@psf/bch-js 7.1.1 → 7.1.3
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 +4 -4
- package/src/bch-js.js +6 -3
- package/src/dsproof.js +2 -1
- package/test/unit/x402.js +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@psf/bch-js",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A JavaScript library for working with Bitcoin Cash and SLP Tokens",
|
|
6
6
|
"author": "Chris Troutner <chris.troutner@gmail.com>",
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"test": "export RESTURL=http://localhost:5942/v6 && c8 mocha --trace-warnings --unhandled-rejections=strict --timeout 30000 test/unit/",
|
|
14
14
|
"test:integration": "npm run test:integration:local:noauth",
|
|
15
15
|
"test:integration:fullstack:free": "export RESTURL=https://bch.fullstack.cash/v6 && mocha --timeout 60000 test/integration/",
|
|
16
|
-
"test:integration:fullstack:x402": "export RESTURL=https://x402-bch.fullstack.cash/v6 && export BCHJSWIF=L1eYaneXDDXy8VDig4Arwe8wYHbhtsA5wuQvwsKwhaYeneoZuKG4 && mocha --timeout
|
|
16
|
+
"test:integration:fullstack:x402": "export RESTURL=https://x402-bch.fullstack.cash/v6 && export BCHJSWIF=L1eYaneXDDXy8VDig4Arwe8wYHbhtsA5wuQvwsKwhaYeneoZuKG4 && mocha --timeout 120000 test/integration/",
|
|
17
17
|
"test:integration:local:noauth": "export RESTURL=http://localhost:5942/v6 && mocha --timeout 30000 test/integration/",
|
|
18
18
|
"test:integration:local:auth": "export RESTURL=http://192.168.1.115:5942/v6 && export BCHJSBEARERTOKEN=temp01 && mocha --timeout 30000 test/integration/",
|
|
19
|
+
"test:integration:local:x402": "export RESTURL=http://localhost:5942/v6 && export BCHJSWIF=L1eYaneXDDXy8VDig4Arwe8wYHbhtsA5wuQvwsKwhaYeneoZuKG4 && mocha --timeout 1200000 test/integration/",
|
|
19
20
|
"test:integration:decatur": "export RESTURL=http://192.168.2.127:5942/v6 && mocha --timeout 30000 test/integration/",
|
|
20
|
-
"test:integration:x402": "export RESTURL=http://localhost:5942/v6 && export BCHJSWIF=L1eYaneXDDXy8VDig4Arwe8wYHbhtsA5wuQvwsKwhaYeneoZuKG4 && mocha --timeout 30000 test/integration/",
|
|
21
21
|
"coverage": "nyc --reporter=html mocha --timeout 25000 test/unit/",
|
|
22
22
|
"docs": "./node_modules/.bin/apidoc -i src/ -o docs && ./fix-docs-contrast.sh",
|
|
23
23
|
"lint": "standard --env mocha --fix"
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"slp-mdm": "0.0.7",
|
|
53
53
|
"slp-parser": "0.0.4",
|
|
54
54
|
"wif": "2.0.6",
|
|
55
|
-
"x402-bch-axios": "1.1.
|
|
55
|
+
"x402-bch-axios": "1.1.2"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"apidoc": "1.2.0",
|
package/src/bch-js.js
CHANGED
|
@@ -86,7 +86,7 @@ class BCHJS {
|
|
|
86
86
|
} else if (process.env.BCHJSWIF && process.env.BCHJSWIF !== '') {
|
|
87
87
|
this.wif = process.env.BCHJSWIF
|
|
88
88
|
}
|
|
89
|
-
this.paymentAmountSats = (config && config.paymentAmountSats) || 2000 *
|
|
89
|
+
this.paymentAmountSats = (config && config.paymentAmountSats) || 2000 * 5
|
|
90
90
|
|
|
91
91
|
// BCH server URL for x402 payments (separate from REST API server)
|
|
92
92
|
// This is used when broadcasting payment transactions to the blockchain
|
|
@@ -95,7 +95,7 @@ class BCHJS {
|
|
|
95
95
|
} else if (process.env.BCHJSBCHSERVERURL && process.env.BCHJSBCHSERVERURL !== '') {
|
|
96
96
|
this.bchServerURL = process.env.BCHJSBCHSERVERURL
|
|
97
97
|
} else {
|
|
98
|
-
this.bchServerURL = 'https://bch.fullstack.cash'
|
|
98
|
+
this.bchServerURL = 'https://bch.fullstack.cash/v6/'
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
const libConfig = {
|
|
@@ -117,7 +117,10 @@ class BCHJS {
|
|
|
117
117
|
axiosInstance = withPaymentInterceptor(
|
|
118
118
|
axiosInstance,
|
|
119
119
|
signer,
|
|
120
|
-
{
|
|
120
|
+
{
|
|
121
|
+
apiType: 'rest-api',
|
|
122
|
+
bchServerURL: this.bchServerURL
|
|
123
|
+
}
|
|
121
124
|
)
|
|
122
125
|
|
|
123
126
|
libConfig.axios = axiosInstance
|
package/src/dsproof.js
CHANGED
|
@@ -6,7 +6,8 @@ class DSProof {
|
|
|
6
6
|
constructor (config) {
|
|
7
7
|
this.restURL = config.restURL
|
|
8
8
|
this.authToken = config.authToken
|
|
9
|
-
|
|
9
|
+
// Use the shared axios instance if provided, otherwise fall back to axios
|
|
10
|
+
this.axios = config.axios || axios
|
|
10
11
|
|
|
11
12
|
this.axiosOptions = {
|
|
12
13
|
headers: {
|
package/test/unit/x402.js
CHANGED
|
@@ -20,8 +20,8 @@ describe('#X402 Integration', () => {
|
|
|
20
20
|
})
|
|
21
21
|
|
|
22
22
|
assert.strictEqual(bchjs.wif, '')
|
|
23
|
-
assert.strictEqual(bchjs.paymentAmountSats,
|
|
24
|
-
assert.strictEqual(bchjs.bchServerURL, 'https://bch.fullstack.cash')
|
|
23
|
+
assert.strictEqual(bchjs.paymentAmountSats, 10000)
|
|
24
|
+
assert.strictEqual(bchjs.bchServerURL, 'https://bch.fullstack.cash/v6/')
|
|
25
25
|
})
|
|
26
26
|
|
|
27
27
|
it('should accept wif in config', () => {
|
|
@@ -59,8 +59,8 @@ describe('#X402 Integration', () => {
|
|
|
59
59
|
})
|
|
60
60
|
|
|
61
61
|
assert.strictEqual(bchjs.wif, '')
|
|
62
|
-
assert.strictEqual(bchjs.paymentAmountSats,
|
|
63
|
-
assert.strictEqual(bchjs.bchServerURL, 'https://bch.fullstack.cash')
|
|
62
|
+
assert.strictEqual(bchjs.paymentAmountSats, 10000)
|
|
63
|
+
assert.strictEqual(bchjs.bchServerURL, 'https://bch.fullstack.cash/v6/')
|
|
64
64
|
})
|
|
65
65
|
|
|
66
66
|
it('should read WIF from BCHJSWIF environment variable', () => {
|
|
@@ -168,7 +168,7 @@ describe('#X402 Integration', () => {
|
|
|
168
168
|
})
|
|
169
169
|
|
|
170
170
|
assert.strictEqual(bchjs.restURL, customRestURL)
|
|
171
|
-
assert.strictEqual(bchjs.bchServerURL, 'https://bch.fullstack.cash')
|
|
171
|
+
assert.strictEqual(bchjs.bchServerURL, 'https://bch.fullstack.cash/v6/')
|
|
172
172
|
})
|
|
173
173
|
})
|
|
174
174
|
|