diff --git a/clients/libs/web/transfer_receive.js b/clients/libs/web/transfer_receive.js index 61460d87..d9ba11bf 100644 --- a/clients/libs/web/transfer_receive.js +++ b/clients/libs/web/transfer_receive.js @@ -131,7 +131,7 @@ const sendTransferReceiverRequestPayload = async (clientConfig, transferReceiver } -const processEncryptedMessage = async (clientConfig, coin, encMessage, network, serverInfo, activities) => { +const processEncryptedMessage = async (clientConfig, coin, encMessage, network, serverInfo, blockheight, activities) => { let clientAuthKey = coin.auth_privkey; let newUserPubkey = coin.user_pubkey; @@ -182,8 +182,10 @@ const processEncryptedMessage = async (clientConfig, coin, encMessage, network, transferMsg, statechainInfo, tx0Hex, + blockheight, feeRateTolerance, currentFeeRateSatsPerByte, + serverInfo.initlock, serverInfo.interval ) @@ -283,6 +285,9 @@ const execute = async (clientConfig, walletName) => { let tempCoins = [...wallet.coins]; let tempActivities = [...wallet.activities]; + const response = await axios.get(`${clientConfig.esploraServer}/api/blocks/tip/height`); + const blockheight = response.data; + for (let [authPubkey, encMessages] of encMsgsPerAuthPubkey.entries()) { for (let encMessage of encMessages) { @@ -291,7 +296,7 @@ const execute = async (clientConfig, walletName) => { if (coin) { try { - let messageResult = await processEncryptedMessage(clientConfig, coin, encMessage, wallet.network, serverInfo, tempActivities); + let messageResult = await processEncryptedMessage(clientConfig, coin, encMessage, wallet.network, serverInfo, blockheight, tempActivities); if (messageResult.isBatchLocked) { isThereBatchLocked = true; @@ -310,7 +315,7 @@ const execute = async (clientConfig, walletName) => { let newCoin = await mercury_wasm.duplicateCoinToInitializedState(wallet, authPubkey); if (newCoin) { - let messageResult = await processEncryptedMessage(clientConfig, newCoin, encMessage, wallet.network, serverInfo, tempActivities); + let messageResult = await processEncryptedMessage(clientConfig, newCoin, encMessage, wallet.network, serverInfo, blockheight, tempActivities); if (messageResult.isBatchLocked) { isThereBatchLocked = true; diff --git a/clients/tests/web/package-lock.json b/clients/tests/web/package-lock.json index 64feedd7..ea1ed337 100644 --- a/clients/tests/web/package-lock.json +++ b/clients/tests/web/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "axios": "^1.7.2", "body-parser": "^1.20.2", + "bolt11": "^1.4.1", "cors": "^2.8.5", "express": "^4.19.2", "install": "^0.13.0", @@ -699,6 +700,17 @@ "node": ">=18" } }, + "node_modules/@noble/hashes": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", + "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@open-draft/deferred-promise": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@open-draft/deferred-promise/-/deferred-promise-2.2.0.tgz", @@ -1027,6 +1039,14 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/cookie": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz", @@ -1054,7 +1074,6 @@ "version": "22.0.0", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.0.0.tgz", "integrity": "sha512-VT7KSYudcPOzP5Q0wfbowyNLaVR8QWUdw+088uFWwfvpY6uCWaXpqV6ieLAu9WBcnTa7H4Z5RLK8I5t2FuOcqw==", - "devOptional": true, "license": "MIT", "dependencies": { "undici-types": "~6.11.1" @@ -1381,6 +1400,11 @@ "streamx": "^2.18.0" } }, + "node_modules/base-x": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", + "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" + }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -1408,6 +1432,45 @@ "node": ">=10.0.0" } }, + "node_modules/bech32": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", + "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" + }, + "node_modules/bip174": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bip174/-/bip174-2.1.1.tgz", + "integrity": "sha512-mdFV5+/v0XyNYXjBS6CQPLo9ekCx4gtKZFnJm5PMto7Fs9hTTDpkkzOB7/FtluRI6JbUUAu+snTYfJRgHLZbZQ==", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/bitcoinjs-lib": { + "version": "6.1.6", + "resolved": "https://registry.npmjs.org/bitcoinjs-lib/-/bitcoinjs-lib-6.1.6.tgz", + "integrity": "sha512-Fk8+Vc+e2rMoDU5gXkW9tD+313rhkm5h6N9HfZxXvYU9LedttVvmXKTgd9k5rsQJjkSfsv6XRM8uhJv94SrvcA==", + "dependencies": { + "@noble/hashes": "^1.2.0", + "bech32": "^2.0.0", + "bip174": "^2.1.1", + "bs58check": "^3.0.1", + "typeforce": "^1.11.3", + "varuint-bitcoin": "^1.1.2" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/bitcoinjs-lib/node_modules/bech32": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz", + "integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==" + }, + "node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, "node_modules/body-parser": { "version": "1.20.2", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", @@ -1455,6 +1518,43 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/bolt11": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/bolt11/-/bolt11-1.4.1.tgz", + "integrity": "sha512-jR0Y+MO+CK2at1Cg5mltLJ+6tdOwNKoTS/DJOBDdzVkQ+R9D6UgZMayTWOsuzY7OgV1gEqlyT5Tzk6t6r4XcNQ==", + "dependencies": { + "@types/bn.js": "^4.11.3", + "bech32": "^1.1.2", + "bitcoinjs-lib": "^6.0.0", + "bn.js": "^4.11.8", + "create-hash": "^1.2.0", + "lodash": "^4.17.11", + "safe-buffer": "^5.1.1", + "secp256k1": "^4.0.2" + } + }, + "node_modules/brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" + }, + "node_modules/bs58": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", + "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "dependencies": { + "base-x": "^4.0.0" + } + }, + "node_modules/bs58check": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-3.0.1.tgz", + "integrity": "sha512-hjuuJvoWEybo7Hn/0xOrczQKKEKD63WguEjlhLExYs2wUBcebDC1jDNK17eEAD2lYfw82d5ASC1d7K3SWszjaQ==", + "dependencies": { + "@noble/hashes": "^1.2.0", + "bs58": "^5.0.0" + } + }, "node_modules/buffer": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", @@ -1584,6 +1684,15 @@ "devtools-protocol": "*" } }, + "node_modules/cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, "node_modules/cli-spinners": { "version": "2.9.2", "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", @@ -1734,6 +1843,18 @@ } } }, + "node_modules/create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -1904,6 +2025,20 @@ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, + "node_modules/elliptic": { + "version": "6.5.7", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.7.tgz", + "integrity": "sha512-ESVCtTwiA+XhY3wyh24QqRGBoP3rEdDUl3EDUUo9tft074fi19IrdpH7hLCMMP3CIj7jb3W96rn8lt/BqIlt5Q==", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -2462,6 +2597,28 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, "node_modules/hasown": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", @@ -2480,6 +2637,16 @@ "dev": true, "license": "MIT" }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, "node_modules/html-encoding-sniffer": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz", @@ -2753,6 +2920,11 @@ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, "node_modules/loupe": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.1.tgz", @@ -2789,6 +2961,16 @@ "@jridgewell/sourcemap-codec": "^1.5.0" } }, + "node_modules/md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -2862,6 +3044,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" + }, "node_modules/mitt": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", @@ -2977,6 +3169,21 @@ "node": ">= 0.4.0" } }, + "node_modules/node-addon-api": { + "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_modules/node-gyp-build": { + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.2.tgz", + "integrity": "sha512-IRUxE4BVsHWXkV/SFOut4qTlagw2aM8T5/vnTsmrHJvVoKueJHRc/JaFND7QDDc61kLYUJ6qlZM3sqTSyx2dTw==", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, "node_modules/npm": { "version": "10.8.2", "resolved": "https://registry.npmjs.org/npm/-/npm-10.8.2.tgz", @@ -5812,6 +6019,19 @@ "dev": true, "license": "MIT" }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/regenerator-runtime": { "version": "0.14.1", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", @@ -5841,6 +6061,15 @@ "node": ">=4" } }, + "node_modules/ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, "node_modules/rollup": { "version": "4.18.1", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.18.1.tgz", @@ -5918,6 +6147,20 @@ "node": ">=v12.22.7" } }, + "node_modules/secp256k1": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", + "hasInstallScript": true, + "dependencies": { + "elliptic": "^6.5.4", + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/semver": { "version": "7.6.0", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", @@ -6014,6 +6257,18 @@ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" }, + "node_modules/sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "bin": { + "sha.js": "bin.js" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -6183,6 +6438,14 @@ "dev": true, "license": "MIT" }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -6382,6 +6645,11 @@ "node": ">= 0.6" } }, + "node_modules/typeforce": { + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/typeforce/-/typeforce-1.18.0.tgz", + "integrity": "sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g==" + }, "node_modules/unbzip2-stream": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", @@ -6395,7 +6663,6 @@ "version": "6.11.1", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.11.1.tgz", "integrity": "sha512-mIDEX2ek50x0OlRgxryxsenE5XaQD4on5U2inY7RApK3SOJpofyw7uW2AyfMKkhAxXIceo2DeWGVGwyvng1GNQ==", - "devOptional": true, "license": "MIT" }, "node_modules/universalify": { @@ -6430,6 +6697,11 @@ "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-10.0.0.tgz", "integrity": "sha512-H/A06tKD7sS1O1X2SshBVeA5FLycRpjqiBeqGKmBwBDBy28EnRjORxTNe269KSSr5un5qyWi1iL61wLxpd+ZOg==" }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", @@ -6438,6 +6710,14 @@ "node": ">= 0.4.0" } }, + "node_modules/varuint-bitcoin": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/varuint-bitcoin/-/varuint-bitcoin-1.1.2.tgz", + "integrity": "sha512-4EVb+w4rx+YfVM32HQX42AbbT7/1f5zwAYhIujKXKk8NQK+JfRVl3pqT3hjNn/L+RstigmGGKVwHA/P0wgITZw==", + "dependencies": { + "safe-buffer": "^5.1.1" + } + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", diff --git a/wasm/node_pkg/debug/mercury_wasm.d.ts b/wasm/node_pkg/debug/mercury_wasm.d.ts index efa4b767..fdfd7877 100644 --- a/wasm/node_pkg/debug/mercury_wasm.d.ts +++ b/wasm/node_pkg/debug/mercury_wasm.d.ts @@ -267,12 +267,14 @@ export function duplicateCoinToInitializedState(walletJson: any, authPubkey: str * @param {any} transfer_msg * @param {any} statechain_info * @param {string} tx0_hex +* @param {number} current_blockheight * @param {number} fee_rate_tolerance * @param {number} current_fee_rate_sats_per_byte +* @param {number} lockheight_init * @param {number} interval * @returns {any} */ -export function validateSignatureScheme(transfer_msg: any, statechain_info: any, tx0_hex: string, fee_rate_tolerance: number, current_fee_rate_sats_per_byte: number, interval: number): any; +export function validateSignatureScheme(transfer_msg: any, statechain_info: any, tx0_hex: string, current_blockheight: number, fee_rate_tolerance: number, current_fee_rate_sats_per_byte: number, lockheight_init: number, interval: number): any; /** * @returns {any} */ diff --git a/wasm/node_pkg/debug/mercury_wasm.js b/wasm/node_pkg/debug/mercury_wasm.js index c512a748..fbe9230a 100644 --- a/wasm/node_pkg/debug/mercury_wasm.js +++ b/wasm/node_pkg/debug/mercury_wasm.js @@ -845,16 +845,20 @@ module.exports.duplicateCoinToInitializedState = function(walletJson, authPubkey * @param {any} transfer_msg * @param {any} statechain_info * @param {string} tx0_hex +* @param {number} current_blockheight * @param {number} fee_rate_tolerance * @param {number} current_fee_rate_sats_per_byte +* @param {number} lockheight_init * @param {number} interval * @returns {any} */ -module.exports.validateSignatureScheme = function(transfer_msg, statechain_info, tx0_hex, fee_rate_tolerance, current_fee_rate_sats_per_byte, interval) { +module.exports.validateSignatureScheme = function(transfer_msg, statechain_info, tx0_hex, current_blockheight, fee_rate_tolerance, current_fee_rate_sats_per_byte, lockheight_init, interval) { const ptr0 = passStringToWasm0(tx0_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; + _assertNum(current_blockheight); + _assertNum(lockheight_init); _assertNum(interval); - const ret = wasm.validateSignatureScheme(addHeapObject(transfer_msg), addHeapObject(statechain_info), ptr0, len0, fee_rate_tolerance, current_fee_rate_sats_per_byte, interval); + const ret = wasm.validateSignatureScheme(addHeapObject(transfer_msg), addHeapObject(statechain_info), ptr0, len0, current_blockheight, fee_rate_tolerance, current_fee_rate_sats_per_byte, lockheight_init, interval); return takeObject(ret); }; diff --git a/wasm/node_pkg/debug/mercury_wasm_bg.wasm b/wasm/node_pkg/debug/mercury_wasm_bg.wasm index c59885e3..06b19695 100644 Binary files a/wasm/node_pkg/debug/mercury_wasm_bg.wasm and b/wasm/node_pkg/debug/mercury_wasm_bg.wasm differ diff --git a/wasm/node_pkg/debug/mercury_wasm_bg.wasm.d.ts b/wasm/node_pkg/debug/mercury_wasm_bg.wasm.d.ts index e36e7657..a40f9970 100644 --- a/wasm/node_pkg/debug/mercury_wasm_bg.wasm.d.ts +++ b/wasm/node_pkg/debug/mercury_wasm_bg.wasm.d.ts @@ -41,7 +41,7 @@ export function signMessage(a: number, b: number, c: number, d: number): void; export function isEnclavePubkeyPartOfCoin(a: number, b: number, c: number): number; export function latestBackuptxPaysToUserpubkey(a: number, b: number, c: number, d: number): number; export function duplicateCoinToInitializedState(a: number, b: number, c: number): number; -export function validateSignatureScheme(a: number, b: number, c: number, d: number, e: number, f: number, g: number): number; +export function validateSignatureScheme(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number): number; export function getMockWallet(): number; export function rustsecp256k1zkp_v0_8_1_default_illegal_callback_fn(a: number, b: number): void; export function rustsecp256k1zkp_v0_8_1_default_error_callback_fn(a: number, b: number): void; diff --git a/wasm/node_pkg/release/mercury_wasm.d.ts b/wasm/node_pkg/release/mercury_wasm.d.ts index efa4b767..fdfd7877 100644 --- a/wasm/node_pkg/release/mercury_wasm.d.ts +++ b/wasm/node_pkg/release/mercury_wasm.d.ts @@ -267,12 +267,14 @@ export function duplicateCoinToInitializedState(walletJson: any, authPubkey: str * @param {any} transfer_msg * @param {any} statechain_info * @param {string} tx0_hex +* @param {number} current_blockheight * @param {number} fee_rate_tolerance * @param {number} current_fee_rate_sats_per_byte +* @param {number} lockheight_init * @param {number} interval * @returns {any} */ -export function validateSignatureScheme(transfer_msg: any, statechain_info: any, tx0_hex: string, fee_rate_tolerance: number, current_fee_rate_sats_per_byte: number, interval: number): any; +export function validateSignatureScheme(transfer_msg: any, statechain_info: any, tx0_hex: string, current_blockheight: number, fee_rate_tolerance: number, current_fee_rate_sats_per_byte: number, lockheight_init: number, interval: number): any; /** * @returns {any} */ diff --git a/wasm/node_pkg/release/mercury_wasm.js b/wasm/node_pkg/release/mercury_wasm.js index 8e08c254..4abeaf0d 100644 --- a/wasm/node_pkg/release/mercury_wasm.js +++ b/wasm/node_pkg/release/mercury_wasm.js @@ -823,15 +823,17 @@ module.exports.duplicateCoinToInitializedState = function(walletJson, authPubkey * @param {any} transfer_msg * @param {any} statechain_info * @param {string} tx0_hex +* @param {number} current_blockheight * @param {number} fee_rate_tolerance * @param {number} current_fee_rate_sats_per_byte +* @param {number} lockheight_init * @param {number} interval * @returns {any} */ -module.exports.validateSignatureScheme = function(transfer_msg, statechain_info, tx0_hex, fee_rate_tolerance, current_fee_rate_sats_per_byte, interval) { +module.exports.validateSignatureScheme = function(transfer_msg, statechain_info, tx0_hex, current_blockheight, fee_rate_tolerance, current_fee_rate_sats_per_byte, lockheight_init, interval) { const ptr0 = passStringToWasm0(tx0_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; - const ret = wasm.validateSignatureScheme(addHeapObject(transfer_msg), addHeapObject(statechain_info), ptr0, len0, fee_rate_tolerance, current_fee_rate_sats_per_byte, interval); + const ret = wasm.validateSignatureScheme(addHeapObject(transfer_msg), addHeapObject(statechain_info), ptr0, len0, current_blockheight, fee_rate_tolerance, current_fee_rate_sats_per_byte, lockheight_init, interval); return takeObject(ret); }; diff --git a/wasm/node_pkg/release/mercury_wasm_bg.wasm b/wasm/node_pkg/release/mercury_wasm_bg.wasm index be67c9d4..08b3da66 100644 Binary files a/wasm/node_pkg/release/mercury_wasm_bg.wasm and b/wasm/node_pkg/release/mercury_wasm_bg.wasm differ diff --git a/wasm/node_pkg/release/mercury_wasm_bg.wasm.d.ts b/wasm/node_pkg/release/mercury_wasm_bg.wasm.d.ts index e36e7657..a40f9970 100644 --- a/wasm/node_pkg/release/mercury_wasm_bg.wasm.d.ts +++ b/wasm/node_pkg/release/mercury_wasm_bg.wasm.d.ts @@ -41,7 +41,7 @@ export function signMessage(a: number, b: number, c: number, d: number): void; export function isEnclavePubkeyPartOfCoin(a: number, b: number, c: number): number; export function latestBackuptxPaysToUserpubkey(a: number, b: number, c: number, d: number): number; export function duplicateCoinToInitializedState(a: number, b: number, c: number): number; -export function validateSignatureScheme(a: number, b: number, c: number, d: number, e: number, f: number, g: number): number; +export function validateSignatureScheme(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number): number; export function getMockWallet(): number; export function rustsecp256k1zkp_v0_8_1_default_illegal_callback_fn(a: number, b: number): void; export function rustsecp256k1zkp_v0_8_1_default_error_callback_fn(a: number, b: number): void; diff --git a/wasm/web_pkg/debug/mercury_wasm.d.ts b/wasm/web_pkg/debug/mercury_wasm.d.ts index 95fe6817..b11793ae 100644 --- a/wasm/web_pkg/debug/mercury_wasm.d.ts +++ b/wasm/web_pkg/debug/mercury_wasm.d.ts @@ -267,12 +267,14 @@ export function duplicateCoinToInitializedState(walletJson: any, authPubkey: str * @param {any} transfer_msg * @param {any} statechain_info * @param {string} tx0_hex +* @param {number} current_blockheight * @param {number} fee_rate_tolerance * @param {number} current_fee_rate_sats_per_byte +* @param {number} lockheight_init * @param {number} interval * @returns {any} */ -export function validateSignatureScheme(transfer_msg: any, statechain_info: any, tx0_hex: string, fee_rate_tolerance: number, current_fee_rate_sats_per_byte: number, interval: number): any; +export function validateSignatureScheme(transfer_msg: any, statechain_info: any, tx0_hex: string, current_blockheight: number, fee_rate_tolerance: number, current_fee_rate_sats_per_byte: number, lockheight_init: number, interval: number): any; /** * @returns {any} */ @@ -322,7 +324,7 @@ export interface InitOutput { readonly isEnclavePubkeyPartOfCoin: (a: number, b: number, c: number) => number; readonly latestBackuptxPaysToUserpubkey: (a: number, b: number, c: number, d: number) => number; readonly duplicateCoinToInitializedState: (a: number, b: number, c: number) => number; - readonly validateSignatureScheme: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number; + readonly validateSignatureScheme: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number; readonly getMockWallet: () => number; readonly rustsecp256k1zkp_v0_8_1_default_illegal_callback_fn: (a: number, b: number) => void; readonly rustsecp256k1zkp_v0_8_1_default_error_callback_fn: (a: number, b: number) => void; diff --git a/wasm/web_pkg/debug/mercury_wasm.js b/wasm/web_pkg/debug/mercury_wasm.js index a9bb0bd3..4608b54d 100644 --- a/wasm/web_pkg/debug/mercury_wasm.js +++ b/wasm/web_pkg/debug/mercury_wasm.js @@ -842,16 +842,20 @@ export function duplicateCoinToInitializedState(walletJson, authPubkey) { * @param {any} transfer_msg * @param {any} statechain_info * @param {string} tx0_hex +* @param {number} current_blockheight * @param {number} fee_rate_tolerance * @param {number} current_fee_rate_sats_per_byte +* @param {number} lockheight_init * @param {number} interval * @returns {any} */ -export function validateSignatureScheme(transfer_msg, statechain_info, tx0_hex, fee_rate_tolerance, current_fee_rate_sats_per_byte, interval) { +export function validateSignatureScheme(transfer_msg, statechain_info, tx0_hex, current_blockheight, fee_rate_tolerance, current_fee_rate_sats_per_byte, lockheight_init, interval) { const ptr0 = passStringToWasm0(tx0_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; + _assertNum(current_blockheight); + _assertNum(lockheight_init); _assertNum(interval); - const ret = wasm.validateSignatureScheme(addHeapObject(transfer_msg), addHeapObject(statechain_info), ptr0, len0, fee_rate_tolerance, current_fee_rate_sats_per_byte, interval); + const ret = wasm.validateSignatureScheme(addHeapObject(transfer_msg), addHeapObject(statechain_info), ptr0, len0, current_blockheight, fee_rate_tolerance, current_fee_rate_sats_per_byte, lockheight_init, interval); return takeObject(ret); } diff --git a/wasm/web_pkg/debug/mercury_wasm_bg.wasm b/wasm/web_pkg/debug/mercury_wasm_bg.wasm index 1b343412..f53ed4ed 100644 Binary files a/wasm/web_pkg/debug/mercury_wasm_bg.wasm and b/wasm/web_pkg/debug/mercury_wasm_bg.wasm differ diff --git a/wasm/web_pkg/debug/mercury_wasm_bg.wasm.d.ts b/wasm/web_pkg/debug/mercury_wasm_bg.wasm.d.ts index e36e7657..a40f9970 100644 --- a/wasm/web_pkg/debug/mercury_wasm_bg.wasm.d.ts +++ b/wasm/web_pkg/debug/mercury_wasm_bg.wasm.d.ts @@ -41,7 +41,7 @@ export function signMessage(a: number, b: number, c: number, d: number): void; export function isEnclavePubkeyPartOfCoin(a: number, b: number, c: number): number; export function latestBackuptxPaysToUserpubkey(a: number, b: number, c: number, d: number): number; export function duplicateCoinToInitializedState(a: number, b: number, c: number): number; -export function validateSignatureScheme(a: number, b: number, c: number, d: number, e: number, f: number, g: number): number; +export function validateSignatureScheme(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number): number; export function getMockWallet(): number; export function rustsecp256k1zkp_v0_8_1_default_illegal_callback_fn(a: number, b: number): void; export function rustsecp256k1zkp_v0_8_1_default_error_callback_fn(a: number, b: number): void; diff --git a/wasm/web_pkg/release/mercury_wasm.d.ts b/wasm/web_pkg/release/mercury_wasm.d.ts index 95fe6817..b11793ae 100644 --- a/wasm/web_pkg/release/mercury_wasm.d.ts +++ b/wasm/web_pkg/release/mercury_wasm.d.ts @@ -267,12 +267,14 @@ export function duplicateCoinToInitializedState(walletJson: any, authPubkey: str * @param {any} transfer_msg * @param {any} statechain_info * @param {string} tx0_hex +* @param {number} current_blockheight * @param {number} fee_rate_tolerance * @param {number} current_fee_rate_sats_per_byte +* @param {number} lockheight_init * @param {number} interval * @returns {any} */ -export function validateSignatureScheme(transfer_msg: any, statechain_info: any, tx0_hex: string, fee_rate_tolerance: number, current_fee_rate_sats_per_byte: number, interval: number): any; +export function validateSignatureScheme(transfer_msg: any, statechain_info: any, tx0_hex: string, current_blockheight: number, fee_rate_tolerance: number, current_fee_rate_sats_per_byte: number, lockheight_init: number, interval: number): any; /** * @returns {any} */ @@ -322,7 +324,7 @@ export interface InitOutput { readonly isEnclavePubkeyPartOfCoin: (a: number, b: number, c: number) => number; readonly latestBackuptxPaysToUserpubkey: (a: number, b: number, c: number, d: number) => number; readonly duplicateCoinToInitializedState: (a: number, b: number, c: number) => number; - readonly validateSignatureScheme: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number; + readonly validateSignatureScheme: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number; readonly getMockWallet: () => number; readonly rustsecp256k1zkp_v0_8_1_default_illegal_callback_fn: (a: number, b: number) => void; readonly rustsecp256k1zkp_v0_8_1_default_error_callback_fn: (a: number, b: number) => void; diff --git a/wasm/web_pkg/release/mercury_wasm.js b/wasm/web_pkg/release/mercury_wasm.js index cb97e308..9152e74e 100644 --- a/wasm/web_pkg/release/mercury_wasm.js +++ b/wasm/web_pkg/release/mercury_wasm.js @@ -820,15 +820,17 @@ export function duplicateCoinToInitializedState(walletJson, authPubkey) { * @param {any} transfer_msg * @param {any} statechain_info * @param {string} tx0_hex +* @param {number} current_blockheight * @param {number} fee_rate_tolerance * @param {number} current_fee_rate_sats_per_byte +* @param {number} lockheight_init * @param {number} interval * @returns {any} */ -export function validateSignatureScheme(transfer_msg, statechain_info, tx0_hex, fee_rate_tolerance, current_fee_rate_sats_per_byte, interval) { +export function validateSignatureScheme(transfer_msg, statechain_info, tx0_hex, current_blockheight, fee_rate_tolerance, current_fee_rate_sats_per_byte, lockheight_init, interval) { const ptr0 = passStringToWasm0(tx0_hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const len0 = WASM_VECTOR_LEN; - const ret = wasm.validateSignatureScheme(addHeapObject(transfer_msg), addHeapObject(statechain_info), ptr0, len0, fee_rate_tolerance, current_fee_rate_sats_per_byte, interval); + const ret = wasm.validateSignatureScheme(addHeapObject(transfer_msg), addHeapObject(statechain_info), ptr0, len0, current_blockheight, fee_rate_tolerance, current_fee_rate_sats_per_byte, lockheight_init, interval); return takeObject(ret); } diff --git a/wasm/web_pkg/release/mercury_wasm_bg.wasm b/wasm/web_pkg/release/mercury_wasm_bg.wasm index a10ea2b2..5cf0f170 100644 Binary files a/wasm/web_pkg/release/mercury_wasm_bg.wasm and b/wasm/web_pkg/release/mercury_wasm_bg.wasm differ diff --git a/wasm/web_pkg/release/mercury_wasm_bg.wasm.d.ts b/wasm/web_pkg/release/mercury_wasm_bg.wasm.d.ts index e36e7657..a40f9970 100644 --- a/wasm/web_pkg/release/mercury_wasm_bg.wasm.d.ts +++ b/wasm/web_pkg/release/mercury_wasm_bg.wasm.d.ts @@ -41,7 +41,7 @@ export function signMessage(a: number, b: number, c: number, d: number): void; export function isEnclavePubkeyPartOfCoin(a: number, b: number, c: number): number; export function latestBackuptxPaysToUserpubkey(a: number, b: number, c: number, d: number): number; export function duplicateCoinToInitializedState(a: number, b: number, c: number): number; -export function validateSignatureScheme(a: number, b: number, c: number, d: number, e: number, f: number, g: number): number; +export function validateSignatureScheme(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number): number; export function getMockWallet(): number; export function rustsecp256k1zkp_v0_8_1_default_illegal_callback_fn(a: number, b: number): void; export function rustsecp256k1zkp_v0_8_1_default_error_callback_fn(a: number, b: number): void;