@psf/bch-js 6.8.2 → 7.0.1

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.
Files changed (112) hide show
  1. package/README.md +10 -28
  2. package/fix-docs-contrast.sh +38 -0
  3. package/llm-bch-js.md +10451 -0
  4. package/package.json +37 -46
  5. package/src/address.js +12 -23
  6. package/src/bch-js.js +81 -48
  7. package/src/bitcoincash.js +10 -11
  8. package/src/blockchain.js +57 -68
  9. package/src/control.js +11 -22
  10. package/src/crypto.js +3 -3
  11. package/src/dsproof.js +6 -17
  12. package/src/ecash.js +1 -1
  13. package/src/ecpair.js +3 -3
  14. package/src/electrumx.js +32 -44
  15. package/src/encryption.js +8 -17
  16. package/src/generating.js +8 -19
  17. package/src/hdnode.js +5 -5
  18. package/src/mining.js +11 -22
  19. package/src/mnemonic.js +8 -11
  20. package/src/price.js +7 -108
  21. package/src/psf-slp-indexer.js +21 -32
  22. package/src/raw-transactions.js +22 -35
  23. package/src/schnorr.js +5 -16
  24. package/src/script.js +4 -2
  25. package/src/slp/address.js +4 -4
  26. package/src/slp/ecpair.js +4 -4
  27. package/src/slp/nft1.js +6 -6
  28. package/src/slp/slp.js +11 -22
  29. package/src/slp/tokentype1.js +11 -22
  30. package/src/slp/utils.js +9 -19
  31. package/src/transaction-builder.js +5 -5
  32. package/src/transaction.js +5 -5
  33. package/src/util.js +5 -98
  34. package/src/utxo.js +6 -6
  35. package/test/e2e/bch-js-e2e-tests.js +4 -3
  36. package/test/e2e/ipfs/ipfs-e2e.js +8 -2
  37. package/test/e2e/rate-limits/anonymous-rate-limits.js +5 -4
  38. package/test/e2e/rate-limits/basic-auth-rate-limits.js +4 -3
  39. package/test/e2e/rate-limits/free-rate-limits.js +4 -3
  40. package/test/e2e/rate-limits/full-node-rate-limits.js +4 -3
  41. package/test/e2e/rate-limits/indexer-rate-limits.js +4 -3
  42. package/test/e2e/send-raw-transaction-bulk/sendrawtransaction.js +28 -18
  43. package/test/e2e/send-raw-transaction-single/sendrawtransaction.js +28 -18
  44. package/test/e2e/send-token/send-token.js +4 -4
  45. package/test/e2e/util/e2e-util.js +6 -3
  46. package/test/e2e/utxo/unsynced-indexer.js +1 -1
  47. package/test/integration/blockchain.js +5 -5
  48. package/test/integration/control.js +2 -2
  49. package/test/integration/{chains/bchn/dsproof.js → dsproof.js} +6 -2
  50. package/test/integration/electrumx.js +5 -12
  51. package/test/integration/price.js +3 -39
  52. package/test/integration/{chains/bchn/psf-slp-indexer.integration.js → psf-slp-indexer.integration.js} +5 -6
  53. package/test/integration/rawtransaction.js +39 -5
  54. package/test/integration/slp.js +147 -5
  55. package/test/integration/transaction-integration.js +27 -2
  56. package/test/integration/{chains/bchn/utxo-integration.js → utxo-integration.js} +3 -2
  57. package/test/unit/address.js +7 -4
  58. package/test/unit/bitcoin-cash.js +5 -3
  59. package/test/unit/blockchain.js +23 -22
  60. package/test/unit/control.js +6 -6
  61. package/test/unit/crypto.js +5 -3
  62. package/test/unit/dsproof.js +5 -4
  63. package/test/unit/ecash.js +3 -2
  64. package/test/unit/ecpairs.js +6 -4
  65. package/test/unit/electrumx.js +7 -7
  66. package/test/unit/encryption.js +6 -5
  67. package/test/unit/fixtures/bitcore-mock.js +1 -1
  68. package/test/unit/fixtures/block-mock.js +1 -1
  69. package/test/unit/fixtures/blockchain-mock.js +1 -1
  70. package/test/unit/fixtures/dsproof-mock.js +1 -1
  71. package/test/unit/fixtures/electrumx-mock.js +1 -1
  72. package/test/unit/fixtures/encryption-mock.js +1 -1
  73. package/test/unit/fixtures/ipfs-mock.js +1 -1
  74. package/test/unit/fixtures/openbazaar-mock.js +1 -1
  75. package/test/unit/fixtures/price-mocks.js +1 -1
  76. package/test/unit/fixtures/psf-slp-indexer-mock.js +1 -1
  77. package/test/unit/fixtures/rawtransaction-mock.js +1 -1
  78. package/test/unit/fixtures/slp/mock-utils.js +1 -1
  79. package/test/unit/fixtures/transaction-mock.js +1 -1
  80. package/test/unit/fixtures/utxo-mocks.js +1 -1
  81. package/test/unit/generating.js +5 -5
  82. package/test/unit/hdnode.js +6 -4
  83. package/test/unit/mining.js +8 -8
  84. package/test/unit/mnemonic.js +4 -2
  85. package/test/unit/price.js +5 -14
  86. package/test/unit/psf-slp-indexer.js +7 -7
  87. package/test/unit/raw-tranactions.js +14 -13
  88. package/test/unit/scripts.js +8 -6
  89. package/test/unit/slp-address.js +6 -4
  90. package/test/unit/slp-ecpair.js +5 -3
  91. package/test/unit/slp-nft1.js +7 -6
  92. package/test/unit/slp-tokentype1.js +7 -6
  93. package/test/unit/slp-utils.js +8 -7
  94. package/test/unit/transaction-builder.js +7 -4
  95. package/test/unit/transaction-unit.js +5 -4
  96. package/test/unit/util.js +11 -32
  97. package/test/unit/utxo-unit.js +6 -5
  98. package/test/unit/x402.js +193 -0
  99. package/test/integration/chains/abc/psf-slp-indexer-integration.js +0 -38
  100. package/test/integration/chains/abc/rawtransaction.js +0 -73
  101. package/test/integration/chains/abc/utxo-integration.js +0 -38
  102. package/test/integration/chains/bchn/rawtransaction.js +0 -71
  103. package/test/integration/chains/bchn/slp.js +0 -301
  104. package/test/integration/chains/bchn/transaction-integration.js +0 -37
  105. package/test/integration/chains/bchn/util.js +0 -103
  106. package/test/integration/chains/testnet/blockchain.js +0 -260
  107. package/test/integration/chains/testnet/control.js +0 -32
  108. package/test/integration/chains/testnet/electrumx.js +0 -376
  109. package/test/integration/chains/testnet/rawtransaction.js +0 -296
  110. package/test/integration/chains/testnet/slp.js +0 -172
  111. package/test/integration/chains/testnet/test-free-tier.sh +0 -9
  112. package/test/integration/chains/testnet/util.js +0 -109
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@psf/bch-js",
3
- "version": "6.8.2",
3
+ "version": "7.0.1",
4
+ "type": "module",
4
5
  "description": "A JavaScript library for working with Bitcoin Cash, eCash, and SLP Tokens",
5
6
  "author": "Chris Troutner <chris.troutner@gmail.com>",
6
7
  "contributors": [
@@ -9,25 +10,16 @@
9
10
  ],
10
11
  "main": "src/bch-js",
11
12
  "scripts": {
12
- "test": "nyc mocha --trace-warnings --unhandled-rejections=strict --timeout 30000 test/unit/",
13
- "test:integration": "npm run test:integration:bchn",
14
- "test:integration:nft": "export RESTURL=https://bchn.fullstack.cash/v5/ && export IS_USING_FREE_TIER=true && mocha --timeout 30000 -g '#nft1' test/integration/chains/bchn/slp.js",
15
- "test:integration:abc": "export RESTURL=https://abc.fullstack.cash/v5/ && mocha --timeout 30000 test/integration/ && mocha --timeout 30000 test/integration/chains/abc/",
16
- "test:integration:bchn": "export RESTURL=https://bchn.fullstack.cash/v5/ && export IS_USING_FREE_TIER=true && mocha --timeout 30000 test/integration/ && mocha --timeout 30000 test/integration/chains/bchn/",
17
- "test:integration:bchn:slpdb": "export TESTSLP=1 && export RESTURL=https://bchn.fullstack.cash/v5/ && export IS_USING_FREE_TIER=true && mocha --timeout 30000 test/integration/ && mocha --timeout 30000 test/integration/chains/bchn/",
18
- "test:integration:local:abc": "export RESTURL=http://localhost:3000/v5/ && mocha --timeout 30000 test/integration && mocha --timeout 30000 test/integration/chains/abc/",
19
- "test:integration:local:bchn": "export RESTURL=http://localhost:3000/v5/ && mocha --timeout 30000 test/integration/ && mocha --timeout 30000 test/integration/chains/bchn/",
20
- "test:integration:local:testnet": "RESTURL=http://localhost:4000/v5/ mocha --timeout 30000 test/integration/chains/testnet",
21
- "test:integration:decatur:bchn": "export RESTURL=http://192.168.2.129:3000/v5/ && mocha --timeout 30000 test/integration/ && mocha --timeout 30000 test/integration/chains/bchn/",
22
- "test:integration:decatur:abc": "export RESTURL=http://192.168.2.142:3000/v5/ && mocha --timeout 30000 test/integration && mocha --timeout 30000 test/integration/chains/abc/",
23
- "test:integration:temp:bchn": "export RESTURL=http://157.90.174.219:3000/v5/ && mocha --timeout 30000 test/integration/",
24
- "test:temp": "export RESTURL=http://localhost:3000/v5/ && mocha --timeout 30000 -g '#Encryption' test/integration/",
25
- "test:temp2": "mocha --timeout=30000 -g '#TransactionLib' test/unit/",
26
- "test:temp3": "export RESTURL=https://bchn.fullstack.cash/v5/ && mocha --timeout 30000 -g '#DSProof' test/integration/chains/",
27
- "test:temp4": "export RESTURL=http://localhost:3000/v5/ && mocha --timeout 30000 -g '#decodeOpReturn' test/integration/",
28
- "coverage": "nyc report --reporter=text-lcov | coveralls",
29
- "coverage:report": "nyc --reporter=html mocha --timeout 25000 test/unit/",
30
- "docs": "./node_modules/.bin/apidoc -i src/ -o docs",
13
+ "test": "c8 mocha --trace-warnings --unhandled-rejections=strict --timeout 30000 test/unit/",
14
+ "test:integration": "npm run test:integration:local:noauth",
15
+ "test:integration:nft": "export RESTURL=https://bchn.fullstack.cash/v6/ && export IS_USING_FREE_TIER=true && mocha --timeout 30000 -g '#nft1' test/integration/slp.js",
16
+ "test:integration:bchn": "export RESTURL=https://bchn.fullstack.cash/v6/ && export IS_USING_FREE_TIER=true && mocha --timeout 30000 test/integration/",
17
+ "test:integration:local:noauth": "export RESTURL=http://localhost:5942/v6/ && mocha --timeout 30000 test/integration/",
18
+ "test:integration:local:auth": "export RESTURL=http://5.78.147.3:5942/v6/ && export BCHJSBEARERTOKEN=temp01 && mocha --timeout 30000 test/integration/",
19
+ "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
+ "coverage": "nyc --reporter=html mocha --timeout 25000 test/unit/",
22
+ "docs": "./node_modules/.bin/apidoc -i src/ -o docs && ./fix-docs-contrast.sh",
31
23
  "lint": "standard --env mocha --fix"
32
24
  },
33
25
  "license": "MIT",
@@ -42,45 +34,39 @@
42
34
  "@psf/bitcoincash-ops": "2.0.0",
43
35
  "@psf/bitcoincashjs-lib": "4.0.3",
44
36
  "@psf/coininfo": "4.0.0",
45
- "axios": "1.12.2",
37
+ "axios": "1.13.2",
46
38
  "bc-bip68": "1.0.5",
47
- "bchaddrjs-slp": "0.2.5",
39
+ "bchaddrjs-slp": "0.2.14",
48
40
  "bigi": "1.4.2",
49
- "bignumber.js": "9.0.0",
50
- "bip-schnorr": "0.3.0",
51
- "bip38": "2.0.2",
52
- "bip39": "3.0.2",
41
+ "bignumber.js": "9.3.1",
42
+ "bip-schnorr": "0.6.7",
43
+ "bip38": "3.1.1",
44
+ "bip39": "3.1.0",
53
45
  "bip66": "1.1.5",
54
- "bitcoinjs-message": "2.0.0",
46
+ "bitcoinjs-message": "2.2.0",
55
47
  "bs58": "4.0.1",
56
48
  "ecashaddrjs": "1.0.7",
57
- "ini": "1.3.8",
58
- "randombytes": "2.0.6",
59
- "safe-buffer": "5.1.2",
60
- "satoshi-bitcoin": "1.0.4",
61
- "slp-mdm": "0.0.6",
49
+ "ini": "6.0.0",
50
+ "randombytes": "2.1.0",
51
+ "safe-buffer": "5.2.1",
52
+ "satoshi-bitcoin": "1.0.5",
53
+ "slp-mdm": "0.0.7",
62
54
  "slp-parser": "0.0.4",
63
- "wif": "2.0.6"
55
+ "wif": "2.0.6",
56
+ "x402-bch-axios": "1.1.1"
64
57
  },
65
58
  "devDependencies": {
66
- "apidoc": "0.50.5",
67
- "assert": "2.0.0",
59
+ "apidoc": "1.2.0",
60
+ "assert": "2.1.0",
61
+ "c8": "10.1.3",
68
62
  "chai": "4.1.2",
69
- "coveralls": "3.0.2",
70
- "eslint": "7.17.0",
71
- "eslint-config-prettier": "7.1.0",
72
- "eslint-config-standard": "16.0.3",
73
- "eslint-plugin-node": "11.1.0",
74
- "eslint-plugin-prettier": "3.3.1",
75
- "eslint-plugin-standard": "4.0.0",
76
63
  "husky": "4.3.8",
77
64
  "lodash.clonedeep": "4.5.0",
78
- "mocha": "9.2.1",
79
- "node-mocks-http": "1.7.0",
65
+ "mocha": "11.7.5",
80
66
  "nyc": "15.1.0",
81
- "semantic-release": "^19.0.2",
67
+ "semantic-release": "24.2.9",
82
68
  "sinon": "9.2.2",
83
- "standard": "^16.0.4"
69
+ "standard": "17.1.2"
84
70
  },
85
71
  "apidoc": {
86
72
  "title": "bch-js",
@@ -90,5 +76,10 @@
90
76
  "hooks": {
91
77
  "pre-commit": "npm run lint"
92
78
  }
79
+ },
80
+ "standard": {
81
+ "parserOptions": {
82
+ "ecmaVersion": "latest"
83
+ }
93
84
  }
94
85
  }
package/src/address.js CHANGED
@@ -1,7 +1,7 @@
1
- // const axios = require("axios")
2
- const Bitcoin = require('@psf/bitcoincashjs-lib')
3
- const cashaddr = require('ecashaddrjs')
4
- const coininfo = require('@psf/coininfo')
1
+ // import axios from "axios"
2
+ import Bitcoin from '@psf/bitcoincashjs-lib'
3
+ import cashaddr from 'ecashaddrjs'
4
+ import coininfo from '@psf/coininfo'
5
5
 
6
6
  class Address {
7
7
  constructor (config) {
@@ -10,22 +10,11 @@ class Address {
10
10
  else tmp.restURL = config.restURL
11
11
 
12
12
  this.restURL = tmp.restURL
13
- this.apiToken = tmp.apiToken
14
13
  this.authToken = config.authToken
15
14
 
16
- if (this.authToken) {
17
- // Add Basic Authentication token to the authorization header.
18
- this.axiosOptions = {
19
- headers: {
20
- authorization: this.authToken
21
- }
22
- }
23
- } else {
24
- // Add JWT token to the authorization header.
25
- this.axiosOptions = {
26
- headers: {
27
- authorization: `Token ${this.apiToken}`
28
- }
15
+ this.axiosOptions = {
16
+ headers: {
17
+ authorization: this.authToken
29
18
  }
30
19
  }
31
20
  }
@@ -312,28 +301,28 @@ class Address {
312
301
  return {
313
302
  prefix: 'bitcoincash',
314
303
  type: 'P2PKH',
315
- hash: hash,
304
+ hash,
316
305
  format: 'legacy'
317
306
  }
318
307
  case info.main.versions.scripthash:
319
308
  return {
320
309
  prefix: 'bitcoincash',
321
310
  type: 'P2SH',
322
- hash: hash,
311
+ hash,
323
312
  format: 'legacy'
324
313
  }
325
314
  case info.test.versions.public:
326
315
  return {
327
316
  prefix: 'bchtest',
328
317
  type: 'P2PKH',
329
- hash: hash,
318
+ hash,
330
319
  format: 'legacy'
331
320
  }
332
321
  case info.test.versions.scripthash:
333
322
  return {
334
323
  prefix: 'bchtest',
335
324
  type: 'P2SH',
336
- hash: hash,
325
+ hash,
337
326
  format: 'legacy'
338
327
  }
339
328
  default:
@@ -871,4 +860,4 @@ class Address {
871
860
  }
872
861
  }
873
862
 
874
- module.exports = Address
863
+ export default Address
package/src/bch-js.js CHANGED
@@ -7,36 +7,45 @@
7
7
  */
8
8
 
9
9
  // bch-api mainnet.
10
- const DEFAULT_REST_API = 'https://api.fullstack.cash/v5/'
11
10
  // const DEFAULT_REST_API = "http://localhost:3000/v5/"
12
11
 
12
+ // Global npm libraries
13
+ import axios from 'axios'
14
+ import {
15
+ createSigner,
16
+ withPaymentInterceptor,
17
+ createPaymentHeader,
18
+ selectPaymentRequirements
19
+ } from 'x402-bch-axios'
20
+
13
21
  // local deps
14
- const BitcoinCash = require('./bitcoincash')
15
- const Crypto = require('./crypto')
16
- const Util = require('./util')
17
- const Blockchain = require('./blockchain')
18
- const Control = require('./control')
19
- const Generating = require('./generating')
20
- const Mining = require('./mining')
21
- const RawTransactions = require('./raw-transactions')
22
- const Mnemonic = require('./mnemonic')
23
- const Address = require('./address')
24
- const HDNode = require('./hdnode')
25
- const TransactionBuilder = require('./transaction-builder')
26
- const ECPair = require('./ecpair')
27
- const Script = require('./script')
28
- const Price = require('./price')
29
- const Schnorr = require('./schnorr')
30
- const SLP = require('./slp/slp')
31
- const Encryption = require('./encryption')
32
- const Utxo = require('./utxo')
33
- const Transaction = require('./transaction')
34
- const DSProof = require('./dsproof')
35
- const Ecash = require('./ecash')
22
+ import BitcoinCash from './bitcoincash.js'
23
+ import Crypto from './crypto.js'
24
+ import Util from './util.js'
25
+ import Blockchain from './blockchain.js'
26
+ import Control from './control.js'
27
+ import Generating from './generating.js'
28
+ import Mining from './mining.js'
29
+ import RawTransactions from './raw-transactions.js'
30
+ import Mnemonic from './mnemonic.js'
31
+ import Address from './address.js'
32
+ import HDNode from './hdnode.js'
33
+ import TransactionBuilder from './transaction-builder.js'
34
+ import ECPair from './ecpair.js'
35
+ import Script from './script.js'
36
+ import Price from './price.js'
37
+ import Schnorr from './schnorr.js'
38
+ import SLP from './slp/slp.js'
39
+ import Encryption from './encryption.js'
40
+ import Utxo from './utxo.js'
41
+ import Transaction from './transaction.js'
42
+ import DSProof from './dsproof.js'
43
+ import Ecash from './ecash.js'
36
44
 
37
45
  // Indexers
38
- const Electrumx = require('./electrumx')
39
- const PsfSlpIndexer = require('./psf-slp-indexer')
46
+ import Electrumx from './electrumx.js'
47
+ import PsfSlpIndexer from './psf-slp-indexer.js'
48
+ const DEFAULT_REST_API = 'https://api.fullstack.cash/v6/'
40
49
 
41
50
  class BCHJS {
42
51
  constructor (config) {
@@ -47,39 +56,55 @@ class BCHJS {
47
56
  this.restURL = process.env.RESTURL
48
57
  } else this.restURL = DEFAULT_REST_API
49
58
 
50
- // Retrieve the apiToken
51
- this.apiToken = '' // default value.
52
- if (config && config.apiToken && config.apiToken !== '') {
53
- this.apiToken = config.apiToken
54
- } else if (process.env.BCHJSTOKEN && process.env.BCHJSTOKEN !== '') {
55
- this.apiToken = process.env.BCHJSTOKEN
59
+ // Retrieve the Bearer token for simple token authentication.
60
+ this.bearerToken = '' // default value.
61
+ if (config && config.bearerToken && config.bearerToken !== '') {
62
+ this.bearerToken = config.bearerToken
63
+ } else if (process.env.BCHJSBEARERTOKEN && process.env.BCHJSBEARERTOKEN !== '') {
64
+ this.bearerToken = process.env.BCHJSBEARERTOKEN
56
65
  }
57
66
 
58
- // Retrieve the Basic Authentication password.
59
- this.authPass = '' // default value.
60
- if (config && config.authPass && config.authPass !== '') {
61
- this.authPass = config.authPass
62
- } else if (process.env.BCHJSAUTHPASS && process.env.BCHJSAUTHPASS !== '') {
63
- this.authPass = process.env.BCHJSAUTHPASS
67
+ // Generate the authentication token for the authorization header.
68
+ this.authToken = ''
69
+ if (this.bearerToken) {
70
+ this.authToken = `Bearer ${this.bearerToken}`
64
71
  }
65
72
 
66
- // Generate a Basic Authentication token from an auth password
67
- this.authToken = ''
68
- if (this.authPass) {
69
- // console.log(`bch-js initialized with authPass: ${this.authPass}`)
70
- // Generate the header for Basic Authentication.
71
- const combined = `fullstackcash:${this.authPass}`
72
- const base64Credential = Buffer.from(combined).toString('base64')
73
- this.authToken = `Basic ${base64Credential}`
73
+ // x402 payment configuration
74
+ // If a WIF private key is provided, enable x402 automatic payment handling
75
+ this.wif = ''
76
+ if (config && config.wif && config.wif !== '') {
77
+ this.wif = config.wif
78
+ } else if (process.env.BCHJSWIF && process.env.BCHJSWIF !== '') {
79
+ this.wif = process.env.BCHJSWIF
74
80
  }
81
+ this.paymentAmountSats = (config && config.paymentAmountSats) || 2000 * 10
82
+ this.bchServerURL = (config && config.bchServerURL) || 'https://free-bch.fullstack.cash'
75
83
 
76
84
  const libConfig = {
77
85
  restURL: this.restURL,
78
- apiToken: this.apiToken,
79
86
  authToken: this.authToken
80
87
  }
81
88
 
82
- // console.log(`apiToken: ${this.apiToken}`)
89
+ // If WIF is provided, create an axios instance with x402 payment interceptor
90
+ // Otherwise, let sub-modules use their own axios import for backwards compatibility
91
+ if (this.wif) {
92
+ let axiosInstance = axios.create({
93
+ baseURL: this.restURL,
94
+ headers: {
95
+ authorization: this.authToken
96
+ }
97
+ })
98
+
99
+ const signer = createSigner(this.wif, this.paymentAmountSats)
100
+ axiosInstance = withPaymentInterceptor(
101
+ axiosInstance,
102
+ signer,
103
+ { bchServerURL: this.bchServerURL }
104
+ )
105
+
106
+ libConfig.axios = axiosInstance
107
+ }
83
108
 
84
109
  // ElectrumX indexer
85
110
  this.Electrumx = new Electrumx(libConfig)
@@ -117,7 +142,15 @@ class BCHJS {
117
142
  this.eCash = new Ecash()
118
143
 
119
144
  this.PsfSlpIndexer = new PsfSlpIndexer(libConfig)
145
+
146
+ // Expose x402 helper functions for advanced use cases
147
+ this.x402 = {
148
+ createSigner,
149
+ withPaymentInterceptor,
150
+ createPaymentHeader,
151
+ selectPaymentRequirements
152
+ }
120
153
  }
121
154
  }
122
155
 
123
- module.exports = BCHJS
156
+ export default BCHJS
@@ -1,13 +1,12 @@
1
- const Bitcoin = require('@psf/bitcoincashjs-lib')
2
- const sb = require('satoshi-bitcoin')
3
- const bitcoinMessage = require('bitcoinjs-message')
4
- const bs58 = require('bs58')
5
- const bip21 = require('@psf/bip21')
6
- const coininfo = require('@psf/coininfo')
7
- const bip38 = require('bip38')
8
- const wif = require('wif')
9
-
10
- const Buffer = require('safe-buffer').Buffer
1
+ import Bitcoin from '@psf/bitcoincashjs-lib'
2
+ import sb from 'satoshi-bitcoin'
3
+ import bitcoinMessage from 'bitcoinjs-message'
4
+ import bs58 from 'bs58'
5
+ import bip21 from '@psf/bip21'
6
+ import coininfo from '@psf/coininfo'
7
+ import bip38 from 'bip38'
8
+ import wif from 'wif'
9
+ import { Buffer } from 'safe-buffer'
11
10
 
12
11
  class BitcoinCash {
13
12
  constructor (address) {
@@ -519,4 +518,4 @@ class BitcoinCash {
519
518
  }
520
519
  }
521
520
 
522
- module.exports = BitcoinCash
521
+ export default BitcoinCash