mirror of
https://github.com/Permissionless-Software-Foundation/bch-js.git
synced 2026-09-23 01:22:01 -07:00
Compare commits
22
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de8c8e6284 | ||
|
|
739bdf1f34 | ||
|
|
b207a1639e | ||
|
|
a169c0f7d0 | ||
|
|
65cf49adf0 | ||
|
|
65104d60ad | ||
|
|
fd0a1a6af2 | ||
|
|
25299e2f6e | ||
|
|
b184c080f1 | ||
|
|
d2c999f739 | ||
|
|
4d2d8d0e5a | ||
|
|
fec9d371af | ||
|
|
b3c74b4a8b | ||
|
|
1aa99a820a | ||
|
|
6652e1e4af | ||
|
|
b70e0a16c0 | ||
|
|
a94392c4a5 | ||
|
|
ba02724d54 | ||
|
|
b12110a617 | ||
|
|
cfd94cb529 | ||
|
|
7377a93c06 | ||
|
|
ea501bb4ef |
+1
-1
@@ -27,4 +27,4 @@ deploy:
|
|||||||
provider: script
|
provider: script
|
||||||
skip_cleanup: true
|
skip_cleanup: true
|
||||||
script:
|
script:
|
||||||
- npx semantic-release
|
- npx semantic-release && ./deploy-production.sh
|
||||||
|
|||||||
Executable
+14
@@ -0,0 +1,14 @@
|
|||||||
|
# Triggers a webhook to update the staging server at staging.fullstack.cash.
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
#echo $DEPLOY_SECRET
|
||||||
|
|
||||||
|
echo "Deploy to production...."
|
||||||
|
|
||||||
|
export DATA="{\"ref\":\"$DEPLOY_SECRET\"}"
|
||||||
|
|
||||||
|
#echo $DATA
|
||||||
|
|
||||||
|
curl -X POST http://fullstack.cash:9000/hooks/bch-js -H "Content-Type: application/json" -d $DATA
|
||||||
|
|
||||||
|
echo "...Finished deploying to production."
|
||||||
+1
-2
@@ -1,4 +1,3 @@
|
|||||||
**Note:** This directory is being deprecated. Examples have been moved to this
|
Examples have been moved to this repository:
|
||||||
repository:
|
|
||||||
|
|
||||||
https://github.com/Permissionless-Software-Foundation/bch-js-examples
|
https://github.com/Permissionless-Software-Foundation/bch-js-examples
|
||||||
|
|||||||
Generated
+213
-220
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@chris.troutner/bch-js",
|
"name": "@psf/bch-js",
|
||||||
"version": "3.0.0",
|
"version": "3.4.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -1697,13 +1697,13 @@
|
|||||||
"integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs="
|
"integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs="
|
||||||
},
|
},
|
||||||
"compare-func": {
|
"compare-func": {
|
||||||
"version": "1.3.4",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/compare-func/-/compare-func-1.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz",
|
||||||
"integrity": "sha512-sq2sWtrqKPkEXAC8tEJA1+BqAH9GbFkGBtUOqrUX57VSfwp8xyktctk+uLoRy5eccTdxzDcVIztlYDpKs3Jv1Q==",
|
"integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"array-ify": "^1.0.0",
|
"array-ify": "^1.0.0",
|
||||||
"dot-prop": "^3.0.0"
|
"dot-prop": "^5.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"component-bind": {
|
"component-bind": {
|
||||||
@@ -1777,22 +1777,49 @@
|
|||||||
"integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo="
|
"integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo="
|
||||||
},
|
},
|
||||||
"conventional-changelog-angular": {
|
"conventional-changelog-angular": {
|
||||||
"version": "5.0.10",
|
"version": "5.0.11",
|
||||||
"resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-5.0.10.tgz",
|
"resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-5.0.11.tgz",
|
||||||
"integrity": "sha512-k7RPPRs0vp8+BtPsM9uDxRl6KcgqtCJmzRD1wRtgqmhQ96g8ifBGo9O/TZBG23jqlXS/rg8BKRDELxfnQQGiaA==",
|
"integrity": "sha512-nSLypht/1yEflhuTogC03i7DX7sOrXGsRn14g131Potqi6cbGbGEE9PSDEHKldabB6N76HiSyw9Ph+kLmC04Qw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"compare-func": "^1.3.1",
|
"compare-func": "^2.0.0",
|
||||||
"q": "^1.5.1"
|
"q": "^1.5.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"compare-func": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/compare-func/-/compare-func-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-zHig5N+tPWARooBnb0Zx1MFcdfpyJrfTJ3Y5L+IFvUm8rM74hHz66z0gw0x4tijh5CorKkKUCnW82R2vmpeCRA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"array-ify": "^1.0.0",
|
||||||
|
"dot-prop": "^5.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dot-prop": {
|
||||||
|
"version": "5.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.2.0.tgz",
|
||||||
|
"integrity": "sha512-uEUyaDKoSQ1M4Oq8l45hSE26SnTxL6snNnqvK/VWx5wJhmff5z0FUVJDKDanor/6w3kzE3i7XZOk+7wC0EXr1A==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"is-obj": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"is-obj": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"conventional-changelog-writer": {
|
"conventional-changelog-writer": {
|
||||||
"version": "4.0.16",
|
"version": "4.0.17",
|
||||||
"resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-4.0.16.tgz",
|
"resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-4.0.17.tgz",
|
||||||
"integrity": "sha512-jmU1sDJDZpm/dkuFxBeRXvyNcJQeKhGtVcFFkwTphUAzyYWcwz2j36Wcv+Mv2hU3tpvLMkysOPXJTLO55AUrYQ==",
|
"integrity": "sha512-IKQuK3bib/n032KWaSb8YlBFds+aLmzENtnKtxJy3+HqDq5kohu3g/UdNbIHeJWygfnEbZjnCKFxAW0y7ArZAw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"compare-func": "^1.3.1",
|
"compare-func": "^2.0.0",
|
||||||
"conventional-commits-filter": "^2.0.6",
|
"conventional-commits-filter": "^2.0.6",
|
||||||
"dateformat": "^3.0.0",
|
"dateformat": "^3.0.0",
|
||||||
"handlebars": "^4.7.6",
|
"handlebars": "^4.7.6",
|
||||||
@@ -2168,12 +2195,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dot-prop": {
|
"dot-prop": {
|
||||||
"version": "3.0.0",
|
"version": "5.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.2.0.tgz",
|
||||||
"integrity": "sha1-G3CK8JSknJoOfbyteQq6U52sEXc=",
|
"integrity": "sha512-uEUyaDKoSQ1M4Oq8l45hSE26SnTxL6snNnqvK/VWx5wJhmff5z0FUVJDKDanor/6w3kzE3i7XZOk+7wC0EXr1A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"is-obj": "^1.0.0"
|
"is-obj": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dotignore": {
|
"dotignore": {
|
||||||
@@ -2255,9 +2282,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"elliptic": {
|
"elliptic": {
|
||||||
"version": "6.5.2",
|
"version": "6.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
|
||||||
"integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==",
|
"integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"bn.js": "^4.4.0",
|
"bn.js": "^4.4.0",
|
||||||
"brorand": "^1.0.1",
|
"brorand": "^1.0.1",
|
||||||
@@ -4041,9 +4068,9 @@
|
|||||||
"integrity": "sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw=="
|
"integrity": "sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw=="
|
||||||
},
|
},
|
||||||
"is-obj": {
|
"is-obj": {
|
||||||
"version": "1.0.1",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz",
|
||||||
"integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=",
|
"integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"is-plain-obj": {
|
"is-plain-obj": {
|
||||||
@@ -5100,9 +5127,9 @@
|
|||||||
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
|
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
|
||||||
},
|
},
|
||||||
"neo-async": {
|
"neo-async": {
|
||||||
"version": "2.6.1",
|
"version": "2.6.2",
|
||||||
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz",
|
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz",
|
||||||
"integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==",
|
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"nerf-dart": {
|
"nerf-dart": {
|
||||||
@@ -5274,9 +5301,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"npm": {
|
"npm": {
|
||||||
"version": "6.14.6",
|
"version": "6.14.7",
|
||||||
"resolved": "https://registry.npmjs.org/npm/-/npm-6.14.6.tgz",
|
"resolved": "https://registry.npmjs.org/npm/-/npm-6.14.7.tgz",
|
||||||
"integrity": "sha512-axnz6iHFK6WPE0js/+mRp+4IOwpHn5tJEw5KB6FiCU764zmffrhsYHbSHi2kKqNkRBt53XasXjngZfBD3FQzrQ==",
|
"integrity": "sha512-swhsdpNpyXg4GbM6LpOQ6qaloQuIKizZ+Zh6JPXJQc59ka49100Js0WvZx594iaKSoFgkFq2s8uXFHS3/Xy2WQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"JSONStream": "^1.3.5",
|
"JSONStream": "^1.3.5",
|
||||||
@@ -5285,7 +5312,7 @@
|
|||||||
"ansistyles": "~0.1.3",
|
"ansistyles": "~0.1.3",
|
||||||
"aproba": "^2.0.0",
|
"aproba": "^2.0.0",
|
||||||
"archy": "~1.0.0",
|
"archy": "~1.0.0",
|
||||||
"bin-links": "^1.1.7",
|
"bin-links": "^1.1.8",
|
||||||
"bluebird": "^3.5.5",
|
"bluebird": "^3.5.5",
|
||||||
"byte-size": "^5.0.1",
|
"byte-size": "^5.0.1",
|
||||||
"cacache": "^12.0.3",
|
"cacache": "^12.0.3",
|
||||||
@@ -5306,7 +5333,7 @@
|
|||||||
"find-npm-prefix": "^1.0.2",
|
"find-npm-prefix": "^1.0.2",
|
||||||
"fs-vacuum": "~1.2.10",
|
"fs-vacuum": "~1.2.10",
|
||||||
"fs-write-stream-atomic": "~1.0.10",
|
"fs-write-stream-atomic": "~1.0.10",
|
||||||
"gentle-fs": "^2.3.0",
|
"gentle-fs": "^2.3.1",
|
||||||
"glob": "^7.1.6",
|
"glob": "^7.1.6",
|
||||||
"graceful-fs": "^4.2.4",
|
"graceful-fs": "^4.2.4",
|
||||||
"has-unicode": "~2.0.1",
|
"has-unicode": "~2.0.1",
|
||||||
@@ -5321,14 +5348,14 @@
|
|||||||
"is-cidr": "^3.0.0",
|
"is-cidr": "^3.0.0",
|
||||||
"json-parse-better-errors": "^1.0.2",
|
"json-parse-better-errors": "^1.0.2",
|
||||||
"lazy-property": "~1.0.0",
|
"lazy-property": "~1.0.0",
|
||||||
"libcipm": "^4.0.7",
|
"libcipm": "^4.0.8",
|
||||||
"libnpm": "^3.0.1",
|
"libnpm": "^3.0.1",
|
||||||
"libnpmaccess": "^3.0.2",
|
"libnpmaccess": "^3.0.2",
|
||||||
"libnpmhook": "^5.0.3",
|
"libnpmhook": "^5.0.3",
|
||||||
"libnpmorg": "^1.0.1",
|
"libnpmorg": "^1.0.1",
|
||||||
"libnpmsearch": "^2.0.2",
|
"libnpmsearch": "^2.0.2",
|
||||||
"libnpmteam": "^1.0.2",
|
"libnpmteam": "^1.0.2",
|
||||||
"libnpx": "^10.2.2",
|
"libnpx": "^10.2.4",
|
||||||
"lock-verify": "^2.1.0",
|
"lock-verify": "^2.1.0",
|
||||||
"lockfile": "^1.0.4",
|
"lockfile": "^1.0.4",
|
||||||
"lodash._baseindexof": "*",
|
"lodash._baseindexof": "*",
|
||||||
@@ -5350,10 +5377,10 @@
|
|||||||
"node-gyp": "^5.1.0",
|
"node-gyp": "^5.1.0",
|
||||||
"nopt": "^4.0.3",
|
"nopt": "^4.0.3",
|
||||||
"normalize-package-data": "^2.5.0",
|
"normalize-package-data": "^2.5.0",
|
||||||
"npm-audit-report": "^1.3.2",
|
"npm-audit-report": "^1.3.3",
|
||||||
"npm-cache-filename": "~1.0.2",
|
"npm-cache-filename": "~1.0.2",
|
||||||
"npm-install-checks": "^3.0.2",
|
"npm-install-checks": "^3.0.2",
|
||||||
"npm-lifecycle": "^3.1.4",
|
"npm-lifecycle": "^3.1.5",
|
||||||
"npm-package-arg": "^6.1.1",
|
"npm-package-arg": "^6.1.1",
|
||||||
"npm-packlist": "^1.4.8",
|
"npm-packlist": "^1.4.8",
|
||||||
"npm-pick-manifest": "^3.0.2",
|
"npm-pick-manifest": "^3.0.2",
|
||||||
@@ -5567,7 +5594,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bin-links": {
|
"bin-links": {
|
||||||
"version": "1.1.7",
|
"version": "1.1.8",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -5722,26 +5749,41 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cliui": {
|
"cliui": {
|
||||||
"version": "4.1.0",
|
"version": "5.0.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"string-width": "^2.1.1",
|
"string-width": "^3.1.0",
|
||||||
"strip-ansi": "^4.0.0",
|
"strip-ansi": "^5.2.0",
|
||||||
"wrap-ansi": "^2.0.0"
|
"wrap-ansi": "^5.1.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ansi-regex": {
|
"ansi-regex": {
|
||||||
"version": "3.0.0",
|
"version": "4.1.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"strip-ansi": {
|
"is-fullwidth-code-point": {
|
||||||
"version": "4.0.0",
|
"version": "2.0.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"string-width": {
|
||||||
|
"version": "3.1.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ansi-regex": "^3.0.0"
|
"emoji-regex": "^7.0.1",
|
||||||
|
"is-fullwidth-code-point": "^2.0.0",
|
||||||
|
"strip-ansi": "^5.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"strip-ansi": {
|
||||||
|
"version": "5.2.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"ansi-regex": "^4.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6103,6 +6145,11 @@
|
|||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"emoji-regex": {
|
||||||
|
"version": "7.0.3",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"encoding": {
|
"encoding": {
|
||||||
"version": "0.1.12",
|
"version": "0.1.12",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
@@ -6228,14 +6275,6 @@
|
|||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"find-up": {
|
|
||||||
"version": "2.1.0",
|
|
||||||
"bundled": true,
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"locate-path": "^2.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flush-write-stream": {
|
"flush-write-stream": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
@@ -6434,7 +6473,7 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"gentle-fs": {
|
"gentle-fs": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -6464,7 +6503,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"get-caller-file": {
|
"get-caller-file": {
|
||||||
"version": "1.0.3",
|
"version": "2.0.5",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
@@ -6688,11 +6727,6 @@
|
|||||||
"validate-npm-package-name": "^3.0.0"
|
"validate-npm-package-name": "^3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"invert-kv": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"bundled": true,
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"ip": {
|
"ip": {
|
||||||
"version": "1.1.5",
|
"version": "1.1.5",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
@@ -6877,16 +6911,8 @@
|
|||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"lcid": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"bundled": true,
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"invert-kv": "^2.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"libcipm": {
|
"libcipm": {
|
||||||
"version": "4.0.7",
|
"version": "4.0.8",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -6896,7 +6922,7 @@
|
|||||||
"find-npm-prefix": "^1.0.2",
|
"find-npm-prefix": "^1.0.2",
|
||||||
"graceful-fs": "^4.1.11",
|
"graceful-fs": "^4.1.11",
|
||||||
"ini": "^1.3.5",
|
"ini": "^1.3.5",
|
||||||
"lock-verify": "^2.0.2",
|
"lock-verify": "^2.1.0",
|
||||||
"mkdirp": "^0.5.1",
|
"mkdirp": "^0.5.1",
|
||||||
"npm-lifecycle": "^3.0.0",
|
"npm-lifecycle": "^3.0.0",
|
||||||
"npm-logical-tree": "^1.2.1",
|
"npm-logical-tree": "^1.2.1",
|
||||||
@@ -7055,7 +7081,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"libnpx": {
|
"libnpx": {
|
||||||
"version": "10.2.2",
|
"version": "10.2.4",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -7066,16 +7092,7 @@
|
|||||||
"update-notifier": "^2.3.0",
|
"update-notifier": "^2.3.0",
|
||||||
"which": "^1.3.0",
|
"which": "^1.3.0",
|
||||||
"y18n": "^4.0.0",
|
"y18n": "^4.0.0",
|
||||||
"yargs": "^11.0.0"
|
"yargs": "^14.2.3"
|
||||||
}
|
|
||||||
},
|
|
||||||
"locate-path": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"bundled": true,
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"p-locate": "^2.0.0",
|
|
||||||
"path-exists": "^3.0.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lock-verify": {
|
"lock-verify": {
|
||||||
@@ -7206,36 +7223,11 @@
|
|||||||
"ssri": "^6.0.0"
|
"ssri": "^6.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"map-age-cleaner": {
|
|
||||||
"version": "0.1.3",
|
|
||||||
"bundled": true,
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"p-defer": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"meant": {
|
"meant": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"mem": {
|
|
||||||
"version": "4.3.0",
|
|
||||||
"bundled": true,
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"map-age-cleaner": "^0.1.1",
|
|
||||||
"mimic-fn": "^2.0.0",
|
|
||||||
"p-is-promise": "^2.0.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"mimic-fn": {
|
|
||||||
"version": "2.1.0",
|
|
||||||
"bundled": true,
|
|
||||||
"dev": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"mime-db": {
|
"mime-db": {
|
||||||
"version": "1.35.0",
|
"version": "1.35.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
@@ -7338,11 +7330,6 @@
|
|||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"nice-try": {
|
|
||||||
"version": "1.0.5",
|
|
||||||
"bundled": true,
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node-fetch-npm": {
|
"node-fetch-npm": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
@@ -7402,7 +7389,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"npm-audit-report": {
|
"npm-audit-report": {
|
||||||
"version": "1.3.2",
|
"version": "1.3.3",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -7432,7 +7419,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"npm-lifecycle": {
|
"npm-lifecycle": {
|
||||||
"version": "3.1.4",
|
"version": "3.1.5",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -7589,44 +7576,6 @@
|
|||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"os-locale": {
|
|
||||||
"version": "3.1.0",
|
|
||||||
"bundled": true,
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"execa": "^1.0.0",
|
|
||||||
"lcid": "^2.0.0",
|
|
||||||
"mem": "^4.0.0"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"cross-spawn": {
|
|
||||||
"version": "6.0.5",
|
|
||||||
"bundled": true,
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"nice-try": "^1.0.4",
|
|
||||||
"path-key": "^2.0.1",
|
|
||||||
"semver": "^5.5.0",
|
|
||||||
"shebang-command": "^1.2.0",
|
|
||||||
"which": "^1.2.9"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"execa": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"bundled": true,
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"cross-spawn": "^6.0.0",
|
|
||||||
"get-stream": "^4.0.0",
|
|
||||||
"is-stream": "^1.1.0",
|
|
||||||
"npm-run-path": "^2.0.0",
|
|
||||||
"p-finally": "^1.0.0",
|
|
||||||
"signal-exit": "^3.0.0",
|
|
||||||
"strip-eof": "^1.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"os-tmpdir": {
|
"os-tmpdir": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
@@ -7641,42 +7590,11 @@
|
|||||||
"os-tmpdir": "^1.0.0"
|
"os-tmpdir": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"p-defer": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"bundled": true,
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"p-finally": {
|
"p-finally": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"p-is-promise": {
|
|
||||||
"version": "2.1.0",
|
|
||||||
"bundled": true,
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"p-limit": {
|
|
||||||
"version": "1.2.0",
|
|
||||||
"bundled": true,
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"p-try": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"p-locate": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"bundled": true,
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"p-limit": "^1.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"p-try": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"bundled": true,
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"package-json": {
|
"package-json": {
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
@@ -8073,7 +7991,7 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"require-main-filename": {
|
"require-main-filename": {
|
||||||
"version": "1.0.1",
|
"version": "2.0.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
@@ -8723,22 +8641,41 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"wrap-ansi": {
|
"wrap-ansi": {
|
||||||
"version": "2.1.0",
|
"version": "5.1.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"string-width": "^1.0.1",
|
"ansi-styles": "^3.2.0",
|
||||||
"strip-ansi": "^3.0.1"
|
"string-width": "^3.0.0",
|
||||||
|
"strip-ansi": "^5.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"ansi-regex": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"is-fullwidth-code-point": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"string-width": {
|
"string-width": {
|
||||||
"version": "1.0.2",
|
"version": "3.1.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"code-point-at": "^1.0.0",
|
"emoji-regex": "^7.0.1",
|
||||||
"is-fullwidth-code-point": "^1.0.0",
|
"is-fullwidth-code-point": "^2.0.0",
|
||||||
"strip-ansi": "^3.0.0"
|
"strip-ansi": "^5.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"strip-ansi": {
|
||||||
|
"version": "5.2.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"ansi-regex": "^4.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8779,37 +8716,105 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"yargs": {
|
"yargs": {
|
||||||
"version": "11.1.1",
|
"version": "14.2.3",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"cliui": "^4.0.0",
|
"cliui": "^5.0.0",
|
||||||
"decamelize": "^1.1.1",
|
"decamelize": "^1.2.0",
|
||||||
"find-up": "^2.1.0",
|
"find-up": "^3.0.0",
|
||||||
"get-caller-file": "^1.0.1",
|
"get-caller-file": "^2.0.1",
|
||||||
"os-locale": "^3.1.0",
|
|
||||||
"require-directory": "^2.1.1",
|
"require-directory": "^2.1.1",
|
||||||
"require-main-filename": "^1.0.1",
|
"require-main-filename": "^2.0.0",
|
||||||
"set-blocking": "^2.0.0",
|
"set-blocking": "^2.0.0",
|
||||||
"string-width": "^2.0.0",
|
"string-width": "^3.0.0",
|
||||||
"which-module": "^2.0.0",
|
"which-module": "^2.0.0",
|
||||||
"y18n": "^3.2.1",
|
"y18n": "^4.0.0",
|
||||||
"yargs-parser": "^9.0.2"
|
"yargs-parser": "^15.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"y18n": {
|
"ansi-regex": {
|
||||||
"version": "3.2.1",
|
"version": "4.1.0",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true
|
"dev": true
|
||||||
|
},
|
||||||
|
"find-up": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"locate-path": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"is-fullwidth-code-point": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"locate-path": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"p-locate": "^3.0.0",
|
||||||
|
"path-exists": "^3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"p-limit": {
|
||||||
|
"version": "2.3.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"p-try": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"p-locate": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"p-limit": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"p-try": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"string-width": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"emoji-regex": "^7.0.1",
|
||||||
|
"is-fullwidth-code-point": "^2.0.0",
|
||||||
|
"strip-ansi": "^5.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"strip-ansi": {
|
||||||
|
"version": "5.2.0",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"ansi-regex": "^4.1.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"yargs-parser": {
|
"yargs-parser": {
|
||||||
"version": "9.0.2",
|
"version": "15.0.1",
|
||||||
"bundled": true,
|
"bundled": true,
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"camelcase": "^4.1.0"
|
"camelcase": "^5.0.0",
|
||||||
|
"decamelize": "^1.2.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"camelcase": {
|
||||||
|
"version": "5.3.1",
|
||||||
|
"bundled": true,
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11481,23 +11486,11 @@
|
|||||||
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA=="
|
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA=="
|
||||||
},
|
},
|
||||||
"uglify-js": {
|
"uglify-js": {
|
||||||
"version": "3.9.4",
|
"version": "3.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.9.4.tgz",
|
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.10.0.tgz",
|
||||||
"integrity": "sha512-8RZBJq5smLOa7KslsNsVcSH+KOXf1uDU8yqLeNuVKwmT0T3FA0ZoXlinQfRad7SDcbZZRZE4ov+2v71EnxNyCA==",
|
"integrity": "sha512-Esj5HG5WAyrLIdYU74Z3JdG2PxdIusvj6IWHMtlyESxc7kcDz7zYlYjpnSokn1UbpV0d/QX9fan7gkCNd/9BQA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true
|
||||||
"requires": {
|
|
||||||
"commander": "~2.20.3"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"commander": {
|
|
||||||
"version": "2.20.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
|
||||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
|
||||||
"dev": true,
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"uniq": {
|
"uniq": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
|
|||||||
+6
-6
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@chris.troutner/bch-js",
|
"name": "@psf/bch-js",
|
||||||
"version": "3.0.0",
|
"version": "3.4.0",
|
||||||
"description": "Bitcoin Cash JavaScript Library based on BITBOX",
|
"description": "The FullStack.cash JavaScript library for Bitcoin Cash and SLP Tokens",
|
||||||
"author": "Chris Troutner <chris.troutner@gmail.com>",
|
"author": "Chris Troutner <chris.troutner@gmail.com>",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"Gabriel Cardona <gabriel@bitcoin.com>"
|
"Gabriel Cardona <gabriel@bitcoin.com>"
|
||||||
@@ -15,17 +15,17 @@
|
|||||||
"test:integration:testnet:local": "RESTURL=http://localhost:4000/v3/ mocha --timeout 30000 test/integration/testnet",
|
"test:integration:testnet:local": "RESTURL=http://localhost:4000/v3/ mocha --timeout 30000 test/integration/testnet",
|
||||||
"test:integration:free": "bash test/integration/test-free-tier.sh",
|
"test:integration:free": "bash test/integration/test-free-tier.sh",
|
||||||
"test:integration:free:testnet": "bash test/integration/testnet/test-free-tier.sh",
|
"test:integration:free:testnet": "bash test/integration/testnet/test-free-tier.sh",
|
||||||
"test:temp": "nyc mocha --timeout 30000 test/unit/ipfs.js",
|
"test:temp": "mocha --timeout 30000 test/integration/testnet/ninsight.js",
|
||||||
"test:integration:api": "RESTURL=https://api.fullstack.cash/v3/ mocha --timeout 30000 test/integration",
|
"test:integration:api": "RESTURL=https://api.fullstack.cash/v3/ mocha --timeout 30000 test/integration",
|
||||||
"coverage": "nyc report --reporter=text-lcov | coveralls",
|
"coverage": "nyc report --reporter=text-lcov | coveralls",
|
||||||
"coverage:report": "nyc --reporter=html mocha --timeout 25000 test/unit/",
|
"coverage:report": "nyc --reporter=html mocha --timeout 25000 test/unit/",
|
||||||
"docs": "./node_modules/.bin/apidoc -i src/ -o docs"
|
"docs": "./node_modules/.bin/apidoc -i src/ -o docs"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"homepage": "https://github.com/christroutner/bch-js",
|
"homepage": "https://github.com/Permissionless-Software-Foundation/bch-js",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/christroutner/bch-js.git"
|
"url": "git+https://github.com/Permissionless-Software-Foundation/bch-js.git"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@uppy/core": "^1.10.4",
|
"@uppy/core": "^1.10.4",
|
||||||
|
|||||||
+17
-17
@@ -14,7 +14,7 @@ class Address {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Address.toLegacyAddress() toLegacyAddress() - Convert to Legacy Address
|
* @api Address.toLegacyAddress() toLegacyAddress()
|
||||||
* @apiName toLegacyAddress
|
* @apiName toLegacyAddress
|
||||||
* @apiGroup Address
|
* @apiGroup Address
|
||||||
* @apiDescription Convert cashaddr to legacy address format
|
* @apiDescription Convert cashaddr to legacy address format
|
||||||
@@ -73,7 +73,7 @@ class Address {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Address.toCashAddress() toCashAddress() - Convert to bitcoincash: format
|
* @api Address.toCashAddress() toCashAddress()
|
||||||
* @apiName toCashAddress
|
* @apiName toCashAddress
|
||||||
* @apiGroup Address
|
* @apiGroup Address
|
||||||
* @apiDescription Convert legacy to cashAddress format
|
* @apiDescription Convert legacy to cashAddress format
|
||||||
@@ -120,7 +120,7 @@ class Address {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Address.hash160ToLegacy() hash160ToLegacy() - Convert hash160 to legacy address.
|
* @api Address.hash160ToLegacy() hash160ToLegacy()
|
||||||
* @apiName hash160ToLegacy
|
* @apiName hash160ToLegacy
|
||||||
* @apiGroup Address
|
* @apiGroup Address
|
||||||
* @apiDescription Convert hash160 to legacy address.
|
* @apiDescription Convert hash160 to legacy address.
|
||||||
@@ -146,7 +146,7 @@ class Address {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Address.hash160ToCash() hash160ToCash() - Convert hash160 to cash address.
|
* @api Address.hash160ToCash() hash160ToCash()
|
||||||
* @apiName hash160ToCash
|
* @apiName hash160ToCash
|
||||||
* @apiGroup Address
|
* @apiGroup Address
|
||||||
* @apiDescription Convert hash160 to cash address.
|
* @apiDescription Convert hash160 to cash address.
|
||||||
@@ -255,7 +255,7 @@ class Address {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Address.isLegacyAddress() isLegacyAddress() - Detect if legacy address.
|
* @api Address.isLegacyAddress() isLegacyAddress()
|
||||||
* @apiName isLegacyAddress
|
* @apiName isLegacyAddress
|
||||||
* @apiGroup Address
|
* @apiGroup Address
|
||||||
* @apiDescription Detect if legacy base58check encoded address.
|
* @apiDescription Detect if legacy base58check encoded address.
|
||||||
@@ -291,7 +291,7 @@ class Address {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Address.isCashAddress() isCashAddress() - Detect if cashAddr address.
|
* @api Address.isCashAddress() isCashAddress()
|
||||||
* @apiName isCashAddress
|
* @apiName isCashAddress
|
||||||
* @apiGroup Address
|
* @apiGroup Address
|
||||||
* @apiDescription Detect if cashAddr encoded address.
|
* @apiDescription Detect if cashAddr encoded address.
|
||||||
@@ -326,7 +326,7 @@ class Address {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Address.isHash160() isHash160() - Detect if an addess is a hash160.
|
* @api Address.isHash160() isHash160()
|
||||||
* @apiName isHash160
|
* @apiName isHash160
|
||||||
* @apiGroup Address
|
* @apiGroup Address
|
||||||
* @apiDescription Detect if an addess is a hash160.
|
* @apiDescription Detect if an addess is a hash160.
|
||||||
@@ -345,7 +345,7 @@ class Address {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Address.isMainnetAddress() isMainnetAddress() - Detect if mainnet address.
|
* @api Address.isMainnetAddress() isMainnetAddress()
|
||||||
* @apiName isMainnetAddress
|
* @apiName isMainnetAddress
|
||||||
* @apiGroup Address
|
* @apiGroup Address
|
||||||
* @apiDescription Detect if mainnet address .
|
* @apiDescription Detect if mainnet address .
|
||||||
@@ -384,7 +384,7 @@ class Address {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Address.isTestnetAddress() isTestnetAddress() - Detect if testnet address.
|
* @api Address.isTestnetAddress() isTestnetAddress()
|
||||||
* @apiName isTestnetAddress
|
* @apiName isTestnetAddress
|
||||||
* @apiGroup Address
|
* @apiGroup Address
|
||||||
* @apiDescription Detect if testnet address.
|
* @apiDescription Detect if testnet address.
|
||||||
@@ -422,7 +422,7 @@ class Address {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Address.isRegTestAddress() isRegTestAddress() - Detect if regtest address.
|
* @api Address.isRegTestAddress() isRegTestAddress()
|
||||||
* @apiName isRegTestAddress
|
* @apiName isRegTestAddress
|
||||||
* @apiGroup Address
|
* @apiGroup Address
|
||||||
* @apiDescription Detect if regtest address.
|
* @apiDescription Detect if regtest address.
|
||||||
@@ -461,7 +461,7 @@ class Address {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Address.isP2PKHAddress() isP2PKHAddress() - Detect if p2pkh address.
|
* @api Address.isP2PKHAddress() isP2PKHAddress()
|
||||||
* @apiName isP2PKHAddress
|
* @apiName isP2PKHAddress
|
||||||
* @apiGroup Address
|
* @apiGroup Address
|
||||||
* @apiDescription Detect if p2pkh address.
|
* @apiDescription Detect if p2pkh address.
|
||||||
@@ -498,7 +498,7 @@ class Address {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Address.isP2SHAddress() isP2SHAddress() - Detect if p2sh address.
|
* @api Address.isP2SHAddress() isP2SHAddress()
|
||||||
* @apiName isP2SHAddress
|
* @apiName isP2SHAddress
|
||||||
* @apiGroup Address
|
* @apiGroup Address
|
||||||
* @apiDescription Detect if p2sh address.
|
* @apiDescription Detect if p2sh address.
|
||||||
@@ -534,7 +534,7 @@ class Address {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Address.detectAddressFormat() detectAddressFormat() - Detect address format.
|
* @api Address.detectAddressFormat() detectAddressFormat()
|
||||||
* @apiName detectAddressFormat
|
* @apiName detectAddressFormat
|
||||||
* @apiGroup Address
|
* @apiGroup Address
|
||||||
* @apiDescription Detect address format.
|
* @apiDescription Detect address format.
|
||||||
@@ -572,7 +572,7 @@ class Address {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Address.detectAddressNetwork() detectAddressNetwork() - Detect address network.
|
* @api Address.detectAddressNetwork() detectAddressNetwork()
|
||||||
* @apiName detectAddressNetwork
|
* @apiName detectAddressNetwork
|
||||||
* @apiGroup Address
|
* @apiGroup Address
|
||||||
* @apiDescription Detect address network.
|
* @apiDescription Detect address network.
|
||||||
@@ -622,7 +622,7 @@ class Address {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Address.detectAddressType() detectAddressType() - Detect address type.
|
* @api Address.detectAddressType() detectAddressType()
|
||||||
* @apiName detectAddressType
|
* @apiName detectAddressType
|
||||||
* @apiGroup Address
|
* @apiGroup Address
|
||||||
* @apiDescription Detect address type.
|
* @apiDescription Detect address type.
|
||||||
@@ -660,7 +660,7 @@ class Address {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Address.fromXPub() fromXPub() - Generates an address (xpub).
|
* @api Address.fromXPub() fromXPub()
|
||||||
* @apiName fromXPub
|
* @apiName fromXPub
|
||||||
* @apiGroup Address
|
* @apiGroup Address
|
||||||
* @apiDescription Generates an address for an extended public key (xpub).
|
* @apiDescription Generates an address for an extended public key (xpub).
|
||||||
@@ -698,7 +698,7 @@ class Address {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Address.fromOutputScript() fromOutputScript() - Detect an addess from an OutputScript..
|
* @api Address.fromOutputScript() fromOutputScript()
|
||||||
* @apiName fromOutputScript
|
* @apiName fromOutputScript
|
||||||
* @apiGroup Address
|
* @apiGroup Address
|
||||||
* @apiDescription Detect an addess from an OutputScript..
|
* @apiDescription Detect an addess from an OutputScript..
|
||||||
|
|||||||
+1
-1
@@ -69,7 +69,7 @@ class BCHJS {
|
|||||||
this.OpenBazaar = new OpenBazaar(libConfig)
|
this.OpenBazaar = new OpenBazaar(libConfig)
|
||||||
|
|
||||||
// Bitcoin.com Ninsight indexer
|
// Bitcoin.com Ninsight indexer
|
||||||
this.Ninsight = new Ninsight()
|
this.Ninsight = new Ninsight(config)
|
||||||
|
|
||||||
// ElectrumX indexer
|
// ElectrumX indexer
|
||||||
this.Electrumx = new Electrumx(libConfig)
|
this.Electrumx = new Electrumx(libConfig)
|
||||||
|
|||||||
+12
-12
@@ -15,7 +15,7 @@ class BitcoinCash {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api BitcoinCash.toSatoshi() toSatoshi() - Converting Bitcoin Cash units to satoshi units.
|
* @api BitcoinCash.toSatoshi() toSatoshi()
|
||||||
* @apiName toSatoshi
|
* @apiName toSatoshi
|
||||||
* @apiGroup BitcoinCash
|
* @apiGroup BitcoinCash
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -48,7 +48,7 @@ class BitcoinCash {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api BitcoinCash.toBitcoinCash() toBitcoinCash() - Converting satoshi units to Bitcoin Cash units.
|
* @api BitcoinCash.toBitcoinCash() toBitcoinCash()
|
||||||
* @apiName toBitcoinCash
|
* @apiName toBitcoinCash
|
||||||
* @apiGroup BitcoinCash
|
* @apiGroup BitcoinCash
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -81,7 +81,7 @@ class BitcoinCash {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api BitcoinCash.toBits() toBits() - Converting satoshi units to Bits denomination.
|
* @api BitcoinCash.toBits() toBits()
|
||||||
* @apiName toBits
|
* @apiName toBits
|
||||||
* @apiGroup BitcoinCash
|
* @apiGroup BitcoinCash
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -133,7 +133,7 @@ class BitcoinCash {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api BitcoinCash.signMessageWithPrivKey() signMessageWithPrivKey() - Sign message with private key.
|
* @api BitcoinCash.signMessageWithPrivKey() signMessageWithPrivKey()
|
||||||
* @apiName signMessageWithPrivKey
|
* @apiName signMessageWithPrivKey
|
||||||
* @apiGroup BitcoinCash
|
* @apiGroup BitcoinCash
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -165,7 +165,7 @@ class BitcoinCash {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api BitcoinCash.verifyMessage() verifyMessage() - Verify message.
|
* @api BitcoinCash.verifyMessage() verifyMessage()
|
||||||
* @apiName verifyMessage
|
* @apiName verifyMessage
|
||||||
* @apiGroup BitcoinCash
|
* @apiGroup BitcoinCash
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -189,7 +189,7 @@ class BitcoinCash {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api BitcoinCash.encodeBase58Check() encodeBase58Check() - Encodes hex string as base58Check.
|
* @api BitcoinCash.encodeBase58Check() encodeBase58Check()
|
||||||
* @apiName encodeBase58Check
|
* @apiName encodeBase58Check
|
||||||
* @apiGroup BitcoinCash
|
* @apiGroup BitcoinCash
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -227,7 +227,7 @@ class BitcoinCash {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api BitcoinCash.decodeBase58Check() decodeBase58Check() - Decodes base58Check encoded string to hex.
|
* @api BitcoinCash.decodeBase58Check() decodeBase58Check()
|
||||||
* @apiName decodeBase58Check
|
* @apiName decodeBase58Check
|
||||||
* @apiGroup BitcoinCash
|
* @apiGroup BitcoinCash
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -265,7 +265,7 @@ class BitcoinCash {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api BitcoinCash.encodeBIP21() encodeBIP21() - Encodes address and options as BIP21 uri.
|
* @api BitcoinCash.encodeBIP21() encodeBIP21()
|
||||||
* @apiName encodeBIP21
|
* @apiName encodeBIP21
|
||||||
* @apiGroup BitcoinCash
|
* @apiGroup BitcoinCash
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -306,7 +306,7 @@ class BitcoinCash {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api BitcoinCash.decodeBIP21() decodeBIP21() - Decodes BIP21 uri.
|
* @api BitcoinCash.decodeBIP21() decodeBIP21()
|
||||||
* @apiName decodeBIP21
|
* @apiName decodeBIP21
|
||||||
* @apiGroup BitcoinCash
|
* @apiGroup BitcoinCash
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -340,7 +340,7 @@ class BitcoinCash {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api BitcoinCash.getByteCount() getByteCount() - Get byte count of transaction.
|
* @api BitcoinCash.getByteCount() getByteCount()
|
||||||
* @apiName getByteCount
|
* @apiName getByteCount
|
||||||
* @apiGroup BitcoinCash
|
* @apiGroup BitcoinCash
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -458,7 +458,7 @@ class BitcoinCash {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api BitcoinCash.encryptBIP38() encryptBIP38() - BIP38 encrypt privkey WIFs.
|
* @api BitcoinCash.encryptBIP38() encryptBIP38()
|
||||||
* @apiName encryptBIP38
|
* @apiName encryptBIP38
|
||||||
* @apiGroup BitcoinCash
|
* @apiGroup BitcoinCash
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -486,7 +486,7 @@ class BitcoinCash {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api BitcoinCash.decryptBIP38() decryptBIP38() - BIP38 encrypt privkey WIFs.
|
* @api BitcoinCash.decryptBIP38() decryptBIP38()
|
||||||
* @apiName decryptBIP38
|
* @apiName decryptBIP38
|
||||||
* @apiGroup BitcoinCash
|
* @apiGroup BitcoinCash
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
|
|||||||
+3
-3
@@ -24,7 +24,7 @@ class Blockbook {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Blockbook.balance() balance() - Balance about an address.
|
* @api Blockbook.balance() balance()
|
||||||
* @apiName Blockbook Balance
|
* @apiName Blockbook Balance
|
||||||
* @apiGroup Blockbook
|
* @apiGroup Blockbook
|
||||||
* @apiDescription Return Balance about an address.
|
* @apiDescription Return Balance about an address.
|
||||||
@@ -221,7 +221,7 @@ class Blockbook {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Blockbook.utxo() utxo() - Get list of uxto for address.
|
* @api Blockbook.utxo() utxo()
|
||||||
* @apiName Blockbook Utxo
|
* @apiName Blockbook Utxo
|
||||||
* @apiGroup Blockbook
|
* @apiGroup Blockbook
|
||||||
* @apiDescription Return list of uxto for address.
|
* @apiDescription Return list of uxto for address.
|
||||||
@@ -307,7 +307,7 @@ class Blockbook {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Blockbook.tx() tx() - Get details on a transaction.
|
* @api Blockbook.tx() tx()
|
||||||
* @apiName Blockbook Tx
|
* @apiName Blockbook Tx
|
||||||
* @apiGroup Blockbook
|
* @apiGroup Blockbook
|
||||||
* @apiDescription Get details on a transaction.
|
* @apiDescription Get details on a transaction.
|
||||||
|
|||||||
+14
-14
@@ -23,7 +23,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Blockchain.getBestBlockHash() getBestBlockHash() - Returns the hash of the best (tip) block in the longest blockchain.
|
* @api Blockchain.getBestBlockHash() getBestBlockHash()
|
||||||
* @apiName getBestBlockHash
|
* @apiName getBestBlockHash
|
||||||
* @apiGroup Blockchain
|
* @apiGroup Blockchain
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -54,7 +54,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Blockchain.getBlock() getBlock() - Return information about block hash.
|
* @api Blockchain.getBlock() getBlock()
|
||||||
* @apiName getBlock
|
* @apiName getBlock
|
||||||
* @apiGroup Blockchain
|
* @apiGroup Blockchain
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -102,7 +102,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Blockchain.getBlockchainInfo() getBlockchainInfo() - Returns an object containing various state info regarding blockchain processing.
|
* @api Blockchain.getBlockchainInfo() getBlockchainInfo()
|
||||||
* @apiName getBlockchainInfo
|
* @apiName getBlockchainInfo
|
||||||
* @apiGroup Blockchain
|
* @apiGroup Blockchain
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -152,7 +152,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Blockchain.getBlockCount() getBlockCount() - Returns the number of blocks in the longest blockchain.
|
* @api Blockchain.getBlockCount() getBlockCount()
|
||||||
* @apiName getBlockCount
|
* @apiName getBlockCount
|
||||||
* @apiGroup Blockchain
|
* @apiGroup Blockchain
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -183,7 +183,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Blockchain.getBlockHash() getBlockHash() - Returns hash of block in best-block-chain at height provided.
|
* @api Blockchain.getBlockHash() getBlockHash()
|
||||||
* @apiName getBlockHash
|
* @apiName getBlockHash
|
||||||
* @apiGroup Blockchain
|
* @apiGroup Blockchain
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -216,7 +216,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Blockchain.getBlockHeader() getBlockHeader() - Return information about blockheader hash.
|
* @api Blockchain.getBlockHeader() getBlockHeader()
|
||||||
* @apiName getBlockHeader
|
* @apiName getBlockHeader
|
||||||
* @apiGroup Blockchain
|
* @apiGroup Blockchain
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -281,7 +281,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Blockchain.getChainTips() getChainTips() - Return information about all known tips in the block tree.
|
* @api Blockchain.getChainTips() getChainTips()
|
||||||
* @apiName getChainTips
|
* @apiName getChainTips
|
||||||
* @apiGroup Blockchain
|
* @apiGroup Blockchain
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -324,7 +324,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Blockchain.getDifficulty() getDifficulty() - Returns the proof-of-work difficulty as a multiple of the minimum difficulty.
|
* @api Blockchain.getDifficulty() getDifficulty()
|
||||||
* @apiName getDifficulty
|
* @apiName getDifficulty
|
||||||
* @apiGroup Blockchain
|
* @apiGroup Blockchain
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -387,7 +387,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Blockchain.getMempoolEntry() getMempoolEntry() - Returns mempool data for given transaction.
|
* @api Blockchain.getMempoolEntry() getMempoolEntry()
|
||||||
* @apiName getMempoolEntry
|
* @apiName getMempoolEntry
|
||||||
* @apiGroup Blockchain
|
* @apiGroup Blockchain
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -499,7 +499,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Blockchain.getMempoolInfo() getMempoolInfo() - Returns details on the active state of the TX memory pool.
|
* @api Blockchain.getMempoolInfo() getMempoolInfo()
|
||||||
* @apiName getMempoolInfo
|
* @apiName getMempoolInfo
|
||||||
* @apiGroup Blockchain
|
* @apiGroup Blockchain
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -535,7 +535,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Blockchain.getRawMempool() getRawMempool() - Returns all transaction ids in memory pool as a json array of string transaction ids.
|
* @api Blockchain.getRawMempool() getRawMempool()
|
||||||
* @apiName getRawMempool
|
* @apiName getRawMempool
|
||||||
* @apiGroup Blockchain
|
* @apiGroup Blockchain
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -582,7 +582,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Blockchain.getTxOut() getTxOut() - Returns details about an unspent transaction output.
|
* @api Blockchain.getTxOut() getTxOut()
|
||||||
* @apiName getTxOut
|
* @apiName getTxOut
|
||||||
* @apiGroup Blockchain
|
* @apiGroup Blockchain
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -634,7 +634,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Blockchain.getTxOutProof() getTxOutProof() - Returns a hex-encoded proof that "txid" was included in a block.
|
* @api Blockchain.getTxOutProof() getTxOutProof()
|
||||||
* @apiName getTxOutProof
|
* @apiName getTxOutProof
|
||||||
* @apiGroup Blockchain
|
* @apiGroup Blockchain
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -740,7 +740,7 @@ class Blockchain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Blockchain.verifyTxOutProof() verifyTxOutProof() - Verifies that a proof points to a transaction in a block.
|
* @api Blockchain.verifyTxOutProof() verifyTxOutProof()
|
||||||
* @apiName verifyTxOutProof
|
* @apiName verifyTxOutProof
|
||||||
* @apiGroup Blockchain
|
* @apiGroup Blockchain
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ class Control {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Control.getNetworkInfo() getNetworkInfo() - Get Network info
|
* @api Control.getNetworkInfo() getNetworkInfo()
|
||||||
* @apiName getNetworkInfo
|
* @apiName getNetworkInfo
|
||||||
* @apiGroup Control
|
* @apiGroup Control
|
||||||
* @apiDescription Returns an object containing various network info.
|
* @apiDescription Returns an object containing various network info.
|
||||||
|
|||||||
+5
-5
@@ -3,7 +3,7 @@ const Bitcoin = require("bitcoincashjs-lib")
|
|||||||
|
|
||||||
class Crypto {
|
class Crypto {
|
||||||
/**
|
/**
|
||||||
* @api Crypto.sha256() sha256() - Utility for creating sha256 hash.
|
* @api Crypto.sha256() sha256()
|
||||||
* @apiName sha256
|
* @apiName sha256
|
||||||
* @apiGroup Crypto
|
* @apiGroup Crypto
|
||||||
* @apiDescription Utility for creating sha256 hash digests of data
|
* @apiDescription Utility for creating sha256 hash digests of data
|
||||||
@@ -31,7 +31,7 @@ class Crypto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Crypto.ripemd160() ripemd160()-Utility for creating ripemd160 hash.
|
* @api Crypto.ripemd160() ripemd160()
|
||||||
* @apiName ripemd160
|
* @apiName ripemd160
|
||||||
* @apiGroup Crypto
|
* @apiGroup Crypto
|
||||||
* @apiDescription Utility for creating ripemd160 hash digests of data
|
* @apiDescription Utility for creating ripemd160 hash digests of data
|
||||||
@@ -57,7 +57,7 @@ class Crypto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Crypto.hash256() hash256() - Utility for creating double sha256 hash.
|
* @api Crypto.hash256() hash256()
|
||||||
* @apiName hash256
|
* @apiName hash256
|
||||||
* @apiGroup Crypto
|
* @apiGroup Crypto
|
||||||
* @apiDescription Utility for creating double sha256 hash digests of data.
|
* @apiDescription Utility for creating double sha256 hash digests of data.
|
||||||
@@ -83,7 +83,7 @@ class Crypto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Crypto.hash160() hash160() - Utility for creating ripemd160(sha256()) hash.
|
* @api Crypto.hash160() hash160()
|
||||||
* @apiName hash160
|
* @apiName hash160
|
||||||
* @apiGroup Crypto
|
* @apiGroup Crypto
|
||||||
* @apiDescription Utility for creating ripemd160(sha256()) hash digests of data.
|
* @apiDescription Utility for creating ripemd160(sha256()) hash digests of data.
|
||||||
@@ -109,7 +109,7 @@ class Crypto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Crypto.randomBytes() randomBytes() - Generates cryptographically strong pseudo-random data.
|
* @api Crypto.randomBytes() randomBytes()
|
||||||
* @apiName randomBytes
|
* @apiName randomBytes
|
||||||
* @apiGroup Crypto
|
* @apiGroup Crypto
|
||||||
* @apiDescription Generates cryptographically strong pseudo-random data. The size argument is a number indicating the number of bytes to generate.
|
* @apiDescription Generates cryptographically strong pseudo-random data. The size argument is a number indicating the number of bytes to generate.
|
||||||
|
|||||||
+6
-6
@@ -6,7 +6,7 @@ class ECPair {
|
|||||||
ECPair._address = address
|
ECPair._address = address
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @api Ecpair.fromWIF() fromWIF() - Generates an ECPair from a private key in wallet import format (WIF).
|
* @api Ecpair.fromWIF() fromWIF()
|
||||||
* @apiName fromWIF
|
* @apiName fromWIF
|
||||||
* @apiGroup ECPair
|
* @apiGroup ECPair
|
||||||
* @apiDescription Generates an ECPair from a private key in wallet import format (WIF). Follow these steps to go from a private key to a WIF. This method only works with a compressed private key.
|
* @apiDescription Generates an ECPair from a private key in wallet import format (WIF). Follow these steps to go from a private key to a WIF. This method only works with a compressed private key.
|
||||||
@@ -35,7 +35,7 @@ class ECPair {
|
|||||||
return Bitcoin.ECPair.fromWIF(privateKeyWIF, bitcoincashBitcoinJSLib)
|
return Bitcoin.ECPair.fromWIF(privateKeyWIF, bitcoincashBitcoinJSLib)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @api Ecpair.toWIF() toWIF() - Gets a private key in wallet import format from an ECPair.
|
* @api Ecpair.toWIF() toWIF()
|
||||||
* @apiName toWIF
|
* @apiName toWIF
|
||||||
* @apiGroup ECPair
|
* @apiGroup ECPair
|
||||||
* @apiDescription Gets a private key in wallet import format from an ECPair.
|
* @apiDescription Gets a private key in wallet import format from an ECPair.
|
||||||
@@ -69,7 +69,7 @@ class ECPair {
|
|||||||
return ecpair.verify(buffer, signature)
|
return ecpair.verify(buffer, signature)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @api Ecpair.fromPublicKey() fromPublicKey() - Generates an ECPair from a public key buffer.
|
* @api Ecpair.fromPublicKey() fromPublicKey()
|
||||||
* @apiName fromPublicKey
|
* @apiName fromPublicKey
|
||||||
* @apiGroup ECPair
|
* @apiGroup ECPair
|
||||||
* @apiDescription Generates an ECPair from a public key buffer.
|
* @apiDescription Generates an ECPair from a public key buffer.
|
||||||
@@ -87,7 +87,7 @@ class ECPair {
|
|||||||
return Bitcoin.ECPair.fromPublicKeyBuffer(pubkeyBuffer)
|
return Bitcoin.ECPair.fromPublicKeyBuffer(pubkeyBuffer)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @api Ecpair.toPublicKey() toPublicKey() - Get the public key of an ECPair as a buffer.
|
* @api Ecpair.toPublicKey() toPublicKey()
|
||||||
* @apiName toPublicKey
|
* @apiName toPublicKey
|
||||||
* @apiGroup ECPair
|
* @apiGroup ECPair
|
||||||
* @apiDescription Get the public key of an ECPair as a buffer.
|
* @apiDescription Get the public key of an ECPair as a buffer.
|
||||||
@@ -109,7 +109,7 @@ class ECPair {
|
|||||||
return ecpair.getPublicKeyBuffer()
|
return ecpair.getPublicKeyBuffer()
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @api Ecpair.toLegacyAddress() toLegacyAddress() - Get legacy address of ECPair.
|
* @api Ecpair.toLegacyAddress() toLegacyAddress()
|
||||||
* @apiName toLegacyAddress
|
* @apiName toLegacyAddress
|
||||||
* @apiGroup ECPair
|
* @apiGroup ECPair
|
||||||
* @apiDescription Get legacy address of ECPair.
|
* @apiDescription Get legacy address of ECPair.
|
||||||
@@ -135,7 +135,7 @@ class ECPair {
|
|||||||
return ecpair.getAddress()
|
return ecpair.getAddress()
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @api Ecpair.toCashAddress() toCashAddress() - Get cash address of ECPair.
|
* @api Ecpair.toCashAddress() toCashAddress()
|
||||||
* @apiName toCashAddress
|
* @apiName toCashAddress
|
||||||
* @apiGroup ECPair
|
* @apiGroup ECPair
|
||||||
* @apiDescription Get cash address of ECPair.
|
* @apiDescription Get cash address of ECPair.
|
||||||
|
|||||||
+95
-3
@@ -24,7 +24,7 @@ class ElectrumX {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Electrumx.utxo() utxo() - Get a list of uxto for an address.
|
* @api Electrumx.utxo() utxo()
|
||||||
* @apiName ElectrumX Utxo
|
* @apiName ElectrumX Utxo
|
||||||
* @apiGroup ElectrumX
|
* @apiGroup ElectrumX
|
||||||
* @apiDescription Return a list of uxtos for an address.
|
* @apiDescription Return a list of uxtos for an address.
|
||||||
@@ -119,7 +119,7 @@ class ElectrumX {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Electrumx.balance() balance() - Get the balance for an address.
|
* @api Electrumx.balance() balance()
|
||||||
* @apiName ElectrumX Balance
|
* @apiName ElectrumX Balance
|
||||||
* @apiGroup ElectrumX
|
* @apiGroup ElectrumX
|
||||||
* @apiDescription Return a list of balances for an address.
|
* @apiDescription Return a list of balances for an address.
|
||||||
@@ -203,7 +203,7 @@ class ElectrumX {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Electrumx.transactions() transactions() - Get the transaction history for an address.
|
* @api Electrumx.transactions() transactions()
|
||||||
* @apiName ElectrumX Transactions
|
* @apiName ElectrumX Transactions
|
||||||
* @apiGroup ElectrumX
|
* @apiGroup ElectrumX
|
||||||
* @apiDescription Return a transaction history for an address.
|
* @apiDescription Return a transaction history for an address.
|
||||||
@@ -299,6 +299,98 @@ class ElectrumX {
|
|||||||
else throw error
|
else throw error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @api Electrumx.unconfirmed() unconfirmed()
|
||||||
|
* @apiName ElectrumX Unconfirmed
|
||||||
|
* @apiGroup ElectrumX
|
||||||
|
* @apiDescription Return a list of unconfirmed uxtos (mempool) for an address.
|
||||||
|
*
|
||||||
|
* @apiExample Example usage:
|
||||||
|
* (async () => {
|
||||||
|
* try {
|
||||||
|
* let mempool = await bchjs.Electrumx.unconfirmed('bitcoincash:qqh793x9au6ehvh7r2zflzguanlme760wuzehgzjh9');
|
||||||
|
* console.log(mempool);
|
||||||
|
* } catch(error) {
|
||||||
|
* console.error(error)
|
||||||
|
* }
|
||||||
|
* })()
|
||||||
|
*
|
||||||
|
* mempool = {
|
||||||
|
* "success": true,
|
||||||
|
* "utxos": [
|
||||||
|
* {
|
||||||
|
* "height": 602405,
|
||||||
|
* "tx_hash": "2b37bdb3b63dd0bca720437754a36671431a950e684b64c44ea910ea9d5297c7",
|
||||||
|
* "fee": 24310
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* (async () => {
|
||||||
|
* try {
|
||||||
|
* let mempool = await bchjs.Electrumx.unconfirmed(['bitcoincash:qrdka2205f4hyukutc2g0s6lykperc8nsu5u2ddpqf', 'bitcoincash:qpdh9s677ya8tnx7zdhfrn8qfyvy22wj4qa7nwqa5v']);
|
||||||
|
* console.log(mempool);
|
||||||
|
* } catch(error) {
|
||||||
|
* console.error(error)
|
||||||
|
* }
|
||||||
|
* })()
|
||||||
|
*
|
||||||
|
* mempool = {
|
||||||
|
* "success": true,
|
||||||
|
* "utxos": [
|
||||||
|
* {
|
||||||
|
* "utxos": [
|
||||||
|
* {
|
||||||
|
* "height": 604392,
|
||||||
|
* "tx_hash": "7774e449c5a3065144cefbc4c0c21e6b69c987f095856778ef9f45ddd8ae1a41",
|
||||||
|
* "fee": 24310
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* "height": 630834,
|
||||||
|
* "tx_hash": "4fe60a51e0d8f5134bfd8e5f872d6e502d7f01b28a6afebb27f4438a4f638d53",
|
||||||
|
* "fee": 3000
|
||||||
|
* }
|
||||||
|
* ],
|
||||||
|
* "address": "bitcoincash:qrdka2205f4hyukutc2g0s6lykperc8nsu5u2ddpqf"
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* "utxos": [],
|
||||||
|
* "address": "bitcoincash:qpdh9s677ya8tnx7zdhfrn8qfyvy22wj4qa7nwqa5v"
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
async unconfirmed(address) {
|
||||||
|
try {
|
||||||
|
// Handle single address.
|
||||||
|
if (typeof address === "string") {
|
||||||
|
const response = await axios.get(
|
||||||
|
`${this.restURL}electrumx/unconfirmed/${address}`,
|
||||||
|
_this.axiosOptions
|
||||||
|
)
|
||||||
|
return response.data
|
||||||
|
|
||||||
|
// Handle array of addresses.
|
||||||
|
} else if (Array.isArray(address)) {
|
||||||
|
const response = await axios.post(
|
||||||
|
`${this.restURL}electrumx/unconfirmed`,
|
||||||
|
{
|
||||||
|
addresses: address
|
||||||
|
},
|
||||||
|
_this.axiosOptions
|
||||||
|
)
|
||||||
|
|
||||||
|
return response.data
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = ElectrumX
|
module.exports = ElectrumX
|
||||||
|
|||||||
+20
-20
@@ -9,7 +9,7 @@ class HDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api HDNode.fromSeed() fromSeed() - Create HDNode from Seed Buffer.
|
* @api HDNode.fromSeed() fromSeed()
|
||||||
* @apiName fromSeed
|
* @apiName fromSeed
|
||||||
* @apiGroup HDNode
|
* @apiGroup HDNode
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -46,7 +46,7 @@ class HDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api HDNode.toLegacyAddress() toLegacyAddress() - Get legacy address of HDNode.
|
* @api HDNode.toLegacyAddress() toLegacyAddress()
|
||||||
* @apiName toLegacyAddress
|
* @apiName toLegacyAddress
|
||||||
* @apiGroup HDNode
|
* @apiGroup HDNode
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -80,7 +80,7 @@ class HDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api HDNode.toCashAddress() toCashAddress() - Get cash address of HDNode
|
* @api HDNode.toCashAddress() toCashAddress()
|
||||||
* @apiName toCashAddress
|
* @apiName toCashAddress
|
||||||
* @apiGroup HDNode
|
* @apiGroup HDNode
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -114,7 +114,7 @@ class HDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api SLP.HDNode.toSLPAddress() toSLPAddress() - Get slp address of HDNode.
|
* @api SLP.HDNode.toSLPAddress() toSLPAddress()
|
||||||
* @apiName toSLPAddress
|
* @apiName toSLPAddress
|
||||||
* @apiGroup SLP
|
* @apiGroup SLP
|
||||||
* @apiDescription Get slp address of HDNode.
|
* @apiDescription Get slp address of HDNode.
|
||||||
@@ -148,7 +148,7 @@ class HDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api HDNode.toWIF() toWIF() - Get private key in wallet import format (WIF) of HDNode.
|
* @api HDNode.toWIF() toWIF()
|
||||||
* @apiName toWIF
|
* @apiName toWIF
|
||||||
* @apiGroup HDNode
|
* @apiGroup HDNode
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -182,7 +182,7 @@ class HDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api HDNode.toXPub() toXPub() - Get extended public key of HDNode.
|
* @api HDNode.toXPub() toXPub()
|
||||||
* @apiName toXPub
|
* @apiName toXPub
|
||||||
* @apiGroup HDNode
|
* @apiGroup HDNode
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -216,7 +216,7 @@ class HDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api HDNode.toXPriv() toXPriv() - Get extended private key of HDNode.
|
* @api HDNode.toXPriv() toXPriv()
|
||||||
* @apiName toXPriv
|
* @apiName toXPriv
|
||||||
* @apiGroup HDNode
|
* @apiGroup HDNode
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -250,7 +250,7 @@ class HDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api HDNode.toKeyPair() toKeyPair() - Get the ECPair of an HDNode.
|
* @api HDNode.toKeyPair() toKeyPair()
|
||||||
* @apiName toKeyPair
|
* @apiName toKeyPair
|
||||||
* @apiGroup HDNode
|
* @apiGroup HDNode
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -282,7 +282,7 @@ class HDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api HDNode.toPublicKey() toPublicKey() - Get the public key of an HDNode as a buffer.
|
* @api HDNode.toPublicKey() toPublicKey()
|
||||||
* @apiName toPublicKey
|
* @apiName toPublicKey
|
||||||
* @apiGroup HDNode
|
* @apiGroup HDNode
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -316,7 +316,7 @@ class HDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api HDNode.fromXPriv() fromXPriv() - Generate HDNode from extended private key.
|
* @api HDNode.fromXPriv() fromXPriv()
|
||||||
* @apiName fromXPriv
|
* @apiName fromXPriv
|
||||||
* @apiGroup HDNode
|
* @apiGroup HDNode
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -339,7 +339,7 @@ class HDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api HDNode.fromXPub() fromXPub() - Generate HDNode from extended public key.
|
* @api HDNode.fromXPub() fromXPub()
|
||||||
* @apiName fromXPub
|
* @apiName fromXPub
|
||||||
* @apiGroup HDNode
|
* @apiGroup HDNode
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -362,7 +362,7 @@ class HDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api HDNode.derivePath() derivePath() - Derive child HDNode from path.
|
* @api HDNode.derivePath() derivePath()
|
||||||
* @apiName derivePath
|
* @apiName derivePath
|
||||||
* @apiGroup HDNode
|
* @apiGroup HDNode
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -383,7 +383,7 @@ class HDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api HDNode.derive() derive() - Derive non hardened child HDNode.
|
* @api HDNode.derive() derive()
|
||||||
* @apiName derive
|
* @apiName derive
|
||||||
* @apiGroup HDNode
|
* @apiGroup HDNode
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -404,7 +404,7 @@ class HDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api HDNode.deriveHardened() deriveHardened() - Derive hardened child HDNode.
|
* @api HDNode.deriveHardened() deriveHardened()
|
||||||
* @apiName deriveHardened
|
* @apiName deriveHardened
|
||||||
* @apiGroup HDNode
|
* @apiGroup HDNode
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -425,7 +425,7 @@ class HDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api HDNode.sign() sign() - Sign 32 byte hash encoded as a buffer.
|
* @api HDNode.sign() sign()
|
||||||
* @apiName sign
|
* @apiName sign
|
||||||
* @apiGroup HDNode
|
* @apiGroup HDNode
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -455,7 +455,7 @@ class HDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api HDNode.verify() verify() - Verify signed 32 byte hash encoded as a buffer.
|
* @api HDNode.verify() verify()
|
||||||
* @apiName verify
|
* @apiName verify
|
||||||
* @apiGroup HDNode
|
* @apiGroup HDNode
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -499,7 +499,7 @@ class HDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api HDNode.isPublic() isPublic() - Check if an HDNode can only derive public keys and children.
|
* @api HDNode.isPublic() isPublic()
|
||||||
* @apiName isPublic
|
* @apiName isPublic
|
||||||
* @apiGroup HDNode
|
* @apiGroup HDNode
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -535,7 +535,7 @@ class HDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api HDNode.isPrivate() isPrivate() - Check if an HDNode can derive both public and private keys and children.
|
* @api HDNode.isPrivate() isPrivate()
|
||||||
* @apiName isPrivate
|
* @apiName isPrivate
|
||||||
* @apiGroup HDNode
|
* @apiGroup HDNode
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -571,7 +571,7 @@ class HDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api HDNode.toIdentifier() toIdentifier() - hash160 of Node’s public key.
|
* @api HDNode.toIdentifier() toIdentifier()
|
||||||
* @apiName toIdentifier
|
* @apiName toIdentifier
|
||||||
* @apiGroup HDNode
|
* @apiGroup HDNode
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -607,7 +607,7 @@ class HDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api HDNode.createAccount() createAccount() - Create BIP32 account.
|
* @api HDNode.createAccount() createAccount()
|
||||||
* @apiName createAccount
|
* @apiName createAccount
|
||||||
* @apiGroup HDNode
|
* @apiGroup HDNode
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
|
|||||||
+177
-8
@@ -53,8 +53,8 @@ class IPFS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api IPFS.createFileModel() createFileModel() - Create a file model
|
* @api IPFS.createFileModelServer() createFileModelServer()
|
||||||
* @apiName createFileModel()
|
* @apiName createFileModelServer()
|
||||||
* @apiGroup IPFS
|
* @apiGroup IPFS
|
||||||
* @apiDescription Creates a new model on the server. If successful, will
|
* @apiDescription Creates a new model on the server. If successful, will
|
||||||
* return an object with file data. That object contains a BCH address,
|
* return an object with file data. That object contains a BCH address,
|
||||||
@@ -64,7 +64,7 @@ class IPFS {
|
|||||||
* (async () => {
|
* (async () => {
|
||||||
* try {
|
* try {
|
||||||
* const path = `${__dirname}/ipfs.js`
|
* const path = `${__dirname}/ipfs.js`
|
||||||
* let fileData = await bchjs.IPFS.uploadFile(path);
|
* let fileData = await bchjs.IPFS.createFileModelServer(path);
|
||||||
* console.log(fileData);
|
* console.log(fileData);
|
||||||
* } catch(error) {
|
* } catch(error) {
|
||||||
* console.error(error)
|
* console.error(error)
|
||||||
@@ -90,7 +90,7 @@ class IPFS {
|
|||||||
* "__v": 0
|
* "__v": 0
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
async createFileModel(path) {
|
async createFileModelServer(path) {
|
||||||
try {
|
try {
|
||||||
// Ensure the file exists.
|
// Ensure the file exists.
|
||||||
if (!_this.fs.existsSync(path))
|
if (!_this.fs.existsSync(path))
|
||||||
@@ -131,7 +131,7 @@ class IPFS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api IPFS.uploadFile() uploadFile() - Upload a file to IPFS
|
* @api IPFS.uploadFileServer() uploadFileServer()
|
||||||
* @apiName uploadFile()
|
* @apiName uploadFile()
|
||||||
* @apiGroup IPFS
|
* @apiGroup IPFS
|
||||||
* @apiDescription Upload a file to the FullStack.cash IPFS server. If
|
* @apiDescription Upload a file to the FullStack.cash IPFS server. If
|
||||||
@@ -142,7 +142,7 @@ class IPFS {
|
|||||||
* (async () => {
|
* (async () => {
|
||||||
* try {
|
* try {
|
||||||
* const path = `${__dirname}/ipfs.js`
|
* const path = `${__dirname}/ipfs.js`
|
||||||
* let fileData = await bchjs.IPFS.uploadFile(path, "5ec562319bfacc745e8d8a52");
|
* let fileData = await bchjs.IPFS.uploadFileServer(path, "5ec562319bfacc745e8d8a52");
|
||||||
* console.log(fileData);
|
* console.log(fileData);
|
||||||
* } catch(error) {
|
* } catch(error) {
|
||||||
* console.error(error)
|
* console.error(error)
|
||||||
@@ -157,7 +157,7 @@ class IPFS {
|
|||||||
* "fileExtension": "js"
|
* "fileExtension": "js"
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
async uploadFile(path, modelId) {
|
async uploadFileServer(path, modelId) {
|
||||||
try {
|
try {
|
||||||
// Ensure the file exists.
|
// Ensure the file exists.
|
||||||
if (!_this.fs.existsSync(path))
|
if (!_this.fs.existsSync(path))
|
||||||
@@ -219,7 +219,7 @@ class IPFS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api IPFS.getStatus() getStatus() - Check status of file upload
|
* @api IPFS.getStatus() getStatus()
|
||||||
* @apiName getStatus()
|
* @apiName getStatus()
|
||||||
* @apiGroup IPFS
|
* @apiGroup IPFS
|
||||||
* @apiDescription Gets the status of the uploaded file. Will return an object
|
* @apiDescription Gets the status of the uploaded file. Will return an object
|
||||||
@@ -270,6 +270,175 @@ class IPFS {
|
|||||||
throw err
|
throw err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @api IPFS.createFileModelWeb() createFileModelWeb()
|
||||||
|
* @apiName createFileModelWeb()
|
||||||
|
* @apiGroup IPFS
|
||||||
|
* @apiDescription Creates a new model on the server. If successful, will
|
||||||
|
* return an object with file data. That object contains a BCH address,
|
||||||
|
* payment amount, and _id required to be able to upload a file.
|
||||||
|
*
|
||||||
|
* @apiExample Example usage:
|
||||||
|
* (async () => {
|
||||||
|
* try {
|
||||||
|
* const content = ['PSF']
|
||||||
|
* const name = 'psf.txt' // Content can be Array , ArrayBuffer , Blob
|
||||||
|
* const options = { type: "text/plain" }
|
||||||
|
* const file = new File(content,name,options)
|
||||||
|
* let fileData = await bchjs.IPFS.createFileModelWeb(file);
|
||||||
|
* console.log(fileData);
|
||||||
|
* } catch(error) {
|
||||||
|
* console.error(error)
|
||||||
|
* }
|
||||||
|
* })()
|
||||||
|
*
|
||||||
|
* {
|
||||||
|
* "success": true,
|
||||||
|
* "hostingCostBCH": 0.00004197,
|
||||||
|
* "hostingCostUSD": 0.01,
|
||||||
|
* "file": {
|
||||||
|
* "payloadLink": "",
|
||||||
|
* "hasBeenPaid": false,
|
||||||
|
* "_id": "5ec562319bfacc745e8d8a52",
|
||||||
|
* "schemaVersion": 1,
|
||||||
|
* "size": 4458,
|
||||||
|
* "fileName": "ipfs.js",
|
||||||
|
* "fileExtension": "js",
|
||||||
|
* "createdTimestamp": "1589994033.655",
|
||||||
|
* "hostingCost": 4196,
|
||||||
|
* "walletIndex": 49,
|
||||||
|
* "bchAddr": "bchtest:qzrpkevu7h2ayfa4rjx08r5elvpfu72dg567x3mh3c",
|
||||||
|
* "__v": 0
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
async createFileModelWeb(file) {
|
||||||
|
try {
|
||||||
|
if (!file) throw new Error(`File is required`)
|
||||||
|
|
||||||
|
const { name, size } = file
|
||||||
|
|
||||||
|
if (!name || typeof name !== "string")
|
||||||
|
throw new Error(`File should have the property 'name' of string type`)
|
||||||
|
|
||||||
|
if (!size || typeof size !== "number")
|
||||||
|
throw new Error(`File should have the property 'size' of number type`)
|
||||||
|
|
||||||
|
// Get the file extension.
|
||||||
|
const splitExt = name.split(".")
|
||||||
|
const fileExt = splitExt[splitExt.length - 1]
|
||||||
|
|
||||||
|
const fileObj = {
|
||||||
|
schemaVersion: 1,
|
||||||
|
size: size,
|
||||||
|
fileName: name,
|
||||||
|
fileExtension: fileExt
|
||||||
|
}
|
||||||
|
// console.log(`fileObj: ${JSON.stringify(fileObj, null, 2)}`)
|
||||||
|
|
||||||
|
const fileData = await _this.axios.post(`${this.IPFS_API}/files`, {
|
||||||
|
file: fileObj
|
||||||
|
})
|
||||||
|
// console.log(`fileData.data: ${JSON.stringify(fileData.data, null, 2)}`)
|
||||||
|
|
||||||
|
return fileData.data
|
||||||
|
} catch (err) {
|
||||||
|
console.error(`Error in createFileModelWeb()`)
|
||||||
|
throw err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @api IPFS.uploadFileWeb() uploadFileWeb()
|
||||||
|
* @apiName uploadFileWeb()
|
||||||
|
* @apiGroup IPFS
|
||||||
|
* @apiDescription Upload a file to the FullStack.cash IPFS server. If
|
||||||
|
* successful, it will return an object with an ID, a BCH address, and an
|
||||||
|
* amount of BCH to pay.
|
||||||
|
*
|
||||||
|
* @apiExample Example usage:
|
||||||
|
* (async () => {
|
||||||
|
* try {
|
||||||
|
* * const content = ['PSF']
|
||||||
|
* const name = 'psf.txt' // Content can be Array , ArrayBuffer , Blob
|
||||||
|
* const options = { type: "text/plain" }
|
||||||
|
* const file = new File(content,name,options)
|
||||||
|
* let fileData = await bchjs.IPFS.uploadFile(file, "5ec562319bfacc745e8d8a52");
|
||||||
|
* console.log(fileData);
|
||||||
|
* } catch(error) {
|
||||||
|
* console.error(error)
|
||||||
|
* }
|
||||||
|
* })()
|
||||||
|
*
|
||||||
|
* {
|
||||||
|
* "schemaVersion": 1,
|
||||||
|
* "size": 2374,
|
||||||
|
* "fileId": "5ec562319bfacc745e8d8a52",
|
||||||
|
* "fileName": "ipfs.js",
|
||||||
|
* "fileExtension": "js"
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
async uploadFileWeb(file, modelId) {
|
||||||
|
try {
|
||||||
|
if (!file) throw new Error(`File is required`)
|
||||||
|
|
||||||
|
const { name, type, size } = file
|
||||||
|
|
||||||
|
if (!name || typeof name !== "string")
|
||||||
|
throw new Error(`File should have the property 'name' of string type`)
|
||||||
|
|
||||||
|
if (!type || typeof type !== "string")
|
||||||
|
throw new Error(`File should have the property 'type' of string type`)
|
||||||
|
|
||||||
|
if (!size || typeof size !== "number")
|
||||||
|
throw new Error(`File should have the property 'size' of number type`)
|
||||||
|
|
||||||
|
if (!modelId) {
|
||||||
|
throw new Error(
|
||||||
|
`Must include a file model ID in order to upload a file.`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare the upload object. Get a file ID from Uppy.
|
||||||
|
const id = _this.uppy.addFile({
|
||||||
|
name: name,
|
||||||
|
data: file,
|
||||||
|
source: "Local",
|
||||||
|
isRemote: false
|
||||||
|
})
|
||||||
|
// console.log(`id: ${JSON.stringify(id, null, 2)}`)
|
||||||
|
|
||||||
|
// Add the model ID, required to be allowed to upload the file.
|
||||||
|
_this.uppy.setFileMeta(id, { fileModelId: modelId })
|
||||||
|
|
||||||
|
// Upload the file to the server.
|
||||||
|
const upData = await _this.uppy.upload()
|
||||||
|
|
||||||
|
if (upData.failed.length)
|
||||||
|
throw new Error("The file could not be uploaded")
|
||||||
|
|
||||||
|
if (upData.successful.length) {
|
||||||
|
delete upData.successful[0].data
|
||||||
|
// console.log(`upData: ${JSON.stringify(upData, null, 2)}`)
|
||||||
|
|
||||||
|
const fileObj = {
|
||||||
|
schemaVersion: 1,
|
||||||
|
size: upData.successful[0].progress.bytesTotal,
|
||||||
|
fileId: upData.successful[0].meta.fileModelId,
|
||||||
|
fileName: upData.successful[0].name,
|
||||||
|
fileExtension: upData.successful[0].extension
|
||||||
|
}
|
||||||
|
// console.log(`fileObj: ${JSON.stringify(fileObj, null, 2)}`)
|
||||||
|
|
||||||
|
return fileObj
|
||||||
|
// return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
} catch (err) {
|
||||||
|
console.error(`Error in bch-js/src/ipfs.js/uploadFileWeb(): `)
|
||||||
|
throw err
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = IPFS
|
module.exports = IPFS
|
||||||
|
|||||||
+8
-8
@@ -10,7 +10,7 @@ class Mnemonic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Mnemonic.generate() generate() - Generate BIP39 mnemonic from entropy.
|
* @api Mnemonic.generate() generate()
|
||||||
* @apiName generate
|
* @apiName generate
|
||||||
* @apiGroup Mnemonic
|
* @apiGroup Mnemonic
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -50,7 +50,7 @@ class Mnemonic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Mnemonic.fromEntropy() fromEntropy() - Create mnemonic from entropy.
|
* @api Mnemonic.fromEntropy() fromEntropy()
|
||||||
* @apiName fromEntropy
|
* @apiName fromEntropy
|
||||||
* @apiGroup Mnemonic
|
* @apiGroup Mnemonic
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -104,7 +104,7 @@ class Mnemonic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Mnemonic.toEntropy() toEntropy() - Turn mnemonic to entropy.
|
* @api Mnemonic.toEntropy() toEntropy()
|
||||||
* @apiName toEntropy
|
* @apiName toEntropy
|
||||||
* @apiGroup Mnemonic
|
* @apiGroup Mnemonic
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -141,7 +141,7 @@ class Mnemonic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Mnemonic.validate() validate() - Validate mnemonic.
|
* @api Mnemonic.validate() validate()
|
||||||
* @apiName validate
|
* @apiName validate
|
||||||
* @apiGroup Mnemonic
|
* @apiGroup Mnemonic
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -181,7 +181,7 @@ class Mnemonic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Mnemonic.toSeed() toSeed() - Create root seed from mnemonic
|
* @api Mnemonic.toSeed() toSeed()
|
||||||
* @apiName toSeed
|
* @apiName toSeed
|
||||||
* @apiGroup Mnemonic
|
* @apiGroup Mnemonic
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -208,7 +208,7 @@ class Mnemonic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Mnemonic.wordLists() wordLists() - Return mnemonic word lists.
|
* @api Mnemonic.wordLists() wordLists()
|
||||||
* @apiName wordLists
|
* @apiName wordLists
|
||||||
* @apiGroup Mnemonic
|
* @apiGroup Mnemonic
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -234,7 +234,7 @@ class Mnemonic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Mnemonic.toKeypairs() toKeypairs() - Returns an array of privateKeyWIF/publicAddress pairs.
|
* @api Mnemonic.toKeypairs() toKeypairs()
|
||||||
* @apiName toKeypairs
|
* @apiName toKeypairs
|
||||||
* @apiGroup Mnemonic
|
* @apiGroup Mnemonic
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -290,7 +290,7 @@ class Mnemonic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Mnemonic.findNearestWord() findNearestWord() - Returns nearest matching word from provided word list.
|
* @api Mnemonic.findNearestWord() findNearestWord()
|
||||||
* @apiName findNearestWord
|
* @apiName findNearestWord
|
||||||
* @apiGroup Mnemonic
|
* @apiGroup Mnemonic
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
|
|||||||
+29
-9
@@ -13,7 +13,11 @@ class Ninsight {
|
|||||||
// this.apiToken = config.apiToken
|
// this.apiToken = config.apiToken
|
||||||
|
|
||||||
// this.ninsightURL = `https://bch-explorer.api.bitcoin.com/v1/`
|
// this.ninsightURL = `https://bch-explorer.api.bitcoin.com/v1/`
|
||||||
this.ninsightURL = `https://rest.bitcoin.com/v2`
|
if (config) {
|
||||||
|
this.ninsightURL = config.ninsightURL
|
||||||
|
? config.ninsightURL
|
||||||
|
: `https://rest.bitcoin.com/v2`
|
||||||
|
}
|
||||||
|
|
||||||
// Add JWT token to the authorization header.
|
// Add JWT token to the authorization header.
|
||||||
this.axiosOptions = {
|
this.axiosOptions = {
|
||||||
@@ -27,7 +31,7 @@ class Ninsight {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Ninsight.utxo() utxo() - Get list of uxto for address.
|
* @api Ninsight.utxo() utxo()
|
||||||
* @apiName Ninsight Utxo
|
* @apiName Ninsight Utxo
|
||||||
* @apiGroup Ninsight
|
* @apiGroup Ninsight
|
||||||
* @apiDescription Return list of uxto for address.
|
* @apiDescription Return list of uxto for address.
|
||||||
@@ -62,15 +66,31 @@ class Ninsight {
|
|||||||
*/
|
*/
|
||||||
async utxo(address) {
|
async utxo(address) {
|
||||||
try {
|
try {
|
||||||
if (typeof address !== "string")
|
// Handle single address.
|
||||||
throw new Error(`address needs to be a string.`)
|
if (typeof address === "string") {
|
||||||
|
const response = await axios.post(
|
||||||
|
`${this.ninsightURL}/address/utxo/${address}`,
|
||||||
|
{
|
||||||
|
addresses: [address]
|
||||||
|
},
|
||||||
|
_this.axiosOptions
|
||||||
|
)
|
||||||
|
return response.data
|
||||||
|
|
||||||
const response = await axios.get(
|
// Handle array of addresses.
|
||||||
`${this.ninsightURL}/address/utxo/${address}`,
|
} else if (Array.isArray(address)) {
|
||||||
_this.axiosOptions
|
const response = await axios.post(
|
||||||
)
|
`${this.ninsightURL}/address/utxo`,
|
||||||
|
{
|
||||||
|
addresses: address
|
||||||
|
},
|
||||||
|
_this.axiosOptions
|
||||||
|
)
|
||||||
|
|
||||||
return response.data
|
return response.data
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(`Input address must be a string or array of strings.`)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.response && error.response.data) throw error.response.data
|
if (error.response && error.response.data) throw error.response.data
|
||||||
else throw error
|
else throw error
|
||||||
|
|||||||
+3
-3
@@ -23,7 +23,7 @@ class OpenBazaar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api OpenBazaar.balance() balance() - Balance about an address.
|
* @api OpenBazaar.balance() balance()
|
||||||
* @apiName OpenBazaar Balance
|
* @apiName OpenBazaar Balance
|
||||||
* @apiGroup OpenBazaar
|
* @apiGroup OpenBazaar
|
||||||
* @apiDescription Return Balance about an address.
|
* @apiDescription Return Balance about an address.
|
||||||
@@ -83,7 +83,7 @@ class OpenBazaar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api OpenBazaar.utxo() utxo() - Get list of uxto for address.
|
* @api OpenBazaar.utxo() utxo()
|
||||||
* @apiName OpenBazaar Utxo
|
* @apiName OpenBazaar Utxo
|
||||||
* @apiGroup OpenBazaar
|
* @apiGroup OpenBazaar
|
||||||
* @apiDescription Return list of uxto for address.
|
* @apiDescription Return list of uxto for address.
|
||||||
@@ -135,7 +135,7 @@ class OpenBazaar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api OpenBazaar.tx() tx() - Get details on a transaction.
|
* @api OpenBazaar.tx() tx()
|
||||||
* @apiName OpenBazaar Tx
|
* @apiName OpenBazaar Tx
|
||||||
* @apiGroup OpenBazaar
|
* @apiGroup OpenBazaar
|
||||||
* @apiDescription Get details on a transaction.
|
* @apiDescription Get details on a transaction.
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
const axios = require("axios")
|
const axios = require("axios")
|
||||||
/**
|
/**
|
||||||
* @api price.current() current() - Get current price.
|
* @api price.current() current()
|
||||||
* @apiName Price.
|
* @apiName Price.
|
||||||
* @apiGroup Price
|
* @apiGroup Price
|
||||||
* @apiDescription Return current price of BCH in multiple currencies.
|
* @apiDescription Return current price of BCH in multiple currencies.
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class RawTransactions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api RawTransactions.decodeRawTransaction() decodeRawTransaction() - Return an Array of JSON objects representing the serialized, hex-encoded transactions.
|
* @api RawTransactions.decodeRawTransaction() decodeRawTransaction()
|
||||||
* @apiName decodeRawTransaction
|
* @apiName decodeRawTransaction
|
||||||
* @apiGroup RawTransactions
|
* @apiGroup RawTransactions
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -115,7 +115,7 @@ class RawTransactions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api RawTransactions.decodeScript() decodeScript() - Decode hex-encoded scripts.
|
* @api RawTransactions.decodeScript() decodeScript()
|
||||||
* @apiName decodeScript
|
* @apiName decodeScript
|
||||||
* @apiGroup RawTransactions
|
* @apiGroup RawTransactions
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -182,7 +182,7 @@ class RawTransactions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api RawTransactions.getRawTransaction() getRawTransaction() - Return the raw transaction data.
|
* @api RawTransactions.getRawTransaction() getRawTransaction()
|
||||||
* @apiName getRawTransaction
|
* @apiName getRawTransaction
|
||||||
* @apiGroup RawTransactions
|
* @apiGroup RawTransactions
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -279,7 +279,7 @@ class RawTransactions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api RawTransactions.sendRawTransaction() sendRawTransaction() - Submits raw transaction (serialized, hex-encoded) to local node and network.
|
* @api RawTransactions.sendRawTransaction() sendRawTransaction()
|
||||||
* @apiName sendRawTransaction
|
* @apiName sendRawTransaction
|
||||||
* @apiGroup RawTransactions
|
* @apiGroup RawTransactions
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
|
|||||||
+11
-11
@@ -14,7 +14,7 @@ class Schnorr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Schnorr.sign() sign() - Sign a 32-byte message with the private key, returning a 64-byte signature.
|
* @api Schnorr.sign() sign()
|
||||||
* @apiName sign
|
* @apiName sign
|
||||||
* @apiGroup Schnorr
|
* @apiGroup Schnorr
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -41,7 +41,7 @@ class Schnorr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Schnorr.verify() verify() - Verify a 64-byte signature of a 32-byte message against the public key.
|
* @api Schnorr.verify() verify()
|
||||||
* @apiName verify
|
* @apiName verify
|
||||||
* @apiGroup Schnorr
|
* @apiGroup Schnorr
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -73,7 +73,7 @@ class Schnorr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Schnorr.batchVerify() batchVerify() - Verify a list of 64-byte signatures as a batch operation.
|
* @api Schnorr.batchVerify() batchVerify()
|
||||||
* @apiName batchVerify
|
* @apiName batchVerify
|
||||||
* @apiGroup Schnorr
|
* @apiGroup Schnorr
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -135,7 +135,7 @@ class Schnorr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Schnorr.nonInteractive() nonInteractive() - Aggregates multiple signatures of different private keys
|
* @api Schnorr.nonInteractive() nonInteractive()
|
||||||
* @apiName nonInteractive
|
* @apiName nonInteractive
|
||||||
* @apiGroup Schnorr
|
* @apiGroup Schnorr
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -184,7 +184,7 @@ class Schnorr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Schnorr.computeEll() computeEll() - Generate ell which is the hash over all public keys participating in a session.
|
* @api Schnorr.computeEll() computeEll()
|
||||||
* @apiName computeEll
|
* @apiName computeEll
|
||||||
* @apiGroup Schnorr
|
* @apiGroup Schnorr
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -258,7 +258,7 @@ class Schnorr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Schnorr.publicKeyCombine() publicKeyCombine() - Creates a special rogue-key-resistant.
|
* @api Schnorr.publicKeyCombine() publicKeyCombine()
|
||||||
* @apiName publicKeyCombine
|
* @apiName publicKeyCombine
|
||||||
* @apiGroup Schnorr
|
* @apiGroup Schnorr
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -276,7 +276,7 @@ class Schnorr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Schnorr.sessionInitialize() sessionInitialize() - Creates a signing session.
|
* @api Schnorr.sessionInitialize() sessionInitialize()
|
||||||
* @apiName sessionInitialize
|
* @apiName sessionInitialize
|
||||||
* @apiGroup Schnorr
|
* @apiGroup Schnorr
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -315,7 +315,7 @@ class Schnorr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Schnorr.sessionNonceCombine() sessionNonceCombine() - Combines multiple nonces R_i into the combined nonce R.
|
* @api Schnorr.sessionNonceCombine() sessionNonceCombine()
|
||||||
* @apiName sessionNonceCombine
|
* @apiName sessionNonceCombine
|
||||||
* @apiGroup Schnorr
|
* @apiGroup Schnorr
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -360,7 +360,7 @@ class Schnorr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Schnorr.partialSign() partialSign() - Creates a partial signature s_i for a participant.
|
* @api Schnorr.partialSign() partialSign()
|
||||||
* @apiName partialSign
|
* @apiName partialSign
|
||||||
* @apiGroup Schnorr
|
* @apiGroup Schnorr
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -392,7 +392,7 @@ class Schnorr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Schnorr.partialSignatureVerify() partialSignatureVerify() - Verifies a partial signature s_i against the participant's public key P_i.
|
* @api Schnorr.partialSignatureVerify() partialSignatureVerify()
|
||||||
* @apiName partialSignatureVerify
|
* @apiName partialSignatureVerify
|
||||||
* @apiGroup Schnorr
|
* @apiGroup Schnorr
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
@@ -445,7 +445,7 @@ class Schnorr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Schnorr.partialSignaturesCombine() partialSignaturesCombine() - Combines multiple partial signatures into a Schnorr signature.
|
* @api Schnorr.partialSignaturesCombine() partialSignaturesCombine()
|
||||||
* @apiName partialSignaturesCombine
|
* @apiName partialSignaturesCombine
|
||||||
* @apiGroup Schnorr
|
* @apiGroup Schnorr
|
||||||
* @apiDescription
|
* @apiDescription
|
||||||
|
|||||||
+11
-11
@@ -14,7 +14,7 @@ class Address extends BCHJSAddress {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api SLP.Address.toSLPAddress() toSLPAddress() - Converting to slpAddress format.
|
* @api SLP.Address.toSLPAddress() toSLPAddress()
|
||||||
* @apiName toSLPAddress
|
* @apiName toSLPAddress
|
||||||
* @apiGroup SLP
|
* @apiGroup SLP
|
||||||
* @apiDescription Converting legacy or cashaddr to slpAddress format.
|
* @apiDescription Converting legacy or cashaddr to slpAddress format.
|
||||||
@@ -60,7 +60,7 @@ class Address extends BCHJSAddress {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api SLP.Address.toCashAddress() toCashAddress() - Converting to cashAddress format.
|
* @api SLP.Address.toCashAddress() toCashAddress()
|
||||||
* @apiName toCashAddress
|
* @apiName toCashAddress
|
||||||
* @apiGroup SLP
|
* @apiGroup SLP
|
||||||
* @apiDescription Converting legacy or slpaddr to cashAddress format.
|
* @apiDescription Converting legacy or slpaddr to cashAddress format.
|
||||||
@@ -106,7 +106,7 @@ class Address extends BCHJSAddress {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api SLP.Address.toLegacyAddress() toLegacyAddress() - Converting to legacy address format.
|
* @api SLP.Address.toLegacyAddress() toLegacyAddress()
|
||||||
* @apiName toLegacyAddress
|
* @apiName toLegacyAddress
|
||||||
* @apiGroup SLP
|
* @apiGroup SLP
|
||||||
* @apiDescription Converting cashaddr or slpaddr to legacy address format.
|
* @apiDescription Converting cashaddr or slpaddr to legacy address format.
|
||||||
@@ -164,7 +164,7 @@ class Address extends BCHJSAddress {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api SLP.Address.isSLPAddress() isSLPAddress() - Detect if slpAddr encoded address.
|
* @api SLP.Address.isSLPAddress() isSLPAddress()
|
||||||
* @apiName isSLPAddress
|
* @apiName isSLPAddress
|
||||||
* @apiGroup SLP
|
* @apiGroup SLP
|
||||||
* @apiDescription Detect if slpAddr encoded address.
|
* @apiDescription Detect if slpAddr encoded address.
|
||||||
@@ -201,7 +201,7 @@ class Address extends BCHJSAddress {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api SLP.Address.isMainnetAddress() isMainnetAddress() - Detect if mainnet address.
|
* @api SLP.Address.isMainnetAddress() isMainnetAddress()
|
||||||
* @apiName isMainnetAddress
|
* @apiName isMainnetAddress
|
||||||
* @apiGroup SLP
|
* @apiGroup SLP
|
||||||
* @apiDescription Detect if mainnet address.
|
* @apiDescription Detect if mainnet address.
|
||||||
@@ -255,7 +255,7 @@ class Address extends BCHJSAddress {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api SLP.Address.isTestnetAddress() isTestnetAddress() - Detect if testnet address.
|
* @api SLP.Address.isTestnetAddress() isTestnetAddress()
|
||||||
* @apiName isTestnetAddress
|
* @apiName isTestnetAddress
|
||||||
* @apiGroup SLP
|
* @apiGroup SLP
|
||||||
* @apiDescription Detect if testnet address.
|
* @apiDescription Detect if testnet address.
|
||||||
@@ -307,7 +307,7 @@ class Address extends BCHJSAddress {
|
|||||||
return bchAddress.isTestnetAddress(cashAddr)
|
return bchAddress.isTestnetAddress(cashAddr)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @api SLP.Address.isP2PKHAddress() isP2PKHAddress() - Detect if p2pkh address.
|
* @api SLP.Address.isP2PKHAddress() isP2PKHAddress()
|
||||||
* @apiName isP2PKHAddress
|
* @apiName isP2PKHAddress
|
||||||
* @apiGroup SLP
|
* @apiGroup SLP
|
||||||
* @apiDescription Detect if p2pkh address.
|
* @apiDescription Detect if p2pkh address.
|
||||||
@@ -359,7 +359,7 @@ class Address extends BCHJSAddress {
|
|||||||
return bchAddress.isP2PKHAddress(cashAddr)
|
return bchAddress.isP2PKHAddress(cashAddr)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @api SLP.Address.isP2SHAddress() isP2SHAddress() - Detect if p2sh address.
|
* @api SLP.Address.isP2SHAddress() isP2SHAddress()
|
||||||
* @apiName isP2SHAddress
|
* @apiName isP2SHAddress
|
||||||
* @apiGroup SLP
|
* @apiGroup SLP
|
||||||
* @apiDescription Detect if p2sh address.
|
* @apiDescription Detect if p2sh address.
|
||||||
@@ -411,7 +411,7 @@ class Address extends BCHJSAddress {
|
|||||||
return bchAddress.isP2SHAddress(cashAddr)
|
return bchAddress.isP2SHAddress(cashAddr)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @api SLP.Address.detectAddressFormat() detectAddressFormat() - Detect address format.
|
* @api SLP.Address.detectAddressFormat() detectAddressFormat()
|
||||||
* @apiName detectAddressFormat
|
* @apiName detectAddressFormat
|
||||||
* @apiGroup SLP
|
* @apiGroup SLP
|
||||||
* @apiDescription Detect address format.
|
* @apiDescription Detect address format.
|
||||||
@@ -464,7 +464,7 @@ class Address extends BCHJSAddress {
|
|||||||
return bchAddress.detectAddressFormat(address)
|
return bchAddress.detectAddressFormat(address)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @api SLP.Address.detectAddressNetwork() detectAddressNetwork() - Detect address network.
|
* @api SLP.Address.detectAddressNetwork() detectAddressNetwork()
|
||||||
* @apiName detectAddressNetwork
|
* @apiName detectAddressNetwork
|
||||||
* @apiGroup SLP
|
* @apiGroup SLP
|
||||||
* @apiDescription Detect address network.
|
* @apiDescription Detect address network.
|
||||||
@@ -516,7 +516,7 @@ class Address extends BCHJSAddress {
|
|||||||
return bchAddress.detectAddressNetwork(cashAddr)
|
return bchAddress.detectAddressNetwork(cashAddr)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @api SLP.Address.detectAddressType() detectAddressType() - Detect address type.
|
* @api SLP.Address.detectAddressType() detectAddressType()
|
||||||
* @apiName detectAddressType
|
* @apiName detectAddressType
|
||||||
* @apiGroup SLP
|
* @apiGroup SLP
|
||||||
* @apiDescription Detect address type.
|
* @apiDescription Detect address type.
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ class ECPair extends BCHJSECPair {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @api SLP.ECPair.toSLPAddress() toSLPAddress() - Get slp address of ECPair.
|
* @api SLP.ECPair.toSLPAddress() toSLPAddress()
|
||||||
* @apiName toSLPAddress
|
* @apiName toSLPAddress
|
||||||
* @apiGroup SLP
|
* @apiGroup SLP
|
||||||
* @apiDescription Get slp address of ECPair.
|
* @apiDescription Get slp address of ECPair.
|
||||||
|
|||||||
@@ -370,84 +370,6 @@ class Utils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @api SLP.Utils.balance() balance()
|
|
||||||
* @apiName balance
|
|
||||||
* @apiGroup SLP Utils
|
|
||||||
* @apiDescription Return single balance for an address by token id.
|
|
||||||
*
|
|
||||||
* @apiExample Example usage:
|
|
||||||
*
|
|
||||||
* // single balance for SLP Address
|
|
||||||
* (async () => {
|
|
||||||
* try {
|
|
||||||
* let balance = await bchjs.SLP.Utils.balance(
|
|
||||||
* "simpleledger:qr5agtachyxvrwxu76vzszan5pnvuzy8duhv4lxrsk",
|
|
||||||
* "df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb"
|
|
||||||
* );
|
|
||||||
* console.log(balance);
|
|
||||||
* } catch (error) {
|
|
||||||
* console.error(error);
|
|
||||||
* }
|
|
||||||
* })();
|
|
||||||
*
|
|
||||||
* // returns
|
|
||||||
* // { tokenId:
|
|
||||||
* // 'df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb',
|
|
||||||
* // balance: '617',
|
|
||||||
* // decimalCount: 8 }
|
|
||||||
*
|
|
||||||
* // single balance for Cash Address
|
|
||||||
* (async () => {
|
|
||||||
* try {
|
|
||||||
* let balance = await bchjs.SLP.Utils.balance(
|
|
||||||
* "bitcoincash:qr5agtachyxvrwxu76vzszan5pnvuzy8dumh7ynrwg",
|
|
||||||
* "df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb"
|
|
||||||
* );
|
|
||||||
* console.log(balance);
|
|
||||||
* } catch (error) {
|
|
||||||
* console.error(error);
|
|
||||||
* }
|
|
||||||
* })();
|
|
||||||
*
|
|
||||||
* // returns
|
|
||||||
* // { tokenId:
|
|
||||||
* // 'df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb',
|
|
||||||
* // balance: '617',
|
|
||||||
* // decimalCount: 8 }
|
|
||||||
*
|
|
||||||
* // single balance for Legacy Address
|
|
||||||
* (async () => {
|
|
||||||
* try {
|
|
||||||
* let balance = await bchjs.SLP.Utils.balance(
|
|
||||||
* "1DwQqpWc8pzaRydCmiJsPdoqCzmjSQQbp8",
|
|
||||||
* "467969e067f5612863d0bf2daaa70dede2c6be03abb6fd401c5ef6e1e1f1f5c5"
|
|
||||||
* );
|
|
||||||
* console.log(balance);
|
|
||||||
* } catch (error) {
|
|
||||||
* console.error(error);
|
|
||||||
* }
|
|
||||||
* })();
|
|
||||||
*
|
|
||||||
* // returns
|
|
||||||
* // { tokenId:
|
|
||||||
* // '467969e067f5612863d0bf2daaa70dede2c6be03abb6fd401c5ef6e1e1f1f5c5',
|
|
||||||
* // balance: '1234',
|
|
||||||
* // decimalCount: 2 }
|
|
||||||
*/
|
|
||||||
// Retrieve a balance for a specific address and token ID
|
|
||||||
async balance(address, tokenId) {
|
|
||||||
const path = `${this.restURL}slp/balance/${address}/${tokenId}`
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await axios.get(path, _this.axiosOptions)
|
|
||||||
return response.data
|
|
||||||
} catch (error) {
|
|
||||||
if (error.response && error.response.data) throw error.response.data
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api SLP.Utils.validateTxid() validateTxid()
|
* @api SLP.Utils.validateTxid() validateTxid()
|
||||||
* @apiName validateTxid
|
* @apiName validateTxid
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class TransactionBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api Transaction-Builder.addInput() addInput() - Add input to transaction.
|
* @api Transaction-Builder.addInput() addInput()
|
||||||
* @apiName AddInput
|
* @apiName AddInput
|
||||||
* @apiGroup TransactionBuilder
|
* @apiGroup TransactionBuilder
|
||||||
* @apiDescription Add input to transaction.
|
* @apiDescription Add input to transaction.
|
||||||
@@ -66,7 +66,7 @@ class TransactionBuilder {
|
|||||||
this.p2shInput = true
|
this.p2shInput = true
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @api Transaction-Builder.addOutput() addOutput() - Add output to transaction.
|
* @api Transaction-Builder.addOutput() addOutput()
|
||||||
* @apiName AddOutput
|
* @apiName AddOutput
|
||||||
* @apiGroup TransactionBuilder
|
* @apiGroup TransactionBuilder
|
||||||
* @apiDescription Add output to transaction.
|
* @apiDescription Add output to transaction.
|
||||||
@@ -90,7 +90,7 @@ class TransactionBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @api Transaction-Builder.setLockTime() setLockTime() - Set locktime.
|
* @api Transaction-Builder.setLockTime() setLockTime()
|
||||||
* @apiName SetLockTime
|
* @apiName SetLockTime
|
||||||
* @apiGroup TransactionBuilder
|
* @apiGroup TransactionBuilder
|
||||||
* @apiDescription Set locktime.
|
* @apiDescription Set locktime.
|
||||||
@@ -108,7 +108,7 @@ class TransactionBuilder {
|
|||||||
this.transaction.setLockTime(locktime)
|
this.transaction.setLockTime(locktime)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @api Transaction-Builder.sign() sign() - Sign transaction..
|
* @api Transaction-Builder.sign() sign()
|
||||||
* @apiName Sign.
|
* @apiName Sign.
|
||||||
* @apiGroup TransactionBuilder
|
* @apiGroup TransactionBuilder
|
||||||
* @apiDescription Sign transaction. It creates the unlocking script needed to spend an input. Each input has its own script and thus 'sign' must be called for each input even if the keyPair is the same..
|
* @apiDescription Sign transaction. It creates the unlocking script needed to spend an input. Each input has its own script and thus 'sign' must be called for each input even if the keyPair is the same..
|
||||||
@@ -145,7 +145,7 @@ class TransactionBuilder {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @api Transaction-Builder.build() build() - Build transaction.
|
* @api Transaction-Builder.build() build()
|
||||||
* @apiName Build.
|
* @apiName Build.
|
||||||
* @apiGroup TransactionBuilder
|
* @apiGroup TransactionBuilder
|
||||||
* @apiDescription Build transaction.
|
* @apiDescription Build transaction.
|
||||||
|
|||||||
+1
-1
@@ -18,7 +18,7 @@ class Util {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api util.validateAddress() validateAddress() - Get information about the given bitcoin address.
|
* @api util.validateAddress() validateAddress()
|
||||||
* @apiName Validate Address.
|
* @apiName Validate Address.
|
||||||
* @apiGroup Util
|
* @apiGroup Util
|
||||||
* @apiDescription Return information about the given bitcoin address.
|
* @apiDescription Return information about the given bitcoin address.
|
||||||
|
|||||||
@@ -178,4 +178,66 @@ describe(`#ElectrumX`, () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe(`#unconfirmed`, () => {
|
||||||
|
// These tests won't work because unconfirmed transactions are transient in nature.
|
||||||
|
/*
|
||||||
|
it(`should GET unconfirmed UTXOs (mempool) for a single address`, async () => {
|
||||||
|
const addr = "bitcoincash:qqy6qwk3wpne95hhv8uzwr4cn8m7c06cqgchl77dnv"
|
||||||
|
|
||||||
|
const result = await bchjs.Electrumx.unconfirmed(addr)
|
||||||
|
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
||||||
|
|
||||||
|
assert.property(result, "success")
|
||||||
|
assert.equal(result.success, true)
|
||||||
|
|
||||||
|
assert.property(result, "utxos")
|
||||||
|
assert.isArray(result.utxos)
|
||||||
|
|
||||||
|
assert.property(result.utxos[0], "height")
|
||||||
|
assert.property(result.utxos[0], "tx_hash")
|
||||||
|
assert.property(result.utxos[0], "fee")
|
||||||
|
})
|
||||||
|
|
||||||
|
it(`should POST request for unconfirmed UTXOs (mempool) for an array of addresses`, async () => {
|
||||||
|
const addr = [
|
||||||
|
"bitcoincash:qqy6qwk3wpne95hhv8uzwr4cn8m7c06cqgchl77dnv",
|
||||||
|
"bitcoincash:qpyrtsl9msdu2klgfpcmn2v5r22w9rk24g8pal74ts"
|
||||||
|
]
|
||||||
|
|
||||||
|
const result = await bchjs.Electrumx.unconfirmed(addr)
|
||||||
|
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
||||||
|
|
||||||
|
assert.property(result, "success")
|
||||||
|
assert.equal(result.success, true)
|
||||||
|
|
||||||
|
assert.property(result, "utxos")
|
||||||
|
assert.isArray(result.utxos)
|
||||||
|
|
||||||
|
assert.property(result.utxos[0], "utxos")
|
||||||
|
assert.isArray(result.utxos[0].utxos)
|
||||||
|
assert.property(result.utxos[0], "address")
|
||||||
|
|
||||||
|
assert.property(result.utxos[0].utxos[0], "height")
|
||||||
|
assert.property(result.utxos[0].utxos[0], "tx_hash")
|
||||||
|
assert.property(result.utxos[0].utxos[0], "fee")
|
||||||
|
})
|
||||||
|
*/
|
||||||
|
|
||||||
|
it(`should throw error on array size rate limit`, async () => {
|
||||||
|
try {
|
||||||
|
const addr = []
|
||||||
|
for (let i = 0; i < 25; i++)
|
||||||
|
addr.push("bitcoincash:qrdka2205f4hyukutc2g0s6lykperc8nsu5u2ddpqf")
|
||||||
|
|
||||||
|
await bchjs.Electrumx.unconfirmed(addr)
|
||||||
|
|
||||||
|
// 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")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const assert = chai.assert
|
|||||||
const sinon = require("sinon")
|
const sinon = require("sinon")
|
||||||
|
|
||||||
const BCHJS = require("../../src/bch-js")
|
const BCHJS = require("../../src/bch-js")
|
||||||
const bchjs = new BCHJS()
|
const bchjs = new BCHJS({ ninsightURL: "https://rest.bitcoin.com/v2" })
|
||||||
|
|
||||||
describe(`#Ninsight`, () => {
|
describe(`#Ninsight`, () => {
|
||||||
let sandbox
|
let sandbox
|
||||||
@@ -33,5 +33,25 @@ describe(`#Ninsight`, () => {
|
|||||||
assert.property(result.utxos[0], "height")
|
assert.property(result.utxos[0], "height")
|
||||||
assert.property(result.utxos[0], "confirmations")
|
assert.property(result.utxos[0], "confirmations")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it(`should POST utxo details for an array of addresses`, async () => {
|
||||||
|
const addr = [
|
||||||
|
"bitcoincash:qp3sn6vlwz28ntmf3wmyra7jqttfx7z6zgtkygjhc7",
|
||||||
|
"bitcoincash:qz0us0z6ucpqt07jgpad0shgh7xmwxyr3ynlcsq0wr"
|
||||||
|
]
|
||||||
|
|
||||||
|
const result = await bchjs.Ninsight.utxo(addr)
|
||||||
|
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
||||||
|
|
||||||
|
assert.isArray(result)
|
||||||
|
assert.isArray(result[0].utxos)
|
||||||
|
|
||||||
|
assert.property(result[0], "utxos")
|
||||||
|
assert.property(result[0], "legacyAddress")
|
||||||
|
assert.property(result[0], "cashAddress")
|
||||||
|
assert.property(result[0], "slpAddress")
|
||||||
|
assert.property(result[0], "scriptPubKey")
|
||||||
|
assert.property(result[0], "asm")
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -182,4 +182,66 @@ describe(`#ElectrumX`, () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe(`#unconfirmed`, () => {
|
||||||
|
// These tests won't work because unconfirmed transactions are transient in nature.
|
||||||
|
/*
|
||||||
|
it(`should GET unconfirmed UTXOs (mempool) for a single address`, async () => {
|
||||||
|
const addr = "bchtest:qp25k20dgcljrz4hkdz43partam3j5httyprjp23qd"
|
||||||
|
|
||||||
|
const result = await bchjs.Electrumx.unconfirmed(addr)
|
||||||
|
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
||||||
|
|
||||||
|
assert.property(result, "success")
|
||||||
|
assert.equal(result.success, true)
|
||||||
|
|
||||||
|
assert.property(result, "utxos")
|
||||||
|
assert.isArray(result.utxos)
|
||||||
|
|
||||||
|
assert.property(result.utxos[0], "height")
|
||||||
|
assert.property(result.utxos[0], "tx_hash")
|
||||||
|
assert.property(result.utxos[0], "fee")
|
||||||
|
})
|
||||||
|
|
||||||
|
it(`should POST unconfirmed UTXO details for an array of addresses`, async () => {
|
||||||
|
const addr = [
|
||||||
|
"bchtest:qp25k20dgcljrz4hkdz43partam3j5httyprjp23qd",
|
||||||
|
"bchtest:qpkl3xylrjx4jup6m66e7zg7whlaucsxeudxeqawdj"
|
||||||
|
]
|
||||||
|
|
||||||
|
const result = await bchjs.Electrumx.unconfirmed(addr)
|
||||||
|
//console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
||||||
|
|
||||||
|
assert.property(result, "success")
|
||||||
|
assert.equal(result.success, true)
|
||||||
|
|
||||||
|
assert.property(result, "utxos")
|
||||||
|
assert.isArray(result.utxos)
|
||||||
|
|
||||||
|
assert.property(result.utxos[0], "utxos")
|
||||||
|
assert.isArray(result.utxos[0].utxos)
|
||||||
|
assert.property(result.utxos[0], "address")
|
||||||
|
|
||||||
|
assert.property(result.utxos[0].utxos[0], "height")
|
||||||
|
assert.property(result.utxos[0].utxos[0], "tx_hash")
|
||||||
|
assert.property(result.utxos[0].utxos[0], "fee")
|
||||||
|
})
|
||||||
|
*/
|
||||||
|
|
||||||
|
it(`should throw error on array size rate limit`, async () => {
|
||||||
|
try {
|
||||||
|
const addr = []
|
||||||
|
for (let i = 0; i < 25; i++)
|
||||||
|
addr.push("bchtest:qrvn2n228aa39xupcw9jw0d3fj8axxky656e4j62z2")
|
||||||
|
|
||||||
|
await bchjs.Electrumx.unconfirmed(addr)
|
||||||
|
//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")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
const chai = require("chai")
|
||||||
|
const assert = chai.assert
|
||||||
|
const sinon = require("sinon")
|
||||||
|
|
||||||
|
const BCHJS = require("../../../src/bch-js")
|
||||||
|
const bchjs = new BCHJS({ ninsightURL: "https://trest.bitcoin.com/v2" })
|
||||||
|
|
||||||
|
describe(`#Ninsight`, () => {
|
||||||
|
let sandbox
|
||||||
|
beforeEach(() => (sandbox = sinon.createSandbox()))
|
||||||
|
afterEach(() => sandbox.restore())
|
||||||
|
|
||||||
|
describe(`#utxo`, () => {
|
||||||
|
it(`should GET utxos for a single address`, async () => {
|
||||||
|
const addr = "bchtest:qzjtnzcvzxx7s0na88yrg3zl28wwvfp97538sgrrmr"
|
||||||
|
|
||||||
|
const result = await bchjs.Ninsight.utxo(addr)
|
||||||
|
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
||||||
|
|
||||||
|
assert.property(result, "utxos")
|
||||||
|
assert.property(result, "legacyAddress")
|
||||||
|
assert.property(result, "cashAddress")
|
||||||
|
assert.property(result, "slpAddress")
|
||||||
|
assert.property(result, "scriptPubKey")
|
||||||
|
assert.property(result, "asm")
|
||||||
|
|
||||||
|
assert.isArray(result.utxos)
|
||||||
|
|
||||||
|
assert.property(result.utxos[0], "txid")
|
||||||
|
assert.property(result.utxos[0], "vout")
|
||||||
|
assert.property(result.utxos[0], "amount")
|
||||||
|
assert.property(result.utxos[0], "satoshis")
|
||||||
|
assert.property(result.utxos[0], "height")
|
||||||
|
assert.property(result.utxos[0], "confirmations")
|
||||||
|
})
|
||||||
|
|
||||||
|
it(`should POST utxo details for an array of addresses`, async () => {
|
||||||
|
const addr = [
|
||||||
|
"bchtest:qzjtnzcvzxx7s0na88yrg3zl28wwvfp97538sgrrmr",
|
||||||
|
"bchtest:qp6hgvevf4gzz6l7pgcte3gaaud9km0l459fa23dul"
|
||||||
|
]
|
||||||
|
|
||||||
|
const result = await bchjs.Ninsight.utxo(addr)
|
||||||
|
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
||||||
|
|
||||||
|
assert.isArray(result)
|
||||||
|
assert.isArray(result[0].utxos)
|
||||||
|
|
||||||
|
assert.property(result[0], "utxos")
|
||||||
|
assert.property(result[0], "legacyAddress")
|
||||||
|
assert.property(result[0], "cashAddress")
|
||||||
|
assert.property(result[0], "slpAddress")
|
||||||
|
assert.property(result[0], "scriptPubKey")
|
||||||
|
assert.property(result[0], "asm")
|
||||||
|
|
||||||
|
// assert.hasAnyKeys(result[0][0], [
|
||||||
|
// "txid",
|
||||||
|
// "vout",
|
||||||
|
// "value",
|
||||||
|
// "height",
|
||||||
|
// "confirmations"
|
||||||
|
// ])
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -6,3 +6,4 @@ export NETWORK=testnet
|
|||||||
|
|
||||||
cd test/integration/testnet/
|
cd test/integration/testnet/
|
||||||
mocha --timeout 30000 blockchain.js control.js electrumx.js openbazaar.js rawtransaction.js slp.js util.js
|
mocha --timeout 30000 blockchain.js control.js electrumx.js openbazaar.js rawtransaction.js slp.js util.js
|
||||||
|
#mocha --timeout 30000 blockchain.js
|
||||||
|
|||||||
@@ -196,4 +196,68 @@ describe(`#ElectrumX`, () => {
|
|||||||
assert.property(result.transactions[0].transactions[0], "tx_hash")
|
assert.property(result.transactions[0].transactions[0], "tx_hash")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe(`#unconfirmed`, () => {
|
||||||
|
it(`should throw an error for improper input`, async () => {
|
||||||
|
try {
|
||||||
|
const addr = 12345
|
||||||
|
|
||||||
|
await bchjs.Electrumx.unconfirmed(addr)
|
||||||
|
assert.equal(true, false, "Unexpected result!")
|
||||||
|
} catch (err) {
|
||||||
|
// console.log(`err: `, err)
|
||||||
|
assert.include(
|
||||||
|
err.message,
|
||||||
|
`Input address must be a string or array of strings`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
it(`should GET unconfirmed utxos for a single address`, async () => {
|
||||||
|
// Stub the network call.
|
||||||
|
sandbox.stub(axios, "get").resolves({ data: mockData.unconfirmed })
|
||||||
|
|
||||||
|
const addr = "bitcoincash:qqh793x9au6ehvh7r2zflzguanlme760wuzehgzjh9"
|
||||||
|
|
||||||
|
const result = await bchjs.Electrumx.unconfirmed(addr)
|
||||||
|
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
||||||
|
|
||||||
|
assert.property(result, "success")
|
||||||
|
assert.equal(result.success, true)
|
||||||
|
|
||||||
|
assert.property(result, "utxos")
|
||||||
|
assert.isArray(result.utxos)
|
||||||
|
|
||||||
|
assert.property(result.utxos[0], "height")
|
||||||
|
assert.property(result.utxos[0], "tx_hash")
|
||||||
|
assert.property(result.utxos[0], "fee")
|
||||||
|
})
|
||||||
|
|
||||||
|
it(`should POST unconfirmed utxo details for an array of addresses`, async () => {
|
||||||
|
// Stub the network call.
|
||||||
|
sandbox.stub(axios, "post").resolves({ data: mockData.unconfirmedArray })
|
||||||
|
|
||||||
|
const addr = [
|
||||||
|
"bitcoincash:qrdka2205f4hyukutc2g0s6lykperc8nsu5u2ddpqf",
|
||||||
|
"bitcoincash:qpdh9s677ya8tnx7zdhfrn8qfyvy22wj4qa7nwqa5v"
|
||||||
|
]
|
||||||
|
|
||||||
|
const result = await bchjs.Electrumx.unconfirmed(addr)
|
||||||
|
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
||||||
|
|
||||||
|
assert.property(result, "success")
|
||||||
|
assert.equal(result.success, true)
|
||||||
|
|
||||||
|
assert.property(result, "utxos")
|
||||||
|
assert.isArray(result.utxos)
|
||||||
|
|
||||||
|
assert.property(result.utxos[0], "utxos")
|
||||||
|
assert.isArray(result.utxos[0].utxos)
|
||||||
|
assert.property(result.utxos[0], "address")
|
||||||
|
|
||||||
|
assert.property(result.utxos[0].utxos[0], "height")
|
||||||
|
assert.property(result.utxos[0].utxos[0], "tx_hash")
|
||||||
|
assert.property(result.utxos[0].utxos[0], "fee")
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -119,11 +119,52 @@ const transactions = {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const unconfirmed = {
|
||||||
|
success: true,
|
||||||
|
utxos: [
|
||||||
|
{
|
||||||
|
height: 602405,
|
||||||
|
tx_hash:
|
||||||
|
"2b37bdb3b63dd0bca720437754a36671431a950e684b64c44ea910ea9d5297c7",
|
||||||
|
fee: 34100
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
const unconfirmedArray = {
|
||||||
|
success: true,
|
||||||
|
utxos: [
|
||||||
|
{
|
||||||
|
utxos: [
|
||||||
|
{
|
||||||
|
height: 604392,
|
||||||
|
tx_hash:
|
||||||
|
"7774e449c5a3065144cefbc4c0c21e6b69c987f095856778ef9f45ddd8ae1a41",
|
||||||
|
fee: 34210
|
||||||
|
},
|
||||||
|
{
|
||||||
|
height: 630834,
|
||||||
|
tx_hash:
|
||||||
|
"4fe60a51e0d8f5134bfd8e5f872d6e502d7f01b28a6afebb27f4438a4f638d53",
|
||||||
|
value: 3000
|
||||||
|
}
|
||||||
|
],
|
||||||
|
address: "bitcoincash:qrdka2205f4hyukutc2g0s6lykperc8nsu5u2ddpqf"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
utxos: [],
|
||||||
|
address: "bitcoincash:qpdh9s677ya8tnx7zdhfrn8qfyvy22wj4qa7nwqa5v"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
utxo,
|
utxo,
|
||||||
utxos,
|
utxos,
|
||||||
balance,
|
balance,
|
||||||
balances,
|
balances,
|
||||||
transaction,
|
transaction,
|
||||||
transactions
|
transactions,
|
||||||
|
unconfirmed,
|
||||||
|
unconfirmedArray
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ const utxo = {
|
|||||||
"OP_DUP OP_HASH160 2fe2c4c5ef359bb2fe1a849f891cecffbcfb4f77 OP_EQUALVERIFY OP_CHECKSIG"
|
"OP_DUP OP_HASH160 2fe2c4c5ef359bb2fe1a849f891cecffbcfb4f77 OP_EQUALVERIFY OP_CHECKSIG"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const utxoPost = [utxo, utxo]
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
utxo
|
utxo,
|
||||||
|
utxoPost
|
||||||
}
|
}
|
||||||
|
|||||||
+257
-9
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
const assert = require("chai").assert
|
const assert = require("chai").assert
|
||||||
const sinon = require("sinon")
|
const sinon = require("sinon")
|
||||||
|
|
||||||
const BCHJS = require("../../src/bch-js")
|
const BCHJS = require("../../src/bch-js")
|
||||||
let bchjs
|
let bchjs
|
||||||
|
|
||||||
@@ -27,12 +26,12 @@ describe(`#IPFS`, () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("#createFileModel", () => {
|
describe("#createFileModelServer", () => {
|
||||||
it("should throw an error if file does not exist", async () => {
|
it("should throw an error if file does not exist", async () => {
|
||||||
try {
|
try {
|
||||||
const path = "/non-existant-file"
|
const path = "/non-existant-file"
|
||||||
|
|
||||||
await bchjs.IPFS.createFileModel(path)
|
await bchjs.IPFS.createFileModelServer(path)
|
||||||
|
|
||||||
assert.equal(true, false, "Unexpected result")
|
assert.equal(true, false, "Unexpected result")
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -48,7 +47,7 @@ describe(`#IPFS`, () => {
|
|||||||
.stub(bchjs.IPFS.axios, "post")
|
.stub(bchjs.IPFS.axios, "post")
|
||||||
.resolves({ data: mockData.mockNewFileModel })
|
.resolves({ data: mockData.mockNewFileModel })
|
||||||
|
|
||||||
const result = await bchjs.IPFS.createFileModel(path)
|
const result = await bchjs.IPFS.createFileModelServer(path)
|
||||||
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
||||||
|
|
||||||
assert.property(result, "success")
|
assert.property(result, "success")
|
||||||
@@ -72,12 +71,12 @@ describe(`#IPFS`, () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("#uploadFile", () => {
|
describe("#uploadFileServer", () => {
|
||||||
it("should throw an error if file does not exist", async () => {
|
it("should throw an error if file does not exist", async () => {
|
||||||
try {
|
try {
|
||||||
const path = "/non-existant-file"
|
const path = "/non-existant-file"
|
||||||
|
|
||||||
await bchjs.IPFS.uploadFile(path)
|
await bchjs.IPFS.uploadFileServer(path)
|
||||||
|
|
||||||
assert.equal(true, false, "Unexpected result")
|
assert.equal(true, false, "Unexpected result")
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -90,7 +89,7 @@ describe(`#IPFS`, () => {
|
|||||||
try {
|
try {
|
||||||
const path = `${__dirname}/ipfs.js`
|
const path = `${__dirname}/ipfs.js`
|
||||||
|
|
||||||
await bchjs.IPFS.uploadFile(path)
|
await bchjs.IPFS.uploadFileServer(path)
|
||||||
|
|
||||||
assert.equal(true, false, "Unexpected result")
|
assert.equal(true, false, "Unexpected result")
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -112,7 +111,7 @@ describe(`#IPFS`, () => {
|
|||||||
sandbox.stub(bchjs.IPFS.uppy, "upload").resolves(mock)
|
sandbox.stub(bchjs.IPFS.uppy, "upload").resolves(mock)
|
||||||
|
|
||||||
const path = `${__dirname}/ipfs.js`
|
const path = `${__dirname}/ipfs.js`
|
||||||
await bchjs.IPFS.uploadFile(path, "5ec562319bfacc745e8d8a52")
|
await bchjs.IPFS.uploadFileServer(path, "5ec562319bfacc745e8d8a52")
|
||||||
|
|
||||||
assert.equal(true, false, "Unexpected result")
|
assert.equal(true, false, "Unexpected result")
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -126,7 +125,7 @@ describe(`#IPFS`, () => {
|
|||||||
sandbox.stub(bchjs.IPFS.uppy, "upload").resolves(mockData.uploadData)
|
sandbox.stub(bchjs.IPFS.uppy, "upload").resolves(mockData.uploadData)
|
||||||
|
|
||||||
const path = `${__dirname}/ipfs.js`
|
const path = `${__dirname}/ipfs.js`
|
||||||
const result = await bchjs.IPFS.uploadFile(
|
const result = await bchjs.IPFS.uploadFileServer(
|
||||||
path,
|
path,
|
||||||
"5ec562319bfacc745e8d8a52"
|
"5ec562319bfacc745e8d8a52"
|
||||||
)
|
)
|
||||||
@@ -192,4 +191,253 @@ describe(`#IPFS`, () => {
|
|||||||
assert.property(result, "fileName")
|
assert.property(result, "fileName")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe("#createFileModelWeb", () => {
|
||||||
|
it("should throw an error if file is undefined", async () => {
|
||||||
|
try {
|
||||||
|
let file
|
||||||
|
|
||||||
|
await bchjs.IPFS.createFileModelWeb(file)
|
||||||
|
|
||||||
|
assert.equal(true, false, "Unexpected result")
|
||||||
|
} catch (err) {
|
||||||
|
//console.log(`err.message: ${err.message}`)
|
||||||
|
assert.include(err.message, `File is required`)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
it("should throw an error if file is empty", async () => {
|
||||||
|
try {
|
||||||
|
const file = {}
|
||||||
|
|
||||||
|
await bchjs.IPFS.createFileModelWeb(file)
|
||||||
|
|
||||||
|
assert.equal(true, false, "Unexpected result")
|
||||||
|
} catch (err) {
|
||||||
|
//console.log(`err.message: ${err.message}`)
|
||||||
|
assert.include(
|
||||||
|
err.message,
|
||||||
|
`File should have the property 'name' of string type`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
it("should throw an error if 'name' property is not included", async () => {
|
||||||
|
try {
|
||||||
|
const file = {
|
||||||
|
size: 5000
|
||||||
|
}
|
||||||
|
|
||||||
|
await bchjs.IPFS.createFileModelWeb(file)
|
||||||
|
|
||||||
|
assert.equal(true, false, "Unexpected result")
|
||||||
|
} catch (err) {
|
||||||
|
//console.log(`err.message: ${err.message}`)
|
||||||
|
assert.include(
|
||||||
|
err.message,
|
||||||
|
`File should have the property 'name' of string type`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should throw an error if 'size' property is not included", async () => {
|
||||||
|
try {
|
||||||
|
const file = {
|
||||||
|
name: "ipfs.js"
|
||||||
|
}
|
||||||
|
|
||||||
|
await bchjs.IPFS.createFileModelWeb(file)
|
||||||
|
|
||||||
|
assert.equal(true, false, "Unexpected result")
|
||||||
|
} catch (err) {
|
||||||
|
//console.log(`err.message: ${err.message}`)
|
||||||
|
assert.include(
|
||||||
|
err.message,
|
||||||
|
`File should have the property 'size' of number type`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should create a new file model", async () => {
|
||||||
|
const file = {
|
||||||
|
name: "ipfs.js",
|
||||||
|
size: 5000,
|
||||||
|
type: "text/plain"
|
||||||
|
}
|
||||||
|
sandbox
|
||||||
|
.stub(bchjs.IPFS.axios, "post")
|
||||||
|
.resolves({ data: mockData.mockNewFileModel })
|
||||||
|
|
||||||
|
const result = await bchjs.IPFS.createFileModelWeb(file)
|
||||||
|
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
||||||
|
|
||||||
|
assert.property(result, "success")
|
||||||
|
assert.equal(result.success, true)
|
||||||
|
|
||||||
|
assert.property(result, "hostingCostBCH")
|
||||||
|
assert.property(result, "hostingCostUSD")
|
||||||
|
assert.property(result, "file")
|
||||||
|
|
||||||
|
assert.property(result.file, "payloadLink")
|
||||||
|
assert.property(result.file, "hasBeenPaid")
|
||||||
|
assert.property(result.file, "_id")
|
||||||
|
assert.property(result.file, "schemaVersion")
|
||||||
|
assert.property(result.file, "size")
|
||||||
|
assert.property(result.file, "fileName")
|
||||||
|
assert.property(result.file, "fileExtension")
|
||||||
|
assert.property(result.file, "createdTimestamp")
|
||||||
|
assert.property(result.file, "hostingCost")
|
||||||
|
assert.property(result.file, "walletIndex")
|
||||||
|
assert.property(result.file, "bchAddr")
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe("#uploadFileWeb", () => {
|
||||||
|
it("should throw an error if file is undefined", async () => {
|
||||||
|
try {
|
||||||
|
let file
|
||||||
|
|
||||||
|
await bchjs.IPFS.uploadFileWeb(file)
|
||||||
|
|
||||||
|
assert.equal(true, false, "Unexpected result")
|
||||||
|
} catch (err) {
|
||||||
|
//console.log(`err.message: ${err.message}`)
|
||||||
|
assert.include(err.message, `File is required`)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
it("should throw an error if file is empty", async () => {
|
||||||
|
try {
|
||||||
|
const file = {}
|
||||||
|
|
||||||
|
await bchjs.IPFS.uploadFileWeb(file)
|
||||||
|
|
||||||
|
assert.equal(true, false, "Unexpected result")
|
||||||
|
} catch (err) {
|
||||||
|
//console.log(`err.message: ${err.message}`)
|
||||||
|
assert.include(
|
||||||
|
err.message,
|
||||||
|
`File should have the property 'name' of string type`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
it("should throw an error if 'name' property is not included", async () => {
|
||||||
|
try {
|
||||||
|
const file = {
|
||||||
|
size: 5000,
|
||||||
|
type: "text/plain"
|
||||||
|
}
|
||||||
|
|
||||||
|
await bchjs.IPFS.uploadFileWeb(file)
|
||||||
|
|
||||||
|
assert.equal(true, false, "Unexpected result")
|
||||||
|
} catch (err) {
|
||||||
|
//console.log(`err.message: ${err.message}`)
|
||||||
|
assert.include(
|
||||||
|
err.message,
|
||||||
|
`File should have the property 'name' of string type`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
it("should throw an error if 'size' property is not included", async () => {
|
||||||
|
try {
|
||||||
|
const file = {
|
||||||
|
name: "ipfs.js",
|
||||||
|
type: "text/plain"
|
||||||
|
}
|
||||||
|
|
||||||
|
await bchjs.IPFS.uploadFileWeb(file)
|
||||||
|
|
||||||
|
assert.equal(true, false, "Unexpected result")
|
||||||
|
} catch (err) {
|
||||||
|
//console.log(`err.message: ${err.message}`)
|
||||||
|
assert.include(
|
||||||
|
err.message,
|
||||||
|
`File should have the property 'size' of number type`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
it("should throw an error if 'type' property is not included", async () => {
|
||||||
|
try {
|
||||||
|
const file = {
|
||||||
|
name: "ipfs.js",
|
||||||
|
size: 5000
|
||||||
|
}
|
||||||
|
|
||||||
|
await bchjs.IPFS.uploadFileWeb(file)
|
||||||
|
|
||||||
|
assert.equal(true, false, "Unexpected result")
|
||||||
|
} catch (err) {
|
||||||
|
//console.log(`err.message: ${err.message}`)
|
||||||
|
assert.include(
|
||||||
|
err.message,
|
||||||
|
`File should have the property 'type' of string type`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
it("should throw an error if modelId is not included", async () => {
|
||||||
|
try {
|
||||||
|
const file = {
|
||||||
|
name: "ipfs.js",
|
||||||
|
size: 5000,
|
||||||
|
type: "text/plain"
|
||||||
|
}
|
||||||
|
await bchjs.IPFS.uploadFileWeb(file)
|
||||||
|
|
||||||
|
assert.equal(true, false, "Unexpected result")
|
||||||
|
} catch (err) {
|
||||||
|
//console.log(`err.message: ${err.message}`)
|
||||||
|
assert.include(err.message, `Must include a file model ID`)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
it("Should throw error if the file was not uploaded", async () => {
|
||||||
|
try {
|
||||||
|
const mock = {
|
||||||
|
successful: [],
|
||||||
|
failed: [
|
||||||
|
{
|
||||||
|
id: "file id"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
sandbox.stub(bchjs.IPFS.uppy, "upload").resolves(mock)
|
||||||
|
|
||||||
|
const file = {
|
||||||
|
name: "ipfs.js",
|
||||||
|
size: 5000,
|
||||||
|
type: "text/plain"
|
||||||
|
}
|
||||||
|
await bchjs.IPFS.uploadFileWeb(file, "5ec562319bfacc745e8d8a52")
|
||||||
|
|
||||||
|
assert.equal(true, false, "Unexpected result")
|
||||||
|
} catch (err) {
|
||||||
|
//console.log(err)
|
||||||
|
assert.include(err.message, `The file could not be uploaded`)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should return file object if the file is uploaded", async () => {
|
||||||
|
try {
|
||||||
|
sandbox.stub(bchjs.IPFS.uppy, "upload").resolves(mockData.uploadData)
|
||||||
|
|
||||||
|
const file = {
|
||||||
|
name: "ipfs.js",
|
||||||
|
size: 5000,
|
||||||
|
type: "text/plain"
|
||||||
|
}
|
||||||
|
const result = await bchjs.IPFS.uploadFileWeb(
|
||||||
|
file,
|
||||||
|
"5ec562319bfacc745e8d8a52"
|
||||||
|
)
|
||||||
|
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
||||||
|
|
||||||
|
assert.property(result, "schemaVersion")
|
||||||
|
assert.property(result, "size")
|
||||||
|
assert.property(result, "fileId")
|
||||||
|
assert.property(result, "fileName")
|
||||||
|
assert.property(result, "fileExtension")
|
||||||
|
} catch (err) {
|
||||||
|
//console.log(err)
|
||||||
|
assert.equal(true, false, "Unexpected result")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
+28
-2
@@ -22,13 +22,16 @@ describe(`#Ninsight`, () => {
|
|||||||
assert.equal(true, false, "Unexpected result!")
|
assert.equal(true, false, "Unexpected result!")
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
//console.log(`err: `, err)
|
//console.log(`err: `, err)
|
||||||
assert.include(err.message, `address needs to be a string`)
|
assert.include(
|
||||||
|
err.message,
|
||||||
|
`Input address must be a string or array of strings.`
|
||||||
|
)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
it(`should GET utxos for a single address`, async () => {
|
it(`should GET utxos for a single address`, async () => {
|
||||||
// Stub the network call.
|
// Stub the network call.
|
||||||
sandbox.stub(axios, "get").resolves({ data: mockData.utxo })
|
sandbox.stub(axios, "post").resolves({ data: mockData.utxo })
|
||||||
|
|
||||||
const addr = "bitcoincash:qqh793x9au6ehvh7r2zflzguanlme760wuzehgzjh9"
|
const addr = "bitcoincash:qqh793x9au6ehvh7r2zflzguanlme760wuzehgzjh9"
|
||||||
|
|
||||||
@@ -51,5 +54,28 @@ describe(`#Ninsight`, () => {
|
|||||||
assert.property(result.utxos[0], "height")
|
assert.property(result.utxos[0], "height")
|
||||||
assert.property(result.utxos[0], "confirmations")
|
assert.property(result.utxos[0], "confirmations")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it(`should POST utxo details for an array of addresses`, async () => {
|
||||||
|
// Mock the network call.
|
||||||
|
sandbox.stub(axios, "post").resolves({ data: mockData.utxoPost })
|
||||||
|
|
||||||
|
const addr = [
|
||||||
|
"bitcoincash:qp3sn6vlwz28ntmf3wmyra7jqttfx7z6zgtkygjhc7",
|
||||||
|
"bitcoincash:qz0us0z6ucpqt07jgpad0shgh7xmwxyr3ynlcsq0wr"
|
||||||
|
]
|
||||||
|
|
||||||
|
const result = await bchjs.Ninsight.utxo(addr)
|
||||||
|
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
||||||
|
|
||||||
|
assert.isArray(result)
|
||||||
|
assert.isArray(result[0].utxos)
|
||||||
|
|
||||||
|
assert.property(result[0], "utxos")
|
||||||
|
assert.property(result[0], "legacyAddress")
|
||||||
|
assert.property(result[0], "cashAddress")
|
||||||
|
assert.property(result[0], "slpAddress")
|
||||||
|
assert.property(result[0], "scriptPubKey")
|
||||||
|
assert.property(result[0], "asm")
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -231,22 +231,6 @@ describe("#SLP Utils", () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("#balance", () => {
|
|
||||||
it(`should fetch balance of single token for address: simpleledger:qzv3zz2trz0xgp6a96lu4m6vp2nkwag0kvyucjzqt9`, async () => {
|
|
||||||
// Mock the call to the REST API
|
|
||||||
if (process.env.TEST === "unit")
|
|
||||||
sandbox.stub(axios, "get").resolves({ data: mockData.mockBalance })
|
|
||||||
|
|
||||||
const balance = await slp.Utils.balance(
|
|
||||||
"simpleledger:qzv3zz2trz0xgp6a96lu4m6vp2nkwag0kvyucjzqt9",
|
|
||||||
"df808a41672a0a0ae6475b44f272a107bc9961b90f29dc918d71301f24fe92fb"
|
|
||||||
)
|
|
||||||
//console.log(`balance: ${JSON.stringify(balance, null, 2)}`)
|
|
||||||
|
|
||||||
assert2.hasAllKeys(balance, ["tokenId", "balance", "balanceString"])
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#validateTxid", () => {
|
describe("#validateTxid", () => {
|
||||||
it(`should validate slp txid`, async () => {
|
it(`should validate slp txid`, async () => {
|
||||||
// Mock the call to the REST API
|
// Mock the call to the REST API
|
||||||
|
|||||||
Reference in New Issue
Block a user