From 296e370dd08a35850b3fdd8200047147f708933a Mon Sep 17 00:00:00 2001 From: DhananjayPurohit Date: Tue, 13 Aug 2024 22:38:17 +0530 Subject: [PATCH] feat: add wallet creation for esplora --- .github/workflows/tests.yml | 7 +++++++ clients/tests/web/server-regtest.cjs | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bf800a59..f5c31bf1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -54,6 +54,13 @@ jobs: echo "New Wallet Address: $address" docker exec $container_id bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass generatetoaddress 101 "$address" docker exec $container_id bitcoin-cli -regtest -rpcuser=user -rpcpassword=pass sendtoaddress bcrt1pcngfxjdkf4r2h26k52dh5nunxg8m68uf4lkfhmfjvjj6agfkm5jqmftw4e 0.0001 + - name: Create wallet for esplora + run: | + container_id=$(docker ps -qf "name=esplora-container") + echo "Container ID: $container_id" + docker logs $container_id + wallet_name="esplora_wallet" + docker exec $container_id cli createwallet $wallet_name - name: Wait for services to be ready run: | sleep 60 # Wait for lnd to sync with latest block diff --git a/clients/tests/web/server-regtest.cjs b/clients/tests/web/server-regtest.cjs index e11c26ec..b68d64e6 100644 --- a/clients/tests/web/server-regtest.cjs +++ b/clients/tests/web/server-regtest.cjs @@ -10,7 +10,7 @@ app.use(bodyParser.json()) app.use(cors()) async function getnewaddress() { - const generateBlockCommand = `docker exec $(docker ps -qf "name=esplora-container") cli -rpcconnect=bitcoind -rpcuser=user -rpcpassword=pass getnewaddress`; + const generateBlockCommand = `docker exec $(docker ps -qf "name=esplora-container") cli getnewaddress`; const { stdout, stderr } = await exec(generateBlockCommand); if (stderr) { throw new Error(`Error: ${stderr}`); @@ -20,13 +20,13 @@ async function getnewaddress() { async function generateBlocks(numBlocks) { const address = await getnewaddress(); - const generateBlockCommand = `docker exec $(docker ps -qf "name=esplora-container") cli -rpcconnect=bitcoind -rpcuser=user -rpcpassword=pass generatetoaddress ${numBlocks} ${address}`; + const generateBlockCommand = `docker exec $(docker ps -qf "name=esplora-container") cli generatetoaddress ${numBlocks} ${address}`; await exec(generateBlockCommand); } async function depositCoin(amount, address) { const amountInBtc = amount / 100000000; - const sendBitcoinCommand = `docker exec $(docker ps -qf "name=esplora-container") cli -rpcconnect=bitcoind -rpcuser=user -rpcpassword=pass sendtoaddress ${address} ${amountInBtc}`; + const sendBitcoinCommand = `docker exec $(docker ps -qf "name=esplora-container") cli sendtoaddress ${address} ${amountInBtc}`; await exec(sendBitcoinCommand); }