diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c5191bb --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "midnight-dapp-connector-api"] + path = midnight-dapp-connector-api + url = git@github.com:midnightntwrk/midnight-dapp-connector-api.git diff --git a/midnight-dapp-connector-api b/midnight-dapp-connector-api new file mode 160000 index 0000000..78e087c --- /dev/null +++ b/midnight-dapp-connector-api @@ -0,0 +1 @@ +Subproject commit 78e087cc1380a39ffcc5d30130613c071d95ad8f diff --git a/package-lock.json b/package-lock.json index bc7039f..40901b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,8 +12,8 @@ ], "dependencies": { "@bitcoin-js/tiny-secp256k1-asmjs": "^2.2.4", - "@midnight-ntwrk/compact-runtime": "0.8.1", - "@midnight-ntwrk/dapp-connector-api": "3.0.0", + "@midnight-ntwrk/compact-runtime": "0.9.0", + "@midnight-ntwrk/dapp-connector-api": "file:./midnight-dapp-connector-api", "@midnight-ntwrk/ledger": "4.0.0", "@midnight-ntwrk/midnight-js-contracts": "2.0.2", "@midnight-ntwrk/midnight-js-fetch-zk-config-provider": "2.0.2", @@ -267,6 +267,44 @@ "node": ">=14.17" } }, + "midnight-dapp-connector-api": { + "name": "@midnight-ntwrk/dapp-connector-api", + "version": "4.0.0-beta.1", + "license": "Apache-2.0", + "devDependencies": { + "@eslint/js": "^9.18.0", + "@rollup/plugin-commonjs": "^29.0.0", + "@rollup/plugin-node-resolve": "^16.0.0", + "@rollup/plugin-typescript": "^12.1.2", + "@tsconfig/node22": "^22.0.0", + "eslint": "^9.18.0", + "eslint-config-prettier": "^10.0.1", + "eslint-plugin-prettier": "^5.2.1", + "prettier": "^3.4.2", + "rollup": "^4.30.1", + "tslib": "^2.8.1", + "typedoc": "^0.28.0", + "typedoc-plugin-markdown": "^4.4.1", + "typescript": "^5.7.3", + "typescript-eslint": "^8.20.0" + } + }, + "midnight-dapp-connector-api/node_modules/eslint-config-prettier": { + "version": "10.1.8", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz", + "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==", + "dev": true, + "license": "MIT", + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "funding": { + "url": "https://opencollective.com/eslint-config-prettier" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, "node_modules/@alloc/quick-lru": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", @@ -1509,6 +1547,62 @@ "tslib": "2" } }, + "node_modules/@gerrit0/mini-shiki": { + "version": "3.19.0", + "resolved": "https://registry.npmjs.org/@gerrit0/mini-shiki/-/mini-shiki-3.19.0.tgz", + "integrity": "sha512-ZSlWfLvr8Nl0T4iA3FF/8VH8HivYF82xQts2DY0tJxZd4wtXJ8AA0nmdW9lmO4hlrh3f9xNwEPtOgqETPqKwDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/engine-oniguruma": "^3.19.0", + "@shikijs/langs": "^3.19.0", + "@shikijs/themes": "^3.19.0", + "@shikijs/types": "^3.19.0", + "@shikijs/vscode-textmate": "^10.0.2" + } + }, + "node_modules/@gerrit0/mini-shiki/node_modules/@shikijs/engine-oniguruma": { + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.20.0.tgz", + "integrity": "sha512-Yx3gy7xLzM0ZOjqoxciHjA7dAt5tyzJE3L4uQoM83agahy+PlW244XJSrmJRSBvGYELDhYXPacD4R/cauV5bzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.20.0", + "@shikijs/vscode-textmate": "^10.0.2" + } + }, + "node_modules/@gerrit0/mini-shiki/node_modules/@shikijs/langs": { + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-3.20.0.tgz", + "integrity": "sha512-le+bssCxcSHrygCWuOrYJHvjus6zhQ2K7q/0mgjiffRbkhM4o1EWu2m+29l0yEsHDbWaWPNnDUTRVVBvBBeKaA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.20.0" + } + }, + "node_modules/@gerrit0/mini-shiki/node_modules/@shikijs/themes": { + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-3.20.0.tgz", + "integrity": "sha512-U1NSU7Sl26Q7ErRvJUouArxfM2euWqq1xaSrbqMu2iqa+tSp0D1Yah8216sDYbdDHw4C8b75UpE65eWorm2erQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.20.0" + } + }, + "node_modules/@gerrit0/mini-shiki/node_modules/@shikijs/types": { + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.20.0.tgz", + "integrity": "sha512-lhYAATn10nkZcBQ0BlzSbJA3wcmL5MXUUF8d2Zzon6saZDlToKaiRX60n2+ZaHJCmXEcZRWNzn+k9vplr8Jhsw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/vscode-textmate": "^10.0.2", + "@types/hast": "^3.0.4" + } + }, "node_modules/@graphql-eslint/eslint-plugin": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@graphql-eslint/eslint-plugin/-/eslint-plugin-4.4.0.tgz", @@ -2749,9 +2843,9 @@ } }, "node_modules/@midnight-ntwrk/compact-runtime": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@midnight-ntwrk/compact-runtime/-/compact-runtime-0.8.1.tgz", - "integrity": "sha512-ZXG/iprEqTCxQC/P1oETGOR5CnsoemPsfb17eSANPRsm+11AcIOP0Tp8KJipN+GbycgxOA+fAVwLFqA1hDCgbw==", + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@midnight-ntwrk/compact-runtime/-/compact-runtime-0.9.0.tgz", + "integrity": "sha512-Dsms+SWRWlaTIay4SO7ITxTJvo8lgEKkMss+dQnIZDnEoCEO5lHTSj4TckBAvyYSWm4KElN3tir/MVm5hHgfDA==", "license": "Apache-2.0", "dependencies": { "@midnight-ntwrk/onchain-runtime": "^0.3.0", @@ -2760,15 +2854,8 @@ } }, "node_modules/@midnight-ntwrk/dapp-connector-api": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@midnight-ntwrk/dapp-connector-api/-/dapp-connector-api-3.0.0.tgz", - "integrity": "sha512-A/AhsNjibrOSaUiPhQhxANeW9178uYnzeBFBf30YCvyvWg0YWCbhQfc7dRpiL7iBoX3Sxt9mtf+Svx4ZygLajg==", - "license": "Apache-2.0", - "dependencies": { - "@midnight-ntwrk/wallet-api": "^5.0.0", - "@midnight-ntwrk/zswap": "^4.0.0", - "ts-custom-error": "^3.3.1" - } + "resolved": "midnight-dapp-connector-api", + "link": true }, "node_modules/@midnight-ntwrk/ledger": { "version": "4.0.0", @@ -4405,6 +4492,71 @@ "dev": true, "license": "MIT" }, + "node_modules/@rollup/plugin-commonjs": { + "version": "29.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-29.0.0.tgz", + "integrity": "sha512-U2YHaxR2cU/yAiwKJtJRhnyLk7cifnQw0zUpISsocBDoHDJn+HTV74ABqnwr5bEgWUwFZC9oFL6wLe21lHu5eQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "commondir": "^1.0.1", + "estree-walker": "^2.0.2", + "fdir": "^6.2.0", + "is-reference": "1.2.1", + "magic-string": "^0.30.3", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=16.0.0 || 14 >= 14.17" + }, + "peerDependencies": { + "rollup": "^2.68.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-commonjs/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==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rollup/plugin-commonjs/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-commonjs/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/@rollup/plugin-inject": { "version": "5.0.5", "resolved": "https://registry.npmjs.org/@rollup/plugin-inject/-/plugin-inject-5.0.5.tgz", @@ -4435,6 +4587,58 @@ "dev": true, "license": "MIT" }, + "node_modules/@rollup/plugin-node-resolve": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-16.0.3.tgz", + "integrity": "sha512-lUYM3UBGuM93CnMPG1YocWu7X802BrNF3jW2zny5gQyLQgRFJhV1Sq0Zi74+dh/6NBx1DxFC4b4GXg9wUCG5Qg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "@types/resolve": "1.20.2", + "deepmerge": "^4.2.2", + "is-module": "^1.0.0", + "resolve": "^1.22.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.78.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "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==", + "dev": true, + "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/plugin-virtual": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@rollup/plugin-virtual/-/plugin-virtual-3.0.2.tgz", @@ -5469,6 +5673,13 @@ "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", "license": "MIT" }, + "node_modules/@tsconfig/node22": { + "version": "22.0.5", + "resolved": "https://registry.npmjs.org/@tsconfig/node22/-/node22-22.0.5.tgz", + "integrity": "sha512-hLf2ld+sYN/BtOJjHUWOk568dvjFQkHnLNa6zce25GIH+vxKfvTgm3qpaH6ToF5tu/NN0IH66s+Bb5wElHrLcw==", + "dev": true, + "license": "MIT" + }, "node_modules/@tybys/wasm-util": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.0.tgz", @@ -5919,6 +6130,13 @@ "@types/react": "^19.0.0" } }, + "node_modules/@types/resolve": { + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz", + "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/semver": { "version": "7.7.0", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.7.0.tgz", @@ -6139,16 +6357,6 @@ "typescript": ">=4.8.4 <6.0.0" } }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { "version": "9.0.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", @@ -7249,14 +7457,12 @@ "license": "MIT" }, "node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "dev": true, + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "license": "MIT", "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "balanced-match": "^1.0.0" } }, "node_modules/braces": { @@ -8069,19 +8275,19 @@ "node": ">= 12" } }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "dev": true, + "license": "MIT" + }, "node_modules/compute-scroll-into-view": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/compute-scroll-into-view/-/compute-scroll-into-view-3.1.1.tgz", "integrity": "sha512-VRhuHOLoKYOy4UbilLbUzbYg93XLjv2PncJC50EuTWPA3gaja1UjBsUP/D/9/juV3vQFr6XBEzn9KCAHdUvOHw==", "license": "MIT" }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true, - "license": "MIT" - }, "node_modules/concurrently": { "version": "8.2.2", "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-8.2.2.tgz", @@ -9033,6 +9239,16 @@ "dev": true, "license": "MIT" }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/define-data-property": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", @@ -10304,6 +10520,37 @@ "node": ">=6" } }, + "node_modules/eslint-plugin-prettier": { + "version": "5.5.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.4.tgz", + "integrity": "sha512-swNtI95SToIz05YINMA6Ox5R057IMAmWZ26GqPxusAp1TZzj+IdY9tXNWWD3vkF/wEqydCONcwjTFpxybBqZsg==", + "dev": true, + "license": "MIT", + "dependencies": { + "prettier-linter-helpers": "^1.0.0", + "synckit": "^0.11.7" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-plugin-prettier" + }, + "peerDependencies": { + "@types/eslint": ">=8.0.0", + "eslint": ">=8.0.0", + "eslint-config-prettier": ">= 7.0.0 <10.0.0 || >=10.1.0", + "prettier": ">=3.0.0" + }, + "peerDependenciesMeta": { + "@types/eslint": { + "optional": true + }, + "eslint-config-prettier": { + "optional": true + } + } + }, "node_modules/eslint-plugin-react": { "version": "7.37.5", "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.37.5.tgz", @@ -10928,6 +11175,13 @@ "dev": true, "license": "MIT" }, + "node_modules/fast-diff": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", + "dev": true, + "license": "Apache-2.0" + }, "node_modules/fast-glob": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", @@ -11413,15 +11667,6 @@ "node": ">=10.13.0" } }, - "node_modules/glob/node_modules/brace-expansion": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "node_modules/glob/node_modules/minimatch": { "version": "9.0.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", @@ -11555,16 +11800,6 @@ } } }, - "node_modules/graphql-config/node_modules/brace-expansion": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "node_modules/graphql-config/node_modules/minimatch": { "version": "9.0.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", @@ -12692,6 +12927,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==", + "dev": true, + "license": "MIT" + }, "node_modules/is-nan": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", @@ -12773,6 +13015,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "*" + } + }, "node_modules/is-regex": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", @@ -16646,6 +16898,19 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-diff": "^1.1.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/prettier-plugin-packagejson": { "version": "2.5.19", "resolved": "https://registry.npmjs.org/prettier-plugin-packagejson/-/prettier-plugin-packagejson-2.5.19.tgz", @@ -19553,15 +19818,6 @@ "typescript": ">=4.8.4" } }, - "node_modules/ts-custom-error": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/ts-custom-error/-/ts-custom-error-3.3.1.tgz", - "integrity": "sha512-5OX1tzOjxWEgsr/YEUWSuPrQ00deKLh6D7OTWcvNHm12/7QPyRh8SYpyWvA4IZv8H/+GQWQEh/kwo95Q9OVW1A==", - "license": "MIT", - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/ts-dedent": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/ts-dedent/-/ts-dedent-2.2.0.tgz", @@ -20108,6 +20364,59 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/typedoc": { + "version": "0.28.15", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.28.15.tgz", + "integrity": "sha512-mw2/2vTL7MlT+BVo43lOsufkkd2CJO4zeOSuWQQsiXoV2VuEn7f6IZp2jsUDPmBMABpgR0R5jlcJ2OGEFYmkyg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@gerrit0/mini-shiki": "^3.17.0", + "lunr": "^2.3.9", + "markdown-it": "^14.1.0", + "minimatch": "^9.0.5", + "yaml": "^2.8.1" + }, + "bin": { + "typedoc": "bin/typedoc" + }, + "engines": { + "node": ">= 18", + "pnpm": ">= 10" + }, + "peerDependencies": { + "typescript": "5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x || 5.8.x || 5.9.x" + } + }, + "node_modules/typedoc-plugin-markdown": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/typedoc-plugin-markdown/-/typedoc-plugin-markdown-4.9.0.tgz", + "integrity": "sha512-9Uu4WR9L7ZBgAl60N/h+jqmPxxvnC9nQAlnnO/OujtG2ubjnKTVUFY1XDhcMY+pCqlX3N2HsQM2QTYZIU9tJuw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "typedoc": "0.28.x" + } + }, + "node_modules/typedoc/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/typescript": { "version": "5.8.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.2.tgz", @@ -21925,16 +22234,6 @@ "node": ">=8" } }, - "packages/configs/node_modules/brace-expansion": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "packages/configs/node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -22411,16 +22710,6 @@ "node": ">=8" } }, - "packages/mesh-midnight-core/node_modules/brace-expansion": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "packages/mesh-midnight-core/node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -22782,16 +23071,6 @@ "node": ">=8" } }, - "packages/mesh-midnight-wallet/node_modules/brace-expansion": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "packages/mesh-midnight-wallet/node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", diff --git a/package.json b/package.json index 67272a9..2a82e88 100644 --- a/package.json +++ b/package.json @@ -16,16 +16,16 @@ }, "dependencies": { "@bitcoin-js/tiny-secp256k1-asmjs": "^2.2.4", - "@midnight-ntwrk/compact-runtime": "0.8.1", - "@midnight-ntwrk/dapp-connector-api": "3.0.0", + "@midnight-ntwrk/compact-runtime": "0.9.0", + "@midnight-ntwrk/dapp-connector-api": "file:./midnight-dapp-connector-api", "@midnight-ntwrk/ledger": "4.0.0", - "@midnight-ntwrk/midnight-js-contracts": "2.0.2", - "@midnight-ntwrk/midnight-js-fetch-zk-config-provider": "2.0.2", - "@midnight-ntwrk/midnight-js-http-client-proof-provider": "2.0.2", - "@midnight-ntwrk/midnight-js-indexer-public-data-provider": "2.0.2", - "@midnight-ntwrk/midnight-js-level-private-state-provider": "2.0.2", - "@midnight-ntwrk/midnight-js-node-zk-config-provider": "2.0.2", - "@midnight-ntwrk/midnight-js-types": "2.0.2", + "@midnight-ntwrk/midnight-js-contracts": "2.1.0", + "@midnight-ntwrk/midnight-js-fetch-zk-config-provider": "2.1.0", + "@midnight-ntwrk/midnight-js-http-client-proof-provider": "2.1.0", + "@midnight-ntwrk/midnight-js-indexer-public-data-provider": "2.1.0", + "@midnight-ntwrk/midnight-js-level-private-state-provider": "2.1.0", + "@midnight-ntwrk/midnight-js-node-zk-config-provider": "2.1.0", + "@midnight-ntwrk/midnight-js-types": "2.1.0", "@midnight-ntwrk/wallet": "5.0.0", "@midnight-ntwrk/wallet-api": "5.0.0", "@midnight-ntwrk/wallet-sdk-hd": "^2.0.0", diff --git a/packages/mesh-midnight-react/src/contexts/wallet-context.tsx b/packages/mesh-midnight-react/src/contexts/wallet-context.tsx index 6ce945d..0e3d3bf 100644 --- a/packages/mesh-midnight-react/src/contexts/wallet-context.tsx +++ b/packages/mesh-midnight-react/src/contexts/wallet-context.tsx @@ -1,7 +1,7 @@ import { createContext, useCallback, useEffect, useState } from 'react'; import { type Logger } from 'pino'; import { MidnightBrowserWallet } from '@meshsdk/midnight-wallet'; -import { ServiceUriConfig } from '@midnight-ntwrk/dapp-connector-api'; +import { Configuration } from '@midnight-ntwrk/dapp-connector-api'; export enum WalletState { NOT_CONNECTED = 'NOT_CONNECTED', @@ -47,7 +47,7 @@ export interface WalletContext { address: string | undefined; coinPublicKey: string | undefined; encryptionPublicKey: string | undefined; - uris: ServiceUriConfig | undefined; + uris: Configuration | undefined; isProofServerOnline: boolean; } @@ -63,7 +63,7 @@ export const useWalletStore = (logger?: Logger): WalletContext => { const [coinPublicKey, setCoinPublicKey] = useState(); const [encryptionPublicKey, setEncryptionPublicKey] = useState(undefined); const [walletName, setWaName] = useState(undefined); - const [uris, setUris] = useState(undefined); + const [uris, setUris] = useState(undefined); const [isProofServerOnline, setIsProofServerOnline] = useState(false); const connectWallet = useCallback( diff --git a/packages/mesh-midnight-react/src/hooks/useWalletBalanceProve.ts b/packages/mesh-midnight-react/src/hooks/useWalletBalanceProve.ts index 900fb14..4ee7a28 100644 --- a/packages/mesh-midnight-react/src/hooks/useWalletBalanceProve.ts +++ b/packages/mesh-midnight-react/src/hooks/useWalletBalanceProve.ts @@ -1,24 +1,23 @@ import { useCallback, useContext, useState } from "react"; -import { CoinInfo, Transaction } from "@midnight-ntwrk/zswap"; import { WalletContext } from "../contexts"; export const useWalletBalanceProve = () => { const [error, setError] = useState(); - const [result, setResult] = useState(); + const [result, setResult] = useState(); const [submitting, setSubmitting] = useState(false); const { hasConnectedWallet, midnightBrowserWalletInstance } = useContext(WalletContext); - const submitTx = useCallback(async (tx: Transaction, newCoins: CoinInfo[]) => { + const submitTx = useCallback(async (tx: string) => { setSubmitting(true); setError(undefined); try { if (hasConnectedWallet && midnightBrowserWalletInstance) { - const txHash = await midnightBrowserWalletInstance.balanceAndProveTransaction(tx, newCoins); - setResult(txHash); - } + const balancedTx = await midnightBrowserWalletInstance.balanceAndProveTransaction(tx); + setResult(balancedTx); + } } catch (error) { setError(error); } diff --git a/packages/mesh-midnight-react/src/hooks/useWalletList.ts b/packages/mesh-midnight-react/src/hooks/useWalletList.ts index dd28513..c70b5e1 100644 --- a/packages/mesh-midnight-react/src/hooks/useWalletList.ts +++ b/packages/mesh-midnight-react/src/hooks/useWalletList.ts @@ -1,9 +1,9 @@ import { useEffect, useState } from "react"; -import { DAppConnectorAPI } from "@midnight-ntwrk/dapp-connector-api"; +import { InitialAPI } from "@midnight-ntwrk/dapp-connector-api"; import { MidnightBrowserWallet } from "@meshsdk/midnight-wallet"; export const useWalletList = () => { - const [wallets, setWallets] = useState([]); + const [wallets, setWallets] = useState([]); useEffect(() => { async function get() { setWallets(MidnightBrowserWallet.getAvailableWallets()); diff --git a/packages/mesh-midnight-react/src/hooks/useWalletSubmit.ts b/packages/mesh-midnight-react/src/hooks/useWalletSubmit.ts index d2fc198..4f6c048 100644 --- a/packages/mesh-midnight-react/src/hooks/useWalletSubmit.ts +++ b/packages/mesh-midnight-react/src/hooks/useWalletSubmit.ts @@ -1,24 +1,21 @@ import { useCallback, useContext, useState } from "react"; -import { Transaction } from "@midnight-ntwrk/zswap"; import { WalletContext } from "../contexts"; export const useWalletSubmit = () => { const [error, setError] = useState(); - const [result, setResult] = useState(); const [submitting, setSubmitting] = useState(false); const { hasConnectedWallet, midnightBrowserWalletInstance } = useContext(WalletContext); - const submitTx = useCallback(async (signedTx: Transaction) => { + const submitTx = useCallback(async (signedTx: string) => { setSubmitting(true); setError(undefined); try { if (hasConnectedWallet && midnightBrowserWalletInstance) { - const txHash = await midnightBrowserWalletInstance.submitTransaction(signedTx); - setResult(txHash); - } + await midnightBrowserWalletInstance.submitTransaction(signedTx); + } } catch (error) { setError(error); } @@ -28,7 +25,6 @@ export const useWalletSubmit = () => { return { error, - result, submitting, submitTx, }; diff --git a/packages/mesh-midnight-wallet/src/browser/browser-wallet.ts b/packages/mesh-midnight-wallet/src/browser/browser-wallet.ts index 569626f..b0ab282 100644 --- a/packages/mesh-midnight-wallet/src/browser/browser-wallet.ts +++ b/packages/mesh-midnight-wallet/src/browser/browser-wallet.ts @@ -1,6 +1,4 @@ -import type { CoinInfo } from '@midnight-ntwrk/ledger'; -import { DAppConnectorAPI, DAppConnectorWalletAPI, ServiceUriConfig } from '@midnight-ntwrk/dapp-connector-api'; -import { Transaction } from '@midnight-ntwrk/zswap'; +import { InitialAPI, ConnectedAPI, Configuration } from "@midnight-ntwrk/dapp-connector-api"; import { pipe as fnPipe } from 'fp-ts/lib/function.js'; import { type Logger } from 'pino'; import { catchError, concatMap, filter, firstValueFrom, interval, map, take, tap, throwError, timeout } from 'rxjs'; @@ -8,25 +6,25 @@ import { checkProofServerStatus } from '@meshsdk/midnight-core'; declare global { interface Window { - midnight?: { [key: string]: DAppConnectorAPI }; + midnight?: { [key: string]: InitialAPI }; } } export class MidnightBrowserWallet { - _walletInstance: DAppConnectorWalletAPI | undefined; - _connectorAPI: DAppConnectorAPI | undefined; + _walletInstance: ConnectedAPI | undefined; + _connectorAPI: InitialAPI | undefined; _walletName: string | undefined; - _uris: ServiceUriConfig | undefined; + _uris: Configuration | undefined; _address: string | undefined; _coinPublicKey: string | undefined; _encryptionPublicKey: string | undefined; _proofServerOnline: boolean; - private constructor( - _connectorAPI: DAppConnectorAPI, - walletInstance: DAppConnectorWalletAPI, + private constructor( + _connectorAPI: InitialAPI, + walletInstance: ConnectedAPI, walletName: string, - uris: ServiceUriConfig, + uris: Configuration, address: string, coinPublicKey: string, encryptionPublicKey: string, @@ -43,24 +41,18 @@ export class MidnightBrowserWallet { this.logger = logger; } - static getAvailableWallets(): DAppConnectorAPI[] { + static getAvailableWallets(): InitialAPI[] { if (window === undefined) return []; if (window.midnight === undefined) return []; - const wallets: DAppConnectorAPI[] = []; + const wallets: InitialAPI[] = []; for (const key in window.midnight) { try { const _wallet = window.midnight[key]; if (_wallet === undefined) continue; if (_wallet.name === undefined) continue; if (_wallet.apiVersion === undefined) continue; - wallets.push({ - name: _wallet.name, - apiVersion: _wallet.apiVersion, - enable: _wallet.enable, - isEnabled: _wallet.isEnabled, - serviceUriConfig: _wallet.serviceUriConfig, - }); + wallets.push(_wallet); } catch (e) { console.log(e); } @@ -95,7 +87,7 @@ export class MidnightBrowserWallet { tap((connectorAPI) => { logger?.info(connectorAPI, 'Check for wallet connector API'); }), - filter((connectorAPI): connectorAPI is DAppConnectorAPI => !!connectorAPI), + filter((connectorAPI) => !!connectorAPI), tap((connectorAPI) => { logger?.info(connectorAPI, 'Compatible wallet connector API found. Connecting.'); }), @@ -109,13 +101,6 @@ export class MidnightBrowserWallet { return new Error('Could not find Midnight Lace wallet. Extension installed?'); }), }), - concatMap(async (connectorAPI) => { - const isEnabled = await connectorAPI.isEnabled(); - - logger?.info(isEnabled, 'Wallet connector API enabled status'); - - return connectorAPI; - }), timeout({ first: 5_000, with: () => @@ -126,8 +111,8 @@ export class MidnightBrowserWallet { }), }), concatMap(async (connectorAPI) => ({ - walletConnectorAPI: await connectorAPI.enable(), - connectorAPI, + walletConnectorAPI: await connectorAPI.connect("preview"), + connectorAPI })), catchError((error, apis) => error @@ -138,20 +123,20 @@ export class MidnightBrowserWallet { : apis, ), concatMap(async ({ walletConnectorAPI, connectorAPI }) => { - const uris = await connectorAPI.serviceUriConfig(); - const { address, coinPublicKey, encryptionPublicKey } = await walletConnectorAPI.state(); + const uris = await walletConnectorAPI.getConfiguration(); + const { shieldedAddress, shieldedCoinPublicKey, shieldedEncryptionPublicKey } = await walletConnectorAPI.getShieldedAddresses(); const proofServerOnline = await checkProofServerStatus(uris.proverServerUri); logger?.info('Connected to wallet connector API and retrieved service configuration'); - const wallet = new MidnightBrowserWallet( + const wallet = new MidnightBrowserWallet( connectorAPI, walletConnectorAPI, walletName, uris, - address, - coinPublicKey, - encryptionPublicKey, + shieldedAddress, + shieldedCoinPublicKey, + shieldedEncryptionPublicKey, proofServerOnline, logger, ); @@ -177,19 +162,18 @@ export class MidnightBrowserWallet { this._proofServerOnline = false; } - async balanceAndProveTransaction(tx: Transaction, newCoins: CoinInfo[]): Promise { + async balanceAndProveTransaction(tx: string): Promise { if (this._walletInstance) { - const balancedAndProvedTransaction = await this._walletInstance.balanceAndProveTransaction(tx, newCoins); - return balancedAndProvedTransaction; + const { tx: balancedTx } = await this._walletInstance.balanceUnsealedTransaction(tx); + return balancedTx; } else { return Promise.reject(new Error('readonly')); } } - async submitTransaction(tx: Transaction): Promise { + async submitTransaction(tx: string): Promise { if (this._walletInstance) { - const submitTransaction = await this._walletInstance.submitTransaction(tx); - return submitTransaction; + await this._walletInstance.submitTransaction(tx); } else { return Promise.reject(new Error('readonly')); }