From 8c3a02c24cc34c1759e2d5bd9bb0ffa6b7ecaa9c Mon Sep 17 00:00:00 2001 From: Andrei Fleiser Date: Thu, 16 Jan 2025 15:02:09 +0100 Subject: [PATCH] deploysc is displayed separately from executesc --- Taskfile.yml | 8 +- internal/handler/wallet/sign.go | 64 +- wails-frontend/package-lock.json | 687 +++++++----------- wails-frontend/package.json | 6 +- wails-frontend/src/i18n/en_US.json | 22 + .../CallSC/FTTransferInfo.tsx | 5 +- .../ExecuteSC.tsx/ExecuteSc.tsx | 98 ++- .../src/pages/PasswordPromptHandler/Sign.tsx | 16 +- .../SignComponentUtils/OperationCost.tsx | 119 ++- .../components/NetworkName.tsx | 18 +- 10 files changed, 530 insertions(+), 513 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 304542cb3..eec47b9c3 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -90,10 +90,12 @@ tasks: wails-dev: cmds: - - cmd: wails dev + - cmd: wails dev -tags webkit2_41 env: STANDALONE: 1 + # This task is used to install the plugin in the MassaStation plugins directory. + # This allow to use the plugin with MassaStation. install-plugin: cmds: - cmd: mkdir -p /usr/local/share/massastation/plugins/wallet-plugin @@ -132,11 +134,15 @@ tasks: - task: build-wails - task: build +# This task build and run the plugin as a standalone application, WITHOUT any connection to MassaStation build-run: cmds: - task: build-standalone - task: run + # This is the task to run for building and using the station-massa-wallet plugin with MassaStation + # It build the plugin and then install it in the MassaStation plugins directory. + # Hence, when massaStation is launched, it will detect the plugin and use it normaly build-install-plugin: cmds: - task: generate diff --git a/internal/handler/wallet/sign.go b/internal/handler/wallet/sign.go index e2324722f..b24168865 100644 --- a/internal/handler/wallet/sign.go +++ b/internal/handler/wallet/sign.go @@ -28,6 +28,7 @@ import ( "github.com/massalabs/station/pkg/node/sendoperation/executesc" "github.com/massalabs/station/pkg/node/sendoperation/sellrolls" "github.com/massalabs/station/pkg/node/sendoperation/transaction" + onchain "github.com/massalabs/station/pkg/onchain" "github.com/pkg/errors" "lukechampine.com/blake3" ) @@ -38,25 +39,27 @@ const ( ) type PromptRequestSignData struct { - Description string - Fees string - MinFees string - OperationType int - Coins string - Address string - Function string - MaxCoins string - WalletAddress string - Nickname string - RollCount uint64 - RecipientAddress string - RecipientNickname string - Amount string - PlainText string - AllowFeeEdition bool - ChainID int64 - Assets []models.AssetInfo - Parameters []byte + Description string + Fees string + MinFees string + OperationType int + Coins string + Address string + Function string + MaxCoins string // for ExecuteSC + WalletAddress string + Nickname string + RollCount uint64 + RecipientAddress string + RecipientNickname string + Amount string + PlainText string + AllowFeeEdition bool + ChainID int64 + Assets []models.AssetInfo + Parameters []byte + DeployedByteCodeSize uint // for executeSC of type deploySC + DeployedCoins uint64 // for executeSC of type DeploySC; the number of coins sent to the deployed contract } func NewSign(prompterApp prompt.WalletPrompterInterface, gc gcache.Cache, AssetsStore *assets.AssetsStore) operations.SignHandler { @@ -316,9 +319,28 @@ func getExecuteSCPromptData( return PromptRequestSignData{}, err } - return PromptRequestSignData{ + promptReq := PromptRequestSignData{ MaxCoins: strconv.FormatUint(msg.MaxCoins, 10), - }, nil + } + + // Check the datastore to know whether the ExecuteSC is a DeploySC or not + + if msg.DataStore == nil { // the executeSC is not a deploySC + return promptReq, nil + } + + dataStore, err := onchain.DeSerializeDatastore(msg.DataStore) + if err != nil { + return PromptRequestSignData{}, err + } + + deployedContract, success := onchain.DatastoreToDeployedContract(dataStore) + if success { // the executeSC is a deploySC + promptReq.DeployedByteCodeSize = uint(len(deployedContract.ByteCode)) + promptReq.DeployedCoins = deployedContract.Coins + } + + return promptReq, nil } func getRollPromptData( diff --git a/wails-frontend/package-lock.json b/wails-frontend/package-lock.json index f98153c2c..ff4ca4d97 100644 --- a/wails-frontend/package-lock.json +++ b/wails-frontend/package-lock.json @@ -8,9 +8,9 @@ "name": "wails-frontend", "version": "0.0.0", "dependencies": { - "@massalabs/massa-web3": "^4.0.2-dev", - "@massalabs/react-ui-kit": "^0.0.5-dev", - "bignumber": "^1.1.0", + "@massalabs/massa-web3": "^5.1.0", + "@massalabs/react-ui-kit": "^1.0.0", + "bignumber.js": "^9.1.2", "currency.js": "^2.0.4", "dot-object": "^2.1.4", "esbuild": "^0.17.19", @@ -66,9 +66,10 @@ "dev": true }, "node_modules/@adraffy/ens-normalize": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz", - "integrity": "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==" + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.11.0.tgz", + "integrity": "sha512-/3DDPKHqqIqxUULp8yP4zODUY1i+2xvVWsv8A79xGWdCAG+8sb0hRh0Rk2QyOJUnnbyPUAZYcpBuRe3nS2OIUg==", + "license": "MIT" }, "node_modules/@alloc/quick-lru": { "version": "5.2.0", @@ -1093,9 +1094,10 @@ } }, "node_modules/@hicaru/bearby.js": { - "version": "0.5.8", - "resolved": "https://registry.npmjs.org/@hicaru/bearby.js/-/bearby.js-0.5.8.tgz", - "integrity": "sha512-K6mLazzHkDNF5Qmx5iQ4+UqmvBJxtuwg1ZHEDEvOKB1SV/QNuKJ54/HRlLMqJE0RHam2zP7s++RlnMZUIfWgGg==" + "version": "0.5.9", + "resolved": "https://registry.npmjs.org/@hicaru/bearby.js/-/bearby.js-0.5.9.tgz", + "integrity": "sha512-bAyPMklXovDsEkZH9cHO2LdhEqRGbFECQwHjezrRmt1kPmSqHvM+jmADucP14yrnID7ZV/lbMBM+WhmqRAfKhg==", + "license": "MIT" }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.8", @@ -1932,14 +1934,6 @@ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" }, - "node_modules/@lukeed/csprng": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.1.0.tgz", - "integrity": "sha512-Z7C/xXCiGWsg0KuKsHTKJxbWhpI3Vs5GwLfOean7MGyVFGqdRgBbAjOCh6u4bbjPc/8MJ2pZmK/0DLdCbivLDA==", - "engines": { - "node": ">=8" - } - }, "node_modules/@massalabs/eslint-config": { "version": "0.0.9", "resolved": "https://registry.npmjs.org/@massalabs/eslint-config/-/eslint-config-0.0.9.tgz", @@ -1957,27 +1951,20 @@ } }, "node_modules/@massalabs/massa-web3": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@massalabs/massa-web3/-/massa-web3-4.0.3.tgz", - "integrity": "sha512-W1TtxMrTiqLfUgvIqO641M/2do6Z2Kvvq44JYhiUbteXI5S+VvCJ+HaRtIZ23r9k2wTSlSikE6j6U5bkKDMABA==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@massalabs/massa-web3/-/massa-web3-5.1.0.tgz", + "integrity": "sha512-fKlOjKD+F0JoUxLUUfweugt9MrM6P1F4WT80TdhgZ1yIKqguN0bNYsXzF9Wf6xVzljP/D+u1kwSDAQpZ/PZ8yg==", + "license": "MIT", "dependencies": { - "@massalabs/wallet-provider": "^2.0.0", - "@massalabs/web3-utils": "^1.4.11", "@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", - "bs58check": "^3.0.1", - "buffer": "^6.0.3", - "crypto-js": "^4.1.1", + "bs58check": "^4.0.0", + "decimal.js": "^10.4.3", "dotenv": "^16.0.3", - "js-base64": "^3.7.5", - "string_decoder": "^1.3.0", - "tslib": "^2.5.2", - "util": "^0.12.5", + "eventemitter3": "^5.0.1", + "lodash.isequal": "^4.5.0", + "secure-random": "^1.1.2", + "tslib": "^2.8.0", "varint": "^6.0.0" }, "optionalDependencies": { @@ -1985,33 +1972,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==", - "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==", - "dependencies": { - "follow-redirects": "^1.15.0", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, "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", @@ -2022,13 +1982,16 @@ } }, "node_modules/@massalabs/react-ui-kit": { - "version": "0.0.5-dev.20240611224415", - "resolved": "https://registry.npmjs.org/@massalabs/react-ui-kit/-/react-ui-kit-0.0.5-dev.20240611224415.tgz", - "integrity": "sha512-1H8pjj+DwV40BRrc0u7IyloJay+zhkgKteEOvNYzms66yhL/2Rbtp14nClbbzmg8hZeGQVq8YpdMd7t0qqOMCQ==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@massalabs/react-ui-kit/-/react-ui-kit-1.0.0.tgz", + "integrity": "sha512-5Mg3Gm/94F8fH4/pLbvLShVOtczlETkaqk/NV8gPlGAYN+2E8o1xHvC9ni5YxaDUf4kBaboemDN5Xvd6yeOWfw==", "dependencies": { "@headlessui/react": "^1.7.15", + "@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", "minidenticons": "^4.2.1", "react": "^18.2.0", "react-currency-input-field": "^3.6.11", @@ -2037,107 +2000,23 @@ "react-icons": "^4.8.0", "react-number-format": "^5.2.2", "tw-colors": "^1.2.5", - "viem": "^1.5.2", + "viem": "^2.19.4", "vite-plugin-svgr": "^3.2.0", "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" - } - }, - "node_modules/@massalabs/react-ui-kit/node_modules/abitype": { - "version": "0.9.8", - "resolved": "https://registry.npmjs.org/abitype/-/abitype-0.9.8.tgz", - "integrity": "sha512-puLifILdm+8sjyss4S+fsUN09obiT1g2YW6CtcQF+QDzxR0euzgEB29MZujC6zMk2a6SVmtttq1fc6+YFA7WYQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/wagmi-dev" - } - ], - "peerDependencies": { - "typescript": ">=5.0.4", - "zod": "^3 >=3.19.1" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - }, - "zod": { - "optional": true - } - } - }, - "node_modules/@massalabs/react-ui-kit/node_modules/viem": { - "version": "1.21.4", - "resolved": "https://registry.npmjs.org/viem/-/viem-1.21.4.tgz", - "integrity": "sha512-BNVYdSaUjeS2zKQgPs+49e5JKocfo60Ib2yiXOWBT6LuVxY1I/6fFX3waEtpXvL1Xn4qu+BVitVtMh9lyThyhQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/wevm" - } - ], - "dependencies": { - "@adraffy/ens-normalize": "1.10.0", - "@noble/curves": "1.2.0", - "@noble/hashes": "1.3.2", - "@scure/bip32": "1.3.2", - "@scure/bip39": "1.2.1", - "abitype": "0.9.8", - "isows": "1.0.3", - "ws": "8.13.0" - }, - "peerDependencies": { - "typescript": ">=5.0.4" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } } }, "node_modules/@massalabs/wallet-provider": { - "version": "2.0.1-dev.20240423112601", - "resolved": "https://registry.npmjs.org/@massalabs/wallet-provider/-/wallet-provider-2.0.1-dev.20240423112601.tgz", - "integrity": "sha512-2NvwKho1Couwd2/gXZ0ZGBymmTiuX6rxjoX2gQnEu8LI2i15uDfRba5Gv6NSSvgLcjExzbhrJOQzPRgDAJhDlQ==", - "peer": true, + "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.7", - "@massalabs/web3-utils": "^1.4.9-dev", + "@hicaru/bearby.js": "^0.5.9", + "@massalabs/massa-web3": "^5.0.0", "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/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/web3-utils": { - "version": "1.4.11", - "resolved": "https://registry.npmjs.org/@massalabs/web3-utils/-/web3-utils-1.4.11.tgz", - "integrity": "sha512-9iUoSc9OZxrvx8UbDor934z0cetenEU3PlDqTa9Hsh3EuZJ9jalcEU8Q9Z+hjLn2S9Ojmqu2ldcOAxVzYeNCbw==", - "dependencies": { - "bignumber.js": "^9.1.2", - "buffer": "^6.0.3", - "events": "^3.3.0", - "string_decoder": "^1.3.0" + "bs58check": "^4.0.0", + "eventemitter3": "^5.0.1", + "lodash.isequal": "^4.5.0" } }, "node_modules/@microsoft/tsdoc": { @@ -2159,11 +2038,15 @@ } }, "node_modules/@noble/curves": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", - "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.7.0.tgz", + "integrity": "sha512-UTMhXK9SeDhFJVrHeUJ5uZlI6ajXg10O6Ddocf9S6GjbSBVZsJo88HzKwXznNfGpMTRDyJkqMjNDPYgf0qFWnw==", + "license": "MIT", "dependencies": { - "@noble/hashes": "1.3.2" + "@noble/hashes": "1.6.0" + }, + "engines": { + "node": "^14.21.3 || >=16" }, "funding": { "url": "https://paulmillr.com/funding/" @@ -2181,11 +2064,12 @@ ] }, "node_modules/@noble/hashes": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", - "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.6.0.tgz", + "integrity": "sha512-YUULf0Uk4/mAA89w+k3+yUYh6NrEvxZa5T6SY3wlMvE2chHkxFUUIDI8/XW1QSC357iA5pSnqt7XEhvFOqmDyQ==", + "license": "MIT", "engines": { - "node": ">= 16" + "node": "^14.21.3 || >=16" }, "funding": { "url": "https://paulmillr.com/funding/" @@ -2292,33 +2176,36 @@ } }, "node_modules/@scure/base": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.6.tgz", - "integrity": "sha512-ok9AWwhcgYuGG3Zfhyqg+zwl+Wn5uE+dwC0NV/2qQkx4dABbb/bx96vWu8NSj+BNjjSjno+JRYRjle1jV08k3g==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.2.1.tgz", + "integrity": "sha512-DGmGtC8Tt63J5GfHgfl5CuAXh96VF/LD8K9Hr/Gv0J2lAoRGlPOMpqMpMbCTOoOJMZCk2Xt+DskdDyn6dEFdzQ==", + "license": "MIT", "funding": { "url": "https://paulmillr.com/funding/" } }, "node_modules/@scure/bip32": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.2.tgz", - "integrity": "sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.6.0.tgz", + "integrity": "sha512-82q1QfklrUUdXJzjuRU7iG7D7XiFx5PHYVS0+oeNKhyDLT7WPqs6pBcM2W5ZdwOwKCwoE1Vy1se+DHjcXwCYnA==", + "license": "MIT", "dependencies": { - "@noble/curves": "~1.2.0", - "@noble/hashes": "~1.3.2", - "@scure/base": "~1.1.2" + "@noble/curves": "~1.7.0", + "@noble/hashes": "~1.6.0", + "@scure/base": "~1.2.1" }, "funding": { "url": "https://paulmillr.com/funding/" } }, "node_modules/@scure/bip39": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz", - "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.5.0.tgz", + "integrity": "sha512-Dop+ASYhnrwm9+HA/HwXg7j2ZqM6yk2fyLWb5znexjctFY3+E+eU8cIWI0Pql0Qx4hPZCijlGq4OL71g+Uz30A==", + "license": "MIT", "dependencies": { - "@noble/hashes": "~1.3.0", - "@scure/base": "~1.1.0" + "@noble/hashes": "~1.6.0", + "@scure/base": "~1.2.1" }, "funding": { "url": "https://paulmillr.com/funding/" @@ -3011,7 +2898,8 @@ "node_modules/@types/dot-object": { "version": "2.1.6", "resolved": "https://registry.npmjs.org/@types/dot-object/-/dot-object-2.1.6.tgz", - "integrity": "sha512-G1e4SNPOuO72ZXv7wz/W2x29CzQtpxko3G9hBiHqGg/AvFIKoArCs2nbc/WPXnnUkO+1dmvX9WQCyj5gIlAzZg==" + "integrity": "sha512-G1e4SNPOuO72ZXv7wz/W2x29CzQtpxko3G9hBiHqGg/AvFIKoArCs2nbc/WPXnnUkO+1dmvX9WQCyj5gIlAzZg==", + "dev": true }, "node_modules/@types/estree": { "version": "1.0.1", @@ -3087,7 +2975,8 @@ "node_modules/@types/node": { "version": "20.2.3", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.2.3.tgz", - "integrity": "sha512-pg9d0yC4rVNWQzX8U7xb4olIOFuuVL9za3bzMT2pu2SU0SNEi66i2qrvhE2qt0HvkhuCaWJu7pLNOt/Pj8BIrw==" + "integrity": "sha512-pg9d0yC4rVNWQzX8U7xb4olIOFuuVL9za3bzMT2pu2SU0SNEi66i2qrvhE2qt0HvkhuCaWJu7pLNOt/Pj8BIrw==", + "devOptional": true }, "node_modules/@types/prop-types": { "version": "15.7.5", @@ -3139,14 +3028,6 @@ "integrity": "sha512-Q5vtl1W5ue16D+nIaW8JWebSSraJVlK+EthKn7e7UcD4KWsaSJ8BqGPXNaPghgtcn/fhvrN17Tv8ksUsQpiplw==", "dev": true }, - "node_modules/@types/ws": { - "version": "8.5.5", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.5.tgz", - "integrity": "sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/yargs": { "version": "17.0.24", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.24.tgz", @@ -3396,21 +3277,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==" - }, - "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==", - "dependencies": { - "@web3pack/base-x": "^1.0.1", - "buffer": "^6.0.3", - "hash.js": "^1.1.7" - } - }, "node_modules/@zxing/text-encoding": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/@zxing/text-encoding/-/text-encoding-0.9.0.tgz", @@ -3425,9 +3291,10 @@ "dev": true }, "node_modules/abitype": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.0.tgz", - "integrity": "sha512-NMeMah//6bJ56H5XRj8QCV4AwuW6hB6zqz2LnhhLdcWVQOsXki6/Pn3APeqxCma62nXIcmZWdu1DlHWS74umVQ==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.7.tgz", + "integrity": "sha512-ZfYYSktDQUwc2eduYu8C4wOs+RDPmnRYMh7zNfzeMtGGgb0U+6tLGjixUic6mXf5xKKCcgT5Qp6cv39tOARVFw==", + "license": "MIT", "funding": { "url": "https://github.com/sponsors/wevm" }, @@ -3832,6 +3699,7 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", + "dev": true, "engines": { "node": ">= 0.4" }, @@ -3840,11 +3708,14 @@ } }, "node_modules/axios": { - "version": "0.26.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", - "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "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.14.8" + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" } }, "node_modules/babel-jest": { @@ -4039,41 +3910,16 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "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==" - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/bignumber": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/bignumber/-/bignumber-1.1.0.tgz", - "integrity": "sha512-EGqHCKkEAwVwufcEOCYhZQqdVH+7cNCyPZ9yxisYvSjHFB+d9YcGMvorsFpeN5IJpC+lC6K+FHhu8+S4MgJazw==", - "engines": { - "node": ">=0.4.0" - } + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-5.0.0.tgz", + "integrity": "sha512-sMW3VGSX1QWVFA6l8U62MLKz29rRfpTlYdCqLdpLo1/Yd4zZwSbnUaDfciIAowAqvq7YFnWq9hrhdg1KYgc1lQ==", + "license": "MIT" }, "node_modules/bignumber.js": { "version": "9.1.2", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==", + "license": "MIT", "engines": { "node": "*" } @@ -4097,14 +3943,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==", - "dependencies": { - "@noble/hashes": "^1.2.0" - } - }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -4115,11 +3953,12 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "license": "MIT", "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -4165,20 +4004,22 @@ } }, "node_modules/bs58": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", - "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "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": "^4.0.0" + "base-x": "^5.0.0" } }, "node_modules/bs58check": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-3.0.1.tgz", - "integrity": "sha512-hjuuJvoWEybo7Hn/0xOrczQKKEKD63WguEjlhLExYs2wUBcebDC1jDNK17eEAD2lYfw82d5ASC1d7K3SWszjaQ==", + "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": "^5.0.0" + "bs58": "^6.0.0" } }, "node_modules/bser": { @@ -4190,29 +4031,6 @@ "node-int64": "^0.4.0" } }, - "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" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -4236,6 +4054,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, "dependencies": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" @@ -4720,10 +4539,11 @@ "devOptional": true }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -4733,11 +4553,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==" - }, "node_modules/css.escape": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", @@ -4825,8 +4640,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", @@ -5962,13 +5776,11 @@ "node": ">=0.10.0" } }, - "node_modules/events": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", - "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", - "engines": { - "node": ">=0.8.x" - } + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "license": "MIT" }, "node_modules/execa": { "version": "5.1.1", @@ -6092,9 +5904,10 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" }, @@ -6146,15 +5959,16 @@ "dev": true }, "node_modules/follow-redirects": { - "version": "1.15.6", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", - "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", "funding": [ { "type": "individual", "url": "https://github.com/sponsors/RubenVerborgh" } ], + "license": "MIT", "engines": { "node": ">=4.0" }, @@ -6168,6 +5982,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" } @@ -6269,6 +6084,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "dev": true, "dependencies": { "function-bind": "^1.1.1", "has": "^1.0.3", @@ -6401,6 +6217,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" }, @@ -6476,6 +6293,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "dev": true, "engines": { "node": ">= 0.4" }, @@ -6487,6 +6305,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" }, @@ -6498,6 +6317,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, "dependencies": { "has-symbols": "^1.0.2" }, @@ -6508,15 +6328,6 @@ "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==", - "dependencies": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, "node_modules/html-encoding-sniffer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz", @@ -6629,25 +6440,6 @@ "node": ">=4" } }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, "node_modules/ignore": { "version": "5.2.4", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", @@ -6741,6 +6533,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" @@ -6814,6 +6607,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" }, @@ -6880,6 +6674,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" }, @@ -6926,6 +6721,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "license": "MIT", "engines": { "node": ">=0.12.0" } @@ -7043,6 +6839,7 @@ "version": "1.1.10", "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", + "dev": true, "dependencies": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", @@ -7098,15 +6895,16 @@ "dev": true }, "node_modules/isows": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.3.tgz", - "integrity": "sha512-2cKei4vlmg2cxEjm3wVSqn8pcoRF/LX/wpifuuNquFO4SQmPwarClT+SUCA2lt+l581tTeZIPIZuIDo2jWN1fg==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.6.tgz", + "integrity": "sha512-lPHCayd40oW98/I0uvgaHKWCSvkzY27LjWLbtzOm64yQ+G3Q5npjjbdppU65iZXkK1Zt+kH9pfegli0AYfwYYw==", "funding": [ { "type": "github", - "url": "https://github.com/sponsors/wagmi-dev" + "url": "https://github.com/sponsors/wevm" } ], + "license": "MIT", "peerDependencies": { "ws": "*" } @@ -8800,11 +8598,6 @@ "integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==", "dev": true }, - "node_modules/js-base64": { - "version": "3.7.5", - "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.5.tgz", - "integrity": "sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA==" - }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -9250,6 +9043,12 @@ "resolved": "https://registry.npmjs.org/lodash.foreach/-/lodash.foreach-4.5.0.tgz", "integrity": "sha512-aEXTF4d+m05rVOAUG3z4vZZ4xVexLKZGF0lIxuHZ1Hplpk/3B6Z1+/ICICYRLm7c41Z2xiejbkCkJoTlypoXhQ==" }, + "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==", + "license": "MIT" + }, "node_modules/lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", @@ -9442,11 +9241,12 @@ } }, "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "license": "MIT", "dependencies": { - "braces": "^3.0.2", + "braces": "^3.0.3", "picomatch": "^2.3.1" }, "engines": { @@ -9498,11 +9298,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==" - }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -9539,15 +9334,16 @@ } }, "node_modules/nanoid": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", - "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -9778,6 +9574,35 @@ "node": ">= 0.8.0" } }, + "node_modules/ox": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/ox/-/ox-0.6.0.tgz", + "integrity": "sha512-blUzTLidvUlshv0O02CnLFqBLidNzPoAZdIth894avUAotTuWziznv6IENv5idRuOSSP3dH8WzcYw84zVdu0Aw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "license": "MIT", + "dependencies": { + "@adraffy/ens-normalize": "^1.10.1", + "@noble/curves": "^1.6.0", + "@noble/hashes": "^1.5.0", + "@scure/bip32": "^1.5.0", + "@scure/bip39": "^1.4.0", + "abitype": "^1.0.6", + "eventemitter3": "5.0.1" + }, + "peerDependencies": { + "typescript": ">=5.4.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -10224,7 +10049,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/psl": { "version": "1.9.0", @@ -10578,9 +10404,10 @@ } }, "node_modules/rollup": { - "version": "3.29.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", - "integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==", + "version": "3.29.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.5.tgz", + "integrity": "sha512-GVsDdsbJzzy4S/v3dqWPJ7EfvZJfCHiDqe80IyrF59LYuP+e6U1LJoUqeuqRbwAWoMNoXivMNeNAOf5E22VA1w==", + "license": "MIT", "bin": { "rollup": "dist/bin/rollup" }, @@ -10689,25 +10516,6 @@ "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", "dev": true }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, "node_modules/safe-regex-test": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz", @@ -10748,6 +10556,12 @@ "loose-envify": "^1.1.0" } }, + "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==", + "license": "MIT" + }, "node_modules/semver": { "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", @@ -10973,14 +10787,6 @@ "node": ">= 0.4" } }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, "node_modules/string-argv": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", @@ -11322,6 +11128,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "license": "MIT", "dependencies": { "is-number": "^7.0.0" }, @@ -11501,9 +11308,10 @@ } }, "node_modules/tslib": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.1.tgz", - "integrity": "sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==" + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" }, "node_modules/tsutils": { "version": "3.21.0", @@ -11638,27 +11446,17 @@ } }, "node_modules/typescript": { - "version": "5.0.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", - "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz", + "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", "devOptional": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=12.20" - } - }, - "node_modules/uid": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/uid/-/uid-2.0.2.tgz", - "integrity": "sha512-u3xV3X7uzvi5b1MncmZo3i2Aw222Zk1keqLA1YkHldREkAhAqi65wuPfe7lHx8H/Wzy+8CE7S7uS3jekIM5s8g==", - "dependencies": { - "@lukeed/csprng": "^1.0.0" - }, - "engines": { - "node": ">=8" + "node": ">=14.17" } }, "node_modules/unbox-primitive": { @@ -11677,10 +11475,11 @@ } }, "node_modules/undici": { - "version": "5.28.3", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz", - "integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==", + "version": "5.28.4", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", + "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", "dev": true, + "license": "MIT", "dependencies": { "@fastify/busboy": "^2.0.0" }, @@ -11770,6 +11569,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", @@ -11809,24 +11609,26 @@ "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==" }, "node_modules/viem": { - "version": "2.9.25", - "resolved": "https://registry.npmjs.org/viem/-/viem-2.9.25.tgz", - "integrity": "sha512-W0QOXCsYQppnV89PQP0EnCvfZIEsDYqmpVakLPNrok4Q4B7651M3MV/sYifYcLWv3Mn4KUyMCUlVxlej6CfC/w==", + "version": "2.22.8", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.22.8.tgz", + "integrity": "sha512-iB3PW/a/qzpYbpjo3R662u6a/zo6piZHez/N/bOC25C79FYXBCs8mQDqwiHk3FYErUhS4KVZLabKV9zGMd+EgQ==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/wevm" } ], - "dependencies": { - "@adraffy/ens-normalize": "1.10.0", - "@noble/curves": "1.2.0", - "@noble/hashes": "1.3.2", - "@scure/bip32": "1.3.2", - "@scure/bip39": "1.2.1", - "abitype": "1.0.0", - "isows": "1.0.3", - "ws": "8.13.0" + "license": "MIT", + "dependencies": { + "@noble/curves": "1.7.0", + "@noble/hashes": "1.6.1", + "@scure/bip32": "1.6.0", + "@scure/bip39": "1.5.0", + "abitype": "1.0.7", + "isows": "1.0.6", + "ox": "0.6.0", + "webauthn-p256": "0.0.10", + "ws": "8.18.0" }, "peerDependencies": { "typescript": ">=5.0.4" @@ -11837,10 +11639,23 @@ } } }, + "node_modules/viem/node_modules/@noble/hashes": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.6.1.tgz", + "integrity": "sha512-pq5D8h10hHBjyqX+cfBm0i8JUXJ0UhczFc4r74zbuT9XgewFo2E3J1cOaGtdZynILNmQ685YWGzGE1Zv6io50w==", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/vite": { - "version": "4.5.2", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.2.tgz", - "integrity": "sha512-tBCZBNSBbHQkaGyhGCDUGqeo2ph8Fstyp6FMSvTtsXeZSPpSMGlviAOav2hxVTqFcx8Hj/twtWKsMJXNY0xI8w==", + "version": "4.5.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.5.tgz", + "integrity": "sha512-ifW3Lb2sMdX+WU91s3R0FyQlAyLxOzCSCP37ujw0+r5POeHPwe6udWVIElKQq8gk3t7b8rkmvqC6IHBpCff4GQ==", + "license": "MIT", "dependencies": { "esbuild": "^0.18.10", "postcss": "^8.4.27", @@ -12349,6 +12164,22 @@ "node": ">= 8" } }, + "node_modules/webauthn-p256": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/webauthn-p256/-/webauthn-p256-0.0.10.tgz", + "integrity": "sha512-EeYD+gmIT80YkSIDb2iWq0lq2zbHo1CxHlQTeJ+KkCILWpVy3zASH3ByD4bopzfk0uCwXxLqKGLqp2W4O28VFA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "license": "MIT", + "dependencies": { + "@noble/curves": "^1.4.0", + "@noble/hashes": "^1.4.0" + } + }, "node_modules/webcrypto-core": { "version": "1.7.7", "resolved": "https://registry.npmjs.org/webcrypto-core/-/webcrypto-core-1.7.7.tgz", @@ -12455,6 +12286,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.11.tgz", "integrity": "sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==", + "dev": true, "dependencies": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", @@ -12547,9 +12379,10 @@ } }, "node_modules/ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "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/wails-frontend/package.json b/wails-frontend/package.json index efcfbec86..3b2ba4f22 100644 --- a/wails-frontend/package.json +++ b/wails-frontend/package.json @@ -17,9 +17,9 @@ "prepare": "cd .. && husky install wails-frontend/.husky" }, "dependencies": { - "@massalabs/massa-web3": "^4.0.2-dev", - "@massalabs/react-ui-kit": "^0.0.5-dev", - "bignumber": "^1.1.0", + "@massalabs/massa-web3": "^5.1.0", + "@massalabs/react-ui-kit": "^1.0.0", + "bignumber.js": "^9.1.2", "currency.js": "^2.0.4", "dot-object": "^2.1.4", "esbuild": "^0.17.19", diff --git a/wails-frontend/src/i18n/en_US.json b/wails-frontend/src/i18n/en_US.json index e24368837..62ef24f26 100644 --- a/wails-frontend/src/i18n/en_US.json +++ b/wails-frontend/src/i18n/en_US.json @@ -61,6 +61,27 @@ "coins": "Coins ", "coins-tooltip": "The amount of coins locked for", "coins-tooltip-2": "storage space on the ledger.", + "deployed-coins": "Deployed contract coins", + "deployed-coins-tooltip": { + "1": "The amount of coins sent to the contract being deployed.", + "2": "Allow it to use storage space on the ledger.", + "3": "Should be non null if constructor need to write to storage." + }, + "deployed-bytecode-cost": "Deployed bytecode cost", + "deployed-bytecode-cost-tooltip": { + "1": "The amount of coins locked for the storage space", + "2": "used for storing the bytecode of the contract being deployed." + }, + "deploy-sc-warning": { + "1": "Deploying a smart contract consist in fact in an ExecuteSC operation", + "2": "This operation can spend coins and tokens from your account.", + "3": "Proceed only if it originates from a trusted source." + }, + "deploy-sc-tooltip": { + "1": "DeploySC allows you to deploy a smart contract on the Massa network.", + "2": "It's in fact a pseudo operation since in background it consist in", + "3": "an ExecuteSC operation that runs a deployer code that deploys your contract." + }, "edit-fees": "edit fees", "confirm-fees": "confirm change", "reset-fees": "reset to default", @@ -76,6 +97,7 @@ "3": "Execute SC", "4": "Call SC" }, + "deploy-sc-pseudo-operation-type": "Deploy SC", "execute-sc-tooltip": { "1": "ExecuteSC operation is a powerful functionality on Massa. It enables the execution of smart contracts directly, instead of storing them on-chain.", "2": "As it is a smart contract which is executing certain functions, coins and tokens can be spent from your account.", diff --git a/wails-frontend/src/pages/PasswordPromptHandler/CallSC/FTTransferInfo.tsx b/wails-frontend/src/pages/PasswordPromptHandler/CallSC/FTTransferInfo.tsx index 10dc9f984..b0d20036e 100644 --- a/wails-frontend/src/pages/PasswordPromptHandler/CallSC/FTTransferInfo.tsx +++ b/wails-frontend/src/pages/PasswordPromptHandler/CallSC/FTTransferInfo.tsx @@ -1,4 +1,4 @@ -import { Args } from '@massalabs/massa-web3'; +import { Args, strToBytes } from '@massalabs/massa-web3'; import { formatAmount } from '@massalabs/react-ui-kit'; import { maskAddress } from '@massalabs/react-ui-kit/src/lib/massa-react/utils'; import { LogPrint } from '@wailsjs/runtime/runtime'; @@ -6,7 +6,6 @@ import { LogPrint } from '@wailsjs/runtime/runtime'; import Intl from '@/i18n/i18n'; import { AmountBox } from '@/pages/PasswordPromptHandler/AmountBox'; import { AssetInfo } from '@/pages/PasswordPromptHandler/Sign'; -import { base64ToArray } from '@/utils/parameters'; interface FTTransferInfoProps { targetFunction: string; @@ -24,7 +23,7 @@ export function FTTransferInfo(props: FTTransferInfoProps) { let amount = 0n; let recipient = ''; try { - const args = new Args(base64ToArray(parameters)); + const args = new Args(strToBytes(parameters)); recipient = args.nextString(); amount = args.nextU256(); } catch (error) { diff --git a/wails-frontend/src/pages/PasswordPromptHandler/ExecuteSC.tsx/ExecuteSc.tsx b/wails-frontend/src/pages/PasswordPromptHandler/ExecuteSC.tsx/ExecuteSc.tsx index 031b5a89b..3809ef096 100644 --- a/wails-frontend/src/pages/PasswordPromptHandler/ExecuteSC.tsx/ExecuteSc.tsx +++ b/wails-frontend/src/pages/PasswordPromptHandler/ExecuteSC.tsx/ExecuteSc.tsx @@ -15,8 +15,11 @@ export function ExecuteSC(props: SignBodyProps) { Nickname, Description: description, children, + DeployedByteCodeSize, } = props; + const isDeploySC = DeployedByteCodeSize > 0; + return (
@@ -27,19 +30,32 @@ export function ExecuteSC(props: SignBodyProps) {

{Intl.t('password-prompt.sign.operation-type')}

- {Intl.t(`password-prompt.sign.operation-types.${OperationType}`)} + {isDeploySC + ? Intl.t('password-prompt.sign.deploy-sc-pseudo-operation-type') + : Intl.t(`password-prompt.sign.operation-types.${OperationType}`)}

- {Intl.t('password-prompt.sign.execute-sc-tooltip.1')} -
- {Intl.t('password-prompt.sign.execute-sc-tooltip.2')} -
-
- {Intl.t('password-prompt.sign.execute-sc-tooltip.3')} - + isDeploySC ? ( + <> + {Intl.t('password-prompt.sign.deploy-sc-tooltip.1')} +
+
+ {Intl.t('password-prompt.sign.deploy-sc-tooltip.2')} +
+ {Intl.t('password-prompt.sign.deploy-sc-tooltip.3')} + + ) : ( + <> + {Intl.t('password-prompt.sign.execute-sc-tooltip.1')} +
+ {Intl.t('password-prompt.sign.execute-sc-tooltip.2')} +
+
+ {Intl.t('password-prompt.sign.execute-sc-tooltip.3')} + + ) } > @@ -54,9 +70,21 @@ export function ExecuteSC(props: SignBodyProps) { strokeWidth="2" />

- {Intl.t('password-prompt.sign.execute-sc-warning.1')} -
- {Intl.t('password-prompt.sign.execute-sc-warning.2')} + {isDeploySC ? ( + <> + {Intl.t('password-prompt.sign.deploy-sc-warning.1')} +
+ {Intl.t('password-prompt.sign.deploy-sc-warning.2')} +
+ {Intl.t('password-prompt.sign.deploy-sc-warning.3')} + + ) : ( + <> + {Intl.t('password-prompt.sign.execute-sc-warning.1')} +
+ {Intl.t('password-prompt.sign.execute-sc-warning.2')} + + )}

@@ -64,27 +92,33 @@ export function ExecuteSC(props: SignBodyProps) { -
-
- - {Intl.t('password-prompt.sign.execute-sc-max-coins-tooltip.1')} -
- {Intl.t('password-prompt.sign.execute-sc-max-coins-tooltip.2')} - - } - > - -
-

{Intl.t('password-prompt.sign.max-coins')}

+ {!isDeploySC && ( +
+
+ + {Intl.t( + 'password-prompt.sign.execute-sc-max-coins-tooltip.1', + )} +
+ {Intl.t( + 'password-prompt.sign.execute-sc-max-coins-tooltip.2', + )} + + } + > + +
+

{Intl.t('password-prompt.sign.max-coins')}

+
+

+ {formatAmount(MaxCoins).full} {massaToken} +

-

- {formatAmount(MaxCoins).full} {massaToken} -

-
+ )} {children}
diff --git a/wails-frontend/src/pages/PasswordPromptHandler/Sign.tsx b/wails-frontend/src/pages/PasswordPromptHandler/Sign.tsx index f1215137c..7f1ea3e2c 100644 --- a/wails-frontend/src/pages/PasswordPromptHandler/Sign.tsx +++ b/wails-frontend/src/pages/PasswordPromptHandler/Sign.tsx @@ -1,6 +1,6 @@ import { SyntheticEvent, useRef, useState } from 'react'; -import { fromMAS, toMAS } from '@massalabs/massa-web3'; +import { Mas } from '@massalabs/massa-web3'; import { Button, Password } from '@massalabs/react-ui-kit'; import { SendSignPromptInput } from '@wailsjs/go/walletapp/WalletApp'; import { EventsOnce, WindowSetSize } from '@wailsjs/runtime/runtime'; @@ -61,6 +61,8 @@ export interface SignBodyProps { ChainID: number; Assets: AssetInfo[]; Parameters: string; // base64 + DeployedByteCodeSize: number; // for executeSC of type deploySC + DeployedCoins: number; // for executeSC of type deploySC children?: React.ReactNode; } @@ -87,8 +89,8 @@ export function Sign() { const signData = req.Data as SignBodyProps; const [error, setError] = useState(null); const [errorMessage, setErrorMessage] = useState(''); - const [fees, setFees] = useState( - toMAS(signData.Fees || '0').toString(), + const [fees, setFees] = useState( // in MAS + Mas.toString(BigInt(signData.Fees || '0')), ); const [isEditing, setIsEditing] = useState(false); @@ -98,7 +100,11 @@ export function Sign() { EventsOnce(events.promptResult, handleResult); - SendSignPromptInput(password, fromMAS(fees).toString(), req.CorrelationID); + SendSignPromptInput( + password, + Mas.fromString(fees).toString(), + req.CorrelationID, + ); } function handleResult(result: promptResult) { @@ -141,6 +147,8 @@ export function Sign() { isEditing, setIsEditing, allowFeeEdition: signData.AllowFeeEdition, + DeployedByteCodeSize: signData.DeployedByteCodeSize, + DeployedCoins: signData.DeployedCoins, }; return ( diff --git a/wails-frontend/src/pages/PasswordPromptHandler/SignComponentUtils/OperationCost.tsx b/wails-frontend/src/pages/PasswordPromptHandler/SignComponentUtils/OperationCost.tsx index 9dc83f5e5..045f05416 100644 --- a/wails-frontend/src/pages/PasswordPromptHandler/SignComponentUtils/OperationCost.tsx +++ b/wails-frontend/src/pages/PasswordPromptHandler/SignComponentUtils/OperationCost.tsx @@ -1,13 +1,19 @@ -import { SyntheticEvent, useEffect, useMemo, useState } from 'react'; +import { + SyntheticEvent, + useCallback, + useEffect, + useMemo, + useState, +} from 'react'; -import { fromMAS, toMAS } from '@massalabs/massa-web3'; +import { Mas, StorageCost } from '@massalabs/massa-web3'; import { AccordionCategory, AccordionContent, InlineMoney, Tooltip, + formatAmount, } from '@massalabs/react-ui-kit'; -import { formatAmount } from '@massalabs/react-ui-kit'; import { massaToken } from '@massalabs/react-ui-kit/src/lib/massa-react/const'; import BigNumber from 'bignumber.js'; import { @@ -33,26 +39,38 @@ export interface OperationCostProps { isEditing?: boolean; setIsEditing: (isEditing: boolean) => void; allowFeeEdition: boolean; + DeployedByteCodeSize: number; // for executeSC of type deploySC + DeployedCoins: number; // for executeSC of type deploySC, in nanoMAS } export function OperationCost(props: OperationCostProps) { const hideCoins = props.coins === undefined; + const hideByteCodeCost = props.DeployedByteCodeSize === 0; + const hideDeployedCoins = props.DeployedCoins === 0; - const coins = toMAS(props.coins || 0).toFixed(9); + const coins = Mas.toString(BigInt(props.coins || 0n), Mas.NB_DECIMALS); // to MAS + const byteCodeStorageCost = Mas.toString( + props.DeployedByteCodeSize + ? StorageCost.smartContract(props.DeployedByteCodeSize) + : 0n, + Mas.NB_DECIMALS, + ); // to MAS + const deployedCoins = Mas.toString( + BigInt(props.DeployedCoins || 0), + Mas.NB_DECIMALS, + ); // to MAS const { fees, setFees, minFees, isEditing, setIsEditing, allowFeeEdition } = props; - const [operationCost, setOperationCost] = useState( - new BigNumber(coins).plus(new BigNumber(fees)).toFixed(9), - ); const [error, setError] = useState(); + /* Compute fees*/ function getDefaultFees(): string { if (fees === '') { return minFees; } - if (fromMAS(fees) < fromMAS(minFees)) { + if (Mas.fromString(fees) < Mas.fromString(minFees)) { return minFees; } @@ -63,24 +81,38 @@ export function OperationCost(props: OperationCostProps) { const defaultFees = useMemo(getDefaultFees, [minFees]); if (fees === '') setFees(defaultFees); - if (fromMAS(fees) < fromMAS(minFees)) setFees(minFees); + if (Mas.fromString(fees) < Mas.fromString(minFees)) setFees(minFees); + + /* Handle operation cost*/ + const computeOperationCost = useCallback(() => { + return new BigNumber(coins) + .plus( + new BigNumber(fees) + .plus(new BigNumber(deployedCoins)) + .plus(new BigNumber(byteCodeStorageCost)), + ) + .toFixed(9); + }, [fees, coins, deployedCoins, byteCodeStorageCost]); + + const [operationCost, setOperationCost] = useState(computeOperationCost()); useEffect(() => { - setOperationCost(new BigNumber(coins).plus(new BigNumber(fees)).toFixed(9)); - }, [fees, coins]); + setOperationCost(computeOperationCost()); + }, [computeOperationCost]); + /* handleConfirmTemplate callback functions*/ function handleEdit(e: SyntheticEvent) { e.preventDefault(); setIsEditing(true); } function validate(): boolean { - if (fromMAS(fees) < fromMAS(minFees)) { + if (Mas.fromString(fees) < Mas.fromString(minFees)) { setError(Intl.t('password-prompt.sign.fees-to-low')); return false; } - if (fromMAS(fees) >= MAX_FEES) { + if (Mas.fromString(fees) >= MAX_FEES) { setError(Intl.t('password-prompt.sign.fees-to-high')); return false; } @@ -104,6 +136,7 @@ export function OperationCost(props: OperationCostProps) { setFees(defaultFees); } + /* Set fee edition button if fee edition is allowed */ const feeEditionButtonsRow = allowFeeEdition ? (
{isEditing ? ( @@ -204,6 +237,66 @@ export function OperationCost(props: OperationCostProps) { />
)} + {!hideDeployedCoins && ( +
+

+ + {Intl.t( + 'password-prompt.sign.deployed-coins-tooltip.1', + )} +
+ {Intl.t( + 'password-prompt.sign.deployed-coins-tooltip.2', + )} +
+ {Intl.t( + 'password-prompt.sign.deployed-coins-tooltip.3', + )} + + } + > + +
+ {Intl.t('password-prompt.sign.deployed-coins')} +

+ +
+ )} + {!hideByteCodeCost && ( +
+

+ + {Intl.t( + 'password-prompt.sign.deployed-bytecode-cost-tooltip.1', + )} +
+ {Intl.t( + 'password-prompt.sign.deployed-bytecode-cost-tooltip.2', + )} + + } + > + +
+ {Intl.t('password-prompt.sign.deployed-bytecode-cost')} +

+ +
+ )} {feeEditionButtonsRow}
diff --git a/wails-frontend/src/pages/PasswordPromptHandler/components/NetworkName.tsx b/wails-frontend/src/pages/PasswordPromptHandler/components/NetworkName.tsx index df12d54d2..a6de52d24 100644 --- a/wails-frontend/src/pages/PasswordPromptHandler/components/NetworkName.tsx +++ b/wails-frontend/src/pages/PasswordPromptHandler/components/NetworkName.tsx @@ -1,25 +1,25 @@ -import { CHAIN_ID_TO_NETWORK_NAME, MAINNET } from '@massalabs/massa-web3'; +import { + getNetworkNameByChainId, + NetworkName as networkNameEnum, +} from '@massalabs/massa-web3'; import { InterrogationPoint, MassaLogo } from '@massalabs/react-ui-kit'; import Intl from '@/i18n/i18n'; -type ChainId = keyof typeof CHAIN_ID_TO_NETWORK_NAME; - export interface NetworkNameProps { chainId: number; } export function NetworkName({ chainId }: NetworkNameProps) { - let networkName: string; - let networkIsKnown = false; - let secondaryColor = undefined; let primaryColor = undefined; - if (chainId in CHAIN_ID_TO_NETWORK_NAME) { - networkName = CHAIN_ID_TO_NETWORK_NAME[chainId as ChainId]; + let networkName: undefined | string | networkNameEnum = + getNetworkNameByChainId(BigInt(chainId)); + let networkIsKnown = false; + if (networkName) { networkIsKnown = true; - if (networkName === MAINNET) { + if (networkName === networkNameEnum.Mainnet) { primaryColor = '#FF0000'; secondaryColor = '#FFFFFF'; } else {