Skip to content

Commit

Permalink
Merge pull request #289 from utxostack/feat/integration-tests
Browse files Browse the repository at this point in the history
test: Switching from Testnet3 to Signet for testing
  • Loading branch information
Dawn-githup authored Nov 25, 2024
2 parents ebcefc3 + 9df8158 commit c3186c4
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 17 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ jobs:
if: ${{ matrix.env_set == 'xudt' }}
run: pnpm run integration:xudt
env:
VITE_SERVICE_URL: https://btc-assets-api.testnet.mibao.pro
VITE_SERVICE_TOKEN: ${{ secrets.TESTNET_SERVICE_TOKEN }}
VITE_SERVICE_ORIGIN: https://btc-assets-api.testnet.mibao.pro
VITE_SERVICE_URL: https://api.signet.rgbpp.io
VITE_SERVICE_TOKEN: ${{ secrets.SIGNET_SERVICE_TOKEN }}
VITE_SERVICE_ORIGIN: https://api.signet.rgbpp.io
INTEGRATION_CKB_PRIVATE_KEY: ${{ secrets.INTEGRATION_CKB_PRIVATE_KEY }}
INTEGRATION_BTC_PRIVATE_KEY: ${{ secrets.INTEGRATION_BTC_PRIVATE_KEY }}

Expand All @@ -60,8 +60,8 @@ jobs:
if: ${{ matrix.env_set == 'spore' }}
run: pnpm run integration:spore
env:
VITE_SERVICE_URL: https://btc-assets-api.testnet.mibao.pro
VITE_SERVICE_TOKEN: ${{ secrets.TESTNET_SERVICE_TOKEN }}
VITE_SERVICE_ORIGIN: https://btc-assets-api.testnet.mibao.pro
VITE_SERVICE_URL: https://api.signet.rgbpp.io
VITE_SERVICE_TOKEN: ${{ secrets.SIGNET_SERVICE_TOKEN }}
VITE_SERVICE_ORIGIN: https://api.signet.rgbpp.io
INTEGRATION_CKB_PRIVATE_KEY: ${{ secrets.INTEGRATION_CKB_SPORE_PRIVATE_KEY }}
INTEGRATION_BTC_PRIVATE_KEY: ${{ secrets.INTEGRATION_BTC_SPORE_PRIVATE_KEY }}
2 changes: 1 addition & 1 deletion tests/rgbpp/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dotenv.config({ path: __dirname + '/.env' });

export const isMainnet = false;

export const BTC_TESTNET_TYPE = 'Testnet3';
export const BTC_TESTNET_TYPE = 'Signet';

export const collector = new Collector({
ckbNodeUrl: 'https://testnet.ckb.dev/rpc',
Expand Down
2 changes: 1 addition & 1 deletion tests/rgbpp/shared/prepare-utxo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const prepareUtxo = async (index: string | number) => {
console.log(tx.toHex());

const { txid: btcTxId } = await btcService.sendBtcTransaction(tx.toHex());
console.log(`explorer: https://mempool.space/testnet/tx/${btcTxId}`);
console.log(`explorer: https://mempool.space/signet/tx/${btcTxId}`);

writeStepLog(String(index), {
txid: btcTxId,
Expand Down
2 changes: 1 addition & 1 deletion tests/rgbpp/spore/4-transfer-spore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const transferSpore = async ({ sporeRgbppLockArgs, toBtcAddress, sporeTypeArgs }

const { txId: btcTxId } = await signAndSendPsbt(psbt, btcAccount, btcService);
console.log('BTC TxId: ', btcTxId);
console.log(`explorer: https://mempool.space/testnet/tx/${btcTxId}`);
console.log(`explorer: https://mempool.space/signet/tx/${btcTxId}`);

await btcService.sendRgbppCkbTransaction({ btc_txid: btcTxId, ckb_virtual_result: ckbVirtualTxResult });

Expand Down
2 changes: 1 addition & 1 deletion tests/rgbpp/spore/5-leap-spore-to-ckb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const leapSporeFromBtcToCkb = async ({ sporeRgbppLockArgs, toCkbAddress, sporeTy

const { txId: btcTxId } = await signAndSendPsbt(psbt, btcAccount, btcService);
console.log('BTC TxId: ', btcTxId);
console.log(`explorer: https://mempool.space/testnet/tx/${btcTxId}`);
console.log(`explorer: https://mempool.space/signet/tx/${btcTxId}`);

await btcService.sendRgbppCkbTransaction({ btc_txid: btcTxId, ckb_virtual_result: ckbVirtualTxResult });

Expand Down
2 changes: 1 addition & 1 deletion tests/rgbpp/spore/launch/2-create-cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const createCluster = async ({ ownerRgbppLockArgs }: { ownerRgbppLockArgs: strin
index: 1,
});
console.log('BTC TxId: ', btcTxId);
console.log(`explorer: https://mempool.space/testnet/tx/${btcTxId}`);
console.log(`explorer: https://mempool.space/signet/tx/${btcTxId}`);

const interval = setInterval(async () => {
try {
Expand Down
2 changes: 1 addition & 1 deletion tests/rgbpp/spore/launch/3-create-spores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const createSpores = async ({ clusterRgbppLockArgs, receivers }: SporeCreatePara
txid: btcTxId,
});
console.log('BTC TxId: ', btcTxId);
console.log(`explorer: https://mempool.space/testnet/tx/${btcTxId}`);
console.log(`explorer: https://mempool.space/signet/tx/${btcTxId}`);

const interval = setInterval(async () => {
try {
Expand Down
2 changes: 1 addition & 1 deletion tests/rgbpp/xudt/2-btc-transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const transfer = async ({ rgbppLockArgsList, toBtcAddress, xudtTypeArgs, transfe
const psbt = bitcoin.Psbt.fromHex(btcPsbtHex);
const { txId: btcTxId } = await signAndSendPsbt(psbt, btcAccount, btcService);
console.log(`BTC ${BTC_TESTNET_TYPE} TxId: ${btcTxId}`);
console.log(`explorer: https://mempool.space/testnet/tx/${btcTxId}`);
console.log(`explorer: https://mempool.space/signet/tx/${btcTxId}`);

writeStepLog('transfer-id', {
txid: btcTxId,
Expand Down
2 changes: 1 addition & 1 deletion tests/rgbpp/xudt/3-btc-leap-ckb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const leapFromBtcToCKB = async ({ rgbppLockArgsList, toCkbAddress, xudtTypeArgs,

const { txId: btcTxId } = await signAndSendPsbt(psbt, btcAccount, btcService);
console.log(`BTC ${BTC_TESTNET_TYPE} TxId: ${btcTxId}`);
console.log(`explorer: https://mempool.space/testnet/tx/${btcTxId}`);
console.log(`explorer: https://mempool.space/signet/tx/${btcTxId}`);

await btcService.sendRgbppCkbTransaction({ btc_txid: btcTxId, ckb_virtual_result: ckbVirtualTxResult });

Expand Down
9 changes: 6 additions & 3 deletions tests/rgbpp/xudt/btc-transfer-all/1-btc-transfer-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { buildRgbppTransferAllTxs, sendRgbppTxGroups } from 'rgbpp';
import { btcDataSource, isMainnet, collector, btcAccount } from '../../env';
import { signPsbt } from '../../../../examples/rgbpp/shared/btc-account';
import { saveCkbVirtualTxResult } from '../../../../examples/rgbpp/shared/utils';
import { readStepLog } from '../../shared/utils';
import { getFastestFeeRate, readStepLog } from '../../shared/utils';

interface TestParams {
xudtTypeArgs: string;
Expand All @@ -12,6 +12,9 @@ interface TestParams {
}

const rgbppTransferAllTxs = async ({ xudtTypeArgs, fromAddress, toAddress }: TestParams) => {
const feeRate = await getFastestFeeRate();
console.log('feeRate = ', feeRate);

const result = await buildRgbppTransferAllTxs({
ckb: {
xudtTypeArgs,
Expand All @@ -22,7 +25,7 @@ const rgbppTransferAllTxs = async ({ xudtTypeArgs, fromAddress, toAddress }: Tes
fromAddress: fromAddress,
toAddress: toAddress,
dataSource: btcDataSource,
feeRate: 5,
feeRate: feeRate,
},
isMainnet,
});
Expand Down Expand Up @@ -63,7 +66,7 @@ const rgbppTransferAllTxs = async ({ xudtTypeArgs, fromAddress, toAddress }: Tes

const successfulTxIds = sentGroups
.filter((group) => group.btcTxId)
.map((group) => `https://mempool.space/testnet/tx/${group.btcTxId}`);
.map((group) => `https://mempool.space/signet/tx/${group.btcTxId}`);

console.log('Successful Transactions:', successfulTxIds.join('\n'));

Expand Down

1 comment on commit c3186c4

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New snapshot version of the rgbpp-sdk packages have been released:

Name Version
@rgbpp-sdk/btc 0.0.0-snap-20241125101550
@rgbpp-sdk/ckb 0.0.0-snap-20241125101550
rgbpp 0.0.0-snap-20241125101550
@rgbpp-sdk/service 0.0.0-snap-20241125101550

Please sign in to comment.