From 542e59461f5aad34258a3072024b491701d73ebf Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Fri, 19 Dec 2025 10:25:07 -0700 Subject: [PATCH] fix(x402): Adding default server for x402 payments --- src/bch-js.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/bch-js.js b/src/bch-js.js index 5b11c22..8489791 100644 --- a/src/bch-js.js +++ b/src/bch-js.js @@ -87,7 +87,16 @@ class BCHJS { this.wif = process.env.BCHJSWIF } this.paymentAmountSats = (config && config.paymentAmountSats) || 2000 * 10 - this.bchServerURL = (config && config.bchServerURL) || 'https://free-bch.fullstack.cash' + + // BCH server URL for x402 payments (separate from REST API server) + // This is used when broadcasting payment transactions to the blockchain + if (config && config.bchServerURL && config.bchServerURL !== '') { + this.bchServerURL = config.bchServerURL + } else if (process.env.BCHJSBCHSERVERURL && process.env.BCHJSBCHSERVERURL !== '') { + this.bchServerURL = process.env.BCHJSBCHSERVERURL + } else { + this.bchServerURL = 'https://bch.fullstack.cash' + } const libConfig = { restURL: this.restURL,