diff --git a/Cargo.lock b/Cargo.lock index 3728eb9..eea22c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -797,9 +797,9 @@ dependencies = [ [[package]] name = "diesel" -version = "2.3.3" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e7624a3bb9fffd82fff016be9a7f163d20e5a89eb8d28f9daaa6b30fff37500" +checksum = "0c415189028b232660655e4893e8bc25ca7aee8e96888db66d9edb400535456a" dependencies = [ "bitflags", "byteorder", @@ -828,9 +828,9 @@ dependencies = [ [[package]] name = "diesel_derives" -version = "2.3.4" +version = "2.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9daac6489a36e42570da165a10c424f3edcefdff70c5fd55e1847c23f3dd7562" +checksum = "8587cbca3c929fb198e7950d761d31ca72b80aa6e07c1b7bec5879d187720436" dependencies = [ "diesel_table_macro_syntax", "dsl_auto_type", @@ -841,9 +841,9 @@ dependencies = [ [[package]] name = "diesel_migrations" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee060f709c3e3b1cadd83fcd0f61711f7a8cf493348f758d3a1c1147d70b3c97" +checksum = "745fd255645f0f1135f9ec55c7b00e0882192af9683ab4731e4bba3da82b8f9c" dependencies = [ "diesel", "migrations_internals", @@ -4840,9 +4840,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", @@ -4851,9 +4851,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.34" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c" dependencies = [ "once_cell", "valuable", @@ -5671,9 +5671,9 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" [[package]] name = "winnow" -version = "0.7.13" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" +checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" dependencies = [ "memchr", ] diff --git a/Dockerfile.coordinator b/Dockerfile.coordinator index d942fc9..440b040 100644 --- a/Dockerfile.coordinator +++ b/Dockerfile.coordinator @@ -1,21 +1,16 @@ FROM rust:1.90-alpine AS chef RUN apk add --no-cache \ - musl-dev \ - pkgconfig \ - openssl-dev \ - openssl-libs-static \ - perl \ - make + musl-dev -FROM rust:1.90-alpine AS chef +RUN cargo install cargo-chef --locked WORKDIR /build FROM chef AS planner COPY Cargo.toml Cargo.lock ./ -COPY bin ./bin +COPY bin/coordinator-server ./bin/coordinator-server COPY crates ./crates RUN cargo chef prepare --recipe-path recipe.json @@ -24,6 +19,14 @@ FROM chef AS builder COPY --from=planner /build/recipe.json recipe.json + +RUN apk add --no-cache \ + pkgconfig \ + openssl-dev \ + openssl-libs-static \ + perl \ + make + RUN cargo chef cook --release --recipe-path recipe.json --features sysbundle COPY Cargo.toml Cargo.lock ./ diff --git a/bin/coordinator-frontend/package-lock.json b/bin/coordinator-frontend/package-lock.json index 5be6e99..6f8881d 100644 --- a/bin/coordinator-frontend/package-lock.json +++ b/bin/coordinator-frontend/package-lock.json @@ -8,12 +8,10 @@ "name": "miden_wallet", "version": "0.1.0", "dependencies": { - "@demox-labs/miden-sdk": "^0.11.11", - "@demox-labs/miden-wallet-adapter": "^0.8.0", - "@demox-labs/miden-wallet-adapter-base": "^0.8.0", - "@demox-labs/miden-wallet-adapter-miden": "^0.8.0", - "@demox-labs/miden-wallet-adapter-react": "^0.8.0", - "@demox-labs/miden-wallet-adapter-reactui": "^0.8.0", + "@demox-labs/miden-sdk": "^0.12.3", + "@demox-labs/miden-wallet-adapter": "^0.10.0", + "@demox-labs/miden-wallet-adapter-base": "^0.10.0", + "@demox-labs/miden-wallet-adapter-miden": "^0.10.0", "@reduxjs/toolkit": "^2.8.2", "framer-motion": "^12.23.12", "next": "15.4.5", @@ -49,12 +47,12 @@ } }, "node_modules/@demox-labs/miden-sdk": { - "version": "0.11.11", - "resolved": "https://registry.npmjs.org/@demox-labs/miden-sdk/-/miden-sdk-0.11.11.tgz", - "integrity": "sha512-HcKadGQQynW/UZrVLSAZsl3Luwt1d0Pmhkd/2MBbyJ0IoIN/tySsAx3f7XrmMSwX4RwUnM2tY5aeM/bf0V/ZEw==", + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/@demox-labs/miden-sdk/-/miden-sdk-0.12.3.tgz", + "integrity": "sha512-iHomtLaZrY1cb8FVevij9x2foXo33qxRnUNNszKDmdlvgEgt1XmZlZUP8+bb4OFPMJF5lRsJaLcfd5pODvF6JQ==", "license": "MIT*", "dependencies": { - "chai-as-promised": "^8.0.0", + "@rollup/plugin-typescript": "^12.3.0", "dexie": "^4.0.1", "glob": "^11.0.0" } @@ -141,15 +139,15 @@ } }, "node_modules/@demox-labs/miden-wallet-adapter": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@demox-labs/miden-wallet-adapter/-/miden-wallet-adapter-0.8.0.tgz", - "integrity": "sha512-CcGRreeUGki8OZY6emJPYElKq36eJnZATQKuQ5/SgVla+UbRrDQaYOHL67Di2GLJKt+WbL182DDg8z4/6Vc5Lw==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@demox-labs/miden-wallet-adapter/-/miden-wallet-adapter-0.10.0.tgz", + "integrity": "sha512-pCyV1vnhwNebBf8MEI6Tz6pbnMe5Kt9I/XiwOskA200o1wK1Sp7z8b3MdLnjyXNe7CXn3gJJFdBqzbU96vF1Lg==", "license": "MIT", "dependencies": { - "@demox-labs/miden-wallet-adapter-base": "^0.8.0", - "@demox-labs/miden-wallet-adapter-miden": "^0.8.0", - "@demox-labs/miden-wallet-adapter-react": "^0.8.0", - "@demox-labs/miden-wallet-adapter-reactui": "^0.8.0" + "@demox-labs/miden-wallet-adapter-base": "^0.10.0", + "@demox-labs/miden-wallet-adapter-miden": "^0.10.0", + "@demox-labs/miden-wallet-adapter-react": "^0.10.0", + "@demox-labs/miden-wallet-adapter-reactui": "^0.10.0" }, "peerDependencies": { "@types/react": "^19.0.0", @@ -159,21 +157,21 @@ } }, "node_modules/@demox-labs/miden-wallet-adapter-base": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@demox-labs/miden-wallet-adapter-base/-/miden-wallet-adapter-base-0.8.0.tgz", - "integrity": "sha512-U2cSyAVDem03/U8eob0i4b6W5ftv9QCId7pdMa/GXwuRrO6Tlxz7zoyZC21xtw0w3dX83nJ8eRErgTFxow25zA==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@demox-labs/miden-wallet-adapter-base/-/miden-wallet-adapter-base-0.10.0.tgz", + "integrity": "sha512-BLPJdIz1eq/s8iUOkwGttpo04ShyqExaflS14lmgnyhXEDevTs5xWAu3ipgrVNEf79gYNeh4AQ/KKC29DsVXcQ==", "license": "MIT", "dependencies": { "eventemitter3": "^5.0.1" } }, "node_modules/@demox-labs/miden-wallet-adapter-miden": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@demox-labs/miden-wallet-adapter-miden/-/miden-wallet-adapter-miden-0.8.0.tgz", - "integrity": "sha512-kuqOPqlam8Uf5ZYFaNohXTvPVeSql4g5vLtGKE8arPgqRo/THTJfsaLhMCq5akwDE7VCGFc1iLd6MSy4cLyWeQ==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@demox-labs/miden-wallet-adapter-miden/-/miden-wallet-adapter-miden-0.10.0.tgz", + "integrity": "sha512-yvZVNRBRY+lvYnyZ+I/VdPBNH9GrMEw6iG//7pztHTQSicxIC8mQZSFEoV1xWWvQglMlpycyZnDMM+R5zv2AwQ==", "license": "MIT", "dependencies": { - "@demox-labs/miden-wallet-adapter-base": "^0.8.0", + "@demox-labs/miden-wallet-adapter-base": "^0.10.0", "nanoid": "^5.0.9" }, "peerDependencies": { @@ -199,25 +197,25 @@ } }, "node_modules/@demox-labs/miden-wallet-adapter-react": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@demox-labs/miden-wallet-adapter-react/-/miden-wallet-adapter-react-0.8.0.tgz", - "integrity": "sha512-cZbE13Tiy7Nw2TdvXnkr7CkZQBVp8P43p9MJhwUgABDJjFsSb6a5PnBA4zV4RzNTAQUpF7UO8L5vF/Ju11p3sw==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@demox-labs/miden-wallet-adapter-react/-/miden-wallet-adapter-react-0.10.0.tgz", + "integrity": "sha512-498XMpvY5QyEDjYbS6CUjzgAuD7BZFL1LxYIWskIglK/TOEGWZEOINT+bsXgan4Bgd+ybfKcJNYY0aAmyPtc2A==", "license": "MIT", "dependencies": { - "@demox-labs/miden-wallet-adapter-base": "^0.8.0" + "@demox-labs/miden-wallet-adapter-base": "^0.10.0" }, "peerDependencies": { "react": "^19.1.1" } }, "node_modules/@demox-labs/miden-wallet-adapter-reactui": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@demox-labs/miden-wallet-adapter-reactui/-/miden-wallet-adapter-reactui-0.8.0.tgz", - "integrity": "sha512-2gFxnj4A1Tq2h2f/VOJ8TQi5QRWRGjqM/NJrAn34Jo2V88dZ6tPFPqgYcSysOXxhXPMOEwg7xAr4L3p1J6fulw==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@demox-labs/miden-wallet-adapter-reactui/-/miden-wallet-adapter-reactui-0.10.0.tgz", + "integrity": "sha512-SdHq7ic6S4GXFcuIg8mtSSS/iFQeLOeBqJYlXh3LrHMGfKVQll9nRhGT1ZvJlXfQdC3/aX3fCNDqsgNzfosTjg==", "license": "MIT", "dependencies": { - "@demox-labs/miden-wallet-adapter-base": "^0.8.0", - "@demox-labs/miden-wallet-adapter-react": "^0.8.0" + "@demox-labs/miden-wallet-adapter-base": "^0.10.0", + "@demox-labs/miden-wallet-adapter-react": "^0.10.0" }, "peerDependencies": { "@types/react": "^19.0.0", @@ -1623,6 +1621,66 @@ } } }, + "node_modules/@rollup/plugin-typescript": { + "version": "12.3.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-12.3.0.tgz", + "integrity": "sha512-7DP0/p7y3t67+NabT9f8oTBFE6gGkto4SA6Np2oudYmZE/m1dt8RB0SjL1msMxFpLo631qjRCcBlAbq1ml/Big==", + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^5.1.0", + "resolve": "^1.22.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.14.0||^3.0.0||^4.0.0", + "tslib": "*", + "typescript": ">=3.7.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + }, + "tslib": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.3.0.tgz", + "integrity": "sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/@rtsao/scc": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz", @@ -1697,7 +1755,6 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", - "dev": true, "license": "MIT" }, "node_modules/@types/json-schema": { @@ -2919,6 +2976,16 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "license": "MIT" }, + "node_modules/baseline-browser-mapping": { + "version": "2.8.32", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.32.tgz", + "integrity": "sha512-OPz5aBThlyLFgxyhdwf/s2+8ab3OvT7AdTNvKHBwpXomIYeXqpUUuT8LrdtxZSsWJ4R4CU1un4XGh5Ez3nlTpw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.js" + } + }, "node_modules/binary-extensions": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", @@ -2955,9 +3022,9 @@ } }, "node_modules/browserslist": { - "version": "4.25.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.25.1.tgz", - "integrity": "sha512-KGj0KoOMXLpSNkkEI6Z6mShmQy0bc1I+T7K9N81k4WWMrfz+6fQ6es80B/YLAeRoKvjYE1YSHHOW1qe9xIVzHw==", + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.0.tgz", + "integrity": "sha512-tbydkR/CxfMwelN0vwdP/pLkDwyAASZ+VfWm4EOwlB6SWhx1sYnWLqo8N5j0rAzPfzfRaxt0mM/4wPU/Su84RQ==", "dev": true, "funding": [ { @@ -2975,10 +3042,11 @@ ], "license": "MIT", "dependencies": { - "caniuse-lite": "^1.0.30001726", - "electron-to-chromium": "^1.5.173", - "node-releases": "^2.0.19", - "update-browserslist-db": "^1.1.3" + "baseline-browser-mapping": "^2.8.25", + "caniuse-lite": "^1.0.30001754", + "electron-to-chromium": "^1.5.249", + "node-releases": "^2.0.27", + "update-browserslist-db": "^1.1.4" }, "bin": { "browserslist": "cli.js" @@ -3065,9 +3133,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001731", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001731.tgz", - "integrity": "sha512-lDdp2/wrOmTRWuoB5DpfNkC0rJDU8DqRa6nYL6HK6sytw70QMopt/NIc/9SM7ylItlBWfACXk0tEn37UWM/+mg==", + "version": "1.0.30001757", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001757.tgz", + "integrity": "sha512-r0nnL/I28Zi/yjk1el6ilj27tKcdjLsNqAOZr0yVjWPrSQyHgKI2INaEWw21bAQSv2LXRt1XuCS/GomNpWOxsQ==", "funding": [ { "type": "opencollective", @@ -3084,28 +3152,6 @@ ], "license": "CC-BY-4.0" }, - "node_modules/chai": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/chai/-/chai-6.0.1.tgz", - "integrity": "sha512-/JOoU2//6p5vCXh00FpNgtlw0LjvhGttaWc+y7wpW9yjBm3ys0dI8tSKZxIOgNruz5J0RleccatSIC3uxEZP0g==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/chai-as-promised": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-8.0.2.tgz", - "integrity": "sha512-1GadL+sEJVLzDjcawPM4kjfnL+p/9vrxiEUonowKOAzvVg0PixJUdtuDzdkDeQhK3zfOE76GqGkZIQ7/Adcrqw==", - "license": "MIT", - "dependencies": { - "check-error": "^2.1.1" - }, - "peerDependencies": { - "chai": ">= 2.1.2 < 7" - } - }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -3123,15 +3169,6 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/check-error": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", - "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==", - "license": "MIT", - "engines": { - "node": ">= 16" - } - }, "node_modules/chokidar": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", @@ -3485,9 +3522,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.192", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.192.tgz", - "integrity": "sha512-rP8Ez0w7UNw/9j5eSXCe10o1g/8B1P5SM90PCCMVkIRQn2R0LEHWz4Eh9RnxkniuDe1W0cTSOB3MLlkTGDcuCg==", + "version": "1.5.262", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.262.tgz", + "integrity": "sha512-NlAsMteRHek05jRUxUR0a5jpjYq9ykk6+kO0yRaMi5moe7u0fVIOeQ3Y30A8dIiWFBNUoQGi1ljb1i5VtS9WQQ==", "dev": true, "license": "ISC" }, @@ -4177,6 +4214,12 @@ "node": ">=4.0" } }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "license": "MIT" + }, "node_modules/esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -5463,14 +5506,18 @@ "license": "MIT" }, "node_modules/loader-runner": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", - "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.1.tgz", + "integrity": "sha512-IWqP2SCPhyVFTBtRcgMHdzlf9ul25NwaFx4wCEH/KjAXuuHY4yNjvPXsBokp8jCB936PyWRaPKUNh8NvylLp2Q==", "dev": true, "license": "MIT", "peer": true, "engines": { "node": ">=6.11.5" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" } }, "node_modules/locate-path": { @@ -5775,9 +5822,9 @@ } }, "node_modules/node-releases": { - "version": "2.0.19", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", - "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", + "version": "2.0.27", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", + "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==", "dev": true, "license": "MIT" }, @@ -6578,9 +6625,9 @@ "license": "MIT" }, "node_modules/schema-utils": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.2.tgz", - "integrity": "sha512-Gn/JaSk/Mt9gYubxTtSn/QCV4em9mpAPiR1rqy/Ocu19u/G9J5WWdNoUT4SiV6mFC3y6cxyFcFwdzPM3FgxGAQ==", + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.3.tgz", + "integrity": "sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==", "dev": true, "license": "MIT", "dependencies": { @@ -7345,26 +7392,30 @@ } }, "node_modules/tapable": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.2.tgz", - "integrity": "sha512-Re10+NauLTMCudc7T5WLFLAwDhQ0JWdrMK+9B2M8zR5hRExKmsRDCBA7/aV/pNJFltmBFO5BAMlQFi/vq3nKOg==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.0.tgz", + "integrity": "sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==", "dev": true, "license": "MIT", "peer": true, "engines": { "node": ">=6" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" } }, "node_modules/terser": { - "version": "5.43.1", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.43.1.tgz", - "integrity": "sha512-+6erLbBm0+LROX2sPXlUYx/ux5PyE9K/a92Wrt6oA+WDAoFTdpHE5tCYCI5PNzq2y8df4rA+QgHLJuR4jNymsg==", + "version": "5.44.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.44.1.tgz", + "integrity": "sha512-t/R3R/n0MSwnnazuPpPNVO60LX0SKL45pyl9YlvxIdkH0Of7D5qM2EVe+yASRIlY5pZ73nclYJfNANGWPwFDZw==", "dev": true, "license": "BSD-2-Clause", "peer": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", - "acorn": "^8.14.0", + "acorn": "^8.15.0", "commander": "^2.20.0", "source-map-support": "~0.5.20" }, @@ -7701,9 +7752,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz", - "integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.4.tgz", + "integrity": "sha512-q0SPT4xyU84saUX+tomz1WLkxUbuaJnR1xWt17M7fJtEJigJeWUNGUqrauFXsHnqev9y9JTRGwk13tFBuKby4A==", "dev": true, "funding": [ { @@ -7772,9 +7823,9 @@ } }, "node_modules/webpack": { - "version": "5.101.1", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.101.1.tgz", - "integrity": "sha512-rHY3vHXRbkSfhG6fH8zYQdth/BtDgXXuR2pHF++1f/EBkI8zkgM5XWfsC3BvOoW9pr1CvZ1qQCxhCEsbNgT50g==", + "version": "5.103.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.103.0.tgz", + "integrity": "sha512-HU1JOuV1OavsZ+mfigY0j8d1TgQgbZ6M+J75zDkpEAwYeXjWSqrGJtgnPblJjd/mAyTNQ7ygw0MiKOn6etz8yw==", "dev": true, "license": "MIT", "peer": true, @@ -7787,7 +7838,7 @@ "@webassemblyjs/wasm-parser": "^1.14.1", "acorn": "^8.15.0", "acorn-import-phases": "^1.0.3", - "browserslist": "^4.24.0", + "browserslist": "^4.26.3", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.17.3", "es-module-lexer": "^1.2.1", @@ -7796,13 +7847,13 @@ "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.2.11", "json-parse-even-better-errors": "^2.3.1", - "loader-runner": "^4.2.0", + "loader-runner": "^4.3.1", "mime-types": "^2.1.27", "neo-async": "^2.6.2", - "schema-utils": "^4.3.2", - "tapable": "^2.1.1", + "schema-utils": "^4.3.3", + "tapable": "^2.3.0", "terser-webpack-plugin": "^5.3.11", - "watchpack": "^2.4.1", + "watchpack": "^2.4.4", "webpack-sources": "^3.3.3" }, "bin": { diff --git a/bin/coordinator-frontend/package.json b/bin/coordinator-frontend/package.json index 429d771..c122cb5 100644 --- a/bin/coordinator-frontend/package.json +++ b/bin/coordinator-frontend/package.json @@ -9,12 +9,10 @@ "lint": "next lint" }, "dependencies": { - "@demox-labs/miden-sdk": "^0.11.11", - "@demox-labs/miden-wallet-adapter": "^0.8.0", - "@demox-labs/miden-wallet-adapter-base": "^0.8.0", - "@demox-labs/miden-wallet-adapter-miden": "^0.8.0", - "@demox-labs/miden-wallet-adapter-react": "^0.8.0", - "@demox-labs/miden-wallet-adapter-reactui": "^0.8.0", + "@demox-labs/miden-sdk": "^0.12.3", + "@demox-labs/miden-wallet-adapter": "^0.10.0", + "@demox-labs/miden-wallet-adapter-base": "^0.10.0", + "@demox-labs/miden-wallet-adapter-miden": "^0.10.0", "@reduxjs/toolkit": "^2.8.2", "framer-motion": "^12.23.12", "next": "15.4.5", @@ -36,4 +34,4 @@ "tailwindcss": "^3.4.0", "typescript": "^5" } -} +} \ No newline at end of file diff --git a/bin/coordinator-frontend/src/app/dashboard/components/PendingActions.tsx b/bin/coordinator-frontend/src/app/dashboard/components/PendingActions.tsx index 930949b..e546b14 100644 --- a/bin/coordinator-frontend/src/app/dashboard/components/PendingActions.tsx +++ b/bin/coordinator-frontend/src/app/dashboard/components/PendingActions.tsx @@ -6,9 +6,9 @@ import media from "../../../../public/media"; import { useAppSelector, useAppDispatch } from "@/store/hooks"; import PendingTransactionDetails from "@/interactions/PendingTransactionDetails"; import { AnimatePresence, motion } from "framer-motion"; -import { TransactionRequest, TransactionSummary, SigningInputs } from "@demox-labs/miden-sdk"; +import { TransactionRequest, TransactionSummary, SigningInputs, NoteFile } from "@demox-labs/miden-sdk"; import { useMidenClient } from "../../../contexts/MidenClientContext"; -import { fetchPendingTransactions, fetchConfirmedTransactions} from "../../../services/transactionApi"; +import { fetchPendingTransactions, fetchConfirmedTransactions } from "../../../services/transactionApi"; import { addSignatureThunk } from "../../../services/signatureApi"; import { useWallet } from "@demox-labs/miden-wallet-adapter"; import { PendingActionsProps, DecodedTransaction, WebClient } from "@/types"; @@ -64,7 +64,8 @@ const getReceiveTransactionAmount = async (noteId: string, noteIdFileBytes: stri if (!inputNoteRecord) { if (noteIdFileBytes) { const noteBytes = Uint8Array.fromBase64(noteIdFileBytes); - await webClient.importNoteFile(noteBytes); + const noteFile = NoteFile.deserialize(noteBytes); + await webClient.importNoteFile(noteFile); inputNoteRecord = await webClient.getInputNote(noteId); } else { console.error("No note file bytes to import"); @@ -92,7 +93,7 @@ const getReceiveTransactionAmount = async (noteId: string, noteIdFileBytes: stri const PendingActions: React.FC = ({ threshold, fixedHeight = false }) => { const router = useRouter(); - const { wallet, accountId, connected, signBytes } = useWallet(); + const { wallet, address, connected, signBytes } = useWallet(); const { handle, isInitialized } = useMidenClient(); const dispatch = useAppDispatch(); const { pendingTransactions, loading: transactionsLoading } = useAppSelector( @@ -114,7 +115,7 @@ const PendingActions: React.FC = ({ threshold, fixedHeight }, [transactionsLoading, hasLoadedOnce]); const handleSign = async (txReqFromApi: string, txId: string) => { - if (!wallet || !accountId || !connected) { + if (!wallet || !address || !connected) { setShowWalletErrorModal(true); setTimeout(() => { setShowWalletErrorModal(false); @@ -157,7 +158,7 @@ const PendingActions: React.FC = ({ threshold, fixedHeight try { const signatureData = { tx_id: txId, - approver: accountId, + approver: address, signature: signatureBase64, }; diff --git a/bin/coordinator-frontend/src/app/dashboard/components/RecentTransactions.tsx b/bin/coordinator-frontend/src/app/dashboard/components/RecentTransactions.tsx index 30a1366..3ccaa50 100644 --- a/bin/coordinator-frontend/src/app/dashboard/components/RecentTransactions.tsx +++ b/bin/coordinator-frontend/src/app/dashboard/components/RecentTransactions.tsx @@ -5,7 +5,7 @@ import { useRouter } from "next/navigation"; import media from "../../../../public/media"; import { useAppSelector } from "@/store/hooks"; import { DecodedTransaction, RecentTransactionsProps } from "@/types"; -import { TransactionRequest } from "@demox-labs/miden-sdk"; +import { TransactionRequest, NoteFile } from "@demox-labs/miden-sdk"; import { useMidenClient } from "../../../contexts/MidenClientContext"; const getTransactionType = ( @@ -79,7 +79,8 @@ const getReceiveTransactionAmount = async (noteId: string, noteIdFileBytes: stri if (!inputNoteRecord) { if (noteIdFileBytes) { const noteBytes = Uint8Array.fromBase64(noteIdFileBytes); - await webClient.importNoteFile(noteBytes); + const noteFile = NoteFile.deserialize(noteBytes); + await webClient.importNoteFile(noteFile); // Retry getting the note inputNoteRecord = await webClient.getInputNote(noteId); diff --git a/bin/coordinator-frontend/src/app/dashboard/components/Taskbar.tsx b/bin/coordinator-frontend/src/app/dashboard/components/Taskbar.tsx index bcf96d5..ce8322a 100644 --- a/bin/coordinator-frontend/src/app/dashboard/components/Taskbar.tsx +++ b/bin/coordinator-frontend/src/app/dashboard/components/Taskbar.tsx @@ -70,7 +70,7 @@ const TaskBar: React.FC = () => { const walletAddress = Address.fromBech32(currentWalletId); const walletAccountId = walletAddress.accountId(); - const convertedWalletId = walletAccountId.toBech32(NetworkId.Testnet, AccountInterface.Unspecified); + const convertedWalletId = walletAccountId.toBech32(NetworkId.Testnet, AccountInterface.BasicWallet); return convertedWalletId; diff --git a/bin/coordinator-frontend/src/app/dashboard/settings/components/General.tsx b/bin/coordinator-frontend/src/app/dashboard/settings/components/General.tsx index 1efcf38..4be61c7 100644 --- a/bin/coordinator-frontend/src/app/dashboard/settings/components/General.tsx +++ b/bin/coordinator-frontend/src/app/dashboard/settings/components/General.tsx @@ -17,7 +17,7 @@ const General = () => { const walletAccountId = walletAddress.accountId(); const convertedWalletId = walletAccountId.toBech32( NetworkId.Testnet, - AccountInterface.Unspecified + AccountInterface.BasicWallet ); return convertedWalletId; } catch (error) { diff --git a/bin/coordinator-frontend/src/components/DynamicWalletButton.tsx b/bin/coordinator-frontend/src/components/DynamicWalletButton.tsx index b584ebe..7ed6820 100644 --- a/bin/coordinator-frontend/src/components/DynamicWalletButton.tsx +++ b/bin/coordinator-frontend/src/components/DynamicWalletButton.tsx @@ -1,9 +1,10 @@ 'use client'; import React, { useState, useEffect } from 'react'; +import { WalletAdapterNetwork } from '@demox-labs/miden-wallet-adapter-base'; const DynamicWalletButton: React.FC = () => { - const [WalletMultiButton, setWalletMultiButton] = useState | null>(null); + const [WalletMultiButton, setWalletMultiButton] = useState | null>(null); const [isLoading, setIsLoading] = useState(true); useEffect(() => { @@ -40,7 +41,7 @@ const DynamicWalletButton: React.FC = () => { } return ( - + ); }; diff --git a/bin/coordinator-frontend/src/components/Providers.tsx b/bin/coordinator-frontend/src/components/Providers.tsx index f4c0b08..180abe1 100644 --- a/bin/coordinator-frontend/src/components/Providers.tsx +++ b/bin/coordinator-frontend/src/components/Providers.tsx @@ -9,6 +9,7 @@ import { MidenWalletAdapter, PrivateDataPermission, } from '@demox-labs/miden-wallet-adapter'; +import { WalletAdapterNetwork } from '@demox-labs/miden-wallet-adapter-base'; import { MidenSdkProvider } from '../hooks/useMidenSdk'; import { MidenClientProvider } from '../contexts/MidenClientContext'; @@ -48,9 +49,10 @@ export function Providers({ children }: { children: React.ReactNode }) { - + {children} diff --git a/bin/coordinator-frontend/src/components/SimpleWalletButton.tsx b/bin/coordinator-frontend/src/components/SimpleWalletButton.tsx index aae957f..2dc0002 100644 --- a/bin/coordinator-frontend/src/components/SimpleWalletButton.tsx +++ b/bin/coordinator-frontend/src/components/SimpleWalletButton.tsx @@ -2,6 +2,7 @@ import React from 'react'; import { WalletMultiButton } from '@demox-labs/miden-wallet-adapter'; +import { WalletAdapterNetwork } from '@demox-labs/miden-wallet-adapter-base'; const SimpleWalletButton: React.FC = () => { return ( @@ -12,7 +13,7 @@ const SimpleWalletButton: React.FC = () => {

Click the button below to connect your Miden wallet

- + ); }; diff --git a/bin/coordinator-frontend/src/components/WalletConnection.tsx b/bin/coordinator-frontend/src/components/WalletConnection.tsx index 6ad4949..f0f30e4 100644 --- a/bin/coordinator-frontend/src/components/WalletConnection.tsx +++ b/bin/coordinator-frontend/src/components/WalletConnection.tsx @@ -4,6 +4,7 @@ import React from 'react'; import { motion } from 'framer-motion'; import { WalletMultiButton } from '@demox-labs/miden-wallet-adapter'; import { useWallet } from '@demox-labs/miden-wallet-adapter'; +import { WalletAdapterNetwork } from '@demox-labs/miden-wallet-adapter-base'; import { WalletConnectionProps } from '@/types'; export const WalletConnection: React.FC = ({ className = '' }) => { @@ -27,6 +28,7 @@ export const WalletConnection: React.FC = ({ className =
diff --git a/bin/coordinator-frontend/src/components/WalletStatus.tsx b/bin/coordinator-frontend/src/components/WalletStatus.tsx index cc97b02..c8cab04 100644 --- a/bin/coordinator-frontend/src/components/WalletStatus.tsx +++ b/bin/coordinator-frontend/src/components/WalletStatus.tsx @@ -4,6 +4,7 @@ import React from 'react'; import { motion } from 'framer-motion'; import { useWallet } from '@demox-labs/miden-wallet-adapter'; import { WalletMultiButton } from '@demox-labs/miden-wallet-adapter'; +import { WalletAdapterNetwork } from '@demox-labs/miden-wallet-adapter-base'; interface WalletStatusProps { className?: string; @@ -60,6 +61,7 @@ export const WalletStatus: React.FC = ({ {showButton && ( )} diff --git a/bin/coordinator-frontend/src/hooks/useFungibleAssets.ts b/bin/coordinator-frontend/src/hooks/useFungibleAssets.ts index 45acf54..c97e99d 100644 --- a/bin/coordinator-frontend/src/hooks/useFungibleAssets.ts +++ b/bin/coordinator-frontend/src/hooks/useFungibleAssets.ts @@ -45,7 +45,7 @@ export const useFungibleAssets = () => { const assets = assetVault.fungibleAssets(); const assetsWithBalance = assets.map(asset => { - const faucetId = asset.faucetId().toBech32(NetworkId.Testnet, AccountInterface.Unspecified); + const faucetId = asset.faucetId().toBech32(NetworkId.Testnet, AccountInterface.BasicWallet); const balance = assetVault.getBalance(asset.faucetId()).toString(); return { faucetId, balance }; }); diff --git a/bin/coordinator-frontend/src/hooks/useMidenSdk.tsx b/bin/coordinator-frontend/src/hooks/useMidenSdk.tsx index e66fd19..6cedf6d 100644 --- a/bin/coordinator-frontend/src/hooks/useMidenSdk.tsx +++ b/bin/coordinator-frontend/src/hooks/useMidenSdk.tsx @@ -46,59 +46,13 @@ export const MidenSdkProvider: FC = ({ children }) => { return await Miden.WebClient.createClient('https://rpc.testnet.miden.io'); }, [Miden]); - const createFaucet = useCallback( - async ( - client: unknown, - storageMode: unknown, - nonFungible: boolean, - assetSymbol: string, - decimals: number, - totalSupply: bigint - ): Promise => { - if (!Miden || !client) - throw new Error('Miden SDK or client not initialized'); - - try { - // Cast client to any to use dynamic SDK methods - const webClient = client as any; - - // First sync the client state to ensure we're up to date - await webClient.syncState(); - - // Create the faucet with provided configuration - const faucet = await webClient.newFaucet( - storageMode, - nonFungible, - assetSymbol, - decimals, - totalSupply - ); - - // Get the faucet ID before any other operations - const newFaucetId = faucet.id(); - - // Add a delay to ensure proper initialization - await new Promise((resolve) => setTimeout(resolve, 2000)); - - // Sync state again after faucet creation - await webClient.syncState(); - - return newFaucetId; - } catch (error) { - console.error('Error creating faucet:', error); - throw error; - } - }, - [Miden] - ); - useEffect(() => { loadSdk(); }, [loadSdk]); return ( {children} diff --git a/bin/coordinator-frontend/src/interactions/ReceiveFundTransfer.tsx b/bin/coordinator-frontend/src/interactions/ReceiveFundTransfer.tsx index cd507fd..485cc14 100644 --- a/bin/coordinator-frontend/src/interactions/ReceiveFundTransfer.tsx +++ b/bin/coordinator-frontend/src/interactions/ReceiveFundTransfer.tsx @@ -3,6 +3,7 @@ import { useState, useEffect } from "react"; import { useMidenClient } from "@/contexts/MidenClientContext"; import { useDispatch, useSelector } from "react-redux"; import { AppDispatch } from "@/store"; +import { NoteFile } from "@demox-labs/miden-sdk"; import { proposeTransactionWithTxBzThunk, fetchPendingTransactions, fetchConfirmedTransactions, getConsumableNotesThunk } from "../services/transactionApi"; const getReceiveTransactionAmount = async (noteId: string, noteIdFileBytes: string, webClient: any): Promise => { @@ -20,7 +21,8 @@ const getReceiveTransactionAmount = async (noteId: string, noteIdFileBytes: stri if (!inputNoteRecord) { if (noteIdFileBytes) { const noteBytes = Uint8Array.fromBase64(noteIdFileBytes); - await webClient.importNoteFile(noteBytes); + const noteFile = NoteFile.deserialize(noteBytes); + await webClient.importNoteFile(noteFile); inputNoteRecord = await webClient.getInputNote(noteId); } else { console.error("No note file bytes to import"); diff --git a/bin/coordinator-frontend/src/types/hooks.ts b/bin/coordinator-frontend/src/types/hooks.ts index d5564c6..9a100f5 100644 --- a/bin/coordinator-frontend/src/types/hooks.ts +++ b/bin/coordinator-frontend/src/types/hooks.ts @@ -92,14 +92,6 @@ export interface MidenSdkContextState { isLoading: boolean; Miden: typeof MidenSDK | null; createClient: () => Promise; - createFaucet: ( - client: MidenClient, - storageMode: StorageMode, - nonFungible: boolean, - assetSymbol: string, - decimals: number, - totalSupply: bigint - ) => Promise; } // Miden SDK class type diff --git a/bin/coordinator-server/src/routes.rs b/bin/coordinator-server/src/routes.rs index 9fda75e..ad692ad 100644 --- a/bin/coordinator-server/src/routes.rs +++ b/bin/coordinator-server/src/routes.rs @@ -3,7 +3,8 @@ use itertools::Itertools; use miden_client::{ Word, account::AccountId, - address::{Address, AddressId}, + address::{Address, AddressId, NetworkId}, + auth::Signature, utils::{Deserializable, Serializable}, }; use miden_multisig_coordinator_engine::{ @@ -66,22 +67,14 @@ pub async fn create_multisig_account( let approvers = approvers .iter() .map(AsRef::as_ref) - .map(Address::decode) - .map(|res| { - res.map_err(|e| AppError::other(format!("failed to decode address: {e}"))) - }) - .map_ok(|(network_id, address)| { + .map(decode_account_address) + .map_ok(|(network_id, account_id)| { engine_network_id .eq(&network_id) - .then_some(address) + .then_some(account_id) .ok_or(AppError::InvalidNetworkId) }) .map(Result::flatten) - .map_ok(|a| match a.id() { - AddressId::AccountId(id) => Ok(id), - _ => Err(AppError::other("approver address must be account id")), - }) - .map(Result::flatten) .try_collect() .inspect_err(|e| tracing::error!("failed to decode approvers: {e}"))?; @@ -125,13 +118,11 @@ pub async fn propose_multisig_tx( ) -> Result, AppError> { let AppDissolved { engine } = app.dissolve(); - let ProposeMultisigTxRequestPayloadDissolved { - multisig_account_address: address, - tx_request, - } = payload.dissolve(); + let ProposeMultisigTxRequestPayloadDissolved { multisig_account_address, tx_request } = + payload.dissolve(); let request = { - let account_id_address = AccountId::from_bech32(&address) + let account_id = decode_account_address(&multisig_account_address) .map(|(network_id, account_id)| { engine.network_id().eq(&network_id).then_some(account_id) })? @@ -141,7 +132,7 @@ pub async fn propose_multisig_tx( .map_err(|_| AppError::InvalidTransactionRequest)?; ProposeMultisigTxRequest::builder() - .multisig_account_id(account_id_address) + .multisig_account_id(account_id) .tx_request(tx_request) .build() }; @@ -167,14 +158,17 @@ pub async fn add_signature( let AddSignatureRequestPayloadDissolved { tx_id, approver, signature } = payload.dissolve(); let request = { - let approver = AccountId::from_bech32(&approver) + let approver = decode_account_address(&approver) .map(|(network_id, account_id)| { engine.network_id().eq(&network_id).then_some(account_id) })? .ok_or(AppError::InvalidNetworkId)?; - let signature = - Deserializable::read_from_bytes(&signature).map_err(|_| AppError::InvalidSignature)?; + let Signature::RpoFalcon512(signature) = + Signature::read_from_bytes(&signature).map_err(|_| AppError::InvalidSignature)? + else { + return Err(AppError::InvalidSignature); + }; AddSignatureRequest::builder() .tx_id(tx_id.into()) @@ -201,7 +195,7 @@ pub async fn list_consumable_notes( let account_id = address .as_deref() - .map(AccountId::from_bech32) + .map(decode_account_address) .transpose()? .map(|(network_id, account_id)| { engine @@ -236,7 +230,7 @@ pub async fn get_multisig_account_details( let GetMultisigAccountDetailsRequestPayloadDissolved { multisig_account_address } = payload.dissolve(); - let multisig_account_id = AccountId::from_bech32(&multisig_account_address) + let multisig_account_id = decode_account_address(&multisig_account_address) .map(|(network_id, account_id)| engine.network_id().eq(&network_id).then_some(account_id))? .ok_or(AppError::InvalidNetworkId)?; @@ -266,7 +260,7 @@ pub async fn list_multisig_approvers( let ListMultisigApproverRequestPayloadDissolved { multisig_account_address } = payload.dissolve(); - let multisig_account_id = AccountId::from_bech32(&multisig_account_address) + let multisig_account_id = decode_account_address(&multisig_account_address) .map(|(network_id, account_id)| engine.network_id().eq(&network_id).then_some(account_id))? .ok_or(AppError::InvalidNetworkId)?; @@ -292,7 +286,7 @@ pub async fn get_multisig_tx_stats( let GetMultisigTxStatsRequestPayloadDissolved { multisig_account_address } = payload.dissolve(); - let multisig_account_id = AccountId::from_bech32(&multisig_account_address) + let multisig_account_id = decode_account_address(&multisig_account_address) .map(|(network_id, account_id)| engine.network_id().eq(&network_id).then_some(account_id))? .ok_or(AppError::InvalidNetworkId)?; @@ -320,7 +314,7 @@ pub async fn list_multisig_tx( tx_status_filter, } = payload.dissolve(); - let multisig_account_id = AccountId::from_bech32(&multisig_account_address) + let multisig_account_id = decode_account_address(&multisig_account_address) .map(|(network_id, account_id)| engine.network_id().eq(&network_id).then_some(account_id))? .ok_or(AppError::InvalidNetworkId)?; @@ -344,3 +338,13 @@ pub async fn list_multisig_tx( Ok(Json(response)) } + +fn decode_account_address(address: &str) -> Result<(NetworkId, AccountId), AppError> { + let (network_id, address) = Address::decode(address) + .map_err(|e| AppError::other(format!("failed to decode address: {e}")))?; + + match address.id() { + AddressId::AccountId(account_id) => Ok((network_id, account_id)), + _ => Err(AppError::other("address must be account id")), + } +}