@psf/bch-js 7.1.7 → 7.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/bch-js.js +4 -1
- package/test/unit/x402.js +6 -2
package/package.json
CHANGED
package/src/bch-js.js
CHANGED
|
@@ -86,7 +86,10 @@ class BCHJS {
|
|
|
86
86
|
} else if (process.env.BCHJSWIF && process.env.BCHJSWIF !== '') {
|
|
87
87
|
this.wif = process.env.BCHJSWIF
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
|
|
90
|
+
// Most TXs cost about 250 sats. So we'll set the default to 25000 sats,
|
|
91
|
+
// so the mining fee is 1% of the transaction.
|
|
92
|
+
this.paymentAmountSats = (config && config.paymentAmountSats) || 25000
|
|
90
93
|
|
|
91
94
|
// BCH server URL for x402 payments (separate from REST API server)
|
|
92
95
|
// This is used when broadcasting payment transactions to the blockchain
|
package/test/unit/x402.js
CHANGED
|
@@ -20,7 +20,9 @@ describe('#X402 Integration', () => {
|
|
|
20
20
|
})
|
|
21
21
|
|
|
22
22
|
assert.strictEqual(bchjs.wif, '')
|
|
23
|
-
assert.strictEqual(bchjs.paymentAmountSats, 10000)
|
|
23
|
+
// assert.strictEqual(bchjs.paymentAmountSats, 10000)
|
|
24
|
+
assert.strictEqual(typeof bchjs.paymentAmountSats, 'number')
|
|
25
|
+
assert.ok(Number.isInteger(bchjs.paymentAmountSats) && bchjs.paymentAmountSats > 0)
|
|
24
26
|
assert.strictEqual(bchjs.bchServerURL, 'https://bch.fullstack.cash/v6')
|
|
25
27
|
})
|
|
26
28
|
|
|
@@ -59,7 +61,9 @@ describe('#X402 Integration', () => {
|
|
|
59
61
|
})
|
|
60
62
|
|
|
61
63
|
assert.strictEqual(bchjs.wif, '')
|
|
62
|
-
assert.strictEqual(bchjs.paymentAmountSats, 10000)
|
|
64
|
+
// assert.strictEqual(bchjs.paymentAmountSats, 10000)
|
|
65
|
+
assert.strictEqual(typeof bchjs.paymentAmountSats, 'number')
|
|
66
|
+
assert.ok(Number.isInteger(bchjs.paymentAmountSats) && bchjs.paymentAmountSats > 0)
|
|
63
67
|
assert.strictEqual(bchjs.bchServerURL, 'https://bch.fullstack.cash/v6')
|
|
64
68
|
})
|
|
65
69
|
|