From fcf9c7044f8dbded85e8144890ce9a2f89ff4f58 Mon Sep 17 00:00:00 2001 From: Tom Beynon Date: Tue, 24 Dec 2024 17:43:40 +0000 Subject: [PATCH 1/8] Initial spike to test Injective ledger concept --- package-lock.json | 1613 ++++++++++++++++++++-- package.json | 9 +- src/adapters/DefaultSigningAdapter.mjs | 59 +- src/adapters/InjectiveSigningAdapter.mjs | 92 ++ src/adapters/TerraSigningAdapter.mjs | 4 +- src/components/App.js | 4 - src/components/DelegateForm.js | 6 +- src/components/VoteForm.js | 11 +- src/messages/delegate.mjs | 5 + src/messages/message.mjs | 58 + src/messages/vote.mjs | 16 + src/networks.json | 3 +- src/utils/Helpers.mjs | 6 +- src/utils/KeplrSignerProvider.mjs | 4 + src/utils/QueryClient.mjs | 21 +- src/utils/SigningClient.mjs | 4 +- src/utils/Validator.mjs | 6 +- 17 files changed, 1729 insertions(+), 192 deletions(-) create mode 100644 src/adapters/InjectiveSigningAdapter.mjs create mode 100644 src/messages/delegate.mjs create mode 100644 src/messages/message.mjs create mode 100644 src/messages/vote.mjs diff --git a/package-lock.json b/package-lock.json index fe21b20b..f1b09d84 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,8 +10,9 @@ "dependencies": { "@bugsnag/js": "^7.16.1", "@bugsnag/plugin-react": "^7.16.1", - "@cosmjs/proto-signing": "^0.28.1", - "@cosmjs/stargate": "^0.28.1", + "@cosmjs/proto-signing": "^0.32.4", + "@cosmjs/stargate": "^0.32.4", + "@injectivelabs/sdk-ts": "^1.14.13", "@keplr-wallet/wc-client": "^0.11.3", "@terra-money/terra.js": "^3.1.8", "@testing-library/jest-dom": "^5.16.2", @@ -53,12 +54,16 @@ "devDependencies": { "@parcel/packager-raw-url": "^2.12.0", "@parcel/transformer-webmanifest": "^2.12.0", + "assert": "^2.1.0", "crypto-browserify": "^3.12.0", "eslint": "^9.4.0", "events": "^3.3.0", + "https-browserify": "^1.0.0", "parcel": "^2.12.0", "path-browserify": "^1.0.1", "stream-browserify": "^3.0.0", + "stream-http": "^3.2.0", + "url": "^0.11.4", "vm-browserify": "^1.1.2" } }, @@ -68,6 +73,66 @@ "integrity": "sha512-Ff9+ksdQQB3rMncgqDK78uLznstjyfIf2Arnh22pW8kBpLs6rpKDwgnZT46hin5Hl1WzazzK64DOrhSwYpS7bQ==", "license": "MIT" }, + "node_modules/@adraffy/ens-normalize": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", + "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==" + }, + "node_modules/@apollo/client": { + "version": "3.11.8", + "resolved": "https://registry.npmjs.org/@apollo/client/-/client-3.11.8.tgz", + "integrity": "sha512-CgG1wbtMjsV2pRGe/eYITmV5B8lXUCYljB2gB/6jWTFQcrvirUVvKg7qtFdjYkQSFbIffU1IDyxgeaN81eTjbA==", + "dependencies": { + "@graphql-typed-document-node/core": "^3.1.1", + "@wry/caches": "^1.0.0", + "@wry/equality": "^0.5.6", + "@wry/trie": "^0.5.0", + "graphql-tag": "^2.12.6", + "hoist-non-react-statics": "^3.3.2", + "optimism": "^0.18.0", + "prop-types": "^15.7.2", + "rehackt": "^0.1.0", + "response-iterator": "^0.2.6", + "symbol-observable": "^4.0.0", + "ts-invariant": "^0.10.3", + "tslib": "^2.3.0", + "zen-observable-ts": "^1.2.5" + }, + "peerDependencies": { + "graphql": "^15.0.0 || ^16.0.0", + "graphql-ws": "^5.5.5", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0", + "subscriptions-transport-ws": "^0.9.0 || ^0.11.0" + }, + "peerDependenciesMeta": { + "graphql-ws": { + "optional": true + }, + "react": { + "optional": true + }, + "react-dom": { + "optional": true + }, + "subscriptions-transport-ws": { + "optional": true + } + } + }, + "node_modules/@apollo/client/node_modules/symbol-observable": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-4.0.0.tgz", + "integrity": "sha512-b19dMThMV4HVFynSAM1++gBHAbk2Tc/osgLIBZMKsyqh34jb2e8Os7T6ZW/Bt3pJFdBTd2JwAnAAEQV7rSNvcQ==", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/@apollo/client/node_modules/tslib": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", + "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + }, "node_modules/@babel/code-frame": { "version": "7.24.7", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", @@ -439,36 +504,36 @@ } }, "node_modules/@cosmjs/amino": { - "version": "0.28.13", - "resolved": "https://registry.npmjs.org/@cosmjs/amino/-/amino-0.28.13.tgz", - "integrity": "sha512-IHnH2zGwaY69qT4mVAavr/pfzx6YE+ud1NHJbvVePlbGiz68CXTi5LHR+K0lrKB5mQ7E+ZErWz2mw5U/x+V1wQ==", + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@cosmjs/amino/-/amino-0.32.4.tgz", + "integrity": "sha512-zKYOt6hPy8obIFtLie/xtygCkH9ZROiQ12UHfKsOkWaZfPQUvVbtgmu6R4Kn1tFLI/SRkw7eqhaogmW/3NYu/Q==", "license": "Apache-2.0", "dependencies": { - "@cosmjs/crypto": "0.28.13", - "@cosmjs/encoding": "0.28.13", - "@cosmjs/math": "0.28.13", - "@cosmjs/utils": "0.28.13" + "@cosmjs/crypto": "^0.32.4", + "@cosmjs/encoding": "^0.32.4", + "@cosmjs/math": "^0.32.4", + "@cosmjs/utils": "^0.32.4" } }, "node_modules/@cosmjs/crypto": { - "version": "0.28.13", - "resolved": "https://registry.npmjs.org/@cosmjs/crypto/-/crypto-0.28.13.tgz", - "integrity": "sha512-ynKfM0q/tMBQMHJby6ad8lR3gkgBKaelQhIsCZTjClsnuC7oYT9y3ThSZCUWr7Pa9h0J8ahU2YV2oFWFVWJQzQ==", + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@cosmjs/crypto/-/crypto-0.32.4.tgz", + "integrity": "sha512-zicjGU051LF1V9v7bp8p7ovq+VyC91xlaHdsFOTo2oVry3KQikp8L/81RkXmUIT8FxMwdx1T7DmFwVQikcSDIw==", "license": "Apache-2.0", "dependencies": { - "@cosmjs/encoding": "0.28.13", - "@cosmjs/math": "0.28.13", - "@cosmjs/utils": "0.28.13", + "@cosmjs/encoding": "^0.32.4", + "@cosmjs/math": "^0.32.4", + "@cosmjs/utils": "^0.32.4", "@noble/hashes": "^1", "bn.js": "^5.2.0", - "elliptic": "^6.5.3", - "libsodium-wrappers": "^0.7.6" + "elliptic": "^6.5.4", + "libsodium-wrappers-sumo": "^0.7.11" } }, "node_modules/@cosmjs/encoding": { - "version": "0.28.13", - "resolved": "https://registry.npmjs.org/@cosmjs/encoding/-/encoding-0.28.13.tgz", - "integrity": "sha512-jtXbAYtV77rLHxoIrjGFsvgGjeTKttuHRv6cvuy3toCZzY7JzTclKH5O2g36IIE4lXwD9xwuhGJ2aa6A3dhNkA==", + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@cosmjs/encoding/-/encoding-0.32.4.tgz", + "integrity": "sha512-tjvaEy6ZGxJchiizzTn7HVRiyTg1i4CObRRaTRPknm5EalE13SV+TCHq38gIDfyUeden4fCuaBVEdBR5+ti7Hw==", "license": "Apache-2.0", "dependencies": { "base64-js": "^1.3.0", @@ -477,131 +542,99 @@ } }, "node_modules/@cosmjs/json-rpc": { - "version": "0.28.13", - "resolved": "https://registry.npmjs.org/@cosmjs/json-rpc/-/json-rpc-0.28.13.tgz", - "integrity": "sha512-fInSvg7x9P6p+GWqet+TMhrMTM3OWWdLJOGS5w2ryubMjgpR1rLiAx77MdTNkArW+/6sUwku0sN4veM4ENQu6A==", + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@cosmjs/json-rpc/-/json-rpc-0.32.4.tgz", + "integrity": "sha512-/jt4mBl7nYzfJ2J/VJ+r19c92mUKF0Lt0JxM3MXEJl7wlwW5haHAWtzRujHkyYMXOwIR+gBqT2S0vntXVBRyhQ==", "license": "Apache-2.0", "dependencies": { - "@cosmjs/stream": "0.28.13", + "@cosmjs/stream": "^0.32.4", "xstream": "^11.14.0" } }, "node_modules/@cosmjs/math": { - "version": "0.28.13", - "resolved": "https://registry.npmjs.org/@cosmjs/math/-/math-0.28.13.tgz", - "integrity": "sha512-PDpL8W/kbyeWi0mQ2OruyqE8ZUAdxPs1xCbDX3WXJwy2oU+X2UTbkuweJHVpS9CIqmZulBoWQAmlf6t6zr1N/g==", + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@cosmjs/math/-/math-0.32.4.tgz", + "integrity": "sha512-++dqq2TJkoB8zsPVYCvrt88oJWsy1vMOuSOKcdlnXuOA/ASheTJuYy4+oZlTQ3Fr8eALDLGGPhJI02W2HyAQaw==", "license": "Apache-2.0", "dependencies": { "bn.js": "^5.2.0" } }, "node_modules/@cosmjs/proto-signing": { - "version": "0.28.13", - "resolved": "https://registry.npmjs.org/@cosmjs/proto-signing/-/proto-signing-0.28.13.tgz", - "integrity": "sha512-nSl/2ZLsUJYz3Ad0RY3ihZUgRHIow2OnYqKsESMu+3RA/jTi9bDYhiBu8mNMHI0xrEJry918B2CyI56pOUHdPQ==", - "license": "Apache-2.0", - "dependencies": { - "@cosmjs/amino": "0.28.13", - "@cosmjs/crypto": "0.28.13", - "@cosmjs/encoding": "0.28.13", - "@cosmjs/math": "0.28.13", - "@cosmjs/utils": "0.28.13", - "cosmjs-types": "^0.4.0", - "long": "^4.0.0" - } - }, - "node_modules/@cosmjs/proto-signing/node_modules/cosmjs-types": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/cosmjs-types/-/cosmjs-types-0.4.1.tgz", - "integrity": "sha512-I7E/cHkIgoJzMNQdFF0YVqPlaTqrqKHrskuSTIqlEyxfB5Lf3WKCajSXVK2yHOfOFfSux/RxEdpMzw/eO4DIog==", + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@cosmjs/proto-signing/-/proto-signing-0.32.4.tgz", + "integrity": "sha512-QdyQDbezvdRI4xxSlyM1rSVBO2st5sqtbEIl3IX03uJ7YiZIQHyv6vaHVf1V4mapusCqguiHJzm4N4gsFdLBbQ==", "license": "Apache-2.0", "dependencies": { - "long": "^4.0.0", - "protobufjs": "~6.11.2" + "@cosmjs/amino": "^0.32.4", + "@cosmjs/crypto": "^0.32.4", + "@cosmjs/encoding": "^0.32.4", + "@cosmjs/math": "^0.32.4", + "@cosmjs/utils": "^0.32.4", + "cosmjs-types": "^0.9.0" } }, "node_modules/@cosmjs/socket": { - "version": "0.28.13", - "resolved": "https://registry.npmjs.org/@cosmjs/socket/-/socket-0.28.13.tgz", - "integrity": "sha512-lavwGxQ5VdeltyhpFtwCRVfxeWjH5D5mmN7jgx9nuCf3XSFbTcOYxrk2pQ4usenu1Q1KZdL4Yl5RCNrJuHD9Ug==", + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@cosmjs/socket/-/socket-0.32.4.tgz", + "integrity": "sha512-davcyYziBhkzfXQTu1l5NrpDYv0K9GekZCC9apBRvL1dvMc9F/ygM7iemHjUA+z8tJkxKxrt/YPjJ6XNHzLrkw==", "license": "Apache-2.0", "dependencies": { - "@cosmjs/stream": "0.28.13", + "@cosmjs/stream": "^0.32.4", "isomorphic-ws": "^4.0.1", "ws": "^7", "xstream": "^11.14.0" } }, "node_modules/@cosmjs/stargate": { - "version": "0.28.13", - "resolved": "https://registry.npmjs.org/@cosmjs/stargate/-/stargate-0.28.13.tgz", - "integrity": "sha512-dVBMazDz8/eActHsRcZjDHHptOBMqvibj5CFgEtZBp22gP6ASzoAUXTlkSVk5FBf4sfuUHoff6st134/+PGMAg==", + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@cosmjs/stargate/-/stargate-0.32.4.tgz", + "integrity": "sha512-usj08LxBSsPRq9sbpCeVdyLx2guEcOHfJS9mHGCLCXpdAPEIEQEtWLDpEUc0LEhWOx6+k/ChXTc5NpFkdrtGUQ==", "license": "Apache-2.0", "dependencies": { "@confio/ics23": "^0.6.8", - "@cosmjs/amino": "0.28.13", - "@cosmjs/encoding": "0.28.13", - "@cosmjs/math": "0.28.13", - "@cosmjs/proto-signing": "0.28.13", - "@cosmjs/stream": "0.28.13", - "@cosmjs/tendermint-rpc": "0.28.13", - "@cosmjs/utils": "0.28.13", - "cosmjs-types": "^0.4.0", - "long": "^4.0.0", - "protobufjs": "~6.11.3", + "@cosmjs/amino": "^0.32.4", + "@cosmjs/encoding": "^0.32.4", + "@cosmjs/math": "^0.32.4", + "@cosmjs/proto-signing": "^0.32.4", + "@cosmjs/stream": "^0.32.4", + "@cosmjs/tendermint-rpc": "^0.32.4", + "@cosmjs/utils": "^0.32.4", + "cosmjs-types": "^0.9.0", "xstream": "^11.14.0" } }, - "node_modules/@cosmjs/stargate/node_modules/cosmjs-types": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/cosmjs-types/-/cosmjs-types-0.4.1.tgz", - "integrity": "sha512-I7E/cHkIgoJzMNQdFF0YVqPlaTqrqKHrskuSTIqlEyxfB5Lf3WKCajSXVK2yHOfOFfSux/RxEdpMzw/eO4DIog==", - "license": "Apache-2.0", - "dependencies": { - "long": "^4.0.0", - "protobufjs": "~6.11.2" - } - }, "node_modules/@cosmjs/stream": { - "version": "0.28.13", - "resolved": "https://registry.npmjs.org/@cosmjs/stream/-/stream-0.28.13.tgz", - "integrity": "sha512-AnjtfwT8NwPPkd3lhZhjOlOzT0Kn9bgEu2IPOZjQ1nmG2bplsr6TJmnwn0dJxHT7UGtex17h6whKB5N4wU37Wg==", + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@cosmjs/stream/-/stream-0.32.4.tgz", + "integrity": "sha512-Gih++NYHEiP+oyD4jNEUxU9antoC0pFSg+33Hpp0JlHwH0wXhtD3OOKnzSfDB7OIoEbrzLJUpEjOgpCp5Z+W3A==", "license": "Apache-2.0", "dependencies": { "xstream": "^11.14.0" } }, "node_modules/@cosmjs/tendermint-rpc": { - "version": "0.28.13", - "resolved": "https://registry.npmjs.org/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.28.13.tgz", - "integrity": "sha512-GB+ZmfuJIGQm0hsRtLYjeR3lOxF7Z6XyCBR0cX5AAYOZzSEBJjevPgUHD6tLn8zIhvzxaW3/VKnMB+WmlxdH4w==", + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.32.4.tgz", + "integrity": "sha512-MWvUUno+4bCb/LmlMIErLypXxy7ckUuzEmpufYYYd9wgbdCXaTaO08SZzyFM5PI8UJ/0S2AmUrgWhldlbxO8mw==", "license": "Apache-2.0", "dependencies": { - "@cosmjs/crypto": "0.28.13", - "@cosmjs/encoding": "0.28.13", - "@cosmjs/json-rpc": "0.28.13", - "@cosmjs/math": "0.28.13", - "@cosmjs/socket": "0.28.13", - "@cosmjs/stream": "0.28.13", - "@cosmjs/utils": "0.28.13", - "axios": "^0.21.2", + "@cosmjs/crypto": "^0.32.4", + "@cosmjs/encoding": "^0.32.4", + "@cosmjs/json-rpc": "^0.32.4", + "@cosmjs/math": "^0.32.4", + "@cosmjs/socket": "^0.32.4", + "@cosmjs/stream": "^0.32.4", + "@cosmjs/utils": "^0.32.4", + "axios": "^1.6.0", "readonly-date": "^1.0.0", "xstream": "^11.14.0" } }, - "node_modules/@cosmjs/tendermint-rpc/node_modules/axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", - "license": "MIT", - "dependencies": { - "follow-redirects": "^1.14.0" - } - }, "node_modules/@cosmjs/utils": { - "version": "0.28.13", - "resolved": "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.28.13.tgz", - "integrity": "sha512-dVeMBiyg+46x7XBZEfJK8yTihphbCFpjVYmLJVqmTsHfJwymQ65cpyW/C+V/LgWARGK8hWQ/aX9HM5Ao8QmMSg==", + "version": "0.32.4", + "resolved": "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.32.4.tgz", + "integrity": "sha512-D1Yc+Zy8oL/hkUkFUL/bwxvuDBzRGpc4cF7/SkdhxX4iHpSLgdOuTt1mhCh9+kl6NQREy9t7SYZ6xeW5gFe60w==", "license": "Apache-2.0" }, "node_modules/@emotion/babel-plugin": { @@ -896,6 +929,14 @@ "integrity": "sha512-J4yDIIthosAsRZ5CPYP/jQvUAQtlZTTD/4suA08/FEnlxqW3sKS9iAhgsa9VYLZ6vDHn/ixJgIqRQPotoBjxIw==", "license": "MIT" }, + "node_modules/@graphql-typed-document-node/core": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@graphql-typed-document-node/core/-/core-3.2.0.tgz", + "integrity": "sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==", + "peerDependencies": { + "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" + } + }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -936,6 +977,356 @@ "google-protobuf": "^3.14.0" } }, + "node_modules/@injectivelabs/core-proto-ts": { + "version": "0.0.21", + "resolved": "https://registry.npmjs.org/@injectivelabs/core-proto-ts/-/core-proto-ts-0.0.21.tgz", + "integrity": "sha512-RBxSkRBCty60R/l55/D1jsSW0Aof5dyGFhCFdN3A010KjMv/SzZGGr+6DZPY/hflyFeaJzDv/VTopCymKNRBvQ==", + "dependencies": { + "@injectivelabs/grpc-web": "^0.0.1", + "google-protobuf": "^3.14.0", + "protobufjs": "^7.0.0", + "rxjs": "^7.4.0" + } + }, + "node_modules/@injectivelabs/core-proto-ts/node_modules/@types/node": { + "version": "22.8.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.8.1.tgz", + "integrity": "sha512-k6Gi8Yyo8EtrNtkHXutUu2corfDf9su95VYVP10aGYMMROM6SAItZi0w1XszA6RtWTHSVp5OeFof37w0IEqCQg==", + "dependencies": { + "undici-types": "~6.19.8" + } + }, + "node_modules/@injectivelabs/core-proto-ts/node_modules/long": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" + }, + "node_modules/@injectivelabs/core-proto-ts/node_modules/protobufjs": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.4.0.tgz", + "integrity": "sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==", + "hasInstallScript": true, + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/node": ">=13.7.0", + "long": "^5.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@injectivelabs/core-proto-ts/node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" + }, + "node_modules/@injectivelabs/dmm-proto-ts": { + "version": "1.0.20", + "resolved": "https://registry.npmjs.org/@injectivelabs/dmm-proto-ts/-/dmm-proto-ts-1.0.20.tgz", + "integrity": "sha512-S9vGOAZbNNa+N5QDW2HcXn7ohvU/4qze6wELA9gF8zu8uWbE+UKWTqzkZ+B4XuG1MkJwoHL7pVcj3M+nC9Qe4A==", + "dependencies": { + "@injectivelabs/grpc-web": "^0.0.1", + "google-protobuf": "^3.14.0", + "protobufjs": "^7.0.0", + "rxjs": "^7.4.0" + } + }, + "node_modules/@injectivelabs/dmm-proto-ts/node_modules/@types/node": { + "version": "22.8.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.8.1.tgz", + "integrity": "sha512-k6Gi8Yyo8EtrNtkHXutUu2corfDf9su95VYVP10aGYMMROM6SAItZi0w1XszA6RtWTHSVp5OeFof37w0IEqCQg==", + "dependencies": { + "undici-types": "~6.19.8" + } + }, + "node_modules/@injectivelabs/dmm-proto-ts/node_modules/long": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" + }, + "node_modules/@injectivelabs/dmm-proto-ts/node_modules/protobufjs": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.4.0.tgz", + "integrity": "sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==", + "hasInstallScript": true, + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/node": ">=13.7.0", + "long": "^5.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@injectivelabs/dmm-proto-ts/node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" + }, + "node_modules/@injectivelabs/exceptions": { + "version": "1.14.13", + "resolved": "https://registry.npmjs.org/@injectivelabs/exceptions/-/exceptions-1.14.13.tgz", + "integrity": "sha512-yFtB0jQtZI6D3AuaP6ObYtlVgDB4vriCWuV+6GY3frduv7i3kz1ZYVsPKsKSKBCOD5QegZXcEmGJL4RiDi1OKA==", + "hasInstallScript": true, + "dependencies": { + "@injectivelabs/grpc-web": "^0.0.1", + "@injectivelabs/ts-types": "^1.14.13", + "http-status-codes": "^2.2.0", + "link-module-alias": "^1.2.0", + "shx": "^0.3.2" + } + }, + "node_modules/@injectivelabs/grpc-web": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@injectivelabs/grpc-web/-/grpc-web-0.0.1.tgz", + "integrity": "sha512-Pu5YgaZp+OvR5UWfqbrPdHer3+gDf+b5fQoY+t2VZx1IAVHX8bzbN9EreYTvTYtFeDpYRWM8P7app2u4EX5wTw==", + "dependencies": { + "browser-headers": "^0.4.1" + }, + "peerDependencies": { + "google-protobuf": "^3.14.0" + } + }, + "node_modules/@injectivelabs/grpc-web-node-http-transport": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@injectivelabs/grpc-web-node-http-transport/-/grpc-web-node-http-transport-0.0.2.tgz", + "integrity": "sha512-rpyhXLiGY/UMs6v6YmgWHJHiO9l0AgDyVNv+jcutNVt4tQrmNvnpvz2wCAGOFtq5LuX/E9ChtTVpk3gWGqXcGA==", + "peerDependencies": { + "@injectivelabs/grpc-web": ">=0.0.1" + } + }, + "node_modules/@injectivelabs/grpc-web-react-native-transport": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@injectivelabs/grpc-web-react-native-transport/-/grpc-web-react-native-transport-0.0.2.tgz", + "integrity": "sha512-mk+aukQXnYNgPsPnu3KBi+FD0ZHQpazIlaBZ2jNZG7QAVmxTWtv3R66Zoq99Wx2dnE946NsZBYAoa0K5oSjnow==", + "peerDependencies": { + "@injectivelabs/grpc-web": ">=0.0.1" + } + }, + "node_modules/@injectivelabs/indexer-proto-ts": { + "version": "1.11.42", + "resolved": "https://registry.npmjs.org/@injectivelabs/indexer-proto-ts/-/indexer-proto-ts-1.11.42.tgz", + "integrity": "sha512-6ejCpcWZWOSsELFIfUf2+xuJPOH+YdiJtwtB3d9x2H7dnrCBjXMxlPCSxoKEUbDH6w/lY2mO6TJm65rNy9piew==", + "dependencies": { + "@injectivelabs/grpc-web": "^0.0.1", + "google-protobuf": "^3.14.0", + "protobufjs": "^7.0.0", + "rxjs": "^7.4.0" + } + }, + "node_modules/@injectivelabs/indexer-proto-ts/node_modules/@types/node": { + "version": "22.8.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.8.1.tgz", + "integrity": "sha512-k6Gi8Yyo8EtrNtkHXutUu2corfDf9su95VYVP10aGYMMROM6SAItZi0w1XszA6RtWTHSVp5OeFof37w0IEqCQg==", + "dependencies": { + "undici-types": "~6.19.8" + } + }, + "node_modules/@injectivelabs/indexer-proto-ts/node_modules/long": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" + }, + "node_modules/@injectivelabs/indexer-proto-ts/node_modules/protobufjs": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.4.0.tgz", + "integrity": "sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==", + "hasInstallScript": true, + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/node": ">=13.7.0", + "long": "^5.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@injectivelabs/indexer-proto-ts/node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" + }, + "node_modules/@injectivelabs/mito-proto-ts": { + "version": "1.0.65", + "resolved": "https://registry.npmjs.org/@injectivelabs/mito-proto-ts/-/mito-proto-ts-1.0.65.tgz", + "integrity": "sha512-kceZP68QrgFop387RYyO7tkfJCYxoktuceHTs9DQP3dJceLqj/V2mz0NlpkkacjgE5NhYkQ/zc0Z40hr8tnYqQ==", + "dependencies": { + "@injectivelabs/grpc-web": "^0.0.1", + "google-protobuf": "^3.14.0", + "protobufjs": "^7.0.0", + "rxjs": "^7.4.0" + } + }, + "node_modules/@injectivelabs/mito-proto-ts/node_modules/@types/node": { + "version": "22.8.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.8.1.tgz", + "integrity": "sha512-k6Gi8Yyo8EtrNtkHXutUu2corfDf9su95VYVP10aGYMMROM6SAItZi0w1XszA6RtWTHSVp5OeFof37w0IEqCQg==", + "dependencies": { + "undici-types": "~6.19.8" + } + }, + "node_modules/@injectivelabs/mito-proto-ts/node_modules/long": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" + }, + "node_modules/@injectivelabs/mito-proto-ts/node_modules/protobufjs": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.4.0.tgz", + "integrity": "sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==", + "hasInstallScript": true, + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/node": ">=13.7.0", + "long": "^5.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@injectivelabs/mito-proto-ts/node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" + }, + "node_modules/@injectivelabs/networks": { + "version": "1.14.13", + "resolved": "https://registry.npmjs.org/@injectivelabs/networks/-/networks-1.14.13.tgz", + "integrity": "sha512-P+eCQXWpbk4LbPxgTmi2gY7OzdZTNsIEUvDoh59Ma0CkqSFaYMtgB8fZVxpkKM0UPla587EDlEEIVxprDBcnZg==", + "hasInstallScript": true, + "dependencies": { + "@injectivelabs/exceptions": "^1.14.13", + "@injectivelabs/ts-types": "^1.14.13", + "@injectivelabs/utils": "^1.14.13", + "link-module-alias": "^1.2.0", + "shx": "^0.3.2" + } + }, + "node_modules/@injectivelabs/sdk-ts": { + "version": "1.14.13", + "resolved": "https://registry.npmjs.org/@injectivelabs/sdk-ts/-/sdk-ts-1.14.13.tgz", + "integrity": "sha512-qcLoIu+hEMpuvdG0iXGNJvWQD05NkcO59tL3ijEhYmshlJWBMWJtpJJGt/E/hV9YxJfNTl20Rhi/5i7l0y8Hfg==", + "hasInstallScript": true, + "dependencies": { + "@apollo/client": "^3.5.8", + "@cosmjs/amino": "^0.32.3", + "@cosmjs/proto-signing": "^0.32.3", + "@cosmjs/stargate": "^0.32.3", + "@ethersproject/bytes": "^5.7.0", + "@injectivelabs/core-proto-ts": "^0.0.21", + "@injectivelabs/dmm-proto-ts": "1.0.20", + "@injectivelabs/exceptions": "^1.14.13", + "@injectivelabs/grpc-web": "^0.0.1", + "@injectivelabs/grpc-web-node-http-transport": "^0.0.2", + "@injectivelabs/grpc-web-react-native-transport": "^0.0.2", + "@injectivelabs/indexer-proto-ts": "1.11.42", + "@injectivelabs/mito-proto-ts": "1.0.65", + "@injectivelabs/networks": "^1.14.13", + "@injectivelabs/test-utils": "^1.14.13", + "@injectivelabs/ts-types": "^1.14.13", + "@injectivelabs/utils": "^1.14.13", + "@metamask/eth-sig-util": "^4.0.0", + "@noble/curves": "^1.4.0", + "axios": "^1.6.4", + "bech32": "^2.0.0", + "bip39": "^3.0.4", + "cosmjs-types": "^0.9.0", + "ethereumjs-util": "^7.1.4", + "ethers": "^6.5.1", + "google-protobuf": "^3.21.0", + "graphql": "^16.3.0", + "http-status-codes": "^2.2.0", + "js-sha3": "^0.8.0", + "jscrypto": "^1.0.3", + "keccak256": "^1.0.6", + "link-module-alias": "^1.2.0", + "secp256k1": "^4.0.3", + "shx": "^0.3.2", + "snakecase-keys": "^5.4.1" + } + }, + "node_modules/@injectivelabs/sdk-ts/node_modules/bech32": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz", + "integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==" + }, + "node_modules/@injectivelabs/test-utils": { + "version": "1.14.13", + "resolved": "https://registry.npmjs.org/@injectivelabs/test-utils/-/test-utils-1.14.13.tgz", + "integrity": "sha512-wa5TQcWLvORRm36mw4Hee+XF7lBlArVK3DM1ebC0uBvVcUgrmm3g/nh1pV/NzLN16WtrLLsvnTsE5uiNEcgYdw==", + "hasInstallScript": true, + "dependencies": { + "axios": "^1.6.4", + "bignumber.js": "^9.0.1", + "link-module-alias": "^1.2.0", + "shx": "^0.3.2", + "snakecase-keys": "^5.1.2", + "store2": "^2.12.0" + } + }, + "node_modules/@injectivelabs/ts-types": { + "version": "1.14.13", + "resolved": "https://registry.npmjs.org/@injectivelabs/ts-types/-/ts-types-1.14.13.tgz", + "integrity": "sha512-jkR4+JnQ91n7LWAdt+cZuvXFfqhv9RVlTE2pezAjZab7z7VeDonYwktjia5OcbqTKjlirvVHFALIZ0pmYd0j+A==", + "hasInstallScript": true, + "dependencies": { + "link-module-alias": "^1.2.0", + "shx": "^0.3.2" + } + }, + "node_modules/@injectivelabs/utils": { + "version": "1.14.13", + "resolved": "https://registry.npmjs.org/@injectivelabs/utils/-/utils-1.14.13.tgz", + "integrity": "sha512-djmSq28R7HDSb2Mezan+EFjqQgmDRydY+fLOmkODwOCYA04xOGQo7yna+WVovV85aKpwPjn864AWPy65xiHUZg==", + "hasInstallScript": true, + "dependencies": { + "@injectivelabs/exceptions": "^1.14.13", + "@injectivelabs/ts-types": "^1.14.13", + "axios": "^1.6.4", + "bignumber.js": "^9.0.1", + "http-status-codes": "^2.2.0", + "link-module-alias": "^1.2.0", + "shx": "^0.3.2", + "snakecase-keys": "^5.1.2", + "store2": "^2.12.0" + } + }, "node_modules/@jest/expect-utils": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", @@ -1207,6 +1598,48 @@ "win32" ] }, + "node_modules/@metamask/eth-sig-util": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@metamask/eth-sig-util/-/eth-sig-util-4.0.1.tgz", + "integrity": "sha512-tghyZKLHZjcdlDqCA3gNZmLeR0XvOE9U1qoQO9ohyAZT6Pya+H9vkBPcsyXytmYLNgVoin7CKCmweo/R43V+tQ==", + "dependencies": { + "ethereumjs-abi": "^0.6.8", + "ethereumjs-util": "^6.2.1", + "ethjs-util": "^0.1.6", + "tweetnacl": "^1.0.3", + "tweetnacl-util": "^0.15.1" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@metamask/eth-sig-util/node_modules/@types/bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@metamask/eth-sig-util/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/@metamask/eth-sig-util/node_modules/ethereumjs-util": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz", + "integrity": "sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw==", + "dependencies": { + "@types/bn.js": "^4.11.3", + "bn.js": "^4.11.0", + "create-hash": "^1.1.2", + "elliptic": "^6.5.2", + "ethereum-cryptography": "^0.1.3", + "ethjs-util": "0.1.6", + "rlp": "^2.2.3" + } + }, "node_modules/@mischnic/json-sourcemap": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/@mischnic/json-sourcemap/-/json-sourcemap-0.1.1.tgz", @@ -1306,6 +1739,31 @@ "win32" ] }, + "node_modules/@noble/curves": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.6.0.tgz", + "integrity": "sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==", + "dependencies": { + "@noble/hashes": "1.5.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/curves/node_modules/@noble/hashes": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", + "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@noble/hashes": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", @@ -3711,6 +4169,14 @@ "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", "license": "MIT" }, + "node_modules/@types/bn.js": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.6.tgz", + "integrity": "sha512-Xh8vSwUeMKeYYrj3cX4lGQgFSF/N03r+tv4AiLl1SucqV+uTQpxRcnM8AkXKHwYP9ZPXOYXRr2KPXpVlIvqh9w==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/debug": { "version": "4.1.12", "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", @@ -3810,6 +4276,14 @@ "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==", "license": "MIT" }, + "node_modules/@types/pbkdf2": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@types/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha512-uRwJqmiXmh9++aSu1VNEn3iIxWOhd8AHXNSdlaLfdAAdSTY9jYVeGWnzejM3dvrkbqE3/hyQkQQ29IFATEGlew==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/prop-types": { "version": "15.7.12", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz", @@ -3844,6 +4318,14 @@ "@types/react": "*" } }, + "node_modules/@types/secp256k1": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.6.tgz", + "integrity": "sha512-hHxJU6PAEUn0TP4S/ZOzuTUvJWuZ6eIKeNKb5RBpODvSl6hp1Wrw4s7ATY50rklRCScUDpHzVA/DQdSjJ3UoYQ==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/stack-utils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", @@ -3982,17 +4464,81 @@ "@walletconnect/window-getters": "^1.0.0" } }, - "node_modules/abortcontroller-polyfill": { - "version": "1.7.5", - "resolved": "https://registry.npmjs.org/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz", - "integrity": "sha512-JMJ5soJWP18htbbxJjG7bG6yuI6pRhgJ0scHHTfkUjf6wjP912xZWvM+A4sJK3gqd9E8fcPbDnOefbA9Th/FIQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/acorn": { - "version": "8.11.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", - "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "node_modules/@wry/caches": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@wry/caches/-/caches-1.0.1.tgz", + "integrity": "sha512-bXuaUNLVVkD20wcGBWRyo7j9N3TxePEWFZj2Y+r9OoUzfqmavM84+mFykRicNsBqatba5JLay1t48wxaXaWnlA==", + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@wry/caches/node_modules/tslib": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", + "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + }, + "node_modules/@wry/context": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/@wry/context/-/context-0.7.4.tgz", + "integrity": "sha512-jmT7Sb4ZQWI5iyu3lobQxICu2nC/vbUhP0vIdd6tHC9PTfenmRmuIFqktc6GH9cgi+ZHnsLWPvfSvc4DrYmKiQ==", + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@wry/context/node_modules/tslib": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", + "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + }, + "node_modules/@wry/equality": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/@wry/equality/-/equality-0.5.7.tgz", + "integrity": "sha512-BRFORjsTuQv5gxcXsuDXx6oGRhuVsEGwZy6LOzRRfgu+eSfxbhUQ9L9YtSEIuIjY/o7g3iWFjrc5eSY1GXP2Dw==", + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@wry/equality/node_modules/tslib": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", + "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + }, + "node_modules/@wry/trie": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@wry/trie/-/trie-0.5.0.tgz", + "integrity": "sha512-FNoYzHawTMk/6KMQoEG5O4PuioX19UbwdQKF44yw0nLfOypfQdjtfZzo/UIJWAJ23sNIFbD1Ug9lbaDGMwbqQA==", + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@wry/trie/node_modules/tslib": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", + "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + }, + "node_modules/abortcontroller-polyfill": { + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/abortcontroller-polyfill/-/abortcontroller-polyfill-1.7.5.tgz", + "integrity": "sha512-JMJ5soJWP18htbbxJjG7bG6yuI6pRhgJ0scHHTfkUjf6wjP912xZWvM+A4sJK3gqd9E8fcPbDnOefbA9Th/FIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/acorn": { + "version": "8.11.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", + "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", "dev": true, "license": "MIT", "bin": { @@ -4012,6 +4558,11 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/aes-js": { + "version": "4.0.0-beta.5", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", + "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" + }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -4088,12 +4639,53 @@ "dev": true, "license": "MIT" }, + "node_modules/assert": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-2.1.0.tgz", + "integrity": "sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "is-nan": "^1.3.2", + "object-is": "^1.1.5", + "object.assign": "^4.1.4", + "util": "^0.12.5" + } + }, + "node_modules/assert/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/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "license": "MIT" }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dev": true, + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/axios": { "version": "1.7.7", "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz", @@ -4195,6 +4787,14 @@ "node": ">=0.6" } }, + "node_modules/bignumber.js": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", + "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==", + "engines": { + "node": "*" + } + }, "node_modules/bindings": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", @@ -4307,7 +4907,6 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", - "dev": true, "license": "MIT", "dependencies": { "buffer-xor": "^1.0.3", @@ -4497,7 +5096,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", "integrity": "sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==", - "dev": true, "license": "MIT" }, "node_modules/bufferutil": { @@ -4513,6 +5111,12 @@ "node": ">=6.14.2" } }, + "node_modules/builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==", + "dev": true + }, "node_modules/byline": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/byline/-/byline-5.0.0.tgz", @@ -4522,6 +5126,25 @@ "node": ">=0.10.0" } }, + "node_modules/call-bind": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "dev": true, + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "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", @@ -5238,6 +5861,20 @@ "url": "https://github.com/fb55/domutils?sponsor=1" } }, + "node_modules/dot-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", + "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "node_modules/dot-case/node_modules/tslib": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", + "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + }, "node_modules/dotenv": { "version": "16.4.5", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", @@ -5539,6 +6176,179 @@ "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==", + "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/ethereumjs-abi": { + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/ethereumjs-abi/-/ethereumjs-abi-0.6.8.tgz", + "integrity": "sha512-Tx0r/iXI6r+lRsdvkFDlut0N08jWMnKRZ6Gkq+Nmw75lZe4e6o3EkSnkaBP5NF6+m5PTGAr9JP43N3LyeoglsA==", + "dependencies": { + "bn.js": "^4.11.8", + "ethereumjs-util": "^6.0.0" + } + }, + "node_modules/ethereumjs-abi/node_modules/@types/bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/ethereumjs-abi/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/ethereumjs-abi/node_modules/ethereumjs-util": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz", + "integrity": "sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw==", + "dependencies": { + "@types/bn.js": "^4.11.3", + "bn.js": "^4.11.0", + "create-hash": "^1.1.2", + "elliptic": "^6.5.2", + "ethereum-cryptography": "^0.1.3", + "ethjs-util": "0.1.6", + "rlp": "^2.2.3" + } + }, + "node_modules/ethereumjs-util": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz", + "integrity": "sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg==", + "dependencies": { + "@types/bn.js": "^5.1.0", + "bn.js": "^5.1.2", + "create-hash": "^1.1.2", + "ethereum-cryptography": "^0.1.3", + "rlp": "^2.2.4" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/ethers": { + "version": "6.13.4", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.13.4.tgz", + "integrity": "sha512-21YtnZVg4/zKkCQPjrDj38B1r4nQvTZLopUGMLQ1ePU2zV/joCfDC3t3iKQjWRzjjjbzR+mdAIoikeBRNkdllA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/ethers-io/" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@adraffy/ens-normalize": "1.10.1", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", + "@types/node": "22.7.5", + "aes-js": "4.0.0-beta.5", + "tslib": "2.7.0", + "ws": "8.17.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/ethers/node_modules/@noble/curves": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", + "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "dependencies": { + "@noble/hashes": "1.3.2" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ethers/node_modules/@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ethers/node_modules/@types/node": { + "version": "22.7.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.5.tgz", + "integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==", + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/ethers/node_modules/tslib": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", + "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==" + }, + "node_modules/ethers/node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" + }, + "node_modules/ethers/node_modules/ws": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/ethjs-util": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz", + "integrity": "sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w==", + "dependencies": { + "is-hex-prefixed": "1.0.0", + "strip-hex-prefix": "1.0.0" + }, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, "node_modules/events": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", @@ -5552,7 +6362,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", - "dev": true, "license": "MIT", "dependencies": { "md5.js": "^1.3.4", @@ -5701,6 +6510,15 @@ } } }, + "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==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.3" + } + }, "node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -5871,6 +6689,33 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "license": "ISC" }, + "node_modules/graphql": { + "version": "16.9.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.9.0.tgz", + "integrity": "sha512-GGTKBX4SD7Wdb8mqeDLni2oaRGYQWjWHGKPQ24ZMnUtKfcsVoiv4uX8+LJr1K6U5VW2Lu1BwJnj7uiori0YtRw==", + "engines": { + "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" + } + }, + "node_modules/graphql-tag": { + "version": "2.12.6", + "resolved": "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.12.6.tgz", + "integrity": "sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg==", + "dependencies": { + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "graphql": "^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" + } + }, + "node_modules/graphql-tag/node_modules/tslib": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", + "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -5916,6 +6761,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/hash-base": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", @@ -6025,6 +6885,17 @@ } } }, + "node_modules/http-status-codes": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/http-status-codes/-/http-status-codes-2.3.0.tgz", + "integrity": "sha512-RJ8XvFvpPM/Dmc5SV+dC4y5PCeOhT3x1Hq0NU3rjGeg5a/CqlhZ7uudknPwZFz4aeAXDcbAyaeP7GAo9lvngtA==" + }, + "node_modules/https-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", + "integrity": "sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg==", + "dev": true + }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -6125,12 +6996,40 @@ "loose-envify": "^1.0.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==", "license": "MIT" }, + "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.13.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", @@ -6153,6 +7052,21 @@ "node": ">=0.10.0" } }, + "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", @@ -6166,6 +7080,15 @@ "node": ">=0.10.0" } }, + "node_modules/is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA==", + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, "node_modules/is-json": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-json/-/is-json-2.0.1.tgz", @@ -6173,6 +7096,22 @@ "dev": true, "license": "ISC" }, + "node_modules/is-nan": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", + "integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -6204,6 +7143,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-typed-array": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.13.tgz", + "integrity": "sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==", + "dev": true, + "dependencies": { + "which-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -6503,6 +7457,35 @@ "node": ">=6" } }, + "node_modules/keccak": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.4.tgz", + "integrity": "sha512-3vKuW0jV8J3XNTzvfyicFR5qvxrSAGl7KIhvgOu5cmWwM7tZRj3fMbj/pfIf4be7aznbc+prBWGjywox/g2Y6Q==", + "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/keccak/node_modules/node-addon-api": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" + }, + "node_modules/keccak256": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/keccak256/-/keccak256-1.0.6.tgz", + "integrity": "sha512-8GLiM01PkdJVGUhR1e6M/AvWnSqYS0HaERI+K/QtStGDGlSTx2B1zTqZk4Zlqu5TxHJNTxWAdP9Y+WI50OApUw==", + "dependencies": { + "bn.js": "^5.2.0", + "buffer": "^6.0.3", + "keccak": "^3.0.2" + } + }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -6533,19 +7516,19 @@ "node": ">= 0.8.0" } }, - "node_modules/libsodium": { - "version": "0.7.13", - "resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.13.tgz", - "integrity": "sha512-mK8ju0fnrKXXfleL53vtp9xiPq5hKM0zbDQtcxQIsSmxNgSxqCj6R7Hl9PkrNe2j29T4yoDaF7DJLK9/i5iWUw==", + "node_modules/libsodium-sumo": { + "version": "0.7.15", + "resolved": "https://registry.npmjs.org/libsodium-sumo/-/libsodium-sumo-0.7.15.tgz", + "integrity": "sha512-5tPmqPmq8T8Nikpm1Nqj0hBHvsLFCXvdhBFV7SGOitQPZAA6jso8XoL0r4L7vmfKXr486fiQInvErHtEvizFMw==", "license": "ISC" }, - "node_modules/libsodium-wrappers": { - "version": "0.7.13", - "resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.13.tgz", - "integrity": "sha512-kasvDsEi/r1fMzKouIDv7B8I6vNmknXwGiYodErGuESoFTohGSKZplFtVxZqHaoQ217AynyIFgnOVRitpHs0Qw==", + "node_modules/libsodium-wrappers-sumo": { + "version": "0.7.15", + "resolved": "https://registry.npmjs.org/libsodium-wrappers-sumo/-/libsodium-wrappers-sumo-0.7.15.tgz", + "integrity": "sha512-aSWY8wKDZh5TC7rMvEdTHoyppVq/1dTSAeAR7H6pzd6QRT3vQWcT5pGwCotLcpPEOLXX6VvqihSPkpEhYAjANA==", "license": "ISC", "dependencies": { - "libsodium": "^0.7.13" + "libsodium-sumo": "^0.7.15" } }, "node_modules/lightningcss": { @@ -6936,6 +7919,19 @@ "loose-envify": "cli.js" } }, + "node_modules/lower-case": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", + "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", + "dependencies": { + "tslib": "^2.0.3" + } + }, + "node_modules/lower-case/node_modules/tslib": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", + "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + }, "node_modules/lz-string": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", @@ -6945,6 +7941,17 @@ "lz-string": "bin/bin.js" } }, + "node_modules/map-obj": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", + "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/mathjs": { "version": "13.0.0", "resolved": "https://registry.npmjs.org/mathjs/-/mathjs-13.0.0.tgz", @@ -7705,6 +8712,20 @@ "dev": true, "license": "MIT" }, + "node_modules/no-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", + "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", + "dependencies": { + "lower-case": "^2.0.2", + "tslib": "^2.0.3" + } + }, + "node_modules/no-case/node_modules/tslib": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", + "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + }, "node_modules/node-addon-api": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.0.tgz", @@ -7787,6 +8808,34 @@ "node": ">=0.10.0" } }, + "node_modules/object-inspect": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", + "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-is": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.6.tgz", + "integrity": "sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -7796,6 +8845,24 @@ "node": ">= 0.4" } }, + "node_modules/object.assign": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.5.tgz", + "integrity": "sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -7805,6 +8872,33 @@ "wrappy": "1" } }, + "node_modules/optimism": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/optimism/-/optimism-0.18.0.tgz", + "integrity": "sha512-tGn8+REwLRNFnb9WmcY5IfpOqeX2kpaYJ1s6Ae3mn12AeydLkR3j+jSCmVQFoXqU8D41PAJ1RG1rCRNWmNZVmQ==", + "dependencies": { + "@wry/caches": "^1.0.0", + "@wry/context": "^0.7.0", + "@wry/trie": "^0.4.3", + "tslib": "^2.3.0" + } + }, + "node_modules/optimism/node_modules/@wry/trie": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@wry/trie/-/trie-0.4.3.tgz", + "integrity": "sha512-I6bHwH0fSf6RqQcnnXLJKhkSXG45MFral3GxPaY4uAl0LYDZM+YDVDAiU9bYwjTuysy1S0IeecWtmq1SZA3M1w==", + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/optimism/node_modules/tslib": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", + "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + }, "node_modules/optionator": { "version": "0.9.4", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", @@ -8014,7 +9108,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", - "dev": true, "license": "MIT", "dependencies": { "create-hash": "^1.1.2", @@ -8045,6 +9138,15 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/possible-typed-array-names": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", + "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/postcss-value-parser": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", @@ -8462,6 +9564,21 @@ "react": "^16.8.0 || ^17.0.0 || ^18.0.0" } }, + "node_modules/qs": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "dev": true, + "dependencies": { + "side-channel": "^1.0.6" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/query-string": { "version": "6.13.5", "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.13.5.tgz", @@ -8504,7 +9621,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, "license": "MIT", "dependencies": { "safe-buffer": "^5.1.0" @@ -8785,6 +9901,23 @@ "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", "license": "MIT" }, + "node_modules/rehackt": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/rehackt/-/rehackt-0.1.0.tgz", + "integrity": "sha512-7kRDOuLHB87D/JESKxQoRwv4DzbIdwkAGQ7p6QKGdVlY1IZheUnVhlk/4UZlNUVxdAXpyxikE3URsG067ybVzw==", + "peerDependencies": { + "@types/react": "*", + "react": "*" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "react": { + "optional": true + } + } + }, "node_modules/resolve": { "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", @@ -8811,6 +9944,14 @@ "node": ">=4" } }, + "node_modules/response-iterator": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/response-iterator/-/response-iterator-0.2.6.tgz", + "integrity": "sha512-pVzEEzrsg23Sh053rmDUvLSkGXluZio0qu8VT6ukrYuvtjVfCbDZH9d6PGXb8HZfzdNZt8feXv/jvUzlhRgLnw==", + "engines": { + "node": ">=0.8" + } + }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", @@ -8840,6 +9981,17 @@ "node": ">=8" } }, + "node_modules/rlp": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.2.7.tgz", + "integrity": "sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ==", + "dependencies": { + "bn.js": "^5.2.0" + }, + "bin": { + "rlp": "bin/rlp" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -8864,6 +10016,19 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/rxjs/node_modules/tslib": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", + "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -8893,6 +10058,11 @@ "loose-envify": "^1.1.0" } }, + "node_modules/scrypt-js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", + "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" + }, "node_modules/secp256k1": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.4.tgz", @@ -8931,6 +10101,28 @@ "node": ">=10" } }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "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==" + }, "node_modules/sha.js": { "version": "2.4.11", "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", @@ -9009,6 +10201,24 @@ "node": ">=6" } }, + "node_modules/side-channel": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -9018,6 +10228,44 @@ "node": ">=8" } }, + "node_modules/snake-case": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", + "integrity": "sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==", + "dependencies": { + "dot-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "node_modules/snake-case/node_modules/tslib": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", + "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + }, + "node_modules/snakecase-keys": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/snakecase-keys/-/snakecase-keys-5.5.0.tgz", + "integrity": "sha512-r3kRtnoPu3FxGJ3fny6PKNnU3pteb29o6qAa0ugzhSseKNWRkw1dw8nIjXMyyKaU9vQxxVIE62Mb3bKbdrgpiw==", + "dependencies": { + "map-obj": "^4.1.0", + "snake-case": "^3.0.4", + "type-fest": "^3.12.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/snakecase-keys/node_modules/type-fest": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.13.1.tgz", + "integrity": "sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -9107,6 +10355,11 @@ "integrity": "sha512-oeVtt7eWQS+Na6F//S4kJ2K2VbRlS9D43mAlMyVpVWovy9o+jfgH8O9agzANzaiLjclA0oYzUXEM4PurhSUChw==", "license": "MIT" }, + "node_modules/store2": { + "version": "2.14.3", + "resolved": "https://registry.npmjs.org/store2/-/store2-2.14.3.tgz", + "integrity": "sha512-4QcZ+yx7nzEFiV4BMLnr/pRa5HYzNITX2ri0Zh6sT9EyQHbBHacC6YigllUPU9X3D0f/22QCgfokpKs52YRrUg==" + }, "node_modules/stream": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/stream/-/stream-0.0.2.tgz", @@ -9127,6 +10380,18 @@ "readable-stream": "^3.5.0" } }, + "node_modules/stream-http": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-3.2.0.tgz", + "integrity": "sha512-Oq1bLqisTyK3TSCXpPbT4sdeYNdmyZJv1LxpEm2vu1ZhK89kSE5YXwZc3cWk0MagGaKriBh9mCFbVGtO+vY29A==", + "dev": true, + "dependencies": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "xtend": "^4.0.2" + } + }, "node_modules/strict-uri-encode": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz", @@ -9158,6 +10423,18 @@ "node": ">=8" } }, + "node_modules/strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha512-q8d4ue7JGEiVcypji1bALTos+0pWtyGlivAWyPuTkHzuTCJqrK9sWxYQZUq6Nq3cuyv3bm734IhHvHtGGURU6A==", + "dependencies": { + "is-hex-prefixed": "1.0.0" + }, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, "node_modules/strip-indent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", @@ -9348,12 +10625,38 @@ "integrity": "sha512-oJLDTdHAk27V+JUUu1vKYezKehx/tECV0vnJ1e8JV/rvre5oLoFMaCLP53ZwiPsw4ZIJzyLoZr/TKQABnaNF6A==", "license": "MIT" }, + "node_modules/ts-invariant": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.10.3.tgz", + "integrity": "sha512-uivwYcQaxAucv1CzRp2n/QdYPo4ILf9VXgH19zEIjFx2EJufV16P0JtJVpYHy89DItG6Kwj2oIUjrcK5au+4tQ==", + "dependencies": { + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ts-invariant/node_modules/tslib": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", + "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + }, "node_modules/tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "license": "0BSD" }, + "node_modules/tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + }, + "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==" + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -9466,6 +10769,25 @@ "punycode": "^2.1.0" } }, + "node_modules/url": { + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.4.tgz", + "integrity": "sha512-oCwdVC7mTuWiPyjLUz/COz5TLk6wgp0RCsN+wHZ2Ekneac9w8uuV0njcbbie2ME+Vs+d6duwmYuR3HgQXs1fOg==", + "dev": true, + "dependencies": { + "punycode": "^1.4.1", + "qs": "^6.12.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/url/node_modules/punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==", + "dev": true + }, "node_modules/use-isomorphic-layout-effect": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/use-isomorphic-layout-effect/-/use-isomorphic-layout-effect-1.1.2.tgz", @@ -9568,6 +10890,25 @@ "node": ">= 8" } }, + "node_modules/which-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.15.tgz", + "integrity": "sha512-oV0jmFtUky6CXfkqehVvBP/LSWJ2sy4vWMioiENyJLePrBO/yKyV9OyJySfAKosh+RYkIl5zJCNZ8/4JncrpdA==", + "dev": true, + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/wif": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/wif/-/wif-2.0.6.tgz", @@ -9623,6 +10964,15 @@ "symbol-observable": "^2.0.3" } }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true, + "engines": { + "node": ">=0.4" + } + }, "node_modules/yaml": { "version": "1.10.2", "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", @@ -9644,6 +10994,19 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "node_modules/zen-observable": { + "version": "0.8.15", + "resolved": "https://registry.npmjs.org/zen-observable/-/zen-observable-0.8.15.tgz", + "integrity": "sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ==" + }, + "node_modules/zen-observable-ts": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/zen-observable-ts/-/zen-observable-ts-1.2.5.tgz", + "integrity": "sha512-QZWQekv6iB72Naeake9hS1KxHlotfRpe+WGNbNx5/ta+R3DNjVO2bswf63gXlWDcs+EMd7XY8HfVQyP1X6T4Zg==", + "dependencies": { + "zen-observable": "0.8.15" + } } } } diff --git a/package.json b/package.json index 85f9bc32..badcc2f0 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,9 @@ "dependencies": { "@bugsnag/js": "^7.16.1", "@bugsnag/plugin-react": "^7.16.1", - "@cosmjs/proto-signing": "^0.28.1", - "@cosmjs/stargate": "^0.28.1", + "@cosmjs/proto-signing": "^0.32.4", + "@cosmjs/stargate": "^0.32.4", + "@injectivelabs/sdk-ts": "^1.14.13", "@keplr-wallet/wc-client": "^0.11.3", "@terra-money/terra.js": "^3.1.8", "@testing-library/jest-dom": "^5.16.2", @@ -73,12 +74,16 @@ "devDependencies": { "@parcel/packager-raw-url": "^2.12.0", "@parcel/transformer-webmanifest": "^2.12.0", + "assert": "^2.1.0", "crypto-browserify": "^3.12.0", "eslint": "^9.4.0", "events": "^3.3.0", + "https-browserify": "^1.0.0", "parcel": "^2.12.0", "path-browserify": "^1.0.1", "stream-browserify": "^3.0.0", + "stream-http": "^3.2.0", + "url": "^0.11.4", "vm-browserify": "^1.1.2" } } diff --git a/src/adapters/DefaultSigningAdapter.mjs b/src/adapters/DefaultSigningAdapter.mjs index e93ec786..0b003e58 100644 --- a/src/adapters/DefaultSigningAdapter.mjs +++ b/src/adapters/DefaultSigningAdapter.mjs @@ -1,51 +1,25 @@ import _ from 'lodash' import Long from "long"; -import { - defaultRegistryTypes as defaultStargateTypes, - AminoTypes, - createBankAminoConverters, - createDistributionAminoConverters, - createFreegrantAminoConverters, - createGovAminoConverters, - createIbcAminoConverters, - createStakingAminoConverters, -} from "@cosmjs/stargate"; -import { makeSignDoc, Registry } from "@cosmjs/proto-signing"; +import { makeSignDoc } from "@cosmjs/proto-signing"; import { makeSignDoc as makeAminoSignDoc } from "@cosmjs/amino"; import { fromBase64 } from '@cosmjs/encoding' import { PubKey } from "cosmjs-types/cosmos/crypto/secp256k1/keys.js"; import { SignMode } from "cosmjs-types/cosmos/tx/signing/v1beta1/signing.js"; import { AuthInfo, Fee, TxBody } from "cosmjs-types/cosmos/tx/v1beta1/tx.js"; -import { createAuthzAminoConverters, createAuthzExecAminoConverters } from '../converters/Authz.mjs' - export default class DefaultSigningAdapter { constructor(network, signerProvider) { this.network = network; this.signerProvider = signerProvider; - - this.registry = new Registry(defaultStargateTypes); - const defaultConverters = { - ...createAuthzAminoConverters(), - ...createBankAminoConverters(), - ...createDistributionAminoConverters(), - ...createGovAminoConverters(), - ...createStakingAminoConverters(this.network.prefix), - ...createIbcAminoConverters(), - ...createFreegrantAminoConverters(), - } - let aminoTypes = new AminoTypes(defaultConverters) - this.aminoTypes = new AminoTypes({...defaultConverters, ...createAuthzExecAminoConverters(this.registry, aminoTypes)}) } async sign(account, messages, memo, fee){ const { chainId } = this.network const { account_number: accountNumber, sequence, address } = account - const txBodyBytes = this.makeBodyBytes(messages, memo) let aminoMsgs try { - aminoMsgs = this.convertToAmino(messages) + aminoMsgs = this.toAmino(messages) } catch (e) { console.log(e) } if(aminoMsgs && this.signerProvider.signAminoSupport()){ // Sign as amino if possible for Ledger and Keplr support @@ -66,6 +40,7 @@ export default class DefaultSigningAdapter { amount: fee.amount, gasLimit: fee.gas, }, SignMode.SIGN_MODE_DIRECT) + const txBodyBytes = this.makeBodyBytes(messages, memo) const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber); const { signature, signed } = await this.signerProvider.signDirect(address, signDoc); return { @@ -89,8 +64,9 @@ export default class DefaultSigningAdapter { } } - convertToAmino(messages){ + toAmino(messages){ return messages.map(message => { + // move this logic to message classes, reacting to network param if(message.typeUrl.startsWith('/cosmos.authz')){ if(!this.network.authzAminoSupport){ throw new Error('This chain does not support amino conversion for Authz messages') @@ -108,7 +84,7 @@ export default class DefaultSigningAdapter { }else if(this.network.aminoPreventTypes.some(prevent => message.typeUrl.match(_.escapeRegExp(prevent)))){ throw new Error(`This chain does not support amino conversion for message type: ${message.typeUrl}`) } - let aminoMessage = this.aminoTypes.toAmino(message) + let aminoMessage = message.toAmino() if(this.network.authzAminoLiftedValues){ switch (aminoMessage.type) { case 'cosmos-sdk/MsgGrant': @@ -126,13 +102,24 @@ export default class DefaultSigningAdapter { }) } - makeBodyBytes(messages, memo){ - const anyMsgs = messages.map((m) => this.registry.encodeAsAny(m)); + toProtoEncoded(messages){ + return messages.map((m) => m.toProtoEncoded()) + } + + makeBodyBytes(messages, memo, timeoutHeight){ + const protoEncodedMsgs = this.toProtoEncoded(messages); + + const txBody = { + messages: protoEncodedMsgs, + memo: memo, + } + + if (timeoutHeight) { + txBody.timeoutHeight = timeoutHeight.toString() + } + return TxBody.encode( - TxBody.fromPartial({ - messages: anyMsgs, - memo: memo, - }) + TxBody.fromPartial(txBody) ).finish() } diff --git a/src/adapters/InjectiveSigningAdapter.mjs b/src/adapters/InjectiveSigningAdapter.mjs new file mode 100644 index 00000000..e2af15c4 --- /dev/null +++ b/src/adapters/InjectiveSigningAdapter.mjs @@ -0,0 +1,92 @@ +import _ from 'lodash' +import { + getEip712TypedData, + mapValuesToProperValueType, + objectKeysToEip712Types, + createWeb3Extension, + createTxRawEIP712, + getGenericAuthorizationFromMessageType, + MsgGrant, + MsgAuthzExec, + MsgDelegate, + MsgVote +} from '@injectivelabs/sdk-ts' +import { + BigNumberInBase, + DEFAULT_BLOCK_TIMEOUT_HEIGHT +} from '@injectivelabs/utils' +import { GenericAuthorization } from "cosmjs-types/cosmos/authz/v1beta1/authz"; +import { SignMode } from "cosmjs-types/cosmos/tx/signing/v1beta1/signing.js"; + +import DefaultSigningAdapter from "./DefaultSigningAdapter.mjs"; + +export default class InjectiveSigningAdapter extends DefaultSigningAdapter { + async sign(account, messages, memo, fee){ + if(!this.signerProvider.isLedger()){ + return super.sign(account, messages, memo, fee) + } + + if(!this.signerProvider.signEIP712){ + throw new Error('Unable to sign message with this wallet/signer') + } + + const { chainId } = this.network + const ethereumChainId = 1 + const { account_number: accountNumber, sequence, address } = account + + const latestBlock = await this.network.queryClient.getLatestBlock() + const latestHeight = latestBlock.block.header.height + const timeoutHeight = new BigNumberInBase(latestHeight).plus( + DEFAULT_BLOCK_TIMEOUT_HEIGHT, + ) + + const eip712TypedData = getEip712TypedData({ + msgs: messages, + fee, + tx: { + memo: memo, + accountNumber: accountNumber.toString(), + sequence: sequence.toString(), + timeoutHeight: timeoutHeight.toFixed(), + chainId, + }, + ethereumChainId, + }) + + const { signature, signed } = await this.signerProvider.signEIP712( + chainId, + address, + eip712TypedData, + { + chain_id: chainId, + timeout_height: timeoutHeight.toFixed(), + account_number: accountNumber.toString(), + sequence: sequence.toString(), + fee, + msgs: messages.map((m) => m.toEip712()), + memo: memo || '', + } + ) + + const txRaw = { + authInfoBytes: await this.makeAuthInfoBytes(account, { + amount: signed.fee.amount, + gasLimit: signed.fee.gas, + }, SignMode.SIGN_MODE_LEGACY_AMINO_JSON), + bodyBytes: this.makeBodyBytes(messages, signed.memo, timeoutHeight), + } + + const web3Extension = createWeb3Extension({ + ethereumChainId, + }) + const txRawEip712 = createTxRawEIP712(txRaw, web3Extension) + + const signatureBuff = Buffer.from( + signature.signature, + 'base64', + ) + txRawEip712.signatures = [signatureBuff] + + return txRawEip712 + } +} diff --git a/src/adapters/TerraSigningAdapter.mjs b/src/adapters/TerraSigningAdapter.mjs index ee56f6bd..feab6178 100644 --- a/src/adapters/TerraSigningAdapter.mjs +++ b/src/adapters/TerraSigningAdapter.mjs @@ -2,8 +2,8 @@ import { Msg } from '@terra-money/terra.js'; import DefaultSigningAdapter from "./DefaultSigningAdapter.mjs"; export default class TerraSigningAdapter extends DefaultSigningAdapter { - convertToAmino(messages){ - return super.convertToAmino(messages).map(message => { + toAmino(messages){ + return super.toAmino(messages).map(message => { // Terra uses custom Amino message types, use Terra.js to convert them return Msg.fromAmino(message).toAmino(true) }) diff --git a/src/components/App.js b/src/components/App.js index 88c75452..185f1de0 100644 --- a/src/components/App.js +++ b/src/components/App.js @@ -8,8 +8,6 @@ import Delegations from './Delegations'; import Coins from './Coins' import About from './About' -import { MsgGrant, MsgRevoke } from "cosmjs-types/cosmos/authz/v1beta1/tx.js"; - import { Container, Dropdown, @@ -209,8 +207,6 @@ class App extends React.Component { } try { const signingClient = SigningClient(network, signerProvider) - signingClient.registry.register("/cosmos.authz.v1beta1.MsgGrant", MsgGrant) - signingClient.registry.register("/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke) const address = await wallet.getAddress(); diff --git a/src/components/DelegateForm.js b/src/components/DelegateForm.js index bc7b8986..6da6461c 100644 --- a/src/components/DelegateForm.js +++ b/src/components/DelegateForm.js @@ -11,6 +11,7 @@ import { pow, multiply, divide, subtract, bignumber } from 'mathjs' import AlertMessage from './AlertMessage' import Coins from './Coins' import { buildExecMessage, coin } from '../utils/Helpers.mjs' +import Delegate from '../messages/delegate.mjs'; function DelegateForm(props) { const { network, wallet, address, validator, selectedValidator, action } = props @@ -46,6 +47,7 @@ function DelegateForm(props) { try { gas = await client.simulate(wallet.address, messages) } catch (error) { + console.log(error) setState({ loading: false, error: error.message }) return } @@ -91,7 +93,9 @@ function DelegateForm(props) { value: value } } - return [message] + // pass network to messages and allow customisation inside message classes per network + const newMessage = new Delegate(value) + return [newMessage] } function hasPermission() { diff --git a/src/components/VoteForm.js b/src/components/VoteForm.js index a5e5ecd5..5b898d3e 100644 --- a/src/components/VoteForm.js +++ b/src/components/VoteForm.js @@ -9,7 +9,7 @@ import { MsgVote } from "cosmjs-types/cosmos/gov/v1beta1/tx.js"; import Vote from '../utils/Vote.mjs'; import { buildExecMessage } from '../utils/Helpers.mjs'; - +import NewVote from '../messages/vote.mjs'; function VoteForm(props) { const { proposal, vote, address, wallet, granter, setError } = props @@ -79,10 +79,11 @@ function VoteForm(props) { value: value } } + console.log(value) + const newMessage = new NewVote(value) + console.log(newMessage) - console.log(message) - - props.signingClient.signAndBroadcast(wallet.address, [message]).then((result) => { + props.signingClient.signAndBroadcast(wallet.address, [newMessage]).then((result) => { console.log("Successfully broadcasted:", result); setLoading(false) setError(null) @@ -162,4 +163,4 @@ function VoteForm(props) { ) } -export default VoteForm \ No newline at end of file +export default VoteForm diff --git a/src/messages/delegate.mjs b/src/messages/delegate.mjs new file mode 100644 index 00000000..86766e1c --- /dev/null +++ b/src/messages/delegate.mjs @@ -0,0 +1,5 @@ +import Message from "./message.mjs"; + +export default class Delegate extends Message { + typeUrl = "/cosmos.staking.v1beta1.MsgDelegate"; +} diff --git a/src/messages/message.mjs b/src/messages/message.mjs new file mode 100644 index 00000000..83fc7dec --- /dev/null +++ b/src/messages/message.mjs @@ -0,0 +1,58 @@ +import { + defaultRegistryTypes, + createDefaultAminoConverters +} from "@cosmjs/stargate"; +import { mapValuesToProperValueType, objectKeysToEip712Types } from "@injectivelabs/sdk-ts"; + +export default class Message { + typeUrl = null; + protoConverters = new Map(defaultRegistryTypes); + aminoConverters = new Map(Object.entries(createDefaultAminoConverters())); + + constructor (params) { + this.params = params + } + + toProto () { + return this.params + } + + toProtoEncoded() { + return { + typeUrl: this.typeUrl, + value: this.toBinary() + } + } + + toBinary() { + const protoType = this.protoConverters.get(this.typeUrl) + return protoType.encode(this.toProto()).finish() + } + + toAmino () { + const aminoType = this.aminoConverters.get(this.typeUrl) + return { + type: aminoType.aminoType, + value: aminoType.toAmino(this.params) + } + } + + toEip712Types(){ + const amino = this.toAmino() + + return objectKeysToEip712Types({ + object: amino.value, + messageType: amino.type, + }) + } + + toEip712(){ + const amino = this.toAmino() + const { type, value } = amino + + return { + type, + value: mapValuesToProperValueType(value, type) + } + } +} diff --git a/src/messages/vote.mjs b/src/messages/vote.mjs new file mode 100644 index 00000000..3b6b4087 --- /dev/null +++ b/src/messages/vote.mjs @@ -0,0 +1,16 @@ +import Message from "./message.mjs"; + +export default class NewVote extends Message { + typeUrl = "/cosmos.gov.v1beta1.MsgVote"; + + toAmino () { + return { + type: "cosmos-sdk/MsgVote", + value: { + proposal_id: this.params.proposalId, + voter: this.params.voter, + option: this.params.option + } + } + } +} diff --git a/src/networks.json b/src/networks.json index b049b8f1..be141bab 100644 --- a/src/networks.json +++ b/src/networks.json @@ -253,7 +253,8 @@ "ownerAddress": "injvaloper1vqz7mgm47xhx25xu5g9qagnz48naks6pk6fmg2", "aminoPreventTypes": [ "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission" - ] + ], + "ledgerSupport": true }, { "name": "xpla" diff --git a/src/utils/Helpers.mjs b/src/utils/Helpers.mjs index d99ac23f..fa2fe82c 100644 --- a/src/utils/Helpers.mjs +++ b/src/utils/Helpers.mjs @@ -1,6 +1,5 @@ import _ from 'lodash' import { format, floor, bignumber } from 'mathjs' -import { coin as _coin } from '@cosmjs/stargate' import truncateMiddle from 'truncate-middle' export function timeStamp(...args) { @@ -8,7 +7,10 @@ export function timeStamp(...args) { } export function coin(amount, denom){ - return _coin(format(floor(amount), {notation: 'fixed'}), denom) + return { + denom, + amount: format(floor(amount), {notation: 'fixed'}) + } } export function joinString(...args){ diff --git a/src/utils/KeplrSignerProvider.mjs b/src/utils/KeplrSignerProvider.mjs index 77afbea2..820c8b08 100644 --- a/src/utils/KeplrSignerProvider.mjs +++ b/src/utils/KeplrSignerProvider.mjs @@ -18,6 +18,10 @@ export default class KeplrSignerProvider extends SignerProvider { } } + signEIP712(...args){ + return this.provider.experimentalSignEIP712CosmosTx_v0(...args) + } + available() { return !!this.provider || isMobile() } diff --git a/src/utils/QueryClient.mjs b/src/utils/QueryClient.mjs index 8854c35b..2542bd94 100644 --- a/src/utils/QueryClient.mjs +++ b/src/utils/QueryClient.mjs @@ -6,7 +6,7 @@ const QueryClient = async (chainId, restUrls, opts) => { const config = _.merge({ connectTimeout: 10000, }, opts) - const restUrl = await findAvailableUrl(restUrls, "rest", { timeout: config.connectTimeout }) + const restUrl = await findAvailableUrl(restUrls, { timeout: config.connectTimeout }) function getAllValidators(pageSize, opts, pageCallback) { return getAllPages((nextKey) => { @@ -228,7 +228,7 @@ const QueryClient = async (chainId, restUrls, opts) => { return pages; } - async function findAvailableUrl(urls, type, opts) { + async function findAvailableUrl(urls, opts) { if(!urls) return if (!Array.isArray(urls)) { @@ -238,12 +238,10 @@ const QueryClient = async (chainId, restUrls, opts) => { urls = [urls] } } - const path = type === "rest" ? apiPath('/base/tendermint', 'blocks/latest') : "/block"; return Promise.any(urls.map(async (url) => { url = url.replace(/\/$/, '') try { - let data = await getLatestBlock(url, type, path, opts) - if (type === "rpc") data = data.result; + let data = await getLatestBlock({ ...opts, url: url }) if (data.block?.header?.chain_id === chainId) { return url; } @@ -251,15 +249,17 @@ const QueryClient = async (chainId, restUrls, opts) => { })); } - async function getLatestBlock(url, type, path, opts){ + async function getLatestBlock(opts){ const { timeout } = opts || {} + const url = opts?.url || restUrl + const path = opts?.path || apiPath('/base/tendermint', 'blocks/latest') try { return await axios.get(url + path, { timeout }) .then((res) => res.data) } catch (error) { - const fallback = type === 'rest' && '/blocks/latest' - if (fallback && fallback !== path && error.response?.status === 501) { - return getLatestBlock(url, type, fallback, opts) + const fallback = '/blocks/latest' + if (fallback !== path && error.response?.status === 501) { + return getLatestBlock({ ...opts, path: fallback }) } throw(error) } @@ -293,7 +293,8 @@ const QueryClient = async (chainId, restUrls, opts) => { getGranteeGrants, getGranterGrants, getWithdrawAddress, - getTransactions + getTransactions, + getLatestBlock }; }; diff --git a/src/utils/SigningClient.mjs b/src/utils/SigningClient.mjs index a2dfc615..2238a480 100644 --- a/src/utils/SigningClient.mjs +++ b/src/utils/SigningClient.mjs @@ -13,9 +13,11 @@ import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx.js"; import { coin } from './Helpers.mjs' import DefaultSigningAdapter from '../adapters/DefaultSigningAdapter.mjs'; import TerraSigningAdapter from '../adapters/TerraSigningAdapter.mjs'; +import InjectiveSigningAdapter from '../adapters/InjectiveSigningAdapter.mjs'; const adapters = { - terra: TerraSigningAdapter + terra: TerraSigningAdapter, + injective: InjectiveSigningAdapter } function SigningClient(network, signerProvider) { diff --git a/src/utils/Validator.mjs b/src/utils/Validator.mjs index b74ba525..e75d3146 100644 --- a/src/utils/Validator.mjs +++ b/src/utils/Validator.mjs @@ -1,10 +1,10 @@ -import { Bech32 } from '@cosmjs/encoding' +import { fromBech32, toBech32 } from '@cosmjs/encoding' const Validator = (network, data) => { const address = data.operator_address const { delegations } = data const totalSlashes = data.slashes?.length - const blockPeriod = data.missed_blocks_periods && data.missed_blocks_periods.slice(-1)[0] + const blockPeriod = data.missed_blocks_periods && data.missed_blocks_periods.slice(-1)[0] const uptime = blockPeriod?.blocks && ((blockPeriod.blocks - blockPeriod.missed) / blockPeriod.blocks) const missedBlocks = blockPeriod?.missed const totalTokens = delegations?.total_tokens_display @@ -16,7 +16,7 @@ const Validator = (network, data) => { if (!address || !window.atob) return false; const prefix = network.prefix - const validatorOperator = Bech32.encode(prefix, Bech32.decode(data.operator_address).data) + const validatorOperator = toBech32(prefix, fromBech32(data.operator_address).data) return validatorOperator === address } From c784605a7964a3b99ec0d62204ce8ee8c63ddd39 Mon Sep 17 00:00:00 2001 From: Tom Beynon Date: Tue, 24 Dec 2024 18:01:38 +0000 Subject: [PATCH 2/8] Convert QueryClient to RestClient and tidy props --- src/adapters/InjectiveSigningAdapter.mjs | 2 +- src/components/App.js | 15 ++++++++------- src/components/Delegations.js | 12 ++++++++---- src/components/NetworkFinder.js | 6 ++---- src/components/ProposalDetails.js | 10 +++++----- src/components/ProposalModal.js | 1 - src/components/ValidatorModal.js | 2 +- src/components/Voting.js | 9 ++++----- src/utils/Network.mjs | 8 ++++---- src/utils/{QueryClient.mjs => RestClient.mjs} | 4 ++-- 10 files changed, 35 insertions(+), 34 deletions(-) rename src/utils/{QueryClient.mjs => RestClient.mjs} (99%) diff --git a/src/adapters/InjectiveSigningAdapter.mjs b/src/adapters/InjectiveSigningAdapter.mjs index e2af15c4..ecb375b2 100644 --- a/src/adapters/InjectiveSigningAdapter.mjs +++ b/src/adapters/InjectiveSigningAdapter.mjs @@ -34,7 +34,7 @@ export default class InjectiveSigningAdapter extends DefaultSigningAdapter { const ethereumChainId = 1 const { account_number: accountNumber, sequence, address } = account - const latestBlock = await this.network.queryClient.getLatestBlock() + const latestBlock = await this.network.restClient.getLatestBlock() const latestHeight = latestBlock.block.header.height const timeoutHeight = new BigNumberInBase(latestHeight).plus( DEFAULT_BLOCK_TIMEOUT_HEIGHT, diff --git a/src/components/App.js b/src/components/App.js index 185f1de0..e04028fc 100644 --- a/src/components/App.js +++ b/src/components/App.js @@ -134,6 +134,10 @@ class App extends React.Component { return this.props.network?.connected } + restClient() { + return this.props.network?.restClient + } + getSignerProvider(providerKey){ if(this.props.network?.disabledWallets?.includes(providerKey)) return @@ -302,7 +306,7 @@ class App extends React.Component { async getBalance() { if (!this.state.address) return - this.props.queryClient.getBalance(this.state.address) + this.restClient().getBalance(this.state.address) .then( (balances) => { const balance = balances?.find( @@ -324,9 +328,9 @@ class App extends React.Component { let granterGrants, granteeGrants, grantQuerySupport try { - granterGrants = await this.props.queryClient.getGranterGrants(address) + granterGrants = await this.restClient().getGranterGrants(address) this.setGrants(address, granterGrants, 'granter', true) - granteeGrants = await this.props.queryClient.getGranteeGrants(address) + granteeGrants = await this.restClient().getGranteeGrants(address) return this.setGrants(address, granteeGrants, 'grantee') } catch (error) { console.log('Failed to get all grants in batch', error.message) @@ -360,7 +364,7 @@ class App extends React.Component { return () => { if (address !== this.state.address) return - return this.props.queryClient.getGrants(grantee, granter).then( + return this.restClient().getGrants(grantee, granter).then( (result) => { return result.map(grant => { return { @@ -775,7 +779,6 @@ class App extends React.Component { showAbout={() => this.setState({ showAbout: true })} onGrant={this.onGrant} onRevoke={this.onRevoke} - queryClient={this.props.queryClient} signingClient={this.state.signingClient} /> } @@ -785,7 +788,6 @@ class App extends React.Component { address={this.state.address} wallet={this.state.wallet} favouriteAddresses={this.favouriteAddresses()} - queryClient={this.props.queryClient} signingClient={this.state.signingClient} /> )} {this.props.active === 'grants' && this.state.address && this.props.network.authzSupport && ( @@ -801,7 +803,6 @@ class App extends React.Component { toggleFavouriteAddress={this.toggleFavouriteAddress} onGrant={this.onGrant} onRevoke={this.onRevoke} - queryClient={this.props.queryClient} grantQuerySupport={this.state.grantQuerySupport} signingClient={this.state.signingClient} /> )} diff --git a/src/components/Delegations.js b/src/components/Delegations.js index 839b721e..b1b4087d 100644 --- a/src/components/Delegations.js +++ b/src/components/Delegations.js @@ -80,6 +80,10 @@ class Delegations extends React.Component { this.clearRefreshInterval() } + restClient() { + return this.props.network.restClient + } + async refresh(getGrants) { this.calculateApy(); await this.getDelegations() @@ -111,7 +115,7 @@ class Delegations extends React.Component { if(!this.props.address) return const address = this.props.address - return this.props.queryClient.getDelegations(address) + return this.restClient().getDelegations(address) .then( (delegations) => { const orderedAddresses = Object.keys(this.props.validators) @@ -149,7 +153,7 @@ class Delegations extends React.Component { if(!this.props.address) return const address = this.props.address - return this.props.queryClient.getWithdrawAddress(address).then(withdraw => { + return this.restClient().getWithdrawAddress(address).then(withdraw => { if (withdraw !== address) { this.setState({ error: 'You have a different withdraw address set. REStake WILL NOT WORK!' }) } @@ -161,7 +165,7 @@ class Delegations extends React.Component { getRewards(hideError) { if(!this.props.address) return - this.props.queryClient + this.restClient() .getRewards(this.props.address, this.props.network.denom) .then( (rewards) => { @@ -179,7 +183,7 @@ class Delegations extends React.Component { Object.values(this.props.validators).forEach(validator => { if(validator.isValidatorOperator(this.props.address)){ - this.props.queryClient.getCommission(validator.address).then((commission) => { + this.restClient().getCommission(validator.address).then((commission) => { this.setState((state, props) => ({ commission: _.set( state.commission, diff --git a/src/components/NetworkFinder.js b/src/components/NetworkFinder.js index 0342b2ab..d4ba91e6 100644 --- a/src/components/NetworkFinder.js +++ b/src/components/NetworkFinder.js @@ -77,7 +77,7 @@ function NetworkFinder() { window.location.replace('https://' + domain); } else { const directory = CosmosDirectory(networkMode === 'testnet'); - setState({ networkMode, directory, active: 'networks', network: null, queryClient: null, networks: {}, validators: {}, operators: [] }); + setState({ networkMode, directory, active: 'networks', network: null, networks: {}, validators: {}, operators: [] }); } } @@ -86,7 +86,6 @@ function NetworkFinder() { setState({ network: network, - queryClient: network.queryClient, validators: network.getValidators(), operators: network.getOperators(), loading: false @@ -190,7 +189,6 @@ function NetworkFinder() { setState({ active: grantMatch ? 'grants' : voteMatch ? 'voting' : 'delegations', network: network, - queryClient: network.queryClient, validators: network.getValidators(), operators: network.getOperators(), loading: false @@ -228,7 +226,7 @@ function NetworkFinder() { ) } - return changeNetwork(network, validators)} setActive={setActive} diff --git a/src/components/ProposalDetails.js b/src/components/ProposalDetails.js index b9924217..4bab20e4 100644 --- a/src/components/ProposalDetails.js +++ b/src/components/ProposalDetails.js @@ -30,19 +30,19 @@ function ProposalDetails(props) { const transformHTMLString = (htmlString, isSpam) => { let transformedString = htmlString; - + // Transform headings transformedString = transformedString.replace(/(.*?)<\/h[2-6]>/g, '
$1
'); transformedString = transformedString.replace(/

(.*?)<\/h1>/g, '

$1
'); - + // Remove all tags if proposal is spam if (isSpam) { transformedString = transformedString.replace(/]*>(.*?)<\/a>/g, '$1'); } - + // Apply table class transformedString = transformedString.replace(//g, '
'); - + return transformedString; }; @@ -58,7 +58,7 @@ function ProposalDetails(props) { useEffect(() => { if(granter){ - props.queryClient.getProposalVote(proposal_id, granter).then(result => { + network.restClient.getProposalVote(proposal_id, granter).then(result => { return setGranterVote(Vote(result.vote)) }).catch(error => { setGranterVote(null) diff --git a/src/components/ProposalModal.js b/src/components/ProposalModal.js index 7454688c..bb50ce37 100644 --- a/src/components/ProposalModal.js +++ b/src/components/ProposalModal.js @@ -33,7 +33,6 @@ function ProposalModal(props) { wallet={props.wallet} granters={props.granters} favouriteAddresses={props.favouriteAddresses} - queryClient={props.queryClient} signingClient={props.signingClient} onVote={props.onVote} /> diff --git a/src/components/ValidatorModal.js b/src/components/ValidatorModal.js index 55a79967..f22b15bd 100644 --- a/src/components/ValidatorModal.js +++ b/src/components/ValidatorModal.js @@ -105,7 +105,7 @@ function ValidatorModal(props) { const key = network.chain.sdk50OrLater ? 'query' : 'events' - network.queryClient.getTransactions([ + network.restClient.getTransactions([ // { key: key, value: `message.action='/cosmos.authz.v1beta1.MsgExec'` }, { key: key, value: `message.sender='${operator.botAddress}'` } ], { diff --git a/src/components/Voting.js b/src/components/Voting.js index 43f68258..04eb1757 100644 --- a/src/components/Voting.js +++ b/src/components/Voting.js @@ -79,11 +79,11 @@ function Voting(props) { }, [address]); async function getProposals(opts) { - if(!props.queryClient) return + if(!network.restClient) return const { clearExisting } = opts || {} try { - let newProposals = await props.queryClient.getProposals() + let newProposals = await network.restClient.getProposals() newProposals = await mapSync(newProposals.map(el => { return async () => { return await Proposal(el) @@ -112,7 +112,7 @@ function Voting(props) { const talliesInvalid = _.every(Object.values(result), el => el === '0') if (proposal.isVoting && talliesInvalid) { - return props.queryClient.getProposalTally(proposal_id).then(result => { + return network.restClient.getProposalTally(proposal_id).then(result => { return setTallies({ [proposal_id]: result.tally }) }) } @@ -129,7 +129,7 @@ function Voting(props) { const { proposal_id } = proposal if (votes[proposal_id] && !clearExisting) return - return props.queryClient.getProposalVote(proposal_id, address).then(result => { + return network.restClient.getProposalVote(proposal_id, address).then(result => { return setVotes({ [proposal_id]: Vote(result.vote) }) }).catch(error => { }) } @@ -206,7 +206,6 @@ function Voting(props) { vote={proposal && votes[proposal.proposal_id]} granters={voteGrants.map(el => el.granter)} favouriteAddresses={props.favouriteAddresses} - queryClient={props.queryClient} signingClient={props.signingClient} closeProposal={closeProposal} onVote={onVote} diff --git a/src/utils/Network.mjs b/src/utils/Network.mjs index fe6f76e2..6c5e1177 100644 --- a/src/utils/Network.mjs +++ b/src/utils/Network.mjs @@ -3,7 +3,7 @@ import { multiply, pow, format, bignumber, number, larger } from 'mathjs' import { GasPrice, } from "@cosmjs/stargate"; -import QueryClient from './QueryClient.mjs' +import RestClient from './RestClient.mjs' import Validator from './Validator.mjs' import Operator from './Operator.mjs' import Chain from './Chain.mjs' @@ -132,12 +132,12 @@ class Network { async connect(opts) { try { - this.queryClient = await QueryClient(this.chain.chainId, this.restUrl, { + this.restClient = await RestClient(this.chain.chainId, this.restUrl, { connectTimeout: opts?.timeout, apiVersions: this.chain.apiVersions }) - this.restUrl = this.queryClient.restUrl - this.connected = this.queryClient.connected && (!this.usingDirectory || this.connectedDirectory()) + this.restUrl = this.restClient.restUrl + this.connected = this.restClient.connected && (!this.usingDirectory || this.connectedDirectory()) } catch (error) { console.log(error) this.connected = false diff --git a/src/utils/QueryClient.mjs b/src/utils/RestClient.mjs similarity index 99% rename from src/utils/QueryClient.mjs rename to src/utils/RestClient.mjs index 2542bd94..cb6a644b 100644 --- a/src/utils/QueryClient.mjs +++ b/src/utils/RestClient.mjs @@ -2,7 +2,7 @@ import axios from "axios"; import axiosRetry from 'axios-retry'; import _ from "lodash"; -const QueryClient = async (chainId, restUrls, opts) => { +const RestClient = async (chainId, restUrls, opts) => { const config = _.merge({ connectTimeout: 10000, }, opts) @@ -298,4 +298,4 @@ const QueryClient = async (chainId, restUrls, opts) => { }; }; -export default QueryClient; +export default RestClient; From ef71d4222ba0cf449d70319412a7e85ab712a861 Mon Sep 17 00:00:00 2001 From: Tom Beynon Date: Tue, 24 Dec 2024 20:54:22 +0000 Subject: [PATCH 3/8] Move signing rest requests to RestClient --- src/utils/RestClient.mjs | 126 +++++++++++++++++++++++++++++++++++- src/utils/SigningClient.mjs | 115 ++------------------------------ 2 files changed, 132 insertions(+), 109 deletions(-) diff --git a/src/utils/RestClient.mjs b/src/utils/RestClient.mjs index cb6a644b..f3159635 100644 --- a/src/utils/RestClient.mjs +++ b/src/utils/RestClient.mjs @@ -1,6 +1,10 @@ import axios from "axios"; import axiosRetry from 'axios-retry'; import _ from "lodash"; +import { + assertIsDeliverTxSuccess +} from "@cosmjs/stargate"; +import { sleep } from "@cosmjs/utils"; const RestClient = async (chainId, restUrls, opts) => { const config = _.merge({ @@ -215,6 +219,121 @@ const RestClient = async (chainId, restUrls, opts) => { return client.get(apiPath('tx', `txs?${searchParams.toString()}`), opts).then((res) => res.data); } + function getTransaction(txHash) { + return axios.get(apiUrl('tx', `txs/${txHash}`)).then((res) => res.data); + } + + function getAccount(address) { + return axios + .get(apiUrl('auth', `accounts/${address}`)) + .then((res) => res.data.account) + .then((value) => { + if(!value) throw new Error('Failed to fetch account, please try again') + + // see https://github.com/chainapsis/keplr-wallet/blob/7ca025d32db7873b7a870e69a4a42b525e379132/packages/cosmos/src/account/index.ts#L73 + // If the chain modifies the account type, handle the case where the account type embeds the base account. + // (Actually, the only existent case is ethermint, and this is the line for handling ethermint) + const baseAccount = + value.BaseAccount || value.baseAccount || value.base_account; + if (baseAccount) { + value = baseAccount; + } + + // If the account is the vesting account that embeds the base vesting account, + // the actual base account exists under the base vesting account. + // But, this can be different according to the version of cosmos-sdk. + // So, anyway, try to parse it by some ways... + const baseVestingAccount = + value.BaseVestingAccount || + value.baseVestingAccount || + value.base_vesting_account; + if (baseVestingAccount) { + value = baseVestingAccount; + + const baseAccount = + value.BaseAccount || value.baseAccount || value.base_account; + if (baseAccount) { + value = baseAccount; + } + } + + // Handle nested account like Desmos + const nestedAccount = value.account + if(nestedAccount){ + value = nestedAccount + } + + return value + }) + .catch((error) => { + if(error.response?.status === 404){ + throw new Error('Account does not exist on chain') + }else{ + throw error + } + }) + }; + + function simulate(params){ + return axios.post(apiUrl('tx', `simulate`), params) + .then((res) => res.data) + } + + function broadcast(params){ + return axios.post(apiUrl('tx', `txs`), params) + .then((res) => parseTxResult(res.data.tx_response)) + } + + async function broadcastAndWait(params, timeout, pollInterval){ + const timeoutMs = timeout || 60_000 + const pollIntervalMs = pollInterval || 3_000 + let timedOut = false + const txPollTimeout = setTimeout(() => { + timedOut = true; + }, timeoutMs); + + const pollForTx = async (txId) => { + if (timedOut) { + throw new Error( + `Transaction with ID ${txId} was submitted but was not yet found on the chain. You might want to check later. There was a wait of ${timeoutMs / 1000} seconds.` + ); + } + await sleep(pollIntervalMs); + try { + const response = await getTransaction(txId); + const result = parseTxResult(response.tx_response) + return result + } catch { + return pollForTx(txId); + } + }; + + const result = await broadcast(params) + assertIsDeliverTxSuccess(result) + return pollForTx(result.transactionHash).then( + (value) => { + clearTimeout(txPollTimeout); + assertIsDeliverTxSuccess(value) + return value + }, + (error) => { + clearTimeout(txPollTimeout); + return error + }, + ) + } + + function parseTxResult(result){ + return { + code: result.code, + height: result.height, + rawLog: result.raw_log, + transactionHash: result.txhash, + gasUsed: result.gas_used, + gasWanted: result.gas_wanted, + } + } + async function getAllPages(getPage, pageCallback) { let pages = []; let nextKey, error; @@ -294,7 +413,12 @@ const RestClient = async (chainId, restUrls, opts) => { getGranterGrants, getWithdrawAddress, getTransactions, - getLatestBlock + getTransaction, + getLatestBlock, + getAccount, + simulate, + broadcast, + broadcastAndWait }; }; diff --git a/src/utils/SigningClient.mjs b/src/utils/SigningClient.mjs index 2238a480..7e62ec5d 100644 --- a/src/utils/SigningClient.mjs +++ b/src/utils/SigningClient.mjs @@ -1,12 +1,9 @@ import _ from 'lodash' -import axios from 'axios' import { multiply, ceil, bignumber } from 'mathjs' import { - assertIsDeliverTxSuccess, GasPrice, } from "@cosmjs/stargate"; -import { sleep } from "@cosmjs/utils"; import { toBase64 } from '@cosmjs/encoding' import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx.js"; @@ -23,62 +20,11 @@ const adapters = { function SigningClient(network, signerProvider) { const adapter = new (adapters[network.path] || DefaultSigningAdapter)(network, signerProvider) const { - restUrl, + restClient, gasPrice: defaultGasPrice, gasModifier: defaultGasModifier, } = network - function getAccount(address) { - return axios - .get(restUrl + "/cosmos/auth/v1beta1/accounts/" + address) - .then((res) => res.data.account) - .then((value) => { - if(!value) throw new Error('Failed to fetch account, please try again') - - // see https://github.com/chainapsis/keplr-wallet/blob/7ca025d32db7873b7a870e69a4a42b525e379132/packages/cosmos/src/account/index.ts#L73 - // If the chain modifies the account type, handle the case where the account type embeds the base account. - // (Actually, the only existent case is ethermint, and this is the line for handling ethermint) - const baseAccount = - value.BaseAccount || value.baseAccount || value.base_account; - if (baseAccount) { - value = baseAccount; - } - - // If the account is the vesting account that embeds the base vesting account, - // the actual base account exists under the base vesting account. - // But, this can be different according to the version of cosmos-sdk. - // So, anyway, try to parse it by some ways... - const baseVestingAccount = - value.BaseVestingAccount || - value.baseVestingAccount || - value.base_vesting_account; - if (baseVestingAccount) { - value = baseVestingAccount; - - const baseAccount = - value.BaseAccount || value.baseAccount || value.base_account; - if (baseAccount) { - value = baseAccount; - } - } - - // Handle nested account like Desmos - const nestedAccount = value.account - if(nestedAccount){ - value = nestedAccount - } - - return value - }) - .catch((error) => { - if(error.response?.status === 404){ - throw new Error('Account does not exist on chain') - }else{ - throw error - } - }) - }; - // vendored to handle large integers // https://github.com/cosmos/cosmjs/blob/0f0c9d8a754cbf01e17acf51d3f2dbdeaae60757/packages/stargate/src/fee.ts function calculateFee(gasLimit, gasPrice) { @@ -116,18 +62,18 @@ function SigningClient(network, signerProvider) { } async function sign(address, messages, memo, fee){ - const account = await getAccount(address) + const account = await restClient.getAccount(address) return adapter.sign(account, messages, memo, fee) } async function simulate(address, messages, memo, modifier) { - const account = await getAccount(address) + const account = await restClient.getAccount(address) const fee = getFee(100_000) const txBody = await adapter.simulate(account, messages, memo, fee) try { - const estimate = await axios.post(restUrl + '/cosmos/tx/v1beta1/simulate', { + const estimate = await restClient.simulate({ tx_bytes: toBase64(TxRaw.encode(txBody).finish()), - }).then(el => el.data.gas_info.gas_used) + }).then(el => el.gas_info.gas_used) return (parseInt(estimate * (modifier || defaultGasModifier))); } catch (error) { throw new Error(error.response?.data?.message || error.message) @@ -135,57 +81,10 @@ function SigningClient(network, signerProvider) { } async function broadcast(txBody){ - const timeoutMs = network.txTimeout || 60_000 - const pollIntervalMs = 3_000 - let timedOut = false - const txPollTimeout = setTimeout(() => { - timedOut = true; - }, timeoutMs); - - const pollForTx = async (txId) => { - if (timedOut) { - throw new Error( - `Transaction with ID ${txId} was submitted but was not yet found on the chain. You might want to check later. There was a wait of ${timeoutMs / 1000} seconds.` - ); - } - await sleep(pollIntervalMs); - try { - const response = await axios.get(restUrl + '/cosmos/tx/v1beta1/txs/' + txId); - const result = parseTxResult(response.data.tx_response) - return result - } catch { - return pollForTx(txId); - } - }; - - const response = await axios.post(restUrl + '/cosmos/tx/v1beta1/txs', { + return await restClient.broadcastAndWait({ tx_bytes: toBase64(TxRaw.encode(txBody).finish()), mode: "BROADCAST_MODE_SYNC" - }) - const result = parseTxResult(response.data.tx_response) - assertIsDeliverTxSuccess(result) - return pollForTx(result.transactionHash).then( - (value) => { - clearTimeout(txPollTimeout); - assertIsDeliverTxSuccess(value) - return value - }, - (error) => { - clearTimeout(txPollTimeout); - return error - }, - ) - } - - function parseTxResult(result){ - return { - code: result.code, - height: result.height, - rawLog: result.raw_log, - transactionHash: result.txhash, - gasUsed: result.gas_used, - gasWanted: result.gas_wanted, - } + }, network.txTimeout) } return { From cdc13cd363e2af916ee1f0c895af05c406cc2f47 Mon Sep 17 00:00:00 2001 From: Tom Beynon Date: Tue, 24 Dec 2024 21:26:44 +0000 Subject: [PATCH 4/8] Move SigningClient and SignerProvider into Wallet --- src/components/App.js | 59 +++++------------ src/components/ClaimRewards.js | 13 ++-- src/components/ConnectWalletModal.js | 99 ---------------------------- src/components/DelegateForm.js | 9 ++- src/components/Delegations.js | 7 -- src/components/GrantModal.js | 4 +- src/components/Grants.js | 2 - src/components/ProposalDetails.js | 1 - src/components/ProposalModal.js | 1 - src/components/REStakeGrantForm.js | 3 +- src/components/RevokeGrant.js | 6 +- src/components/SendModal.js | 6 +- src/components/ValidatorModal.js | 1 - src/components/ValidatorStake.js | 6 -- src/components/VoteForm.js | 2 +- src/components/Voting.js | 2 - src/components/WalletModal.js | 2 +- src/utils/Wallet.mjs | 32 ++++++--- 18 files changed, 61 insertions(+), 194 deletions(-) delete mode 100644 src/components/ConnectWalletModal.js diff --git a/src/components/App.js b/src/components/App.js index e04028fc..8ea1f9eb 100644 --- a/src/components/App.js +++ b/src/components/App.js @@ -53,10 +53,8 @@ import Wallet from '../utils/Wallet.mjs'; import SendModal from './SendModal'; import KeplrSignerProvider from '../utils/KeplrSignerProvider.mjs'; import LeapSignerProvider from '../utils/LeapSignerProvider.mjs'; -import ConnectWalletModal from './ConnectWalletModal'; import { truncateAddress } from '../utils/Helpers.mjs'; import CosmostationSignerProvider from '../utils/CosmostationSignerProvider.mjs'; -import SigningClient from '../utils/SigningClient.mjs'; class App extends React.Component { constructor(props) { @@ -146,14 +144,12 @@ class App extends React.Component { disconnect() { localStorage.removeItem('connected') - this.state.signerProvider?.disconnect() + this.state.wallet?.disconnect() this.setState({ error: null, address: null, balance: null, - wallet: null, - signingClient: null, - signerProvider: null + wallet: null }) } @@ -193,8 +189,6 @@ class App extends React.Component { return } - this.setState({ signerProvider }) - const wallet = new Wallet(network, signerProvider) try { const key = await wallet.connect(); @@ -206,29 +200,17 @@ class App extends React.Component { error: `Unable to connect to ${signerProvider?.label || 'signer'}: ${e.message}`, address: null, wallet: null, - signingClient: null - }) - } - try { - const signingClient = SigningClient(network, signerProvider) - - const address = await wallet.getAddress(); - - localStorage.setItem('connected', providerKey) - this.setState({ - address, - wallet, - signingClient, - error: false, - qrCodeUri: null, - qrCodeCallback: null - }) - } catch (e) { - console.log(e) - return this.setState({ - error: `Failed to connect to ${signerProvider?.label || 'signer'}: ${e.message}` }) } + const address = wallet.address; + localStorage.setItem('connected', providerKey) + this.setState({ + address, + wallet, + error: false, + qrCodeUri: null, + qrCodeCallback: null + }) } refreshInterval() { @@ -640,7 +622,7 @@ class App extends React.Component { ) : ( diff --git a/src/utils/Wallet.mjs b/src/utils/Wallet.mjs index 50946165..d6da77e7 100644 --- a/src/utils/Wallet.mjs +++ b/src/utils/Wallet.mjs @@ -1,3 +1,5 @@ +import SigningClient from '../utils/SigningClient.mjs'; + export const messageTypes = [ '/cosmos.gov.v1beta1.MsgVote', '/cosmos.gov.v1beta1.MsgDeposit', @@ -17,15 +19,37 @@ class Wallet { constructor(network, signerProvider){ this.network = network this.signerProvider = signerProvider + this.signingClient = new SigningClient(network, signerProvider) this.grants = [] } async connect(){ this.key = await this.signerProvider.connect(this.network) + this.address = await this.signerProvider.getAddress() this.name = this.key?.name return this.key } + disconnect(){ + this.signerProvider.disconnect() + } + + signAndBroadcast(messages, gas, memo, gasPrice){ + return this.signingClient.signAndBroadcast(this.address, messages, gas, memo, gasPrice) + } + + signAndBroadcastWithoutBalanceCheck(msgs, gas, memo, gasPrice){ + return this.signingClient.signAndBroadcastWithoutBalanceCheck(this.address, msgs, gas, memo, gasPrice) + } + + simulate(messages, memo, modifier){ + return this.signingClient.simulate(this.address, messages, memo, modifier) + } + + getFee(gas, gasPrice){ + return this.signingClient.getFee(gas, gasPrice) + } + hasPermission(address, action){ if(address === this.address) return true if(!this.authzSupport()) return false @@ -60,14 +84,6 @@ class Wallet { signAminoSupport(){ return this.signerProvider.signAminoSupport() } - - async getAddress(){ - if(!this.address){ - this.address = await this.signerProvider.getAddress() - } - - return this.address - } } export default Wallet From a18f00d305b7e27f7f16e1303e27ac9c1fbd0034 Mon Sep 17 00:00:00 2001 From: Tom Beynon Date: Tue, 24 Dec 2024 21:37:24 +0000 Subject: [PATCH 5/8] Fix broken Keplr error message --- src/components/App.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/components/App.js b/src/components/App.js index 8ea1f9eb..d69e6e97 100644 --- a/src/components/App.js +++ b/src/components/App.js @@ -732,11 +732,6 @@ class App extends React.Component { )} - {!this.state.providerError === 'keplr' && ( - this.setState({ providerError: false })}> - Please install the Keplr browser extension using desktop Google Chrome. - - )} {this.props.active === 'networks' && ( Date: Thu, 26 Dec 2024 21:54:28 +0000 Subject: [PATCH 6/8] Implement all message classes and complete Injective ledger signing --- package-lock.json | 446 ++++++++++-------- package.json | 2 +- src/adapters/DefaultSigningAdapter.mjs | 86 ++-- src/adapters/InjectiveSigningAdapter.mjs | 22 +- src/adapters/TerraSigningAdapter.mjs | 25 +- src/components/ClaimRewards.js | 25 +- src/components/DelegateForm.js | 37 +- src/components/GrantModal.js | 63 +-- src/components/REStakeGrantForm.js | 78 +-- src/components/RevokeGrant.js | 14 +- src/components/SendModal.js | 14 +- src/components/VoteForm.js | 26 +- src/messages/MsgBase.mjs | 45 ++ src/messages/MsgBeginRedelegate.mjs | 18 + src/messages/MsgDelegate.mjs | 16 + src/messages/MsgExec.mjs | 34 ++ src/messages/MsgGrant.mjs | 65 +++ src/messages/MsgRevoke.mjs | 27 ++ src/messages/MsgSend.mjs | 17 + src/messages/MsgUndelegate.mjs | 16 + src/messages/MsgVote.mjs | 16 + src/messages/MsgWithdrawDelegatorReward.mjs | 15 + .../MsgWithdrawValidatorCommission.mjs | 15 + .../authorizations/GenericAuthorization.mjs | 14 + .../authorizations/StakeAuthorization.mjs | 23 + src/messages/delegate.mjs | 5 - src/messages/message.mjs | 58 --- src/messages/vote.mjs | 16 - src/networks.json | 6 +- src/utils/Helpers.mjs | 34 +- src/utils/SigningClient.mjs | 6 +- 31 files changed, 742 insertions(+), 542 deletions(-) create mode 100644 src/messages/MsgBase.mjs create mode 100644 src/messages/MsgBeginRedelegate.mjs create mode 100644 src/messages/MsgDelegate.mjs create mode 100644 src/messages/MsgExec.mjs create mode 100644 src/messages/MsgGrant.mjs create mode 100644 src/messages/MsgRevoke.mjs create mode 100644 src/messages/MsgSend.mjs create mode 100644 src/messages/MsgUndelegate.mjs create mode 100644 src/messages/MsgVote.mjs create mode 100644 src/messages/MsgWithdrawDelegatorReward.mjs create mode 100644 src/messages/MsgWithdrawValidatorCommission.mjs create mode 100644 src/messages/authorizations/GenericAuthorization.mjs create mode 100644 src/messages/authorizations/StakeAuthorization.mjs delete mode 100644 src/messages/delegate.mjs delete mode 100644 src/messages/message.mjs delete mode 100644 src/messages/vote.mjs diff --git a/package-lock.json b/package-lock.json index f1b09d84..9c1acde2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@bugsnag/plugin-react": "^7.16.1", "@cosmjs/proto-signing": "^0.32.4", "@cosmjs/stargate": "^0.32.4", - "@injectivelabs/sdk-ts": "^1.14.13", + "@injectivelabs/sdk-ts": "^1.14.33", "@keplr-wallet/wc-client": "^0.11.3", "@terra-money/terra.js": "^3.1.8", "@testing-library/jest-dom": "^5.16.2", @@ -79,9 +79,10 @@ "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==" }, "node_modules/@apollo/client": { - "version": "3.11.8", - "resolved": "https://registry.npmjs.org/@apollo/client/-/client-3.11.8.tgz", - "integrity": "sha512-CgG1wbtMjsV2pRGe/eYITmV5B8lXUCYljB2gB/6jWTFQcrvirUVvKg7qtFdjYkQSFbIffU1IDyxgeaN81eTjbA==", + "version": "3.12.4", + "resolved": "https://registry.npmjs.org/@apollo/client/-/client-3.12.4.tgz", + "integrity": "sha512-S/eC9jxEW9Jg1BjD6AZonE1fHxYuvC3gFHop8FRQkUdeK63MmBD5r0DOrN2WlJbwha1MSD6A97OwXwjaujEQpA==", + "license": "MIT", "dependencies": { "@graphql-typed-document-node/core": "^3.1.1", "@wry/caches": "^1.0.0", @@ -101,8 +102,8 @@ "peerDependencies": { "graphql": "^15.0.0 || ^16.0.0", "graphql-ws": "^5.5.5", - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc", "subscriptions-transport-ws": "^0.9.0 || ^0.11.0" }, "peerDependenciesMeta": { @@ -124,14 +125,16 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-4.0.0.tgz", "integrity": "sha512-b19dMThMV4HVFynSAM1++gBHAbk2Tc/osgLIBZMKsyqh34jb2e8Os7T6ZW/Bt3pJFdBTd2JwAnAAEQV7rSNvcQ==", + "license": "MIT", "engines": { "node": ">=0.10" } }, "node_modules/@apollo/client/node_modules/tslib": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", - "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" }, "node_modules/@babel/code-frame": { "version": "7.24.7", @@ -933,6 +936,7 @@ "version": "3.2.0", "resolved": "https://registry.npmjs.org/@graphql-typed-document-node/core/-/core-3.2.0.tgz", "integrity": "sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==", + "license": "MIT", "peerDependencies": { "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } @@ -978,9 +982,10 @@ } }, "node_modules/@injectivelabs/core-proto-ts": { - "version": "0.0.21", - "resolved": "https://registry.npmjs.org/@injectivelabs/core-proto-ts/-/core-proto-ts-0.0.21.tgz", - "integrity": "sha512-RBxSkRBCty60R/l55/D1jsSW0Aof5dyGFhCFdN3A010KjMv/SzZGGr+6DZPY/hflyFeaJzDv/VTopCymKNRBvQ==", + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/@injectivelabs/core-proto-ts/-/core-proto-ts-1.13.4.tgz", + "integrity": "sha512-81+bwey0qzNgOzUASsxYghSahcWzH5l6bSceW8FdR7w42+Knp+bAgbg12sSyS1hiOO2kMXx6tBvmYkCmnghM1Q==", + "license": "MIT", "dependencies": { "@injectivelabs/grpc-web": "^0.0.1", "google-protobuf": "^3.14.0", @@ -989,23 +994,26 @@ } }, "node_modules/@injectivelabs/core-proto-ts/node_modules/@types/node": { - "version": "22.8.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.8.1.tgz", - "integrity": "sha512-k6Gi8Yyo8EtrNtkHXutUu2corfDf9su95VYVP10aGYMMROM6SAItZi0w1XszA6RtWTHSVp5OeFof37w0IEqCQg==", + "version": "22.10.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.2.tgz", + "integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==", + "license": "MIT", "dependencies": { - "undici-types": "~6.19.8" + "undici-types": "~6.20.0" } }, "node_modules/@injectivelabs/core-proto-ts/node_modules/long": { "version": "5.2.3", "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==", + "license": "Apache-2.0" }, "node_modules/@injectivelabs/core-proto-ts/node_modules/protobufjs": { "version": "7.4.0", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.4.0.tgz", "integrity": "sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==", "hasInstallScript": true, + "license": "BSD-3-Clause", "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", @@ -1025,72 +1033,20 @@ } }, "node_modules/@injectivelabs/core-proto-ts/node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" - }, - "node_modules/@injectivelabs/dmm-proto-ts": { - "version": "1.0.20", - "resolved": "https://registry.npmjs.org/@injectivelabs/dmm-proto-ts/-/dmm-proto-ts-1.0.20.tgz", - "integrity": "sha512-S9vGOAZbNNa+N5QDW2HcXn7ohvU/4qze6wELA9gF8zu8uWbE+UKWTqzkZ+B4XuG1MkJwoHL7pVcj3M+nC9Qe4A==", - "dependencies": { - "@injectivelabs/grpc-web": "^0.0.1", - "google-protobuf": "^3.14.0", - "protobufjs": "^7.0.0", - "rxjs": "^7.4.0" - } - }, - "node_modules/@injectivelabs/dmm-proto-ts/node_modules/@types/node": { - "version": "22.8.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.8.1.tgz", - "integrity": "sha512-k6Gi8Yyo8EtrNtkHXutUu2corfDf9su95VYVP10aGYMMROM6SAItZi0w1XszA6RtWTHSVp5OeFof37w0IEqCQg==", - "dependencies": { - "undici-types": "~6.19.8" - } - }, - "node_modules/@injectivelabs/dmm-proto-ts/node_modules/long": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" - }, - "node_modules/@injectivelabs/dmm-proto-ts/node_modules/protobufjs": { - "version": "7.4.0", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.4.0.tgz", - "integrity": "sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==", - "hasInstallScript": true, - "dependencies": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/node": ">=13.7.0", - "long": "^5.0.0" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/@injectivelabs/dmm-proto-ts/node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "license": "MIT" }, "node_modules/@injectivelabs/exceptions": { - "version": "1.14.13", - "resolved": "https://registry.npmjs.org/@injectivelabs/exceptions/-/exceptions-1.14.13.tgz", - "integrity": "sha512-yFtB0jQtZI6D3AuaP6ObYtlVgDB4vriCWuV+6GY3frduv7i3kz1ZYVsPKsKSKBCOD5QegZXcEmGJL4RiDi1OKA==", - "hasInstallScript": true, + "version": "1.14.33", + "resolved": "https://registry.npmjs.org/@injectivelabs/exceptions/-/exceptions-1.14.33.tgz", + "integrity": "sha512-2c8YzLgwTOOsyc1WheqdM8jEfgGBhVrXN4cZ0jsikFVsLF619IDRn3hjIYqTeNERaEpeRPiuJGfZDu0DomwFrQ==", + "license": "Apache-2.0", "dependencies": { "@injectivelabs/grpc-web": "^0.0.1", - "@injectivelabs/ts-types": "^1.14.13", + "@injectivelabs/ts-types": "^1.14.33", "http-status-codes": "^2.2.0", - "link-module-alias": "^1.2.0", "shx": "^0.3.2" } }, @@ -1122,9 +1078,10 @@ } }, "node_modules/@injectivelabs/indexer-proto-ts": { - "version": "1.11.42", - "resolved": "https://registry.npmjs.org/@injectivelabs/indexer-proto-ts/-/indexer-proto-ts-1.11.42.tgz", - "integrity": "sha512-6ejCpcWZWOSsELFIfUf2+xuJPOH+YdiJtwtB3d9x2H7dnrCBjXMxlPCSxoKEUbDH6w/lY2mO6TJm65rNy9piew==", + "version": "1.13.3", + "resolved": "https://registry.npmjs.org/@injectivelabs/indexer-proto-ts/-/indexer-proto-ts-1.13.3.tgz", + "integrity": "sha512-rLesVPCARl+OC82vj063/pUawYu0ISty/2+xg6ya4Lwk6PDbXmtRvw8wpNP6K+pAsBOKaSkRnO4ThP5qbX+E6A==", + "license": "MIT", "dependencies": { "@injectivelabs/grpc-web": "^0.0.1", "google-protobuf": "^3.14.0", @@ -1133,23 +1090,26 @@ } }, "node_modules/@injectivelabs/indexer-proto-ts/node_modules/@types/node": { - "version": "22.8.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.8.1.tgz", - "integrity": "sha512-k6Gi8Yyo8EtrNtkHXutUu2corfDf9su95VYVP10aGYMMROM6SAItZi0w1XszA6RtWTHSVp5OeFof37w0IEqCQg==", + "version": "22.10.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.2.tgz", + "integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==", + "license": "MIT", "dependencies": { - "undici-types": "~6.19.8" + "undici-types": "~6.20.0" } }, "node_modules/@injectivelabs/indexer-proto-ts/node_modules/long": { "version": "5.2.3", "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==", + "license": "Apache-2.0" }, "node_modules/@injectivelabs/indexer-proto-ts/node_modules/protobufjs": { "version": "7.4.0", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.4.0.tgz", "integrity": "sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==", "hasInstallScript": true, + "license": "BSD-3-Clause", "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", @@ -1169,14 +1129,16 @@ } }, "node_modules/@injectivelabs/indexer-proto-ts/node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "license": "MIT" }, "node_modules/@injectivelabs/mito-proto-ts": { - "version": "1.0.65", - "resolved": "https://registry.npmjs.org/@injectivelabs/mito-proto-ts/-/mito-proto-ts-1.0.65.tgz", - "integrity": "sha512-kceZP68QrgFop387RYyO7tkfJCYxoktuceHTs9DQP3dJceLqj/V2mz0NlpkkacjgE5NhYkQ/zc0Z40hr8tnYqQ==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/@injectivelabs/mito-proto-ts/-/mito-proto-ts-1.13.0.tgz", + "integrity": "sha512-DE9iK7PkEnkWAMTDJDH01R8jxkxVCNuurfVp/09Te9wY3dm3mRx9M6R756JywP2Sd/ggJl2UbavGAQe2pZ7v1w==", + "license": "MIT", "dependencies": { "@injectivelabs/grpc-web": "^0.0.1", "google-protobuf": "^3.14.0", @@ -1185,23 +1147,26 @@ } }, "node_modules/@injectivelabs/mito-proto-ts/node_modules/@types/node": { - "version": "22.8.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.8.1.tgz", - "integrity": "sha512-k6Gi8Yyo8EtrNtkHXutUu2corfDf9su95VYVP10aGYMMROM6SAItZi0w1XszA6RtWTHSVp5OeFof37w0IEqCQg==", + "version": "22.10.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.2.tgz", + "integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==", + "license": "MIT", "dependencies": { - "undici-types": "~6.19.8" + "undici-types": "~6.20.0" } }, "node_modules/@injectivelabs/mito-proto-ts/node_modules/long": { "version": "5.2.3", "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==", + "license": "Apache-2.0" }, "node_modules/@injectivelabs/mito-proto-ts/node_modules/protobufjs": { "version": "7.4.0", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.4.0.tgz", "integrity": "sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==", "hasInstallScript": true, + "license": "BSD-3-Clause", "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", @@ -1221,46 +1186,103 @@ } }, "node_modules/@injectivelabs/mito-proto-ts/node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "license": "MIT" }, "node_modules/@injectivelabs/networks": { - "version": "1.14.13", - "resolved": "https://registry.npmjs.org/@injectivelabs/networks/-/networks-1.14.13.tgz", - "integrity": "sha512-P+eCQXWpbk4LbPxgTmi2gY7OzdZTNsIEUvDoh59Ma0CkqSFaYMtgB8fZVxpkKM0UPla587EDlEEIVxprDBcnZg==", - "hasInstallScript": true, + "version": "1.14.33", + "resolved": "https://registry.npmjs.org/@injectivelabs/networks/-/networks-1.14.33.tgz", + "integrity": "sha512-XDhAYwWYKdKBRfwO/MIfMyKjKRWz/AliMJG9yaM1C/cDlGHmA3EY7Au2Nf+PdkRhuxl2FzLV2Hp4uWeC0g8BYw==", + "license": "Apache-2.0", "dependencies": { - "@injectivelabs/exceptions": "^1.14.13", - "@injectivelabs/ts-types": "^1.14.13", - "@injectivelabs/utils": "^1.14.13", - "link-module-alias": "^1.2.0", + "@injectivelabs/exceptions": "^1.14.33", + "@injectivelabs/ts-types": "^1.14.33", + "@injectivelabs/utils": "^1.14.33", "shx": "^0.3.2" } }, - "node_modules/@injectivelabs/sdk-ts": { - "version": "1.14.13", - "resolved": "https://registry.npmjs.org/@injectivelabs/sdk-ts/-/sdk-ts-1.14.13.tgz", - "integrity": "sha512-qcLoIu+hEMpuvdG0iXGNJvWQD05NkcO59tL3ijEhYmshlJWBMWJtpJJGt/E/hV9YxJfNTl20Rhi/5i7l0y8Hfg==", + "node_modules/@injectivelabs/olp-proto-ts": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/@injectivelabs/olp-proto-ts/-/olp-proto-ts-1.13.1.tgz", + "integrity": "sha512-dKxse7mZpmvRhm00Wn8Yy93EVEvFD7FPWeWFfxga0Patow3HK0D7k43VV7fE5kX9CDM1bxTatEVQ7WYGq4w0Eg==", + "license": "MIT", + "dependencies": { + "@injectivelabs/grpc-web": "^0.0.1", + "google-protobuf": "^3.14.0", + "protobufjs": "^7.0.0", + "rxjs": "^7.4.0" + } + }, + "node_modules/@injectivelabs/olp-proto-ts/node_modules/@types/node": { + "version": "22.10.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.2.tgz", + "integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==", + "license": "MIT", + "dependencies": { + "undici-types": "~6.20.0" + } + }, + "node_modules/@injectivelabs/olp-proto-ts/node_modules/long": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", + "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==", + "license": "Apache-2.0" + }, + "node_modules/@injectivelabs/olp-proto-ts/node_modules/protobufjs": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.4.0.tgz", + "integrity": "sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==", "hasInstallScript": true, + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/node": ">=13.7.0", + "long": "^5.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@injectivelabs/olp-proto-ts/node_modules/undici-types": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "license": "MIT" + }, + "node_modules/@injectivelabs/sdk-ts": { + "version": "1.14.33", + "resolved": "https://registry.npmjs.org/@injectivelabs/sdk-ts/-/sdk-ts-1.14.33.tgz", + "integrity": "sha512-qEuu6yzhy8t8rtviCBqV1VMR+JAaDSy59Eebd23i+1P5zqQ9X2lZLLLxz+gWjiglWb8uQYsoLN3TFh2509WNzQ==", + "license": "Apache-2.0", "dependencies": { - "@apollo/client": "^3.5.8", + "@apollo/client": "^3.11.10", "@cosmjs/amino": "^0.32.3", "@cosmjs/proto-signing": "^0.32.3", "@cosmjs/stargate": "^0.32.3", "@ethersproject/bytes": "^5.7.0", - "@injectivelabs/core-proto-ts": "^0.0.21", - "@injectivelabs/dmm-proto-ts": "1.0.20", - "@injectivelabs/exceptions": "^1.14.13", + "@injectivelabs/core-proto-ts": "1.13.4", + "@injectivelabs/exceptions": "^1.14.33", "@injectivelabs/grpc-web": "^0.0.1", "@injectivelabs/grpc-web-node-http-transport": "^0.0.2", "@injectivelabs/grpc-web-react-native-transport": "^0.0.2", - "@injectivelabs/indexer-proto-ts": "1.11.42", - "@injectivelabs/mito-proto-ts": "1.0.65", - "@injectivelabs/networks": "^1.14.13", - "@injectivelabs/test-utils": "^1.14.13", - "@injectivelabs/ts-types": "^1.14.13", - "@injectivelabs/utils": "^1.14.13", + "@injectivelabs/indexer-proto-ts": "1.13.3", + "@injectivelabs/mito-proto-ts": "1.13.0", + "@injectivelabs/networks": "^1.14.33", + "@injectivelabs/olp-proto-ts": "1.13.1", + "@injectivelabs/test-utils": "^1.14.33", + "@injectivelabs/ts-types": "^1.14.33", + "@injectivelabs/utils": "^1.14.33", "@metamask/eth-sig-util": "^4.0.0", "@noble/curves": "^1.4.0", "axios": "^1.6.4", @@ -1275,7 +1297,6 @@ "js-sha3": "^0.8.0", "jscrypto": "^1.0.3", "keccak256": "^1.0.6", - "link-module-alias": "^1.2.0", "secp256k1": "^4.0.3", "shx": "^0.3.2", "snakecase-keys": "^5.4.1" @@ -1287,41 +1308,42 @@ "integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==" }, "node_modules/@injectivelabs/test-utils": { - "version": "1.14.13", - "resolved": "https://registry.npmjs.org/@injectivelabs/test-utils/-/test-utils-1.14.13.tgz", - "integrity": "sha512-wa5TQcWLvORRm36mw4Hee+XF7lBlArVK3DM1ebC0uBvVcUgrmm3g/nh1pV/NzLN16WtrLLsvnTsE5uiNEcgYdw==", - "hasInstallScript": true, + "version": "1.14.33", + "resolved": "https://registry.npmjs.org/@injectivelabs/test-utils/-/test-utils-1.14.33.tgz", + "integrity": "sha512-1SfIRsMnWcJAYNrrpY+ZUWmbD62lWWdIvD6c+FYmFKS14zU3yDIK9NXe9g1lTM/GdUVkVKQgGg2QAYZ5f2G/xA==", + "license": "Apache-2.0", "dependencies": { + "@injectivelabs/exceptions": "^1.14.33", + "@injectivelabs/networks": "^1.14.33", + "@injectivelabs/ts-types": "^1.14.33", + "@injectivelabs/utils": "^1.14.33", "axios": "^1.6.4", "bignumber.js": "^9.0.1", - "link-module-alias": "^1.2.0", "shx": "^0.3.2", "snakecase-keys": "^5.1.2", "store2": "^2.12.0" } }, "node_modules/@injectivelabs/ts-types": { - "version": "1.14.13", - "resolved": "https://registry.npmjs.org/@injectivelabs/ts-types/-/ts-types-1.14.13.tgz", - "integrity": "sha512-jkR4+JnQ91n7LWAdt+cZuvXFfqhv9RVlTE2pezAjZab7z7VeDonYwktjia5OcbqTKjlirvVHFALIZ0pmYd0j+A==", - "hasInstallScript": true, + "version": "1.14.33", + "resolved": "https://registry.npmjs.org/@injectivelabs/ts-types/-/ts-types-1.14.33.tgz", + "integrity": "sha512-sJZzMNJtZFFZoPKZ91G09bxrZqQ5aS9omoTjQWy+7OxfiRAakzhsarTueX47hm6oTaN0XeBgD3wkMukkWUaobw==", + "license": "Apache-2.0", "dependencies": { - "link-module-alias": "^1.2.0", "shx": "^0.3.2" } }, "node_modules/@injectivelabs/utils": { - "version": "1.14.13", - "resolved": "https://registry.npmjs.org/@injectivelabs/utils/-/utils-1.14.13.tgz", - "integrity": "sha512-djmSq28R7HDSb2Mezan+EFjqQgmDRydY+fLOmkODwOCYA04xOGQo7yna+WVovV85aKpwPjn864AWPy65xiHUZg==", - "hasInstallScript": true, + "version": "1.14.33", + "resolved": "https://registry.npmjs.org/@injectivelabs/utils/-/utils-1.14.33.tgz", + "integrity": "sha512-zsezML4dTujF0xGLhcGmWBCghfJiy9MW+r6VqR8zJUlxnmnEdNpmsvBhBI6cmmov6Se4FL+yALAIFRvTm3txbg==", + "license": "Apache-2.0", "dependencies": { - "@injectivelabs/exceptions": "^1.14.13", - "@injectivelabs/ts-types": "^1.14.13", + "@injectivelabs/exceptions": "^1.14.33", + "@injectivelabs/ts-types": "^1.14.33", "axios": "^1.6.4", "bignumber.js": "^9.0.1", "http-status-codes": "^2.2.0", - "link-module-alias": "^1.2.0", "shx": "^0.3.2", "snakecase-keys": "^5.1.2", "store2": "^2.12.0" @@ -4468,6 +4490,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/@wry/caches/-/caches-1.0.1.tgz", "integrity": "sha512-bXuaUNLVVkD20wcGBWRyo7j9N3TxePEWFZj2Y+r9OoUzfqmavM84+mFykRicNsBqatba5JLay1t48wxaXaWnlA==", + "license": "MIT", "dependencies": { "tslib": "^2.3.0" }, @@ -4476,14 +4499,16 @@ } }, "node_modules/@wry/caches/node_modules/tslib": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", - "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" }, "node_modules/@wry/context": { "version": "0.7.4", "resolved": "https://registry.npmjs.org/@wry/context/-/context-0.7.4.tgz", "integrity": "sha512-jmT7Sb4ZQWI5iyu3lobQxICu2nC/vbUhP0vIdd6tHC9PTfenmRmuIFqktc6GH9cgi+ZHnsLWPvfSvc4DrYmKiQ==", + "license": "MIT", "dependencies": { "tslib": "^2.3.0" }, @@ -4492,14 +4517,16 @@ } }, "node_modules/@wry/context/node_modules/tslib": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", - "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" }, "node_modules/@wry/equality": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/@wry/equality/-/equality-0.5.7.tgz", "integrity": "sha512-BRFORjsTuQv5gxcXsuDXx6oGRhuVsEGwZy6LOzRRfgu+eSfxbhUQ9L9YtSEIuIjY/o7g3iWFjrc5eSY1GXP2Dw==", + "license": "MIT", "dependencies": { "tslib": "^2.3.0" }, @@ -4508,14 +4535,16 @@ } }, "node_modules/@wry/equality/node_modules/tslib": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", - "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" }, "node_modules/@wry/trie": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/@wry/trie/-/trie-0.5.0.tgz", "integrity": "sha512-FNoYzHawTMk/6KMQoEG5O4PuioX19UbwdQKF44yw0nLfOypfQdjtfZzo/UIJWAJ23sNIFbD1Ug9lbaDGMwbqQA==", + "license": "MIT", "dependencies": { "tslib": "^2.3.0" }, @@ -4524,9 +4553,10 @@ } }, "node_modules/@wry/trie/node_modules/tslib": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", - "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" }, "node_modules/abortcontroller-polyfill": { "version": "1.7.5", @@ -4791,6 +4821,7 @@ "version": "9.1.2", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==", + "license": "MIT", "engines": { "node": "*" } @@ -5418,9 +5449,9 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, "license": "MIT", "dependencies": { @@ -5865,15 +5896,17 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", + "license": "MIT", "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3" } }, "node_modules/dot-case/node_modules/tslib": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", - "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" }, "node_modules/dotenv": { "version": "16.4.5", @@ -6690,9 +6723,10 @@ "license": "ISC" }, "node_modules/graphql": { - "version": "16.9.0", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.9.0.tgz", - "integrity": "sha512-GGTKBX4SD7Wdb8mqeDLni2oaRGYQWjWHGKPQ24ZMnUtKfcsVoiv4uX8+LJr1K6U5VW2Lu1BwJnj7uiori0YtRw==", + "version": "16.10.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.10.0.tgz", + "integrity": "sha512-AjqGKbDGUFRKIRCP9tCKiIGHyriz2oHEbPIbEtcSLSs4YjReZOIPQQWek4+6hjw62H9QShXHyaGivGiYVLeYFQ==", + "license": "MIT", "engines": { "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" } @@ -6701,6 +6735,7 @@ "version": "2.12.6", "resolved": "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.12.6.tgz", "integrity": "sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg==", + "license": "MIT", "dependencies": { "tslib": "^2.1.0" }, @@ -6712,9 +6747,10 @@ } }, "node_modules/graphql-tag/node_modules/tslib": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", - "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" }, "node_modules/has-flag": { "version": "4.0.0", @@ -6888,7 +6924,8 @@ "node_modules/http-status-codes": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/http-status-codes/-/http-status-codes-2.3.0.tgz", - "integrity": "sha512-RJ8XvFvpPM/Dmc5SV+dC4y5PCeOhT3x1Hq0NU3rjGeg5a/CqlhZ7uudknPwZFz4aeAXDcbAyaeP7GAo9lvngtA==" + "integrity": "sha512-RJ8XvFvpPM/Dmc5SV+dC4y5PCeOhT3x1Hq0NU3rjGeg5a/CqlhZ7uudknPwZFz4aeAXDcbAyaeP7GAo9lvngtA==", + "license": "MIT" }, "node_modules/https-browserify": { "version": "1.0.0", @@ -7923,14 +7960,16 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", + "license": "MIT", "dependencies": { "tslib": "^2.0.3" } }, "node_modules/lower-case/node_modules/tslib": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", - "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" }, "node_modules/lz-string": { "version": "1.5.0", @@ -7945,6 +7984,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", + "license": "MIT", "engines": { "node": ">=8" }, @@ -8716,15 +8756,17 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", + "license": "MIT", "dependencies": { "lower-case": "^2.0.2", "tslib": "^2.0.3" } }, "node_modules/no-case/node_modules/tslib": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", - "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" }, "node_modules/node-addon-api": { "version": "7.1.0", @@ -8873,31 +8915,22 @@ } }, "node_modules/optimism": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/optimism/-/optimism-0.18.0.tgz", - "integrity": "sha512-tGn8+REwLRNFnb9WmcY5IfpOqeX2kpaYJ1s6Ae3mn12AeydLkR3j+jSCmVQFoXqU8D41PAJ1RG1rCRNWmNZVmQ==", + "version": "0.18.1", + "resolved": "https://registry.npmjs.org/optimism/-/optimism-0.18.1.tgz", + "integrity": "sha512-mLXNwWPa9dgFyDqkNi54sjDyNJ9/fTI6WGBLgnXku1vdKY/jovHfZT5r+aiVeFFLOz+foPNOm5YJ4mqgld2GBQ==", + "license": "MIT", "dependencies": { "@wry/caches": "^1.0.0", "@wry/context": "^0.7.0", - "@wry/trie": "^0.4.3", - "tslib": "^2.3.0" - } - }, - "node_modules/optimism/node_modules/@wry/trie": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@wry/trie/-/trie-0.4.3.tgz", - "integrity": "sha512-I6bHwH0fSf6RqQcnnXLJKhkSXG45MFral3GxPaY4uAl0LYDZM+YDVDAiU9bYwjTuysy1S0IeecWtmq1SZA3M1w==", - "dependencies": { + "@wry/trie": "^0.5.0", "tslib": "^2.3.0" - }, - "engines": { - "node": ">=8" } }, "node_modules/optimism/node_modules/tslib": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", - "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" }, "node_modules/optionator": { "version": "0.9.4", @@ -9905,6 +9938,7 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/rehackt/-/rehackt-0.1.0.tgz", "integrity": "sha512-7kRDOuLHB87D/JESKxQoRwv4DzbIdwkAGQ7p6QKGdVlY1IZheUnVhlk/4UZlNUVxdAXpyxikE3URsG067ybVzw==", + "license": "MIT", "peerDependencies": { "@types/react": "*", "react": "*" @@ -9948,6 +9982,7 @@ "version": "0.2.6", "resolved": "https://registry.npmjs.org/response-iterator/-/response-iterator-0.2.6.tgz", "integrity": "sha512-pVzEEzrsg23Sh053rmDUvLSkGXluZio0qu8VT6ukrYuvtjVfCbDZH9d6PGXb8HZfzdNZt8feXv/jvUzlhRgLnw==", + "license": "MIT", "engines": { "node": ">=0.8" } @@ -10020,14 +10055,16 @@ "version": "7.8.1", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "license": "Apache-2.0", "dependencies": { "tslib": "^2.1.0" } }, "node_modules/rxjs/node_modules/tslib": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", - "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" }, "node_modules/safe-buffer": { "version": "5.2.1", @@ -10232,20 +10269,23 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", "integrity": "sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==", + "license": "MIT", "dependencies": { "dot-case": "^3.0.4", "tslib": "^2.0.3" } }, "node_modules/snake-case/node_modules/tslib": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", - "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" }, "node_modules/snakecase-keys": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/snakecase-keys/-/snakecase-keys-5.5.0.tgz", "integrity": "sha512-r3kRtnoPu3FxGJ3fny6PKNnU3pteb29o6qAa0ugzhSseKNWRkw1dw8nIjXMyyKaU9vQxxVIE62Mb3bKbdrgpiw==", + "license": "MIT", "dependencies": { "map-obj": "^4.1.0", "snake-case": "^3.0.4", @@ -10259,6 +10299,7 @@ "version": "3.13.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.13.1.tgz", "integrity": "sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==", + "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=14.16" }, @@ -10358,7 +10399,8 @@ "node_modules/store2": { "version": "2.14.3", "resolved": "https://registry.npmjs.org/store2/-/store2-2.14.3.tgz", - "integrity": "sha512-4QcZ+yx7nzEFiV4BMLnr/pRa5HYzNITX2ri0Zh6sT9EyQHbBHacC6YigllUPU9X3D0f/22QCgfokpKs52YRrUg==" + "integrity": "sha512-4QcZ+yx7nzEFiV4BMLnr/pRa5HYzNITX2ri0Zh6sT9EyQHbBHacC6YigllUPU9X3D0f/22QCgfokpKs52YRrUg==", + "license": "MIT" }, "node_modules/stream": { "version": "0.0.2", @@ -10629,6 +10671,7 @@ "version": "0.10.3", "resolved": "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.10.3.tgz", "integrity": "sha512-uivwYcQaxAucv1CzRp2n/QdYPo4ILf9VXgH19zEIjFx2EJufV16P0JtJVpYHy89DItG6Kwj2oIUjrcK5au+4tQ==", + "license": "MIT", "dependencies": { "tslib": "^2.1.0" }, @@ -10637,9 +10680,10 @@ } }, "node_modules/ts-invariant/node_modules/tslib": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", - "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==" + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" }, "node_modules/tslib": { "version": "1.14.1", @@ -10998,12 +11042,14 @@ "node_modules/zen-observable": { "version": "0.8.15", "resolved": "https://registry.npmjs.org/zen-observable/-/zen-observable-0.8.15.tgz", - "integrity": "sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ==" + "integrity": "sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ==", + "license": "MIT" }, "node_modules/zen-observable-ts": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/zen-observable-ts/-/zen-observable-ts-1.2.5.tgz", "integrity": "sha512-QZWQekv6iB72Naeake9hS1KxHlotfRpe+WGNbNx5/ta+R3DNjVO2bswf63gXlWDcs+EMd7XY8HfVQyP1X6T4Zg==", + "license": "MIT", "dependencies": { "zen-observable": "0.8.15" } diff --git a/package.json b/package.json index badcc2f0..5b6225f2 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "@bugsnag/plugin-react": "^7.16.1", "@cosmjs/proto-signing": "^0.32.4", "@cosmjs/stargate": "^0.32.4", - "@injectivelabs/sdk-ts": "^1.14.13", + "@injectivelabs/sdk-ts": "^1.14.33", "@keplr-wallet/wc-client": "^0.11.3", "@terra-money/terra.js": "^3.1.8", "@testing-library/jest-dom": "^5.16.2", diff --git a/src/adapters/DefaultSigningAdapter.mjs b/src/adapters/DefaultSigningAdapter.mjs index 0b003e58..5017a476 100644 --- a/src/adapters/DefaultSigningAdapter.mjs +++ b/src/adapters/DefaultSigningAdapter.mjs @@ -19,7 +19,7 @@ export default class DefaultSigningAdapter { const { account_number: accountNumber, sequence, address } = account let aminoMsgs try { - aminoMsgs = this.toAmino(messages) + aminoMsgs = messages.map(message => this.toAmino(message)) } catch (e) { console.log(e) } if(aminoMsgs && this.signerProvider.signAminoSupport()){ // Sign as amino if possible for Ledger and Keplr support @@ -64,53 +64,59 @@ export default class DefaultSigningAdapter { } } - toAmino(messages){ - return messages.map(message => { - // move this logic to message classes, reacting to network param - if(message.typeUrl.startsWith('/cosmos.authz')){ - if(!this.network.authzAminoSupport){ - throw new Error('This chain does not support amino conversion for Authz messages') - } - if(this.network.authzAminoGenericOnly && this.signerProvider.signDirectSupport()){ - throw new Error('This chain does not fully support amino conversion for Authz messages, using signDirect instead') - } + toProto(message){ + return message.toProto() + } + + toAmino(message){ + this.checkAminoSupport(message) + let aminoMessage = message.toAmino() + if(this.network.authzAminoLiftedValues){ + aminoMessage = this.liftAuthzAmino(aminoMessage) + } + return aminoMessage + } + + checkAminoSupport(message){ + if(message.typeUrl.startsWith('/cosmos.authz')){ + if(!this.network.authzAminoSupport){ + throw new Error('This chain does not support amino conversion for Authz messages') } - if(message.typeUrl === '/cosmos.authz.v1beta1.MsgExec'){ - const execTypes = message.value.msgs.map(msg => msg.typeUrl) - const preventedTypes = execTypes.filter(type => this.network.authzAminoExecPreventTypes.some(prevent => type.match(_.escapeRegExp(prevent)))) - if(preventedTypes.length > 0){ - throw new Error(`This chain does not support amino conversion for Authz Exec with message types: ${preventedTypes.join(', ')}`) - } - }else if(this.network.aminoPreventTypes.some(prevent => message.typeUrl.match(_.escapeRegExp(prevent)))){ - throw new Error(`This chain does not support amino conversion for message type: ${message.typeUrl}`) + if(this.network.authzAminoGenericOnly && this.signerProvider.signDirectSupport()){ + throw new Error('This chain does not fully support amino conversion for Authz messages, using signDirect instead') } - let aminoMessage = message.toAmino() - if(this.network.authzAminoLiftedValues){ - switch (aminoMessage.type) { - case 'cosmos-sdk/MsgGrant': - aminoMessage = aminoMessage.value - aminoMessage.grant.authorization = aminoMessage.grant.authorization.value - break; - case 'cosmos-sdk/MsgRevoke': - aminoMessage = aminoMessage.value - break; - case 'cosmos-sdk/MsgExec': - throw new Error('This chain does not support amino conversion for MsgExec') - } + } + if(message.typeUrl === '/cosmos.authz.v1beta1.MsgExec'){ + const execTypes = message.params.msgs.map(msg => msg.typeUrl) + const preventedTypes = execTypes.filter(type => this.network.authzAminoExecPreventTypes.some(prevent => type.match(_.escapeRegExp(prevent)))) + if(preventedTypes.length > 0){ + throw new Error(`This chain does not support amino conversion for Authz Exec with message types: ${preventedTypes.join(', ')}`) } - return aminoMessage - }) + }else if(this.network.aminoPreventTypes.some(prevent => message.typeUrl.match(_.escapeRegExp(prevent)))){ + throw new Error(`This chain does not support amino conversion for message type: ${message.typeUrl}`) + } } - toProtoEncoded(messages){ - return messages.map((m) => m.toProtoEncoded()) + liftAuthzAmino(aminoMessage){ + switch (aminoMessage.type) { + case 'cosmos-sdk/MsgGrant': + aminoMessage = aminoMessage.value + aminoMessage.grant.authorization = aminoMessage.grant.authorization.value + break; + case 'cosmos-sdk/MsgRevoke': + aminoMessage = aminoMessage.value + break; + case 'cosmos-sdk/MsgExec': + throw new Error('This chain does not support amino conversion for MsgExec') + } + return aminoMessage; } makeBodyBytes(messages, memo, timeoutHeight){ - const protoEncodedMsgs = this.toProtoEncoded(messages); + const protoMsgs = messages.map(message => this.toProto(message)); const txBody = { - messages: protoEncodedMsgs, + messages: protoMsgs, memo: memo, } @@ -150,10 +156,6 @@ export default class DefaultSigningAdapter { pubkeyTypeUrl(pub_key){ if(pub_key && pub_key['@type']) return pub_key['@type'] - if(this.network.path === 'injective'){ - return '/injective.crypto.v1beta1.ethsecp256k1.PubKey' - } - if(this.network.slip44 === 60){ return '/ethermint.crypto.v1.ethsecp256k1.PubKey' } diff --git a/src/adapters/InjectiveSigningAdapter.mjs b/src/adapters/InjectiveSigningAdapter.mjs index ecb375b2..1833ed22 100644 --- a/src/adapters/InjectiveSigningAdapter.mjs +++ b/src/adapters/InjectiveSigningAdapter.mjs @@ -1,21 +1,13 @@ import _ from 'lodash' import { - getEip712TypedData, - mapValuesToProperValueType, - objectKeysToEip712Types, createWeb3Extension, createTxRawEIP712, - getGenericAuthorizationFromMessageType, - MsgGrant, - MsgAuthzExec, - MsgDelegate, - MsgVote + getEip712TypedData } from '@injectivelabs/sdk-ts' import { BigNumberInBase, DEFAULT_BLOCK_TIMEOUT_HEIGHT } from '@injectivelabs/utils' -import { GenericAuthorization } from "cosmjs-types/cosmos/authz/v1beta1/authz"; import { SignMode } from "cosmjs-types/cosmos/tx/signing/v1beta1/signing.js"; import DefaultSigningAdapter from "./DefaultSigningAdapter.mjs"; @@ -40,8 +32,10 @@ export default class InjectiveSigningAdapter extends DefaultSigningAdapter { DEFAULT_BLOCK_TIMEOUT_HEIGHT, ) + const injMessages = messages.map((m) => m.toInjective()) + const eip712TypedData = getEip712TypedData({ - msgs: messages, + msgs: injMessages, fee, tx: { memo: memo, @@ -63,7 +57,7 @@ export default class InjectiveSigningAdapter extends DefaultSigningAdapter { account_number: accountNumber.toString(), sequence: sequence.toString(), fee, - msgs: messages.map((m) => m.toEip712()), + msgs: injMessages.map((m) => m.toEip712()), memo: memo || '', } ) @@ -89,4 +83,10 @@ export default class InjectiveSigningAdapter extends DefaultSigningAdapter { return txRawEip712 } + + pubkeyTypeUrl(pub_key){ + if(pub_key && pub_key['@type']) return pub_key['@type'] + + return '/injective.crypto.v1beta1.ethsecp256k1.PubKey' + } } diff --git a/src/adapters/TerraSigningAdapter.mjs b/src/adapters/TerraSigningAdapter.mjs index feab6178..cabbb613 100644 --- a/src/adapters/TerraSigningAdapter.mjs +++ b/src/adapters/TerraSigningAdapter.mjs @@ -2,10 +2,25 @@ import { Msg } from '@terra-money/terra.js'; import DefaultSigningAdapter from "./DefaultSigningAdapter.mjs"; export default class TerraSigningAdapter extends DefaultSigningAdapter { - toAmino(messages){ - return super.toAmino(messages).map(message => { - // Terra uses custom Amino message types, use Terra.js to convert them - return Msg.fromAmino(message).toAmino(true) - }) + toAmino(message){ + this.checkAminoSupport(message) + // Terra uses custom Amino message types, use Terra.js to convert them + let aminoMessage = Msg.fromAmino(message.toAmino()).toAmino(true) + if(this.network.authzAminoLiftedValues){ + aminoMessage = this.liftAuthzAmino(aminoMessage) + } + return aminoMessage + } + + liftAuthzAmino(aminoMessage){ + switch (aminoMessage.type) { + case 'msgauth/MsgGrantAuthorization': + throw new Error('This chain does not support amino conversion for MsgGrant') + case 'cosmos-sdk/MsgRevoke': + throw new Error('This chain does not support amino conversion for MsgRevoke') + case 'cosmos-sdk/MsgExec': + throw new Error('This chain does not support amino conversion for MsgExec') + } + return aminoMessage; } } diff --git a/src/components/ClaimRewards.js b/src/components/ClaimRewards.js index 3fc9a256..0b2ffcce 100644 --- a/src/components/ClaimRewards.js +++ b/src/components/ClaimRewards.js @@ -1,6 +1,4 @@ -import { MsgWithdrawDelegatorReward, MsgWithdrawValidatorCommission } from "cosmjs-types/cosmos/distribution/v1beta1/tx"; -import { MsgDelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx"; -import { buildExecableMessage, buildExecMessage, coin, rewardAmount } from "../utils/Helpers.mjs"; +import { coin, execableMessage, rewardAmount } from "../utils/Helpers.mjs"; import { Dropdown, @@ -8,6 +6,9 @@ import { } from 'react-bootstrap' import { add, subtract, multiply, divide, bignumber } from 'mathjs' +import { MsgDelegate } from "../messages/MsgDelegate.mjs"; +import { MsgWithdrawDelegatorReward } from "../messages/MsgWithdrawDelegatorReward.mjs"; +import { MsgWithdrawValidatorCommission } from "../messages/MsgWithdrawValidatorCommission.mjs"; function ClaimRewards(props) { const { network, address, wallet, rewards } = props @@ -88,29 +89,25 @@ function ClaimRewards(props) { let valMessages = [] if(props.restake){ - valMessages.push(buildExecableMessage(MsgDelegate, "/cosmos.staking.v1beta1.MsgDelegate", { + valMessages.push(new MsgDelegate({ delegatorAddress: address, validatorAddress: validatorReward.validatorAddress, amount: coin(validatorReward.reward, network.denom) - }, wallet?.address !== address)) + })) }else{ - valMessages.push(buildExecableMessage(MsgWithdrawDelegatorReward, "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", { + valMessages.push(new MsgWithdrawDelegatorReward({ delegatorAddress: address, validatorAddress: validatorReward.validatorAddress - }, wallet?.address !== address)) + })) } if (props.commission) { - valMessages.push(buildExecableMessage(MsgWithdrawValidatorCommission, "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", { + valMessages.push(new MsgWithdrawValidatorCommission({ validatorAddress: validatorReward.validatorAddress - }, wallet?.address !== address)) + })) } - if (wallet?.address !== address) { - return [buildExecMessage(wallet.address, valMessages)] - }else{ - return valMessages - } + return execableMessage(valMessages, wallet.address, address) }).flat() } diff --git a/src/components/DelegateForm.js b/src/components/DelegateForm.js index 5c2e2603..c309165e 100644 --- a/src/components/DelegateForm.js +++ b/src/components/DelegateForm.js @@ -1,5 +1,4 @@ import React, { useState, useReducer } from 'react'; -import { MsgDelegate, MsgUndelegate, MsgBeginRedelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx"; import { Button, @@ -10,8 +9,10 @@ import { pow, multiply, divide, subtract, bignumber } from 'mathjs' import AlertMessage from './AlertMessage' import Coins from './Coins' -import { buildExecMessage, coin } from '../utils/Helpers.mjs' -import Delegate from '../messages/delegate.mjs'; +import { coin, execableMessage } from '../utils/Helpers.mjs' +import { MsgBeginRedelegate } from '../messages/MsgBeginRedelegate.mjs'; +import { MsgUndelegate } from '../messages/MsgUndelegate.mjs'; +import { MsgDelegate } from '../messages/MsgDelegate.mjs'; function DelegateForm(props) { const { network, wallet, address, validator, selectedValidator, action } = props @@ -62,39 +63,23 @@ function DelegateForm(props) { } function buildMessages(amount) { - let message, type, typeUrl, value + let message if (action === 'redelegate') { - type = MsgBeginRedelegate - typeUrl = "/cosmos.staking.v1beta1.MsgBeginRedelegate" - value = { + message = new MsgBeginRedelegate({ delegatorAddress: address, validatorSrcAddress: validator.operator_address, validatorDstAddress: selectedValidator.operator_address, amount: coin(amount, network.denom) - } + }) } else { - type = action === 'undelegate' ? MsgUndelegate : MsgDelegate - typeUrl = "/cosmos.staking.v1beta1.Msg" + (action === 'undelegate' ? 'Undelegate' : 'Delegate') - value = { + const type = action === 'undelegate' ? MsgUndelegate : MsgDelegate + message = new type({ delegatorAddress: address, validatorAddress: validator.operator_address, amount: coin(amount, network.denom) - } - } - if (wallet?.address !== address) { - message = buildExecMessage(wallet.address, [{ - typeUrl: typeUrl, - value: type.encode(type.fromPartial(value)).finish() - }]) - } else { - message = { - typeUrl: typeUrl, - value: value - } + }) } - // pass network to messages and allow customisation inside message classes per network - const newMessage = new Delegate(value) - return [newMessage] + return execableMessage(message, wallet.address, address) } function hasPermission() { diff --git a/src/components/GrantModal.js b/src/components/GrantModal.js index df7edfdb..148201f1 100644 --- a/src/components/GrantModal.js +++ b/src/components/GrantModal.js @@ -2,10 +2,6 @@ import React, { useState, useEffect } from 'react'; import _ from 'lodash' import moment from 'moment' -import { MsgGrant } from "cosmjs-types/cosmos/authz/v1beta1/tx"; -import { GenericAuthorization } from "cosmjs-types/cosmos/authz/v1beta1/authz"; -import { Timestamp } from "cosmjs-types/google/protobuf/timestamp"; - import { Modal, Button, @@ -15,7 +11,9 @@ import { import AlertMessage from './AlertMessage'; import { messageTypes } from '../utils/Wallet.mjs'; -import { buildExecMessage, truncateAddress } from '../utils/Helpers.mjs'; +import { execableMessage } from '../utils/Helpers.mjs'; +import { MsgGrant } from '../messages/MsgGrant.mjs'; +import { GenericAuthorization } from '../messages/authorizations/GenericAuthorization.mjs'; function GrantModal(props) { const { show, network, address, wallet } = props @@ -60,19 +58,28 @@ function GrantModal(props) { if(!address || !walletAuthzSupport || !valid()) return showLoading(true) + setError(null) const expiry = moment(state.expiryDateValue) + let authorization - const messages = [ - buildGrantMsg(state.grantTypeValue, - GenericAuthorization.encode(GenericAuthorization.fromPartial({ + switch(state.grantTypeValue){ + case '/cosmos.authz.v1beta1.GenericAuthorization': + authorization = new GenericAuthorization({ msg: messageType() - })).finish(), - expiry - ) - ] - console.log(messages) + }) + break + } - wallet.signAndBroadcast(messages).then((result) => { + const message = new MsgGrant({ + granter: address, + grantee: grantee(), + grant: { + authorization: authorization, + expiration: expiry.unix() + } + }) + + wallet.signAndBroadcast(execableMessage(message, wallet.address, address)).then((result) => { console.log("Successfully broadcasted:", result); showLoading(false) props.onGrant(grantee(), { @@ -96,34 +103,6 @@ function GrantModal(props) { props.onHide(); } - function buildGrantMsg(type, authValue, expiryDate) { - const value = { - granter: address, - grantee: grantee(), - grant: { - authorization: { - typeUrl: type, - value: authValue - }, - expiration: Timestamp.fromPartial({ - seconds: expiryDate.unix(), - nanos: 0 - }) - } - } - if(wallet?.address !== address){ - return buildExecMessage(wallet.address, [{ - typeUrl: "/cosmos.authz.v1beta1.MsgGrant", - value: MsgGrant.encode(MsgGrant.fromPartial(value)).finish() - }]) - }else{ - return { - typeUrl: "/cosmos.authz.v1beta1.MsgGrant", - value: value - } - } - } - function grantee(){ return state.granteeValue === 'custom' ? state.customGranteeValue : state.granteeValue } diff --git a/src/components/REStakeGrantForm.js b/src/components/REStakeGrantForm.js index f0d6e9cd..a11f90d4 100644 --- a/src/components/REStakeGrantForm.js +++ b/src/components/REStakeGrantForm.js @@ -2,21 +2,19 @@ import React, { useState, useEffect, useReducer } from 'react'; import moment from 'moment' import { pow, multiply, divide, larger, bignumber } from 'mathjs' -import { MsgGrant } from "cosmjs-types/cosmos/authz/v1beta1/tx"; -import { StakeAuthorization } from "cosmjs-types/cosmos/staking/v1beta1/authz"; -import { GenericAuthorization } from "cosmjs-types/cosmos/authz/v1beta1/authz"; -import { Timestamp } from "cosmjs-types/google/protobuf/timestamp"; - import { Button, Form, } from 'react-bootstrap' import Coins from './Coins'; -import { buildExecMessage, coin, rewardAmount } from '../utils/Helpers.mjs'; +import { coin, execableMessage, rewardAmount } from '../utils/Helpers.mjs'; import RevokeGrant from './RevokeGrant'; import AlertMessage from './AlertMessage'; import OperatorLastRestakeAlert from './OperatorLastRestakeAlert'; +import { GenericAuthorization } from '../messages/authorizations/GenericAuthorization.mjs'; +import { StakeAuthorization } from '../messages/authorizations/StakeAuthorization.mjs'; +import { MsgGrant } from '../messages/MsgGrant.mjs'; function REStakeGrantForm(props) { const { grants, wallet, operator, address, network, lastExec } = props @@ -82,31 +80,29 @@ function REStakeGrantForm(props) { maxTokens = coin(maxTokensDenom(), network.denom) } - let messages + let authorization if(genericGrantOnly){ - messages = [ - buildGrantMsg("/cosmos.authz.v1beta1.GenericAuthorization", - GenericAuthorization.encode(GenericAuthorization.fromPartial({ - msg: '/cosmos.staking.v1beta1.MsgDelegate' - })).finish(), - expiry - ) - ] + authorization = new GenericAuthorization({ + msg: '/cosmos.staking.v1beta1.MsgDelegate' + }) }else{ - messages = [ - buildGrantMsg("/cosmos.staking.v1beta1.StakeAuthorization", - StakeAuthorization.encode(StakeAuthorization.fromPartial({ - allowList: { address: [operator.address] }, - maxTokens: maxTokens, - authorizationType: 1 - })).finish(), - expiry - ) - ] + authorization = new StakeAuthorization({ + allowList: { address: [operator.address] }, + maxTokens: maxTokens, + authorizationType: 1 + }) } - console.log(messages) - wallet.signAndBroadcast(messages).then((result) => { + const message = new MsgGrant({ + granter: address, + grantee: operator.botAddress, + grant: { + authorization: authorization, + expiration: expiry.unix() + } + }) + + wallet.signAndBroadcast(execableMessage(message, wallet.address, address)).then((result) => { console.log("Successfully broadcasted:", result); showLoading(false) props.onGrant(operator.botAddress, { @@ -129,34 +125,6 @@ function REStakeGrantForm(props) { }) } - function buildGrantMsg(type, authValue, expiryDate) { - const value = { - granter: address, - grantee: operator.botAddress, - grant: { - authorization: { - typeUrl: type, - value: authValue - }, - expiration: Timestamp.fromPartial({ - seconds: expiryDate.unix(), - nanos: 0 - }) - } - } - if (wallet?.address !== address) { - return buildExecMessage(wallet.address, [{ - typeUrl: "/cosmos.authz.v1beta1.MsgGrant", - value: MsgGrant.encode(MsgGrant.fromPartial(value)).finish() - }]) - } else { - return { - typeUrl: "/cosmos.authz.v1beta1.MsgGrant", - value: value - } - } - } - function grantInformation() { return ( <> diff --git a/src/components/RevokeGrant.js b/src/components/RevokeGrant.js index f57b4fb6..15ef8f37 100644 --- a/src/components/RevokeGrant.js +++ b/src/components/RevokeGrant.js @@ -3,8 +3,8 @@ import { Dropdown, Button } from 'react-bootstrap' -import { MsgRevoke } from "cosmjs-types/cosmos/authz/v1beta1/tx"; -import { buildExecableMessage, buildExecMessage } from '../utils/Helpers.mjs' +import { execableMessage } from '../utils/Helpers.mjs' +import { MsgRevoke } from '../messages/MsgRevoke.mjs' function RevokeGrant(props) { const { address, wallet, grantAddress, grants } = props @@ -24,11 +24,7 @@ function RevokeGrant(props) { } }) let messages = msgTypes.map(type => buildRevokeMsg(type)) - if(wallet?.address !== address){ - messages = [buildExecMessage(wallet.address, messages)] - } - - console.log(messages) + messages = execableMessage(messages, wallet.address, address) try { const gas = await wallet.simulate(messages) @@ -44,11 +40,11 @@ function RevokeGrant(props) { } function buildRevokeMsg(type){ - return buildExecableMessage(MsgRevoke, "/cosmos.authz.v1beta1.MsgRevoke", { + return new MsgRevoke({ granter: address, grantee: grantAddress, msgTypeUrl: type - }, wallet?.address !== address) + }) } function disabled(){ diff --git a/src/components/SendModal.js b/src/components/SendModal.js index 045e54b4..f7d36725 100644 --- a/src/components/SendModal.js +++ b/src/components/SendModal.js @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'; import _ from 'lodash' import { pow, multiply, divide, subtract, bignumber } from 'mathjs' -import { MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx"; +import { MsgSend } from "../messages/MsgSend.mjs"; import { Modal, @@ -11,7 +11,7 @@ import { } from 'react-bootstrap' import AlertMessage from './AlertMessage'; -import { buildExecableMessage, buildExecMessage, coin, truncateAddress } from '../utils/Helpers.mjs'; +import { coin, execableMessage, truncateAddress } from '../utils/Helpers.mjs'; import Coins from './Coins'; function SendModal(props) { @@ -55,7 +55,6 @@ function SendModal(props) { const messages = [ buildSendMsg(address, recipient(), [coinValue]) ] - console.log(messages) wallet.signAndBroadcast(messages, null, state.memoValue).then((result) => { console.log("Successfully broadcasted:", result); @@ -80,15 +79,12 @@ function SendModal(props) { } function buildSendMsg(address, recipient, amount) { - let message = buildExecableMessage(MsgSend, "/cosmos.bank.v1beta1.MsgSend", { + let message = new MsgSend({ fromAddress: address, toAddress: recipient, amount: amount - }, wallet?.address !== address) - if(wallet?.address !== address){ - return buildExecMessage(wallet.address, [message]) - } - return message + }) + return execableMessage(message, wallet.address, address) } async function setAvailableAmount(){ diff --git a/src/components/VoteForm.js b/src/components/VoteForm.js index 40b5a3fa..023cdc0c 100644 --- a/src/components/VoteForm.js +++ b/src/components/VoteForm.js @@ -5,11 +5,10 @@ import { Form, Button } from 'react-bootstrap' -import { MsgVote } from "cosmjs-types/cosmos/gov/v1beta1/tx.js"; import Vote from '../utils/Vote.mjs'; -import { buildExecMessage } from '../utils/Helpers.mjs'; -import NewVote from '../messages/vote.mjs'; +import { MsgVote } from '../messages/MsgVote.mjs'; +import { execableMessage } from '../utils/Helpers.mjs'; function VoteForm(props) { const { proposal, vote, address, wallet, granter, setError } = props @@ -62,28 +61,13 @@ function VoteForm(props) { ] }) - let message - const value = { + const message = new MsgVote({ proposalId: proposal.proposal_id, voter: newVote.voter, option: newVote.optionValue - } - if(granter){ - message = buildExecMessage(wallet.address, [{ - typeUrl: "/cosmos.gov.v1beta1.MsgVote", - value: MsgVote.encode(MsgVote.fromPartial(value)).finish() - }]) - }else{ - message = { - typeUrl: "/cosmos.gov.v1beta1.MsgVote", - value: value - } - } - console.log(value) - const newMessage = new NewVote(value) - console.log(newMessage) + }) - wallet.signAndBroadcast([newMessage]).then((result) => { + wallet.signAndBroadcast(execableMessage(message, wallet.address, granter)).then((result) => { console.log("Successfully broadcasted:", result); setLoading(false) setError(null) diff --git a/src/messages/MsgBase.mjs b/src/messages/MsgBase.mjs new file mode 100644 index 00000000..122401cb --- /dev/null +++ b/src/messages/MsgBase.mjs @@ -0,0 +1,45 @@ +import { + defaultRegistryTypes, + createDefaultAminoConverters +} from "@cosmjs/stargate"; + +export class MsgBase { + typeUrl = null; + binaryConverter = null; + aminoConverter = null; + + static binaryConverters = new Map(defaultRegistryTypes); + static aminoConverters = new Map(Object.entries(createDefaultAminoConverters())); + + constructor (params) { + this.params = params + } + + protoType() { + return this.binaryConverter || MsgBase.binaryConverters.get(this.typeUrl) + } + + aminoType() { + return this.aminoConverter || MsgBase.aminoConverters.get(this.typeUrl) + } + + toProto() { + return { + typeUrl: this.typeUrl, + value: this.toBinary() + } + } + + toBinary() { + const protoType = this.protoType() + return protoType.encode(this.params).finish() + } + + toAmino () { + const aminoType = this.aminoType() + return { + type: aminoType.aminoType, + value: aminoType.toAmino(this.params) + } + } +} diff --git a/src/messages/MsgBeginRedelegate.mjs b/src/messages/MsgBeginRedelegate.mjs new file mode 100644 index 00000000..972975c6 --- /dev/null +++ b/src/messages/MsgBeginRedelegate.mjs @@ -0,0 +1,18 @@ +import { + MsgBeginRedelegate as InjectiveMsgBeginRedelegate +} from '@injectivelabs/sdk-ts' + +import { MsgBase } from "./MsgBase.mjs"; + +export class MsgBeginRedelegate extends MsgBase { + typeUrl = "/cosmos.staking.v1beta1.MsgBeginRedelegate"; + + toInjective(){ + return new InjectiveMsgBeginRedelegate({ + ...this.params, + injectiveAddress: this.params.delegatorAddress, + srcValidatorAddress: this.params.validatorSrcAddress, + dstValidatorAddress: this.params.validatorDstAddress + }) + } +} diff --git a/src/messages/MsgDelegate.mjs b/src/messages/MsgDelegate.mjs new file mode 100644 index 00000000..c59d6035 --- /dev/null +++ b/src/messages/MsgDelegate.mjs @@ -0,0 +1,16 @@ +import { + MsgDelegate as InjectiveMsgDelegate +} from '@injectivelabs/sdk-ts' + +import { MsgBase } from "./MsgBase.mjs"; + +export class MsgDelegate extends MsgBase { + typeUrl = "/cosmos.staking.v1beta1.MsgDelegate"; + + toInjective(){ + return new InjectiveMsgDelegate({ + ...this.params, + injectiveAddress: this.params.delegatorAddress + }) + } +} diff --git a/src/messages/MsgExec.mjs b/src/messages/MsgExec.mjs new file mode 100644 index 00000000..9f246bce --- /dev/null +++ b/src/messages/MsgExec.mjs @@ -0,0 +1,34 @@ +import { + MsgAuthzExec as InjectiveMsgExec +} from '@injectivelabs/sdk-ts' + +import { MsgBase } from "./MsgBase.mjs"; + +export class MsgExec extends MsgBase { + typeUrl = "/cosmos.authz.v1beta1.MsgExec"; + + toBinary() { + const protoType = MsgBase.binaryConverters.get(this.typeUrl) + return protoType.encode({ + ...this.params, + msgs: this.params.msgs.map(msg => msg.toProto()) + }).finish() + } + + toAmino () { + return { + type: "cosmos-sdk/MsgExec", + value: { + grantee: this.params.grantee, + msgs: this.params.msgs.map(msg => msg.toAmino()) + } + } + } + + toInjective(){ + return new InjectiveMsgExec({ + ...this.params, + msgs: this.params.msgs.map(msg => msg.toInjective()) + }) + } +} diff --git a/src/messages/MsgGrant.mjs b/src/messages/MsgGrant.mjs new file mode 100644 index 00000000..a7bda15c --- /dev/null +++ b/src/messages/MsgGrant.mjs @@ -0,0 +1,65 @@ +import moment from "moment"; +import { Timestamp } from "cosmjs-types/google/protobuf/timestamp"; + +import { MsgBase } from "./MsgBase.mjs"; + +import { mapValuesToProperValueType, objectKeysToEip712Types } from "@injectivelabs/sdk-ts"; + +export class MsgGrant extends MsgBase { + typeUrl = "/cosmos.authz.v1beta1.MsgGrant"; + + toBinary () { + const protoType = MsgBase.binaryConverters.get(this.typeUrl) + return protoType.encode({ + ...this.params, + grant: { + authorization: this.params.grant.authorization.toProto(), + expiration: Timestamp.fromPartial({ + seconds: this.params.grant.expiration, + nanos: 0 + }) + } + }).finish() + } + + toAmino () { + return { + type: "cosmos-sdk/MsgGrant", + value: { + granter: this.params.granter, + grantee: this.params.grantee, + grant: { + authorization: this.params.grant.authorization.toAmino(), + expiration: moment(Number(this.params.grant.expiration) * 1000).utc().format() + } + } + } + } + + toInjective () { + // Injective MsgGrant throws an InvalidCharacterError currently. + // For now we will implement the toEip712 methods on this class as the Amino + // parameter order matches so we can avoid an Injective class right now. + return this + } + + + toEip712Types(){ + const amino = this.toAmino() + + return objectKeysToEip712Types({ + object: amino.value, + messageType: amino.type, + }) + } + + toEip712(){ + const amino = this.toAmino() + const { type, value } = amino + + return { + type, + value: mapValuesToProperValueType(value, type) + } + } +} diff --git a/src/messages/MsgRevoke.mjs b/src/messages/MsgRevoke.mjs new file mode 100644 index 00000000..ad840f6e --- /dev/null +++ b/src/messages/MsgRevoke.mjs @@ -0,0 +1,27 @@ +import { + MsgRevoke as InjectiveMsgRevoke +} from '@injectivelabs/sdk-ts' + +import { MsgBase } from "./MsgBase.mjs"; + +export class MsgRevoke extends MsgBase { + typeUrl = "/cosmos.authz.v1beta1.MsgRevoke"; + + toAmino () { + return { + type: "cosmos-sdk/MsgRevoke", + value: { + granter: this.params.granter, + grantee: this.params.grantee, + msg_type_url: this.params.msgTypeUrl + } + } + } + + toInjective(){ + return new InjectiveMsgRevoke({ + ...this.params, + messageType: this.params.msgTypeUrl + }) + } +} diff --git a/src/messages/MsgSend.mjs b/src/messages/MsgSend.mjs new file mode 100644 index 00000000..b796ab4d --- /dev/null +++ b/src/messages/MsgSend.mjs @@ -0,0 +1,17 @@ +import { + MsgSend as InjectiveMsgSend +} from '@injectivelabs/sdk-ts' + +import { MsgBase } from "./MsgBase.mjs"; + +export class MsgSend extends MsgBase { + typeUrl = "/cosmos.bank.v1beta1.MsgSend"; + + toInjective(){ + return new InjectiveMsgSend({ + ...this.params, + srcInjectiveAddress: this.params.fromAddress, + dstInjectiveAddress: this.params.toAddress, + }) + } +} diff --git a/src/messages/MsgUndelegate.mjs b/src/messages/MsgUndelegate.mjs new file mode 100644 index 00000000..adee38c5 --- /dev/null +++ b/src/messages/MsgUndelegate.mjs @@ -0,0 +1,16 @@ +import { + MsgUndelegate as InjectiveMsgUndelegate +} from '@injectivelabs/sdk-ts' + +import { MsgBase } from "./MsgBase.mjs"; + +export class MsgUndelegate extends MsgBase { + typeUrl = "/cosmos.staking.v1beta1.MsgUndelegate"; + + toInjective(){ + return new InjectiveMsgUndelegate({ + ...this.params, + injectiveAddress: this.params.delegatorAddress + }) + } +} diff --git a/src/messages/MsgVote.mjs b/src/messages/MsgVote.mjs new file mode 100644 index 00000000..4f16944e --- /dev/null +++ b/src/messages/MsgVote.mjs @@ -0,0 +1,16 @@ +import { + MsgVote as InjectiveMsgVote +} from '@injectivelabs/sdk-ts' + +import { MsgBase } from "./MsgBase.mjs"; + +export class MsgVote extends MsgBase { + typeUrl = "/cosmos.gov.v1beta1.MsgVote"; + + toInjective(){ + return new InjectiveMsgVote({ + ...this.params, + vote: this.params.option + }) + } +} diff --git a/src/messages/MsgWithdrawDelegatorReward.mjs b/src/messages/MsgWithdrawDelegatorReward.mjs new file mode 100644 index 00000000..b52a3a81 --- /dev/null +++ b/src/messages/MsgWithdrawDelegatorReward.mjs @@ -0,0 +1,15 @@ +import { + MsgWithdrawDelegatorReward as InjectiveMsgWithdrawDelegatorReward +} from '@injectivelabs/sdk-ts' + +import { MsgBase } from "./MsgBase.mjs"; + +export class MsgWithdrawDelegatorReward extends MsgBase { + typeUrl = "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward"; + + toInjective(){ + return new InjectiveMsgWithdrawDelegatorReward({ + ...this.params + }) + } +} diff --git a/src/messages/MsgWithdrawValidatorCommission.mjs b/src/messages/MsgWithdrawValidatorCommission.mjs new file mode 100644 index 00000000..201a22e4 --- /dev/null +++ b/src/messages/MsgWithdrawValidatorCommission.mjs @@ -0,0 +1,15 @@ +import { + MsgWithdrawValidatorCommission as InjectiveMsgWithdrawValidatorCommission +} from '@injectivelabs/sdk-ts' + +import { MsgBase } from "./MsgBase.mjs"; + +export class MsgWithdrawValidatorCommission extends MsgBase { + typeUrl = "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission"; + + toInjective(){ + return new InjectiveMsgWithdrawValidatorCommission({ + ...this.params + }) + } +} diff --git a/src/messages/authorizations/GenericAuthorization.mjs b/src/messages/authorizations/GenericAuthorization.mjs new file mode 100644 index 00000000..d744cc16 --- /dev/null +++ b/src/messages/authorizations/GenericAuthorization.mjs @@ -0,0 +1,14 @@ +import { GenericAuthorization as GenericAuthorizationType } from "cosmjs-types/cosmos/authz/v1beta1/authz"; +import { MsgBase } from "../MsgBase.mjs"; + +export class GenericAuthorization extends MsgBase { + typeUrl = "/cosmos.authz.v1beta1.GenericAuthorization" + binaryConverter = GenericAuthorizationType + + toAmino () { + return { + type: "cosmos-sdk/GenericAuthorization", + value: this.params + } + } +} diff --git a/src/messages/authorizations/StakeAuthorization.mjs b/src/messages/authorizations/StakeAuthorization.mjs new file mode 100644 index 00000000..98913115 --- /dev/null +++ b/src/messages/authorizations/StakeAuthorization.mjs @@ -0,0 +1,23 @@ +import { StakeAuthorization as StakeAuthorizationType } from "cosmjs-types/cosmos/staking/v1beta1/authz"; +import { MsgBase } from "../MsgBase.mjs"; + +export class StakeAuthorization extends MsgBase { + typeUrl = "/cosmos.staking.v1beta1.StakeAuthorization" + binaryConverter = StakeAuthorizationType + + toAmino () { + return { + type: "cosmos-sdk/StakeAuthorization", + value: { + Validators: { + type: "cosmos-sdk/StakeAuthorization/AllowList", + value: { + allow_list: this.params.allowList + } + }, + max_tokens: this.params.maxTokens, + authorization_type: this.params.authorizationType + } + } + } +} diff --git a/src/messages/delegate.mjs b/src/messages/delegate.mjs deleted file mode 100644 index 86766e1c..00000000 --- a/src/messages/delegate.mjs +++ /dev/null @@ -1,5 +0,0 @@ -import Message from "./message.mjs"; - -export default class Delegate extends Message { - typeUrl = "/cosmos.staking.v1beta1.MsgDelegate"; -} diff --git a/src/messages/message.mjs b/src/messages/message.mjs deleted file mode 100644 index 83fc7dec..00000000 --- a/src/messages/message.mjs +++ /dev/null @@ -1,58 +0,0 @@ -import { - defaultRegistryTypes, - createDefaultAminoConverters -} from "@cosmjs/stargate"; -import { mapValuesToProperValueType, objectKeysToEip712Types } from "@injectivelabs/sdk-ts"; - -export default class Message { - typeUrl = null; - protoConverters = new Map(defaultRegistryTypes); - aminoConverters = new Map(Object.entries(createDefaultAminoConverters())); - - constructor (params) { - this.params = params - } - - toProto () { - return this.params - } - - toProtoEncoded() { - return { - typeUrl: this.typeUrl, - value: this.toBinary() - } - } - - toBinary() { - const protoType = this.protoConverters.get(this.typeUrl) - return protoType.encode(this.toProto()).finish() - } - - toAmino () { - const aminoType = this.aminoConverters.get(this.typeUrl) - return { - type: aminoType.aminoType, - value: aminoType.toAmino(this.params) - } - } - - toEip712Types(){ - const amino = this.toAmino() - - return objectKeysToEip712Types({ - object: amino.value, - messageType: amino.type, - }) - } - - toEip712(){ - const amino = this.toAmino() - const { type, value } = amino - - return { - type, - value: mapValuesToProperValueType(value, type) - } - } -} diff --git a/src/messages/vote.mjs b/src/messages/vote.mjs deleted file mode 100644 index 3b6b4087..00000000 --- a/src/messages/vote.mjs +++ /dev/null @@ -1,16 +0,0 @@ -import Message from "./message.mjs"; - -export default class NewVote extends Message { - typeUrl = "/cosmos.gov.v1beta1.MsgVote"; - - toAmino () { - return { - type: "cosmos-sdk/MsgVote", - value: { - proposal_id: this.params.proposalId, - voter: this.params.voter, - option: this.params.option - } - } - } -} diff --git a/src/networks.json b/src/networks.json index be141bab..af78d8a7 100644 --- a/src/networks.json +++ b/src/networks.json @@ -46,8 +46,7 @@ ] }, { - "name": "terra", - "authzAminoLiftedValues": false + "name": "terra" }, { "name": "terra2" @@ -254,7 +253,8 @@ "aminoPreventTypes": [ "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission" ], - "ledgerSupport": true + "ledgerSupport": true, + "authzAminoGenericOnly": true }, { "name": "xpla" diff --git a/src/utils/Helpers.mjs b/src/utils/Helpers.mjs index fa2fe82c..a269fa74 100644 --- a/src/utils/Helpers.mjs +++ b/src/utils/Helpers.mjs @@ -1,6 +1,7 @@ import _ from 'lodash' import { format, floor, bignumber } from 'mathjs' import truncateMiddle from 'truncate-middle' +import { MsgExec } from '../messages/MsgExec.mjs'; export function timeStamp(...args) { console.log('[' + new Date().toISOString().substring(11, 23) + ']', ...args); @@ -8,8 +9,8 @@ export function timeStamp(...args) { export function coin(amount, denom){ return { - denom, - amount: format(floor(amount), {notation: 'fixed'}) + amount: format(floor(amount), {notation: 'fixed'}), + denom } } @@ -45,27 +46,14 @@ export function overrideNetworks(networks, overrides){ }) } -export function buildExecMessage(grantee, messages) { - return { - typeUrl: "/cosmos.authz.v1beta1.MsgExec", - value: { - grantee: grantee, - msgs: messages - } - } -} - -export function buildExecableMessage(type, typeUrl, value, shouldExec){ - if (shouldExec) { - return { - typeUrl: typeUrl, - value: type.encode(type.fromPartial(value)).finish() - } - } else { - return { - typeUrl: typeUrl, - value: value - } +export function execableMessage(messages, walletAddress, granterAddress){ + if (granterAddress && walletAddress !== granterAddress) { + return new MsgExec({ + grantee: walletAddress, + msgs: Array.isArray() ? messages : [messages] + }) + }else{ + return messages } } diff --git a/src/utils/SigningClient.mjs b/src/utils/SigningClient.mjs index 7e62ec5d..61f45e0d 100644 --- a/src/utils/SigningClient.mjs +++ b/src/utils/SigningClient.mjs @@ -54,8 +54,9 @@ function SigningClient(network, signerProvider) { } async function signAndBroadcast(address, messages, gas, memo, gasPrice) { - if (!gas) - gas = await simulate(address, messages, memo); + messages = Array.isArray(messages) ? messages : [messages] + console.log(messages) + gas = gas || await simulate(address, messages, memo); const fee = getFee(gas, gasPrice); const txBody = await sign(address, messages, memo, fee) return broadcast(txBody) @@ -67,6 +68,7 @@ function SigningClient(network, signerProvider) { } async function simulate(address, messages, memo, modifier) { + messages = Array.isArray(messages) ? messages : [messages] const account = await restClient.getAccount(address) const fee = getFee(100_000) const txBody = await adapter.simulate(account, messages, memo, fee) From 5dcd324d6b6c7cffa275314e2c839d1571f56ece Mon Sep 17 00:00:00 2001 From: Tom Beynon Date: Thu, 26 Dec 2024 22:02:09 +0000 Subject: [PATCH 7/8] Remove unused Keplr WC package --- package-lock.json | 265 +--------------------------------------------- package.json | 3 +- 2 files changed, 3 insertions(+), 265 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9c1acde2..6378efe0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,8 +13,7 @@ "@cosmjs/proto-signing": "^0.32.4", "@cosmjs/stargate": "^0.32.4", "@injectivelabs/sdk-ts": "^1.14.33", - "@keplr-wallet/wc-client": "^0.11.3", - "@terra-money/terra.js": "^3.1.8", + "@terra-money/terra.js": "^3.1.10", "@testing-library/jest-dom": "^5.16.2", "@testing-library/react": "^15.0.7", "@testing-library/user-event": "^13.5.0", @@ -871,26 +870,6 @@ "@ethersproject/logger": "^5.7.0" } }, - "node_modules/@ethersproject/keccak256": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", - "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "license": "MIT", - "dependencies": { - "@ethersproject/bytes": "^5.7.0", - "js-sha3": "0.8.0" - } - }, "node_modules/@ethersproject/logger": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz", @@ -1438,87 +1417,6 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/@keplr-wallet/common": { - "version": "0.11.64", - "resolved": "https://registry.npmjs.org/@keplr-wallet/common/-/common-0.11.64.tgz", - "integrity": "sha512-kEnv6K+TxH+BBwwqUgiTcIXuRLBn6PaZMO4jwJbE1O8C8Qh/2j1QtkMLAMgl3Nj9qQkHgJ/dvA5oIqOIdLVMwg==", - "license": "Apache-2.0", - "dependencies": { - "@keplr-wallet/crypto": "0.11.64", - "buffer": "^6.0.3", - "delay": "^4.4.0" - } - }, - "node_modules/@keplr-wallet/crypto": { - "version": "0.11.64", - "resolved": "https://registry.npmjs.org/@keplr-wallet/crypto/-/crypto-0.11.64.tgz", - "integrity": "sha512-DMeGhs+UUBpvefYa/0pF8h8D0lVS1T/eTGNKrn7SIO5CBMp1qfght+k1Se0pHGLr4CAtxFSXTDvYm3mr+ovKhg==", - "license": "Apache-2.0", - "dependencies": { - "@ethersproject/keccak256": "^5.5.0", - "bip32": "^2.0.6", - "bip39": "^3.0.3", - "bs58check": "^2.1.2", - "buffer": "^6.0.3", - "crypto-js": "^4.0.0", - "elliptic": "^6.5.3", - "sha.js": "^2.4.11" - } - }, - "node_modules/@keplr-wallet/provider": { - "version": "0.11.64", - "resolved": "https://registry.npmjs.org/@keplr-wallet/provider/-/provider-0.11.64.tgz", - "integrity": "sha512-BmBRqIncnOAxbl7NDsfBxiQ8exoOnLKMGmX3GK34nQwa9fqRpO1o1jDn6JXdDowv7AugPktq4/qjm9QnPPf4vA==", - "license": "Apache-2.0", - "dependencies": { - "@keplr-wallet/router": "0.11.64", - "@keplr-wallet/types": "0.11.64", - "buffer": "^6.0.3", - "deepmerge": "^4.2.2", - "long": "^4.0.0" - } - }, - "node_modules/@keplr-wallet/router": { - "version": "0.11.64", - "resolved": "https://registry.npmjs.org/@keplr-wallet/router/-/router-0.11.64.tgz", - "integrity": "sha512-o8AfcSCDECYT+G+wqsNKoor00nZCsd25M7cUVgoDlugHEAOhwaWJfGpWkMFNq35oz6SeXz98nphX1qS4cjtHyQ==", - "license": "Apache-2.0" - }, - "node_modules/@keplr-wallet/types": { - "version": "0.11.64", - "resolved": "https://registry.npmjs.org/@keplr-wallet/types/-/types-0.11.64.tgz", - "integrity": "sha512-GgzeLDHHfZFyne3O7UIfFHj/uYqVbxAZI31RbBwt460OBbvwQzjrlZwvJW3vieWRAgxKSITjzEDBl2WneFTQdQ==", - "license": "Apache-2.0", - "dependencies": { - "axios": "^0.27.2", - "long": "^4.0.0" - } - }, - "node_modules/@keplr-wallet/types/node_modules/axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", - "license": "MIT", - "dependencies": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" - } - }, - "node_modules/@keplr-wallet/wc-client": { - "version": "0.11.64", - "resolved": "https://registry.npmjs.org/@keplr-wallet/wc-client/-/wc-client-0.11.64.tgz", - "integrity": "sha512-7ko1icC7egHUXfFgOOlzhx/1SBtwsTa3wUC0GAZDgpfrvsuX/EzGilOysbnceNMXn9kN0Ht7Ik+i0YQnPV++cw==", - "license": "Apache-2.0", - "dependencies": { - "@keplr-wallet/common": "0.11.64", - "@keplr-wallet/provider": "0.11.64", - "@keplr-wallet/types": "0.11.64", - "@walletconnect/types": "^1.6.4", - "@walletconnect/utils": "^1.6.4", - "buffer": "^6.0.3", - "deepmerge": "^4.2.2" - } - }, "node_modules/@lezer/common": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.2.1.tgz", @@ -4396,47 +4294,6 @@ "detect-browser": "5.2.0" } }, - "node_modules/@walletconnect/encoding": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@walletconnect/encoding/-/encoding-1.0.2.tgz", - "integrity": "sha512-CrwSBrjqJ7rpGQcTL3kU+Ief+Bcuu9PH6JLOb+wM6NITX1GTxR/MfNwnQfhLKK6xpRAyj2/nM04OOH6wS8Imag==", - "license": "MIT", - "dependencies": { - "is-typedarray": "1.0.0", - "tslib": "1.14.1", - "typedarray-to-buffer": "3.1.5" - } - }, - "node_modules/@walletconnect/environment": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@walletconnect/environment/-/environment-1.0.1.tgz", - "integrity": "sha512-T426LLZtHj8e8rYnKfzsw1aG6+M0BT1ZxayMdv/p8yM0MU+eJDISqNY3/bccxRr4LrF9csq02Rhqt08Ibl0VRg==", - "license": "MIT", - "dependencies": { - "tslib": "1.14.1" - } - }, - "node_modules/@walletconnect/jsonrpc-types": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-types/-/jsonrpc-types-1.0.4.tgz", - "integrity": "sha512-P6679fG/M+wuWg9TY8mh6xFSdYnFyFjwFelxyISxMDrlbXokorEVXYOxiqEbrU3x1BmBoCAJJ+vtEaEoMlpCBQ==", - "license": "MIT", - "dependencies": { - "events": "^3.3.0", - "keyvaluestorage-interface": "^1.0.0" - } - }, - "node_modules/@walletconnect/jsonrpc-utils": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-utils/-/jsonrpc-utils-1.0.8.tgz", - "integrity": "sha512-vdeb03bD8VzJUL6ZtzRYsFMq1eZQcM3EAzT0a3st59dyLfJ0wq+tKMpmGH7HlB7waD858UWgfIcudbPFsbzVdw==", - "license": "MIT", - "dependencies": { - "@walletconnect/environment": "^1.0.1", - "@walletconnect/jsonrpc-types": "^1.0.3", - "tslib": "1.14.1" - } - }, "node_modules/@walletconnect/safe-json": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@walletconnect/safe-json/-/safe-json-1.0.0.tgz", @@ -4450,27 +4307,6 @@ "deprecated": "WalletConnect's v1 SDKs are now deprecated. Please upgrade to a v2 SDK. For details see: https://docs.walletconnect.com/", "license": "Apache-2.0" }, - "node_modules/@walletconnect/utils": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-1.8.0.tgz", - "integrity": "sha512-zExzp8Mj1YiAIBfKNm5u622oNw44WOESzo6hj+Q3apSMIb0Jph9X3GDIdbZmvVZsNPxWDL7uodKgZcCInZv2vA==", - "license": "Apache-2.0", - "dependencies": { - "@walletconnect/browser-utils": "^1.8.0", - "@walletconnect/encoding": "^1.0.1", - "@walletconnect/jsonrpc-utils": "^1.0.3", - "@walletconnect/types": "^1.8.0", - "bn.js": "4.11.8", - "js-sha3": "0.8.0", - "query-string": "6.13.5" - } - }, - "node_modules/@walletconnect/utils/node_modules/bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", - "license": "MIT" - }, "node_modules/@walletconnect/window-getters": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@walletconnect/window-getters/-/window-getters-1.0.0.tgz", @@ -5501,12 +5337,6 @@ "node": "*" } }, - "node_modules/crypto-js": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", - "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==", - "license": "MIT" - }, "node_modules/css-select": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", @@ -5645,15 +5475,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/decode-uri-component": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", - "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", - "license": "MIT", - "engines": { - "node": ">=0.10" - } - }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -5661,15 +5482,6 @@ "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==", - "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", @@ -5704,18 +5516,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/delay": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/delay/-/delay-4.4.1.tgz", - "integrity": "sha512-aL3AhqtfhOlT/3ai6sWXeqwnw63ATNpnUiN4HL7x9q+My5QtHlO3OIkasmug9LKzpheLdmUKGRKnYXYAS7FQkQ==", - "license": "MIT", - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -6386,6 +6186,7 @@ "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "dev": true, "license": "MIT", "engines": { "node": ">=0.8.x" @@ -7195,12 +6996,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", - "license": "MIT" - }, "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -7533,12 +7328,6 @@ "json-buffer": "3.0.1" } }, - "node_modules/keyvaluestorage-interface": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/keyvaluestorage-interface/-/keyvaluestorage-interface-1.0.0.tgz", - "integrity": "sha512-8t6Q3TclQ4uZynJY9IGr2+SsIGwK9JHcO6ootkHCGA0CrQCRy+VkouYNO2xicET6b9al7QKzpebNow+gkpCL8g==", - "license": "MIT" - }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -9612,23 +9401,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/query-string": { - "version": "6.13.5", - "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.13.5.tgz", - "integrity": "sha512-svk3xg9qHR39P3JlHuD7g3nRnyay5mHbrPctEBDUxUkHRifPHXJDhBUycdCC0NBjXoDf44Gb+IsOZL1Uwn8M/Q==", - "license": "MIT", - "dependencies": { - "decode-uri-component": "^0.2.0", - "split-on-first": "^1.0.0", - "strict-uri-encode": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", @@ -10328,15 +10100,6 @@ "node": ">=0.10.0" } }, - "node_modules/split-on-first": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz", - "integrity": "sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/srcset": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/srcset/-/srcset-5.0.1.tgz", @@ -10434,15 +10197,6 @@ "xtend": "^4.0.2" } }, - "node_modules/strict-uri-encode": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz", - "integrity": "sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ==", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -10685,12 +10439,6 @@ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "license": "0BSD" }, - "node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "license": "0BSD" - }, "node_modules/tweetnacl": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", @@ -10736,15 +10484,6 @@ "node": ">= 18" } }, - "node_modules/typedarray-to-buffer": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", - "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", - "license": "MIT", - "dependencies": { - "is-typedarray": "^1.0.0" - } - }, "node_modules/typeforce": { "version": "1.18.0", "resolved": "https://registry.npmjs.org/typeforce/-/typeforce-1.18.0.tgz", diff --git a/package.json b/package.json index 5b6225f2..a5e695e0 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,7 @@ "@cosmjs/proto-signing": "^0.32.4", "@cosmjs/stargate": "^0.32.4", "@injectivelabs/sdk-ts": "^1.14.33", - "@keplr-wallet/wc-client": "^0.11.3", - "@terra-money/terra.js": "^3.1.8", + "@terra-money/terra.js": "^3.1.10", "@testing-library/jest-dom": "^5.16.2", "@testing-library/react": "^15.0.7", "@testing-library/user-event": "^13.5.0", From 97e65f7e1ff35ae8adc5a941f047695f3e49cb65 Mon Sep 17 00:00:00 2001 From: Tom Beynon Date: Thu, 26 Dec 2024 22:21:26 +0000 Subject: [PATCH 8/8] Remove Authz amino converter --- src/converters/Authz.mjs | 126 --------------------------------------- 1 file changed, 126 deletions(-) delete mode 100644 src/converters/Authz.mjs diff --git a/src/converters/Authz.mjs b/src/converters/Authz.mjs deleted file mode 100644 index 7d5625fd..00000000 --- a/src/converters/Authz.mjs +++ /dev/null @@ -1,126 +0,0 @@ -import moment from 'moment' -import { GenericAuthorization } from "cosmjs-types/cosmos/authz/v1beta1/authz.js"; -import { StakeAuthorization } from "cosmjs-types/cosmos/staking/v1beta1/authz.js"; - -function createAuthzAuthorizationAminoConverter(){ - return { - "/cosmos.authz.v1beta1.GenericAuthorization": { - aminoType: "cosmos-sdk/GenericAuthorization", - toAmino: (value) => GenericAuthorization.decode(value), - fromAmino: ({ msg }) => (GenericAuthorization.encode(GenericAuthorization.fromPartial({ - msg - })).finish()) - }, - "/cosmos.staking.v1beta1.StakeAuthorization": { - aminoType: "cosmos-sdk/StakeAuthorization", - toAmino: (value) => { - const { allowList, maxTokens, authorizationType } = StakeAuthorization.decode(value) - return { - Validators: { - type: "cosmos-sdk/StakeAuthorization/AllowList", - value: { - allow_list: allowList - } - }, - max_tokens: maxTokens, - authorization_type: authorizationType - } - }, - fromAmino: ({ allow_list, max_tokens, authorization_type }) => (StakeAuthorization.encode(StakeAuthorization.fromPartial({ - allowList: allow_list, - maxTokens: max_tokens, - authorizationType: authorization_type - })).finish()) - } - } -} - -const dateConverter = { - toAmino(date){ - return moment(Number(date.seconds) * 1000).utc().format() - }, - fromAmino(date){ - return { - seconds: moment(date).unix(), - nanos: 0 - } - } -} - -export function createAuthzAminoConverters() { - const grantConverter = createAuthzAuthorizationAminoConverter() - return { - "/cosmos.authz.v1beta1.MsgGrant": { - aminoType: "cosmos-sdk/MsgGrant", - toAmino: ({ granter, grantee, grant }) => { - const converter = grantConverter[grant.authorization.typeUrl] - return { - granter, - grantee, - grant: { - authorization: { - type: converter.aminoType, - value: converter.toAmino(grant.authorization.value) - }, - expiration: dateConverter.toAmino(grant.expiration) - } - } - }, - fromAmino: ({ granter, grantee, grant }) => { - const protoType = Object.keys(grantConverter).find(type => grantConverter[type].aminoType === grant.authorization.type) - const converter = grantConverter[protoType] - return { - granter, - grantee, - grant: { - authorization: { - typeUrl: protoType, - value: converter.fromAmino(grant.authorization.value) - }, - expiration: dateConverter.fromAmino(grant.expiration) - } - } - }, - }, - "/cosmos.authz.v1beta1.MsgRevoke": { - aminoType: "cosmos-sdk/MsgRevoke", - toAmino: ({ granter, grantee, msgTypeUrl }) => ({ - granter, - grantee, - msg_type_url: msgTypeUrl - }), - fromAmino: ({ granter, grantee, msg_type_url }) => ({ - granter, - grantee, - msgTypeUrl: msg_type_url - }), - }, - }; -} - -export function createAuthzExecAminoConverters(registry, aminoTypes) { - return { - "/cosmos.authz.v1beta1.MsgExec": { - aminoType: "cosmos-sdk/MsgExec", - toAmino: ({ grantee, msgs }) => ({ - grantee, - msgs: msgs.map(({typeUrl, value}) => { - const msgType = registry.lookupType(typeUrl) - return aminoTypes.toAmino({ typeUrl, value: msgType.decode(value) }) - }) - }), - fromAmino: ({ grantee, msgs }) => ({ - grantee, - msgs: msgs.map(({type, value}) => { - const proto = aminoTypes.fromAmino({ type, value }) - const typeUrl = proto.typeUrl - const msgType = registry.lookupType(typeUrl) - return { - typeUrl, - value: msgType.encode(msgType.fromPartial(proto.value)).finish() - } - }) - }), - }, - }; -}
Wallet Provider
- {props.signerProvider?.label || 'None'} + {wallet.signerProvider?.label || 'None'}