mirror of
https://github.com/Permissionless-Software-Foundation/bch-js.git
synced 2026-09-21 16:51:59 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7649eeffec | ||
|
|
f7d79dea28 | ||
|
|
2f1d6995a6 | ||
|
|
462885e97b | ||
|
|
24774a706e | ||
|
|
d5f7e6aa7f | ||
|
|
04e3346086 | ||
|
|
cb2a90fc93 | ||
|
|
66c2d3ab22 | ||
|
|
89d13fe241 | ||
|
|
ad0b1b5ddb | ||
|
|
ae30b89d68 | ||
|
|
2e88d26ff2 | ||
|
|
b1745d37e0 | ||
|
|
9733c07e04 | ||
|
|
430f5f015e | ||
|
|
9e76b34d05 | ||
|
|
61078b2e91 | ||
|
|
82733a7e1a | ||
|
|
3685ea1541 | ||
|
|
5f217af3e9 | ||
|
|
e2ca3cfb00 | ||
|
|
690520d72e | ||
|
|
36660f3bc9 | ||
|
|
80ee5c8d31 | ||
|
|
b7e04522ce | ||
|
|
19f243428d | ||
|
|
16079c8d04 | ||
|
|
6743ca5fa9 | ||
|
|
ec046d3ef7 |
@@ -7,21 +7,16 @@
|
||||
|
||||
[bch-js](https://www.npmjs.com/package/@psf/bch-js) is a JavaScript npm library for creating web and mobile apps that can interact with the Bitcoin Cash (BCH) blockchain. bch-js contains a toolbox of handy tools, and an easy API for talking with [psf-bch-api REST API](https://github.com/Permissionless-Software-Foundation/psf-bch-api). [FullStack.cash](https://fullstack.cash) offers paid cloud access to psf-bch-api. You can run your own infrastructure by following documentation on [CashStack.info](https://cashstack.info).
|
||||
|
||||
### Quick Start Videos:
|
||||
|
||||
YouTube walk-through videos to help you get started:
|
||||
|
||||
- [Introduction to bch-js and the bch-js-examples repository](https://youtu.be/GD2i1ZUiyrk)
|
||||
|
||||
### Quick Links
|
||||
|
||||
- [Code Examples](https://github.com/Permissionless-Software-Foundation/psf-js-examples) using bch-js
|
||||
- [npm Library](https://www.npmjs.com/package/@psf/bch-js)
|
||||
- [Documentation](https://bchjs.fullstack.cash/)
|
||||
- [Examples](https://github.com/Permissionless-Software-Foundation/bch-js-examples)
|
||||
- [API Reference](https://bchjs.fullstack.cash/)
|
||||
- [x402-bch.fullstack.cash](https://x402-bch.fullstack.cash) - The REST API this library talks to by default.
|
||||
- [FullStack.cash](https://fullstack.cash) - cloud-based infrastructure for application developers.
|
||||
- [Permissionless Software Foundation](https://psfoundation.cash) - The organization that maintains this library.
|
||||
- [CashStack.info](https://cashstack.info) - bch-js is part of the Cash Stack, a JavaScript framework for writing web 2 and web 3 business applications.
|
||||
- [Permissionless Software Foundation](https://psfoundation.info) - The organization that maintains this library.
|
||||
|
||||
|
||||
### Quick Notes
|
||||
|
||||
@@ -115,24 +110,11 @@ const bchjs2 = new BCHJS({
|
||||
|
||||
[bch-wallet-web3-spa](https://github.com/Permissionless-Software-Foundation/bch-wallet-web3-spa) is a React web app template using bch-js and minimal-slp-wallet.
|
||||
|
||||
## Features
|
||||
|
||||
- [ECMAScript 2017 standard JavaScript](https://en.wikipedia.org/wiki/ECMAScript#8th_Edition_-_ECMAScript_2017) used instead of TypeScript. Works
|
||||
natively with node.js v10 or higher.
|
||||
|
||||
- Full SLP tokens support: bch-js has full support for all SLP token functionality, including send, mint, and genesis transactions. It also fully supports all aspects of [non-fugible tokans (NFTs)](https://www.youtube.com/watch?v=vvlpYUx6HRs).
|
||||
|
||||
- [Semantic Release](https://github.com/semantic-release/semantic-release) for
|
||||
continuous delivery using semantic versioning.
|
||||
|
||||
- [IPFS](https://ipfs.io) and [Radicle](https://radicle.xyz) uploads of all files and dependencies, to backup
|
||||
dependencies in case they are ever inaccessible from GitHub or npm.
|
||||
|
||||
## Documentation:
|
||||
|
||||
Full documentation for this library can be found here:
|
||||
|
||||
- [Documentation](https://bchjs.fullstack.cash/)
|
||||
- [API Reference](https://bchjs.fullstack.cash/)
|
||||
|
||||
bch-js uses [APIDOC](http://apidocjs.com/) so that documentation and working code
|
||||
live in the same repository. To generate the documentation:
|
||||
@@ -154,17 +136,6 @@ This open source software is developed and maintained by the [Permissionless Sof
|
||||
<p>bitcoincash:qqsrke9lh257tqen99dkyy2emh4uty0vky9y0z0lsr</p>
|
||||
</div>
|
||||
|
||||
|
||||
## IPFS & Radicle Releases
|
||||
|
||||
Copies of this repository are also published on [IPFS](https://ipfs.io).
|
||||
|
||||
- v6.2.10: `bafybeifsioj3ba77u2763nsyuzq53gtbdxsnqpoipvdl4immj6ytznjaoy`
|
||||
- (with dependencies, node v14.18.2 and npm v8.8.0): `bafybeihfendd4oj6uxvvecm7sluobwwhpb5wdcxhvhmx56e667nxdncd4a`
|
||||
|
||||
They are also posted to the Radicle:
|
||||
- v6.2.10: `rad:git:hnrkkroqnbfwj6uxpfjuhspoxnfm4i8e6oqwy`
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE.md)
|
||||
|
||||
Generated
+192
-137
@@ -32,7 +32,7 @@
|
||||
"slp-mdm": "0.0.7",
|
||||
"slp-parser": "0.0.4",
|
||||
"wif": "2.0.6",
|
||||
"x402-bch-axios": "1.1.2"
|
||||
"x402-bch-axios": "2.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"apidoc": "1.2.0",
|
||||
@@ -49,13 +49,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/code-frame": {
|
||||
"version": "7.27.1",
|
||||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz",
|
||||
"integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==",
|
||||
"version": "7.28.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.28.6.tgz",
|
||||
"integrity": "sha512-JYgintcMjRiCvS8mMECzaEn+m3PfoQiyqukOMCCVQtoJGYJw8j/8LBJEiqkHLkfwCcs74E3pbAUFNg7d9VNJ+Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-validator-identifier": "^7.27.1",
|
||||
"@babel/helper-validator-identifier": "^7.28.5",
|
||||
"js-tokens": "^4.0.0",
|
||||
"picocolors": "^1.1.1"
|
||||
},
|
||||
@@ -64,9 +64,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/compat-data": {
|
||||
"version": "7.28.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.5.tgz",
|
||||
"integrity": "sha512-6uFXyCayocRbqhZOB+6XcuZbkMNimwfVGFji8CTZnCzOHVGvDqzvitu1re2AU5LROliz7eQPhB8CpAMvnx9EjA==",
|
||||
"version": "7.28.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.6.tgz",
|
||||
"integrity": "sha512-2lfu57JtzctfIrcGMz992hyLlByuzgIk58+hhGCxjKZ3rWI82NnVLjXcaTqkI2NvlcvOskZaiZ5kjUALo3Lpxg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@@ -74,21 +74,21 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/core": {
|
||||
"version": "7.28.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.5.tgz",
|
||||
"integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==",
|
||||
"version": "7.28.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.6.tgz",
|
||||
"integrity": "sha512-H3mcG6ZDLTlYfaSNi0iOKkigqMFvkTKlGUYlD8GW7nNOYRrevuA46iTypPyv+06V3fEmvvazfntkBU34L0azAw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.27.1",
|
||||
"@babel/generator": "^7.28.5",
|
||||
"@babel/helper-compilation-targets": "^7.27.2",
|
||||
"@babel/helper-module-transforms": "^7.28.3",
|
||||
"@babel/helpers": "^7.28.4",
|
||||
"@babel/parser": "^7.28.5",
|
||||
"@babel/template": "^7.27.2",
|
||||
"@babel/traverse": "^7.28.5",
|
||||
"@babel/types": "^7.28.5",
|
||||
"@babel/code-frame": "^7.28.6",
|
||||
"@babel/generator": "^7.28.6",
|
||||
"@babel/helper-compilation-targets": "^7.28.6",
|
||||
"@babel/helper-module-transforms": "^7.28.6",
|
||||
"@babel/helpers": "^7.28.6",
|
||||
"@babel/parser": "^7.28.6",
|
||||
"@babel/template": "^7.28.6",
|
||||
"@babel/traverse": "^7.28.6",
|
||||
"@babel/types": "^7.28.6",
|
||||
"@jridgewell/remapping": "^2.3.5",
|
||||
"convert-source-map": "^2.0.0",
|
||||
"debug": "^4.1.0",
|
||||
@@ -122,14 +122,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/generator": {
|
||||
"version": "7.28.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.5.tgz",
|
||||
"integrity": "sha512-3EwLFhZ38J4VyIP6WNtt2kUdW9dokXA9Cr4IVIFHuCpZ3H8/YFOl5JjZHisrn1fATPBmKKqXzDFvh9fUwHz6CQ==",
|
||||
"version": "7.28.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.6.tgz",
|
||||
"integrity": "sha512-lOoVRwADj8hjf7al89tvQ2a1lf53Z+7tiXMgpZJL3maQPDxh0DgLMN62B2MKUOFcoodBHLMbDM6WAbKgNy5Suw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.28.5",
|
||||
"@babel/types": "^7.28.5",
|
||||
"@babel/parser": "^7.28.6",
|
||||
"@babel/types": "^7.28.6",
|
||||
"@jridgewell/gen-mapping": "^0.3.12",
|
||||
"@jridgewell/trace-mapping": "^0.3.28",
|
||||
"jsesc": "^3.0.2"
|
||||
@@ -139,13 +139,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-compilation-targets": {
|
||||
"version": "7.27.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz",
|
||||
"integrity": "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ==",
|
||||
"version": "7.28.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz",
|
||||
"integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/compat-data": "^7.27.2",
|
||||
"@babel/compat-data": "^7.28.6",
|
||||
"@babel/helper-validator-option": "^7.27.1",
|
||||
"browserslist": "^4.24.0",
|
||||
"lru-cache": "^5.1.1",
|
||||
@@ -176,29 +176,29 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-module-imports": {
|
||||
"version": "7.27.1",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz",
|
||||
"integrity": "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w==",
|
||||
"version": "7.28.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.28.6.tgz",
|
||||
"integrity": "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/traverse": "^7.27.1",
|
||||
"@babel/types": "^7.27.1"
|
||||
"@babel/traverse": "^7.28.6",
|
||||
"@babel/types": "^7.28.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-module-transforms": {
|
||||
"version": "7.28.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.3.tgz",
|
||||
"integrity": "sha512-gytXUbs8k2sXS9PnQptz5o0QnpLL51SwASIORY6XaBKF88nsOT0Zw9szLqlSGQDP/4TljBAD5y98p2U1fqkdsw==",
|
||||
"version": "7.28.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz",
|
||||
"integrity": "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-module-imports": "^7.27.1",
|
||||
"@babel/helper-validator-identifier": "^7.27.1",
|
||||
"@babel/traverse": "^7.28.3"
|
||||
"@babel/helper-module-imports": "^7.28.6",
|
||||
"@babel/helper-validator-identifier": "^7.28.5",
|
||||
"@babel/traverse": "^7.28.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
@@ -238,27 +238,27 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helpers": {
|
||||
"version": "7.28.4",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.4.tgz",
|
||||
"integrity": "sha512-HFN59MmQXGHVyYadKLVumYsA9dBFun/ldYxipEjzA4196jpLZd8UjEEBLkbEkvfYreDqJhZxYAWFPtrfhNpj4w==",
|
||||
"version": "7.28.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.6.tgz",
|
||||
"integrity": "sha512-xOBvwq86HHdB7WUDTfKfT/Vuxh7gElQ+Sfti2Cy6yIWNW05P8iUslOVcZ4/sKbE+/jQaukQAdz/gf3724kYdqw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/template": "^7.27.2",
|
||||
"@babel/types": "^7.28.4"
|
||||
"@babel/template": "^7.28.6",
|
||||
"@babel/types": "^7.28.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/parser": {
|
||||
"version": "7.28.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.5.tgz",
|
||||
"integrity": "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==",
|
||||
"version": "7.28.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.6.tgz",
|
||||
"integrity": "sha512-TeR9zWR18BvbfPmGbLampPMW+uW1NZnJlRuuHso8i87QZNq2JRF9i6RgxRqtEq+wQGsS19NNTWr2duhnE49mfQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.28.5"
|
||||
"@babel/types": "^7.28.6"
|
||||
},
|
||||
"bin": {
|
||||
"parser": "bin/babel-parser.js"
|
||||
@@ -268,33 +268,33 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/template": {
|
||||
"version": "7.27.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz",
|
||||
"integrity": "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==",
|
||||
"version": "7.28.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz",
|
||||
"integrity": "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.27.1",
|
||||
"@babel/parser": "^7.27.2",
|
||||
"@babel/types": "^7.27.1"
|
||||
"@babel/code-frame": "^7.28.6",
|
||||
"@babel/parser": "^7.28.6",
|
||||
"@babel/types": "^7.28.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/traverse": {
|
||||
"version": "7.28.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.5.tgz",
|
||||
"integrity": "sha512-TCCj4t55U90khlYkVV/0TfkJkAkUg3jZFA3Neb7unZT8CPok7iiRfaX0F+WnqWqt7OxhOn0uBKXCw4lbL8W0aQ==",
|
||||
"version": "7.28.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.6.tgz",
|
||||
"integrity": "sha512-fgWX62k02qtjqdSNTAGxmKYY/7FSL9WAS1o2Hu5+I5m9T0yxZzr4cnrfXQ/MX0rIifthCSs6FKTlzYbJcPtMNg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.27.1",
|
||||
"@babel/generator": "^7.28.5",
|
||||
"@babel/code-frame": "^7.28.6",
|
||||
"@babel/generator": "^7.28.6",
|
||||
"@babel/helper-globals": "^7.28.0",
|
||||
"@babel/parser": "^7.28.5",
|
||||
"@babel/template": "^7.27.2",
|
||||
"@babel/types": "^7.28.5",
|
||||
"@babel/parser": "^7.28.6",
|
||||
"@babel/template": "^7.28.6",
|
||||
"@babel/types": "^7.28.6",
|
||||
"debug": "^4.3.1"
|
||||
},
|
||||
"engines": {
|
||||
@@ -302,9 +302,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/types": {
|
||||
"version": "7.28.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.5.tgz",
|
||||
"integrity": "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==",
|
||||
"version": "7.28.6",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.6.tgz",
|
||||
"integrity": "sha512-0ZrskXVEHSWIqZM/sQZ4EV3jZJXRkio/WCxaqKZP1g//CEWEPSfeZFcms4XeKBCHU0ZKnIkdJeU/kF+eRp5lBg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -779,9 +779,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint-community/eslint-utils": {
|
||||
"version": "4.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz",
|
||||
"integrity": "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==",
|
||||
"version": "4.9.1",
|
||||
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz",
|
||||
"integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -1432,9 +1432,9 @@
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/@pnpm/npm-conf": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@pnpm/npm-conf/-/npm-conf-2.3.1.tgz",
|
||||
"integrity": "sha512-c83qWb22rNRuB0UaVCI0uRPNRr8Z0FWnEIvT47jiHAmOIUHbBOg5XvV7pM5x+rKn9HRpjxquDbXYSXr3fAKFcw==",
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@pnpm/npm-conf/-/npm-conf-3.0.2.tgz",
|
||||
"integrity": "sha512-h104Kh26rR8tm+a3Qkc5S4VLYint3FE48as7+/5oCEcKR2idC/pF1G6AhIXKI+eHPJa/3J9i5z0Al47IeGHPkA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -1447,6 +1447,38 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js": {
|
||||
"version": "7.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@psf/bch-js/-/bch-js-7.1.4.tgz",
|
||||
"integrity": "sha512-/+5mbg6RFybKPNtB/m0NEOJYVyT4Rosy/GHGjHknOEkBRF2Xd0/pZTtPAd+BtvzePDki4c2KyL13VkF5XghFyw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@chris.troutner/bip32-utils": "1.0.5",
|
||||
"@psf/bip21": "2.0.1",
|
||||
"@psf/bitcoincashjs-lib": "4.0.3",
|
||||
"@psf/coininfo": "4.0.0",
|
||||
"axios": "1.13.2",
|
||||
"bc-bip68": "1.0.5",
|
||||
"bchaddrjs-slp": "0.2.14",
|
||||
"bigi": "1.4.2",
|
||||
"bignumber.js": "9.3.1",
|
||||
"bip-schnorr": "0.6.7",
|
||||
"bip38": "3.1.1",
|
||||
"bip39": "3.1.0",
|
||||
"bip66": "1.1.5",
|
||||
"bitcoinjs-message": "2.2.0",
|
||||
"bs58": "4.0.1",
|
||||
"ecashaddrjs": "1.0.7",
|
||||
"ini": "6.0.0",
|
||||
"randombytes": "2.1.0",
|
||||
"safe-buffer": "5.2.1",
|
||||
"satoshi-bitcoin": "1.0.5",
|
||||
"slp-mdm": "0.0.7",
|
||||
"slp-parser": "0.0.4",
|
||||
"wif": "2.0.6",
|
||||
"x402-bch-axios": "2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js": {
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@psf/bch-js/-/bch-js-7.1.1.tgz",
|
||||
"integrity": "sha512-Wknq+q418Zb2Hmb6aDmxt/6VLrU81N+Iq9KP0KHGo1lFHeupJJonBkVt74R1ulry61F7MNRr39iDCTQsMM0ctg==",
|
||||
@@ -1478,7 +1510,7 @@
|
||||
"x402-bch-axios": "1.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js": {
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/@psf/bch-js": {
|
||||
"version": "6.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@psf/bch-js/-/bch-js-6.8.1.tgz",
|
||||
"integrity": "sha512-xu5YT9L3OhdILwJUmkV7Pg/WZ3r2aA6jD7fr5WMvo0OJSzzBBbXGShIbQNZp9+Vv9BoeVLCMqpZoW1Fp7OLCbg==",
|
||||
@@ -1510,7 +1542,7 @@
|
||||
"wif": "2.0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/axios": {
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/axios": {
|
||||
"version": "0.26.1",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
|
||||
"integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==",
|
||||
@@ -1519,7 +1551,7 @@
|
||||
"follow-redirects": "^1.14.8"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/bchaddrjs-slp": {
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/bchaddrjs-slp": {
|
||||
"version": "0.2.5",
|
||||
"resolved": "https://registry.npmjs.org/bchaddrjs-slp/-/bchaddrjs-slp-0.2.5.tgz",
|
||||
"integrity": "sha512-33flmPcqMFswerKu7477DSUNMVMQR3tHDk3lvbmsdkEva+TxVGGWWE/p5Lqx9M/8t3vkbe7fzmVhj4QhChcCyA==",
|
||||
@@ -1532,7 +1564,7 @@
|
||||
"node": ">= 6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/bignumber.js": {
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/bignumber.js": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz",
|
||||
"integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==",
|
||||
@@ -1541,7 +1573,7 @@
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/bip-schnorr": {
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/bip-schnorr": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/bip-schnorr/-/bip-schnorr-0.3.0.tgz",
|
||||
"integrity": "sha512-Sc1Hn2+1n+okPEW8G+JLjeaM12dsUOwr+oFlMDSKR9wYwNGMw0alskeBIHTmXxBxMZSWKhCW7PwKQVDyGmnaVg==",
|
||||
@@ -1556,7 +1588,7 @@
|
||||
"node": ">=8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/bip38": {
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/bip38": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/bip38/-/bip38-2.0.2.tgz",
|
||||
"integrity": "sha512-22KDak0RDyghFbR0Si7wyq9IgY423YzGYzWLpGeofH3DaolOQqjD3mNN08eFoubKlbyclOQKFwtONMv2SD9V3A==",
|
||||
@@ -1570,7 +1602,7 @@
|
||||
"scryptsy": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/bip39": {
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/bip39": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/bip39/-/bip39-3.0.2.tgz",
|
||||
"integrity": "sha512-J4E1r2N0tUylTKt07ibXvhpT2c5pyAFgvuA5q1H9uDy6dEGpjV8jmymh3MTYJDLCNbIVClSB9FbND49I6N24MQ==",
|
||||
@@ -1582,7 +1614,7 @@
|
||||
"randombytes": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/bitcoinjs-message": {
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/bitcoinjs-message": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bitcoinjs-message/-/bitcoinjs-message-2.0.0.tgz",
|
||||
"integrity": "sha512-H5pJC7/eSqVjREiEOZ4jifX+7zXYP3Y28GIOIqg9hrgE7Vj8Eva9+HnVqnxwA1rJPOwZKuw0vo6k0UxgVc6q1A==",
|
||||
@@ -1598,13 +1630,13 @@
|
||||
"node": ">=0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/ini": {
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/ini": {
|
||||
"version": "1.3.8",
|
||||
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
|
||||
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/randombytes": {
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/randombytes": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz",
|
||||
"integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==",
|
||||
@@ -1613,13 +1645,13 @@
|
||||
"safe-buffer": "^5.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/safe-buffer": {
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/satoshi-bitcoin": {
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/satoshi-bitcoin": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/satoshi-bitcoin/-/satoshi-bitcoin-1.0.4.tgz",
|
||||
"integrity": "sha512-YuHOmw5wsz6wuHIQdsz5b2cgtuKtV/jEcZ4NGmWN5tM/gz5T9Q+DSuLlnuf5BP/jsQWgR0ofmY4f8Dm6JnqSug==",
|
||||
@@ -1628,7 +1660,7 @@
|
||||
"big.js": "^3.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/slp-mdm": {
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/slp-mdm": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/slp-mdm/-/slp-mdm-0.0.6.tgz",
|
||||
"integrity": "sha512-fbjlIg/o8OtzgK2JydC6POJp3Qup/rLgy4yB5hoLgxWRlERyJyE29ScwS3r9TTwPxe12qK55pyivAdNOZZXL0A==",
|
||||
@@ -1637,6 +1669,30 @@
|
||||
"bignumber.js": "^9.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/minimal-slp-wallet": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/minimal-slp-wallet/-/minimal-slp-wallet-6.1.0.tgz",
|
||||
"integrity": "sha512-P24WzJu2kHg5aQtKkIVJ42Gu1dsYXWAc0z5MCmlinjDq11Bgy4ICBu73YxpNTB3TQwrWIIi2LJgsuQa/dqH50Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@chris.troutner/retry-queue-commonjs": "1.0.8",
|
||||
"@psf/bch-js": "6.8.1",
|
||||
"apidoc": "0.51.0",
|
||||
"bch-consumer": "1.6.2",
|
||||
"bch-donation": "1.1.2",
|
||||
"crypto-js": "4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/@psf/bch-js/node_modules/x402-bch-axios": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/x402-bch-axios/-/x402-bch-axios-1.1.1.tgz",
|
||||
"integrity": "sha512-jQ0AyjAzvyTw7ejTTvUSIQiH8//wVn/SRwSgcJ3LeM38SJlJWpTMvvNpOpcjcZ+kFKOe4SsurOy/AcH7o+akjQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@chris.troutner/retry-queue": "1.0.11",
|
||||
"minimal-slp-wallet": "6.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/@types/node": {
|
||||
"version": "11.11.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-11.11.6.tgz",
|
||||
@@ -1789,14 +1845,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/minimal-slp-wallet": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/minimal-slp-wallet/-/minimal-slp-wallet-6.1.0.tgz",
|
||||
"integrity": "sha512-P24WzJu2kHg5aQtKkIVJ42Gu1dsYXWAc0z5MCmlinjDq11Bgy4ICBu73YxpNTB3TQwrWIIi2LJgsuQa/dqH50Q==",
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/minimal-slp-wallet/-/minimal-slp-wallet-7.0.2.tgz",
|
||||
"integrity": "sha512-H3H46VXXhvHF/1EKIaAVpBXevX5Bmt1SYqpfQFIcb7JSajXwwncQv7gmhf5Q9H3jtwdY43YWq2TFoeLUkI7E4g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@chris.troutner/retry-queue-commonjs": "1.0.8",
|
||||
"@psf/bch-js": "6.8.1",
|
||||
"apidoc": "0.51.0",
|
||||
"@chris.troutner/retry-queue": "1.0.11",
|
||||
"@psf/bch-js": "7.1.1",
|
||||
"bch-consumer": "1.6.2",
|
||||
"bch-donation": "1.1.2",
|
||||
"crypto-js": "4.0.0"
|
||||
@@ -1891,13 +1946,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bch-js/node_modules/x402-bch-axios": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/x402-bch-axios/-/x402-bch-axios-1.1.1.tgz",
|
||||
"integrity": "sha512-jQ0AyjAzvyTw7ejTTvUSIQiH8//wVn/SRwSgcJ3LeM38SJlJWpTMvvNpOpcjcZ+kFKOe4SsurOy/AcH7o+akjQ==",
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/x402-bch-axios/-/x402-bch-axios-2.1.0.tgz",
|
||||
"integrity": "sha512-6IE6tUmg/+W4Poi6JBs5z0xjSOhvouzea9IH6BUnuBIdXDm0wv5cwT0cN5qAA4k7BE7hiB98LPiG6QIIkoGjVA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@chris.troutner/retry-queue": "1.0.11",
|
||||
"minimal-slp-wallet": "6.1.0"
|
||||
"minimal-slp-wallet": "7.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@psf/bip21": {
|
||||
@@ -2364,9 +2419,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "25.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.3.tgz",
|
||||
"integrity": "sha512-W609buLVRVmeW693xKfzHeIV6nJGGz98uCPfeXI1ELMLXVeKYZ9m15fAMSaUPBHYLGFsVRcMmSCksQOrZV9BYA==",
|
||||
"version": "25.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.9.tgz",
|
||||
"integrity": "sha512-/rpCXHlCWeqClNBwUhDcusJxXYDjZTyE8v5oTO7WbL8eij2nKhUeU89/6xgjU7N4/Vh3He0BtyhJdQbDyhiXAw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~7.16.0"
|
||||
@@ -3124,9 +3179,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/baseline-browser-mapping": {
|
||||
"version": "2.9.11",
|
||||
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.11.tgz",
|
||||
"integrity": "sha512-Sg0xJUNDU1sJNGdfGWhVHX0kkZ+HWcvmVymJbj6NSgZZmW/8S9Y2HQ5euytnIgakgxN6papOAWiwDo1ctFDcoQ==",
|
||||
"version": "2.9.15",
|
||||
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.15.tgz",
|
||||
"integrity": "sha512-kX8h7K2srmDyYnXRIppo4AH/wYgzWVCs+eKr3RusRSQ5PvRYoEFmR/I0PbdTjKFAoKqp5+kbxnNTFO9jOfSVJg==",
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"baseline-browser-mapping": "dist/cli.js"
|
||||
@@ -4243,9 +4298,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/caniuse-lite": {
|
||||
"version": "1.0.30001761",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001761.tgz",
|
||||
"integrity": "sha512-JF9ptu1vP2coz98+5051jZ4PwQgd2ni8A+gYSN7EA7dPKIMf0pDlSUxhdmVOaV3/fYK5uWBkgSXJaRLr4+3A6g==",
|
||||
"version": "1.0.30001764",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001764.tgz",
|
||||
"integrity": "sha512-9JGuzl2M+vPL+pz70gtMF9sHdMFbY9FJaQBi186cHKH3pSzDvzoUJUPV6fqiKIMyXbud9ZLg4F3Yza1vJ1+93g==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
@@ -6222,9 +6277,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/esquery": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz",
|
||||
"integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==",
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz",
|
||||
"integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
@@ -6427,9 +6482,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/fastq": {
|
||||
"version": "1.19.1",
|
||||
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz",
|
||||
"integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==",
|
||||
"version": "1.20.1",
|
||||
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz",
|
||||
"integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
@@ -9184,13 +9239,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/minimal-slp-wallet": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/minimal-slp-wallet/-/minimal-slp-wallet-7.0.2.tgz",
|
||||
"integrity": "sha512-H3H46VXXhvHF/1EKIaAVpBXevX5Bmt1SYqpfQFIcb7JSajXwwncQv7gmhf5Q9H3jtwdY43YWq2TFoeLUkI7E4g==",
|
||||
"version": "7.0.5",
|
||||
"resolved": "https://registry.npmjs.org/minimal-slp-wallet/-/minimal-slp-wallet-7.0.5.tgz",
|
||||
"integrity": "sha512-yrWQwXrtUZYvB6mWe3HTBzQGK1oEjgHuXkanx94tejPR3N8nJLmRRMQu27oWIYD/m3wm0wU8UreYXPIA0iN/iw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@chris.troutner/retry-queue": "1.0.11",
|
||||
"@psf/bch-js": "7.1.1",
|
||||
"@psf/bch-js": "7.1.4",
|
||||
"bch-consumer": "1.6.2",
|
||||
"bch-donation": "1.1.2",
|
||||
"crypto-js": "4.0.0"
|
||||
@@ -9624,9 +9679,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/normalize-url": {
|
||||
"version": "8.1.0",
|
||||
"resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.1.0.tgz",
|
||||
"integrity": "sha512-X06Mfd/5aKsRHc0O0J5CUedwnPmnDtLF2+nq+KN9KSDlJHkPuh0JUviWjEWMe0SW/9TDdSLVPuk7L5gGTIA1/w==",
|
||||
"version": "8.1.1",
|
||||
"resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-8.1.1.tgz",
|
||||
"integrity": "sha512-JYc0DPlpGWB40kH5g07gGTrYuMqV653k3uBKY6uITPWds3M0ov3GaWGp9lbE3Bzngx8+XkfzgvASb9vk9JDFXQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
@@ -13436,9 +13491,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/qs": {
|
||||
"version": "6.14.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz",
|
||||
"integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==",
|
||||
"version": "6.14.1",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.1.tgz",
|
||||
"integrity": "sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"side-channel": "^1.1.0"
|
||||
@@ -13726,13 +13781,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/registry-auth-token": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-5.1.0.tgz",
|
||||
"integrity": "sha512-GdekYuwLXLxMuFTwAPg5UKGLW/UXzQrZvH/Zj791BQif5T05T0RsaLfHc9q3ZOKi7n+BoprPD9mJ0O0k4xzUlw==",
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-5.1.1.tgz",
|
||||
"integrity": "sha512-P7B4+jq8DeD2nMsAcdfaqHbssgHtZ7Z5+++a5ask90fvmJ8p5je4mOa+wzu+DB4vQ5tdJV/xywY+UnVFeQLV5Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@pnpm/npm-conf": "^2.1.0"
|
||||
"@pnpm/npm-conf": "^3.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
@@ -15562,9 +15617,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/terser": {
|
||||
"version": "5.44.1",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.44.1.tgz",
|
||||
"integrity": "sha512-t/R3R/n0MSwnnazuPpPNVO60LX0SKL45pyl9YlvxIdkH0Of7D5qM2EVe+yASRIlY5pZ73nclYJfNANGWPwFDZw==",
|
||||
"version": "5.46.0",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.46.0.tgz",
|
||||
"integrity": "sha512-jTwoImyr/QbOWFFso3YoU3ik0jBBDJ6JTOQiy/J2YxVJdZCc+5u7skhNwiOR3FQIygFqVUPHl7qbbxtjW2K3Qg==",
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"@jridgewell/source-map": "^0.3.3",
|
||||
@@ -16301,9 +16356,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/watchpack": {
|
||||
"version": "2.4.4",
|
||||
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.4.tgz",
|
||||
"integrity": "sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA==",
|
||||
"version": "2.5.1",
|
||||
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.5.1.tgz",
|
||||
"integrity": "sha512-Zn5uXdcFNIA1+1Ei5McRd+iRzfhENPCe7LeABkJtNulSxjma+l7ltNx55BWZkRlwRnpOgHqxnjyaDgJnNXnqzg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"glob-to-regexp": "^0.4.1",
|
||||
@@ -16582,9 +16637,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/which-typed-array": {
|
||||
"version": "1.1.19",
|
||||
"resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.19.tgz",
|
||||
"integrity": "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==",
|
||||
"version": "1.1.20",
|
||||
"resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.20.tgz",
|
||||
"integrity": "sha512-LYfpUkmqwl0h9A2HL09Mms427Q1RZWuOHsukfVcKRq9q95iQxdw0ix1JQrqbcDR9PH1QDwf5Qo8OZb5lksZ8Xg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"available-typed-arrays": "^1.0.7",
|
||||
@@ -16749,13 +16804,13 @@
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/x402-bch-axios": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/x402-bch-axios/-/x402-bch-axios-1.1.2.tgz",
|
||||
"integrity": "sha512-HG44zvQZJDHIjLN79ZCubFdMDpanhGJT+n5iyIyy6ni8S2bLDwKJeAyqhNMlTIPKjcZD9JLyyxU6iWtqxjUXOw==",
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/x402-bch-axios/-/x402-bch-axios-2.2.1.tgz",
|
||||
"integrity": "sha512-N23DpQRA746bqGDTCJYVQ8QL55PoxE6LTSNMFzx5sySsvnBem6H0hQLSf2N9e45O8xPVw3ulSvXncgTcVM8ikw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@chris.troutner/retry-queue": "1.0.11",
|
||||
"minimal-slp-wallet": "7.0.2"
|
||||
"minimal-slp-wallet": "7.0.5"
|
||||
}
|
||||
},
|
||||
"node_modules/xdg-basedir": {
|
||||
|
||||
+6
-4
@@ -11,13 +11,15 @@
|
||||
"main": "src/bch-js.js",
|
||||
"scripts": {
|
||||
"test": "export RESTURL=http://localhost:5942/v6 && c8 mocha --trace-warnings --unhandled-rejections=strict --timeout 30000 test/unit/",
|
||||
"test:custom": "export RESTURL=http://localhost:5942/v6 && c8 mocha --trace-warnings --unhandled-rejections=strict --timeout 60000 ${MOCHA_GREP:+--grep $MOCHA_GREP} test/unit/",
|
||||
"test:integration": "npm run test:integration:local:noauth",
|
||||
"test:integration:fullstack:free": "export RESTURL=https://bch.fullstack.cash/v6 && mocha --timeout 60000 test/integration/",
|
||||
"test:integration:fullstack:x402": "export RESTURL=https://x402-bch.fullstack.cash/v6 && export BCHJSWIF=L1eYaneXDDXy8VDig4Arwe8wYHbhtsA5wuQvwsKwhaYeneoZuKG4 && mocha --timeout 30000 test/integration/",
|
||||
"test:integration:local:noauth": "export RESTURL=http://localhost:5942/v6 && mocha --timeout 30000 test/integration/",
|
||||
"test:integration:fullstack:x402": "export RESTURL=https://x402-bch.fullstack.cash/v6 && export BCHJSWIF=L1eYaneXDDXy8VDig4Arwe8wYHbhtsA5wuQvwsKwhaYeneoZuKG4 && mocha --timeout 120000 test/integration/",
|
||||
"test:integration:fullstack:auth": "export RESTURL=http://dev.fullstack.cash/v6 && export BCHJSBEARERTOKEN=test01 && mocha --timeout 30000 test/integration/",
|
||||
"test:integration:local:noauth": "export RESTURL=http://192.168.1.65:5942/v6 && mocha --timeout 30000 test/integration/",
|
||||
"test:integration:local:auth": "export RESTURL=http://192.168.1.115:5942/v6 && export BCHJSBEARERTOKEN=temp01 && mocha --timeout 30000 test/integration/",
|
||||
"test:integration:local:x402": "export RESTURL=http://localhost:5942/v6 && export BCHJSWIF=L1eYaneXDDXy8VDig4Arwe8wYHbhtsA5wuQvwsKwhaYeneoZuKG4 && mocha --timeout 1200000 test/integration/",
|
||||
"test:integration:decatur": "export RESTURL=http://192.168.2.127:5942/v6 && mocha --timeout 30000 test/integration/",
|
||||
"test:integration:decatur": "export RESTURL=http://192.168.1.65:5942/v6 && mocha --timeout 30000 test/integration/",
|
||||
"coverage": "nyc --reporter=html mocha --timeout 25000 test/unit/",
|
||||
"docs": "./node_modules/.bin/apidoc -i src/ -o docs && ./fix-docs-contrast.sh",
|
||||
"lint": "standard --env mocha --fix"
|
||||
@@ -52,7 +54,7 @@
|
||||
"slp-mdm": "0.0.7",
|
||||
"slp-parser": "0.0.4",
|
||||
"wif": "2.0.6",
|
||||
"x402-bch-axios": "1.1.2"
|
||||
"x402-bch-axios": "2.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"apidoc": "1.2.0",
|
||||
|
||||
+5
-2
@@ -86,7 +86,10 @@ class BCHJS {
|
||||
} else if (process.env.BCHJSWIF && process.env.BCHJSWIF !== '') {
|
||||
this.wif = process.env.BCHJSWIF
|
||||
}
|
||||
this.paymentAmountSats = (config && config.paymentAmountSats) || 2000 * 5
|
||||
|
||||
// Most TXs cost about 250 sats. So we'll set the default to 25000 sats,
|
||||
// so the mining fee is 1% of the transaction.
|
||||
this.paymentAmountSats = (config && config.paymentAmountSats) || 25000
|
||||
|
||||
// BCH server URL for x402 payments (separate from REST API server)
|
||||
// This is used when broadcasting payment transactions to the blockchain
|
||||
@@ -95,7 +98,7 @@ class BCHJS {
|
||||
} else if (process.env.BCHJSBCHSERVERURL && process.env.BCHJSBCHSERVERURL !== '') {
|
||||
this.bchServerURL = process.env.BCHJSBCHSERVERURL
|
||||
} else {
|
||||
this.bchServerURL = 'https://bch.fullstack.cash/v6/'
|
||||
this.bchServerURL = 'https://bch.fullstack.cash/v6'
|
||||
}
|
||||
|
||||
const libConfig = {
|
||||
|
||||
+97
-38
@@ -47,8 +47,11 @@ class Blockchain {
|
||||
)
|
||||
return response.data
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,8 +108,11 @@ class Blockchain {
|
||||
)
|
||||
return response.data
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,8 +161,11 @@ class Blockchain {
|
||||
)
|
||||
return response.data
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,8 +198,11 @@ class Blockchain {
|
||||
console.log('Error in bch-js/blockchain.js/getBlockCount()')
|
||||
console.log('blockchain.js restURL: ', this.restURL)
|
||||
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,8 +234,11 @@ class Blockchain {
|
||||
)
|
||||
return response.data
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,8 +302,13 @@ class Blockchain {
|
||||
|
||||
throw new Error('Input hash must be a string or array of strings.')
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
// console.log('Error in bch-js/blockchain.js/getBlockHeader() error: ', error)
|
||||
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -330,8 +350,11 @@ class Blockchain {
|
||||
)
|
||||
return response.data
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,8 +385,11 @@ class Blockchain {
|
||||
)
|
||||
return response.data
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -378,8 +404,11 @@ class Blockchain {
|
||||
)
|
||||
return response.data
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,8 +422,11 @@ class Blockchain {
|
||||
)
|
||||
return response.data
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,8 +537,11 @@ class Blockchain {
|
||||
|
||||
throw new Error('Input must be a string or array of strings.')
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -541,8 +576,11 @@ class Blockchain {
|
||||
)
|
||||
return response.data
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -588,8 +626,11 @@ class Blockchain {
|
||||
)
|
||||
return response.data
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -642,8 +683,11 @@ class Blockchain {
|
||||
|
||||
return response.data
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -709,8 +753,11 @@ class Blockchain {
|
||||
|
||||
throw new Error('Input must be a string or array of strings.')
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -722,8 +769,11 @@ class Blockchain {
|
||||
)
|
||||
return response.data
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -735,8 +785,11 @@ class Blockchain {
|
||||
)
|
||||
return response.data
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -748,8 +801,11 @@ class Blockchain {
|
||||
)
|
||||
return response.data
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -816,8 +872,11 @@ class Blockchain {
|
||||
|
||||
throw new Error('Input must be a string or array of strings.')
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-3
@@ -6,7 +6,8 @@ class DSProof {
|
||||
constructor (config) {
|
||||
this.restURL = config.restURL
|
||||
this.authToken = config.authToken
|
||||
this.axios = axios
|
||||
// Use the shared axios instance if provided, otherwise fall back to axios
|
||||
this.axios = config.axios || axios
|
||||
|
||||
this.axiosOptions = {
|
||||
headers: {
|
||||
@@ -61,8 +62,11 @@ class DSProof {
|
||||
)
|
||||
return response.data
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+37
-15
@@ -120,8 +120,11 @@ class ElectrumX {
|
||||
|
||||
throw new Error('Input address must be a string or array of strings.')
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,8 +207,11 @@ class ElectrumX {
|
||||
|
||||
throw new Error('Input address must be a string or array of strings.')
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,8 +311,11 @@ class ElectrumX {
|
||||
throw new Error('Input address must be a string or array of strings.')
|
||||
} catch (error) {
|
||||
// console.log('Error in transactions(): ', error)
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,8 +406,11 @@ class ElectrumX {
|
||||
|
||||
throw new Error('Input address must be a string or array of strings.')
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -453,9 +465,13 @@ class ElectrumX {
|
||||
} catch (error) {
|
||||
// console.log("error: ", error)
|
||||
if (error.response && error.response.data) {
|
||||
if (error.response && error.response.data) {
|
||||
throw new Error(error.response.data.error)
|
||||
} else throw error.response.data
|
||||
const errorData = error.response.data
|
||||
if (errorData.error) {
|
||||
throw new Error(errorData.error)
|
||||
} else {
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
}
|
||||
} else {
|
||||
throw error
|
||||
}
|
||||
@@ -555,8 +571,11 @@ class ElectrumX {
|
||||
|
||||
throw new Error('Input txId must be a string or array of strings.')
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -595,8 +614,11 @@ class ElectrumX {
|
||||
|
||||
throw new Error('Input txHex must be a string.')
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
else throw error
|
||||
if (error.response && error.response.data) {
|
||||
const errorData = error.response.data
|
||||
const errorMessage = typeof errorData === 'string' ? errorData : (errorData.error || errorData.message || JSON.stringify(errorData))
|
||||
throw new Error(errorMessage)
|
||||
} else throw error
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+23
-5
@@ -12,6 +12,7 @@ import axios from 'axios'
|
||||
// Local libraries
|
||||
import RawTransaction from './raw-transactions.js'
|
||||
import SlpUtils from './slp/utils.js'
|
||||
import Blockchain from './blockchain.js'
|
||||
|
||||
// let _this
|
||||
|
||||
@@ -31,6 +32,7 @@ class PsfSlpIndexer {
|
||||
// Encapsulate dependencies
|
||||
this.rawTransaction = new RawTransaction(config)
|
||||
this.slpUtils = new SlpUtils(config)
|
||||
this.blockchain = new Blockchain(config)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,7 +68,7 @@ class PsfSlpIndexer {
|
||||
)
|
||||
return response.data
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
if (error.response && error.response.data && error.response.data.error) throw new Error(error.response.data.error)
|
||||
else throw error
|
||||
}
|
||||
}
|
||||
@@ -134,7 +136,7 @@ class PsfSlpIndexer {
|
||||
}
|
||||
throw new Error('Input address must be a string.')
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
if (error.response && error.response.data && error.response.data.error) throw new Error(error.response.data.error)
|
||||
else throw error
|
||||
}
|
||||
}
|
||||
@@ -199,7 +201,7 @@ class PsfSlpIndexer {
|
||||
}
|
||||
throw new Error('Input tokenId must be a string.')
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
if (error.response && error.response.data && error.response.data.error) throw new Error(error.response.data.error)
|
||||
else throw error
|
||||
}
|
||||
}
|
||||
@@ -317,6 +319,22 @@ class PsfSlpIndexer {
|
||||
const txDetails = await this.rawTransaction.getTxData(txid)
|
||||
// console.log(`txDetails: ${JSON.stringify(txDetails, null, 2)}`)
|
||||
|
||||
// Add blockheight, height, time, and blocktime to the txDetails object.
|
||||
if (txDetails.height === null) {
|
||||
// Get current block height and increment by 1
|
||||
const currentBlockHeight = await this.blockchain.getBlockCount()
|
||||
const estimatedHeight = currentBlockHeight + 1
|
||||
|
||||
// Set height and blockheight
|
||||
txDetails.height = estimatedHeight
|
||||
txDetails.blockheight = estimatedHeight
|
||||
|
||||
// Set time and blocktime to current unix timestamp
|
||||
const currentTime = Math.floor(Date.now() / 1000)
|
||||
txDetails.time = currentTime
|
||||
txDetails.blocktime = currentTime
|
||||
}
|
||||
|
||||
if (isInBlacklist) {
|
||||
txDetails.isValidSlp = null
|
||||
} else {
|
||||
@@ -427,7 +445,7 @@ class PsfSlpIndexer {
|
||||
}
|
||||
throw new Error('Input tokenId must be a string.')
|
||||
} catch (error) {
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
if (error.response && error.response.data && error.response.data.error) throw new Error(error.response.data.error)
|
||||
else throw error
|
||||
}
|
||||
}
|
||||
@@ -522,7 +540,7 @@ class PsfSlpIndexer {
|
||||
throw new Error('Input tokenId must be a string.')
|
||||
} catch (error) {
|
||||
// console.log('error: ', error)
|
||||
if (error.response && error.response.data) throw error.response.data
|
||||
if (error.response && error.response.data && error.response.data.error) throw new Error(error.response.data.error)
|
||||
else throw error
|
||||
}
|
||||
}
|
||||
|
||||
+65
-11
@@ -15,6 +15,46 @@ class RawTransactions {
|
||||
|
||||
// Use the shared axios instance if provided, otherwise fall back to axios
|
||||
this.axios = config.axios || axios
|
||||
|
||||
// Retry configuration for transient network failures during broadcast.
|
||||
this.maxBroadcastRetries = 2
|
||||
this.broadcastRetryDelayMs = 250
|
||||
}
|
||||
|
||||
_sleep (ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms))
|
||||
}
|
||||
|
||||
_isTransientNetworkError (error) {
|
||||
if (!error) return false
|
||||
|
||||
const msg = String(error.message || '').toLowerCase()
|
||||
const causeMsg = String(error?.cause?.message || '').toLowerCase()
|
||||
const stack = String(error.stack || '').toLowerCase()
|
||||
const code = String(error.code || error?.cause?.code || '').toUpperCase()
|
||||
|
||||
if (['ECONNRESET', 'EPIPE', 'ETIMEDOUT'].includes(code)) return true
|
||||
if (msg.includes('socket hang up')) return true
|
||||
if (causeMsg.includes('socket hang up')) return true
|
||||
if (stack.includes('socket hang up')) return true
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
async _postSendRawTransaction (hexes) {
|
||||
const options = {
|
||||
method: 'POST',
|
||||
url: `${this.restURL}full-node/rawtransactions/sendRawTransaction`,
|
||||
data: {
|
||||
hexes
|
||||
},
|
||||
headers: {
|
||||
...this.axiosOptions.headers,
|
||||
Connection: 'close'
|
||||
}
|
||||
}
|
||||
|
||||
return this.axios(options)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -448,7 +488,13 @@ class RawTransactions {
|
||||
if (typeof hex === 'string') {
|
||||
const response = await this.axios.get(
|
||||
`${this.restURL}full-node/rawtransactions/sendRawTransaction/${hex}`,
|
||||
this.axiosOptions
|
||||
{
|
||||
...this.axiosOptions,
|
||||
headers: {
|
||||
...this.axiosOptions.headers,
|
||||
Connection: 'close'
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
if (response.data === '66: insufficient priority') {
|
||||
@@ -463,17 +509,25 @@ class RawTransactions {
|
||||
|
||||
// Array input
|
||||
} else if (Array.isArray(hex)) {
|
||||
const options = {
|
||||
method: 'POST',
|
||||
url: `${this.restURL}full-node/rawtransactions/sendRawTransaction`,
|
||||
data: {
|
||||
hexes: hex
|
||||
},
|
||||
headers: this.axiosOptions.headers
|
||||
}
|
||||
const response = await this.axios(options)
|
||||
let lastErr
|
||||
|
||||
return response.data
|
||||
for (let attempt = 0; attempt <= this.maxBroadcastRetries; attempt++) {
|
||||
try {
|
||||
const response = await this._postSendRawTransaction(hex)
|
||||
return response.data
|
||||
} catch (err) {
|
||||
lastErr = err
|
||||
|
||||
const isLastAttempt = attempt >= this.maxBroadcastRetries
|
||||
const shouldRetry = this._isTransientNetworkError(err) && !isLastAttempt
|
||||
if (!shouldRetry) throw err
|
||||
|
||||
const delay = this.broadcastRetryDelayMs * Math.pow(2, attempt)
|
||||
await this._sleep(delay)
|
||||
}
|
||||
}
|
||||
|
||||
throw lastErr
|
||||
}
|
||||
|
||||
throw new Error('Input hex must be a string or array of strings.')
|
||||
|
||||
@@ -103,8 +103,8 @@ describe('#blockchain', () => {
|
||||
console.log(`result: ${util.inspect(result)}`)
|
||||
assert.equal(true, false, 'Unexpected result!')
|
||||
} catch (err) {
|
||||
assert.hasAnyKeys(err, ['error'])
|
||||
assert.include(err.error, 'Array too large')
|
||||
assert.instanceOf(err, Error)
|
||||
assert.include(err.message, 'Array too large')
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -171,8 +171,8 @@ describe('#blockchain', () => {
|
||||
assert.equal(true, false, 'Unexpected result!')
|
||||
} catch (err) {
|
||||
// console.log(`err: ${util.inspect(err)}`)
|
||||
assert.hasAnyKeys(err, ['error'])
|
||||
assert.include(err.error, 'Transaction not in mempool')
|
||||
assert.instanceOf(err, Error)
|
||||
assert.include(err.message, 'Transaction not in mempool')
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -241,8 +241,8 @@ describe('#blockchain', () => {
|
||||
console.log(`result: ${util.inspect(result)}`)
|
||||
assert.equal(true, false, 'Unexpected result!')
|
||||
} catch (err) {
|
||||
assert.hasAnyKeys(err, ['error'])
|
||||
assert.include(err.error, 'Array too large')
|
||||
assert.instanceOf(err, Error)
|
||||
assert.include(err.message, 'Array too large')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -73,8 +73,8 @@ describe('#ElectrumX', () => {
|
||||
// console.log(`result: ${util.inspect(result)}`)
|
||||
assert.equal(true, false, 'Unexpected result!')
|
||||
} catch (err) {
|
||||
assert.hasAnyKeys(err, ['error'])
|
||||
assert.include(err.error, 'Array too large')
|
||||
assert.instanceOf(err, Error)
|
||||
assert.include(err.message, 'Array too large')
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -129,8 +129,8 @@ describe('#ElectrumX', () => {
|
||||
|
||||
assert.equal(true, false, 'Unexpected result!')
|
||||
} catch (err) {
|
||||
assert.hasAnyKeys(err, ['error'])
|
||||
assert.include(err.error, 'Array too large')
|
||||
assert.instanceOf(err, Error)
|
||||
assert.include(err.message, 'Array too large')
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -187,8 +187,8 @@ describe('#ElectrumX', () => {
|
||||
|
||||
assert.equal(true, false, 'Unexpected result!')
|
||||
} catch (err) {
|
||||
assert.hasAnyKeys(err, ['error'])
|
||||
assert.include(err.error, 'Array too large')
|
||||
assert.instanceOf(err, Error)
|
||||
assert.include(err.message, 'Array too large')
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -250,8 +250,8 @@ describe('#ElectrumX', () => {
|
||||
// console.log(`result: ${util.inspect(result)}`)
|
||||
assert.equal(true, false, 'Unexpected result!')
|
||||
} catch (err) {
|
||||
assert.hasAnyKeys(err, ['error'])
|
||||
assert.include(err.error, 'Array too large')
|
||||
assert.instanceOf(err, Error)
|
||||
assert.include(err.message, 'Array too large')
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -345,8 +345,8 @@ describe('#ElectrumX', () => {
|
||||
// console.log(`result: ${util.inspect(result)}`)
|
||||
assert.equal(true, false, 'Unexpected result!')
|
||||
} catch (err) {
|
||||
assert.hasAnyKeys(err, ['error'])
|
||||
assert.include(err.error, 'Array too large')
|
||||
assert.instanceOf(err, Error)
|
||||
assert.include(err.message, 'Array too large')
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -359,8 +359,9 @@ describe('#ElectrumX', () => {
|
||||
try {
|
||||
await bchjs.Electrumx.broadcast(txHex)
|
||||
} catch (err) {
|
||||
// console.error('err: ', err)
|
||||
assert.include(
|
||||
err.error,
|
||||
err.message,
|
||||
'the transaction was rejected by network rules'
|
||||
)
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ describe('#price', () => {
|
||||
})
|
||||
|
||||
describe('#getPsffppPrice', () => {
|
||||
it('should get the price of BCH in several currencies', async () => {
|
||||
it('should get the price to write 1MB to the PSFFPP', async () => {
|
||||
const result = await bchjs.Price.getPsffppPrice()
|
||||
// console.log(result)
|
||||
|
||||
|
||||
+30
-22
@@ -266,10 +266,15 @@ describe('#BitcoinCash', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('#bip38', () => {
|
||||
describe('#bip38', function () {
|
||||
// Increase timeout for BIP38 tests as they use CPU-intensive scrypt operations
|
||||
// Each encrypt/decrypt operation takes ~5-6 seconds in Node.js v22
|
||||
this.timeout(60000)
|
||||
|
||||
describe('#encryptBIP38', () => {
|
||||
fixtures.bip38.encrypt.mainnet.forEach(fixture => {
|
||||
it(`BIP 38 encrypt wif ${fixture.wif} with password ${fixture.password} on mainnet`, () => {
|
||||
it(`BIP 38 encrypt wif ${fixture.wif} with password ${fixture.password} on mainnet`, function () {
|
||||
this.timeout(60000)
|
||||
const encryptedKey = bchjs.BitcoinCash.encryptBIP38(
|
||||
fixture.wif,
|
||||
fixture.password
|
||||
@@ -278,20 +283,22 @@ describe('#BitcoinCash', () => {
|
||||
})
|
||||
})
|
||||
|
||||
fixtures.bip38.encrypt.testnet.forEach(fixture => {
|
||||
it(`BIP 38 encrypt wif ${fixture.wif} with password ${fixture.password} on testnet`, () => {
|
||||
const encryptedKey = bchjs.BitcoinCash.encryptBIP38(
|
||||
fixture.wif,
|
||||
fixture.password
|
||||
)
|
||||
assert.equal(encryptedKey, fixture.encryptedKey)
|
||||
})
|
||||
})
|
||||
// fixtures.bip38.encrypt.testnet.forEach(fixture => {
|
||||
// it(`BIP 38 encrypt wif ${fixture.wif} with password ${fixture.password} on testnet`, function () {
|
||||
// this.timeout(60000)
|
||||
// const encryptedKey = bchjs.BitcoinCash.encryptBIP38(
|
||||
// fixture.wif,
|
||||
// fixture.password
|
||||
// )
|
||||
// assert.equal(encryptedKey, fixture.encryptedKey)
|
||||
// })
|
||||
// })
|
||||
})
|
||||
|
||||
describe('#decryptBIP38', () => {
|
||||
fixtures.bip38.decrypt.mainnet.forEach(fixture => {
|
||||
it(`BIP 38 decrypt encrypted key ${fixture.encryptedKey} on mainnet`, () => {
|
||||
it(`BIP 38 decrypt encrypted key ${fixture.encryptedKey} on mainnet`, function () {
|
||||
this.timeout(60000)
|
||||
const wif = bchjs.BitcoinCash.decryptBIP38(
|
||||
fixture.encryptedKey,
|
||||
fixture.password,
|
||||
@@ -301,16 +308,17 @@ describe('#BitcoinCash', () => {
|
||||
})
|
||||
})
|
||||
|
||||
fixtures.bip38.decrypt.testnet.forEach(fixture => {
|
||||
it(`BIP 38 decrypt encrypted key ${fixture.encryptedKey} on testnet`, () => {
|
||||
const wif = bchjs.BitcoinCash.decryptBIP38(
|
||||
fixture.encryptedKey,
|
||||
fixture.password,
|
||||
'testnet'
|
||||
)
|
||||
assert.equal(wif, fixture.wif)
|
||||
})
|
||||
})
|
||||
// fixtures.bip38.decrypt.testnet.forEach(fixture => {
|
||||
// it(`BIP 38 decrypt encrypted key ${fixture.encryptedKey} on testnet`, function () {
|
||||
// this.timeout(60000)
|
||||
// const wif = bchjs.BitcoinCash.decryptBIP38(
|
||||
// fixture.encryptedKey,
|
||||
// fixture.password,
|
||||
// 'testnet'
|
||||
// )
|
||||
// assert.equal(wif, fixture.wif)
|
||||
// })
|
||||
// })
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -93,7 +93,7 @@ describe('#Blockchain', () => {
|
||||
await bchjs.Blockchain.getBlock(blockhash)
|
||||
assert2.fail('Unexpected result')
|
||||
} catch (err) {
|
||||
assert2.include(err, 'Test Error')
|
||||
assert2.include(err.message, 'Test Error')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -406,11 +406,6 @@
|
||||
"wif": "L1XHKhaBAfkr2FJQn3pTfCMxz652WYfmvKj8xDCHCEDV9tWGcbYj",
|
||||
"password": "1EBPIyj55eR8bVUov9",
|
||||
"encryptedKey": "6PYWWnBNfNpSqEJZKcfwbrYgTTdb9PNiGjQJ8r9V6cvsZNKLfcZD8YefQc"
|
||||
},
|
||||
{
|
||||
"wif": "L1phBREbhL4vb1uHHHCAse8bdGE5c7ic2PFjRxMawLzQCsiFVbvu",
|
||||
"password": "9GKVkabAHBMyAf",
|
||||
"encryptedKey": "6PYU2fDHRVF2194gKDGkbFbeu4mFgkWtVvg2RPd2Sp6KmZx3RCHFpgBB2G"
|
||||
}
|
||||
],
|
||||
"testnet": [
|
||||
@@ -432,11 +427,6 @@
|
||||
"wif": "L1XHKhaBAfkr2FJQn3pTfCMxz652WYfmvKj8xDCHCEDV9tWGcbYj",
|
||||
"password": "1EBPIyj55eR8bVUov9",
|
||||
"encryptedKey": "6PYWWnBNfNpSqEJZKcfwbrYgTTdb9PNiGjQJ8r9V6cvsZNKLfcZD8YefQc"
|
||||
},
|
||||
{
|
||||
"wif": "L1phBREbhL4vb1uHHHCAse8bdGE5c7ic2PFjRxMawLzQCsiFVbvu",
|
||||
"password": "9GKVkabAHBMyAf",
|
||||
"encryptedKey": "6PYU2fDHRVF2194gKDGkbFbeu4mFgkWtVvg2RPd2Sp6KmZx3RCHFpgBB2G"
|
||||
}
|
||||
],
|
||||
"testnet": [
|
||||
|
||||
@@ -43,14 +43,14 @@ describe('#PsfSlpIndexer', () => {
|
||||
try {
|
||||
// Stub the network call.
|
||||
const testErr = new Error()
|
||||
testErr.response = { data: { status: 422 } }
|
||||
testErr.response = { data: { error: 'Status 422' } }
|
||||
sandbox.stub(axios, 'get').throws(testErr)
|
||||
|
||||
await bchjs.PsfSlpIndexer.status()
|
||||
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
||||
assert.equal(true, false, 'Unexpected result!')
|
||||
} catch (err) {
|
||||
assert.equal(err.status, 422)
|
||||
assert.equal(err.message, 'Status 422')
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -103,7 +103,7 @@ describe('#PsfSlpIndexer', () => {
|
||||
try {
|
||||
// Stub the network call.
|
||||
const testErr = new Error()
|
||||
testErr.response = { data: { status: 422 } }
|
||||
testErr.response = { data: { error: 'Status 422' } }
|
||||
sandbox.stub(axios, 'post').throws(testErr)
|
||||
|
||||
const addr = 'bitcoincash:qzmd5vxgh9m22m6fgvm57yd6kjnjl9qnwywsf3583n'
|
||||
@@ -112,7 +112,7 @@ describe('#PsfSlpIndexer', () => {
|
||||
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
||||
assert.equal(true, false, 'Unexpected result!')
|
||||
} catch (err) {
|
||||
assert.equal(err.status, 422)
|
||||
assert.equal(err.message, 'Status 422')
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -174,7 +174,7 @@ describe('#PsfSlpIndexer', () => {
|
||||
try {
|
||||
// Stub the network call.
|
||||
const testErr = new Error()
|
||||
testErr.response = { data: { status: 422 } }
|
||||
testErr.response = { data: { error: 'Status 422' } }
|
||||
sandbox.stub(axios, 'post').throws(testErr)
|
||||
|
||||
const tokenId =
|
||||
@@ -182,7 +182,7 @@ describe('#PsfSlpIndexer', () => {
|
||||
await bchjs.PsfSlpIndexer.tokenStats(tokenId)
|
||||
assert.equal(true, false, 'Unexpected result!')
|
||||
} catch (err) {
|
||||
assert.equal(err.status, 422)
|
||||
assert.equal(err.message, 'Status 422')
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -399,7 +399,7 @@ describe('#PsfSlpIndexer', () => {
|
||||
try {
|
||||
// Stub the network call.
|
||||
const testErr = new Error()
|
||||
testErr.response = { data: { status: 422 } }
|
||||
testErr.response = { data: { error: 'Status 422' } }
|
||||
sandbox.stub(axios, 'post').throws(testErr)
|
||||
|
||||
const tokenId =
|
||||
@@ -407,7 +407,7 @@ describe('#PsfSlpIndexer', () => {
|
||||
await bchjs.PsfSlpIndexer.getTokenData(tokenId)
|
||||
assert.equal(true, false, 'Unexpected result!')
|
||||
} catch (err) {
|
||||
assert.equal(err.status, 422)
|
||||
assert.equal(err.message, 'Status 422')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
Focused unit tests for retry behavior in raw-transactions.js.
|
||||
*/
|
||||
|
||||
import assert from 'assert'
|
||||
import sinon from 'sinon'
|
||||
|
||||
import RawTransactions from '../../src/raw-transactions.js'
|
||||
|
||||
describe('#RawTransactions Retry Logic', () => {
|
||||
afterEach(() => sinon.restore())
|
||||
|
||||
it('retries once on ECONNRESET and succeeds', async () => {
|
||||
const axiosStub = sinon.stub()
|
||||
axiosStub.onCall(0).rejects(Object.assign(new Error('socket hang up'), { code: 'ECONNRESET' }))
|
||||
axiosStub.onCall(1).resolves({ data: ['txid-123'] })
|
||||
|
||||
const uut = new RawTransactions({
|
||||
restURL: 'http://localhost:5942/v6/',
|
||||
authToken: '',
|
||||
axios: axiosStub
|
||||
})
|
||||
uut.broadcastRetryDelayMs = 0
|
||||
|
||||
const result = await uut.sendRawTransaction(['abcd'])
|
||||
|
||||
assert.deepStrictEqual(result, ['txid-123'])
|
||||
assert.equal(axiosStub.callCount, 2)
|
||||
assert.equal(axiosStub.getCall(0).args[0].headers.Connection, 'close')
|
||||
assert.equal(axiosStub.getCall(1).args[0].headers.Connection, 'close')
|
||||
})
|
||||
|
||||
it('does not retry on non-transient errors', async () => {
|
||||
const axiosStub = sinon.stub()
|
||||
axiosStub.rejects(new Error('RPC validation error'))
|
||||
|
||||
const uut = new RawTransactions({
|
||||
restURL: 'http://localhost:5942/v6/',
|
||||
authToken: '',
|
||||
axios: axiosStub
|
||||
})
|
||||
uut.broadcastRetryDelayMs = 0
|
||||
|
||||
await assert.rejects(
|
||||
uut.sendRawTransaction(['abcd']),
|
||||
/RPC validation error/
|
||||
)
|
||||
assert.equal(axiosStub.callCount, 1)
|
||||
})
|
||||
|
||||
it('enforces retry cap for repeated transient failures', async () => {
|
||||
const axiosStub = sinon.stub()
|
||||
axiosStub.rejects(Object.assign(new Error('socket hang up'), { code: 'ECONNRESET' }))
|
||||
|
||||
const uut = new RawTransactions({
|
||||
restURL: 'http://localhost:5942/v6/',
|
||||
authToken: '',
|
||||
axios: axiosStub
|
||||
})
|
||||
uut.broadcastRetryDelayMs = 0
|
||||
uut.maxBroadcastRetries = 3
|
||||
|
||||
await assert.rejects(
|
||||
uut.sendRawTransaction(['abcd']),
|
||||
/socket hang up/
|
||||
)
|
||||
|
||||
// 1 initial attempt + 2 retries.
|
||||
assert.equal(axiosStub.callCount, 4)
|
||||
})
|
||||
})
|
||||
+9
-5
@@ -20,8 +20,10 @@ describe('#X402 Integration', () => {
|
||||
})
|
||||
|
||||
assert.strictEqual(bchjs.wif, '')
|
||||
assert.strictEqual(bchjs.paymentAmountSats, 10000)
|
||||
assert.strictEqual(bchjs.bchServerURL, 'https://bch.fullstack.cash/v6/')
|
||||
// assert.strictEqual(bchjs.paymentAmountSats, 10000)
|
||||
assert.strictEqual(typeof bchjs.paymentAmountSats, 'number')
|
||||
assert.ok(Number.isInteger(bchjs.paymentAmountSats) && bchjs.paymentAmountSats > 0)
|
||||
assert.strictEqual(bchjs.bchServerURL, 'https://bch.fullstack.cash/v6')
|
||||
})
|
||||
|
||||
it('should accept wif in config', () => {
|
||||
@@ -59,8 +61,10 @@ describe('#X402 Integration', () => {
|
||||
})
|
||||
|
||||
assert.strictEqual(bchjs.wif, '')
|
||||
assert.strictEqual(bchjs.paymentAmountSats, 10000)
|
||||
assert.strictEqual(bchjs.bchServerURL, 'https://bch.fullstack.cash/v6/')
|
||||
// assert.strictEqual(bchjs.paymentAmountSats, 10000)
|
||||
assert.strictEqual(typeof bchjs.paymentAmountSats, 'number')
|
||||
assert.ok(Number.isInteger(bchjs.paymentAmountSats) && bchjs.paymentAmountSats > 0)
|
||||
assert.strictEqual(bchjs.bchServerURL, 'https://bch.fullstack.cash/v6')
|
||||
})
|
||||
|
||||
it('should read WIF from BCHJSWIF environment variable', () => {
|
||||
@@ -168,7 +172,7 @@ describe('#X402 Integration', () => {
|
||||
})
|
||||
|
||||
assert.strictEqual(bchjs.restURL, customRestURL)
|
||||
assert.strictEqual(bchjs.bchServerURL, 'https://bch.fullstack.cash/v6/')
|
||||
assert.strictEqual(bchjs.bchServerURL, 'https://bch.fullstack.cash/v6')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user