diff --git a/package-lock.json b/package-lock.json index ce9f6fa..f688902 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,7 +34,7 @@ "koa2-ratelimit": "0.9.1", "libp2p": "^0.36.2", "line-reader": "0.4.0", - "minimal-slp-wallet": "4.6.5", + "minimal-slp-wallet": "5.0.3", "mongoose": "5.13.13", "node-fetch": "npm:@achingbrain/node-fetch@2.6.7", "nodemailer": "6.7.5", @@ -2696,54 +2696,19 @@ } }, "node_modules/bch-consumer": { - "version": "1.3.0", - "license": "MIT", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/bch-consumer/-/bch-consumer-1.3.1.tgz", + "integrity": "sha512-8ZoyFp4pLJFAOzM482K22sVL2FpuxhkYRtZuLLsMH9L442mRABjsAP7fTh91W5er40r8RGN/CSKi2TMyUmrY1Q==", "dependencies": { - "@psf/bch-js": "6.3.4", + "@psf/bch-js": "6.4.5", "apidoc": "0.51.0", "axios": "0.25.0" } }, - "node_modules/bch-consumer/node_modules/@psf/bch-js": { - "version": "6.3.4", - "license": "MIT", - "dependencies": { - "@chris.troutner/bip32-utils": "1.0.5", - "@psf/bip21": "2.0.1", - "@psf/bitcoincash-ops": "2.0.0", - "@psf/bitcoincashjs-lib": "4.0.2", - "@psf/coininfo": "4.0.0", - "axios": "0.26.1", - "bc-bip68": "1.0.5", - "bchaddrjs-slp": "0.2.5", - "bigi": "1.4.2", - "bignumber.js": "9.0.0", - "bip-schnorr": "0.3.0", - "bip38": "2.0.2", - "bip39": "3.0.2", - "bip66": "1.1.5", - "bitcoinjs-message": "2.0.0", - "bs58": "4.0.1", - "ecashaddrjs": "1.0.7", - "ini": "1.3.8", - "randombytes": "2.0.6", - "safe-buffer": "5.1.2", - "satoshi-bitcoin": "1.0.4", - "slp-mdm": "0.0.6", - "slp-parser": "0.0.4", - "wif": "2.0.6" - } - }, - "node_modules/bch-consumer/node_modules/@psf/bch-js/node_modules/axios": { - "version": "0.26.1", - "license": "MIT", - "dependencies": { - "follow-redirects": "^1.14.8" - } - }, "node_modules/bch-consumer/node_modules/apidoc": { "version": "0.51.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/apidoc/-/apidoc-0.51.0.tgz", + "integrity": "sha512-3P4srhm6NA+kE/YRM4qL5jESElpQQJL+Z8n7hyr4uC+1DSwGzmE6adXPVxuT/hpDyShrqmRlHk8hf40RSqEsNw==", "os": [ "darwin", "freebsd", @@ -2784,14 +2749,16 @@ }, "node_modules/bch-consumer/node_modules/axios": { "version": "0.25.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.25.0.tgz", + "integrity": "sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==", "dependencies": { "follow-redirects": "^1.14.7" } }, "node_modules/bch-consumer/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", @@ -10622,47 +10589,17 @@ } }, "node_modules/minimal-slp-wallet": { - "version": "4.6.5", - "license": "MIT", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/minimal-slp-wallet/-/minimal-slp-wallet-5.0.3.tgz", + "integrity": "sha512-tB2H0udGovM5TDUQIGqnpABnAh3fZafYFv1QLXUqKlSpLYxkI1GaKVzAuq5VdRu6GlIpKggN057AL02KTooNQg==", "dependencies": { - "@psf/bch-js": "6.4.1", + "@psf/bch-js": "6.4.5", "apidoc": "0.51.0", - "bch-consumer": "1.3.0", + "bch-consumer": "1.3.1", "bch-donation": "1.1.2", "crypto-js": "4.0.0" } }, - "node_modules/minimal-slp-wallet/node_modules/@psf/bch-js": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@psf/bch-js/-/bch-js-6.4.1.tgz", - "integrity": "sha512-/BLGzWH02VqaDNeY05QGMhrCtYDw5bXn45Egz+L5FLcyZaOqONR4kl80T6a8xvTPcREO4R+AjGTRBpfjdikwpA==", - "dependencies": { - "@chris.troutner/bip32-utils": "1.0.5", - "@psf/bip21": "2.0.1", - "@psf/bitcoincash-ops": "2.0.0", - "@psf/bitcoincashjs-lib": "4.0.2", - "@psf/coininfo": "4.0.0", - "axios": "0.26.1", - "bc-bip68": "1.0.5", - "bchaddrjs-slp": "0.2.5", - "bigi": "1.4.2", - "bignumber.js": "9.0.0", - "bip-schnorr": "0.3.0", - "bip38": "2.0.2", - "bip39": "3.0.2", - "bip66": "1.1.5", - "bitcoinjs-message": "2.0.0", - "bs58": "4.0.1", - "ecashaddrjs": "1.0.7", - "ini": "1.3.8", - "randombytes": "2.0.6", - "safe-buffer": "5.1.2", - "satoshi-bitcoin": "1.0.4", - "slp-mdm": "0.0.6", - "slp-parser": "0.0.4", - "wif": "2.0.6" - } - }, "node_modules/minimal-slp-wallet/node_modules/apidoc": { "version": "0.51.0", "license": "MIT", @@ -10704,14 +10641,6 @@ "node": ">=14.0.0" } }, - "node_modules/minimal-slp-wallet/node_modules/axios": { - "version": "0.26.1", - "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/minimal-slp-wallet/node_modules/glob": { "version": "7.2.3", "license": "ISC", @@ -21406,52 +21335,19 @@ "version": "1.0.5" }, "bch-consumer": { - "version": "1.3.0", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/bch-consumer/-/bch-consumer-1.3.1.tgz", + "integrity": "sha512-8ZoyFp4pLJFAOzM482K22sVL2FpuxhkYRtZuLLsMH9L442mRABjsAP7fTh91W5er40r8RGN/CSKi2TMyUmrY1Q==", "requires": { - "@psf/bch-js": "6.3.4", + "@psf/bch-js": "6.4.5", "apidoc": "0.51.0", "axios": "0.25.0" }, "dependencies": { - "@psf/bch-js": { - "version": "6.3.4", - "requires": { - "@chris.troutner/bip32-utils": "1.0.5", - "@psf/bip21": "2.0.1", - "@psf/bitcoincash-ops": "2.0.0", - "@psf/bitcoincashjs-lib": "4.0.2", - "@psf/coininfo": "4.0.0", - "axios": "0.26.1", - "bc-bip68": "1.0.5", - "bchaddrjs-slp": "0.2.5", - "bigi": "1.4.2", - "bignumber.js": "9.0.0", - "bip-schnorr": "0.3.0", - "bip38": "2.0.2", - "bip39": "3.0.2", - "bip66": "1.1.5", - "bitcoinjs-message": "2.0.0", - "bs58": "4.0.1", - "ecashaddrjs": "1.0.7", - "ini": "1.3.8", - "randombytes": "2.0.6", - "safe-buffer": "5.1.2", - "satoshi-bitcoin": "1.0.4", - "slp-mdm": "0.0.6", - "slp-parser": "0.0.4", - "wif": "2.0.6" - }, - "dependencies": { - "axios": { - "version": "0.26.1", - "requires": { - "follow-redirects": "^1.14.8" - } - } - } - }, "apidoc": { "version": "0.51.0", + "resolved": "https://registry.npmjs.org/apidoc/-/apidoc-0.51.0.tgz", + "integrity": "sha512-3P4srhm6NA+kE/YRM4qL5jESElpQQJL+Z8n7hyr4uC+1DSwGzmE6adXPVxuT/hpDyShrqmRlHk8hf40RSqEsNw==", "requires": { "bootstrap": "3.4.1", "commander": "^8.3.0", @@ -21479,12 +21375,16 @@ }, "axios": { "version": "0.25.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.25.0.tgz", + "integrity": "sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==", "requires": { "follow-redirects": "^1.14.7" } }, "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", @@ -26845,46 +26745,17 @@ "dev": true }, "minimal-slp-wallet": { - "version": "4.6.5", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/minimal-slp-wallet/-/minimal-slp-wallet-5.0.3.tgz", + "integrity": "sha512-tB2H0udGovM5TDUQIGqnpABnAh3fZafYFv1QLXUqKlSpLYxkI1GaKVzAuq5VdRu6GlIpKggN057AL02KTooNQg==", "requires": { - "@psf/bch-js": "6.4.1", + "@psf/bch-js": "6.4.5", "apidoc": "0.51.0", - "bch-consumer": "1.3.0", + "bch-consumer": "1.3.1", "bch-donation": "1.1.2", "crypto-js": "4.0.0" }, "dependencies": { - "@psf/bch-js": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@psf/bch-js/-/bch-js-6.4.1.tgz", - "integrity": "sha512-/BLGzWH02VqaDNeY05QGMhrCtYDw5bXn45Egz+L5FLcyZaOqONR4kl80T6a8xvTPcREO4R+AjGTRBpfjdikwpA==", - "requires": { - "@chris.troutner/bip32-utils": "1.0.5", - "@psf/bip21": "2.0.1", - "@psf/bitcoincash-ops": "2.0.0", - "@psf/bitcoincashjs-lib": "4.0.2", - "@psf/coininfo": "4.0.0", - "axios": "0.26.1", - "bc-bip68": "1.0.5", - "bchaddrjs-slp": "0.2.5", - "bigi": "1.4.2", - "bignumber.js": "9.0.0", - "bip-schnorr": "0.3.0", - "bip38": "2.0.2", - "bip39": "3.0.2", - "bip66": "1.1.5", - "bitcoinjs-message": "2.0.0", - "bs58": "4.0.1", - "ecashaddrjs": "1.0.7", - "ini": "1.3.8", - "randombytes": "2.0.6", - "safe-buffer": "5.1.2", - "satoshi-bitcoin": "1.0.4", - "slp-mdm": "0.0.6", - "slp-parser": "0.0.4", - "wif": "2.0.6" - } - }, "apidoc": { "version": "0.51.0", "requires": { @@ -26912,14 +26783,6 @@ "winston": "^3.3.3" } }, - "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" - } - }, "glob": { "version": "7.2.3", "requires": { diff --git a/package.json b/package.json index 5eff438..7a11e9e 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "koa2-ratelimit": "0.9.1", "libp2p": "^0.36.2", "line-reader": "0.4.0", - "minimal-slp-wallet": "4.6.5", + "minimal-slp-wallet": "5.0.3", "mongoose": "5.13.13", "node-fetch": "npm:@achingbrain/node-fetch@2.6.7", "nodemailer": "6.7.5", diff --git a/src/use-cases/offer/index.js b/src/use-cases/offer/index.js index 56b7c16..9e5ed2d 100644 --- a/src/use-cases/offer/index.js +++ b/src/use-cases/offer/index.js @@ -352,10 +352,17 @@ class OfferUseCases { let utxoStatus = null try { // Get the status of the UTXO associate with this Offer. - utxoStatus = await this.adapters.bchjs.Blockchain.getTxOut( - thisOffer.utxoTxid, - thisOffer.utxoVout - ) + // utxoStatus = await this.adapters.bchjs.Blockchain.getTxOut( + // thisOffer.utxoTxid, + // thisOffer.utxoVout + // ) + + // Get the status of the UTXO associate with this Offer. + const utxo = { + tx_hash: thisOffer.utxoTxid, + tx_pos: thisOffer.utxoVout + } + utxoStatus = await this.adapters.wallet.bchWallet.utxoIsValid(utxo) // console.log('utxoStatus: ', utxoStatus) } catch (err) { // Handle corner case of bad-data in the Offer model. @@ -364,7 +371,7 @@ class OfferUseCases { await thisOffer.remove() continue } else if (err.isAxiosError) { - console.log('Error trying to contact api.fullstack.cash') + console.log('Error trying to contact wallet service: ', err) continue } else { throw err diff --git a/src/use-cases/order.js b/src/use-cases/order.js index 726e77f..6b293b4 100644 --- a/src/use-cases/order.js +++ b/src/use-cases/order.js @@ -198,10 +198,17 @@ class OrderLib { let utxoStatus = null try { // Get the status of the UTXO associate with this Order. - utxoStatus = await this.adapters.bchjs.Blockchain.getTxOut( - thisOrder.utxoTxid, - thisOrder.utxoVout - ) + // utxoStatus = await this.adapters.bchjs.Blockchain.getTxOut( + // thisOrder.utxoTxid, + // thisOrder.utxoVout + // ) + + // Get the status of the UTXO associate with this Order. + const utxo = { + tx_hash: thisOrder.utxoTxid, + tx_pos: thisOrder.utxoVout + } + utxoStatus = await this.adapters.wallet.bchWallet.utxoIsValid(utxo) // console.log('utxoStatus: ', utxoStatus) } catch (err) { // Handle corner case of bad-data in the Order model. @@ -210,7 +217,7 @@ class OrderLib { await thisOrder.remove() continue } else if (err.isAxiosError) { - console.log('Error trying to contact api.fullstack.cash') + console.log('Error trying to contact wallet service: ', err) continue } else { throw err