From 37b2e426a55ddc2c025f7e983657acebd116a0fc Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Sat, 1 Oct 2022 23:45:49 -0700 Subject: [PATCH] fix(order): Retry-Queue used to wrap workflow --- package-lock.json | 641 ++++++++++----------- package.json | 3 +- src/adapters/p2wdb-adapter.js | 4 + src/adapters/wallet.js | 3 + src/entities/offer.js | 10 +- src/use-cases/order.js | 22 +- test/unit/mocks/adapters/wallet.js | 1 + test/unit/use-cases/order.use-case.unit.js | 6 +- 8 files changed, 343 insertions(+), 347 deletions(-) diff --git a/package-lock.json b/package-lock.json index e4c24c4..626b1ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "MIT", "dependencies": { "@chris.troutner/retry-queue": "1.0.5", + "@psf/bch-js": "^6.4.5", "axios": "0.27.2", "bch-message-lib": "2.2.1", "bcryptjs": "2.4.3", @@ -33,7 +34,7 @@ "koa2-ratelimit": "0.9.1", "libp2p": "^0.36.2", "line-reader": "0.4.0", - "minimal-slp-wallet": "5.1.0", + "minimal-slp-wallet": "../minimal-slp-wallet/", "mongoose": "5.13.14", "node-fetch": "npm:@achingbrain/node-fetch@2.6.7", "nodemailer": "6.7.5", @@ -57,6 +58,36 @@ "uuid": "8.3.2" } }, + "../minimal-slp-wallet": { + "version": "5.0.0", + "license": "MIT", + "dependencies": { + "@psf/bch-js": "6.4.5", + "apidoc": "0.51.0", + "bch-consumer": "1.3.1", + "bch-donation": "1.1.2", + "crypto-js": "4.0.0" + }, + "devDependencies": { + "browserify": "17.0.0", + "chai": "4.2.0", + "coveralls": "3.1.0", + "eslint": "7.17.0", + "eslint-config-prettier": "7.1.0", + "eslint-config-standard": "16.0.2", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-prettier": "3.3.1", + "eslint-plugin-standard": "4.0.1", + "husky": "4.3.8", + "lodash.clonedeep": "4.5.0", + "mocha": "9.2.1", + "nyc": "15.1.0", + "semantic-release": "19.0.3", + "sinon": "9.2.0", + "standard": "16.0.4", + "tinyify": "3.0.0" + } + }, "node_modules/@babel/code-frame": { "version": "7.18.6", "dev": true, @@ -161,7 +192,8 @@ }, "node_modules/@chris.troutner/bip32-utils": { "version": "1.0.5", - "license": "MIT", + "resolved": "https://registry.npmjs.org/@chris.troutner/bip32-utils/-/bip32-utils-1.0.5.tgz", + "integrity": "sha512-pa9dh5VpPmfol1bdLy+FyqONmxlf/QH6Q01a57OP6C9gTVOZM1Rt0kCLXxXKC6e2AnNIrXpYN1UtlyBm+r6P0g==", "dependencies": { "keccak": "^3.0.1", "tape": "*" @@ -1045,7 +1077,8 @@ }, "node_modules/@psf/bch-js": { "version": "6.4.5", - "license": "MIT", + "resolved": "https://registry.npmjs.org/@psf/bch-js/-/bch-js-6.4.5.tgz", + "integrity": "sha512-sH72zbJJI5oe9EUMczFQb0jCaNQb8rc3/86E6xXKl3325HCwBqE80BX7JFvZ97Qv1gGxwp/3WROp59v6Dz2NKA==", "dependencies": { "@chris.troutner/bip32-utils": "1.0.5", "@psf/bip21": "2.0.1", @@ -1075,25 +1108,29 @@ }, "node_modules/@psf/bch-js/node_modules/axios": { "version": "0.26.1", - "license": "MIT", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", "dependencies": { "follow-redirects": "^1.14.8" } }, "node_modules/@psf/bip21": { "version": "2.0.1", - "license": "ISC", + "resolved": "https://registry.npmjs.org/@psf/bip21/-/bip21-2.0.1.tgz", + "integrity": "sha512-U9c8xBV31n+D7qxOPBO0vQ015DNvKskWCUbVgoMfH5AUNHLYrSDWIrCx4P7v9etfdu6LpPdsYr53KDSAIk0b7Q==", "dependencies": { "qs": "^6.3.0" } }, "node_modules/@psf/bitcoincash-ops": { "version": "2.0.0", - "license": "MIT" + "resolved": "https://registry.npmjs.org/@psf/bitcoincash-ops/-/bitcoincash-ops-2.0.0.tgz", + "integrity": "sha512-M3PWqRpeJq6rli2NqWGbas76z9TrdGOmNuDFACBWBMctPucEAsFQY2AmyFHRSa7hEwythwvrPh9AG/n6ehmEog==" }, "node_modules/@psf/bitcoincashjs-lib": { "version": "4.0.2", - "license": "MIT", + "resolved": "https://registry.npmjs.org/@psf/bitcoincashjs-lib/-/bitcoincashjs-lib-4.0.2.tgz", + "integrity": "sha512-fTy9mW4H0NkQ+dojGtf+nPduA27F3V2YpBi5licYUVjdVRD/xpUCTgEN1cYRAupOaeDH/AYOWT0MWLkbQSTxAQ==", "dependencies": { "@psf/bitcoincash-ops": "^2.0.0", "@psf/pushdata-bitcoin": "^1.2.2", @@ -1117,14 +1154,16 @@ }, "node_modules/@psf/coininfo": { "version": "4.0.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/@psf/coininfo/-/coininfo-4.0.0.tgz", + "integrity": "sha512-RwBc09790kbaOt8uZJMyvLqf1UziTd20FXu78bM8bMlkClnZQTJyNDdLCsFSBkJQYAJtGMkjdQ/o3/UaSC7c2Q==", "dependencies": { "safe-buffer": "^5.1.1" } }, "node_modules/@psf/pushdata-bitcoin": { "version": "1.2.2", - "license": "MIT", + "resolved": "https://registry.npmjs.org/@psf/pushdata-bitcoin/-/pushdata-bitcoin-1.2.2.tgz", + "integrity": "sha512-e1qkZLJFU6Ldg7TMBgSkiR5U1NfpRgSIr2ppk8BeED/Q9wUc9DEVAjXfPMD65xgXdqnlyFEtLbpPMWwyydMVUQ==", "dependencies": { "@psf/bitcoincash-ops": "^2.0.0" } @@ -1878,7 +1917,8 @@ }, "node_modules/array.prototype.every": { "version": "1.1.3", - "license": "MIT", + "resolved": "https://registry.npmjs.org/array.prototype.every/-/array.prototype.every-1.1.3.tgz", + "integrity": "sha512-vWnriJI//SOMOWtXbU/VXhJ/InfnNHPF6BLKn5WfY8xXy+NWql0fUy20GO3sdqBhCAO+qw8S/E5nJiZX+QFdCA==", "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", @@ -1977,7 +2017,8 @@ }, "node_modules/available-typed-arrays": { "version": "1.0.5", - "license": "MIT", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", "engines": { "node": ">= 0.4" }, @@ -2036,88 +2077,15 @@ }, "node_modules/bc-bip68": { "version": "1.0.5", - "license": "ISC", + "resolved": "https://registry.npmjs.org/bc-bip68/-/bc-bip68-1.0.5.tgz", + "integrity": "sha512-GzaMlN7pNthrY5BhReVhnfr4Ixx+GUSfyNRHYh0QiMUF0d0+0YaD8MpEdv6AjFBksg/zlqL1fVCBBm6PpTt2Rg==", "engines": { "node": ">=4.5.0" } }, - "node_modules/bch-consumer": { - "version": "1.3.1", - "license": "MIT", - "dependencies": { - "@psf/bch-js": "6.4.5", - "apidoc": "0.51.0", - "axios": "0.25.0" - } - }, - "node_modules/bch-consumer/node_modules/apidoc": { - "version": "0.51.0", - "license": "MIT", - "os": [ - "darwin", - "freebsd", - "linux", - "openbsd", - "win32" - ], - "dependencies": { - "bootstrap": "3.4.1", - "commander": "^8.3.0", - "diff-match-patch": "^1.0.5", - "esbuild-loader": "^2.16.0", - "expose-loader": "^3.1.0", - "fs-extra": "^10.0.0", - "glob": "^7.2.0", - "handlebars": "^4.7.7", - "iconv-lite": "^0.6.3", - "jquery": "^3.6.0", - "klaw-sync": "^6.0.0", - "lodash": "^4.17.21", - "markdown-it": "^12.2.0", - "nodemon": "^2.0.15", - "path-to-regexp": "^6.2.0", - "prismjs": "^1.25.0", - "semver": "^7.3.5", - "style-loader": "^3.3.1", - "url-parse": "^1.5.3", - "webpack": "^5.64.2", - "webpack-cli": "^4.9.1", - "winston": "^3.3.3" - }, - "bin": { - "apidoc": "bin/apidoc" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/bch-consumer/node_modules/axios": { - "version": "0.25.0", - "license": "MIT", - "dependencies": { - "follow-redirects": "^1.14.7" - } - }, - "node_modules/bch-consumer/node_modules/glob": { - "version": "7.2.3", - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/bch-donation": { "version": "1.1.2", + "dev": true, "license": "MIT", "dependencies": { "apidoc": "0.51.0" @@ -2125,6 +2093,7 @@ }, "node_modules/bch-donation/node_modules/apidoc": { "version": "0.51.0", + "dev": true, "license": "MIT", "os": [ "darwin", @@ -2166,6 +2135,7 @@ }, "node_modules/bch-donation/node_modules/glob": { "version": "7.2.3", + "dev": true, "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", @@ -2211,7 +2181,8 @@ }, "node_modules/bchaddrjs-slp": { "version": "0.2.5", - "license": "MIT", + "resolved": "https://registry.npmjs.org/bchaddrjs-slp/-/bchaddrjs-slp-0.2.5.tgz", + "integrity": "sha512-33flmPcqMFswerKu7477DSUNMVMQR3tHDk3lvbmsdkEva+TxVGGWWE/p5Lqx9M/8t3vkbe7fzmVhj4QhChcCyA==", "dependencies": { "bs58check": "^2.1.2", "cashaddrjs-slp": "^0.2.11" @@ -2242,7 +2213,8 @@ }, "node_modules/big-integer": { "version": "1.6.51", - "license": "Unlicense", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", + "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==", "engines": { "node": ">=0.6" } @@ -2280,7 +2252,8 @@ }, "node_modules/bip-schnorr": { "version": "0.3.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/bip-schnorr/-/bip-schnorr-0.3.0.tgz", + "integrity": "sha512-Sc1Hn2+1n+okPEW8G+JLjeaM12dsUOwr+oFlMDSKR9wYwNGMw0alskeBIHTmXxBxMZSWKhCW7PwKQVDyGmnaVg==", "dependencies": { "ecurve": "^1.0.6", "js-sha256": "^0.9.0", @@ -2293,6 +2266,8 @@ }, "node_modules/bip38": { "version": "2.0.2", + "resolved": "https://registry.npmjs.org/bip38/-/bip38-2.0.2.tgz", + "integrity": "sha512-22KDak0RDyghFbR0Si7wyq9IgY423YzGYzWLpGeofH3DaolOQqjD3mNN08eFoubKlbyclOQKFwtONMv2SD9V3A==", "dependencies": { "bigi": "^1.2.0", "browserify-aes": "^1.0.1", @@ -2305,7 +2280,8 @@ }, "node_modules/bip39": { "version": "3.0.2", - "license": "ISC", + "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.0.2.tgz", + "integrity": "sha512-J4E1r2N0tUylTKt07ibXvhpT2c5pyAFgvuA5q1H9uDy6dEGpjV8jmymh3MTYJDLCNbIVClSB9FbND49I6N24MQ==", "dependencies": { "@types/node": "11.11.6", "create-hash": "^1.1.0", @@ -2350,7 +2326,8 @@ }, "node_modules/bitcoinjs-message": { "version": "2.0.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/bitcoinjs-message/-/bitcoinjs-message-2.0.0.tgz", + "integrity": "sha512-H5pJC7/eSqVjREiEOZ4jifX+7zXYP3Y28GIOIqg9hrgE7Vj8Eva9+HnVqnxwA1rJPOwZKuw0vo6k0UxgVc6q1A==", "dependencies": { "bs58check": "^2.0.2", "buffer-equals": "^1.0.3", @@ -2569,7 +2546,8 @@ }, "node_modules/buffer-equals": { "version": "1.0.4", - "license": "MIT", + "resolved": "https://registry.npmjs.org/buffer-equals/-/buffer-equals-1.0.4.tgz", + "integrity": "sha512-99MsCq0j5+RhubVEtKQgKaD6EM+UP3xJgIvQqwJ3SOLDUekzxMX1ylXBng+Wa2sh7mGT0W6RUly8ojjr1Tt6nA==", "engines": { "node": ">=0.10.0" } @@ -2824,7 +2802,8 @@ }, "node_modules/cashaddrjs-slp": { "version": "0.2.12", - "license": "MIT", + "resolved": "https://registry.npmjs.org/cashaddrjs-slp/-/cashaddrjs-slp-0.2.12.tgz", + "integrity": "sha512-n2TTIuW6vZZxYvjvsUAA+wOM0Zkj+3RRKUtDC1XSu4Ic4XVr0yFJkl1bzQkHWda7nkVT51sxjZneygz7D0SyrQ==", "dependencies": { "big-integer": "^1.6.34" } @@ -3402,10 +3381,6 @@ "node": ">=0.8.0" } }, - "node_modules/crypto-js": { - "version": "4.0.0", - "license": "MIT" - }, "node_modules/crypto-random-string": { "version": "2.0.0", "license": "MIT", @@ -3569,7 +3544,8 @@ }, "node_modules/defined": { "version": "1.0.0", - "license": "MIT" + "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", + "integrity": "sha512-Y2caI5+ZwS5c3RiNDJ6u53VhQHv+hHKwhkI1iHvceKUHw9Df6EK2zRLfjejRgMuCuxK7PfSWIMwWecceVvThjQ==" }, "node_modules/del": { "version": "6.1.1", @@ -3705,7 +3681,8 @@ }, "node_modules/dotignore": { "version": "0.1.2", - "license": "MIT", + "resolved": "https://registry.npmjs.org/dotignore/-/dotignore-0.1.2.tgz", + "integrity": "sha512-UGGGWfSauusaVJC+8fgV+NVvBXkCTmVv7sk6nojDZZvuOUNGUy0Zk4UpHQD6EDjS0jpBwcACvH4eofvyzBcRDw==", "dependencies": { "minimatch": "^3.0.4" }, @@ -3765,14 +3742,16 @@ }, "node_modules/ecashaddrjs": { "version": "1.0.7", - "license": "MIT", + "resolved": "https://registry.npmjs.org/ecashaddrjs/-/ecashaddrjs-1.0.7.tgz", + "integrity": "sha512-KsvHYLlYtLr/GBkEPiwwQDIDBzqRx61qC34n1puHKOjVE4Uwg3syHccjFCqNynLa6T6xI0Rd7ByCRUJcuJcoIw==", "dependencies": { "big-integer": "1.6.36" } }, "node_modules/ecashaddrjs/node_modules/big-integer": { "version": "1.6.36", - "license": "Unlicense", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.36.tgz", + "integrity": "sha512-t70bfa7HYEA1D9idDbmuv7YbsbVkQ+Hp+8KFSul4aE5e/i1bjCNIRYJZlA8Q8p0r9T8cF/RVvwUgRA//FydEyg==", "engines": { "node": ">=0.6" } @@ -4006,7 +3985,8 @@ }, "node_modules/es-get-iterator": { "version": "1.1.2", - "license": "MIT", + "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.2.tgz", + "integrity": "sha512-+DTO8GYwbMCwbywjimwZMHp8AuYXOS2JZFWoi2AlPOS3ebnII9w/NLpNZtA7A0YLaVDw+O7KFCeoIV7OPvM7hQ==", "dependencies": { "call-bind": "^1.0.2", "get-intrinsic": "^1.1.0", @@ -4023,7 +4003,8 @@ }, "node_modules/es-get-iterator/node_modules/isarray": { "version": "2.0.5", - "license": "MIT" + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" }, "node_modules/es-module-lexer": { "version": "0.9.3", @@ -4863,7 +4844,8 @@ }, "node_modules/for-each": { "version": "0.3.3", - "license": "MIT", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", "dependencies": { "is-callable": "^1.1.3" } @@ -5056,7 +5038,8 @@ }, "node_modules/get-package-type": { "version": "0.1.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", "engines": { "node": ">=8.0.0" } @@ -5335,7 +5318,8 @@ }, "node_modules/has-dynamic-import": { "version": "2.0.1", - "license": "MIT", + "resolved": "https://registry.npmjs.org/has-dynamic-import/-/has-dynamic-import-2.0.1.tgz", + "integrity": "sha512-X3fbtsZmwb6W7fJGR9o7x65fZoodygCrZ3TVycvghP62yYQfS0t4RS0Qcz+j5tQYUKeSWS09tHkWW6WhFV3XhQ==", "dependencies": { "call-bind": "^1.0.2", "get-intrinsic": "^1.1.1" @@ -6180,7 +6164,8 @@ }, "node_modules/is-arguments": { "version": "1.1.1", - "license": "MIT", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", "dependencies": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" @@ -6352,7 +6337,8 @@ }, "node_modules/is-map": { "version": "2.0.2", - "license": "MIT", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz", + "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -6461,7 +6447,8 @@ }, "node_modules/is-set": { "version": "2.0.2", - "license": "MIT", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz", + "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -6525,7 +6512,8 @@ }, "node_modules/is-typed-array": { "version": "1.1.9", - "license": "MIT", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.9.tgz", + "integrity": "sha512-kfrlnTTn8pZkfpJMUgYD7YZ3qzeJgWUn8XfVYBARc4wnmNOmLbmuuaAs3q5fvB0UJOn6yHAKaGTPM7d6ezoD/A==", "dependencies": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", @@ -6557,7 +6545,8 @@ }, "node_modules/is-weakmap": { "version": "2.0.1", - "license": "MIT", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", + "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -6574,7 +6563,8 @@ }, "node_modules/is-weakset": { "version": "2.0.2", - "license": "MIT", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz", + "integrity": "sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==", "dependencies": { "call-bind": "^1.0.2", "get-intrinsic": "^1.1.1" @@ -6837,7 +6827,8 @@ }, "node_modules/js-sha256": { "version": "0.9.0", - "license": "MIT" + "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", + "integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==" }, "node_modules/js-sha3": { "version": "0.8.0", @@ -7052,8 +7043,9 @@ }, "node_modules/keccak": { "version": "3.0.2", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.2.tgz", + "integrity": "sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ==", "hasInstallScript": true, - "license": "MIT", "dependencies": { "node-addon-api": "^2.0.0", "node-gyp-build": "^4.2.0", @@ -7976,74 +7968,8 @@ } }, "node_modules/minimal-slp-wallet": { - "version": "5.1.0", - "license": "MIT", - "dependencies": { - "@psf/bch-js": "6.4.5", - "apidoc": "0.51.0", - "bch-consumer": "1.3.1", - "bch-donation": "1.1.2", - "crypto-js": "4.0.0" - } - }, - "node_modules/minimal-slp-wallet/node_modules/apidoc": { - "version": "0.51.0", - "license": "MIT", - "os": [ - "darwin", - "freebsd", - "linux", - "openbsd", - "win32" - ], - "dependencies": { - "bootstrap": "3.4.1", - "commander": "^8.3.0", - "diff-match-patch": "^1.0.5", - "esbuild-loader": "^2.16.0", - "expose-loader": "^3.1.0", - "fs-extra": "^10.0.0", - "glob": "^7.2.0", - "handlebars": "^4.7.7", - "iconv-lite": "^0.6.3", - "jquery": "^3.6.0", - "klaw-sync": "^6.0.0", - "lodash": "^4.17.21", - "markdown-it": "^12.2.0", - "nodemon": "^2.0.15", - "path-to-regexp": "^6.2.0", - "prismjs": "^1.25.0", - "semver": "^7.3.5", - "style-loader": "^3.3.1", - "url-parse": "^1.5.3", - "webpack": "^5.64.2", - "webpack-cli": "^4.9.1", - "winston": "^3.3.3" - }, - "bin": { - "apidoc": "bin/apidoc" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/minimal-slp-wallet/node_modules/glob": { - "version": "7.2.3", - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } + "resolved": "../minimal-slp-wallet", + "link": true }, "node_modules/minimalistic-assert": { "version": "1.0.1", @@ -8744,7 +8670,8 @@ }, "node_modules/node-addon-api": { "version": "2.0.2", - "license": "MIT" + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" }, "node_modules/node-emoji": { "version": "1.11.0", @@ -8770,8 +8697,9 @@ } }, "node_modules/node-gyp-build": { - "version": "4.4.0", - "license": "MIT", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", + "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", "bin": { "node-gyp-build": "bin.js", "node-gyp-build-optional": "optional.js", @@ -11365,7 +11293,8 @@ }, "node_modules/object-is": { "version": "1.1.5", - "license": "MIT", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", + "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.3" @@ -12284,6 +12213,7 @@ }, "node_modules/querystringify": { "version": "2.2.0", + "dev": true, "license": "MIT" }, "node_modules/queue-microtask": { @@ -12771,6 +12701,7 @@ }, "node_modules/requires-port": { "version": "1.0.0", + "dev": true, "license": "MIT" }, "node_modules/resolve": { @@ -12861,7 +12792,8 @@ }, "node_modules/resumer": { "version": "0.0.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/resumer/-/resumer-0.0.0.tgz", + "integrity": "sha512-Fn9X8rX8yYF4m81rZCK/5VmrmsSbqS/i3rDLl6ZZHAXgC2nTAx3dhwG8q8odP/RmdLa2YrybDJaAMg+X1ajY3w==", "dependencies": { "through": "~2.3.4" } @@ -12972,14 +12904,16 @@ }, "node_modules/satoshi-bitcoin": { "version": "1.0.4", - "license": "MIT", + "resolved": "https://registry.npmjs.org/satoshi-bitcoin/-/satoshi-bitcoin-1.0.4.tgz", + "integrity": "sha512-YuHOmw5wsz6wuHIQdsz5b2cgtuKtV/jEcZ4NGmWN5tM/gz5T9Q+DSuLlnuf5BP/jsQWgR0ofmY4f8Dm6JnqSug==", "dependencies": { "big.js": "^3.1.3" } }, "node_modules/satoshi-bitcoin/node_modules/big.js": { "version": "3.2.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", + "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==", "engines": { "node": "*" } @@ -13006,7 +12940,8 @@ }, "node_modules/scryptsy": { "version": "2.1.0", - "license": "MIT" + "resolved": "https://registry.npmjs.org/scryptsy/-/scryptsy-2.1.0.tgz", + "integrity": "sha512-1CdSqHQowJBnMAFyPEBRfqag/YP9OF394FV+4YREIJX4ljD7OxvQRDayyoyyCk+senRjSkP6VnUNQmVQqB6g7w==" }, "node_modules/secp256k1": { "version": "3.8.0", @@ -13398,14 +13333,16 @@ }, "node_modules/slp-mdm": { "version": "0.0.6", - "license": "MIT", + "resolved": "https://registry.npmjs.org/slp-mdm/-/slp-mdm-0.0.6.tgz", + "integrity": "sha512-fbjlIg/o8OtzgK2JydC6POJp3Qup/rLgy4yB5hoLgxWRlERyJyE29ScwS3r9TTwPxe12qK55pyivAdNOZZXL0A==", "dependencies": { "bignumber.js": "^9.0.0" } }, "node_modules/slp-parser": { "version": "0.0.4", - "license": "MIT", + "resolved": "https://registry.npmjs.org/slp-parser/-/slp-parser-0.0.4.tgz", + "integrity": "sha512-AvbslJumkzGfMGWNvuE2pWx2nyHEk/VgQ7l119kDKIFRTuRUWOkyOULLauw5laGRQsBRThg6NCx/TsR3grX6GA==", "dependencies": { "bignumber.js": "^9.0.0" } @@ -14184,7 +14121,8 @@ }, "node_modules/string.prototype.trim": { "version": "1.2.6", - "license": "MIT", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.6.tgz", + "integrity": "sha512-8lMR2m+U0VJTPp6JjvJTtGyc4FIGq9CdRt7O9p6T0e6K4vjU+OP+SQJpbe/SBmRcCUIvNUnjsbmY6lnMp8MhsQ==", "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.4", @@ -14374,8 +14312,9 @@ } }, "node_modules/tape": { - "version": "5.5.3", - "license": "MIT", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/tape/-/tape-5.6.1.tgz", + "integrity": "sha512-reNzS3rzsJtKk0f+zJx2XlzIsjJXlIcOIrIxk5shHAG/DzW3BKyMg8UfN79oluYlcWo4lIt56ahLqwgpRT4idg==", "dependencies": { "array.prototype.every": "^1.1.3", "call-bind": "^1.0.2", @@ -14384,28 +14323,32 @@ "dotignore": "^0.1.2", "for-each": "^0.3.3", "get-package-type": "^0.1.0", - "glob": "^7.2.0", + "glob": "^7.2.3", "has": "^1.0.3", "has-dynamic-import": "^2.0.1", "inherits": "^2.0.4", "is-regex": "^1.1.4", "minimist": "^1.2.6", - "object-inspect": "^1.12.0", + "object-inspect": "^1.12.2", "object-is": "^1.1.5", "object-keys": "^1.1.1", - "object.assign": "^4.1.2", + "object.assign": "^4.1.4", "resolve": "^2.0.0-next.3", "resumer": "^0.0.0", - "string.prototype.trim": "^1.2.5", + "string.prototype.trim": "^1.2.6", "through": "^2.3.8" }, "bin": { "tape": "bin/tape" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/tape/node_modules/deep-equal": { "version": "2.0.5", - "license": "MIT", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.0.5.tgz", + "integrity": "sha512-nPiRgmbAtm1a3JsnLCf6/SLfXcjyN5v8L1TXzdCmHrXJ4hx+gW/w1YCcn7z8gJtSiDArZCgYtbao3QqLm/N1Sw==", "dependencies": { "call-bind": "^1.0.0", "es-get-iterator": "^1.1.1", @@ -14429,7 +14372,8 @@ }, "node_modules/tape/node_modules/glob": { "version": "7.2.3", - "license": "ISC", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -14447,11 +14391,13 @@ }, "node_modules/tape/node_modules/isarray": { "version": "2.0.5", - "license": "MIT" + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" }, "node_modules/tape/node_modules/resolve": { "version": "2.0.0-next.4", - "license": "MIT", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.4.tgz", + "integrity": "sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ==", "dependencies": { "is-core-module": "^2.9.0", "path-parse": "^1.0.7", @@ -15022,6 +14968,7 @@ }, "node_modules/url-parse": { "version": "1.5.10", + "dev": true, "license": "MIT", "dependencies": { "querystringify": "^2.1.1", @@ -15324,7 +15271,8 @@ }, "node_modules/which-collection": { "version": "1.0.1", - "license": "MIT", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz", + "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==", "dependencies": { "is-map": "^2.0.1", "is-set": "^2.0.1", @@ -15345,7 +15293,8 @@ }, "node_modules/which-typed-array": { "version": "1.1.8", - "license": "MIT", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.8.tgz", + "integrity": "sha512-Jn4e5PItbcAHyLoRDwvPj1ypu27DJbtdYXUa5zsinrUx77Uvfb0cXwwnGMTn7cjUfhhqgVQnVJCwF+7cgU7tpw==", "dependencies": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", @@ -15679,6 +15628,8 @@ }, "@chris.troutner/bip32-utils": { "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@chris.troutner/bip32-utils/-/bip32-utils-1.0.5.tgz", + "integrity": "sha512-pa9dh5VpPmfol1bdLy+FyqONmxlf/QH6Q01a57OP6C9gTVOZM1Rt0kCLXxXKC6e2AnNIrXpYN1UtlyBm+r6P0g==", "requires": { "keccak": "^3.0.1", "tape": "*" @@ -16309,6 +16260,8 @@ }, "@psf/bch-js": { "version": "6.4.5", + "resolved": "https://registry.npmjs.org/@psf/bch-js/-/bch-js-6.4.5.tgz", + "integrity": "sha512-sH72zbJJI5oe9EUMczFQb0jCaNQb8rc3/86E6xXKl3325HCwBqE80BX7JFvZ97Qv1gGxwp/3WROp59v6Dz2NKA==", "requires": { "@chris.troutner/bip32-utils": "1.0.5", "@psf/bip21": "2.0.1", @@ -16338,6 +16291,8 @@ "dependencies": { "axios": { "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", "requires": { "follow-redirects": "^1.14.8" } @@ -16346,15 +16301,21 @@ }, "@psf/bip21": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@psf/bip21/-/bip21-2.0.1.tgz", + "integrity": "sha512-U9c8xBV31n+D7qxOPBO0vQ015DNvKskWCUbVgoMfH5AUNHLYrSDWIrCx4P7v9etfdu6LpPdsYr53KDSAIk0b7Q==", "requires": { "qs": "^6.3.0" } }, "@psf/bitcoincash-ops": { - "version": "2.0.0" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@psf/bitcoincash-ops/-/bitcoincash-ops-2.0.0.tgz", + "integrity": "sha512-M3PWqRpeJq6rli2NqWGbas76z9TrdGOmNuDFACBWBMctPucEAsFQY2AmyFHRSa7hEwythwvrPh9AG/n6ehmEog==" }, "@psf/bitcoincashjs-lib": { "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@psf/bitcoincashjs-lib/-/bitcoincashjs-lib-4.0.2.tgz", + "integrity": "sha512-fTy9mW4H0NkQ+dojGtf+nPduA27F3V2YpBi5licYUVjdVRD/xpUCTgEN1cYRAupOaeDH/AYOWT0MWLkbQSTxAQ==", "requires": { "@psf/bitcoincash-ops": "^2.0.0", "@psf/pushdata-bitcoin": "^1.2.2", @@ -16375,12 +16336,16 @@ }, "@psf/coininfo": { "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@psf/coininfo/-/coininfo-4.0.0.tgz", + "integrity": "sha512-RwBc09790kbaOt8uZJMyvLqf1UziTd20FXu78bM8bMlkClnZQTJyNDdLCsFSBkJQYAJtGMkjdQ/o3/UaSC7c2Q==", "requires": { "safe-buffer": "^5.1.1" } }, "@psf/pushdata-bitcoin": { "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@psf/pushdata-bitcoin/-/pushdata-bitcoin-1.2.2.tgz", + "integrity": "sha512-e1qkZLJFU6Ldg7TMBgSkiR5U1NfpRgSIr2ppk8BeED/Q9wUc9DEVAjXfPMD65xgXdqnlyFEtLbpPMWwyydMVUQ==", "requires": { "@psf/bitcoincash-ops": "^2.0.0" } @@ -16913,6 +16878,8 @@ }, "array.prototype.every": { "version": "1.1.3", + "resolved": "https://registry.npmjs.org/array.prototype.every/-/array.prototype.every-1.1.3.tgz", + "integrity": "sha512-vWnriJI//SOMOWtXbU/VXhJ/InfnNHPF6BLKn5WfY8xXy+NWql0fUy20GO3sdqBhCAO+qw8S/E5nJiZX+QFdCA==", "requires": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", @@ -16970,7 +16937,9 @@ "version": "0.4.0" }, "available-typed-arrays": { - "version": "1.0.5" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", + "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==" }, "aws-sign2": { "version": "0.5.0", @@ -17000,70 +16969,20 @@ "version": "1.5.1" }, "bc-bip68": { - "version": "1.0.5" - }, - "bch-consumer": { - "version": "1.3.1", - "requires": { - "@psf/bch-js": "6.4.5", - "apidoc": "0.51.0", - "axios": "0.25.0" - }, - "dependencies": { - "apidoc": { - "version": "0.51.0", - "requires": { - "bootstrap": "3.4.1", - "commander": "^8.3.0", - "diff-match-patch": "^1.0.5", - "esbuild-loader": "^2.16.0", - "expose-loader": "^3.1.0", - "fs-extra": "^10.0.0", - "glob": "^7.2.0", - "handlebars": "^4.7.7", - "iconv-lite": "^0.6.3", - "jquery": "^3.6.0", - "klaw-sync": "^6.0.0", - "lodash": "^4.17.21", - "markdown-it": "^12.2.0", - "nodemon": "^2.0.15", - "path-to-regexp": "^6.2.0", - "prismjs": "^1.25.0", - "semver": "^7.3.5", - "style-loader": "^3.3.1", - "url-parse": "^1.5.3", - "webpack": "^5.64.2", - "webpack-cli": "^4.9.1", - "winston": "^3.3.3" - } - }, - "axios": { - "version": "0.25.0", - "requires": { - "follow-redirects": "^1.14.7" - } - }, - "glob": { - "version": "7.2.3", - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - } - } + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/bc-bip68/-/bc-bip68-1.0.5.tgz", + "integrity": "sha512-GzaMlN7pNthrY5BhReVhnfr4Ixx+GUSfyNRHYh0QiMUF0d0+0YaD8MpEdv6AjFBksg/zlqL1fVCBBm6PpTt2Rg==" }, "bch-donation": { "version": "1.1.2", + "dev": true, "requires": { "apidoc": "0.51.0" }, "dependencies": { "apidoc": { "version": "0.51.0", + "dev": true, "requires": { "bootstrap": "3.4.1", "commander": "^8.3.0", @@ -17091,6 +17010,7 @@ }, "glob": { "version": "7.2.3", + "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -17123,6 +17043,8 @@ }, "bchaddrjs-slp": { "version": "0.2.5", + "resolved": "https://registry.npmjs.org/bchaddrjs-slp/-/bchaddrjs-slp-0.2.5.tgz", + "integrity": "sha512-33flmPcqMFswerKu7477DSUNMVMQR3tHDk3lvbmsdkEva+TxVGGWWE/p5Lqx9M/8t3vkbe7fzmVhj4QhChcCyA==", "requires": { "bs58check": "^2.1.2", "cashaddrjs-slp": "^0.2.11" @@ -17145,7 +17067,9 @@ "dev": true }, "big-integer": { - "version": "1.6.51" + "version": "1.6.51", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", + "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==" }, "big.js": { "version": "5.2.2" @@ -17167,6 +17091,8 @@ }, "bip-schnorr": { "version": "0.3.0", + "resolved": "https://registry.npmjs.org/bip-schnorr/-/bip-schnorr-0.3.0.tgz", + "integrity": "sha512-Sc1Hn2+1n+okPEW8G+JLjeaM12dsUOwr+oFlMDSKR9wYwNGMw0alskeBIHTmXxBxMZSWKhCW7PwKQVDyGmnaVg==", "requires": { "ecurve": "^1.0.6", "js-sha256": "^0.9.0", @@ -17176,6 +17102,8 @@ }, "bip38": { "version": "2.0.2", + "resolved": "https://registry.npmjs.org/bip38/-/bip38-2.0.2.tgz", + "integrity": "sha512-22KDak0RDyghFbR0Si7wyq9IgY423YzGYzWLpGeofH3DaolOQqjD3mNN08eFoubKlbyclOQKFwtONMv2SD9V3A==", "requires": { "bigi": "^1.2.0", "browserify-aes": "^1.0.1", @@ -17188,6 +17116,8 @@ }, "bip39": { "version": "3.0.2", + "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.0.2.tgz", + "integrity": "sha512-J4E1r2N0tUylTKt07ibXvhpT2c5pyAFgvuA5q1H9uDy6dEGpjV8jmymh3MTYJDLCNbIVClSB9FbND49I6N24MQ==", "requires": { "@types/node": "11.11.6", "create-hash": "^1.1.0", @@ -17226,6 +17156,8 @@ }, "bitcoinjs-message": { "version": "2.0.0", + "resolved": "https://registry.npmjs.org/bitcoinjs-message/-/bitcoinjs-message-2.0.0.tgz", + "integrity": "sha512-H5pJC7/eSqVjREiEOZ4jifX+7zXYP3Y28GIOIqg9hrgE7Vj8Eva9+HnVqnxwA1rJPOwZKuw0vo6k0UxgVc6q1A==", "requires": { "bs58check": "^2.0.2", "buffer-equals": "^1.0.3", @@ -17361,7 +17293,9 @@ "version": "1.0.1" }, "buffer-equals": { - "version": "1.0.4" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/buffer-equals/-/buffer-equals-1.0.4.tgz", + "integrity": "sha512-99MsCq0j5+RhubVEtKQgKaD6EM+UP3xJgIvQqwJ3SOLDUekzxMX1ylXBng+Wa2sh7mGT0W6RUly8ojjr1Tt6nA==" }, "buffer-from": { "version": "1.1.2" @@ -17520,6 +17454,8 @@ }, "cashaddrjs-slp": { "version": "0.2.12", + "resolved": "https://registry.npmjs.org/cashaddrjs-slp/-/cashaddrjs-slp-0.2.12.tgz", + "integrity": "sha512-n2TTIuW6vZZxYvjvsUAA+wOM0Zkj+3RRKUtDC1XSu4Ic4XVr0yFJkl1bzQkHWda7nkVT51sxjZneygz7D0SyrQ==", "requires": { "big-integer": "^1.6.34" } @@ -17909,9 +17845,6 @@ "boom": "0.4.x" } }, - "crypto-js": { - "version": "4.0.0" - }, "crypto-random-string": { "version": "2.0.0" }, @@ -18011,7 +17944,9 @@ } }, "defined": { - "version": "1.0.0" + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", + "integrity": "sha512-Y2caI5+ZwS5c3RiNDJ6u53VhQHv+hHKwhkI1iHvceKUHw9Df6EK2zRLfjejRgMuCuxK7PfSWIMwWecceVvThjQ==" }, "del": { "version": "6.1.1", @@ -18095,6 +18030,8 @@ }, "dotignore": { "version": "0.1.2", + "resolved": "https://registry.npmjs.org/dotignore/-/dotignore-0.1.2.tgz", + "integrity": "sha512-UGGGWfSauusaVJC+8fgV+NVvBXkCTmVv7sk6nojDZZvuOUNGUy0Zk4UpHQD6EDjS0jpBwcACvH4eofvyzBcRDw==", "requires": { "minimatch": "^3.0.4" } @@ -18144,12 +18081,16 @@ }, "ecashaddrjs": { "version": "1.0.7", + "resolved": "https://registry.npmjs.org/ecashaddrjs/-/ecashaddrjs-1.0.7.tgz", + "integrity": "sha512-KsvHYLlYtLr/GBkEPiwwQDIDBzqRx61qC34n1puHKOjVE4Uwg3syHccjFCqNynLa6T6xI0Rd7ByCRUJcuJcoIw==", "requires": { "big-integer": "1.6.36" }, "dependencies": { "big-integer": { - "version": "1.6.36" + "version": "1.6.36", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.36.tgz", + "integrity": "sha512-t70bfa7HYEA1D9idDbmuv7YbsbVkQ+Hp+8KFSul4aE5e/i1bjCNIRYJZlA8Q8p0r9T8cF/RVvwUgRA//FydEyg==" } } }, @@ -18329,6 +18270,8 @@ }, "es-get-iterator": { "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.2.tgz", + "integrity": "sha512-+DTO8GYwbMCwbywjimwZMHp8AuYXOS2JZFWoi2AlPOS3ebnII9w/NLpNZtA7A0YLaVDw+O7KFCeoIV7OPvM7hQ==", "requires": { "call-bind": "^1.0.2", "get-intrinsic": "^1.1.0", @@ -18341,7 +18284,9 @@ }, "dependencies": { "isarray": { - "version": "2.0.5" + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" } } }, @@ -18884,6 +18829,8 @@ }, "for-each": { "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", "requires": { "is-callable": "^1.1.3" } @@ -19003,7 +18950,9 @@ "version": "1.0.2" }, "get-package-type": { - "version": "0.1.0" + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==" }, "get-stdin": { "version": "8.0.0", @@ -19177,6 +19126,8 @@ }, "has-dynamic-import": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-dynamic-import/-/has-dynamic-import-2.0.1.tgz", + "integrity": "sha512-X3fbtsZmwb6W7fJGR9o7x65fZoodygCrZ3TVycvghP62yYQfS0t4RS0Qcz+j5tQYUKeSWS09tHkWW6WhFV3XhQ==", "requires": { "call-bind": "^1.0.2", "get-intrinsic": "^1.1.1" @@ -19725,6 +19676,8 @@ }, "is-arguments": { "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", "requires": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" @@ -19815,7 +19768,9 @@ "version": "1.0.1" }, "is-map": { - "version": "2.0.2" + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz", + "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==" }, "is-negative-zero": { "version": "2.0.2" @@ -19862,7 +19817,9 @@ "integrity": "sha512-rbku49cWloU5bSMI+zaRaXdQHXnthP6DZ/vLnfdSKyL4zUzuWnomtOEiZZOd+ioQ+avFo/qau3KPTc7Fjy1uPA==" }, "is-set": { - "version": "2.0.2" + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz", + "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==" }, "is-shared-array-buffer": { "version": "1.0.2", @@ -19894,6 +19851,8 @@ }, "is-typed-array": { "version": "1.1.9", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.9.tgz", + "integrity": "sha512-kfrlnTTn8pZkfpJMUgYD7YZ3qzeJgWUn8XfVYBARc4wnmNOmLbmuuaAs3q5fvB0UJOn6yHAKaGTPM7d6ezoD/A==", "requires": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", @@ -19910,7 +19869,9 @@ "dev": true }, "is-weakmap": { - "version": "2.0.1" + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", + "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==" }, "is-weakref": { "version": "1.0.2", @@ -19920,6 +19881,8 @@ }, "is-weakset": { "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz", + "integrity": "sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==", "requires": { "call-bind": "^1.0.2", "get-intrinsic": "^1.1.1" @@ -20109,7 +20072,9 @@ "version": "3.6.0" }, "js-sha256": { - "version": "0.9.0" + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", + "integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==" }, "js-sha3": { "version": "0.8.0" @@ -20260,6 +20225,8 @@ }, "keccak": { "version": "3.0.2", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.2.tgz", + "integrity": "sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ==", "requires": { "node-addon-api": "^2.0.0", "node-gyp-build": "^4.2.0", @@ -20913,53 +20880,30 @@ "dev": true }, "minimal-slp-wallet": { - "version": "5.1.0", + "version": "file:../minimal-slp-wallet", "requires": { "@psf/bch-js": "6.4.5", "apidoc": "0.51.0", "bch-consumer": "1.3.1", "bch-donation": "1.1.2", - "crypto-js": "4.0.0" - }, - "dependencies": { - "apidoc": { - "version": "0.51.0", - "requires": { - "bootstrap": "3.4.1", - "commander": "^8.3.0", - "diff-match-patch": "^1.0.5", - "esbuild-loader": "^2.16.0", - "expose-loader": "^3.1.0", - "fs-extra": "^10.0.0", - "glob": "^7.2.0", - "handlebars": "^4.7.7", - "iconv-lite": "^0.6.3", - "jquery": "^3.6.0", - "klaw-sync": "^6.0.0", - "lodash": "^4.17.21", - "markdown-it": "^12.2.0", - "nodemon": "^2.0.15", - "path-to-regexp": "^6.2.0", - "prismjs": "^1.25.0", - "semver": "^7.3.5", - "style-loader": "^3.3.1", - "url-parse": "^1.5.3", - "webpack": "^5.64.2", - "webpack-cli": "^4.9.1", - "winston": "^3.3.3" - } - }, - "glob": { - "version": "7.2.3", - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - } + "browserify": "17.0.0", + "chai": "4.2.0", + "coveralls": "3.1.0", + "crypto-js": "4.0.0", + "eslint": "7.17.0", + "eslint-config-prettier": "7.1.0", + "eslint-config-standard": "16.0.2", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-prettier": "3.3.1", + "eslint-plugin-standard": "4.0.1", + "husky": "4.3.8", + "lodash.clonedeep": "4.5.0", + "mocha": "9.2.1", + "nyc": "15.1.0", + "semantic-release": "19.0.3", + "sinon": "9.2.0", + "standard": "16.0.4", + "tinyify": "3.0.0" } }, "minimalistic-assert": { @@ -21415,7 +21359,9 @@ } }, "node-addon-api": { - "version": "2.0.2" + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" }, "node-emoji": { "version": "1.11.0", @@ -21431,7 +21377,9 @@ "version": "1.3.1" }, "node-gyp-build": { - "version": "4.4.0" + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", + "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==" }, "node-releases": { "version": "2.0.5" @@ -23218,6 +23166,8 @@ }, "object-is": { "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", + "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", "requires": { "call-bind": "^1.0.2", "define-properties": "^1.1.3" @@ -23776,7 +23726,8 @@ } }, "querystringify": { - "version": "2.2.0" + "version": "2.2.0", + "dev": true }, "queue-microtask": { "version": "1.2.3", @@ -24091,7 +24042,8 @@ "peer": true }, "requires-port": { - "version": "1.0.0" + "version": "1.0.0", + "dev": true }, "resolve": { "version": "1.22.1", @@ -24151,6 +24103,8 @@ }, "resumer": { "version": "0.0.0", + "resolved": "https://registry.npmjs.org/resumer/-/resumer-0.0.0.tgz", + "integrity": "sha512-Fn9X8rX8yYF4m81rZCK/5VmrmsSbqS/i3rDLl6ZZHAXgC2nTAx3dhwG8q8odP/RmdLa2YrybDJaAMg+X1ajY3w==", "requires": { "through": "~2.3.4" } @@ -24216,12 +24170,16 @@ }, "satoshi-bitcoin": { "version": "1.0.4", + "resolved": "https://registry.npmjs.org/satoshi-bitcoin/-/satoshi-bitcoin-1.0.4.tgz", + "integrity": "sha512-YuHOmw5wsz6wuHIQdsz5b2cgtuKtV/jEcZ4NGmWN5tM/gz5T9Q+DSuLlnuf5BP/jsQWgR0ofmY4f8Dm6JnqSug==", "requires": { "big.js": "^3.1.3" }, "dependencies": { "big.js": { - "version": "3.2.0" + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", + "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==" } } }, @@ -24237,7 +24195,9 @@ } }, "scryptsy": { - "version": "2.1.0" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/scryptsy/-/scryptsy-2.1.0.tgz", + "integrity": "sha512-1CdSqHQowJBnMAFyPEBRfqag/YP9OF394FV+4YREIJX4ljD7OxvQRDayyoyyCk+senRjSkP6VnUNQmVQqB6g7w==" }, "secp256k1": { "version": "3.8.0", @@ -24512,12 +24472,16 @@ }, "slp-mdm": { "version": "0.0.6", + "resolved": "https://registry.npmjs.org/slp-mdm/-/slp-mdm-0.0.6.tgz", + "integrity": "sha512-fbjlIg/o8OtzgK2JydC6POJp3Qup/rLgy4yB5hoLgxWRlERyJyE29ScwS3r9TTwPxe12qK55pyivAdNOZZXL0A==", "requires": { "bignumber.js": "^9.0.0" } }, "slp-parser": { "version": "0.0.4", + "resolved": "https://registry.npmjs.org/slp-parser/-/slp-parser-0.0.4.tgz", + "integrity": "sha512-AvbslJumkzGfMGWNvuE2pWx2nyHEk/VgQ7l119kDKIFRTuRUWOkyOULLauw5laGRQsBRThg6NCx/TsR3grX6GA==", "requires": { "bignumber.js": "^9.0.0" } @@ -24985,6 +24949,8 @@ }, "string.prototype.trim": { "version": "1.2.6", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.6.tgz", + "integrity": "sha512-8lMR2m+U0VJTPp6JjvJTtGyc4FIGq9CdRt7O9p6T0e6K4vjU+OP+SQJpbe/SBmRcCUIvNUnjsbmY6lnMp8MhsQ==", "requires": { "call-bind": "^1.0.2", "define-properties": "^1.1.4", @@ -25097,7 +25063,9 @@ "version": "2.2.1" }, "tape": { - "version": "5.5.3", + "version": "5.6.1", + "resolved": "https://registry.npmjs.org/tape/-/tape-5.6.1.tgz", + "integrity": "sha512-reNzS3rzsJtKk0f+zJx2XlzIsjJXlIcOIrIxk5shHAG/DzW3BKyMg8UfN79oluYlcWo4lIt56ahLqwgpRT4idg==", "requires": { "array.prototype.every": "^1.1.3", "call-bind": "^1.0.2", @@ -25106,24 +25074,26 @@ "dotignore": "^0.1.2", "for-each": "^0.3.3", "get-package-type": "^0.1.0", - "glob": "^7.2.0", + "glob": "^7.2.3", "has": "^1.0.3", "has-dynamic-import": "^2.0.1", "inherits": "^2.0.4", "is-regex": "^1.1.4", "minimist": "^1.2.6", - "object-inspect": "^1.12.0", + "object-inspect": "^1.12.2", "object-is": "^1.1.5", "object-keys": "^1.1.1", - "object.assign": "^4.1.2", + "object.assign": "^4.1.4", "resolve": "^2.0.0-next.3", "resumer": "^0.0.0", - "string.prototype.trim": "^1.2.5", + "string.prototype.trim": "^1.2.6", "through": "^2.3.8" }, "dependencies": { "deep-equal": { "version": "2.0.5", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.0.5.tgz", + "integrity": "sha512-nPiRgmbAtm1a3JsnLCf6/SLfXcjyN5v8L1TXzdCmHrXJ4hx+gW/w1YCcn7z8gJtSiDArZCgYtbao3QqLm/N1Sw==", "requires": { "call-bind": "^1.0.0", "es-get-iterator": "^1.1.1", @@ -25144,6 +25114,8 @@ }, "glob": { "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -25154,10 +25126,14 @@ } }, "isarray": { - "version": "2.0.5" + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" }, "resolve": { "version": "2.0.0-next.4", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.4.tgz", + "integrity": "sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ==", "requires": { "is-core-module": "^2.9.0", "path-parse": "^1.0.7", @@ -25521,6 +25497,7 @@ }, "url-parse": { "version": "1.5.10", + "dev": true, "requires": { "querystringify": "^2.1.1", "requires-port": "^1.0.0" @@ -25704,6 +25681,8 @@ }, "which-collection": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz", + "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==", "requires": { "is-map": "^2.0.1", "is-set": "^2.0.1", @@ -25717,6 +25696,8 @@ }, "which-typed-array": { "version": "1.1.8", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.8.tgz", + "integrity": "sha512-Jn4e5PItbcAHyLoRDwvPj1ypu27DJbtdYXUa5zsinrUx77Uvfb0cXwwnGMTn7cjUfhhqgVQnVJCwF+7cgU7tpw==", "requires": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", diff --git a/package.json b/package.json index 7aba394..0372554 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "repository": "Permissionless-Software-Foundation/bch-dex", "dependencies": { "@chris.troutner/retry-queue": "1.0.5", + "@psf/bch-js": "^6.4.5", "axios": "0.27.2", "bch-message-lib": "2.2.1", "bcryptjs": "2.4.3", @@ -52,7 +53,7 @@ "koa2-ratelimit": "0.9.1", "libp2p": "^0.36.2", "line-reader": "0.4.0", - "minimal-slp-wallet": "5.1.0", + "minimal-slp-wallet": "../minimal-slp-wallet/", "mongoose": "5.13.14", "node-fetch": "npm:@achingbrain/node-fetch@2.6.7", "nodemailer": "6.7.5", diff --git a/src/adapters/p2wdb-adapter.js b/src/adapters/p2wdb-adapter.js index 9e94482..fb3cc62 100644 --- a/src/adapters/p2wdb-adapter.js +++ b/src/adapters/p2wdb-adapter.js @@ -27,6 +27,10 @@ class P2wdbAdapter { // Allow the localConfig to overwrite the config file values. this.p2wdbURL = localConfig.p2wdbURL || config.p2wdbUrl + + // Bind the 'this' object to all functions + this.write = this.write.bind(this) + this.checkForSufficientFunds = this.checkForSufficientFunds.bind(this) } // Write some data to the P2WDB diff --git a/src/adapters/wallet.js b/src/adapters/wallet.js index 9cb68f1..d4f5f00 100644 --- a/src/adapters/wallet.js +++ b/src/adapters/wallet.js @@ -31,6 +31,9 @@ class WalletAdapter { this.bitcoinJs = bitcoinJs this.BchWallet = BchWallet this.bchWallet = {} // Will be replaced when initialized. + + // Bind the 'this' object + this.moveTokens = this.moveTokens.bind(this) } // Open the wallet file, or create one if the file doesn't exist. diff --git a/src/entities/offer.js b/src/entities/offer.js index 275e6b0..44bea7b 100644 --- a/src/entities/offer.js +++ b/src/entities/offer.js @@ -29,7 +29,7 @@ class OfferEntity { utxoVout, offerStatus, makerAddr, - ticker, + // ticker, tokenType } = offerData.data @@ -67,9 +67,9 @@ class OfferEntity { if (!makerAddr || typeof makerAddr !== 'string') { throw new Error("Property 'makerAddr' must be a string.") } - if (!ticker || typeof ticker !== 'string') { - throw new Error("Property 'ticker' must be a string.") - } + // if (!ticker || typeof ticker !== 'string') { + // throw new Error("Property 'ticker' must be a string.") + // } if (!tokenType || typeof tokenType !== 'number') { throw new Error("Property 'tokenType' must be a number.") } @@ -95,7 +95,7 @@ class OfferEntity { p2wdbHash: offerData.hash, offerStatus: offerStatus || this.offerStatus[0], makerAddr, - ticker, + // ticker, tokenType } diff --git a/src/use-cases/order.js b/src/use-cases/order.js index d334e7f..59c94f5 100644 --- a/src/use-cases/order.js +++ b/src/use-cases/order.js @@ -26,6 +26,9 @@ class OrderLib { this.bch = this.adapters.bch this.config = config this.retryQueue = new RetryQueue({ retryPeriod: 1000, attempts: 3 }) + + // Bind subfunctions to the 'this' object. + this.ensureFunds = this.ensureFunds.bind(this) } // Create a new order model and add it to the Mongo database. @@ -44,25 +47,29 @@ class OrderLib { const orderEntity = this.orderEntity.inputValidate(entryObj) console.log('orderEntity: ', orderEntity) + // Ensure sufficient tokens exist to create the order. + // await this.ensureFunds(orderEntity) + await this.retryQueue.addToQueue(this.ensureFunds, orderEntity) + // Get Ticker for token ID. - const tokenData = await this.adapters.wallet.bchWallet.getTxData([entryObj.tokenId]) + // const tokenData = await this.adapters.wallet.bchWallet.getTxData([entryObj.tokenId]) + const tokenData = await this.retryQueue.addToQueue(this.adapters.wallet.bchWallet.getTxData, [entryObj.tokenId]) // console.log(`tokenData: ${JSON.stringify(tokenData, null, 2)}`) entryObj.ticker = tokenData[0].tokenTicker - // Ensure sufficient tokens exist to create the order. - await this.ensureFunds(orderEntity) - // Move the tokens to holding address. const moveObj = { tokenId: orderEntity.tokenId, qty: orderEntity.numTokens } - const utxoInfo = await this.adapters.wallet.moveTokens(moveObj) + // const utxoInfo = await this.adapters.wallet.moveTokens(moveObj) + const utxoInfo = await this.retryQueue.addToQueue(this.adapters.wallet.moveTokens, moveObj) console.log('utxoInfo: ', utxoInfo) // Update the UTXO store for the wallet. await this.adapters.wallet.bchWallet.bchjs.Util.sleep(3000) - await this.adapters.wallet.bchWallet.getUtxos() + // await this.adapters.wallet.bchWallet.getUtxos() + await this.retryQueue.addToQueue(this.adapters.wallet.bchWallet.initialize, {}) // Update the order with the new UTXO information. orderEntity.utxoTxid = utxoInfo.txid @@ -78,7 +85,8 @@ class OrderLib { data: orderEntity, appId: this.config.p2wdbAppId } - const hash = await this.adapters.p2wdb.write(p2wdbObj) + // const hash = await this.adapters.p2wdb.write(p2wdbObj) + const hash = await this.retryQueue.addToQueue(this.adapters.p2wdb.write, p2wdbObj) // console.log('hash: ', hash) // Create a MongoDB model to hold the Order diff --git a/test/unit/mocks/adapters/wallet.js b/test/unit/mocks/adapters/wallet.js index 1b4acb0..ae38b59 100644 --- a/test/unit/mocks/adapters/wallet.js +++ b/test/unit/mocks/adapters/wallet.js @@ -35,6 +35,7 @@ class MockBchWallet { }] } this.getTokenData = async () => {} + this.initialize = async () => {} // Environment variable is used by wallet-balance.unit.js to force an error. if (process.env.NO_UTXO) { diff --git a/test/unit/use-cases/order.use-case.unit.js b/test/unit/use-cases/order.use-case.unit.js index 2dfd7c9..1d42e84 100644 --- a/test/unit/use-cases/order.use-case.unit.js +++ b/test/unit/use-cases/order.use-case.unit.js @@ -106,14 +106,12 @@ describe('#order-use-case', () => { numTokens: 1 } - // Mock dependencies - // sandbox.stub(uut.adapters.wallet, 'burnPsf').resolves('fakeTxid') - // sandbox.stub(uut.adapters.wallet.bchWallet, 'getTxData').resolves({ tokenTicker: 'TROUT' }) + // Mock dependencies and force expected code path sandbox.stub(uut.orderEntity, 'inputValidate').returns(entryObj) sandbox.stub(uut, 'ensureFunds').resolves() sandbox.stub(uut.adapters.wallet.bchWallet.bchjs.Util, 'sleep').resolves() sandbox.stub(uut.adapters.wallet, 'moveTokens').resolves({ txid: 'fakeTxid', vout: 0, hdIndex: 1 }) - sandbox.stub(uut.adapters.wallet.bchWallet, 'getUtxos').resolves() + sandbox.stub(uut.adapters.wallet.bchWallet, 'initialize').resolves() sandbox.stub(uut.adapters.p2wdb, 'write').resolves('fakeHash') const result = await uut.createOrder(entryObj)