diff --git a/jest.config.cjs b/jest.config.cjs index e3b9a7bb..3d7181b2 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -1,5 +1,7 @@ const config = { - transformIgnorePatterns: ['node_modules/(?!minidenticons)'], + transformIgnorePatterns: [ + '/node_modules/(?!(@massalabs|big-varint|minidenticons)/)', + ], testEnvironment: 'jsdom', setupFilesAfterEnv: ['/jest.setup.ts'], }; diff --git a/package-lock.json b/package-lock.json index f0146d79..6d04dfb8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,14 +1,15 @@ { "name": "@massalabs/react-ui-kit", - "version": "0.0.4", + "version": "0.0.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@massalabs/react-ui-kit", - "version": "0.0.4", + "version": "0.0.5", "dependencies": { "@headlessui/react": "^1.7.15", + "@massalabs/massa-web3": "^5.0.0-next", "copy-to-clipboard": "^3.3.3", "currency.js": "^2.0.4", "minidenticons": "^4.2.1", @@ -71,7 +72,6 @@ "vite": "^4.5.3" }, "peerDependencies": { - "@massalabs/massa-web3": "^4.0.3-dev", "@massalabs/wallet-provider": "^2.0.1-dev", "@types/dot-object": "^2.1.6", "dot-object": "^2.1.5" @@ -3830,6 +3830,40 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@json-schema-spec/json-pointer": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@json-schema-spec/json-pointer/-/json-pointer-0.1.2.tgz", + "integrity": "sha512-BYY7IavBjwsWWSmVcMz2A9mKiDD9RvacnsItgmy1xV8cmgbtxFfKmKMtkVpD7pYtkx4mIW4800yZBXueVFIWPw==" + }, + "node_modules/@json-schema-tools/dereferencer": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@json-schema-tools/dereferencer/-/dereferencer-1.5.1.tgz", + "integrity": "sha512-CUpdGpxNTq1ebMkrgVxS03FHfwkGiw63c+GNzqFAqwqsxR0OsR79aqK8h2ybxTIEhdwiaknSnlUgtUIy7FJ+3A==", + "dependencies": { + "@json-schema-tools/reference-resolver": "^1.2.1", + "@json-schema-tools/traverse": "^1.7.5", + "fast-safe-stringify": "^2.0.7" + } + }, + "node_modules/@json-schema-tools/meta-schema": { + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/@json-schema-tools/meta-schema/-/meta-schema-1.7.5.tgz", + "integrity": "sha512-8Hy6tuMC2BQdK7O4ilLovFB9t0j5o0L/sQTuWeg2CNYpITmPiFTRiG7Yb/jYd483D8784kxLFJ0dT+T4O2hNmw==" + }, + "node_modules/@json-schema-tools/reference-resolver": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@json-schema-tools/reference-resolver/-/reference-resolver-1.2.6.tgz", + "integrity": "sha512-4QZu5ROb5EpLSvV+buzk8WR30W+dffSNaKqD3VGFYJ3y0BLDi2OHoSz5e6NKcLYTyUYXV8IKxocNOszeVBJI4Q==", + "dependencies": { + "@json-schema-spec/json-pointer": "^0.1.2", + "isomorphic-fetch": "^3.0.0" + } + }, + "node_modules/@json-schema-tools/traverse": { + "version": "1.10.4", + "resolved": "https://registry.npmjs.org/@json-schema-tools/traverse/-/traverse-1.10.4.tgz", + "integrity": "sha512-9e42zjhLIxzBONroNC4SGsTqdB877tzwH2S6lqgTav9K24kWJR9vNieeMVSuyqnY8FlclH21D8wsm/tuD9WA9Q==" + }, "node_modules/@juggle/resize-observer": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/@juggle/resize-observer/-/resize-observer-3.4.0.tgz", @@ -3862,28 +3896,21 @@ } }, "node_modules/@massalabs/massa-web3": { - "version": "4.0.3-dev.20240522131036", - "resolved": "https://registry.npmjs.org/@massalabs/massa-web3/-/massa-web3-4.0.3-dev.20240522131036.tgz", - "integrity": "sha512-4W+XEOLF8vO6Z+TlPPm3uOrZPZdtVR3vG2A2b0nbCs3LkgBi6fpyhscFURV2sc7m16nH45BbskTLPC0JOMsKwg==", - "peer": true, + "version": "5.0.0-next.20240708144840", + "resolved": "https://registry.npmjs.org/@massalabs/massa-web3/-/massa-web3-5.0.0-next.20240708144840.tgz", + "integrity": "sha512-xgfMEI1rC1fBPfRzITYXLlBnbmQzxzm5E/nn4mx83EDekfsE/AQ5Tlmlg/QWZdilRCtBNqzA0d2B6LoJxpJNZg==", "dependencies": { - "@massalabs/wallet-provider": "^2.0.0", - "@massalabs/web3-utils": "^1.4.10", "@noble/ed25519": "^1.7.3", "@noble/hashes": "^1.2.0", - "@types/ws": "^8.5.4", - "@web3pack/base58-check": "^1.0.3", - "axios": "^0.26.1", - "bignumber.js": "^9.1.1", - "bip39": "^3.0.4", + "@open-rpc/client-js": "^1.8.1", + "@open-rpc/schema-utils-js": "1.15.0", + "big-varint": "^0.1.3", "bs58check": "^3.0.1", - "buffer": "^6.0.3", - "crypto-js": "^4.1.1", + "decimal.js": "^10.4.3", "dotenv": "^16.0.3", - "js-base64": "^3.7.5", + "secure-random": "^1.1.2", "string_decoder": "^1.3.0", "tslib": "^2.5.2", - "util": "^0.12.5", "varint": "^6.0.0" }, "optionalDependencies": { @@ -3891,65 +3918,6 @@ "utf-8-validate": "^6.0.2" } }, - "node_modules/@massalabs/massa-web3/node_modules/@massalabs/wallet-provider": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@massalabs/wallet-provider/-/wallet-provider-2.0.0.tgz", - "integrity": "sha512-3BKtYszSfKMOi85cxOB1q60uiMWYmdteV28stx2NjT42VtSyKOuWiTJq4KaWbf3ov+fkg+/HknXdl5bhDghbSQ==", - "peer": true, - "dependencies": { - "@hicaru/bearby.js": "^0.5.7", - "@massalabs/web3-utils": "^1.4.9-dev", - "axios": "^0.28.0", - "bs58check": "^3.0.1", - "buffer": "^6.0.3", - "uid": "^2.0.1" - }, - "optionalDependencies": { - "bufferutil": "^4.0.7", - "utf-8-validate": "^6.0.2" - } - }, - "node_modules/@massalabs/massa-web3/node_modules/@massalabs/wallet-provider/node_modules/axios": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.28.1.tgz", - "integrity": "sha512-iUcGA5a7p0mVb4Gm/sy+FSECNkPFT4y7wt6OM/CDpO/OnNCvSs3PoMG8ibrC9jRoGYU0gUK5pXVC4NPXq6lHRQ==", - "peer": true, - "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, - "node_modules/@massalabs/massa-web3/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "peer": true, - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "node_modules/@massalabs/massa-web3/node_modules/proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "peer": true - }, "node_modules/@massalabs/prettier-config-as": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/@massalabs/prettier-config-as/-/prettier-config-as-0.0.2.tgz", @@ -4133,8 +4101,7 @@ "type": "individual", "url": "https://paulmillr.com/funding/" } - ], - "peer": true + ] }, "node_modules/@noble/hashes": { "version": "1.3.2", @@ -4179,6 +4146,87 @@ "node": ">= 8" } }, + "node_modules/@open-rpc/client-js": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@open-rpc/client-js/-/client-js-1.8.1.tgz", + "integrity": "sha512-vV+Hetl688nY/oWI9IFY0iKDrWuLdYhf7OIKI6U1DcnJV7r4gAgwRJjEr1QVYszUc0gjkHoQJzqevmXMGLyA0g==", + "dependencies": { + "isomorphic-fetch": "^3.0.0", + "isomorphic-ws": "^5.0.0", + "strict-event-emitter-types": "^2.0.0", + "ws": "^7.0.0" + } + }, + "node_modules/@open-rpc/client-js/node_modules/utf-8-validate": { + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", + "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", + "hasInstallScript": true, + "optional": true, + "peer": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, + "node_modules/@open-rpc/client-js/node_modules/ws": { + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/@open-rpc/meta-schema": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/@open-rpc/meta-schema/-/meta-schema-1.14.2.tgz", + "integrity": "sha512-vD4Nbkrb7wYFRcSQf+j228LwOy1C6/KKpy5NADlpMElGrAWPRxhTa2yTi6xG+x88OHzg2+cydQ0GAD6o40KUcg==" + }, + "node_modules/@open-rpc/schema-utils-js": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/@open-rpc/schema-utils-js/-/schema-utils-js-1.15.0.tgz", + "integrity": "sha512-YHTt3n3RZo1lRy8oknn2G1y0PWlo7HWtnwLOKfvVxjauKMOmlvBbpPHQZibpzIhgt+yPe4mht1ldhKOwq2tCUw==", + "dependencies": { + "@json-schema-tools/dereferencer": "1.5.1", + "@json-schema-tools/meta-schema": "^1.6.10", + "@json-schema-tools/reference-resolver": "^1.2.1", + "@open-rpc/meta-schema": "1.14.2", + "ajv": "^6.10.0", + "detect-node": "^2.0.4", + "fast-safe-stringify": "^2.0.7", + "fs-extra": "^9.0.0", + "is-url": "^1.2.4", + "isomorphic-fetch": "^3.0.0" + } + }, + "node_modules/@open-rpc/schema-utils-js/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@peculiar/asn1-schema": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-2.3.6.tgz", @@ -7802,47 +7850,6 @@ "web-streams-polyfill": "^3.1.1" } }, - "node_modules/@web3pack/base-x": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@web3pack/base-x/-/base-x-1.0.2.tgz", - "integrity": "sha512-P3XgVnEQ1QFyUTmHzT1sXNprLyxE1aG8WAnk5/Fj+3j4AmsK4dRfMdV3t/aIdYP3i1KvjPRkQJhFXGpxUc+M8A==", - "peer": true - }, - "node_modules/@web3pack/base58-check": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@web3pack/base58-check/-/base58-check-1.0.3.tgz", - "integrity": "sha512-+s4HKOnJbIkj45jhGfSxgWkKsjBENuNbfqASPTLPy/yjGGv/jGCxzFCl0fb4gudV3x0gS50gLpJsC8qQ6cV1gw==", - "peer": true, - "dependencies": { - "@web3pack/base-x": "^1.0.1", - "buffer": "^6.0.3", - "hash.js": "^1.1.7" - } - }, - "node_modules/@web3pack/base58-check/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "peer": true, - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, "node_modules/@webassemblyjs/ast": { "version": "1.11.6", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz", @@ -8232,7 +8239,6 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -8574,7 +8580,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "dev": true, "engines": { "node": ">= 4.0.0" } @@ -8620,6 +8625,7 @@ "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" }, @@ -8645,15 +8651,6 @@ "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==", "dev": true }, - "node_modules/axios": { - "version": "0.26.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", - "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", - "peer": true, - "dependencies": { - "follow-redirects": "^1.14.8" - } - }, "node_modules/babel-core": { "version": "7.0.0-bridge.0", "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-7.0.0-bridge.0.tgz", @@ -8853,8 +8850,7 @@ "node_modules/base-x": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", - "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==", - "peer": true + "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" }, "node_modules/base64-js": { "version": "1.5.1", @@ -8905,6 +8901,11 @@ "node": ">=0.6" } }, + "node_modules/big-varint": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/big-varint/-/big-varint-0.1.3.tgz", + "integrity": "sha512-HgJQG8DtWAaYtrXTCasQukrMO0jbtQpd4BPEjr+JHoLRrbyIr8IxrMp01OZVJCoZBdqGynGHvp2iz0mabXz6dA==" + }, "node_modules/big.js": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", @@ -8942,15 +8943,6 @@ "wasm2js": "bin/wasm2js" } }, - "node_modules/bip39": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.1.0.tgz", - "integrity": "sha512-c9kiwdk45Do5GL0vJMe7tS95VjCii65mYAH7DfWl3uW8AVzXKQVUm64i3hzVybBDMp9r7j9iNxR85+ul8MdN/A==", - "peer": true, - "dependencies": { - "@noble/hashes": "^1.2.0" - } - }, "node_modules/bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -9110,7 +9102,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", - "peer": true, "dependencies": { "base-x": "^4.0.0" } @@ -9119,7 +9110,6 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-3.0.1.tgz", "integrity": "sha512-hjuuJvoWEybo7Hn/0xOrczQKKEKD63WguEjlhLExYs2wUBcebDC1jDNK17eEAD2lYfw82d5ASC1d7K3SWszjaQ==", - "peer": true, "dependencies": { "@noble/hashes": "^1.2.0", "bs58": "^5.0.0" @@ -9179,7 +9169,6 @@ "integrity": "sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==", "hasInstallScript": true, "optional": true, - "peer": true, "dependencies": { "node-gyp-build": "^4.3.0" }, @@ -9309,6 +9298,7 @@ "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", @@ -10071,12 +10061,6 @@ "node": ">= 8" } }, - "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==", - "peer": true - }, "node_modules/crypto-random-string": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", @@ -10491,8 +10475,7 @@ "node_modules/decimal.js": { "version": "10.4.3", "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz", - "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==", - "dev": true + "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==" }, "node_modules/dedent": { "version": "1.5.1", @@ -10584,6 +10567,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, "dependencies": { "es-define-property": "^1.0.0", "es-errors": "^1.3.0", @@ -10704,6 +10688,11 @@ "node": ">=8" } }, + "node_modules/detect-node": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", + "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==" + }, "node_modules/detect-node-es": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz", @@ -11122,6 +11111,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dev": true, "dependencies": { "get-intrinsic": "^1.2.4" }, @@ -11133,6 +11123,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, "engines": { "node": ">= 0.4" } @@ -11937,8 +11928,7 @@ "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "node_modules/fast-glob": { "version": "3.3.1", @@ -11969,8 +11959,7 @@ "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, "node_modules/fast-levenshtein": { "version": "2.0.6", @@ -11978,6 +11967,11 @@ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true }, + "node_modules/fast-safe-stringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==" + }, "node_modules/fastq": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", @@ -12279,6 +12273,7 @@ "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" } @@ -12470,6 +12465,7 @@ "version": "1.2.4", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "dev": true, "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2", @@ -12698,6 +12694,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", + "dev": true, "dependencies": { "get-intrinsic": "^1.1.3" }, @@ -12708,8 +12705,7 @@ "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "devOptional": true + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" }, "node_modules/graphemer": { "version": "1.4.0", @@ -12787,6 +12783,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, "dependencies": { "es-define-property": "^1.0.0" }, @@ -12798,6 +12795,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "dev": true, "engines": { "node": ">= 0.4" }, @@ -12809,6 +12807,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true, "engines": { "node": ">= 0.4" }, @@ -12820,6 +12819,7 @@ "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" }, @@ -12830,20 +12830,11 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "peer": true, - "dependencies": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, "node_modules/hasown": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, "dependencies": { "function-bind": "^1.1.2" }, @@ -13237,6 +13228,7 @@ "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" @@ -13312,6 +13304,7 @@ "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" }, @@ -13408,6 +13401,7 @@ "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" }, @@ -13630,6 +13624,7 @@ "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" }, @@ -13658,6 +13653,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-url": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/is-url/-/is-url-1.2.4.tgz", + "integrity": "sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==" + }, "node_modules/is-weakmap": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", @@ -13720,6 +13720,15 @@ "node": ">=0.10.0" } }, + "node_modules/isomorphic-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", + "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", + "dependencies": { + "node-fetch": "^2.6.1", + "whatwg-fetch": "^3.4.1" + } + }, "node_modules/isomorphic-ws": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz", @@ -15813,12 +15822,6 @@ "integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==", "dev": true }, - "node_modules/js-base64": { - "version": "3.7.7", - "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.7.tgz", - "integrity": "sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw==", - "peer": true - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -16063,8 +16066,7 @@ "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -16099,7 +16101,6 @@ "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, "dependencies": { "universalify": "^2.0.0" }, @@ -17182,12 +17183,6 @@ "node": ">=15.14.0" } }, - "node_modules/minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "peer": true - }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -17400,7 +17395,6 @@ "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dev": true, "dependencies": { "whatwg-url": "^5.0.0" }, @@ -17425,20 +17419,17 @@ "node_modules/node-fetch/node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dev": true + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, "node_modules/node-fetch/node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "dev": true + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, "node_modules/node-fetch/node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dev": true, "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" @@ -17449,7 +17440,6 @@ "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.1.tgz", "integrity": "sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw==", "optional": true, - "peer": true, "bin": { "node-gyp-build": "bin.js", "node-gyp-build-optional": "optional.js", @@ -18070,6 +18060,7 @@ "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" } @@ -18502,7 +18493,6 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", - "dev": true, "engines": { "node": ">=6" } @@ -19647,6 +19637,11 @@ "url": "https://opencollective.com/webpack" } }, + "node_modules/secure-random": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/secure-random/-/secure-random-1.1.2.tgz", + "integrity": "sha512-H2bdSKERKdBV1SwoqYm6C0y+9EA94v6SUBOWO8kDndc4NoUih7Dv6Tsgma7zO1lv27wIvjlD0ZpMQk7um5dheQ==" + }, "node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -19757,6 +19752,7 @@ "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", @@ -20124,6 +20120,11 @@ "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==", "dev": true }, + "node_modules/strict-event-emitter-types": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strict-event-emitter-types/-/strict-event-emitter-types-2.0.0.tgz", + "integrity": "sha512-Nk/brWYpD85WlOgzw5h173aci0Teyv8YdIAEtV+N88nDB0dLlazZyJMIsN6eo1/AR61l+p6CJTG1JIyFaoNEEA==" + }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -21168,7 +21169,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "dev": true, "engines": { "node": ">= 10.0.0" } @@ -21248,7 +21248,6 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, "dependencies": { "punycode": "^2.1.0" } @@ -21333,7 +21332,6 @@ "integrity": "sha512-xu9GQDeFp+eZ6LnCywXN/zBancWvOpUMzgjLPSjy4BRHSmTelvn2E0DG0o1sTiw5hkCKBHo8rwSKncfRfv2EEQ==", "hasInstallScript": true, "optional": true, - "peer": true, "dependencies": { "node-gyp-build": "^4.3.0" }, @@ -21345,6 +21343,7 @@ "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", @@ -21413,8 +21412,7 @@ "node_modules/varint": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", - "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", - "peer": true + "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==" }, "node_modules/vary": { "version": "1.1.2", @@ -21803,6 +21801,11 @@ "node": ">=0.10.0" } }, + "node_modules/whatwg-fetch": { + "version": "3.6.20", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz", + "integrity": "sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==" + }, "node_modules/whatwg-mimetype": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz", @@ -21875,6 +21878,7 @@ "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", diff --git a/package.json b/package.json index fc912767..32b0bef7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@massalabs/react-ui-kit", - "version": "0.0.4", + "version": "0.0.5", "type": "module", "files": ["src", "presets"], "main": "src/index.ts", @@ -26,6 +26,7 @@ }, "dependencies": { "@headlessui/react": "^1.7.15", + "@massalabs/massa-web3": "^5.0.0-next", "copy-to-clipboard": "^3.3.3", "currency.js": "^2.0.4", "minidenticons": "^4.2.1", @@ -41,7 +42,6 @@ "zustand": "^4.5.2" }, "peerDependencies": { - "@massalabs/massa-web3": "^4.0.3-dev", "@massalabs/wallet-provider": "^2.0.1-dev", "@types/dot-object": "^2.1.6", "dot-object": "^2.1.5" diff --git a/src/lib/ConnectMassaWallets/components/MASBalance.tsx b/src/lib/ConnectMassaWallets/components/MASBalance.tsx index 7ea99ac7..ac263695 100644 --- a/src/lib/ConnectMassaWallets/components/MASBalance.tsx +++ b/src/lib/ConnectMassaWallets/components/MASBalance.tsx @@ -4,7 +4,6 @@ import React from 'react'; import { useEffect, useState } from 'react'; -import { fromMAS } from '@massalabs/massa-web3'; import { IAccountBalanceResponse } from '@massalabs/wallet-provider'; import Intl from '../i18n'; @@ -13,6 +12,7 @@ import { FetchingLine } from '../../../components'; import { fetchMASBalance } from '../../massa-react/utils'; import { massaToken } from '../../massa-react/const'; import { formatAmount } from '../../util/parseAmount'; +import { Mas } from '@massalabs/massa-web3'; export function MASBalance() { const [balance, setBalance] = useState(); @@ -27,7 +27,7 @@ export function MASBalance() { }, [connectedAccount, setBalance]); const formattedBalance = formatAmount( - fromMAS(balance?.candidateBalance || '0').toString(), + Mas.fromString(balance?.candidateBalance || '0').toString(), 9, ).full; diff --git a/src/lib/ConnectMassaWallets/store/accountStore.ts b/src/lib/ConnectMassaWallets/store/accountStore.ts index c0aefc5a..634e3583 100644 --- a/src/lib/ConnectMassaWallets/store/accountStore.ts +++ b/src/lib/ConnectMassaWallets/store/accountStore.ts @@ -1,6 +1,4 @@ -import { Client, ClientFactory } from '@massalabs/massa-web3'; import { IAccount, IProvider } from '@massalabs/wallet-provider'; - import { SUPPORTED_MASSA_WALLETS } from '../../massa-react/const'; async function handleBearbyAccountChange( @@ -24,7 +22,6 @@ async function handleBearbyAccountChange( export interface AccountStoreState { connectedAccount?: IAccount; - massaClient?: Client; accounts?: IAccount[]; currentProvider?: IProvider; providers: IProvider[]; @@ -41,7 +38,6 @@ export interface AccountStoreState { setProviders: (providers: IProvider[]) => void; setConnectedAccount: (account?: IAccount) => void; - refreshMassaClient: () => void; } const accountStore = ( @@ -52,7 +48,6 @@ const accountStore = ( connectedAccount: undefined, accountObserver: undefined, networkObserver: undefined, - massaClient: undefined, currentProvider: undefined, providers: [], isFetching: false, @@ -81,7 +76,6 @@ const accountStore = ( if (!get().networkObserver) { const networkObserver = currentProvider.listenNetworkChanges( async () => { - get().refreshMassaClient(); set({ chainId: await currentProvider.getChainId() }); }, ); @@ -151,7 +145,6 @@ const accountStore = ( // if current provider is not in the new list of providers, unset it if (!providers.some((p) => p.name() === get().currentProvider?.name())) { set({ - massaClient: undefined, currentProvider: undefined, connectedAccount: undefined, accounts: undefined, @@ -165,29 +158,12 @@ const accountStore = ( if (connectedAccount) { const currentProvider = get().currentProvider; if (!currentProvider) throw new Error('No provider found'); - const provider = currentProvider; - // update the massa client with the new account - set({ - massaClient: await ClientFactory.fromWalletProvider( - provider, - connectedAccount, - ), - }); } }, refreshMassaClient: async () => { const provider = get().currentProvider; if (!provider) return; - - const connectedAccount = get().connectedAccount; - if (!connectedAccount) return; - set({ - massaClient: await ClientFactory.fromWalletProvider( - provider, - connectedAccount, - ), - }); }, }); diff --git a/src/lib/massa-react/hooks/useWriteSmartContract.tsx b/src/lib/massa-react/hooks/useWriteSmartContract.tsx index 30cd6f49..f33d0a99 100644 --- a/src/lib/massa-react/hooks/useWriteSmartContract.tsx +++ b/src/lib/massa-react/hooks/useWriteSmartContract.tsx @@ -1,15 +1,20 @@ import { useState } from 'react'; - -import { - Client, - EOperationStatus, - ICallData, - MAX_GAS_CALL, -} from '@massalabs/massa-web3'; import { toast, ToastContent } from '../../../components'; import { OperationToast } from '../../ConnectMassaWallets/components/OperationToast'; import { logSmartContractEvents } from '../utils'; import Intl from '../i18n'; +import { + IAccount, + IProvider, + ITransactionDetails, +} from '@massalabs/wallet-provider'; +import { + JsonRPCClient, + MAX_GAS_CALL, + Operation, + OperationStatus, +} from '@massalabs/massa-web3'; +import { Toast } from 'react-hot-toast'; interface ToasterMessage { pending: string; @@ -18,144 +23,162 @@ interface ToasterMessage { timeout?: string; } +// Utility function to get the minimum of two bigints function minBigInt(a: bigint, b: bigint) { return a < b ? a : b; } -export function useWriteSmartContract(client?: Client, isMainnet?: boolean) { +export function useWriteSmartContract( + account: IAccount, + provider: IProvider, + isMainnet?: boolean, +) { const [isPending, setIsPending] = useState(false); const [isOpPending, setIsOpPending] = useState(false); const [isSuccess, setIsSuccess] = useState(false); const [isError, setIsError] = useState(false); const [opId, setOpId] = useState(undefined); - function callSmartContract( + function resetState() { + setIsPending(false); + setIsOpPending(false); + setIsSuccess(false); + setIsError(false); + setOpId(undefined); + } + + async function gasEstimation( targetFunction: string, targetAddress: string, - parameter: number[], - messages: ToasterMessage, + parameter: Uint8Array, coins = BigInt(0), + ): Promise { + try { + const estimation = await account.readSc( + targetAddress, + targetFunction, + parameter, + coins, + 0n, + MAX_GAS_CALL, + ); + + const gasCost = BigInt(estimation.info.gas_cost); + return minBigInt(gasCost + (gasCost * 20n) / 100n, MAX_GAS_CALL); + } catch (error) { + console.error('Gas estimation failed:', error); + throw new Error('Failed to estimate gas.'); + } + } + + function showToast( + type: 'loading' | 'error' | 'success', + message: string, + operationId?: string, + duration = 5000, ) { - if (!client) { - throw new Error('Massa client not found'); + const content = (t: Toast) => ( + + + + ); + + if (type === 'loading') { + return toast.loading(content, { duration: Infinity }); + } else if (type === 'error') { + toast.error(content, { duration }); + } else { + toast.success(content, { duration }); } + } + + async function callSmartContract( + targetFunction: string, + targetAddress: string, + parameter: Uint8Array, + messages: ToasterMessage, + coins = BigInt(0), + ) { if (isOpPending) { throw new Error('Operation is already pending'); } - setIsSuccess(false); - setIsError(false); - setIsOpPending(false); - setIsPending(true); - let operationId: string | undefined; - let toastId: string | undefined; - - const callData = { - targetAddress, - targetFunction, - parameter, - coins, - } as ICallData; - - client - .smartContracts() - .readSmartContract(callData) - .then((response) => { - const gasCost = BigInt(response.info.gas_cost); - return minBigInt(gasCost + (gasCost * 20n) / 100n, MAX_GAS_CALL); - }) - .then((maxGas: bigint) => { - callData.maxGas = maxGas; - return client.smartContracts().callSmartContract(callData); - }) - .then((opId) => { + + let loadingToastId: string | undefined; + + try { + const publicClient = new JsonRPCClient(await provider.getNetwork()); + + let maxGas: bigint; + try { + maxGas = await gasEstimation( + targetFunction, + targetAddress, + parameter, + coins, + ); + } catch (error) { + console.error('Gas estimation failed:', error); + showToast('error', 'Gas estimation failed.'); + return; + } + + let operationId: string; + try { + const { operationId: opId } = (await account.callSC( + targetAddress, + targetFunction, + new Uint8Array(parameter), + coins, + 0n, + maxGas, + )) as ITransactionDetails; operationId = opId; setOpId(operationId); setIsOpPending(true); - toastId = toast.loading( - (t) => ( - - - - ), - { - duration: Infinity, - }, - ); - return client - .smartContracts() - .awaitMultipleRequiredOperationStatus(operationId, [ - EOperationStatus.SPECULATIVE_ERROR, - EOperationStatus.FINAL_ERROR, - EOperationStatus.FINAL_SUCCESS, - ]); - }) - .then((status: EOperationStatus) => { - if (status !== EOperationStatus.FINAL_SUCCESS) { - throw new Error('Operation failed', { cause: { status } }); - } - setIsSuccess(true); - setIsOpPending(false); - setIsPending(false); - toast.dismiss(toastId); - toast.success((t) => ( - - - - )); - }) - .catch((error) => { - console.error(error); - toast.dismiss(toastId); - setIsError(true); - setIsOpPending(false); - setIsPending(false); - - if (!operationId) { - console.error('Operation ID not found'); - toast.error((t) => ( - - - - )); - return; - } + } catch (error) { + console.error('Smart contract call failed:', error); + showToast('error', 'Smart contract call failed.'); + return; + } + + loadingToastId = showToast('loading', messages.pending, operationId); - if ( - [ - EOperationStatus.FINAL_ERROR, - EOperationStatus.SPECULATIVE_ERROR, - ].includes(error.cause?.status) - ) { - toast.error((t) => ( - - - - )); - logSmartContractEvents(client, operationId); - } else { - toast.error((t) => ( - - - - )); + try { + const op = new Operation(publicClient, operationId); + const finalStatus = await op.waitFinalExecution(); + if (finalStatus !== OperationStatus.Success) { + const errorMessage = `Operation failed with status: ${finalStatus}`; + console.error(errorMessage); + showToast('error', messages.error, operationId); + logSmartContractEvents(publicClient, operationId); + throw new Error(errorMessage); } - }); + } catch (error) { + console.error('Operation execution failed:', error); + showToast('error', messages.error, operationId); + logSmartContractEvents(publicClient, operationId); + return; + } + + setIsSuccess(true); + toast.dismiss(loadingToastId); + showToast('success', messages.success, operationId); + } catch (error) { + console.error('Error during smart contract call:', error); + setIsError(true); + toast.dismiss(loadingToastId); + showToast( + 'error', + messages.timeout || Intl.t('steps.failed-timeout'), + opId, + ); + } finally { + resetState(); + } } return { diff --git a/src/lib/massa-react/utils.ts b/src/lib/massa-react/utils.ts index cb3a5ee1..8d673c43 100644 --- a/src/lib/massa-react/utils.ts +++ b/src/lib/massa-react/utils.ts @@ -1,4 +1,3 @@ -import { Client } from '@massalabs/massa-web3'; import { IAccount, IAccountBalanceResponse } from '@massalabs/wallet-provider'; import { @@ -9,25 +8,18 @@ import { import Intl from './i18n'; import { toast } from '../../components'; -export function logSmartContractEvents( - client: Client, +import { Operation, PublicAPI } from '@massalabs/massa-web3'; + +export async function logSmartContractEvents( + client: PublicAPI, operationId: string, -): void { - client - .smartContracts() - .getFilteredScOutputEvents({ - emitter_address: null, - start: null, - end: null, - original_caller_address: null, - original_operation_id: operationId, - is_final: null, - }) - .then((events) => { - events.map((l) => - console.error(`opId ${operationId}: execution error ${l.data}`), - ); - }); +): Promise { + const op = new Operation(client, operationId); + const event = await op.getFinalEvents(); + + for (const e of event) { + console.error(`opId ${operationId}: ${e}`); + } } export function generateExplorerLink(opId: string, isMainnet = true): string { diff --git a/src/lib/util/checkAddressFormat.ts b/src/lib/util/checkAddressFormat.ts index 77741b90..f58643be 100644 --- a/src/lib/util/checkAddressFormat.ts +++ b/src/lib/util/checkAddressFormat.ts @@ -9,7 +9,7 @@ import { Address } from '@massalabs/massa-web3/'; export function checkAddressFormat(recipient: string): boolean { try { // eslint-disable-next-line no-new - new Address(recipient); + Address.fromString(recipient); } catch (error) { return false; }