From 3153acad17ac867f6c046bd57b77037fa91083c9 Mon Sep 17 00:00:00 2001 From: Vadym Mozharivsky Date: Thu, 9 Jan 2025 15:28:09 +0200 Subject: [PATCH] separated berrachain --- {utils => berrachain}/.gitignore | 0 {utils => berrachain}/.prettierrc | 0 berrachain/README.md | 7 + {utils => berrachain}/eslint.config.mjs | 0 {utils => berrachain}/jest.config.ts | 0 {utils => berrachain}/package.json | 8 +- {utils => berrachain}/pnpm-lock.yaml | 725 ++++++++++ berrachain/src/bgt.ts | 1766 +++++++++++++++++++++++ berrachain/src/constants/errors.ts | 16 + berrachain/src/constants/index.ts | 6 + berrachain/src/index.ts | 281 ++++ berrachain/src/types/index.ts | 9 + {utils => berrachain}/tsconfig.json | 0 utils/README.md | 7 - utils/{src => }/api.ts | 0 utils/{src => }/constants/errors.ts | 0 utils/{src => }/constants/index.ts | 0 utils/{src => }/index.ts | 0 18 files changed, 2815 insertions(+), 10 deletions(-) rename {utils => berrachain}/.gitignore (100%) rename {utils => berrachain}/.prettierrc (100%) create mode 100644 berrachain/README.md rename {utils => berrachain}/eslint.config.mjs (100%) rename {utils => berrachain}/jest.config.ts (100%) rename {utils => berrachain}/package.json (89%) rename {utils => berrachain}/pnpm-lock.yaml (86%) create mode 100755 berrachain/src/bgt.ts create mode 100644 berrachain/src/constants/errors.ts create mode 100644 berrachain/src/constants/index.ts create mode 100644 berrachain/src/index.ts create mode 100644 berrachain/src/types/index.ts rename {utils => berrachain}/tsconfig.json (100%) delete mode 100644 utils/README.md rename utils/{src => }/api.ts (100%) rename utils/{src => }/constants/errors.ts (100%) rename utils/{src => }/constants/index.ts (100%) rename utils/{src => }/index.ts (100%) diff --git a/utils/.gitignore b/berrachain/.gitignore similarity index 100% rename from utils/.gitignore rename to berrachain/.gitignore diff --git a/utils/.prettierrc b/berrachain/.prettierrc similarity index 100% rename from utils/.prettierrc rename to berrachain/.prettierrc diff --git a/berrachain/README.md b/berrachain/README.md new file mode 100644 index 0000000..06e3e0e --- /dev/null +++ b/berrachain/README.md @@ -0,0 +1,7 @@ +# Everstake Wallet SDK - Berrachain + +## Getting Started +```sh +$ npm install @everstake/wallet-sdk-berrachain +``` + diff --git a/utils/eslint.config.mjs b/berrachain/eslint.config.mjs similarity index 100% rename from utils/eslint.config.mjs rename to berrachain/eslint.config.mjs diff --git a/utils/jest.config.ts b/berrachain/jest.config.ts similarity index 100% rename from utils/jest.config.ts rename to berrachain/jest.config.ts diff --git a/utils/package.json b/berrachain/package.json similarity index 89% rename from utils/package.json rename to berrachain/package.json index eb1f592..8cfd83c 100644 --- a/utils/package.json +++ b/berrachain/package.json @@ -1,7 +1,7 @@ { - "name": "@everstake/wallet-sdk-utils", + "name": "@everstake/wallet-sdk-berrachain", "version": "0.0.1", - "description": "Everstake Wallet SDK utils", + "description": "Berrachain - Everstake Wallet SDK", "publishConfig": { "access": "public" }, @@ -24,7 +24,7 @@ "prebuild": "pnpm run type-check && pnpm run lint" }, "keywords": [ - "utils", + "berrachain", "blockchain", "everstake", "wallet sdk" @@ -40,6 +40,8 @@ }, "homepage": "https://github.com/everstake/wallet-sdk#readme", "dependencies": { + "bignumber.js": "^9.1.2", + "web3": "^4.14.0" }, "devDependencies": { "@eslint/js": "^9.7.0", diff --git a/utils/pnpm-lock.yaml b/berrachain/pnpm-lock.yaml similarity index 86% rename from utils/pnpm-lock.yaml rename to berrachain/pnpm-lock.yaml index 3bdff49..8b54164 100644 --- a/utils/pnpm-lock.yaml +++ b/berrachain/pnpm-lock.yaml @@ -7,6 +7,13 @@ settings: importers: .: + dependencies: + bignumber.js: + specifier: ^9.1.2 + version: 9.1.2 + web3: + specifier: ^4.14.0 + version: 4.16.0(typescript@5.7.3)(zod@3.24.1) devDependencies: '@eslint/js': specifier: ^9.7.0 @@ -53,6 +60,9 @@ importers: packages: + '@adraffy/ens-normalize@1.11.0': + resolution: {integrity: sha512-/3DDPKHqqIqxUULp8yP4zODUY1i+2xvVWsv8A79xGWdCAG+8sb0hRh0Rk2QyOJUnnbyPUAZYcpBuRe3nS2OIUg==} + '@ampproject/remapping@2.3.0': resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} engines: {node: '>=6.0.0'} @@ -406,6 +416,16 @@ packages: resolution: {integrity: sha512-zSkKow6H5Kdm0ZUQUB2kV5JIXqoG0+uH5YADhaEHswm664N9Db8dXSi0nMJpacpMf+MyyglF1vnZohpEg5yUtg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@ethereumjs/rlp@4.0.1': + resolution: {integrity: sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw==} + engines: {node: '>=14'} + hasBin: true + + '@ethereumjs/rlp@5.0.2': + resolution: {integrity: sha512-DziebCdg4JpGlEqEdGgXmjqcFoJi+JGulUXwEjsZGAscAQ7MyD/7LE/GVCP29vEQxKc7AAwjT3A2ywHp2xfoCA==} + engines: {node: '>=18'} + hasBin: true + '@humanfs/core@0.19.1': resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==} engines: {node: '>=18.18.0'} @@ -525,6 +545,13 @@ packages: '@jridgewell/trace-mapping@0.3.9': resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} + '@noble/curves@1.4.2': + resolution: {integrity: sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==} + + '@noble/hashes@1.4.0': + resolution: {integrity: sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==} + engines: {node: '>= 16'} + '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -640,6 +667,15 @@ packages: cpu: [x64] os: [win32] + '@scure/base@1.1.9': + resolution: {integrity: sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==} + + '@scure/bip32@1.4.0': + resolution: {integrity: sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==} + + '@scure/bip39@1.3.0': + resolution: {integrity: sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==} + '@sinclair/typebox@0.27.8': resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} @@ -700,6 +736,9 @@ packages: '@types/stack-utils@2.0.3': resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} + '@types/ws@8.5.3': + resolution: {integrity: sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==} + '@types/yargs-parser@21.0.3': resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} @@ -764,6 +803,15 @@ packages: resolution: {integrity: sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==} engines: {node: ^18.18.0 || >=20.0.0} + abitype@0.7.1: + resolution: {integrity: sha512-VBkRHTDZf9Myaek/dO3yMmOzB/y2s3Zo6nVU7yaw1G+TvCHAjwaJzNGN9yo4K5D8bU/VZXKP1EJpRhFr862PlQ==} + peerDependencies: + typescript: '>=4.9.4' + zod: ^3 >=3.19.1 + peerDependenciesMeta: + zod: + optional: true + acorn-jsx@5.3.2: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: @@ -828,6 +876,10 @@ packages: async@3.2.6: resolution: {integrity: sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==} + available-typed-arrays@1.0.7: + resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} + engines: {node: '>= 0.4'} + babel-jest@29.7.0: resolution: {integrity: sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -856,6 +908,9 @@ packages: balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + bignumber.js@9.1.2: + resolution: {integrity: sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==} + brace-expansion@1.1.11: resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} @@ -891,6 +946,18 @@ packages: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} + call-bind-apply-helpers@1.0.1: + resolution: {integrity: sha512-BhYE+WDaywFg2TBWYNXAE+8B1ATnThNBqXHP5nQu0jWJdVvY2hvkpyB3qOmtmDePiS5/BDQ8wASEWGMWRG148g==} + engines: {node: '>= 0.4'} + + call-bind@1.0.8: + resolution: {integrity: sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==} + engines: {node: '>= 0.4'} + + call-bound@1.0.3: + resolution: {integrity: sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA==} + engines: {node: '>= 0.4'} + callsites@3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} @@ -957,6 +1024,11 @@ packages: convert-source-map@2.0.0: resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} + crc-32@1.2.2: + resolution: {integrity: sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==} + engines: {node: '>=0.8'} + hasBin: true + create-jest@29.7.0: resolution: {integrity: sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -965,6 +1037,9 @@ packages: create-require@1.1.1: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} + cross-fetch@4.1.0: + resolution: {integrity: sha512-uKm5PU+MHTootlWEY+mZ4vvXoCn4fLQxT9dSc1sXVMSFkINTJVN8cAQROpwcKm8bJ/c7rgZVIBWzH5T78sNZZw==} + cross-spawn@7.0.6: resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} @@ -993,6 +1068,10 @@ packages: resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} engines: {node: '>=0.10.0'} + define-data-property@1.1.4: + resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} + engines: {node: '>= 0.4'} + detect-newline@3.1.0: resolution: {integrity: sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==} engines: {node: '>=8'} @@ -1009,6 +1088,10 @@ packages: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} + dunder-proto@1.0.1: + resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} + engines: {node: '>= 0.4'} + eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} @@ -1033,6 +1116,18 @@ packages: error-ex@1.3.2: resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==} + es-define-property@1.0.1: + resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} + engines: {node: '>= 0.4'} + + es-errors@1.3.0: + resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} + engines: {node: '>= 0.4'} + + es-object-atoms@1.0.0: + resolution: {integrity: sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==} + engines: {node: '>= 0.4'} + esbuild@0.24.2: resolution: {integrity: sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==} engines: {node: '>=18'} @@ -1117,6 +1212,12 @@ packages: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} engines: {node: '>=0.10.0'} + ethereum-cryptography@2.2.1: + resolution: {integrity: sha512-r/W8lkHSiTLxUxW8Rf3u4HGB0xQweG2RyETjywylKZSzLWoWAijRz8WCuOtJ6wah+avllXBqZuk29HCCvhEIRg==} + + eventemitter3@5.0.1: + resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} + execa@5.1.1: resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} engines: {node: '>=10'} @@ -1185,6 +1286,9 @@ packages: flatted@3.3.2: resolution: {integrity: sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==} + for-each@0.3.3: + resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} + foreground-child@3.3.0: resolution: {integrity: sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==} engines: {node: '>=14'} @@ -1208,10 +1312,18 @@ packages: resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} engines: {node: 6.* || 8.* || >= 10.*} + get-intrinsic@1.2.7: + resolution: {integrity: sha512-VW6Pxhsrk0KAOqs3WEd0klDiF/+V7gQOpAvY1jVU/LHmaD/kQO4523aiJuikX/QAKYiW6x8Jh+RJej1almdtCA==} + engines: {node: '>= 0.4'} + get-package-type@0.1.0: resolution: {integrity: sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==} engines: {node: '>=8.0.0'} + get-proto@1.0.1: + resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} + engines: {node: '>= 0.4'} + get-stream@6.0.1: resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} engines: {node: '>=10'} @@ -1248,6 +1360,10 @@ packages: resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} engines: {node: '>=10'} + gopd@1.2.0: + resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} + engines: {node: '>= 0.4'} + graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} @@ -1258,6 +1374,17 @@ packages: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} + has-property-descriptors@1.0.2: + resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} + + has-symbols@1.1.0: + resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==} + engines: {node: '>= 0.4'} + + has-tostringtag@1.0.2: + resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} + engines: {node: '>= 0.4'} + hasown@2.0.2: resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} engines: {node: '>= 0.4'} @@ -1293,9 +1420,17 @@ packages: inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + is-arguments@1.2.0: + resolution: {integrity: sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA==} + engines: {node: '>= 0.4'} + is-arrayish@0.2.1: resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} + is-callable@1.2.7: + resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} + engines: {node: '>= 0.4'} + is-core-module@2.16.1: resolution: {integrity: sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==} engines: {node: '>= 0.4'} @@ -1312,6 +1447,10 @@ packages: resolution: {integrity: sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==} engines: {node: '>=6'} + is-generator-function@1.1.0: + resolution: {integrity: sha512-nPUB5km40q9e8UfN/Zc24eLlzdSf9OfKByBw9CIdw4H1giPMeA0OIJvbchsCu4npfI2QcMVBsGEBHKZ7wLTWmQ==} + engines: {node: '>= 0.4'} + is-glob@4.0.3: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} engines: {node: '>=0.10.0'} @@ -1320,13 +1459,26 @@ packages: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} engines: {node: '>=0.12.0'} + is-regex@1.2.1: + resolution: {integrity: sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==} + engines: {node: '>= 0.4'} + is-stream@2.0.1: resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} engines: {node: '>=8'} + is-typed-array@1.1.15: + resolution: {integrity: sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==} + engines: {node: '>= 0.4'} + isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + isomorphic-ws@5.0.0: + resolution: {integrity: sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==} + peerDependencies: + ws: '*' + istanbul-lib-coverage@3.2.2: resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==} engines: {node: '>=8'} @@ -1584,6 +1736,10 @@ packages: makeerror@1.0.12: resolution: {integrity: sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==} + math-intrinsics@1.1.0: + resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} + engines: {node: '>= 0.4'} + merge-stream@2.0.0: resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} @@ -1623,6 +1779,15 @@ packages: natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + node-fetch@2.7.0: + resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + node-int64@0.4.0: resolution: {integrity: sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==} @@ -1725,6 +1890,10 @@ packages: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} + possible-typed-array-names@1.0.0: + resolution: {integrity: sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==} + engines: {node: '>= 0.4'} + postcss-load-config@6.0.1: resolution: {integrity: sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==} engines: {node: '>= 18'} @@ -1818,6 +1987,10 @@ packages: run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + safe-regex-test@1.1.0: + resolution: {integrity: sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==} + engines: {node: '>= 0.4'} + semver@6.3.1: resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} hasBin: true @@ -1827,6 +2000,13 @@ packages: engines: {node: '>=10'} hasBin: true + set-function-length@1.2.2: + resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} + engines: {node: '>= 0.4'} + + setimmediate@1.0.5: + resolution: {integrity: sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==} + shebang-command@2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} engines: {node: '>=8'} @@ -1945,6 +2125,9 @@ packages: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} + tr46@0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + tr46@1.0.1: resolution: {integrity: sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==} @@ -2060,6 +2243,9 @@ packages: uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + util@0.12.5: + resolution: {integrity: sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==} + v8-compile-cache-lib@3.0.1: resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} @@ -2070,12 +2256,98 @@ packages: walker@1.0.8: resolution: {integrity: sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==} + web3-core@4.7.1: + resolution: {integrity: sha512-9KSeASCb/y6BG7rwhgtYC4CvYY66JfkmGNEYb7q1xgjt9BWfkf09MJPaRyoyT5trdOxYDHkT9tDlypvQWaU8UQ==} + engines: {node: '>=14', npm: '>=6.12.0'} + + web3-errors@1.3.1: + resolution: {integrity: sha512-w3NMJujH+ZSW4ltIZZKtdbkbyQEvBzyp3JRn59Ckli0Nz4VMsVq8aF1bLWM7A2kuQ+yVEm3ySeNU+7mSRwx7RQ==} + engines: {node: '>=14', npm: '>=6.12.0'} + + web3-eth-abi@4.4.1: + resolution: {integrity: sha512-60ecEkF6kQ9zAfbTY04Nc9q4eEYM0++BySpGi8wZ2PD1tw/c0SDvsKhV6IKURxLJhsDlb08dATc3iD6IbtWJmg==} + engines: {node: '>=14', npm: '>=6.12.0'} + + web3-eth-accounts@4.3.1: + resolution: {integrity: sha512-rTXf+H9OKze6lxi7WMMOF1/2cZvJb2AOnbNQxPhBDssKOllAMzLhg1FbZ4Mf3lWecWfN6luWgRhaeSqO1l+IBQ==} + engines: {node: '>=14', npm: '>=6.12.0'} + + web3-eth-contract@4.7.2: + resolution: {integrity: sha512-3ETqs2pMNPEAc7BVY/C3voOhTUeJdkf2aM3X1v+edbngJLHAxbvxKpOqrcO0cjXzC4uc2Q8Zpf8n8zT5r0eLnA==} + engines: {node: '>=14', npm: '>=6.12.0'} + + web3-eth-ens@4.4.0: + resolution: {integrity: sha512-DeyVIS060hNV9g8dnTx92syqvgbvPricE3MerCxe/DquNZT3tD8aVgFfq65GATtpCgDDJffO2bVeHp3XBemnSQ==} + engines: {node: '>=14', npm: '>=6.12.0'} + + web3-eth-iban@4.0.7: + resolution: {integrity: sha512-8weKLa9KuKRzibC87vNLdkinpUE30gn0IGY027F8doeJdcPUfsa4IlBgNC4k4HLBembBB2CTU0Kr/HAOqMeYVQ==} + engines: {node: '>=14', npm: '>=6.12.0'} + + web3-eth-personal@4.1.0: + resolution: {integrity: sha512-RFN83uMuvA5cu1zIwwJh9A/bAj0OBxmGN3tgx19OD/9ygeUZbifOL06jgFzN0t+1ekHqm3DXYQM8UfHpXi7yDQ==} + engines: {node: '>=14', npm: '>=6.12.0'} + + web3-eth@4.11.1: + resolution: {integrity: sha512-q9zOkzHnbLv44mwgLjLXuyqszHuUgZWsQayD2i/rus2uk0G7hMn11bE2Q3hOVnJS4ws4VCtUznlMxwKQ+38V2w==} + engines: {node: '>=14', npm: '>=6.12.0'} + + web3-net@4.1.0: + resolution: {integrity: sha512-WWmfvHVIXWEoBDWdgKNYKN8rAy6SgluZ0abyRyXOL3ESr7ym7pKWbfP4fjApIHlYTh8tNqkrdPfM4Dyi6CA0SA==} + engines: {node: '>=14', npm: '>=6.12.0'} + + web3-providers-http@4.2.0: + resolution: {integrity: sha512-IPMnDtHB7dVwaB7/mMxAZzyq7d5ezfO1+Vw0bNfAeIi7gaDlJiggp85SdyAfOgov8AMUA/dyiY72kQ0KmjXKvQ==} + engines: {node: '>=14', npm: '>=6.12.0'} + + web3-providers-ipc@4.0.7: + resolution: {integrity: sha512-YbNqY4zUvIaK2MHr1lQFE53/8t/ejHtJchrWn9zVbFMGXlTsOAbNoIoZWROrg1v+hCBvT2c9z8xt7e/+uz5p1g==} + engines: {node: '>=14', npm: '>=6.12.0'} + + web3-providers-ws@4.0.8: + resolution: {integrity: sha512-goJdgata7v4pyzHRsg9fSegUG4gVnHZSHODhNnn6J93ykHkBI1nz4fjlGpcQLUMi4jAMz6SHl9Ibzs2jj9xqPw==} + engines: {node: '>=14', npm: '>=6.12.0'} + + web3-rpc-methods@1.3.0: + resolution: {integrity: sha512-/CHmzGN+IYgdBOme7PdqzF+FNeMleefzqs0LVOduncSaqsppeOEoskLXb2anSpzmQAP3xZJPaTrkQPWSJMORig==} + engines: {node: '>=14', npm: '>=6.12.0'} + + web3-rpc-providers@1.0.0-rc.4: + resolution: {integrity: sha512-PXosCqHW0EADrYzgmueNHP3Y5jcSmSwH+Dkqvn7EYD0T2jcsdDAIHqk6szBiwIdhumM7gv9Raprsu/s/f7h1fw==} + engines: {node: '>=14', npm: '>=6.12.0'} + + web3-types@1.10.0: + resolution: {integrity: sha512-0IXoaAFtFc8Yin7cCdQfB9ZmjafrbP6BO0f0KT/khMhXKUpoJ6yShrVhiNpyRBo8QQjuOagsWzwSK2H49I7sbw==} + engines: {node: '>=14', npm: '>=6.12.0'} + + web3-utils@4.3.3: + resolution: {integrity: sha512-kZUeCwaQm+RNc2Bf1V3BYbF29lQQKz28L0y+FA4G0lS8IxtJVGi5SeDTUkpwqqkdHHC7JcapPDnyyzJ1lfWlOw==} + engines: {node: '>=14', npm: '>=6.12.0'} + + web3-validator@2.0.6: + resolution: {integrity: sha512-qn9id0/l1bWmvH4XfnG/JtGKKwut2Vokl6YXP5Kfg424npysmtRLe9DgiNBM9Op7QL/aSiaA0TVXibuIuWcizg==} + engines: {node: '>=14', npm: '>=6.12.0'} + + web3@4.16.0: + resolution: {integrity: sha512-SgoMSBo6EsJ5GFCGar2E/pR2lcR/xmUSuQ61iK6yDqzxmm42aPPxSqZfJz2z/UCR6pk03u77pU8TGV6lgMDdIQ==} + engines: {node: '>=14.0.0', npm: '>=6.12.0'} + + webidl-conversions@3.0.1: + resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + webidl-conversions@4.0.2: resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==} + whatwg-url@5.0.0: + resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + whatwg-url@7.1.0: resolution: {integrity: sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==} + which-typed-array@1.1.18: + resolution: {integrity: sha512-qEcY+KJYlWyLH9vNbsr6/5j59AXk5ni5aakf8ldzBvGde6Iz4sxZGkJyWSAueTG7QhOvNRYb1lDdFmL5Td0QKA==} + engines: {node: '>= 0.4'} + which@2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} engines: {node: '>= 8'} @@ -2100,6 +2372,18 @@ packages: resolution: {integrity: sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + ws@8.18.0: + resolution: {integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==} + 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 + y18n@5.0.8: resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} engines: {node: '>=10'} @@ -2123,8 +2407,13 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} + zod@3.24.1: + resolution: {integrity: sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==} + snapshots: + '@adraffy/ens-normalize@1.11.0': {} + '@ampproject/remapping@2.3.0': dependencies: '@jridgewell/gen-mapping': 0.3.8 @@ -2437,6 +2726,10 @@ snapshots: dependencies: levn: 0.4.1 + '@ethereumjs/rlp@4.0.1': {} + + '@ethereumjs/rlp@5.0.2': {} + '@humanfs/core@0.19.1': {} '@humanfs/node@0.16.6': @@ -2653,6 +2946,12 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 + '@noble/curves@1.4.2': + dependencies: + '@noble/hashes': 1.4.0 + + '@noble/hashes@1.4.0': {} + '@nodelib/fs.scandir@2.1.5': dependencies: '@nodelib/fs.stat': 2.0.5 @@ -2727,6 +3026,19 @@ snapshots: '@rollup/rollup-win32-x64-msvc@4.30.1': optional: true + '@scure/base@1.1.9': {} + + '@scure/bip32@1.4.0': + dependencies: + '@noble/curves': 1.4.2 + '@noble/hashes': 1.4.0 + '@scure/base': 1.1.9 + + '@scure/bip39@1.3.0': + dependencies: + '@noble/hashes': 1.4.0 + '@scure/base': 1.1.9 + '@sinclair/typebox@0.27.8': {} '@sinonjs/commons@3.0.1': @@ -2795,6 +3107,10 @@ snapshots: '@types/stack-utils@2.0.3': {} + '@types/ws@8.5.3': + dependencies: + '@types/node': 22.10.5 + '@types/yargs-parser@21.0.3': {} '@types/yargs@17.0.33': @@ -2882,6 +3198,12 @@ snapshots: '@typescript-eslint/types': 7.18.0 eslint-visitor-keys: 3.4.3 + abitype@0.7.1(typescript@5.7.3)(zod@3.24.1): + dependencies: + typescript: 5.7.3 + optionalDependencies: + zod: 3.24.1 + acorn-jsx@5.3.2(acorn@8.14.0): dependencies: acorn: 8.14.0 @@ -2934,6 +3256,10 @@ snapshots: async@3.2.6: {} + available-typed-arrays@1.0.7: + dependencies: + possible-typed-array-names: 1.0.0 + babel-jest@29.7.0(@babel/core@7.26.0): dependencies: '@babel/core': 7.26.0 @@ -2991,6 +3317,8 @@ snapshots: balanced-match@1.0.2: {} + bignumber.js@9.1.2: {} + brace-expansion@1.1.11: dependencies: balanced-match: 1.0.2 @@ -3028,6 +3356,23 @@ snapshots: cac@6.7.14: {} + call-bind-apply-helpers@1.0.1: + dependencies: + es-errors: 1.3.0 + function-bind: 1.1.2 + + call-bind@1.0.8: + dependencies: + call-bind-apply-helpers: 1.0.1 + es-define-property: 1.0.1 + get-intrinsic: 1.2.7 + set-function-length: 1.2.2 + + call-bound@1.0.3: + dependencies: + call-bind-apply-helpers: 1.0.1 + get-intrinsic: 1.2.7 + callsites@3.1.0: {} camelcase@5.3.1: {} @@ -3075,6 +3420,8 @@ snapshots: convert-source-map@2.0.0: {} + crc-32@1.2.2: {} + create-jest@29.7.0(@types/node@22.10.5)(ts-node@10.9.2(@types/node@22.10.5)(typescript@5.7.3)): dependencies: '@jest/types': 29.6.3 @@ -3092,6 +3439,12 @@ snapshots: create-require@1.1.1: {} + cross-fetch@4.1.0: + dependencies: + node-fetch: 2.7.0 + transitivePeerDependencies: + - encoding + cross-spawn@7.0.6: dependencies: path-key: 3.1.1 @@ -3108,6 +3461,12 @@ snapshots: deepmerge@4.3.1: {} + define-data-property@1.1.4: + dependencies: + es-define-property: 1.0.1 + es-errors: 1.3.0 + gopd: 1.2.0 + detect-newline@3.1.0: {} diff-sequences@29.6.3: {} @@ -3118,6 +3477,12 @@ snapshots: dependencies: path-type: 4.0.0 + dunder-proto@1.0.1: + dependencies: + call-bind-apply-helpers: 1.0.1 + es-errors: 1.3.0 + gopd: 1.2.0 + eastasianwidth@0.2.0: {} ejs@3.1.10: @@ -3136,6 +3501,14 @@ snapshots: dependencies: is-arrayish: 0.2.1 + es-define-property@1.0.1: {} + + es-errors@1.3.0: {} + + es-object-atoms@1.0.0: + dependencies: + es-errors: 1.3.0 + esbuild@0.24.2: optionalDependencies: '@esbuild/aix-ppc64': 0.24.2 @@ -3251,6 +3624,15 @@ snapshots: esutils@2.0.3: {} + ethereum-cryptography@2.2.1: + dependencies: + '@noble/curves': 1.4.2 + '@noble/hashes': 1.4.0 + '@scure/bip32': 1.4.0 + '@scure/bip39': 1.3.0 + + eventemitter3@5.0.1: {} + execa@5.1.1: dependencies: cross-spawn: 7.0.6 @@ -3330,6 +3712,10 @@ snapshots: flatted@3.3.2: {} + for-each@0.3.3: + dependencies: + is-callable: 1.2.7 + foreground-child@3.3.0: dependencies: cross-spawn: 7.0.6 @@ -3346,8 +3732,26 @@ snapshots: get-caller-file@2.0.5: {} + get-intrinsic@1.2.7: + dependencies: + call-bind-apply-helpers: 1.0.1 + es-define-property: 1.0.1 + es-errors: 1.3.0 + es-object-atoms: 1.0.0 + function-bind: 1.1.2 + get-proto: 1.0.1 + gopd: 1.2.0 + has-symbols: 1.1.0 + hasown: 2.0.2 + math-intrinsics: 1.1.0 + get-package-type@0.1.0: {} + get-proto@1.0.1: + dependencies: + dunder-proto: 1.0.1 + es-object-atoms: 1.0.0 + get-stream@6.0.1: {} glob-parent@5.1.2: @@ -3391,12 +3795,24 @@ snapshots: merge2: 1.4.1 slash: 3.0.0 + gopd@1.2.0: {} + graceful-fs@4.2.11: {} graphemer@1.4.0: {} has-flag@4.0.0: {} + has-property-descriptors@1.0.2: + dependencies: + es-define-property: 1.0.1 + + has-symbols@1.1.0: {} + + has-tostringtag@1.0.2: + dependencies: + has-symbols: 1.1.0 + hasown@2.0.2: dependencies: function-bind: 1.1.2 @@ -3426,8 +3842,15 @@ snapshots: inherits@2.0.4: {} + is-arguments@1.2.0: + dependencies: + call-bound: 1.0.3 + has-tostringtag: 1.0.2 + is-arrayish@0.2.1: {} + is-callable@1.2.7: {} + is-core-module@2.16.1: dependencies: hasown: 2.0.2 @@ -3438,16 +3861,38 @@ snapshots: is-generator-fn@2.1.0: {} + is-generator-function@1.1.0: + dependencies: + call-bound: 1.0.3 + get-proto: 1.0.1 + has-tostringtag: 1.0.2 + safe-regex-test: 1.1.0 + is-glob@4.0.3: dependencies: is-extglob: 2.1.1 is-number@7.0.0: {} + is-regex@1.2.1: + dependencies: + call-bound: 1.0.3 + gopd: 1.2.0 + has-tostringtag: 1.0.2 + hasown: 2.0.2 + is-stream@2.0.1: {} + is-typed-array@1.1.15: + dependencies: + which-typed-array: 1.1.18 + isexe@2.0.0: {} + isomorphic-ws@5.0.0(ws@8.18.0): + dependencies: + ws: 8.18.0 + istanbul-lib-coverage@3.2.2: {} istanbul-lib-instrument@5.2.1: @@ -3885,6 +4330,8 @@ snapshots: dependencies: tmpl: 1.0.5 + math-intrinsics@1.1.0: {} + merge-stream@2.0.0: {} merge2@1.4.1: {} @@ -3920,6 +4367,10 @@ snapshots: natural-compare@1.4.0: {} + node-fetch@2.7.0: + dependencies: + whatwg-url: 5.0.0 + node-int64@0.4.0: {} node-releases@2.0.19: {} @@ -4007,6 +4458,8 @@ snapshots: dependencies: find-up: 4.1.0 + possible-typed-array-names@1.0.0: {} + postcss-load-config@6.0.1: dependencies: lilconfig: 3.1.3 @@ -4089,10 +4542,27 @@ snapshots: dependencies: queue-microtask: 1.2.3 + safe-regex-test@1.1.0: + dependencies: + call-bound: 1.0.3 + es-errors: 1.3.0 + is-regex: 1.2.1 + semver@6.3.1: {} semver@7.6.3: {} + set-function-length@1.2.2: + dependencies: + define-data-property: 1.1.4 + es-errors: 1.3.0 + function-bind: 1.1.2 + get-intrinsic: 1.2.7 + gopd: 1.2.0 + has-property-descriptors: 1.0.2 + + setimmediate@1.0.5: {} + shebang-command@2.0.0: dependencies: shebang-regex: 3.0.0 @@ -4207,6 +4677,8 @@ snapshots: dependencies: is-number: 7.0.0 + tr46@0.0.3: {} + tr46@1.0.1: dependencies: punycode: 2.3.1 @@ -4318,6 +4790,14 @@ snapshots: dependencies: punycode: 2.3.1 + util@0.12.5: + dependencies: + inherits: 2.0.4 + is-arguments: 1.2.0 + is-generator-function: 1.1.0 + is-typed-array: 1.1.15 + which-typed-array: 1.1.18 + v8-compile-cache-lib@3.0.1: {} v8-to-istanbul@9.3.0: @@ -4330,14 +4810,255 @@ snapshots: dependencies: makeerror: 1.0.12 + web3-core@4.7.1: + dependencies: + web3-errors: 1.3.1 + web3-eth-accounts: 4.3.1 + web3-eth-iban: 4.0.7 + web3-providers-http: 4.2.0 + web3-providers-ws: 4.0.8 + web3-types: 1.10.0 + web3-utils: 4.3.3 + web3-validator: 2.0.6 + optionalDependencies: + web3-providers-ipc: 4.0.7 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + + web3-errors@1.3.1: + dependencies: + web3-types: 1.10.0 + + web3-eth-abi@4.4.1(typescript@5.7.3)(zod@3.24.1): + dependencies: + abitype: 0.7.1(typescript@5.7.3)(zod@3.24.1) + web3-errors: 1.3.1 + web3-types: 1.10.0 + web3-utils: 4.3.3 + web3-validator: 2.0.6 + transitivePeerDependencies: + - typescript + - zod + + web3-eth-accounts@4.3.1: + dependencies: + '@ethereumjs/rlp': 4.0.1 + crc-32: 1.2.2 + ethereum-cryptography: 2.2.1 + web3-errors: 1.3.1 + web3-types: 1.10.0 + web3-utils: 4.3.3 + web3-validator: 2.0.6 + + web3-eth-contract@4.7.2(typescript@5.7.3)(zod@3.24.1): + dependencies: + '@ethereumjs/rlp': 5.0.2 + web3-core: 4.7.1 + web3-errors: 1.3.1 + web3-eth: 4.11.1(typescript@5.7.3)(zod@3.24.1) + web3-eth-abi: 4.4.1(typescript@5.7.3)(zod@3.24.1) + web3-types: 1.10.0 + web3-utils: 4.3.3 + web3-validator: 2.0.6 + transitivePeerDependencies: + - bufferutil + - encoding + - typescript + - utf-8-validate + - zod + + web3-eth-ens@4.4.0(typescript@5.7.3)(zod@3.24.1): + dependencies: + '@adraffy/ens-normalize': 1.11.0 + web3-core: 4.7.1 + web3-errors: 1.3.1 + web3-eth: 4.11.1(typescript@5.7.3)(zod@3.24.1) + web3-eth-contract: 4.7.2(typescript@5.7.3)(zod@3.24.1) + web3-net: 4.1.0 + web3-types: 1.10.0 + web3-utils: 4.3.3 + web3-validator: 2.0.6 + transitivePeerDependencies: + - bufferutil + - encoding + - typescript + - utf-8-validate + - zod + + web3-eth-iban@4.0.7: + dependencies: + web3-errors: 1.3.1 + web3-types: 1.10.0 + web3-utils: 4.3.3 + web3-validator: 2.0.6 + + web3-eth-personal@4.1.0(typescript@5.7.3)(zod@3.24.1): + dependencies: + web3-core: 4.7.1 + web3-eth: 4.11.1(typescript@5.7.3)(zod@3.24.1) + web3-rpc-methods: 1.3.0 + web3-types: 1.10.0 + web3-utils: 4.3.3 + web3-validator: 2.0.6 + transitivePeerDependencies: + - bufferutil + - encoding + - typescript + - utf-8-validate + - zod + + web3-eth@4.11.1(typescript@5.7.3)(zod@3.24.1): + dependencies: + setimmediate: 1.0.5 + web3-core: 4.7.1 + web3-errors: 1.3.1 + web3-eth-abi: 4.4.1(typescript@5.7.3)(zod@3.24.1) + web3-eth-accounts: 4.3.1 + web3-net: 4.1.0 + web3-providers-ws: 4.0.8 + web3-rpc-methods: 1.3.0 + web3-types: 1.10.0 + web3-utils: 4.3.3 + web3-validator: 2.0.6 + transitivePeerDependencies: + - bufferutil + - encoding + - typescript + - utf-8-validate + - zod + + web3-net@4.1.0: + dependencies: + web3-core: 4.7.1 + web3-rpc-methods: 1.3.0 + web3-types: 1.10.0 + web3-utils: 4.3.3 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + + web3-providers-http@4.2.0: + dependencies: + cross-fetch: 4.1.0 + web3-errors: 1.3.1 + web3-types: 1.10.0 + web3-utils: 4.3.3 + transitivePeerDependencies: + - encoding + + web3-providers-ipc@4.0.7: + dependencies: + web3-errors: 1.3.1 + web3-types: 1.10.0 + web3-utils: 4.3.3 + optional: true + + web3-providers-ws@4.0.8: + dependencies: + '@types/ws': 8.5.3 + isomorphic-ws: 5.0.0(ws@8.18.0) + web3-errors: 1.3.1 + web3-types: 1.10.0 + web3-utils: 4.3.3 + ws: 8.18.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + + web3-rpc-methods@1.3.0: + dependencies: + web3-core: 4.7.1 + web3-types: 1.10.0 + web3-validator: 2.0.6 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + + web3-rpc-providers@1.0.0-rc.4: + dependencies: + web3-errors: 1.3.1 + web3-providers-http: 4.2.0 + web3-providers-ws: 4.0.8 + web3-types: 1.10.0 + web3-utils: 4.3.3 + web3-validator: 2.0.6 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + + web3-types@1.10.0: {} + + web3-utils@4.3.3: + dependencies: + ethereum-cryptography: 2.2.1 + eventemitter3: 5.0.1 + web3-errors: 1.3.1 + web3-types: 1.10.0 + web3-validator: 2.0.6 + + web3-validator@2.0.6: + dependencies: + ethereum-cryptography: 2.2.1 + util: 0.12.5 + web3-errors: 1.3.1 + web3-types: 1.10.0 + zod: 3.24.1 + + web3@4.16.0(typescript@5.7.3)(zod@3.24.1): + dependencies: + web3-core: 4.7.1 + web3-errors: 1.3.1 + web3-eth: 4.11.1(typescript@5.7.3)(zod@3.24.1) + web3-eth-abi: 4.4.1(typescript@5.7.3)(zod@3.24.1) + web3-eth-accounts: 4.3.1 + web3-eth-contract: 4.7.2(typescript@5.7.3)(zod@3.24.1) + web3-eth-ens: 4.4.0(typescript@5.7.3)(zod@3.24.1) + web3-eth-iban: 4.0.7 + web3-eth-personal: 4.1.0(typescript@5.7.3)(zod@3.24.1) + web3-net: 4.1.0 + web3-providers-http: 4.2.0 + web3-providers-ws: 4.0.8 + web3-rpc-methods: 1.3.0 + web3-rpc-providers: 1.0.0-rc.4 + web3-types: 1.10.0 + web3-utils: 4.3.3 + web3-validator: 2.0.6 + transitivePeerDependencies: + - bufferutil + - encoding + - typescript + - utf-8-validate + - zod + + webidl-conversions@3.0.1: {} + webidl-conversions@4.0.2: {} + whatwg-url@5.0.0: + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + whatwg-url@7.1.0: dependencies: lodash.sortby: 4.7.0 tr46: 1.0.1 webidl-conversions: 4.0.2 + which-typed-array@1.1.18: + dependencies: + available-typed-arrays: 1.0.7 + call-bind: 1.0.8 + call-bound: 1.0.3 + for-each: 0.3.3 + gopd: 1.2.0 + has-tostringtag: 1.0.2 + which@2.0.2: dependencies: isexe: 2.0.0 @@ -4363,6 +5084,8 @@ snapshots: imurmurhash: 0.1.4 signal-exit: 3.0.7 + ws@8.18.0: {} + y18n@5.0.8: {} yallist@3.1.1: {} @@ -4382,3 +5105,5 @@ snapshots: yn@3.1.1: {} yocto-queue@0.1.0: {} + + zod@3.24.1: {} diff --git a/berrachain/src/bgt.ts b/berrachain/src/bgt.ts new file mode 100755 index 0000000..9349d2b --- /dev/null +++ b/berrachain/src/bgt.ts @@ -0,0 +1,1766 @@ +export const ABI = [ + { + inputs: [], + name: 'AlreadyInitialized', + type: 'error', + }, + { + inputs: [], + name: 'AmountLessThanMinIncentiveRate', + type: 'error', + }, + { + inputs: [], + name: 'BlockDoesNotExist', + type: 'error', + }, + { + inputs: [], + name: 'BlockNotInBuffer', + type: 'error', + }, + { + inputs: [], + name: 'CannotRecoverRewardToken', + type: 'error', + }, + { + inputs: [], + name: 'CannotRecoverStakingToken', + type: 'error', + }, + { + inputs: [], + name: 'CheckpointUnorderedInsertion', + type: 'error', + }, + { + inputs: [], + name: 'DelegateStakedOverflow', + type: 'error', + }, + { + inputs: [], + name: 'ECDSAInvalidSignature', + type: 'error', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'length', + type: 'uint256', + }, + ], + name: 'ECDSAInvalidSignatureLength', + type: 'error', + }, + { + inputs: [ + { + internalType: 'bytes32', + name: 's', + type: 'bytes32', + }, + ], + name: 'ECDSAInvalidSignatureS', + type: 'error', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'increasedSupply', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'cap', + type: 'uint256', + }, + ], + name: 'ERC20ExceededSafeSupply', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'allowance', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'needed', + type: 'uint256', + }, + ], + name: 'ERC20InsufficientAllowance', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'balance', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'needed', + type: 'uint256', + }, + ], + name: 'ERC20InsufficientBalance', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'approver', + type: 'address', + }, + ], + name: 'ERC20InvalidApprover', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'receiver', + type: 'address', + }, + ], + name: 'ERC20InvalidReceiver', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'sender', + type: 'address', + }, + ], + name: 'ERC20InvalidSender', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + ], + name: 'ERC20InvalidSpender', + type: 'error', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'timepoint', + type: 'uint256', + }, + { + internalType: 'uint48', + name: 'clock', + type: 'uint48', + }, + ], + name: 'ERC5805FutureLookup', + type: 'error', + }, + { + inputs: [], + name: 'ERC6372InconsistentClock', + type: 'error', + }, + { + inputs: [], + name: 'InsolventReward', + type: 'error', + }, + { + inputs: [], + name: 'InsufficientDelegateStake', + type: 'error', + }, + { + inputs: [], + name: 'InsufficientSelfStake', + type: 'error', + }, + { + inputs: [], + name: 'InsufficientStake', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + { + internalType: 'uint256', + name: 'currentNonce', + type: 'uint256', + }, + ], + name: 'InvalidAccountNonce', + type: 'error', + }, + { + inputs: [], + name: 'InvalidCommission', + type: 'error', + }, + { + inputs: [], + name: 'InvalidCuttingBoardWeights', + type: 'error', + }, + { + inputs: [], + name: 'InvalidInitialization', + type: 'error', + }, + { + inputs: [], + name: 'InvalidMaxIncentiveTokensCount', + type: 'error', + }, + { + inputs: [], + name: 'InvalidMinter', + type: 'error', + }, + { + inputs: [], + name: 'InvalidStartBlock', + type: 'error', + }, + { + inputs: [], + name: 'InvariantCheckFailed', + type: 'error', + }, + { + inputs: [], + name: 'MaxNumWeightsPerCuttingBoardIsZero', + type: 'error', + }, + { + inputs: [], + name: 'NoWhitelistedTokens', + type: 'error', + }, + { + inputs: [], + name: 'NotActionableBlock', + type: 'error', + }, + { + inputs: [], + name: 'NotApprovedSender', + type: 'error', + }, + { + inputs: [], + name: 'NotBGT', + type: 'error', + }, + { + inputs: [], + name: 'NotBlockRewardController', + type: 'error', + }, + { + inputs: [], + name: 'NotDelegate', + type: 'error', + }, + { + inputs: [], + name: 'NotDistributor', + type: 'error', + }, + { + inputs: [], + name: 'NotEnoughBalance', + type: 'error', + }, + { + inputs: [], + name: 'NotEnoughTime', + type: 'error', + }, + { + inputs: [], + name: 'NotFeeCollector', + type: 'error', + }, + { + inputs: [], + name: 'NotFriendOfTheChef', + type: 'error', + }, + { + inputs: [], + name: 'NotGovernance', + type: 'error', + }, + { + inputs: [], + name: 'NotInitializing', + type: 'error', + }, + { + inputs: [], + name: 'NotOperator', + type: 'error', + }, + { + inputs: [], + name: 'NotProver', + type: 'error', + }, + { + inputs: [], + name: 'NotRootFollower', + type: 'error', + }, + { + inputs: [], + name: 'NotValidatorOrOperator', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + ], + name: 'OwnableInvalidOwner', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'OwnableUnauthorizedAccount', + type: 'error', + }, + { + inputs: [], + name: 'PayoutAmountIsZero', + type: 'error', + }, + { + inputs: [], + name: 'PayoutTokenIsZero', + type: 'error', + }, + { + inputs: [], + name: 'QueuedCuttingBoardNotFound', + type: 'error', + }, + { + inputs: [], + name: 'QueuedCuttingBoardNotReady', + type: 'error', + }, + { + inputs: [], + name: 'RewardCycleNotEnded', + type: 'error', + }, + { + inputs: [ + { + internalType: 'uint8', + name: 'bits', + type: 'uint8', + }, + { + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + ], + name: 'SafeCastOverflowedUintDowncast', + type: 'error', + }, + { + inputs: [], + name: 'StakeAmountIsZero', + type: 'error', + }, + { + inputs: [], + name: 'TokenAlreadyWhitelistedOrLimitReached', + type: 'error', + }, + { + inputs: [], + name: 'TokenNotWhitelisted', + type: 'error', + }, + { + inputs: [], + name: 'TooManyWeights', + type: 'error', + }, + { + inputs: [], + name: 'TotalSupplyOverflow', + type: 'error', + }, + { + inputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + name: 'Unauthorized', + type: 'error', + }, + { + inputs: [], + name: 'VaultAlreadyExists', + type: 'error', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'expiry', + type: 'uint256', + }, + ], + name: 'VotesExpiredSignature', + type: 'error', + }, + { + inputs: [], + name: 'WithdrawAmountIsZero', + type: 'error', + }, + { + inputs: [], + name: 'ZeroAddress', + type: 'error', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'validator', + type: 'address', + }, + { + indexed: false, + internalType: 'uint128', + name: 'amount', + type: 'uint128', + }, + ], + name: 'ActivateBoost', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + ], + name: 'Approval', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'previous', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'current', + type: 'address', + }, + ], + name: 'BeraChefChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'validator', + type: 'address', + }, + { + indexed: false, + internalType: 'uint128', + name: 'amount', + type: 'uint128', + }, + ], + name: 'CancelBoost', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'delegator', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'fromDelegate', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'toDelegate', + type: 'address', + }, + ], + name: 'DelegateChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'delegate', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'previousVotes', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'newVotes', + type: 'uint256', + }, + ], + name: 'DelegateVotesChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'validator', + type: 'address', + }, + { + indexed: false, + internalType: 'uint128', + name: 'amount', + type: 'uint128', + }, + ], + name: 'DropBoost', + type: 'event', + }, + { + anonymous: false, + inputs: [], + name: 'EIP712DomainChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: 'uint64', + name: 'version', + type: 'uint64', + }, + ], + name: 'Initialized', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'previous', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'current', + type: 'address', + }, + ], + name: 'MinterChanged', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'previousOwner', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'OwnershipTransferred', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'validator', + type: 'address', + }, + { + indexed: false, + internalType: 'uint128', + name: 'amount', + type: 'uint128', + }, + ], + name: 'QueueBoost', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'from', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'receiver', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'Redeem', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + indexed: false, + internalType: 'bool', + name: 'approved', + type: 'bool', + }, + ], + name: 'SenderWhitelisted', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'from', + type: 'address', + }, + { + indexed: true, + internalType: 'address', + name: 'to', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'value', + type: 'uint256', + }, + ], + name: 'Transfer', + type: 'event', + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: 'address', + name: 'validator', + type: 'address', + }, + { + indexed: false, + internalType: 'uint256', + name: 'oldRate', + type: 'uint256', + }, + { + indexed: false, + internalType: 'uint256', + name: 'newRate', + type: 'uint256', + }, + ], + name: 'UpdateCommission', + type: 'event', + }, + { + inputs: [], + name: 'CLOCK_MODE', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'validator', + type: 'address', + }, + ], + name: 'activateBoost', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + ], + name: 'allowance', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'spender', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'approve', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'balanceOf', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'beraChef', + outputs: [ + { + internalType: 'contract IBeraChef', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + { + internalType: 'address', + name: 'validator', + type: 'address', + }, + ], + name: 'boosted', + outputs: [ + { + internalType: 'uint128', + name: '', + type: 'uint128', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + { + internalType: 'address', + name: 'validator', + type: 'address', + }, + ], + name: 'boostedQueue', + outputs: [ + { + internalType: 'uint32', + name: 'blockNumberLast', + type: 'uint32', + }, + { + internalType: 'uint128', + name: 'balance', + type: 'uint128', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'validator', + type: 'address', + }, + { + internalType: 'uint256', + name: 'rewardRate', + type: 'uint256', + }, + ], + name: 'boostedRewardRate', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'validator', + type: 'address', + }, + ], + name: 'boostees', + outputs: [ + { + internalType: 'uint128', + name: '', + type: 'uint128', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'boosts', + outputs: [ + { + internalType: 'uint128', + name: '', + type: 'uint128', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'validator', + type: 'address', + }, + { + internalType: 'uint128', + name: 'amount', + type: 'uint128', + }, + ], + name: 'cancelBoost', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + { + internalType: 'uint32', + name: 'pos', + type: 'uint32', + }, + ], + name: 'checkpoints', + outputs: [ + { + components: [ + { + internalType: 'uint48', + name: '_key', + type: 'uint48', + }, + { + internalType: 'uint208', + name: '_value', + type: 'uint208', + }, + ], + internalType: 'struct Checkpoints.Checkpoint208', + name: '', + type: 'tuple', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'clock', + outputs: [ + { + internalType: 'uint48', + name: '', + type: 'uint48', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'validator', + type: 'address', + }, + { + internalType: 'uint256', + name: 'rewardRate', + type: 'uint256', + }, + ], + name: 'commissionRewardRate', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'validator', + type: 'address', + }, + ], + name: 'commissions', + outputs: [ + { + internalType: 'uint32', + name: 'blockNumberLast', + type: 'uint32', + }, + { + internalType: 'uint224', + name: 'rate', + type: 'uint224', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'decimals', + outputs: [ + { + internalType: 'uint8', + name: '', + type: 'uint8', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'delegatee', + type: 'address', + }, + ], + name: 'delegate', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'delegatee', + type: 'address', + }, + { + internalType: 'uint256', + name: 'nonce', + type: 'uint256', + }, + { + internalType: 'uint256', + name: 'expiry', + type: 'uint256', + }, + { + internalType: 'uint8', + name: 'v', + type: 'uint8', + }, + { + internalType: 'bytes32', + name: 'r', + type: 'bytes32', + }, + { + internalType: 'bytes32', + name: 's', + type: 'bytes32', + }, + ], + name: 'delegateBySig', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'delegates', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'validator', + type: 'address', + }, + { + internalType: 'uint128', + name: 'amount', + type: 'uint128', + }, + ], + name: 'dropBoost', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'eip712Domain', + outputs: [ + { + internalType: 'bytes1', + name: 'fields', + type: 'bytes1', + }, + { + internalType: 'string', + name: 'name', + type: 'string', + }, + { + internalType: 'string', + name: 'version', + type: 'string', + }, + { + internalType: 'uint256', + name: 'chainId', + type: 'uint256', + }, + { + internalType: 'address', + name: 'verifyingContract', + type: 'address', + }, + { + internalType: 'bytes32', + name: 'salt', + type: 'bytes32', + }, + { + internalType: 'uint256[]', + name: 'extensions', + type: 'uint256[]', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'uint256', + name: 'timepoint', + type: 'uint256', + }, + ], + name: 'getPastTotalSupply', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + { + internalType: 'uint256', + name: 'timepoint', + type: 'uint256', + }, + ], + name: 'getPastVotes', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'getVotes', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + ], + name: 'initialize', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'sender', + type: 'address', + }, + ], + name: 'isWhitelistedSender', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'distributor', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'mint', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'minter', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'name', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'pure', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'owner', + type: 'address', + }, + ], + name: 'nonces', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'numCheckpoints', + outputs: [ + { + internalType: 'uint32', + name: '', + type: 'uint32', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'owner', + outputs: [ + { + internalType: 'address', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'validator', + type: 'address', + }, + { + internalType: 'uint128', + name: 'amount', + type: 'uint128', + }, + ], + name: 'queueBoost', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'queuedBoost', + outputs: [ + { + internalType: 'uint128', + name: '', + type: 'uint128', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'receiver', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'redeem', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'renounceOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_beraChef', + type: 'address', + }, + ], + name: 'setBeraChef', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'validator', + type: 'address', + }, + { + internalType: 'uint256', + name: 'rate', + type: 'uint256', + }, + ], + name: 'setCommission', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_minter', + type: 'address', + }, + ], + name: 'setMinter', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: '_staker', + type: 'address', + }, + ], + name: 'setStaker', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [], + name: 'staker', + outputs: [ + { + internalType: 'contract BGTStaker', + name: '', + type: 'address', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'symbol', + outputs: [ + { + internalType: 'string', + name: '', + type: 'string', + }, + ], + stateMutability: 'pure', + type: 'function', + }, + { + inputs: [], + name: 'totalBoosts', + outputs: [ + { + internalType: 'uint128', + name: '', + type: 'uint128', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [], + name: 'totalSupply', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'transfer', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'from', + type: 'address', + }, + { + internalType: 'address', + name: 'to', + type: 'address', + }, + { + internalType: 'uint256', + name: 'amount', + type: 'uint256', + }, + ], + name: 'transferFrom', + outputs: [ + { + internalType: 'bool', + name: '', + type: 'bool', + }, + ], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'newOwner', + type: 'address', + }, + ], + name: 'transferOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'account', + type: 'address', + }, + ], + name: 'unboostedBalanceOf', + outputs: [ + { + internalType: 'uint256', + name: '', + type: 'uint256', + }, + ], + stateMutability: 'view', + type: 'function', + }, + { + inputs: [ + { + internalType: 'address', + name: 'sender', + type: 'address', + }, + { + internalType: 'bool', + name: 'approved', + type: 'bool', + }, + ], + name: 'whitelistSender', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, +] as const; diff --git a/berrachain/src/constants/errors.ts b/berrachain/src/constants/errors.ts new file mode 100644 index 0000000..5540bd5 --- /dev/null +++ b/berrachain/src/constants/errors.ts @@ -0,0 +1,16 @@ +export const ERROR_MESSAGES = { + NETWORK_ERR: 'Invalid network', + + ADDRESS_FORMAT_ERROR: 'Invalid Berrachain address format', + BALANCE_ERROR: 'An error occurred while getting the balance', + BOOSTED_ERROR: 'An error occurred while getting the boosted balance', + BOOSTS_ERROR: 'An error occurred while getting all boosts', + BOOST_QUEUE_ERROR: 'An error occurred while getting boost queue', + + ACTIVATE_BOOST_ERROR: 'An error occurred while making boost tx data', + CANCEL_BOOST_ERROR: 'An error occurred while making cancel boost tx data', + DROP_BOOST_ERROR: 'An error occurred while making drop boost tx data', + BOOST_ERROR: 'An error occurred while making boost tx data', +}; + +export const ORIGINAL_ERROR_MESSAGES = {}; diff --git a/berrachain/src/constants/index.ts b/berrachain/src/constants/index.ts new file mode 100644 index 0000000..ecc6d92 --- /dev/null +++ b/berrachain/src/constants/index.ts @@ -0,0 +1,6 @@ +export const BERA_TESTNET_VALIDATOR = + '0x6f06dD615817886E8e1c3Cb837BF69F94e903472'; +export const BERA_TESTNET_BGT_CONTRACT_ADDRESS = + '0xbda130737bdd9618301681329bf2e46a016ff9ad'; + +export const BERA_GAS_RESERVE = 220000; diff --git a/berrachain/src/index.ts b/berrachain/src/index.ts new file mode 100644 index 0000000..a621c44 --- /dev/null +++ b/berrachain/src/index.ts @@ -0,0 +1,281 @@ +import { Blockchain } from '../../utils'; +import { Network, Transaction } from './types'; +import Web3 from 'web3'; +import { HttpProvider } from 'web3'; +import type { Contract } from 'web3'; +import { ABI } from './bgt'; +import { + BERA_GAS_RESERVE, + BERA_TESTNET_BGT_CONTRACT_ADDRESS, + BERA_TESTNET_VALIDATOR, +} from './constants'; + +import { ERROR_MESSAGES, ORIGINAL_ERROR_MESSAGES } from './constants/errors'; + +/** + * The `Berrachain` class extends the `Blockchain` class and provides methods for interacting with the Berrachain network. + * + * It allows you to select a network, initialize it, and retrieve the balance of the contract. + * + * @property {string} validator - The address of the validator. + * @property {Web3} web3 - The Web3 instance used for interacting with the Ethereum network. + * @property {string} btgAddress - The address of the BTG contract. + * @property {Contract} btg - The BTG contract instance. + * @property ERROR_MESSAGES - The error messages for the Berrachain class. + * @property ORIGINAL_ERROR_MESSAGES - The original error messages for the Berrachain class. + * + */ +export class Berrachain extends Blockchain { + private validator: string; + private web3!: Web3; + private readonly btgAddress: string; + private btg!: Contract; + + protected ERROR_MESSAGES = ERROR_MESSAGES; + protected ORIGINAL_ERROR_MESSAGES = ORIGINAL_ERROR_MESSAGES; + + constructor(network: Network, rpc: string) { + super(); + switch (network) { + case 'testnet': + this.validator = BERA_TESTNET_VALIDATOR; + this.btgAddress = BERA_TESTNET_BGT_CONTRACT_ADDRESS; + break; + default: + throw this.throwError('NETWORK_ERROR'); + } + const httpProvider = new HttpProvider(rpc); + this.web3 = new Web3(httpProvider); + this.btg = new this.web3.eth.Contract(ABI, this.btgAddress); + } + + /** + * Retrieves the balance of the user by address + * + * @param address - The staker address + * @returns A Promise that resolves to the balance. + * + * @throws Will throw an error if the contract call fails. + */ + public async balanceOf(address: string): Promise { + try { + return await this.btg.methods.balanceOf(address).call(); + } catch (error) { + throw this.handleError('BALANCE_ERROR', error); + } + } + + /** + * Retrieves the boosted stake of the user by address + * + * @param address - The staker address + * @returns A Promise that resolves to the boosted stake. + * + * @throws Will throw an error if the contract call fails. + */ + public async boosted(address: string): Promise { + try { + return await this.btg.methods.boosted(this.validator, address).call(); + } catch (error) { + throw this.handleError('BOOSTED_ERROR', error); + } + } + + /** + * Retrieves all uses boosts by address + * + * @param address - The staker address + * @returns A Promise that resolves to the ball user's boosts. + * + * @throws Will throw an error if the contract call fails. + */ + public async boosts(address: string): Promise { + try { + return await this.btg.methods.boosts(address).call(); + } catch (error) { + throw this.handleError('BOOSTS_ERROR', error); + } + } + + /** + * Retrieves info about user's boost queue by address + * + * @param address - The staker address + * @returns A Promise that resolves to the balance in queue. + * + * @throws Will throw an error if the contract call fails. + */ + public async boostedQueue( + address: string, + ): Promise<{ lastBlock: number; balance: string }> { + try { + const result = await this.btg.methods + .boostedQueue(address, this.validator) + .call(); + + return { + lastBlock: Number(result[0]), + balance: result[1].toString(), + }; + } catch (error) { + throw this.handleError('BOOST_QUEUE_ERROR', error); + } + } + + /** + * Creates a transaction data for boost activation + * + * @param address - The staker address + * @returns A Promise that resolves to the transaction data + * + * @throws Will throw an error if the contract call fails. + */ + public async activateBoost(address: string): Promise { + try { + const gasConsumption = await this.btg.methods + .activateBoost(this.validator) + .estimateGas({ from: address }); + + return { + from: address, + to: this.btgAddress, + value: 0, + gasLimit: this.calculateGasLimit(gasConsumption), + data: this.btg.methods.activateBoost(this.validator).encodeABI(), + }; + } catch (error) { + throw this.handleError('ACTIVATE_BOOST_ERROR', error); + } + } + + /** + * Creates a transaction data for canceling boost queue + * + * @param address - The staker address + * @param amount - The amount of boost + * @returns A Promise that resolves to the transaction data + * + * @throws Will throw an error if the contract call fails. + */ + public async cancelBoost( + address: string, + amount: string, + ): Promise { + try { + if (!this.isAddress(address)) { + this.throwError('ADDRESS_FORMAT_ERROR'); + } + + const amountWei = this.web3.utils.toWei(amount, 'ether'); + + const gasConsumption = await this.btg.methods + .cancelBoost(this.validator, amountWei) + .estimateGas({ from: address }); + + return { + from: address, + to: this.btgAddress, + value: 0, + gasLimit: this.calculateGasLimit(gasConsumption), + data: this.btg.methods + .cancelBoost(this.validator, amountWei) + .encodeABI(), + }; + } catch (error) { + throw this.handleError('CANCEL_BOOST_ERROR', error); + } + } + + /** + * Creates a transaction data for drop boost (unstake) + * + * @param address - The staker address + * @param amount - The amount of boost + * @returns A Promise that resolves to the transaction data + * + * @throws Will throw an error if the contract call fails. + */ + public async dropBoost( + address: string, + amount: string, + ): Promise { + try { + if (!this.isAddress(address)) { + this.throwError('ADDRESS_FORMAT_ERROR'); + } + + const amountWei = this.web3.utils.toWei(amount, 'ether'); + + const gasConsumption = await this.btg.methods + .dropBoost(this.validator, amountWei) + .estimateGas({ from: address }); + + return { + from: address, + to: this.btgAddress, + value: 0, + gasLimit: this.calculateGasLimit(gasConsumption), + data: this.btg.methods.dropBoost(this.validator, amountWei).encodeABI(), + }; + } catch (error) { + throw this.handleError('DROP_BOOST_ERROR', error); + } + } + + /** + * Creates a transaction data for boost (staking) + * + * @param address - The staker address + * @param amount - The amount of boost + * @returns A Promise that resolves to the transaction data + * + * @throws Will throw an error if the contract call fails. + */ + public async boost(address: string, amount: string): Promise { + try { + if (!this.isAddress(address)) { + this.throwError('ADDRESS_FORMAT_ERROR'); + } + + const amountWei = this.web3.utils.toWei(amount, 'ether'); + + const gasConsumption = await this.btg.methods + .queueBoost(this.validator, amountWei) + .estimateGas({ from: address }); + + return { + from: address, + to: this.btgAddress, + value: 0, + gasLimit: this.calculateGasLimit(gasConsumption), + data: this.btg.methods + .queueBoost(this.validator, amountWei) + .encodeABI(), + }; + } catch (error) { + throw this.handleError('BOOST_ERROR', error); + } + } + + /** + * Calculates the gas limit by adding a predefined BERA_GAS_RESERVE to the given gas consumption. + * + * @param gasConsumption - The amount of gas consumed. + * + * @returns The calculated gas limit as a number. + */ + private calculateGasLimit(gasConsumption: bigint): number { + return Number(gasConsumption) + BERA_GAS_RESERVE; + } + + /** + * Checks if a given address has the basic requirements of an Berrachain address format. + * + * @param address - The Berrachain address to validate. + * + * @returns `true` if the address meets basic requirements, otherwise `false`. + */ + private isAddress(address: string): boolean { + return /^(0x)?([0-9a-f]{40})$/.test(address.toLowerCase()); + } +} diff --git a/berrachain/src/types/index.ts b/berrachain/src/types/index.ts new file mode 100644 index 0000000..b8c6dc3 --- /dev/null +++ b/berrachain/src/types/index.ts @@ -0,0 +1,9 @@ +export type Network = 'testnet'; + +export type Transaction = { + from: string; + to: string; + value: number; + gasLimit: number; + data: string; +}; diff --git a/utils/tsconfig.json b/berrachain/tsconfig.json similarity index 100% rename from utils/tsconfig.json rename to berrachain/tsconfig.json diff --git a/utils/README.md b/utils/README.md deleted file mode 100644 index ece69ba..0000000 --- a/utils/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Everstake Wallet SDK - utils library - -## Getting Started -```sh -$ npm install @everstake/wallet-sdk-utils -``` - diff --git a/utils/src/api.ts b/utils/api.ts similarity index 100% rename from utils/src/api.ts rename to utils/api.ts diff --git a/utils/src/constants/errors.ts b/utils/constants/errors.ts similarity index 100% rename from utils/src/constants/errors.ts rename to utils/constants/errors.ts diff --git a/utils/src/constants/index.ts b/utils/constants/index.ts similarity index 100% rename from utils/src/constants/index.ts rename to utils/constants/index.ts diff --git a/utils/src/index.ts b/utils/index.ts similarity index 100% rename from utils/src/index.ts rename to utils/index.ts