@@ -2,27 +2,27 @@ const mempoolJS = require("@mempool/mempool.js");
22const pmtBuilder = require ( "../index" ) ;
33const { getWtxids, getTransactionWithRetry } = require ( "./pmt-builder-utils" ) ;
44
5- const getInformationReadyForRegisterBtcTransaction = async ( transactionHash , network ) => {
5+ const getInformationReadyForRegisterBtcTransaction = async ( network , txHash ) => {
66 const bitcoin = mempoolJS ( {
77 hostname : 'mempool.space' ,
88 network // 'testnet' | 'mainnet'
99 } ) ;
1010
1111 const transactionsClient = bitcoin . bitcoin . transactions ;
12- const transaction = await transactionsClient . getTx ( { txid : transactionHash } ) ;
12+ const transaction = await transactionsClient . getTx ( { txid : txHash } ) ;
1313
1414 const blockHash = transaction . status . block_hash ;
1515 const blocksClient = bitcoin . bitcoin . blocks ;
1616 const blockTxids = await blocksClient . getBlockTxids ( { hash : blockHash } ) ;
1717
18- const resultPmt = pmtBuilder . buildPMT ( blockTxids , transactionHash ) ;
18+ const resultPmt = pmtBuilder . buildPMT ( blockTxids , txHash ) ;
1919 const pmt = resultPmt . hex ;
2020 const blockHeight = transaction . status . block_height ;
2121
22- const { blockWtxids, targetWtxid } = await getWtxids ( transactionsClient , blockTxids , transactionHash ) ;
22+ const { blockWtxids, targetWtxid } = await getWtxids ( transactionsClient , blockTxids , txHash ) ;
2323 const resultPmtConsideringWitness = pmtBuilder . buildPMT ( blockWtxids , targetWtxid ) ;
2424 const pmtConsideringWitness = resultPmtConsideringWitness . hex ;
25- const rawTargetBtcTransaction = await getTransactionWithRetry ( transactionsClient , transactionHash ) ;
25+ const rawTargetBtcTransaction = await getTransactionWithRetry ( transactionsClient , txHash ) ;
2626
2727 const informationReadyForRegisterBtcTransaction = {
2828 tx : `0x${ rawTargetBtcTransaction } ` ,
@@ -37,9 +37,9 @@ const getInformationReadyForRegisterBtcTransaction = async (transactionHash, net
3737( async ( ) => {
3838 try {
3939 const network = process . argv [ 2 ] ;
40- const transactionHash = process . argv [ 3 ] ;
40+ const txHash = process . argv [ 3 ] ;
4141
42- const informationReadyForRegisterBtcTransaction = await getInformationReadyForRegisterBtcTransaction ( transactionHash , network ) ;
42+ const informationReadyForRegisterBtcTransaction = await getInformationReadyForRegisterBtcTransaction ( network , txHash ) ;
4343
4444 console . log ( 'Transaction Information ready for registerBtcTransaction: ' , informationReadyForRegisterBtcTransaction ) ;
4545
0 commit comments