Skip to content

Commit

Permalink
fix: Resolve integration:xudt test failure issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Dawn-githup committed Jun 17, 2024
1 parent a4dbb33 commit 775e36a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/rgbpp/xudt/1-ckb-leap-btc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { serializeScript } from '@nervosnetwork/ckb-sdk-utils';
import { genCkbJumpBtcVirtualTx } from 'rgbpp';
import { getSecp256k1CellDep, buildRgbppLockArgs, getXudtTypeScript } from 'rgbpp/ckb';
import { CKB_PRIVATE_KEY, isMainnet, collector, ckbAddress } from '../env';
import { CKB_PRIVATE_KEY, isMainnet, collector, ckbAddress, BTC_TESTNET_TYPE } from '../env';
import { readStepLog } from '../shared/utils';

interface LeapToBtcParams {
Expand All @@ -28,19 +28,20 @@ const leapFromCkbToBtc = async ({ outIndex, btcTxId, xudtTypeArgs, transferAmoun
toRgbppLockArgs,
xudtTypeBytes: serializeScript(xudtType),
transferAmount,
btcTestnetType: BTC_TESTNET_TYPE,
});

const emptyWitness = { lock: '', inputType: '', outputType: '' };
const unsignedTx: CKBComponents.RawTransactionToSign = {
...ckbRawTx,
cellDeps: [...ckbRawTx.cellDeps, getSecp256k1CellDep(false)],
cellDeps: [...ckbRawTx.cellDeps, getSecp256k1CellDep(isMainnet)],
witnesses: [emptyWitness, ...ckbRawTx.witnesses.slice(1)],
};

const signedTx = collector.getCkb().signTransaction(CKB_PRIVATE_KEY)(unsignedTx);

const txHash = await collector.getCkb().rpc.sendTransaction(signedTx, 'passthrough');
console.info(`Rgbpp asset has been jumped from CKB to BTC and tx hash is ${txHash}`);
console.info(`Rgbpp asset has been jumped from CKB to BTC and CKB tx hash is ${txHash}`);
console.info(`explorer: https://pudge.explorer.nervos.org/transaction/${txHash}`);
});
};
Expand Down

0 comments on commit 775e36a

Please sign in to comment.