Skip to content

Commit

Permalink
feat: setup esplora for actions
Browse files Browse the repository at this point in the history
  • Loading branch information
DhananjayPurohit committed Aug 8, 2024
1 parent 90efed7 commit 51a9a0e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ jobs:
run: |
cd clients/apps/nodejs
npm install
npm install mocha -g
- name: Install Node.js dependencies for web client
run: |
cd clients/tests/web
Expand All @@ -144,9 +145,14 @@ jobs:
node test_basic_workflow2.js
node test_atomic_swap.js
mocha ./test/tb04-simple-lightning-latch.mjs --exit
- name: Run start-test-components.sh for web client tests
run: |
cd clients/tests/web
chmod +x start-test-components.sh
./start-test-components.sh
- name: Run web client Tests
run: |
cd clients/libs/web
cd clients/tests/web
npx vitest --browser.name=chromium --browser.headless
- name: Tear Down
run: |
Expand Down
4 changes: 2 additions & 2 deletions clients/libs/nodejs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const sqlite_manager = require('./sqlite_manager');
const { v4: uuidv4 } = require('uuid');

const wallet_manager = require('./wallet');
const bitcoinjs = require("bitcoinjs-lib");
const lightningPayReq = require("bolt11");

const getDatabase = async (clientConfig) => {
const databaseFile = clientConfig.databaseFile;
Expand Down Expand Up @@ -250,7 +250,7 @@ const retrievePreImage = async (clientConfig, walletName, statechainId, batchId)

const verifyInvoice = async (clientConfig, batchId, paymentRequest) => {

const decodedInvoice = bitcoinjs.decode(paymentRequest);
const decodedInvoice = lightningPayReq.decode(paymentRequest);
let paymentHash = await getPaymentHash(clientConfig, batchId);

return paymentHash === decodedInvoice.tagsObject.payment_hash;
Expand Down
1 change: 1 addition & 0 deletions clients/libs/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@mempool/electrum-client": "^1.1.9",
"axios": "^1.5.1",
"bitcoinjs-lib": "^6.1.5",
"bolt11": "^1.4.1",
"commander": "^11.1.0",
"config": "^3.3.9",
"mercury-wasm": "file:../../../wasm/node_pkg/debug",
Expand Down
2 changes: 1 addition & 1 deletion clients/tests/web/start-test-components.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ node server-regtest.cjs &
NODE_PID=$!

# Run docker command in the background without -it flags
docker run --name esplora-container -p 50001:50001 -p 8094:80 \
docker run --name esplora-container -p 50002:50002 -p 8094:80 \
--volume $PWD/data_bitcoin_regtest:/data \
--env CORS_ALLOW='*' --rm \
blockstream/esplora \
Expand Down

0 comments on commit 51a9a0e

Please sign in to comment.