Skip to content

Commit 987ae3f

Browse files
committed
renamed and reorder parameters in getInformationReadyForRegister files for consistency
1 parent 765c82b commit 987ae3f

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

tool/getInformationReadyForRegisterBtcTransaction.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@ const mempoolJS = require("@mempool/mempool.js");
22
const pmtBuilder = require("../index");
33
const { 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

tool/getInformationReadyForRegisterCoinbaseBtcTransaction.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const getAllTxs = async (transactionsClient, txIds) => {
6262
return txs;
6363
};
6464

65-
const getInformationReadyForRegisterCoinbaseBtcTransaction = async (transactionHash, network) => {
65+
const getInformationReadyForRegisterCoinbaseBtcTransaction = async (network, txHash) => {
6666

6767
const bitcoinClients = mempoolJS({
6868
hostname: 'mempool.space',
@@ -73,7 +73,7 @@ const getInformationReadyForRegisterCoinbaseBtcTransaction = async (transactionH
7373
blocksClient = bitcoinClients.bitcoin.blocks;
7474
transactionsClient = bitcoinClients.bitcoin.transactions;
7575

76-
const transaction = await transactionsClient.getTx({ txid: transactionHash });
76+
const transaction = await transactionsClient.getTx({ txid: txHash });
7777

7878
const blockHash = transaction.status.block_hash;
7979
const blockHeight = transaction.status.block_height;
@@ -114,9 +114,9 @@ const getInformationReadyForRegisterCoinbaseBtcTransaction = async (transactionH
114114
try {
115115

116116
const network = process.argv[2];
117-
const transactionHash = process.argv[3];
117+
const txHash = process.argv[3];
118118

119-
const informationReadyForRegisterCoinbaseBtcTransaction = await getInformationReadyForRegisterCoinbaseBtcTransaction(transactionHash, network);
119+
const informationReadyForRegisterCoinbaseBtcTransaction = await getInformationReadyForRegisterCoinbaseBtcTransaction(network, txHash);
120120

121121
console.log('Transaction Information ready for registerCoinbaseBtcTransaction: ', informationReadyForRegisterCoinbaseBtcTransaction);
122122

0 commit comments

Comments
 (0)