diff --git a/front/package-lock.json b/front/package-lock.json index 8b17e97..7379469 100644 --- a/front/package-lock.json +++ b/front/package-lock.json @@ -8,9 +8,9 @@ "name": "autonomous-tips", "version": "0.0.0", "dependencies": { - "@massalabs/massa-web3": "^5.0.0-next", - "@massalabs/react-ui-kit": "^0.1.1-dev", - "@massalabs/wallet-provider": "^3.0.0-next", + "@massalabs/massa-web3": "^5.0.0", + "@massalabs/react-ui-kit": "^1.0.1-dev.20241106091332", + "@massalabs/wallet-provider": "^3.0.0", "copy-to-clipboard": "^3.3.3", "currency.js": "^2.0.4", "delay": "^6.0.0", @@ -58,10 +58,50 @@ "vite-plugin-image-optimizer": "^1.1.8" } }, + "../../wallet-provider": { + "name": "@massalabs/wallet-provider", + "version": "2.0.0", + "extraneous": true, + "license": "(MIT AND Apache-2.0)", + "dependencies": { + "@hicaru/bearby.js": "^0.5.9", + "@massalabs/massa-web3": "../massa-web3/", + "axios": "^0.28.0", + "bs58check": "^4.0.0", + "eventemitter3": "^5.0.1", + "lodash.isequal": "^4.5.0" + }, + "devDependencies": { + "@babel/preset-env": "^7.22.14", + "@massalabs/eslint-config": "^0.0.9", + "@playwright/test": "^1.36.2", + "@types/jest": "^29.5.4", + "@types/node": "^18.13.0", + "babel-jest": "^29.6.4", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-jsdoc": "^41.1.1", + "husky": "^9.1.4", + "is-ci": "^3.0.1", + "jest": "^29.6.4", + "jest-environment-jsdom": "^29.6.4", + "lint-staged": "^15.2.7", + "npm-run-all": "^4.1.5", + "prettier": "^3.0.3", + "prettier-eslint": "^15.0.1", + "prettier-plugin-organize-imports": "^3.2.4", + "rimraf": "^5.0.5", + "ts-jest": "^29.1.1", + "tslib": "^2.5.0", + "tslint": "^6.1.3", + "typedoc": "^0.23.25", + "typescript": "^4.9.5" + } + }, "node_modules/@adraffy/ens-normalize": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.11.0.tgz", - "integrity": "sha512-/3DDPKHqqIqxUULp8yP4zODUY1i+2xvVWsv8A79xGWdCAG+8sb0hRh0Rk2QyOJUnnbyPUAZYcpBuRe3nS2OIUg==" + "integrity": "sha512-/3DDPKHqqIqxUULp8yP4zODUY1i+2xvVWsv8A79xGWdCAG+8sb0hRh0Rk2QyOJUnnbyPUAZYcpBuRe3nS2OIUg==", + "license": "MIT" }, "node_modules/@alloc/quick-lru": { "version": "5.2.0", @@ -833,6 +873,7 @@ "version": "1.7.19", "resolved": "https://registry.npmjs.org/@headlessui/react/-/react-1.7.19.tgz", "integrity": "sha512-Ll+8q3OlMJfJbAKM/+/Y2q6PPYbryqNTXDbryx7SXLIDamkF6iQFbriYHga0dY44PvDhvvBWCx1Xj4U5+G4hOw==", + "license": "MIT", "dependencies": { "@tanstack/react-virtual": "^3.0.0-beta.60", "client-only": "^0.0.1" @@ -848,7 +889,8 @@ "node_modules/@hicaru/bearby.js": { "version": "0.5.9", "resolved": "https://registry.npmjs.org/@hicaru/bearby.js/-/bearby.js-0.5.9.tgz", - "integrity": "sha512-bAyPMklXovDsEkZH9cHO2LdhEqRGbFECQwHjezrRmt1kPmSqHvM+jmADucP14yrnID7ZV/lbMBM+WhmqRAfKhg==" + "integrity": "sha512-bAyPMklXovDsEkZH9cHO2LdhEqRGbFECQwHjezrRmt1kPmSqHvM+jmADucP14yrnID7ZV/lbMBM+WhmqRAfKhg==", + "license": "MIT" }, "node_modules/@humanwhocodes/config-array": { "version": "0.13.0", @@ -1637,9 +1679,10 @@ } }, "node_modules/@massalabs/massa-web3": { - "version": "5.0.0-next.20241015092154", - "resolved": "https://registry.npmjs.org/@massalabs/massa-web3/-/massa-web3-5.0.0-next.20241015092154.tgz", - "integrity": "sha512-PmXw4ABfMAqlZdAHIES1MEJ9acNc5RXRY9+7ezDBZM5KQ2grmQUHIT3jr6DZvCoSL0bhKnRYshLGO9jM1lXKpQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@massalabs/massa-web3/-/massa-web3-5.0.0.tgz", + "integrity": "sha512-O7aU61WYSJrv6+uQLJZzicv9f3XoKHMUzfibVDprU0LzaZejaHBRnpbiERJs6m3k4UHWBLYGpoW++lhRRspPkw==", + "license": "MIT", "dependencies": { "@noble/ed25519": "^1.7.3", "@noble/hashes": "^1.2.0", @@ -1649,6 +1692,7 @@ "eventemitter3": "^5.0.1", "lodash.isequal": "^4.5.0", "secure-random": "^1.1.2", + "tslib": "^2.8.0", "varint": "^6.0.0" }, "optionalDependencies": { @@ -1666,13 +1710,13 @@ } }, "node_modules/@massalabs/react-ui-kit": { - "version": "0.1.1-dev.20241015101242", - "resolved": "https://registry.npmjs.org/@massalabs/react-ui-kit/-/react-ui-kit-0.1.1-dev.20241015101242.tgz", - "integrity": "sha512-qRORWGb9oshW/JK+FyQchP3TZL9hfjyn0EN8yYcFOXy0e1Nm7bYTsS3oU9G9/ip45x03gY3T+ewkiKel9YGGOA==", + "version": "1.0.1-dev.20241106091332", + "resolved": "https://registry.npmjs.org/@massalabs/react-ui-kit/-/react-ui-kit-1.0.1-dev.20241106091332.tgz", + "integrity": "sha512-AKdlDHwbb/V3CLWvNw4uP4P4C01CbQipFlsu/oxAfp/6xX2uSIg3H4MumfrXd4qlsgx7r0XnQWLsAbpgoIUgRQ==", "dependencies": { "@headlessui/react": "^1.7.15", - "@massalabs/massa-web3": "^5.0.0-next", - "@massalabs/wallet-provider": "^3.0.0-next", + "@massalabs/massa-web3": "^5.0.0", + "@massalabs/wallet-provider": "^3.0.0", "copy-to-clipboard": "^3.3.3", "currency.js": "^2.0.4", "dot-object": "^2.1.5", @@ -1696,6 +1740,7 @@ "cpu": [ "arm" ], + "license": "MIT", "optional": true, "os": [ "android" @@ -1712,6 +1757,7 @@ "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "android" @@ -1728,6 +1774,7 @@ "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "android" @@ -1744,6 +1791,7 @@ "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "darwin" @@ -1760,6 +1808,7 @@ "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "darwin" @@ -1776,6 +1825,7 @@ "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "freebsd" @@ -1792,6 +1842,7 @@ "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "freebsd" @@ -1808,6 +1859,7 @@ "cpu": [ "arm" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -1824,6 +1876,7 @@ "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -1840,6 +1893,7 @@ "cpu": [ "ia32" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -1856,6 +1910,7 @@ "cpu": [ "loong64" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -1872,6 +1927,7 @@ "cpu": [ "mips64el" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -1888,6 +1944,7 @@ "cpu": [ "ppc64" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -1904,6 +1961,7 @@ "cpu": [ "riscv64" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -1920,6 +1978,7 @@ "cpu": [ "s390x" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -1936,6 +1995,7 @@ "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "linux" @@ -1952,6 +2012,7 @@ "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "netbsd" @@ -1968,6 +2029,7 @@ "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "openbsd" @@ -1984,6 +2046,7 @@ "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "sunos" @@ -2000,6 +2063,7 @@ "cpu": [ "arm64" ], + "license": "MIT", "optional": true, "os": [ "win32" @@ -2016,6 +2080,7 @@ "cpu": [ "ia32" ], + "license": "MIT", "optional": true, "os": [ "win32" @@ -2032,6 +2097,7 @@ "cpu": [ "x64" ], + "license": "MIT", "optional": true, "os": [ "win32" @@ -2046,6 +2112,7 @@ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", "integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==", "hasInstallScript": true, + "license": "MIT", "peer": true, "bin": { "esbuild": "bin/esbuild" @@ -2082,6 +2149,7 @@ "version": "3.29.5", "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.5.tgz", "integrity": "sha512-GVsDdsbJzzy4S/v3dqWPJ7EfvZJfCHiDqe80IyrF59LYuP+e6U1LJoUqeuqRbwAWoMNoXivMNeNAOf5E22VA1w==", + "license": "MIT", "peer": true, "bin": { "rollup": "dist/bin/rollup" @@ -2098,6 +2166,7 @@ "version": "1.2.6", "resolved": "https://registry.npmjs.org/tw-colors/-/tw-colors-1.2.6.tgz", "integrity": "sha512-/HI70siD+7/xNd52YuVtKN77As/ERrm/db6P6DJpdioZ06andLRbaMBWowHO6XagdVjZ9dBQRoQlqAENzCe8UA==", + "license": "MIT", "dependencies": { "color": "^4.2.3", "flat": "^5.0.2", @@ -2111,6 +2180,7 @@ "version": "4.5.5", "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.5.tgz", "integrity": "sha512-ifW3Lb2sMdX+WU91s3R0FyQlAyLxOzCSCP37ujw0+r5POeHPwe6udWVIElKQq8gk3t7b8rkmvqC6IHBpCff4GQ==", + "license": "MIT", "peer": true, "dependencies": { "esbuild": "^0.18.10", @@ -2166,6 +2236,7 @@ "version": "3.3.0", "resolved": "https://registry.npmjs.org/vite-plugin-svgr/-/vite-plugin-svgr-3.3.0.tgz", "integrity": "sha512-vWZMCcGNdPqgziYFKQ3Y95XP0d0YGp28+MM3Dp9cTa/px5CKcHHrIoPl2Jw81rgVm6/ZUNONzjXbZQZ7Kw66og==", + "license": "MIT", "dependencies": { "@rollup/pluginutils": "^5.0.4", "@svgr/core": "^8.1.0", @@ -2176,12 +2247,13 @@ } }, "node_modules/@massalabs/wallet-provider": { - "version": "3.0.0-next.20241016095620", - "resolved": "https://registry.npmjs.org/@massalabs/wallet-provider/-/wallet-provider-3.0.0-next.20241016095620.tgz", - "integrity": "sha512-tfsx5lmUabpUIFinIsYtH0XLq2Ev4kwXEo/GMPrnVEEq4uHDU7ZTO6MCWP2+64ccAcnYQSUM4TSs/XZL3YXztQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@massalabs/wallet-provider/-/wallet-provider-3.0.0.tgz", + "integrity": "sha512-PPLdOHiFholf4MOUWxvhhkMtxK2HBbcvmk4rg2VA5cGSP2GoQ+EtVkXZGI0r8gdmJXpmedEBi7yJAg/G67pvVA==", + "license": "(MIT AND Apache-2.0)", "dependencies": { "@hicaru/bearby.js": "^0.5.9", - "@massalabs/massa-web3": "^5.0.0-next", + "@massalabs/massa-web3": "^5.0.0", "axios": "^0.28.0", "bs58check": "^4.0.0", "eventemitter3": "^5.0.1", @@ -2223,6 +2295,7 @@ "version": "1.6.0", "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.6.0.tgz", "integrity": "sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==", + "license": "MIT", "dependencies": { "@noble/hashes": "1.5.0" }, @@ -2242,12 +2315,14 @@ "type": "individual", "url": "https://paulmillr.com/funding/" } - ] + ], + "license": "MIT" }, "node_modules/@noble/hashes": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", + "license": "MIT", "engines": { "node": "^14.21.3 || >=16" }, @@ -2560,6 +2635,7 @@ "version": "1.1.9", "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "license": "MIT", "funding": { "url": "https://paulmillr.com/funding/" } @@ -2568,6 +2644,7 @@ "version": "1.5.0", "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.5.0.tgz", "integrity": "sha512-8EnFYkqEQdnkuGBVpCzKxyIwDCBLDVj3oiX0EKUFre/tOjL/Hqba1D6n/8RcmaQy4f95qQFrO2A8Sr6ybh4NRw==", + "license": "MIT", "dependencies": { "@noble/curves": "~1.6.0", "@noble/hashes": "~1.5.0", @@ -2581,6 +2658,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.4.0.tgz", "integrity": "sha512-BEEm6p8IueV/ZTfQLp/0vhw4NPnT9oWf5+28nvmeUICjP99f4vr2d+qc7AVGDDtwRep6ifR43Yed9ERVmiITzw==", + "license": "MIT", "dependencies": { "@noble/hashes": "~1.5.0", "@scure/base": "~1.1.8" @@ -2593,6 +2671,7 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-8.0.0.tgz", "integrity": "sha512-b9MIk7yhdS1pMCZM8VeNfUlSKVRhsHZNMl5O9SfaX0l0t5wjdgu4IDzGB8bpnGBBOjGST3rRFVsaaEtI4W6f7g==", + "license": "MIT", "engines": { "node": ">=14" }, @@ -2608,6 +2687,7 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-remove-jsx-attribute/-/babel-plugin-remove-jsx-attribute-8.0.0.tgz", "integrity": "sha512-BcCkm/STipKvbCl6b7QFrMh/vx00vIP63k2eM66MfHJzPr6O2U0jYEViXkHJWqXqQYjdeA9cuCl5KWmlwjDvbA==", + "license": "MIT", "engines": { "node": ">=14" }, @@ -2623,6 +2703,7 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-remove-jsx-empty-expression/-/babel-plugin-remove-jsx-empty-expression-8.0.0.tgz", "integrity": "sha512-5BcGCBfBxB5+XSDSWnhTThfI9jcO5f0Ai2V24gZpG+wXF14BzwxxdDb4g6trdOux0rhibGs385BeFMSmxtS3uA==", + "license": "MIT", "engines": { "node": ">=14" }, @@ -2638,6 +2719,7 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-replace-jsx-attribute-value/-/babel-plugin-replace-jsx-attribute-value-8.0.0.tgz", "integrity": "sha512-KVQ+PtIjb1BuYT3ht8M5KbzWBhdAjjUPdlMtpuw/VjT8coTrItWX6Qafl9+ji831JaJcu6PJNKCV0bp01lBNzQ==", + "license": "MIT", "engines": { "node": ">=14" }, @@ -2653,6 +2735,7 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-svg-dynamic-title/-/babel-plugin-svg-dynamic-title-8.0.0.tgz", "integrity": "sha512-omNiKqwjNmOQJ2v6ge4SErBbkooV2aAWwaPFs2vUY7p7GhVkzRkJ00kILXQvRhA6miHnNpXv7MRnnSjdRjK8og==", + "license": "MIT", "engines": { "node": ">=14" }, @@ -2668,6 +2751,7 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-svg-em-dimensions/-/babel-plugin-svg-em-dimensions-8.0.0.tgz", "integrity": "sha512-mURHYnu6Iw3UBTbhGwE/vsngtCIbHE43xCRK7kCw4t01xyGqb2Pd+WXekRRoFOBIY29ZoOhUCTEweDMdrjfi9g==", + "license": "MIT", "engines": { "node": ">=14" }, @@ -2683,6 +2767,7 @@ "version": "8.1.0", "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-transform-react-native-svg/-/babel-plugin-transform-react-native-svg-8.1.0.tgz", "integrity": "sha512-Tx8T58CHo+7nwJ+EhUwx3LfdNSG9R2OKfaIXXs5soiy5HtgoAEkDay9LIimLOcG8dJQH1wPZp/cnAv6S9CrR1Q==", + "license": "MIT", "engines": { "node": ">=14" }, @@ -2698,6 +2783,7 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-transform-svg-component/-/babel-plugin-transform-svg-component-8.0.0.tgz", "integrity": "sha512-DFx8xa3cZXTdb/k3kfPeaixecQLgKh5NVBMwD0AQxOzcZawK4oo1Jh9LbrcACUivsCA7TLG8eeWgrDXjTMhRmw==", + "license": "MIT", "engines": { "node": ">=12" }, @@ -2713,6 +2799,7 @@ "version": "8.1.0", "resolved": "https://registry.npmjs.org/@svgr/babel-preset/-/babel-preset-8.1.0.tgz", "integrity": "sha512-7EYDbHE7MxHpv4sxvnVPngw5fuR6pw79SkcrILHJ/iMpuKySNCl5W1qcwPEpU+LgyRXOaAFgH0KhwD18wwg6ug==", + "license": "MIT", "dependencies": { "@svgr/babel-plugin-add-jsx-attribute": "8.0.0", "@svgr/babel-plugin-remove-jsx-attribute": "8.0.0", @@ -2738,6 +2825,7 @@ "version": "8.1.0", "resolved": "https://registry.npmjs.org/@svgr/core/-/core-8.1.0.tgz", "integrity": "sha512-8QqtOQT5ACVlmsvKOJNEaWmRPmcojMOzCz4Hs2BGG/toAp/K38LcsMRyLp349glq5AzJbCEeimEoxaX6v/fLrA==", + "license": "MIT", "dependencies": { "@babel/core": "^7.21.3", "@svgr/babel-preset": "8.1.0", @@ -2757,6 +2845,7 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/@svgr/hast-util-to-babel-ast/-/hast-util-to-babel-ast-8.0.0.tgz", "integrity": "sha512-EbDKwO9GpfWP4jN9sGdYwPBU0kdomaPIL2Eu4YwmgP+sJeXT+L7bMwJUBnhzfH8Q2qMBqZ4fJwpCyYsAN3mt2Q==", + "license": "MIT", "dependencies": { "@babel/types": "^7.21.3", "entities": "^4.4.0" @@ -2773,6 +2862,7 @@ "version": "8.1.0", "resolved": "https://registry.npmjs.org/@svgr/plugin-jsx/-/plugin-jsx-8.1.0.tgz", "integrity": "sha512-0xiIyBsLlr8quN+WyuxooNW9RJ0Dpr8uOnH/xrCVO8GLUcwHISwj1AG0k+LFzteTkAA0GbX0kj9q6Dk70PTiPA==", + "license": "MIT", "dependencies": { "@babel/core": "^7.21.3", "@svgr/babel-preset": "8.1.0", @@ -2806,6 +2896,7 @@ "version": "3.10.8", "resolved": "https://registry.npmjs.org/@tanstack/react-virtual/-/react-virtual-3.10.8.tgz", "integrity": "sha512-VbzbVGSsZlQktyLrP5nxE+vE1ZR+U0NFAWPbJLoG2+DKPwd2D7dVICTVIIaYlJqX1ZCEnYDbaOpmMwbsyhBoIA==", + "license": "MIT", "dependencies": { "@tanstack/virtual-core": "3.10.8" }, @@ -2822,6 +2913,7 @@ "version": "3.10.8", "resolved": "https://registry.npmjs.org/@tanstack/virtual-core/-/virtual-core-3.10.8.tgz", "integrity": "sha512-PBu00mtt95jbKFi6Llk9aik8bnR3tR/oQP1o3TSi+iG//+Q2RTIzCEgKkHG8BB86kxMNW6O8wku+Lmi+QFR6jA==", + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/tannerlinsley" @@ -3160,6 +3252,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.6.tgz", "integrity": "sha512-MMSqYh4+C/aVqI2RQaWqbvI4Kxo5cQV40WQ4QFtDnNzCkqChm8MuENhElmynZlO0qUy/ObkEUaXtKqYnx1Kp3A==", + "license": "MIT", "funding": { "url": "https://github.com/sponsors/wevm" }, @@ -3500,7 +3593,8 @@ "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" }, "node_modules/autoprefixer": { "version": "10.4.20", @@ -3557,6 +3651,7 @@ "version": "0.28.1", "resolved": "https://registry.npmjs.org/axios/-/axios-0.28.1.tgz", "integrity": "sha512-iUcGA5a7p0mVb4Gm/sy+FSECNkPFT4y7wt6OM/CDpO/OnNCvSs3PoMG8ibrC9jRoGYU0gUK5pXVC4NPXq6lHRQ==", + "license": "MIT", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -3571,7 +3666,8 @@ "node_modules/base-x": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/base-x/-/base-x-5.0.0.tgz", - "integrity": "sha512-sMW3VGSX1QWVFA6l8U62MLKz29rRfpTlYdCqLdpLo1/Yd4zZwSbnUaDfciIAowAqvq7YFnWq9hrhdg1KYgc1lQ==" + "integrity": "sha512-sMW3VGSX1QWVFA6l8U62MLKz29rRfpTlYdCqLdpLo1/Yd4zZwSbnUaDfciIAowAqvq7YFnWq9hrhdg1KYgc1lQ==", + "license": "MIT" }, "node_modules/base64-js": { "version": "1.5.1", @@ -3804,6 +3900,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/bs58/-/bs58-6.0.0.tgz", "integrity": "sha512-PD0wEnEYg6ijszw/u8s+iI3H17cTymlrwkKhDhPZq+Sokl3AU4htyBFTjAeNAlCCmg0f53g6ih3jATyCKftTfw==", + "license": "MIT", "dependencies": { "base-x": "^5.0.0" } @@ -3812,6 +3909,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-4.0.0.tgz", "integrity": "sha512-FsGDOnFg9aVI9erdriULkd/JjEWONV/lQE5aYziB5PoBsXRind56lh8doIZIc9X4HoxT5x4bLjMWN1/NB8Zp5g==", + "license": "MIT", "dependencies": { "@noble/hashes": "^1.2.0", "bs58": "^6.0.0" @@ -3856,6 +3954,7 @@ "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.8.tgz", "integrity": "sha512-4T53u4PdgsXqKaIctwF8ifXlRTTmEPJ8iEPWFdGZvcf7sbwYo6FKFEX9eNNAnzFZ7EzJAQ3CJeOtCRA4rDp7Pw==", "hasInstallScript": true, + "license": "MIT", "optional": true, "dependencies": { "node-gyp-build": "^4.3.0" @@ -3899,6 +3998,7 @@ "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "license": "MIT", "engines": { "node": ">=10" }, @@ -4085,7 +4185,8 @@ "node_modules/client-only": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", - "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==" + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==", + "license": "MIT" }, "node_modules/cliui": { "version": "8.0.1", @@ -4211,6 +4312,7 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", "dependencies": { "delayed-stream": "~1.0.0" }, @@ -4273,6 +4375,7 @@ "version": "8.3.6", "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.3.6.tgz", "integrity": "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA==", + "license": "MIT", "dependencies": { "import-fresh": "^3.3.0", "js-yaml": "^4.1.0", @@ -4540,7 +4643,8 @@ "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==" + "integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==", + "license": "MIT" }, "node_modules/deep-is": { "version": "0.1.4", @@ -4604,6 +4708,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", "engines": { "node": ">=0.4.0" } @@ -4745,6 +4850,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", + "license": "MIT", "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3" @@ -4774,6 +4880,7 @@ "version": "16.4.5", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "license": "BSD-2-Clause", "engines": { "node": ">=12" }, @@ -4842,6 +4949,7 @@ "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "license": "MIT", "dependencies": { "is-arrayish": "^0.2.1" } @@ -4849,7 +4957,8 @@ "node_modules/error-ex/node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==" + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "license": "MIT" }, "node_modules/es-abstract": { "version": "1.23.3", @@ -5754,6 +5863,7 @@ "url": "https://github.com/sponsors/RubenVerborgh" } ], + "license": "MIT", "engines": { "node": ">=4.0" }, @@ -5790,6 +5900,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", + "license": "MIT", "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -6040,6 +6151,7 @@ "version": "2.1.16", "resolved": "https://registry.npmjs.org/goober/-/goober-2.1.16.tgz", "integrity": "sha512-erjk19y1U33+XAMe1VTvIONHYoSqE4iS7BYUZfHaqeohLmnC0FdxEh7rQU+6MZ4OajItzjZFSRtVANrQwNq6/g==", + "license": "MIT", "peerDependencies": { "csstype": "^3.0.10" } @@ -6685,6 +6797,7 @@ "url": "https://github.com/sponsors/wevm" } ], + "license": "MIT", "peerDependencies": { "ws": "*" } @@ -6762,7 +6875,8 @@ "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "license": "MIT" }, "node_modules/json-schema-traverse": { "version": "0.4.1", @@ -6924,7 +7038,8 @@ "node_modules/lodash.isequal": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", - "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==" + "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", + "license": "MIT" }, "node_modules/lodash.merge": { "version": "4.6.2", @@ -7043,6 +7158,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", + "license": "MIT", "dependencies": { "tslib": "^2.0.3" } @@ -7126,6 +7242,7 @@ "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -7134,6 +7251,7 @@ "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", "dependencies": { "mime-db": "1.52.0" }, @@ -7178,6 +7296,7 @@ "version": "4.2.1", "resolved": "https://registry.npmjs.org/minidenticons/-/minidenticons-4.2.1.tgz", "integrity": "sha512-oWfFivA0lOx/V/bO/YIJbthB26lV8JXYvhnv9zM2hNd3fzsHTXQ6c6bWZPcvhD3nnOB+lQk/D9lF43BXixrN8g==", + "license": "MIT", "engines": { "node": ">=15.14.0" } @@ -7290,6 +7409,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", + "license": "MIT", "dependencies": { "lower-case": "^2.0.2", "tslib": "^2.0.3" @@ -7299,6 +7419,7 @@ "version": "4.8.2", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.2.tgz", "integrity": "sha512-IRUxE4BVsHWXkV/SFOut4qTlagw2aM8T5/vnTsmrHJvVoKueJHRc/JaFND7QDDc61kLYUJ6qlZM3sqTSyx2dTw==", + "license": "MIT", "optional": true, "bin": { "node-gyp-build": "bin.js", @@ -7669,6 +7790,7 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "license": "MIT", "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", @@ -8005,7 +8127,8 @@ "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==" + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "license": "MIT" }, "node_modules/public-encrypt": { "version": "4.0.3", @@ -8107,6 +8230,7 @@ "version": "3.8.0", "resolved": "https://registry.npmjs.org/react-currency-input-field/-/react-currency-input-field-3.8.0.tgz", "integrity": "sha512-DKSIjacrvgUDOpuB16b+OVDvp5pbCt+s+RHJgpRZCHNhzg1yBpRUoy4fbnXpeOj0kdbwf5BaXCr2mAtxEujfhg==", + "license": "MIT", "peerDependencies": { "react": "^16.9.0 || ^17.0.0 || ^18.0.0" } @@ -8127,6 +8251,7 @@ "version": "2.4.1", "resolved": "https://registry.npmjs.org/react-hot-toast/-/react-hot-toast-2.4.1.tgz", "integrity": "sha512-j8z+cQbWIM5LY37pR6uZR6D4LfseplqnuAO4co4u8917hBUvXlEqyP1ZzqVLcqoyUesZZv/ImreoCeHVDpE5pQ==", + "license": "MIT", "dependencies": { "goober": "^2.1.10" }, @@ -8495,7 +8620,8 @@ "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==" + "integrity": "sha512-H2bdSKERKdBV1SwoqYm6C0y+9EA94v6SUBOWO8kDndc4NoUih7Dv6Tsgma7zO1lv27wIvjlD0ZpMQk7um5dheQ==", + "license": "MIT" }, "node_modules/semver": { "version": "7.6.3", @@ -8698,6 +8824,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", "integrity": "sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==", + "license": "MIT", "dependencies": { "dot-case": "^3.0.4", "tslib": "^2.0.3" @@ -9019,7 +9146,8 @@ "node_modules/svg-parser": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/svg-parser/-/svg-parser-2.0.4.tgz", - "integrity": "sha512-e4hG1hRwoOdRb37cIMSgzNsxyzKfayW6VOflrwvR+/bzrkyxY/31WkbgnQpgtrNp1SdpJvpUAGTa/ZoiPNDuRQ==" + "integrity": "sha512-e4hG1hRwoOdRb37cIMSgzNsxyzKfayW6VOflrwvR+/bzrkyxY/31WkbgnQpgtrNp1SdpJvpUAGTa/ZoiPNDuRQ==", + "license": "MIT" }, "node_modules/svgo": { "version": "3.3.2", @@ -9241,9 +9369,10 @@ } }, "node_modules/tslib": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", - "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==" + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.0.tgz", + "integrity": "sha512-jWVzBLplnCmoaTr13V9dYbiQ99wvZRd0vNWaDRg+aVYRcjDF3nDksxFDE/+fkXnKhpnUUkmx5pK/v8mCtLVqZA==", + "license": "0BSD" }, "node_modules/tsutils": { "version": "3.21.0", @@ -9483,6 +9612,7 @@ "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-6.0.4.tgz", "integrity": "sha512-xu9GQDeFp+eZ6LnCywXN/zBancWvOpUMzgjLPSjy4BRHSmTelvn2E0DG0o1sTiw5hkCKBHo8rwSKncfRfv2EEQ==", "hasInstallScript": true, + "license": "MIT", "optional": true, "dependencies": { "node-gyp-build": "^4.3.0" @@ -9511,18 +9641,20 @@ "node_modules/varint": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", - "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==" + "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", + "license": "MIT" }, "node_modules/viem": { - "version": "2.21.25", - "resolved": "https://registry.npmjs.org/viem/-/viem-2.21.25.tgz", - "integrity": "sha512-fQbFLVW5RjC1MwjelmzzDygmc2qMfY17NruAIIdYeiB8diQfhqsczU5zdGw/jTbmNXbKoYnSdgqMb8MFZcbZ1w==", + "version": "2.21.41", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.21.41.tgz", + "integrity": "sha512-FxDALzW6I9lGSISbGKqGLfsc4GCtALrgm3mpQcOi7gpyTBkKkl39IWgRjAK1KGNOOvqneQmUKSxWsApkUYSn5w==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/wevm" } ], + "license": "MIT", "dependencies": { "@adraffy/ens-normalize": "1.11.0", "@noble/curves": "1.6.0", @@ -10051,6 +10183,7 @@ "url": "https://github.com/sponsors/wevm" } ], + "license": "MIT", "dependencies": { "@noble/curves": "^1.4.0", "@noble/hashes": "^1.4.0" @@ -10248,6 +10381,7 @@ "version": "8.18.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", + "license": "MIT", "engines": { "node": ">=10.0.0" }, diff --git a/front/package.json b/front/package.json index 533ede9..a1e0456 100644 --- a/front/package.json +++ b/front/package.json @@ -17,9 +17,9 @@ "prepare": "husky install" }, "dependencies": { - "@massalabs/massa-web3": "^5.0.0-next", - "@massalabs/react-ui-kit": "^0.1.1-dev", - "@massalabs/wallet-provider": "^3.0.0-next", + "@massalabs/massa-web3": "^5.0.0", + "@massalabs/react-ui-kit": "^1.0.1-dev", + "@massalabs/wallet-provider": "^3.0.0", "copy-to-clipboard": "^3.3.3", "currency.js": "^2.0.4", "delay": "^6.0.0", @@ -65,5 +65,9 @@ "typescript": "^5.2.2", "vite": "^5.1.7", "vite-plugin-image-optimizer": "^1.1.8" + }, + "overrides": { + "@massalabs/massa-web3": "^5.0.0", + "@massalabs/wallet-provider": "^3.0.0" } } diff --git a/front/src/components/ConnectWalletPopup/ConnectButton.tsx b/front/src/components/ConnectWalletPopup/ConnectButton.tsx index bf1d616..b1329e5 100644 --- a/front/src/components/ConnectWalletPopup/ConnectButton.tsx +++ b/front/src/components/ConnectWalletPopup/ConnectButton.tsx @@ -15,7 +15,7 @@ export function ConnectButton() { + ); +}; diff --git a/front/src/const/network.ts b/front/src/const/network.ts new file mode 100644 index 0000000..76de960 --- /dev/null +++ b/front/src/const/network.ts @@ -0,0 +1,3 @@ +export type AvailableNetwork = 'mainnet' | 'buildnet'; + +export const dappNetwork: AvailableNetwork = 'buildnet'; diff --git a/front/src/hooks/useAccountSync.tsx b/front/src/hooks/useAccountSync.tsx index 2e16bbe..024e345 100644 --- a/front/src/hooks/useAccountSync.tsx +++ b/front/src/hooks/useAccountSync.tsx @@ -1,7 +1,7 @@ import { useCallback, useEffect, useRef } from 'react'; import { useAccountStore } from '@massalabs/react-ui-kit/src/lib/ConnectMassaWallets'; import { useLocalStorage } from '@massalabs/react-ui-kit/src/lib/util/hooks/useLocalStorage'; -import { getWallets } from '../../../../wallet-provider'; +import { getWallets } from '@massalabs/wallet-provider'; type SavedAccount = { address: string; @@ -14,19 +14,14 @@ const EMPTY_ACCOUNT: SavedAccount = { }; const useAccountSync = () => { - const { - connectedAccount, - setConnectedAccount, - setCurrentWallet, - setWallets, - } = useAccountStore(); + const { connectedAccount, setCurrentWallet } = useAccountStore(); const [savedAccount, setSavedAccount] = useLocalStorage( 'saved-account', EMPTY_ACCOUNT, ); - const findMatchingAccount = useCallback(async (address: string) => { + const getStoredAccount = useCallback(async (address: string) => { const wallets = await getWallets(); for (const wallet of wallets) { const accounts = await wallet.accounts(); @@ -35,26 +30,16 @@ const useAccountSync = () => { return { account: matchingAccount, wallet, wallets }; } } - return null; }, []); const setAccountFromSaved = useCallback(async () => { if (!savedAccount.address) return; - const result = await findMatchingAccount(savedAccount.address); - if (result) { - const { account, wallet, wallets } = result; - setConnectedAccount(account); - setCurrentWallet(wallet); - setWallets(wallets); + const stored = await getStoredAccount(savedAccount.address); + if (stored) { + setCurrentWallet(stored.wallet, stored.account); } - }, [ - savedAccount, - findMatchingAccount, - setConnectedAccount, - setCurrentWallet, - setWallets, - ]); + }, [savedAccount.address, getStoredAccount, setCurrentWallet]); useEffect(() => { const shouldUpdateSavedAccount = diff --git a/front/src/hooks/useInit.ts b/front/src/hooks/useInit.ts index 1404297..f614658 100644 --- a/front/src/hooks/useInit.ts +++ b/front/src/hooks/useInit.ts @@ -1,21 +1,29 @@ import { useEffect } from 'react'; import { toast, useAccountStore } from '@massalabs/react-ui-kit'; -import { initApp } from '@/store/store'; +import { initApp, resetApp } from '@/store/store'; import { useSchedulerStore } from '@/store/scheduler'; -import { useNetworkStore } from '@/store/network'; import useAccountSync from './useAccountSync'; +import { dappNetwork } from '@/const/network'; export const useInit = () => { const { eventPollerStop } = useSchedulerStore(); const { connectedAccount, network: walletNetwork } = useAccountStore(); - const { network: dappNetwork } = useNetworkStore(); + useAccountSync(); useEffect(() => { - if (connectedAccount) { - initApp(); + if (!connectedAccount) { + resetApp(); + } + + if (connectedAccount && walletNetwork) { + if (walletNetwork.name !== dappNetwork) { + toast.error(`Please switch to ${dappNetwork} network`); + return; + } + initApp(connectedAccount, walletNetwork.name); } - }, [connectedAccount]); + }, [connectedAccount, walletNetwork]); useEffect(() => { return () => { @@ -24,10 +32,4 @@ export const useInit = () => { } }; }, [eventPollerStop]); - - useEffect(() => { - if (!walletNetwork) return; - if (walletNetwork !== dappNetwork) - toast.error(`Please switch to ${dappNetwork} network`); - }, [dappNetwork, walletNetwork]); }; diff --git a/front/src/hooks/useSchedule.ts b/front/src/hooks/useSchedule.ts index 1ee6712..4c5e6a3 100644 --- a/front/src/hooks/useSchedule.ts +++ b/front/src/hooks/useSchedule.ts @@ -10,7 +10,7 @@ export default function useSchedule() { const { connectedAccount } = useAccountStore(); const { scheduleInfo, - getBySpender, + getUserPayments, address: schedulerAddress, } = useSchedulerStore(); const { callSmartContract } = useWriteSmartContract(connectedAccount!); @@ -57,7 +57,7 @@ export default function useSchedule() { Mas.fromString('1') + (scheduleInfo.isVesting ? totalAmount : 0n), ); - getBySpender(connectedAccount.address); + getUserPayments(connectedAccount.address); } async function cancelSchedules(ids: bigint[]) { @@ -74,7 +74,7 @@ export default function useSchedule() { }, ); - getBySpender(connectedAccount.address); + getUserPayments(connectedAccount.address); } async function manualTrigger(spender: string, id: bigint) { @@ -91,7 +91,7 @@ export default function useSchedule() { }, ); - getBySpender(spender); + getUserPayments(spender); } return { diff --git a/front/src/index.css b/front/src/index.css index 42b2550..b886e2c 100644 --- a/front/src/index.css +++ b/front/src/index.css @@ -55,15 +55,9 @@ button { font-size: 1em; font-weight: 500; font-family: inherit; - background-color: #1a1a1a; cursor: pointer; transition: border-color 0.25s; -} - -@media (prefers-color-scheme: light) { - button { - background-color: #f9f9f9; - } + background-color: #f9f9f9; } #dropdownUiKitButton { diff --git a/front/src/pages/HomePage.tsx b/front/src/pages/HomePage.tsx index 9a20ddc..f3db7e2 100644 --- a/front/src/pages/HomePage.tsx +++ b/front/src/pages/HomePage.tsx @@ -1,16 +1,14 @@ import { useRef } from 'react'; -import ScheduleTable from '@/components/ScheduleTable'; import { useSearchParams } from 'react-router-dom'; import { ArrowButton } from '@/components/ArrowButton'; import { ScheduleForm } from '@/components/ScheduleForm'; import { NavBar } from '@/components/NavBar'; import { useSchedulerStore } from '@/store/scheduler'; +import { ScheduleTablesSection } from '@/components/ScheduleTablesSection'; export default function HomePage() { - const { scheduleInfo, setScheduleInfo, spenderSchedules } = - useSchedulerStore(); + const { scheduleInfo, setScheduleInfo } = useSchedulerStore(); const scheduleTableRef = useRef(null); - const [searchParams] = useSearchParams(); const recipientQuery = searchParams.get('recipient'); @@ -33,8 +31,8 @@ export default function HomePage() { -
- +
+
); diff --git a/front/src/store/network.ts b/front/src/store/network.ts deleted file mode 100644 index 2051815..0000000 --- a/front/src/store/network.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ - -import { create } from 'zustand'; - -export type AvailableNetwork = 'mainnet' | 'buildnet'; - -export interface NetworkStoreState { - network: AvailableNetwork; - setNetwork: (network: AvailableNetwork) => void; -} - -export const useNetworkStore = create((set) => ({ - network: 'buildnet', - - setNetwork: (network: AvailableNetwork) => { - set({ network }); - }, -})); diff --git a/front/src/store/scheduler.ts b/front/src/store/scheduler.ts index 3cb04fb..ada31bc 100644 --- a/front/src/store/scheduler.ts +++ b/front/src/store/scheduler.ts @@ -19,16 +19,20 @@ export type ScheduleInfo = { interface SchedulerStoreState { scheduleInfo: ScheduleInfo; - spenderSchedules: Schedule[]; + userPayments: Schedule[]; + userReceive: Schedule[]; address: string; + showUserPayments: boolean; setSchedulerAddress: (address: string) => void; setScheduleInfo: ( key: keyof ScheduleInfo, value: bigint | string | Asset | boolean, ) => void; - getBySpender: (spender: string) => Promise; - getByRecipient: (recipient: string) => Promise; + setUserPayments: (payments: Schedule[]) => void; + setUserReceive: (payments: Schedule[]) => void; + getUserPayments: (spender: string) => Promise; + getUserReceive: (recipient: string) => Promise; eventPollerStop: () => void; setEventPollerStop: (stop: () => void) => void; @@ -36,6 +40,7 @@ interface SchedulerStoreState { setEventPollerStopOld: (timeout: NodeJS.Timeout) => void; lastEventSlotOld: Slot | undefined; setLastEventSlotOld: (slot: Slot) => void; + setShowUserPayments: (showUserPayments: boolean) => void; } const defaultScheduleInfo: ScheduleInfo = { @@ -52,10 +57,12 @@ const defaultScheduleInfo: ScheduleInfo = { export const useSchedulerStore = create((set, get) => ({ address: '', scheduleInfo: defaultScheduleInfo, - spenderSchedules: [], + userPayments: [], + userReceive: [], eventPollerStop: () => {}, eventPollerStopOld: setTimeout(() => {}, 0), lastEventSlotOld: undefined, + showUserPayments: true, setLastEventSlotOld: (slot) => { set({ lastEventSlotOld: slot }); @@ -72,39 +79,53 @@ export const useSchedulerStore = create((set, get) => ({ scheduleInfo: { ...state.scheduleInfo, [key]: value }, })), - getBySpender: async (spender: string): Promise => { + getUserPayments: async (userAddress: string): Promise => { const { connectedAccount } = useAccountStore.getState(); if (!connectedAccount) return []; const res = await connectedAccount.readSC({ func: 'getSchedulesBySpender', target: get().address, - parameter: new Args().addString(spender).serialize(), + parameter: new Args().addString(userAddress).serialize(), caller: connectedAccount.address, }); - const schedules = new Args(res.value).nextSerializableObjectArray(Schedule); - set({ spenderSchedules: schedules }); - return schedules; + const payments = new Args(res.value).nextSerializableObjectArray(Schedule); + set({ userPayments: payments }); + + return payments; }, - getByRecipient: async (recipient: string) => { + getUserReceive: async (userAddress: string): Promise => { const { connectedAccount } = useAccountStore.getState(); if (!connectedAccount) return []; const res = await connectedAccount.readSC({ func: 'getScheduleByRecipient', target: get().address, - parameter: new Args().addString(recipient).serialize(), + parameter: new Args().addString(userAddress).serialize(), caller: connectedAccount.address, }); - const schedules = new Args(res.value).nextSerializableObjectArray(Schedule); - set({ spenderSchedules: schedules }); - return schedules; + const payments = new Args(res.value).nextSerializableObjectArray(Schedule); + set({ userReceive: payments }); + + return payments; + }, + + setUserPayments: (payments: Schedule[]) => { + set({ userPayments: payments }); + }, + + setUserReceive: (payments: Schedule[]) => { + set({ userReceive: payments }); }, setEventPollerStop: (stop: () => void) => { set({ eventPollerStop: stop }); }, + + setShowUserPayments: (showUserPayments: boolean) => { + set({ showUserPayments }); + }, })); diff --git a/front/src/store/store.ts b/front/src/store/store.ts index 1843f66..eba881b 100644 --- a/front/src/store/store.ts +++ b/front/src/store/store.ts @@ -2,41 +2,54 @@ import { EventPoller, Provider, SCEvent } from '@massalabs/massa-web3'; import { schedulerAddress } from '../const/contracts'; import { Schedule } from '../serializable/Schedule'; import { truncateAddress } from '@/utils/address'; -import { useAccountStore, formatAmount, toast } from '@massalabs/react-ui-kit'; +import { formatAmount, toast } from '@massalabs/react-ui-kit'; import { useSchedulerStore } from './scheduler'; import { useTokenStore } from './token'; import { getTokenInfo } from '@/utils/assets'; -import { AvailableNetwork, useNetworkStore } from './network'; import { supportedTokens } from '@/const/assets'; +import { AvailableNetwork, dappNetwork } from '@/const/network'; -export async function initApp() { - const { connectedAccount } = useAccountStore.getState(); - if (!connectedAccount) return; - const { network } = useNetworkStore.getState(); +export async function resetApp() { + const { setUserPayments, setUserReceive } = useSchedulerStore.getState(); + setUserPayments([]); + setUserReceive([]); +} - await initTokens(network); - await initSchedules(connectedAccount, network); +export async function initApp( + connectedAccount: Provider, + walletNetwork: AvailableNetwork, +) { + await initSchedules(connectedAccount, walletNetwork); + await initTokens(walletNetwork); await initPollEvent(connectedAccount); } async function initTokens(network: AvailableNetwork) { const { setTokens, refreshBalances } = useTokenStore.getState(); - setTokens(supportedTokens[network]); + setTokens(supportedTokens[dappNetwork]); + if (network !== dappNetwork) return; refreshBalances(); } -async function initSchedules( +export async function initSchedules( connectedAccount: Provider, - network: AvailableNetwork, + walletNetwork: AvailableNetwork, ) { - const { setSchedulerAddress, getBySpender } = useSchedulerStore.getState(); - setSchedulerAddress(schedulerAddress[network]); - await getBySpender(connectedAccount.address); + const { setSchedulerAddress, getUserPayments, getUserReceive } = + useSchedulerStore.getState(); + if (dappNetwork !== walletNetwork) { + resetApp(); + return; + } + + setSchedulerAddress(schedulerAddress[dappNetwork]); + await getUserPayments(connectedAccount.address); + await getUserReceive(connectedAccount.address); } async function initPollEvent(connectedAccount: Provider) { const { - getBySpender, + getUserPayments, address: schedulerAddress, setEventPollerStop, eventPollerStop, @@ -50,7 +63,7 @@ async function initPollEvent(connectedAccount: Provider) { connectedAccount, { smartContractAddress: schedulerAddress, start: lastSlot }, async (data) => { - const schedules = await getBySpender(connectedAccount.address); + const schedules = await getUserPayments(connectedAccount.address); if (!schedules?.length) return; handleTransferEvents(data, schedules); diff --git a/front/src/store/token.ts b/front/src/store/token.ts index 39ceaa3..6665a36 100644 --- a/front/src/store/token.ts +++ b/front/src/store/token.ts @@ -6,7 +6,7 @@ import { MRC20 } from '@massalabs/massa-web3'; import { MasToken, supportedTokens } from '@/const/assets'; import { Asset } from '@massalabs/react-ui-kit/src/lib/token/models/AssetModel'; import { useSchedulerStore } from './scheduler'; -import { useNetworkStore } from './network'; +import { dappNetwork } from '@/const/network'; export interface TokenStoreState { selectedToken?: Asset; @@ -21,8 +21,7 @@ export const useTokenStore = create((set, get) => ({ mas: MasToken, init: async () => { - const { network } = useNetworkStore.getState(); - set({ tokens: supportedTokens[network] }); + set({ tokens: supportedTokens[dappNetwork] }); const { refreshBalances } = get(); refreshBalances(); }, diff --git a/front/src/styles/buttons.ts b/front/src/styles/buttons.ts index fca98a6..2a8ae66 100644 --- a/front/src/styles/buttons.ts +++ b/front/src/styles/buttons.ts @@ -1,3 +1,5 @@ /* eslint-disable max-len */ export const commonButton = - 'hover:bg-opacity-80 hover:shadow-md active:shadow-none transition-all duration-50 ease-in-out disabled:opacity-50 disabled:cursor-not-allowed'; + 'hover:bg-opacity-80 dark:hover:bg-opacity-80 hover:shadow-md active:shadow-none transition-all duration-50 ease-in-out disabled:opacity-50 disabled:cursor-not-allowed text:black '; + +export const redButton = `bg-primary text-white ${commonButton}`; diff --git a/front/src/themes/default.js b/front/src/themes/default.js index b924e6b..49f7b02 100644 --- a/front/src/themes/default.js +++ b/front/src/themes/default.js @@ -50,12 +50,14 @@ module.exports = { 'f-disabled-2': colorBeige, }, dark: { - primary: colorGray, + primary: colorRed, secondary: colorGray, tertiary: colorBeige, brand: colorRed, - neutral: colorBeige, + + neutral: colorDarkGray, info: colorGray, + // states: 's-success': colorRed, 's-error': colorRed, @@ -63,20 +65,20 @@ module.exports = { 's-info': colorGray, 's-info-1': colorGray, // components: - 'c-default': colorBeige, - 'c-hover': colorGray, + 'c-default': colorDarkGray, + 'c-hover': colorDarkGray, 'c-pressed': colorGray, 'c-disabled-1': colorGray, 'c-disabled-2': colorBeige, 'c-error': colorRed, // icons: - 'i-primary': colorBeige, - 'i-secondary': colorGray, - 'i-tertiary': colorRed, + 'i-primary': colorGray, + 'i-secondary': colorBeige, + 'i-tertiary': colorDarkGray, // fonts: - 'f-primary': colorBeige, - 'f-secondary': colorGray, - 'f-tertiary': colorRed, + 'f-primary': colorDarkGray, + 'f-secondary': colorBeige, + 'f-tertiary': colorGray, 'f-disabled-1': colorGray, 'f-disabled-2': colorBeige, },