From 9524dba2a6153c0b37f01596e74280e155b4353e Mon Sep 17 00:00:00 2001 From: Volodymyr-Kuchinskyi Date: Thu, 19 Dec 2024 14:15:09 +0100 Subject: [PATCH] feat!: Upgrade to casper-js-sdk 5.x --- package-lock.json | 1195 ++++++++++++------------------------------- package.json | 4 +- src/casper/types.ts | 35 -- src/casper/utils.ts | 227 -------- src/event.ts | 50 +- src/index.ts | 1 - src/parser.ts | 135 ++--- src/schema.ts | 67 +-- 8 files changed, 444 insertions(+), 1270 deletions(-) delete mode 100644 src/casper/types.ts delete mode 100644 src/casper/utils.ts diff --git a/package-lock.json b/package-lock.json index e860bd7..b75c1dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "@typescript-eslint/parser": "^5.53.0", "browserify-zlib": "^0.2.0", "buffer": "^6.0.3", - "casper-js-sdk": "^2.12.0", + "casper-js-sdk": "^5.0.0-rc8", "copy-webpack-plugin": "^11.0.0", "crypto-browserify": "^3.12.0", "eslint": "^8.34.0", @@ -40,7 +40,7 @@ "webpack-node-externals": "^3.0.0" }, "peerDependencies": { - "casper-js-sdk": "^2.12.0" + "casper-js-sdk": "^5.0.0-rc8" } }, "node_modules/@ampproject/remapping": { @@ -1315,6 +1315,69 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@noble/curves": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.7.0.tgz", + "integrity": "sha512-UTMhXK9SeDhFJVrHeUJ5uZlI6ajXg10O6Ddocf9S6GjbSBVZsJo88HzKwXznNfGpMTRDyJkqMjNDPYgf0qFWnw==", + "dev": true, + "dependencies": { + "@noble/hashes": "1.6.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/curves/node_modules/@noble/hashes": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.6.0.tgz", + "integrity": "sha512-YUULf0Uk4/mAA89w+k3+yUYh6NrEvxZa5T6SY3wlMvE2chHkxFUUIDI8/XW1QSC357iA5pSnqt7XEhvFOqmDyQ==", + "dev": true, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/ed25519": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.3.tgz", + "integrity": "sha512-iR8GBkDt0Q3GyaVcIu7mSsVIqnFbkbRzGLWlvhwunacoLwt4J3swfKhfaM6rN6WY+TBGoYT1GtT1mIh2/jGbRQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/@noble/hashes": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.6.1.tgz", + "integrity": "sha512-pq5D8h10hHBjyqX+cfBm0i8JUXJ0UhczFc4r74zbuT9XgewFo2E3J1cOaGtdZynILNmQ685YWGzGE1Zv6io50w==", + "dev": true, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/secp256k1": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", + "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -1362,6 +1425,42 @@ "ws": "^7.0.0" } }, + "node_modules/@scure/base": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.1.tgz", + "integrity": "sha512-DGmGtC8Tt63J5GfHgfl5CuAXh96VF/LD8K9Hr/Gv0J2lAoRGlPOMpqMpMbCTOoOJMZCk2Xt+DskdDyn6dEFdzQ==", + "dev": true, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.6.0.tgz", + "integrity": "sha512-82q1QfklrUUdXJzjuRU7iG7D7XiFx5PHYVS0+oeNKhyDLT7WPqs6pBcM2W5ZdwOwKCwoE1Vy1se+DHjcXwCYnA==", + "dev": true, + "dependencies": { + "@noble/curves": "~1.7.0", + "@noble/hashes": "~1.6.0", + "@scure/base": "~1.2.1" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.5.0.tgz", + "integrity": "sha512-Dop+ASYhnrwm9+HA/HwXg7j2ZqM6yk2fyLWb5znexjctFY3+E+eU8cIWI0Pql0Qx4hPZCijlGq4OL71g+Uz30A==", + "dev": true, + "dependencies": { + "@noble/hashes": "~1.6.0", + "@scure/base": "~1.2.1" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@sinclair/typebox": { "version": "0.25.23", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.23.tgz", @@ -1436,16 +1535,6 @@ "@types/node": "*" } }, - "node_modules/@types/eccrypto": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@types/eccrypto/-/eccrypto-1.1.3.tgz", - "integrity": "sha512-3O0qER6JMYReqVbcQTGmXeMHdw3O+rVps63tlo5g5zoB3altJS8yzSvboSivwVWeYO9o5jSATu7P0UIqYZPgow==", - "dev": true, - "dependencies": { - "@types/expect": "^1.20.4", - "@types/node": "*" - } - }, "node_modules/@types/elliptic": { "version": "6.4.14", "resolved": "https://registry.npmjs.org/@types/elliptic/-/elliptic-6.4.14.tgz", @@ -1481,12 +1570,6 @@ "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==", "dev": true }, - "node_modules/@types/expect": { - "version": "1.20.4", - "resolved": "https://registry.npmjs.org/@types/expect/-/expect-1.20.4.tgz", - "integrity": "sha512-Q5Vn3yjTDyCMV50TB6VRIbQNxSE4OmZR86VSbGaNpfUolm0iePBB4KdEEHmxoY5sT2+2DIvXW0rvMDP2nHZ4Mg==", - "dev": true - }, "node_modules/@types/graceful-fs": { "version": "4.1.6", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", @@ -1548,30 +1631,12 @@ "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", "dev": true }, - "node_modules/@types/pbkdf2": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@types/pbkdf2/-/pbkdf2-3.1.0.tgz", - "integrity": "sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/prettier": { "version": "2.7.2", "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.2.tgz", "integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==", "dev": true }, - "node_modules/@types/secp256k1": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.3.tgz", - "integrity": "sha512-Da66lEIFeIz9ltsdMZcpQvmrmmoqrfju8pm1BH8WbYjZSwUgCwXLb9C+9XYogwBITnbsSaMdVPb2ekf7TV+03w==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/semver": { "version": "7.3.13", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", @@ -2025,6 +2090,7 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", "dev": true, + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -2202,16 +2268,21 @@ "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", "dev": true }, - "node_modules/available-typed-arrays": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", - "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true + }, + "node_modules/axios": { + "version": "1.7.9", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz", + "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==", "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" } }, "node_modules/babel-jest": { @@ -2311,15 +2382,6 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, - "node_modules/base-x": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", - "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", - "dev": true, - "dependencies": { - "safe-buffer": "^5.0.1" - } - }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -2340,32 +2402,6 @@ } ] }, - "node_modules/bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dev": true, - "optional": true, - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, - "node_modules/bip66": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", - "integrity": "sha512-nemMHz95EmS38a26XbbdxIYj5csHd3RMP3H5bwQknX0WYHF01qhpufP42mLOwVICuH2JmhIhXiWs89MfUGL7Xw==", - "dev": true, - "optional": true, - "dependencies": { - "safe-buffer": "^5.0.1" - } - }, - "node_modules/blakejs": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", - "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==", - "dev": true - }, "node_modules/bn.js": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", @@ -2513,26 +2549,6 @@ "node": ">= 6" } }, - "node_modules/bs58": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", - "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", - "dev": true, - "dependencies": { - "base-x": "^3.0.2" - } - }, - "node_modules/bs58check": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", - "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", - "dev": true, - "dependencies": { - "bs58": "^4.0.0", - "create-hash": "^1.1.0", - "safe-buffer": "^5.1.2" - } - }, "node_modules/bser": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", @@ -2584,19 +2600,6 @@ "integrity": "sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==", "dev": true }, - "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -2632,30 +2635,32 @@ ] }, "node_modules/casper-js-sdk": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/casper-js-sdk/-/casper-js-sdk-2.12.0.tgz", - "integrity": "sha512-n4dP2lnNb1bhBQS82PY7m0K0CgGqqioSI92/Z/tZVWsLxiRAr6sdIMN5mf8vK62UN2pcaEtm6ER4/DUVs/TxKQ==", + "version": "5.0.0-rc8", + "resolved": "https://registry.npmjs.org/casper-js-sdk/-/casper-js-sdk-5.0.0-rc8.tgz", + "integrity": "sha512-EQBEprxQoGPtOzv6iJt3wRi6mIZhyGa/K4AvzfM2Hl8lBWYno6N3bhd9G501UwszyOVKYdK/TflONEogpSKrlQ==", "dev": true, "dependencies": { "@ethersproject/bignumber": "^5.0.8", "@ethersproject/bytes": "^5.0.5", "@ethersproject/constants": "^5.0.5", - "@open-rpc/client-js": "^1.6.2", - "@types/eccrypto": "^1.1.2", + "@noble/curves": "^1.1.0", + "@noble/ed25519": "^1.7.3", + "@noble/hashes": "^1.2.0", + "@noble/secp256k1": "^1.7.1", + "@open-rpc/client-js": "^1.8.1", + "@scure/bip32": "^1.1.5", + "@scure/bip39": "^1.2.0", "@types/ws": "^8.2.2", - "blakejs": "^1.1.0", - "eccrypto": "^1.1.6", - "ethereum-cryptography": "^0.1.3", + "axios": "^1.7.9", + "eventsource": "^2.0.2", + "glob": "^7.1.6", "humanize-duration": "^3.24.0", "key-encoder": "^2.0.3", "lodash": "^4.17.21", + "node-fetch": "2.6.13", "reflect-metadata": "^0.1.13", "ts-results": "npm:@casperlabs/ts-results@^3.3.4", - "tweetnacl-ts": "^1.0.3", - "tweetnacl-util": "^0.15.0", - "typedjson": "^1.6.0-rc2", - "util": "^0.12.5", - "webpack": "^5.24.3" + "typedjson": "^1.6.0-rc2" } }, "node_modules/casper-js-sdk/node_modules/ts-results": { @@ -2798,6 +2803,18 @@ "integrity": "sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==", "dev": true }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -3072,6 +3089,15 @@ "node": ">=0.10.0" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/des.js": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", @@ -3141,37 +3167,6 @@ "node": ">=6.0.0" } }, - "node_modules/drbg.js": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/drbg.js/-/drbg.js-1.0.1.tgz", - "integrity": "sha512-F4wZ06PvqxYLFEZKkFxTDcns9oFNk34hvmJSEwdzsxVQ8YI5YaxtACgQatkYgv2VI2CFkUd2Y+xosPQnHv809g==", - "dev": true, - "optional": true, - "dependencies": { - "browserify-aes": "^1.0.6", - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/eccrypto": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/eccrypto/-/eccrypto-1.1.6.tgz", - "integrity": "sha512-d78ivVEzu7Tn0ZphUUaL43+jVPKTMPFGtmgtz1D0LrFn7cY3K8CdrvibuLz2AAkHBLKZtR8DMbB2ukRYFk987A==", - "dev": true, - "hasInstallScript": true, - "dependencies": { - "acorn": "7.1.1", - "elliptic": "6.5.4", - "es6-promise": "4.2.8", - "nan": "2.14.0" - }, - "optionalDependencies": { - "secp256k1": "3.7.1" - } - }, "node_modules/electron-to-chromium": { "version": "1.4.295", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.295.tgz", @@ -3257,12 +3252,6 @@ "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==", "dev": true }, - "node_modules/es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", - "dev": true - }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -3536,44 +3525,6 @@ "node": ">=0.10.0" } }, - "node_modules/ethereum-cryptography": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", - "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", - "dev": true, - "dependencies": { - "@types/pbkdf2": "^3.0.0", - "@types/secp256k1": "^4.0.1", - "blakejs": "^1.1.0", - "browserify-aes": "^1.2.0", - "bs58check": "^2.1.2", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "hash.js": "^1.1.7", - "keccak": "^3.0.0", - "pbkdf2": "^3.0.17", - "randombytes": "^2.1.0", - "safe-buffer": "^5.1.2", - "scrypt-js": "^3.0.0", - "secp256k1": "^4.0.1", - "setimmediate": "^1.0.5" - } - }, - "node_modules/ethereum-cryptography/node_modules/secp256k1": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", - "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", - "dev": true, - "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/events": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", @@ -3583,6 +3534,15 @@ "node": ">=0.8.x" } }, + "node_modules/eventsource": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", + "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==", + "dev": true, + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/evp_bytestokey": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", @@ -3732,13 +3692,6 @@ "node": "^10.12.0 || >=12.0.0" } }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true, - "optional": true - }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -3801,13 +3754,38 @@ "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", "dev": true }, - "node_modules/for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "node_modules/follow-redirects": { + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", + "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", "dev": true, "dependencies": { - "is-callable": "^1.1.3" + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" } }, "node_modules/fs.realpath": { @@ -3854,21 +3832,6 @@ "node": "6.* || 8.* || >= 10.*" } }, - "node_modules/get-intrinsic": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", - "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/get-package-type": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", @@ -3963,18 +3926,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "dev": true, - "dependencies": { - "get-intrinsic": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", @@ -4008,45 +3959,6 @@ "node": ">=8" } }, - "node_modules/has-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", - "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", - "dev": true, - "dependencies": { - "has-symbols": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "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", @@ -4301,40 +4213,12 @@ "node": ">=10.13.0" } }, - "node_modules/is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true }, - "node_modules/is-callable": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", - "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-core-module": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", @@ -4374,21 +4258,6 @@ "node": ">=6" } }, - "node_modules/is-generator-function": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", - "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -4443,25 +4312,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-typed-array": { - "version": "1.1.10", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", - "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", - "dev": true, - "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -5307,21 +5157,6 @@ "node": ">=6" } }, - "node_modules/keccak": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.3.tgz", - "integrity": "sha512-JZrLIAJWuZxKbCilMpNz5Vj7Vtb4scDG3dMXLOsbzBmQGyjwE61BbW7bJkfKKCShXiQZt3T6sBgALRtmd+nZaQ==", - "dev": true, - "hasInstallScript": true, - "dependencies": { - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0", - "readable-stream": "^3.6.0" - }, - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/key-encoder": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/key-encoder/-/key-encoder-2.0.3.tgz", @@ -5597,12 +5432,6 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "node_modules/nan": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", - "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", - "dev": true - }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -5621,16 +5450,10 @@ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, - "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==", - "dev": true - }, "node_modules/node-fetch": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", - "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", + "version": "2.6.13", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.13.tgz", + "integrity": "sha512-StxNAxh15zr77QvvkmveSQ8uCQ4+v5FkvNTj0OESmiHu+VRi/gXArXtkWMElOsOUNLtUEvI4yS+rdtOHZTwlQA==", "dev": true, "dependencies": { "whatwg-url": "^5.0.0" @@ -5647,17 +5470,6 @@ } } }, - "node_modules/node-gyp-build": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", - "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==", - "dev": true, - "bin": { - "node-gyp-build": "bin.js", - "node-gyp-build-optional": "optional.js", - "node-gyp-build-test": "build-test.js" - } - }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -6010,6 +5822,12 @@ "node": ">= 6" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, "node_modules/public-encrypt": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", @@ -6314,40 +6132,6 @@ "url": "https://opencollective.com/webpack" } }, - "node_modules/scrypt-js": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", - "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==", - "dev": true - }, - "node_modules/secp256k1": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.7.1.tgz", - "integrity": "sha512-1cf8sbnRreXrQFdH6qsg2H71Xw91fCCS9Yp021GnUNJzWJS/py96fS4lHbnTnouLp08Xj6jBoBB6V78Tdbdu5g==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "dependencies": { - "bindings": "^1.5.0", - "bip66": "^1.1.5", - "bn.js": "^4.11.8", - "create-hash": "^1.2.0", - "drbg.js": "^1.0.1", - "elliptic": "^6.4.1", - "nan": "^2.14.0", - "safe-buffer": "^5.1.2" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/secp256k1/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==", - "dev": true, - "optional": true - }, "node_modules/semver": { "version": "7.3.8", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", @@ -6390,12 +6174,6 @@ "randombytes": "^2.1.0" } }, - "node_modules/setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", - "dev": true - }, "node_modules/sha.js": { "version": "2.4.11", "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", @@ -6875,21 +6653,6 @@ "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" } }, - "node_modules/tweetnacl-ts": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tweetnacl-ts/-/tweetnacl-ts-1.0.3.tgz", - "integrity": "sha512-C5I/dWf6xjAXaCDlf84T4HvozU/8ycAlq5WRllF1hAeeq5390tfXD+bNas5bhEV0HMSOx8bsQYpLjPl8wfnEeQ==", - "dev": true, - "dependencies": { - "tslib": "^1" - } - }, - "node_modules/tweetnacl-util": { - "version": "0.15.1", - "resolved": "https://registry.npmjs.org/tweetnacl-util/-/tweetnacl-util-0.15.1.tgz", - "integrity": "sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw==", - "dev": true - }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -7002,19 +6765,6 @@ "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==", "dev": true }, - "node_modules/util": { - "version": "0.12.5", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", - "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", - "dev": true, - "dependencies": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "which-typed-array": "^1.1.2" - } - }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -7284,26 +7034,6 @@ "node": ">=4" } }, - "node_modules/which-typed-array": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", - "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", - "dev": true, - "dependencies": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0", - "is-typed-array": "^1.1.10" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/wildcard": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.0.tgz", @@ -8407,6 +8137,41 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "@noble/curves": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.7.0.tgz", + "integrity": "sha512-UTMhXK9SeDhFJVrHeUJ5uZlI6ajXg10O6Ddocf9S6GjbSBVZsJo88HzKwXznNfGpMTRDyJkqMjNDPYgf0qFWnw==", + "dev": true, + "requires": { + "@noble/hashes": "1.6.0" + }, + "dependencies": { + "@noble/hashes": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.6.0.tgz", + "integrity": "sha512-YUULf0Uk4/mAA89w+k3+yUYh6NrEvxZa5T6SY3wlMvE2chHkxFUUIDI8/XW1QSC357iA5pSnqt7XEhvFOqmDyQ==", + "dev": true + } + } + }, + "@noble/ed25519": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.3.tgz", + "integrity": "sha512-iR8GBkDt0Q3GyaVcIu7mSsVIqnFbkbRzGLWlvhwunacoLwt4J3swfKhfaM6rN6WY+TBGoYT1GtT1mIh2/jGbRQ==", + "dev": true + }, + "@noble/hashes": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.6.1.tgz", + "integrity": "sha512-pq5D8h10hHBjyqX+cfBm0i8JUXJ0UhczFc4r74zbuT9XgewFo2E3J1cOaGtdZynILNmQ685YWGzGE1Zv6io50w==", + "dev": true + }, + "@noble/secp256k1": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", + "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==", + "dev": true + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -8445,6 +8210,33 @@ "ws": "^7.0.0" } }, + "@scure/base": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.1.tgz", + "integrity": "sha512-DGmGtC8Tt63J5GfHgfl5CuAXh96VF/LD8K9Hr/Gv0J2lAoRGlPOMpqMpMbCTOoOJMZCk2Xt+DskdDyn6dEFdzQ==", + "dev": true + }, + "@scure/bip32": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.6.0.tgz", + "integrity": "sha512-82q1QfklrUUdXJzjuRU7iG7D7XiFx5PHYVS0+oeNKhyDLT7WPqs6pBcM2W5ZdwOwKCwoE1Vy1se+DHjcXwCYnA==", + "dev": true, + "requires": { + "@noble/curves": "~1.7.0", + "@noble/hashes": "~1.6.0", + "@scure/base": "~1.2.1" + } + }, + "@scure/bip39": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.5.0.tgz", + "integrity": "sha512-Dop+ASYhnrwm9+HA/HwXg7j2ZqM6yk2fyLWb5znexjctFY3+E+eU8cIWI0Pql0Qx4hPZCijlGq4OL71g+Uz30A==", + "dev": true, + "requires": { + "@noble/hashes": "~1.6.0", + "@scure/base": "~1.2.1" + } + }, "@sinclair/typebox": { "version": "0.25.23", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.25.23.tgz", @@ -8519,16 +8311,6 @@ "@types/node": "*" } }, - "@types/eccrypto": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@types/eccrypto/-/eccrypto-1.1.3.tgz", - "integrity": "sha512-3O0qER6JMYReqVbcQTGmXeMHdw3O+rVps63tlo5g5zoB3altJS8yzSvboSivwVWeYO9o5jSATu7P0UIqYZPgow==", - "dev": true, - "requires": { - "@types/expect": "^1.20.4", - "@types/node": "*" - } - }, "@types/elliptic": { "version": "6.4.14", "resolved": "https://registry.npmjs.org/@types/elliptic/-/elliptic-6.4.14.tgz", @@ -8564,12 +8346,6 @@ "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==", "dev": true }, - "@types/expect": { - "version": "1.20.4", - "resolved": "https://registry.npmjs.org/@types/expect/-/expect-1.20.4.tgz", - "integrity": "sha512-Q5Vn3yjTDyCMV50TB6VRIbQNxSE4OmZR86VSbGaNpfUolm0iePBB4KdEEHmxoY5sT2+2DIvXW0rvMDP2nHZ4Mg==", - "dev": true - }, "@types/graceful-fs": { "version": "4.1.6", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.6.tgz", @@ -8631,30 +8407,12 @@ "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", "dev": true }, - "@types/pbkdf2": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@types/pbkdf2/-/pbkdf2-3.1.0.tgz", - "integrity": "sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, "@types/prettier": { "version": "2.7.2", "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.2.tgz", "integrity": "sha512-KufADq8uQqo1pYKVIYzfKbJfBAc0sOeXqGbFaSpv8MRmC/zXgowNZmFcbngndGk922QDmOASEXUZCaY48gs4cg==", "dev": true }, - "@types/secp256k1": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.3.tgz", - "integrity": "sha512-Da66lEIFeIz9ltsdMZcpQvmrmmoqrfju8pm1BH8WbYjZSwUgCwXLb9C+9XYogwBITnbsSaMdVPb2ekf7TV+03w==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, "@types/semver": { "version": "7.3.13", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", @@ -8991,7 +8749,8 @@ "version": "7.1.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", - "dev": true + "dev": true, + "peer": true }, "acorn-jsx": { "version": "5.3.2", @@ -9122,12 +8881,23 @@ } } }, - "available-typed-arrays": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", - "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "dev": true }, + "axios": { + "version": "1.7.9", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz", + "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==", + "dev": true, + "requires": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "babel-jest": { "version": "29.4.3", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.4.3.tgz", @@ -9204,47 +8974,12 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, - "base-x": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", - "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", - "dev": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, "base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", "dev": true }, - "bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dev": true, - "optional": true, - "requires": { - "file-uri-to-path": "1.0.0" - } - }, - "bip66": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", - "integrity": "sha512-nemMHz95EmS38a26XbbdxIYj5csHd3RMP3H5bwQknX0WYHF01qhpufP42mLOwVICuH2JmhIhXiWs89MfUGL7Xw==", - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "blakejs": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", - "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==", - "dev": true - }, "bn.js": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", @@ -9370,26 +9105,6 @@ "fast-json-stable-stringify": "2.x" } }, - "bs58": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", - "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", - "dev": true, - "requires": { - "base-x": "^3.0.2" - } - }, - "bs58check": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", - "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", - "dev": true, - "requires": { - "bs58": "^4.0.0", - "create-hash": "^1.1.0", - "safe-buffer": "^5.1.2" - } - }, "bser": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", @@ -9427,16 +9142,6 @@ "integrity": "sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==", "dev": true }, - "call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dev": true, - "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - } - }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -9456,30 +9161,32 @@ "dev": true }, "casper-js-sdk": { - "version": "2.12.0", - "resolved": "https://registry.npmjs.org/casper-js-sdk/-/casper-js-sdk-2.12.0.tgz", - "integrity": "sha512-n4dP2lnNb1bhBQS82PY7m0K0CgGqqioSI92/Z/tZVWsLxiRAr6sdIMN5mf8vK62UN2pcaEtm6ER4/DUVs/TxKQ==", + "version": "5.0.0-rc8", + "resolved": "https://registry.npmjs.org/casper-js-sdk/-/casper-js-sdk-5.0.0-rc8.tgz", + "integrity": "sha512-EQBEprxQoGPtOzv6iJt3wRi6mIZhyGa/K4AvzfM2Hl8lBWYno6N3bhd9G501UwszyOVKYdK/TflONEogpSKrlQ==", "dev": true, "requires": { "@ethersproject/bignumber": "^5.0.8", "@ethersproject/bytes": "^5.0.5", "@ethersproject/constants": "^5.0.5", - "@open-rpc/client-js": "^1.6.2", - "@types/eccrypto": "^1.1.2", + "@noble/curves": "^1.1.0", + "@noble/ed25519": "^1.7.3", + "@noble/hashes": "^1.2.0", + "@noble/secp256k1": "^1.7.1", + "@open-rpc/client-js": "^1.8.1", + "@scure/bip32": "^1.1.5", + "@scure/bip39": "^1.2.0", "@types/ws": "^8.2.2", - "blakejs": "^1.1.0", - "eccrypto": "^1.1.6", - "ethereum-cryptography": "^0.1.3", + "axios": "^1.7.9", + "eventsource": "^2.0.2", + "glob": "^7.1.6", "humanize-duration": "^3.24.0", "key-encoder": "^2.0.3", "lodash": "^4.17.21", + "node-fetch": "2.6.13", "reflect-metadata": "^0.1.13", "ts-results": "npm:@casperlabs/ts-results@^3.3.4", - "tweetnacl-ts": "^1.0.3", - "tweetnacl-util": "^0.15.0", - "typedjson": "^1.6.0-rc2", - "util": "^0.12.5", - "webpack": "^5.24.3" + "typedjson": "^1.6.0-rc2" }, "dependencies": { "ts-results": { @@ -9598,6 +9305,15 @@ "integrity": "sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==", "dev": true }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -9817,6 +9533,12 @@ "integrity": "sha512-z2wJZXrmeHdvYJp/Ux55wIjqo81G5Bp4c+oELTW+7ar6SogWHajt5a9gO3s3IDaGSAXjDk0vlQKN3rms8ab3og==", "dev": true }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true + }, "des.js": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", @@ -9876,31 +9598,6 @@ "esutils": "^2.0.2" } }, - "drbg.js": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/drbg.js/-/drbg.js-1.0.1.tgz", - "integrity": "sha512-F4wZ06PvqxYLFEZKkFxTDcns9oFNk34hvmJSEwdzsxVQ8YI5YaxtACgQatkYgv2VI2CFkUd2Y+xosPQnHv809g==", - "dev": true, - "optional": true, - "requires": { - "browserify-aes": "^1.0.6", - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4" - } - }, - "eccrypto": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/eccrypto/-/eccrypto-1.1.6.tgz", - "integrity": "sha512-d78ivVEzu7Tn0ZphUUaL43+jVPKTMPFGtmgtz1D0LrFn7cY3K8CdrvibuLz2AAkHBLKZtR8DMbB2ukRYFk987A==", - "dev": true, - "requires": { - "acorn": "7.1.1", - "elliptic": "6.5.4", - "es6-promise": "4.2.8", - "nan": "2.14.0", - "secp256k1": "3.7.1" - } - }, "electron-to-chromium": { "version": "1.4.295", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.295.tgz", @@ -9973,12 +9670,6 @@ "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==", "dev": true }, - "es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", - "dev": true - }, "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -10164,48 +9855,18 @@ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true }, - "ethereum-cryptography": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", - "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", - "dev": true, - "requires": { - "@types/pbkdf2": "^3.0.0", - "@types/secp256k1": "^4.0.1", - "blakejs": "^1.1.0", - "browserify-aes": "^1.2.0", - "bs58check": "^2.1.2", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "hash.js": "^1.1.7", - "keccak": "^3.0.0", - "pbkdf2": "^3.0.17", - "randombytes": "^2.1.0", - "safe-buffer": "^5.1.2", - "scrypt-js": "^3.0.0", - "secp256k1": "^4.0.1", - "setimmediate": "^1.0.5" - }, - "dependencies": { - "secp256k1": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", - "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", - "dev": true, - "requires": { - "elliptic": "^6.5.4", - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0" - } - } - } - }, "events": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", "dev": true }, + "eventsource": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", + "integrity": "sha512-IzUmBGPR3+oUG9dUeXynyNmf91/3zUSJg1lCktzKw47OXuhco54U3r9B7O4XX+Rb1Itm9OZ2b0RkTs10bICOxA==", + "dev": true + }, "evp_bytestokey": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", @@ -10333,13 +9994,6 @@ "flat-cache": "^3.0.4" } }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true, - "optional": true - }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -10384,13 +10038,21 @@ "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", "dev": true }, - "for-each": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", - "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "follow-redirects": { + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "dev": true + }, + "form-data": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", + "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", "dev": true, "requires": { - "is-callable": "^1.1.3" + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" } }, "fs.realpath": { @@ -10424,18 +10086,6 @@ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true }, - "get-intrinsic": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", - "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3" - } - }, "get-package-type": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", @@ -10500,15 +10150,6 @@ "slash": "^3.0.0" } }, - "gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "dev": true, - "requires": { - "get-intrinsic": "^1.1.3" - } - }, "graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", @@ -10536,27 +10177,6 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "has-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", - "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", - "dev": true - }, - "has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "dev": true - }, - "has-tostringtag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", - "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", - "dev": true, - "requires": { - "has-symbols": "^1.0.2" - } - }, "hash-base": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", @@ -10739,28 +10359,12 @@ "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==", "dev": true }, - "is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true }, - "is-callable": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", - "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", - "dev": true - }, "is-core-module": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz", @@ -10788,15 +10392,6 @@ "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", "dev": true }, - "is-generator-function": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", - "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", - "dev": true, - "requires": { - "has-tostringtag": "^1.0.0" - } - }, "is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -10833,19 +10428,6 @@ "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", "dev": true }, - "is-typed-array": { - "version": "1.1.10", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", - "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", - "dev": true, - "requires": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0" - } - }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -11491,17 +11073,6 @@ "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true }, - "keccak": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.3.tgz", - "integrity": "sha512-JZrLIAJWuZxKbCilMpNz5Vj7Vtb4scDG3dMXLOsbzBmQGyjwE61BbW7bJkfKKCShXiQZt3T6sBgALRtmd+nZaQ==", - "dev": true, - "requires": { - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0", - "readable-stream": "^3.6.0" - } - }, "key-encoder": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/key-encoder/-/key-encoder-2.0.3.tgz", @@ -11729,12 +11300,6 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "nan": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", - "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", - "dev": true - }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -11753,27 +11318,15 @@ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, - "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==", - "dev": true - }, "node-fetch": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.11.tgz", - "integrity": "sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==", + "version": "2.6.13", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.13.tgz", + "integrity": "sha512-StxNAxh15zr77QvvkmveSQ8uCQ4+v5FkvNTj0OESmiHu+VRi/gXArXtkWMElOsOUNLtUEvI4yS+rdtOHZTwlQA==", "dev": true, "requires": { "whatwg-url": "^5.0.0" } }, - "node-gyp-build": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", - "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==", - "dev": true - }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -12032,6 +11585,12 @@ "sisteransi": "^1.0.5" } }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, "public-encrypt": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", @@ -12238,38 +11797,6 @@ "ajv-keywords": "^3.5.2" } }, - "scrypt-js": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", - "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==", - "dev": true - }, - "secp256k1": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.7.1.tgz", - "integrity": "sha512-1cf8sbnRreXrQFdH6qsg2H71Xw91fCCS9Yp021GnUNJzWJS/py96fS4lHbnTnouLp08Xj6jBoBB6V78Tdbdu5g==", - "dev": true, - "optional": true, - "requires": { - "bindings": "^1.5.0", - "bip66": "^1.1.5", - "bn.js": "^4.11.8", - "create-hash": "^1.2.0", - "drbg.js": "^1.0.1", - "elliptic": "^6.4.1", - "nan": "^2.14.0", - "safe-buffer": "^5.1.2" - }, - "dependencies": { - "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==", - "dev": true, - "optional": true - } - } - }, "semver": { "version": "7.3.8", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", @@ -12300,12 +11827,6 @@ "randombytes": "^2.1.0" } }, - "setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", - "dev": true - }, "sha.js": { "version": "2.4.11", "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", @@ -12650,21 +12171,6 @@ "tslib": "^1.8.1" } }, - "tweetnacl-ts": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tweetnacl-ts/-/tweetnacl-ts-1.0.3.tgz", - "integrity": "sha512-C5I/dWf6xjAXaCDlf84T4HvozU/8ycAlq5WRllF1hAeeq5390tfXD+bNas5bhEV0HMSOx8bsQYpLjPl8wfnEeQ==", - "dev": true, - "requires": { - "tslib": "^1" - } - }, - "tweetnacl-util": { - "version": "0.15.1", - "resolved": "https://registry.npmjs.org/tweetnacl-util/-/tweetnacl-util-0.15.1.tgz", - "integrity": "sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw==", - "dev": true - }, "type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -12746,19 +12252,6 @@ } } }, - "util": { - "version": "0.12.5", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", - "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "which-typed-array": "^1.1.2" - } - }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -12954,20 +12447,6 @@ "integrity": "sha512-n1brCuqClxfFfq/Rb0ICg9giSZqCS+pLtccdag6C2HyufBrh3fBOiy9nb6ggRMvWOVH5GrdJskj5iGTZNxd7SA==", "dev": true }, - "which-typed-array": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz", - "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==", - "dev": true, - "requires": { - "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "has-tostringtag": "^1.0.0", - "is-typed-array": "^1.1.10" - } - }, "wildcard": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.0.tgz", diff --git a/package.json b/package.json index 259dca8..6de5a16 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "ts-results": "^3.3.0" }, "peerDependencies": { - "casper-js-sdk": "^2.12.0" + "casper-js-sdk": "^5.0.0-rc8" }, "devDependencies": { "@types/jest": "^29.4.0", @@ -47,7 +47,7 @@ "@typescript-eslint/parser": "^5.53.0", "browserify-zlib": "^0.2.0", "buffer": "^6.0.3", - "casper-js-sdk": "^2.12.0", + "casper-js-sdk": "^5.0.0-rc8", "copy-webpack-plugin": "^11.0.0", "crypto-browserify": "^3.12.0", "eslint": "^8.34.0", diff --git a/src/casper/types.ts b/src/casper/types.ts deleted file mode 100644 index 2c82deb..0000000 --- a/src/casper/types.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { CLType } from 'casper-js-sdk'; - -type TransformValue = any; - -interface Transform { - key: string; - transform: TransformValue; -} - -interface Effect { - transforms: Transform[]; -} - -interface ExecutionResultBody { - cost: number; - error_message?: string | null; - transfers: string[]; - effect: Effect; -} - -/** Result interface for an execution result */ -export interface ExecutionResult { - Success?: ExecutionResultBody; - Failure?: ExecutionResultBody; -} - -export interface WithRemainder { - data: T; - remainder: Uint8Array; -} - -export interface RawCLValue { - clType: CLType; - bytes: Uint8Array; -} diff --git a/src/casper/utils.ts b/src/casper/utils.ts deleted file mode 100644 index 2c76baf..0000000 --- a/src/casper/utils.ts +++ /dev/null @@ -1,227 +0,0 @@ -import { - CLBoolType, - CLByteArrayType, - CLI32Type, - CLI64Type, - CLKeyType, - CLListType, - CLMapType, - CLOptionType, - CLPublicKeyType, - CLResultType, - CLStringType, - CLTuple1Type, - CLType, - CLTypeTag, - CLU128Type, - CLU256Type, - CLU32BytesParser, - CLU32Type, - CLU512Type, - CLU64Type, - CLU8Type, - CLUnitType, - CLURefType, - ResultAndRemainder, - resultHelper, -} from 'casper-js-sdk'; -import { Err, Ok } from 'ts-results'; -import { RawCLValue, WithRemainder } from './types'; - -export function parseBytesWithRemainder( - rawBytes: Uint8Array, -): WithRemainder { - const length = Buffer.from(rawBytes).readUInt32LE(0); - if (length === 0 || length > rawBytes.length) { - throw new Error('invalid length value'); - } - - const remainder = rawBytes.subarray(4); - if (length > remainder.length) { - throw new Error('invalid length value after offset'); - } - - return { - data: remainder.subarray(0, length), - remainder: remainder.subarray(length), - }; -} - -export function parseCLValueFromBytesWithRemainder( - rawBytes: Uint8Array, -): WithRemainder { - const rawBytesWithRemainder = parseBytesWithRemainder(rawBytes); - - const clTypeWithRemainder = matchBytesToCLType( - rawBytesWithRemainder.remainder, - ); - - const clType = clTypeWithRemainder.result.unwrap(); - - if (!clTypeWithRemainder.remainder) { - throw new Error('remainder is empty'); - } - - return { - data: { - clType, - bytes: rawBytesWithRemainder.data, - }, - remainder: clTypeWithRemainder.remainder, - }; -} - -export function matchBytesToCLType( - bytes: Uint8Array, -): ResultAndRemainder { - const tag = bytes[0]; - const remainder = bytes.subarray(1); - - switch (tag) { - case CLTypeTag.Bool: - return resultHelper(Ok(new CLBoolType()), remainder); - case CLTypeTag.I32: - return resultHelper(Ok(new CLI32Type()), remainder); - case CLTypeTag.I64: - return resultHelper(Ok(new CLI64Type()), remainder); - case CLTypeTag.U8: - return resultHelper(Ok(new CLU8Type()), remainder); - case CLTypeTag.U32: - return resultHelper(Ok(new CLU32Type()), remainder); - case CLTypeTag.U64: - return resultHelper(Ok(new CLU64Type()), remainder); - case CLTypeTag.U64: - return resultHelper(Ok(new CLU64Type()), remainder); - case CLTypeTag.U128: - return resultHelper(Ok(new CLU128Type()), remainder); - case CLTypeTag.U256: - return resultHelper(Ok(new CLU256Type()), remainder); - case CLTypeTag.U512: - return resultHelper(Ok(new CLU512Type()), remainder); - case CLTypeTag.Unit: - return resultHelper(Ok(new CLUnitType()), remainder); - case CLTypeTag.String: - return resultHelper(Ok(new CLStringType()), remainder); - case CLTypeTag.Key: - return resultHelper(Ok(new CLKeyType()), remainder); - case CLTypeTag.URef: - return resultHelper(Ok(new CLURefType()), remainder); - case CLTypeTag.Option: { - const { result, remainder: typeRem } = matchBytesToCLType(remainder); - - const innerType = result.unwrap(); - - return resultHelper(Ok(new CLOptionType(innerType)), typeRem); - } - case CLTypeTag.List: { - const { result, remainder: typeRem } = matchBytesToCLType(remainder); - - const innerType = result.unwrap(); - - return resultHelper(Ok(new CLListType(innerType)), typeRem); - } - case CLTypeTag.ByteArray: { - const { result: sizeRes, remainder: rem } = - new CLU32BytesParser().fromBytesWithRemainder(remainder); - - const size = sizeRes.unwrap().value().toNumber(); - - return resultHelper(Ok(new CLByteArrayType(size)), rem); - } - case CLTypeTag.Result: { - const { result: okTypeRes, remainder: okTypeRem } = - matchBytesToCLType(remainder); - const okType = okTypeRes.unwrap(); - - if (!okTypeRem) - return resultHelper(Err('Missing Error type bytes in Result')); - - const { result: errTypeRes, remainder: rem } = - matchBytesToCLType(okTypeRem); - const errType = errTypeRes.unwrap(); - - return resultHelper( - Ok(new CLResultType({ ok: okType, err: errType })), - rem, - ); - } - case CLTypeTag.Map: { - const { result: keyTypeRes, remainder: keyTypeRem } = - matchBytesToCLType(remainder); - const keyType = keyTypeRes.unwrap(); - - if (!keyTypeRem) - return resultHelper(Err('Missing Key type bytes in Map')); - - const { result: valTypeRes, remainder: rem } = - matchBytesToCLType(keyTypeRem); - const valType = valTypeRes.unwrap(); - - return resultHelper(Ok(new CLMapType([keyType, valType])), rem); - } - case CLTypeTag.Tuple1: { - const { result: innerTypeRes, remainder: rem } = - matchBytesToCLType(remainder); - const innerType = innerTypeRes.unwrap(); - - return resultHelper(Ok(new CLTuple1Type([innerType])), rem); - } - case CLTypeTag.Tuple2: { - const { result: innerType1Res, remainder: innerType1Rem } = - matchBytesToCLType(remainder); - const innerType1 = innerType1Res.unwrap(); - - if (!innerType1Rem) { - return resultHelper( - Err('Missing second tuple type bytes in CLTuple2Type'), - ); - } - - const { result: innerType2Res, remainder: innerType2Rem } = - matchBytesToCLType(innerType1Rem); - const innerType2 = innerType2Res.unwrap(); - - return resultHelper( - Ok(new CLTuple1Type([innerType1, innerType2])), - innerType2Rem, - ); - } - case CLTypeTag.Tuple3: { - const { result: innerType1Res, remainder: innerType1Rem } = - matchBytesToCLType(remainder); - const innerType1 = innerType1Res.unwrap(); - - if (!innerType1Rem) { - return resultHelper( - Err('Missing second tuple type bytes in CLTuple2Type'), - ); - } - - const { result: innerType2Res, remainder: innerType2Rem } = - matchBytesToCLType(innerType1Rem); - const innerType2 = innerType2Res.unwrap(); - - if (!innerType2Rem) { - return resultHelper( - Err('Missing third tuple type bytes in CLTuple2Type'), - ); - } - - const { result: innerType3Res, remainder: innerType3Rem } = - matchBytesToCLType(innerType2Rem); - const innerType3 = innerType3Res.unwrap(); - - return resultHelper( - Ok(new CLTuple1Type([innerType1, innerType2, innerType3])), - innerType3Rem, - ); - } - case CLTypeTag.Any: { - return resultHelper(Err('Any unsupported')); - } - case CLTypeTag.PublicKey: - return resultHelper(Ok(new CLPublicKeyType()), remainder); - } - - return resultHelper(Err('Unsuported type')); -} diff --git a/src/event.ts b/src/event.ts index 38e353f..9790cda 100644 --- a/src/event.ts +++ b/src/event.ts @@ -1,28 +1,25 @@ -import { CLValue, decodeBase16, matchByteParserByCLType } from 'casper-js-sdk'; -import { WithRemainder } from './casper/types'; +import { CLValue, Hash, IResultWithBytes } from 'casper-js-sdk'; +import { toBytesString } from "casper-js-sdk/dist/types/ByteConverters"; +import { CLValueParser } from "casper-js-sdk/dist/types/clvalue/Parser"; -import { - parseBytesWithRemainder, - parseCLValueFromBytesWithRemainder, -} from './casper/utils'; import { Schema, Schemas } from './schema'; const EVENT_PREFIX = 'event_'; export interface Event { name: string; - contractHash: Uint8Array | null; - contractPackageHash: Uint8Array | null; + contractHash: Hash | null; + contractPackageHash: Hash | null; data: Record; } export function parseEventNameWithRemainder( rawEvent: Uint8Array, -): WithRemainder { - const eventNameWithRemainder = parseBytesWithRemainder(rawEvent); +): IResultWithBytes { + const eventNameWithRemainder = CLValueParser.fromBytesWithType(rawEvent); const eventNameWithPrefix = new TextDecoder().decode( - eventNameWithRemainder.data, + eventNameWithRemainder.result.bytes(), ); if (!eventNameWithPrefix.startsWith(EVENT_PREFIX)) { @@ -32,8 +29,8 @@ export function parseEventNameWithRemainder( const eventName = eventNameWithPrefix.replace('event_', ''); return { - data: eventName, - remainder: eventNameWithRemainder.remainder, + result: eventName, + bytes: eventNameWithRemainder.bytes, }; } @@ -44,28 +41,28 @@ export function parseEventNameAndData( name: string; data: Record; } { - const event = decodeBase16(rawEvent); + const event = toBytesString(rawEvent); - const clValueWithRemainder = parseCLValueFromBytesWithRemainder(event); + const clValueWithRemainder = CLValueParser.fromBytesWithType(event); - if (clValueWithRemainder.data.bytes.length < 4) { + if (clValueWithRemainder.result.bytes().length < 4) { throw new Error('invalid event bytes'); } const eventNameWithRemainder = parseEventNameWithRemainder( - clValueWithRemainder.data.bytes.subarray(4), + clValueWithRemainder.result.bytes().subarray(4), ); - const eventSchema = schemas[eventNameWithRemainder.data]; + const eventSchema = schemas[eventNameWithRemainder.result]; if (!eventSchema) { throw new Error('event name not in schema'); } return { - name: eventNameWithRemainder.data, + name: eventNameWithRemainder.result, data: parseEventDataFromBytes( eventSchema, - eventNameWithRemainder.remainder, + eventNameWithRemainder.bytes, ), }; } @@ -79,19 +76,14 @@ export function parseEventDataFromBytes( let remainder = rawBytes; for (const item of schema) { - const parser = matchByteParserByCLType(item.value).unwrap(); + const clValueWithRemainder = CLValueParser.fromBytesByType(remainder, item.value); - const clValueWithRemainder = parser.fromBytesWithRemainder( - remainder, - item.value, - ); - - if (!clValueWithRemainder.remainder) { + if (!clValueWithRemainder.bytes) { throw new Error('remainder is empty'); } - result[item.property] = clValueWithRemainder.result.unwrap(); - remainder = clValueWithRemainder.remainder; + result[item.property] = clValueWithRemainder.result; + remainder = clValueWithRemainder.bytes; } return result; diff --git a/src/index.ts b/src/index.ts index f447b39..41b234d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,5 +14,4 @@ export { export { ExecutionResult } from './casper/types'; export { parseBytesWithRemainder, - parseCLValueFromBytesWithRemainder, } from './casper/utils'; diff --git a/src/parser.ts b/src/parser.ts index 809d1bf..b91de8b 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -1,34 +1,24 @@ -import { - CasperServiceByJsonRPC, - decodeBase16, - encodeBase16, -} from 'casper-js-sdk'; -import { - parseBytesWithRemainder, - parseCLValueFromBytesWithRemainder, -} from './casper/utils'; +import { ExecutionResult, Hash, IResultWithBytes, RpcClient, URef } from 'casper-js-sdk'; import { Event, parseEventDataFromBytes, parseEventNameWithRemainder, } from './event'; -import { ExecutionResult, RawCLValue, WithRemainder } from './casper/types'; import { parseSchemasFromBytes, Schemas } from './schema'; +import { CLValueParser } from "casper-js-sdk/dist/types/clvalue/Parser"; export interface ContractMetadata { schemas: Schemas; - contractHash: Uint8Array; - contractPackageHash: Uint8Array; - eventsSchemaUref: string; - eventsUref: string; + contractHash: Hash; + contractPackageHash: Hash; + eventsSchemaUref: URef; + eventsUref: URef; } export const EVENTS_SCHEMA_NAMED_KEY = '__events_schema'; export const EVENTS_NAMED_KEY = '__events'; -const DICTIONARY_PREFIX = 'dictionary-'; - export interface ParseResult { error: string | null; event: Event; @@ -40,7 +30,7 @@ export class Parser { ) {} static async create( - rpcClient: CasperServiceByJsonRPC, + rpcClient: RpcClient, contractHashes: string[], ): Promise { const contractsMetadata = await Parser.getContractsMetadata( @@ -52,58 +42,59 @@ export class Parser { } public parseExecutionResult(executionResult: ExecutionResult): ParseResult[] { - if (!executionResult.Success) { - throw new Error('failed deploy'); + if (executionResult.errorMessage) { + throw new Error(`failed deploy ${executionResult.errorMessage}`); } const results: ParseResult[] = []; - for (const transform of executionResult.Success.effect.transforms) { - if (!transform.transform.WriteCLValue) { + for (const transform of executionResult.effects) { + if (!transform.key.dictionary) { continue; } - if (!transform.key.startsWith(DICTIONARY_PREFIX)) { + if (!transform.kind.isWriteCLValue()) { continue; } - let clValueWithRemainder: WithRemainder; - try { - clValueWithRemainder = parseCLValueFromBytesWithRemainder( - decodeBase16(transform.transform.WriteCLValue.bytes), - ); - } catch (err) { - continue; + const eventPayloadCLValueWithRemainder = CLValueParser.fromBytesWithType(transform.kind.parseAsWriteCLValue().toBytes()) + + if (!eventPayloadCLValueWithRemainder.result.any) { + continue } - if (clValueWithRemainder.data.bytes.length < 4) { + eventPayloadCLValueWithRemainder.bytes + + if (eventPayloadCLValueWithRemainder.bytes.length < 4) { continue; } - let eventNameWithRemainder: WithRemainder; + let eventNameWithRemainder: IResultWithBytes; try { eventNameWithRemainder = parseEventNameWithRemainder( - clValueWithRemainder.data.bytes.subarray(4), + eventPayloadCLValueWithRemainder.bytes.subarray(4), ); } catch (err) { continue; } - const urefBytesWithRemainder = parseBytesWithRemainder( - clValueWithRemainder.remainder, + const urefBytesWithRemainder = CLValueParser.fromBytesWithType( + eventPayloadCLValueWithRemainder.bytes, ); - const uref = `uref-${encodeBase16(urefBytesWithRemainder.data)}-007`; + if (!urefBytesWithRemainder.result.uref) { + throw new Error('not a valid uref for parsing'); + } const parsedEvent: Event = { contractHash: null, contractPackageHash: null, - name: eventNameWithRemainder.data, + name: eventNameWithRemainder.result, data: {}, }; - const contractMetadata = this.contractsMetadata[uref]; + const contractMetadata = this.contractsMetadata[urefBytesWithRemainder.result.uref.toString()]; if (!contractMetadata) { results.push({ event: parsedEvent, @@ -116,7 +107,7 @@ export class Parser { parsedEvent.contractHash = contractMetadata.contractHash; parsedEvent.contractPackageHash = contractMetadata.contractPackageHash; - const eventSchema = contractMetadata.schemas[eventNameWithRemainder.data]; + const eventSchema = contractMetadata.schemas[eventNameWithRemainder.result]; if (!eventSchema) { results.push({ event: parsedEvent, @@ -129,7 +120,7 @@ export class Parser { try { parsedEvent.data = parseEventDataFromBytes( eventSchema, - eventNameWithRemainder.remainder, + eventNameWithRemainder.bytes, ); } catch (err) { results.push({ @@ -150,32 +141,32 @@ export class Parser { } private static async getContractsMetadata( - rpcClient: CasperServiceByJsonRPC, + rpcClient: RpcClient, contractHashes: string[], ): Promise> { const contractsSchemas: Record = {}; - const stateRootHash = await rpcClient.getStateRootHash(); + const stateRootHash = await rpcClient.getStateRootHashLatest(); for (const contractHash of contractHashes) { const contractData = ( - await rpcClient.getBlockState(stateRootHash, `hash-${contractHash}`, []) - ).Contract; + await rpcClient.getStateItem(stateRootHash.stateRootHash.toHex(), `hash-${contractHash}`, []) + ).storedValue.contract; if (!contractData) { throw new Error('contract data not found'); } - let eventsSchemaUref = '', - eventsUref = ''; - for (const namedKey of contractData.namedKeys) { + let eventsSchemaUref: URef | undefined, + eventsUref : URef | undefined; + for (const namedKey of contractData.namedKeys.keys) { if (namedKey.name === EVENTS_SCHEMA_NAMED_KEY) { - eventsSchemaUref = namedKey.key; + eventsSchemaUref = namedKey.key.uRef; } else if (namedKey.name === EVENTS_NAMED_KEY) { - eventsUref = namedKey.key; + eventsUref = namedKey.key.uRef; } - if (eventsSchemaUref !== '' && eventsUref !== '') { + if (!!eventsSchemaUref && !!eventsUref) { break; } } @@ -188,28 +179,17 @@ export class Parser { throw new Error(`no '${EVENTS_NAMED_KEY}' uref found`); } - const schemaResponse = await rpcClient['client'].request({ - method: 'state_get_item', - params: { - state_root_hash: stateRootHash, - key: eventsSchemaUref, - path: [], - }, - }); + const schemaResponse = await rpcClient.getStateItem(stateRootHash.stateRootHash.toHex(), eventsSchemaUref.toString(), []); + if (!schemaResponse.storedValue.clValue) { + throw new Error(`no schema uref for ${eventsSchemaUref}`); + } - const schemas = parseSchemasFromBytes( - decodeBase16(schemaResponse.stored_value.CLValue.bytes), - ); + const schemas = parseSchemasFromBytes(schemaResponse.storedValue.clValue.bytes()); - const contractPackageHash = contractData.contractPackageHash.replace( - /^(contract-package-wasm|contract-package-)/, - '', - ); - - contractsSchemas[eventsUref] = { + contractsSchemas[eventsUref.toString()] = { schemas, - contractHash: decodeBase16(contractHash), - contractPackageHash: decodeBase16(contractPackageHash), + contractHash: Hash.fromHex(contractHash), + contractPackageHash: contractData.contractPackageHash.hash, eventsSchemaUref, eventsUref, }; @@ -220,18 +200,15 @@ export class Parser { } export async function fetchContractSchemasBytes( - rpcClient: CasperServiceByJsonRPC, + rpcClient: RpcClient, contractHash: string, stateRootHash: string, ): Promise { - const schemaResponse = await rpcClient['client'].request({ - method: 'state_get_item', - params: { - state_root_hash: stateRootHash, - key: `hash-${contractHash}`, - path: [EVENTS_SCHEMA_NAMED_KEY], - }, - }); - - return decodeBase16(schemaResponse.stored_value.CLValue.bytes); + const schemaResponse = await rpcClient.getStateItem(stateRootHash, `hash-${contractHash}`, [EVENTS_SCHEMA_NAMED_KEY]); + + if (!schemaResponse.storedValue.clValue) { + throw new Error('no clvalue for contract schema'); + } + + return schemaResponse.storedValue.clValue.bytes(); } diff --git a/src/schema.ts b/src/schema.ts index eb0aba4..c1aef12 100644 --- a/src/schema.ts +++ b/src/schema.ts @@ -1,13 +1,12 @@ -import { CasperServiceByJsonRPC, CLType, decodeBase16 } from 'casper-js-sdk'; -import { WithRemainder } from './casper/types'; -import { matchBytesToCLType, parseBytesWithRemainder } from './casper/utils'; +import {CLType, CLTypeParser, IResultWithBytes, RpcClient} from 'casper-js-sdk'; import { EVENTS_SCHEMA_NAMED_KEY } from './parser'; +import { CLValueParser } from "casper-js-sdk/dist/types/clvalue/Parser"; export type Schemas = Record; -export type Schema = PropertyDefenition[]; +export type Schema = PropertyDefinition[]; -interface PropertyDefenition { +interface PropertyDefinition { property: string; value: CLType; } @@ -23,17 +22,15 @@ export function parseSchemasFromBytes(rawSchemas: Uint8Array): Schemas { const schemas: Schemas = {}; for (let i = 0; i < schemasNumber; i++) { - const rawBytesWithRemainder = parseBytesWithRemainder(remainder); - - const schemaName = new TextDecoder().decode(rawBytesWithRemainder.data); + const schemaName = CLValueParser.fromBytesWithType(remainder); const schemaWithRemainder = parseSchemaFromBytesWithRemainder( - rawBytesWithRemainder.remainder, + schemaName.bytes, ); - schemas[schemaName] = schemaWithRemainder.data; + schemas[schemaName.result.toString()] = schemaWithRemainder.result; - remainder = schemaWithRemainder.remainder; + remainder = schemaWithRemainder.bytes; } return schemas; @@ -41,7 +38,7 @@ export function parseSchemasFromBytes(rawSchemas: Uint8Array): Schemas { export function parseSchemaFromBytesWithRemainder( rawBytes: Uint8Array, -): WithRemainder { +): IResultWithBytes { const fieldsNumber = Buffer.from(rawBytes).readUInt32LE(0); if (fieldsNumber > rawBytes.length) { throw new Error('invalid fieldsNumber value'); @@ -52,47 +49,42 @@ export function parseSchemaFromBytesWithRemainder( const schema: Schema = []; for (let i = 0; i < fieldsNumber; i++) { - const rawBytesWithRemainder = parseBytesWithRemainder(remainder); - - const fieldName = new TextDecoder().decode(rawBytesWithRemainder.data); - remainder = rawBytesWithRemainder.remainder; + const fieldName = CLValueParser.fromBytesWithType(remainder); - const clTypeWithRemainder = matchBytesToCLType(remainder); + const clTypeWithRemainder = CLTypeParser.matchBytesToCLType(fieldName.bytes); - const clType = clTypeWithRemainder.result.unwrap(); + remainder = fieldName.bytes; - if (!clTypeWithRemainder.remainder) { + if (!clTypeWithRemainder.bytes) { throw new Error('remainder is empty'); } schema.push({ - property: fieldName, - value: clType, + property: fieldName.result.toString(), + value: clTypeWithRemainder.result, }); - remainder = clTypeWithRemainder.remainder; + remainder = clTypeWithRemainder.bytes; } return { - data: schema, - remainder, + result: schema, + bytes: remainder, }; } export async function fetchContractSchemasBytes( - rpcClient: CasperServiceByJsonRPC, + rpcClient: RpcClient, contractHash: string, stateRootHash: string, ): Promise { - const contractData = ( - await rpcClient.getBlockState(stateRootHash, `hash-${contractHash}`, []) - ).Contract; + const contractData = await rpcClient.getStateItem(stateRootHash, `hash-${contractHash}`, []); - if (!contractData) { + if (!contractData || !contractData.storedValue.contract) { throw new Error('contract data not found'); } - const eventsSchema = contractData.namedKeys.find( + const eventsSchema = contractData.storedValue.contract.namedKeys.keys.find( el => el.name === EVENTS_SCHEMA_NAMED_KEY, ); if (!eventsSchema) { @@ -101,14 +93,11 @@ export async function fetchContractSchemasBytes( ); } - const schemaResponse = await rpcClient['client'].request({ - method: 'state_get_item', - params: { - state_root_hash: stateRootHash, - key: eventsSchema.key, - path: [], - }, - }); + const schemaResponse = await rpcClient.getStateItem(stateRootHash, eventsSchema.key.toString(), []); + + if (!schemaResponse.storedValue.clValue) { + throw new Error('no CLValue for schema'); + } - return decodeBase16(schemaResponse.stored_value.CLValue.bytes); + return schemaResponse.storedValue.clValue.bytes(); }