Skip to content

Commit

Permalink
debug: bitcoin-cli for deposit
Browse files Browse the repository at this point in the history
  • Loading branch information
DhananjayPurohit committed Jun 4, 2024
1 parent d9358e0 commit b49db0b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions clients/apps/nodejs/test_basic_workflow2.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,14 @@ async function walletTransfersToItselfAndWithdraw(clientConfig, wallet_name) {
const amountInBtc = 0.0001;

// Sending Bitcoin using bitcoin-cli
const sendBitcoinCommand = `bitcoin-cli sendtoaddress ${deposit_info.deposit_address} ${amountInBtc}`;
const execSync = require('child_process').execSync;
execSync(sendBitcoinCommand);
try {
const sendBitcoinCommand = `docker exec $(docker ps -qf "name=mercurylayer_bitcoin_1") bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass sendtoaddress ${deposit_info.deposit_address} ${amountInBtc}`;
execSync(sendBitcoinCommand);
console.log(`Sent ${amountInBtc} BTC to ${deposit_info.deposit_address}`);
} catch (error) {
console.error('Error sending Bitcoin:', error.message);
return;
}

let coin = undefined;

Expand Down

0 comments on commit b49db0b

Please sign in to comment.