From 58c9cc4c9200ac832a15c0e564f2a2f286d5ffdb Mon Sep 17 00:00:00 2001 From: shrinathprabhu Date: Wed, 26 Jun 2024 12:51:45 +0400 Subject: [PATCH 01/13] Dynamically import the accountHandlers --- src/pages/PermissionRequest.vue | 6 +++--- src/pages/TransakSell.vue | 6 +++--- src/pages/loggedInView.vue | 6 +++--- src/utils/accountHandler.ts | 32 ++++++++++++++++++++++---------- 4 files changed, 31 insertions(+), 19 deletions(-) diff --git a/src/pages/PermissionRequest.vue b/src/pages/PermissionRequest.vue index 3a2a5360..b93040a1 100644 --- a/src/pages/PermissionRequest.vue +++ b/src/pages/PermissionRequest.vue @@ -101,10 +101,10 @@ async function getAppDetails(appId: string) { return data } -function initAccountHandler(rpcUrl) { +async function initAccountHandler(rpcUrl) { const { privateKey } = getStorage().local.getUserInfo() if (!requestHandlerExists()) { - const accountHandler = CreateAccountHandler(privateKey, rpcUrl) + const accountHandler = await CreateAccountHandler(privateKey, rpcUrl) setRequestHandler(accountHandler) } } @@ -213,7 +213,7 @@ async function initFromChainId(chainId: string) { isCustom: false, } rpcStore.setSelectedRPCConfig(rpcConfig) - initAccountHandler(chainDetails.rpc_url) + await initAccountHandler(chainDetails.rpc_url) setRPCConfigInRequestHandler(chainDetails) } } diff --git a/src/pages/TransakSell.vue b/src/pages/TransakSell.vue index e776f936..61059d1a 100644 --- a/src/pages/TransakSell.vue +++ b/src/pages/TransakSell.vue @@ -98,7 +98,7 @@ onBeforeMount(async () => { populateFields(chain) initStorage(appId) updateTheme() - initAccountHandler(chain?.rpcUrls[0]) + await initAccountHandler(chain?.rpcUrls[0]) explorerUrl.value = chain?.blockExplorerUrls ? chain.blockExplorerUrls[0] : '' await handleGasless( chain?.chainId as string, @@ -227,10 +227,10 @@ async function getAppDetails(appId: string) { return data } -function initAccountHandler(rpcUrl) { +async function initAccountHandler(rpcUrl) { const { privateKey } = getStorage().local.getUserInfo() if (!requestHandlerExists()) { - const accountHandler = CreateAccountHandler(privateKey, rpcUrl) + const accountHandler = await CreateAccountHandler(privateKey, rpcUrl) setRequestHandler(accountHandler) } } diff --git a/src/pages/loggedInView.vue b/src/pages/loggedInView.vue index 42ecee5a..88201659 100644 --- a/src/pages/loggedInView.vue +++ b/src/pages/loggedInView.vue @@ -225,9 +225,9 @@ async function getAccountDetails() { await initAccountHandler() } -function initKeeper(rpcUrl) { +async function initKeeper(rpcUrl) { if (!requestHandlerExists()) { - const accountHandler = CreateAccountHandler( + const accountHandler = await CreateAccountHandler( userStore.privateKey, rpcUrl, appStore.chainType @@ -417,7 +417,7 @@ async function getRpcConfig() { let rpcConfig = enabledChainList.value.find((chain) => chain.defaultChain) || enabledChainList.value[0] // some time, chain list don't have default chain - initKeeper(rpcConfig.rpcUrls[0]) + await initKeeper(rpcConfig.rpcUrls[0]) rpcStore.setSelectedRPCConfig(rpcConfig) rpcStore.setRpcConfig(rpcConfig) } diff --git a/src/utils/accountHandler.ts b/src/utils/accountHandler.ts index 5c23dc55..9f0ea721 100644 --- a/src/utils/accountHandler.ts +++ b/src/utils/accountHandler.ts @@ -1,10 +1,10 @@ import base58 from 'bs58' import { ChainType } from '@/utils/chainType' -import { EVMAccountHandler } from '@/utils/evm/accountHandler' -import { MultiversXAccountHandler } from '@/utils/multiversx/accountHandler' -import { NEARAccountHandler } from '@/utils/near/accountHandler' -import { SolanaAccountHandler } from '@/utils/solana/accountHandler' +import { type EVMAccountHandler } from '@/utils/evm/accountHandler' +import { type MultiversXAccountHandler } from '@/utils/multiversx/accountHandler' +import { type NEARAccountHandler } from '@/utils/near/accountHandler' +import { type SolanaAccountHandler } from '@/utils/solana/accountHandler' type AccountHandler = | EVMAccountHandler @@ -12,20 +12,32 @@ type AccountHandler = | MultiversXAccountHandler | NEARAccountHandler -function CreateAccountHandler( +async function CreateAccountHandler( privateKey: string, rpcUrl: string, chainType: ChainType = ChainType.evm_secp256k1 -): AccountHandler { +): Promise { switch (chainType) { - case ChainType.multiversx_cv25519: + case ChainType.multiversx_cv25519: { + const { MultiversXAccountHandler } = await import( + '@/utils/multiversx/accountHandler' + ) return new MultiversXAccountHandler(base58.decode(privateKey), rpcUrl) - case ChainType.solana_cv25519: + } + case ChainType.solana_cv25519: { + const { SolanaAccountHandler } = await import( + '@/utils/solana/accountHandler' + ) return new SolanaAccountHandler(base58.decode(privateKey), rpcUrl) - case ChainType.near_cv25519: + } + case ChainType.near_cv25519: { + const { NEARAccountHandler } = await import('@/utils/near/accountHandler') return new NEARAccountHandler(privateKey) - default: + } + default: { + const { EVMAccountHandler } = await import('@/utils/evm/accountHandler') return new EVMAccountHandler(privateKey, rpcUrl) + } } } From abf5927d33ceb72afe2151e1860c98422f65f944 Mon Sep 17 00:00:00 2001 From: shrinathprabhu Date: Wed, 26 Jun 2024 13:08:05 +0400 Subject: [PATCH 02/13] Remove yup, replace with validator and remove emailScheme --- package-lock.json | 98 +++++-------------------------- package.json | 4 +- src/pages/backCompat/initPage.vue | 4 +- src/pages/initPageV2.vue | 4 +- src/utils/emailScheme.ts | 5 -- 5 files changed, 21 insertions(+), 94 deletions(-) delete mode 100644 src/utils/emailScheme.ts diff --git a/package-lock.json b/package-lock.json index 126def15..d30bcae7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53,6 +53,7 @@ "pusher-js": "^8.4.0-rc2", "qrious": "^4.0.2", "uuid": "^9.0.1", + "validator": "^13.12.0", "vue": "^3.4.27", "vue-class-component": "^8.0.0-rc.1", "vue-gtag": "^2.0.1", @@ -61,8 +62,7 @@ "vue-router": "^4.3.2", "vue-slider-component": "^4.1.0-beta.7", "vue-toastification": "^2.0.0-rc.5", - "vue3-popper": "^1.5.0", - "yup": "^0.32.11" + "vue3-popper": "^1.5.0" }, "devDependencies": { "@babel/core": "^7.24.6", @@ -8316,11 +8316,6 @@ "@types/node": "*" } }, - "node_modules/@types/lodash": { - "version": "4.14.183", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.183.tgz", - "integrity": "sha512-UXavyuxzXKMqJPEpFPri6Ku5F9af6ZJXUneHhvQJxavrEjuHkFp2YnDWHcxJiG7hk8ZkWqjcyNeW1s/smZv5cw==" - }, "node_modules/@types/long": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz", @@ -23998,11 +23993,6 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, - "node_modules/lodash-es": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", - "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" - }, "node_modules/lodash.camelcase": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", @@ -25358,11 +25348,6 @@ "resolved": "https://registry.npmjs.org/nanoassert/-/nanoassert-1.1.0.tgz", "integrity": "sha512-C40jQ3NzfkP53NsO8kEOFd79p4b9kDXQMwgiY1z8ZwrDZgUyom0AHwGegF4Dm99L+YoYhuaB0ceerUcXmqr1rQ==" }, - "node_modules/nanoclone": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/nanoclone/-/nanoclone-0.2.1.tgz", - "integrity": "sha512-wynEP02LmIbLpcYw8uBKpcfF6dmg2vcpKqxeH5UcoKEYdExslsdUA4ugFauuaeYdTB76ez6gJW8XAZ6CgkXYxA==" - }, "node_modules/nanoid": { "version": "3.3.7", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", @@ -27979,11 +27964,6 @@ "asap": "~2.0.6" } }, - "node_modules/property-expr": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/property-expr/-/property-expr-2.0.5.tgz", - "integrity": "sha512-IJUkICM5dP5znhCckHSv30Q4b5/JA5enCtkRHYaOVOAocnH/1BQEYTC5NMfT3AVl/iXKdr3aqQbQn9DxyWknwA==" - }, "node_modules/protobufjs": { "version": "6.11.4", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.4.tgz", @@ -31528,11 +31508,6 @@ "node": ">=0.6" } }, - "node_modules/toposort": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/toposort/-/toposort-2.0.2.tgz", - "integrity": "sha512-0a5EOkAUp8D4moMi2W8ZF8jcga7BgZd91O/yabJCFY8az+XSzeGyTKs0Aoo897iV1Nj6guFq8orWDS96z91oGg==" - }, "node_modules/totalist": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/totalist/-/totalist-1.1.0.tgz", @@ -32400,6 +32375,14 @@ "spdx-expression-parse": "^3.0.0" } }, + "node_modules/validator": { + "version": "13.12.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.12.0.tgz", + "integrity": "sha512-c1Q0mCiPlgdTVVVIJIrBuxNicYE+t/7oKeI9MWLj3fh/uq2Pxh/3eeWbVZ4OcGW1TUf53At0njHw5SMdA3tmMg==", + "engines": { + "node": ">= 0.10" + } + }, "node_modules/varint": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", @@ -35795,23 +35778,6 @@ "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==", "dev": true }, - "node_modules/yup": { - "version": "0.32.11", - "resolved": "https://registry.npmjs.org/yup/-/yup-0.32.11.tgz", - "integrity": "sha512-Z2Fe1bn+eLstG8DRR6FTavGD+MeAwyfmouhHsIUgaADz8jvFKbO/fXc2trJKZg+5EBjh4gGm3iU/t3onKlXHIg==", - "dependencies": { - "@babel/runtime": "^7.15.4", - "@types/lodash": "^4.14.175", - "lodash": "^4.17.21", - "lodash-es": "^4.17.21", - "nanoclone": "^0.2.1", - "property-expr": "^2.0.4", - "toposort": "^2.0.2" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/zod": { "version": "3.22.4", "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.4.tgz", @@ -41730,11 +41696,6 @@ "@types/node": "*" } }, - "@types/lodash": { - "version": "4.14.183", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.183.tgz", - "integrity": "sha512-UXavyuxzXKMqJPEpFPri6Ku5F9af6ZJXUneHhvQJxavrEjuHkFp2YnDWHcxJiG7hk8ZkWqjcyNeW1s/smZv5cw==" - }, "@types/long": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz", @@ -53779,11 +53740,6 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, - "lodash-es": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", - "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" - }, "lodash.camelcase": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", @@ -54813,11 +54769,6 @@ "resolved": "https://registry.npmjs.org/nanoassert/-/nanoassert-1.1.0.tgz", "integrity": "sha512-C40jQ3NzfkP53NsO8kEOFd79p4b9kDXQMwgiY1z8ZwrDZgUyom0AHwGegF4Dm99L+YoYhuaB0ceerUcXmqr1rQ==" }, - "nanoclone": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/nanoclone/-/nanoclone-0.2.1.tgz", - "integrity": "sha512-wynEP02LmIbLpcYw8uBKpcfF6dmg2vcpKqxeH5UcoKEYdExslsdUA4ugFauuaeYdTB76ez6gJW8XAZ6CgkXYxA==" - }, "nanoid": { "version": "3.3.7", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", @@ -56669,11 +56620,6 @@ "asap": "~2.0.6" } }, - "property-expr": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/property-expr/-/property-expr-2.0.5.tgz", - "integrity": "sha512-IJUkICM5dP5znhCckHSv30Q4b5/JA5enCtkRHYaOVOAocnH/1BQEYTC5NMfT3AVl/iXKdr3aqQbQn9DxyWknwA==" - }, "protobufjs": { "version": "6.11.4", "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.4.tgz", @@ -59383,11 +59329,6 @@ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" }, - "toposort": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/toposort/-/toposort-2.0.2.tgz", - "integrity": "sha512-0a5EOkAUp8D4moMi2W8ZF8jcga7BgZd91O/yabJCFY8az+XSzeGyTKs0Aoo897iV1Nj6guFq8orWDS96z91oGg==" - }, "totalist": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/totalist/-/totalist-1.1.0.tgz", @@ -60036,6 +59977,11 @@ "spdx-expression-parse": "^3.0.0" } }, + "validator": { + "version": "13.12.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-13.12.0.tgz", + "integrity": "sha512-c1Q0mCiPlgdTVVVIJIrBuxNicYE+t/7oKeI9MWLj3fh/uq2Pxh/3eeWbVZ4OcGW1TUf53At0njHw5SMdA3tmMg==" + }, "varint": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", @@ -62694,20 +62640,6 @@ } } }, - "yup": { - "version": "0.32.11", - "resolved": "https://registry.npmjs.org/yup/-/yup-0.32.11.tgz", - "integrity": "sha512-Z2Fe1bn+eLstG8DRR6FTavGD+MeAwyfmouhHsIUgaADz8jvFKbO/fXc2trJKZg+5EBjh4gGm3iU/t3onKlXHIg==", - "requires": { - "@babel/runtime": "^7.15.4", - "@types/lodash": "^4.14.175", - "lodash": "^4.17.21", - "lodash-es": "^4.17.21", - "nanoclone": "^0.2.1", - "property-expr": "^2.0.4", - "toposort": "^2.0.2" - } - }, "zod": { "version": "3.22.4", "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.4.tgz", diff --git a/package.json b/package.json index 9e0b880a..7b6051ed 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "pusher-js": "^8.4.0-rc2", "qrious": "^4.0.2", "uuid": "^9.0.1", + "validator": "^13.12.0", "vue": "^3.4.27", "vue-class-component": "^8.0.0-rc.1", "vue-gtag": "^2.0.1", @@ -69,8 +70,7 @@ "vue-router": "^4.3.2", "vue-slider-component": "^4.1.0-beta.7", "vue-toastification": "^2.0.0-rc.5", - "vue3-popper": "^1.5.0", - "yup": "^0.32.11" + "vue3-popper": "^1.5.0" }, "devDependencies": { "@babel/core": "^7.24.6", diff --git a/src/pages/backCompat/initPage.vue b/src/pages/backCompat/initPage.vue index 32c630a3..dff130a9 100644 --- a/src/pages/backCompat/initPage.vue +++ b/src/pages/backCompat/initPage.vue @@ -1,6 +1,7 @@ - - diff --git a/src/main.ts b/src/main.ts index 48a02fa1..da4f5624 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,7 +4,6 @@ import { BrowserTracing } from '@sentry/tracing' import { init as SentryInit, vueRouterInstrumentation } from '@sentry/vue' import { createApp } from 'vue' import VueGtag from 'vue-gtag' -import JsonViewer from 'vue-json-viewer' import Toast from 'vue-toastification' import App from '@/App.vue' @@ -51,7 +50,7 @@ if ( }) } -walletApp.use(JsonViewer).use(router).use(Toast, toastOptions).use(store) +walletApp.use(router).use(Toast, toastOptions).use(store) if (process.env.NODE_ENV === 'production') { walletApp.use(VueGtag, { diff --git a/src/shims-vue.d.ts b/src/shims-vue.d.ts index 4ed8cd6b..b6568e26 100644 --- a/src/shims-vue.d.ts +++ b/src/shims-vue.d.ts @@ -31,5 +31,3 @@ declare namespace NodeJS { VUE_APP_DKG_CONTRACT_ADDRESS: string } } - -declare module 'vue-json-viewer' From 8e1218fd529f365ead21296447fa782b4a9faef1 Mon Sep 17 00:00:00 2001 From: shrinathprabhu Date: Wed, 26 Jun 2024 15:03:52 +0400 Subject: [PATCH 05/13] Move node-polyfill-plugin to devDep --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cef8ed2e..149562fc 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,6 @@ "ethers": "^5.7.2", "json-rpc-engine": "^6.1.0", "near-api-js": "^4.0.1", - "node-polyfill-webpack-plugin": "^4.0.0", "penpal": "^6.2.2", "pinia": "^2.1.7", "pusher-js": "^8.4.0-rc2", @@ -82,6 +81,7 @@ "husky": "^7.0.4", "lint-staged": "^12.5.0", "markdownlint-cli": "^0.41.0", + "node-polyfill-webpack-plugin": "^4.0.0", "npm-run-all": "^4.1.5", "postcss": "^8.4.38", "prettier": "^2.8.8", From dd4340db81a9649bc7fd6711b0d629587b5a760c Mon Sep 17 00:00:00 2001 From: shrinathprabhu Date: Thu, 27 Jun 2024 10:17:27 +0400 Subject: [PATCH 06/13] Remove arcana.abi.json --- src/abis/arcana.abi.json | 771 --------------------------------------- 1 file changed, 771 deletions(-) delete mode 100644 src/abis/arcana.abi.json diff --git a/src/abis/arcana.abi.json b/src/abis/arcana.abi.json deleted file mode 100644 index a29b6b60..00000000 --- a/src/abis/arcana.abi.json +++ /dev/null @@ -1,771 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "previousAdmin", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "beacon", - "type": "address" - } - ], - "name": "BeaconUpgraded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "identity", - "type": "address" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "file", - "type": "bytes32" - } - ], - "name": "DeleteFileEvent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "identity", - "type": "address" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "file", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fileSize", - "type": "uint256" - } - ], - "name": "NewFileUpdate", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "identity", - "type": "address" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "file", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "validity", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "accessType", - "type": "bytes32" - } - ], - "name": "NewPermissionCheck", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "identity", - "type": "address" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "file", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "accessType", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "validity", - "type": "uint256" - } - ], - "name": "NewShare", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "identity", - "type": "address" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "file", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "accessType", - "type": "bytes32" - } - ], - "name": "NewUpdateAccess", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "implementation", - "type": "address" - } - ], - "name": "Upgraded", - "type": "event" - }, - { - "inputs": [], - "name": "DID", - "outputs": [ - { - "internalType": "contract IDID", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "NFTHandler", - "outputs": [ - { - "internalType": "contract IArcanaNFTHandler", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "accessSpecifier", - "outputs": [ - { - "internalType": "uint256", - "name": "version", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "time", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "aggregateLogin", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_did", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "changeFileOwner", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_did", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "_accessType", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "_ephemeralAddress", - "type": "address" - } - ], - "name": "checkPermission", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "consumption", - "outputs": [ - { - "internalType": "uint256", - "name": "store", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "bandwidth", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "defaultLimit", - "outputs": [ - { - "internalType": "uint256", - "name": "store", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "bandwidth", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_did", - "type": "bytes32" - } - ], - "name": "deleteFile", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getAppConfig", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getImplementation", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_factory", - "type": "address" - }, - { - "internalType": "address", - "name": "_relayer", - "type": "address" - }, - { - "internalType": "bool", - "name": "_aggregateLogin", - "type": "bool" - }, - { - "internalType": "address", - "name": "_handlerContract", - "type": "address" - }, - { - "internalType": "address", - "name": "_did", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_appConfigValue", - "type": "bytes32" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "forwarder", - "type": "address" - } - ], - "name": "isTrustedForwarder", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "limit", - "outputs": [ - { - "internalType": "uint256", - "name": "store", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "bandwidth", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_did", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "_tokenId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_nftContract", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_chainId", - "type": "uint256" - } - ], - "name": "linkNFT", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_did", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_accessType", - "type": "bytes32" - } - ], - "name": "revoke", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "appConfig", - "type": "bytes32" - } - ], - "name": "setAppConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_store", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_bandwidth", - "type": "uint256" - } - ], - "name": "setAppLevelLimit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_store", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_bandwidth", - "type": "uint256" - } - ], - "name": "setDefaultLimit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "setUiMode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_store", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_bandwidth", - "type": "uint256" - } - ], - "name": "setUserLevelLimit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32[]", - "name": "_files", - "type": "bytes32[]" - }, - { - "internalType": "address[]", - "name": "_user", - "type": "address[]" - }, - { - "internalType": "bytes32[]", - "name": "_accessType", - "type": "bytes32[]" - }, - { - "internalType": "uint256[]", - "name": "_validity", - "type": "uint256[]" - } - ], - "name": "share", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - } - ], - "name": "upgradeTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "upgradeToAndCall", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_did", - "type": "bytes32" - } - ], - "name": "uploadClose", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_did", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "_fileSize", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "_encryptedMetaData", - "type": "bytes" - }, - { - "internalType": "address", - "name": "_storageNode", - "type": "address" - }, - { - "internalType": "address", - "name": "_ephemeralAddress", - "type": "address" - }, - { - "internalType": "bool", - "name": "_duplicate", - "type": "bool" - } - ], - "name": "uploadInit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "walletType", - "outputs": [ - { - "internalType": "enum Arcana.WalletMode", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - } -] From 812ca484b97052202f7246d09bac02f870e40d98 Mon Sep 17 00:00:00 2001 From: shrinathprabhu Date: Thu, 27 Jun 2024 10:19:47 +0400 Subject: [PATCH 07/13] Remove unused components --- src/components/BaseTabs.vue | 35 ---------- src/components/ChangeChain.vue | 113 --------------------------------- src/components/DateTime.vue | 25 -------- src/utils/chargeInfo.ts | 5 -- 4 files changed, 178 deletions(-) delete mode 100644 src/components/BaseTabs.vue delete mode 100644 src/components/ChangeChain.vue delete mode 100644 src/components/DateTime.vue delete mode 100644 src/utils/chargeInfo.ts diff --git a/src/components/BaseTabs.vue b/src/components/BaseTabs.vue deleted file mode 100644 index 7567a84e..00000000 --- a/src/components/BaseTabs.vue +++ /dev/null @@ -1,35 +0,0 @@ - - - - - diff --git a/src/components/ChangeChain.vue b/src/components/ChangeChain.vue deleted file mode 100644 index e1eb3cde..00000000 --- a/src/components/ChangeChain.vue +++ /dev/null @@ -1,113 +0,0 @@ - - - diff --git a/src/components/DateTime.vue b/src/components/DateTime.vue deleted file mode 100644 index 153ed39b..00000000 --- a/src/components/DateTime.vue +++ /dev/null @@ -1,25 +0,0 @@ - - - - - diff --git a/src/utils/chargeInfo.ts b/src/utils/chargeInfo.ts deleted file mode 100644 index aeebd762..00000000 --- a/src/utils/chargeInfo.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const chargeInfo = `What you are about to do is -simply sign a transaction and send it -to the network from where it will -be submitted to the public Arcana blockchain. -You will never pay a fee to sign transactions.` From 27e466ecc81ee7fdc8b831451c16aac79c3021bb Mon Sep 17 00:00:00 2001 From: shrinathprabhu Date: Thu, 27 Jun 2024 10:21:00 +0400 Subject: [PATCH 08/13] Replace type specific imports with `import type` --- src/components/AssetsView.vue | 2 +- src/components/NFTView.vue | 2 +- src/components/SendNftPreview.vue | 2 +- src/components/SendTokensPreview.vue | 2 +- src/components/SendTransaction.vue | 5 ++++- src/components/SendTransactionCompact.vue | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/AssetsView.vue b/src/components/AssetsView.vue index 53bfd809..5af17722 100644 --- a/src/components/AssetsView.vue +++ b/src/components/AssetsView.vue @@ -9,7 +9,7 @@ import { useAppStore } from '@/store/app' import { useModalStore } from '@/store/modal' import { useRpcStore } from '@/store/rpc' import { useUserStore } from '@/store/user' -import { +import type { MultiversXAccountHandler, SolanaAccountHandler, } from '@/utils/accountHandler' diff --git a/src/components/NFTView.vue b/src/components/NFTView.vue index c3b33cc3..638e977a 100644 --- a/src/components/NFTView.vue +++ b/src/components/NFTView.vue @@ -8,7 +8,7 @@ import { NFTDB } from '@/services/nft.service' import { useAppStore } from '@/store/app' import { useRpcStore } from '@/store/rpc' import { useUserStore } from '@/store/user' -import { +import type { MultiversXAccountHandler, SolanaAccountHandler, } from '@/utils/accountHandler' diff --git a/src/components/SendNftPreview.vue b/src/components/SendNftPreview.vue index b04e23d7..e4899f8e 100644 --- a/src/components/SendNftPreview.vue +++ b/src/components/SendNftPreview.vue @@ -5,7 +5,7 @@ import { onBeforeMount, ref, onMounted } from 'vue' import SwipeToAction from '@/components/SwipeToAction.vue' import { useAppStore } from '@/store/app' import { useRpcStore } from '@/store/rpc' -import { EVMAccountHandler } from '@/utils/accountHandler' +import type { EVMAccountHandler } from '@/utils/accountHandler' import { ChainType } from '@/utils/chainType' import { getImage } from '@/utils/getImage' import { getRequestHandler } from '@/utils/requestHandlerSingleton' diff --git a/src/components/SendTokensPreview.vue b/src/components/SendTokensPreview.vue index 4c1ad61d..b9e97620 100644 --- a/src/components/SendTokensPreview.vue +++ b/src/components/SendTokensPreview.vue @@ -6,7 +6,7 @@ import { useRoute } from 'vue-router' import SwipeToAction from '@/components/SwipeToAction.vue' import { useAppStore } from '@/store/app' import { useRpcStore } from '@/store/rpc' -import { EVMAccountHandler } from '@/utils/accountHandler' +import type { EVMAccountHandler } from '@/utils/accountHandler' import { ChainType } from '@/utils/chainType' import { getImage } from '@/utils/getImage' import { getRequestHandler } from '@/utils/requestHandlerSingleton' diff --git a/src/components/SendTransaction.vue b/src/components/SendTransaction.vue index ee11415c..50369392 100644 --- a/src/components/SendTransaction.vue +++ b/src/components/SendTransaction.vue @@ -13,7 +13,10 @@ import useCurrencyStore from '@/store/currencies' import { useRequestStore } from '@/store/request' import { useRpcStore } from '@/store/rpc' import { useUserStore } from '@/store/user' -import { EVMAccountHandler, SolanaAccountHandler } from '@/utils/accountHandler' +import type { + EVMAccountHandler, + SolanaAccountHandler, +} from '@/utils/accountHandler' import { ChainType } from '@/utils/chainType' import { getImage } from '@/utils/getImage' import { getRequestHandler } from '@/utils/requestHandlerSingleton' diff --git a/src/components/SendTransactionCompact.vue b/src/components/SendTransactionCompact.vue index 6e3cdb0a..bb265bb6 100644 --- a/src/components/SendTransactionCompact.vue +++ b/src/components/SendTransactionCompact.vue @@ -9,7 +9,7 @@ import useCurrencyStore from '@/store/currencies' import { useParentConnectionStore } from '@/store/parentConnection' import { useRequestStore } from '@/store/request' import { useRpcStore } from '@/store/rpc' -import { EVMAccountHandler } from '@/utils/accountHandler' +import type { EVMAccountHandler } from '@/utils/accountHandler' import { ChainType } from '@/utils/chainType' import { getImage } from '@/utils/getImage' import { getRequestHandler } from '@/utils/requestHandlerSingleton' From 78d7c123403532794068a382febf1abecc4a9e1e Mon Sep 17 00:00:00 2001 From: shrinathprabhu Date: Thu, 27 Jun 2024 10:21:30 +0400 Subject: [PATCH 09/13] Remove unused imports --- src/components/PinBasedRecoveryModal.vue | 2 +- src/components/SecurityQuestionRecoveryModal.vue | 2 +- src/pages/backCompat/initPage.vue | 2 +- src/utils/evm/walletMiddleware.ts | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/PinBasedRecoveryModal.vue b/src/components/PinBasedRecoveryModal.vue index 6f01a425..d4164484 100644 --- a/src/components/PinBasedRecoveryModal.vue +++ b/src/components/PinBasedRecoveryModal.vue @@ -2,7 +2,7 @@ import { ref } from 'vue' import { useToast } from 'vue-toastification' -import { content, errors } from '@/utils/content' +import { content } from '@/utils/content' import { getImage } from '@/utils/getImage' const emit = defineEmits(['proceed', 'back', 'switch-alternate']) diff --git a/src/components/SecurityQuestionRecoveryModal.vue b/src/components/SecurityQuestionRecoveryModal.vue index 81674bae..81a882ee 100644 --- a/src/components/SecurityQuestionRecoveryModal.vue +++ b/src/components/SecurityQuestionRecoveryModal.vue @@ -3,7 +3,7 @@ import { computed, ref, onBeforeMount, type Ref } from 'vue' import { useToast } from 'vue-toastification' import SelectQuestion from '@/components/SelectQuestion.vue' -import { content, errors } from '@/utils/content' +import { content } from '@/utils/content' const emit = defineEmits(['proceed', 'back', 'switch-alternate']) const props = defineProps<{ diff --git a/src/pages/backCompat/initPage.vue b/src/pages/backCompat/initPage.vue index 0df8abbb..0e0ab15d 100644 --- a/src/pages/backCompat/initPage.vue +++ b/src/pages/backCompat/initPage.vue @@ -15,7 +15,7 @@ import { catchupSigninPage, fetchPasswordlessResponseFromSignIn, } from '@/utils/redirectUtils' -import { getStorage, initStorage } from '@/utils/storageWrapper' +import { initStorage } from '@/utils/storageWrapper' const route = useRoute() const user = useUserStore() diff --git a/src/utils/evm/walletMiddleware.ts b/src/utils/evm/walletMiddleware.ts index 2909850a..642fe413 100644 --- a/src/utils/evm/walletMiddleware.ts +++ b/src/utils/evm/walletMiddleware.ts @@ -1,6 +1,6 @@ import { AppMode } from '@arcana/auth' import { ethErrors } from 'eth-rpc-errors' -import sigUtil from 'eth-sig-util' +import { recoverPersonalSignature, type SignedMsgParams } from 'eth-sig-util' import { createAsyncMiddleware, createScaffoldMiddleware, @@ -345,12 +345,12 @@ function createWalletMiddleware({ const signature: string = (req.params as string)[1] const extraParams: Record = (req.params as Record[])[2] || {} - const msgParams: sigUtil.SignedMsgParams = { + const msgParams: SignedMsgParams = { ...extraParams, sig: signature, data: message, } - const signerAddress: string = sigUtil.recoverPersonalSignature(msgParams) + const signerAddress: string = recoverPersonalSignature(msgParams) res.result = signerAddress } From 111bfa5ae0045a38e1ee62cb8790c232cb88d296 Mon Sep 17 00:00:00 2001 From: shrinathprabhu Date: Thu, 27 Jun 2024 10:21:42 +0400 Subject: [PATCH 10/13] Update content of ChargeInfo --- src/components/ChargeInfo.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ChargeInfo.vue b/src/components/ChargeInfo.vue index 9ac0e554..1653368f 100644 --- a/src/components/ChargeInfo.vue +++ b/src/components/ChargeInfo.vue @@ -2,8 +2,8 @@

What you are about to do is simply sign a transaction and send it to the - network from where it will be submitted to the public Arcana blockchain. - You will never pay a fee to sign transactions. + network from where it will be submitted to the public blockchain. You will + never pay a fee to sign transactions.

From c16a66fc2df4355fde29357cebd11d32628fbdb7 Mon Sep 17 00:00:00 2001 From: shrinathprabhu Date: Thu, 27 Jun 2024 10:21:56 +0400 Subject: [PATCH 11/13] Update package-lock --- package-lock.json | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5d593f8d..850652c9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,7 +41,6 @@ "ethers": "^5.7.2", "json-rpc-engine": "^6.1.0", "near-api-js": "^4.0.1", - "node-polyfill-webpack-plugin": "^4.0.0", "penpal": "^6.2.2", "pinia": "^2.1.7", "pusher-js": "^8.4.0-rc2", @@ -74,6 +73,7 @@ "husky": "^7.0.4", "lint-staged": "^12.5.0", "markdownlint-cli": "^0.41.0", + "node-polyfill-webpack-plugin": "^4.0.0", "npm-run-all": "^4.1.5", "postcss": "^8.4.38", "prettier": "^2.8.8", @@ -5789,14 +5789,6 @@ "resolved": "https://registry.npmjs.org/borsh/-/borsh-1.0.0.tgz", "integrity": "sha512-fSVWzzemnyfF89EPwlUNsrS5swF5CrtiN4e+h0/lLf4dz2he4L3ndM20PS9wj7ICSkXJe/TQUHdaPTq15b1mNQ==" }, - "node_modules/@near-js/providers/node_modules/depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/@near-js/providers/node_modules/http-errors": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", @@ -13299,7 +13291,6 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", - "dev": true, "engines": { "node": ">= 0.6" } @@ -13476,6 +13467,7 @@ "version": "5.7.0", "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-5.7.0.tgz", "integrity": "sha512-edTFu0M/7wO1pXY6GDxVNVW086uqwWYIHP98txhcPyV995X21JIH2DtYp33sQJOupYoXKe9RwTw2Ya2vWaquTQ==", + "dev": true, "license": "Artistic-2.0", "engines": { "node": ">=4" @@ -25636,6 +25628,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/node-polyfill-webpack-plugin/-/node-polyfill-webpack-plugin-4.0.0.tgz", "integrity": "sha512-WLk77vLpbcpmTekRj6s6vYxk30XoyaY5MDZ4+9g8OaKoG3Ij+TjOqhpQjVUlfDZBPBgpNATDltaQkzuXSnnkwg==", + "dev": true, "license": "MIT", "dependencies": { "assert": "^2.1.0", @@ -25674,6 +25667,7 @@ "version": "4.5.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", + "dev": true, "dependencies": { "abort-controller": "^3.0.0", "buffer": "^6.0.3", @@ -25689,6 +25683,7 @@ "version": "4.18.3", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.18.3.tgz", "integrity": "sha512-Q08/0IrpvM+NMY9PA2rti9Jb+JejTddwmwmVQGskAlhtcrw1wsRzoR6ode6mR+OAabNa75w/dxedSUY2mlphaQ==", + "dev": true, "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=16" @@ -39751,11 +39746,6 @@ "resolved": "https://registry.npmjs.org/borsh/-/borsh-1.0.0.tgz", "integrity": "sha512-fSVWzzemnyfF89EPwlUNsrS5swF5CrtiN4e+h0/lLf4dz2he4L3ndM20PS9wj7ICSkXJe/TQUHdaPTq15b1mNQ==" }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==" - }, "http-errors": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", @@ -45447,8 +45437,7 @@ "depd": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", - "dev": true + "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==" }, "des.js": { "version": "1.0.1", @@ -45590,7 +45579,8 @@ "domain-browser": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-5.7.0.tgz", - "integrity": "sha512-edTFu0M/7wO1pXY6GDxVNVW086uqwWYIHP98txhcPyV995X21JIH2DtYp33sQJOupYoXKe9RwTw2Ya2vWaquTQ==" + "integrity": "sha512-edTFu0M/7wO1pXY6GDxVNVW086uqwWYIHP98txhcPyV995X21JIH2DtYp33sQJOupYoXKe9RwTw2Ya2vWaquTQ==", + "dev": true }, "domelementtype": { "version": "2.3.0", @@ -54948,6 +54938,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/node-polyfill-webpack-plugin/-/node-polyfill-webpack-plugin-4.0.0.tgz", "integrity": "sha512-WLk77vLpbcpmTekRj6s6vYxk30XoyaY5MDZ4+9g8OaKoG3Ij+TjOqhpQjVUlfDZBPBgpNATDltaQkzuXSnnkwg==", + "dev": true, "requires": { "assert": "^2.1.0", "browserify-zlib": "^0.2.0", @@ -54979,6 +54970,7 @@ "version": "4.5.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", + "dev": true, "requires": { "abort-controller": "^3.0.0", "buffer": "^6.0.3", @@ -54990,7 +54982,8 @@ "type-fest": { "version": "4.18.3", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.18.3.tgz", - "integrity": "sha512-Q08/0IrpvM+NMY9PA2rti9Jb+JejTddwmwmVQGskAlhtcrw1wsRzoR6ode6mR+OAabNa75w/dxedSUY2mlphaQ==" + "integrity": "sha512-Q08/0IrpvM+NMY9PA2rti9Jb+JejTddwmwmVQGskAlhtcrw1wsRzoR6ode6mR+OAabNa75w/dxedSUY2mlphaQ==", + "dev": true } } }, From 82f9334389a7e605bb09319ac46bdb6de0224a26 Mon Sep 17 00:00:00 2001 From: shrinathprabhu Date: Thu, 27 Jun 2024 11:35:54 +0400 Subject: [PATCH 12/13] Update imports for ethers - Update ethers imports for treeshaking - Remove unused imports - Update type imports to `import type` --- src/components/ActivityView.vue | 2 +- src/models/Connection.ts | 9 +++- src/models/EthersError.ts | 9 ---- src/models/RpcConfigList.ts | 68 +------------------------- src/pages/AddTokenScreen.vue | 2 +- src/pages/MFARestoreScreen.vue | 2 - src/pages/MFASetup.vue | 2 +- src/pages/PermissionRequest.vue | 6 +-- src/pages/RequestsScreen.vue | 2 +- src/pages/SendNft.vue | 2 +- src/pages/SendTokens.vue | 2 +- src/pages/StarterTips/index-page.vue | 15 +++--- src/pages/TransakSell.vue | 23 +++++---- src/pages/globalRedirect.vue | 2 - src/pages/homeScreen.vue | 3 -- src/pages/initPageV2.vue | 6 +-- src/pages/loggedInView.vue | 9 ++-- src/pages/loginRedirect.vue | 2 - src/pages/signInV2.vue | 1 - src/store/activities.ts | 28 ++++++----- src/store/rpc.ts | 2 +- src/utils/accountHandler.ts | 1 + src/utils/contractUtil.ts | 8 +-- src/utils/evm/accountHandler.ts | 62 ++++++++++------------- src/utils/evm/requestHandler.ts | 2 - src/utils/evm/rpcURLToProvider.ts | 12 +++-- src/utils/getwalletType.ts | 4 +- src/utils/loginToken.ts | 5 +- src/utils/multiversx/requestHandler.ts | 2 - src/utils/nftUtils.ts | 18 ++----- src/utils/requestHandler.ts | 34 ++++++++----- src/utils/requestHandlerSingleton.ts | 4 +- src/utils/requestManagement.ts | 1 - src/utils/solana/accountHandler.ts | 6 +-- src/utils/solana/requestHandler.ts | 1 - src/utils/typeguards.ts | 4 +- 36 files changed, 139 insertions(+), 222 deletions(-) delete mode 100644 src/models/EthersError.ts diff --git a/src/components/ActivityView.vue b/src/components/ActivityView.vue index 57cba10a..3407486e 100644 --- a/src/components/ActivityView.vue +++ b/src/components/ActivityView.vue @@ -15,7 +15,7 @@ import type { import { useAppStore } from '@/store/app' import { useParentConnectionStore } from '@/store/parentConnection' import { useRpcStore } from '@/store/rpc' -import { EVMAccountHandler } from '@/utils/accountHandler' +import type { EVMAccountHandler } from '@/utils/accountHandler' import { ChainType } from '@/utils/chainType' import { getRequestHandler } from '@/utils/requestHandlerSingleton' import { truncateEnd, truncateMid } from '@/utils/stringUtils' diff --git a/src/models/Connection.ts b/src/models/Connection.ts index 40ffd250..30be0f90 100644 --- a/src/models/Connection.ts +++ b/src/models/Connection.ts @@ -1,6 +1,11 @@ -import { AppConfig, AppMode, Position, RpcConfig } from '@arcana/auth' +import { + type AppConfig, + AppMode, + type Position, + type RpcConfig, +} from '@arcana/auth' import type { SocialLoginType } from '@arcana/auth-core' -import { JsonRpcRequest, PendingJsonRpcResponse } from 'json-rpc-engine' +import type { JsonRpcRequest, PendingJsonRpcResponse } from 'json-rpc-engine' type SDKVersion = 'v2' | 'v3' diff --git a/src/models/EthersError.ts b/src/models/EthersError.ts deleted file mode 100644 index 688f537a..00000000 --- a/src/models/EthersError.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Ethers doesn't export EthersError class/type -// it simply patches the Native Error object with Reason and Code - -interface EthersError extends Error { - reason?: string - code?: string -} - -export type { EthersError } diff --git a/src/models/RpcConfigList.ts b/src/models/RpcConfigList.ts index 6b248292..12bc07e3 100644 --- a/src/models/RpcConfigList.ts +++ b/src/models/RpcConfigList.ts @@ -1,4 +1,4 @@ -import { RpcConfig } from '@arcana/auth' +import type { RpcConfig } from '@arcana/auth' interface RpcConfigWallet extends RpcConfig { favicon: string @@ -7,70 +7,4 @@ interface RpcConfigWallet extends RpcConfig { compatibility?: string } -const CHAIN_LIST = [ - { - chainId: '1', - rpcUrls: ['https://cloudflare-eth.com'], - chainName: 'Ethereum Mainnet', - blockExplorerUrls: ['https://etherscan.io'], - favicon: 'ethereum-icon', - isCustom: false, - nativeCurrency: { - symbol: 'ETH', - decimals: 18, - }, - }, - { - chainId: '5', - rpcUrls: ['https://goerli.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161'], - chainName: 'Ethereum Goerli (Testnet)', - blockExplorerUrls: ['https://goerli.etherscan.io'], - favicon: 'ethereum-icon', - isCustom: false, - nativeCurrency: { - symbol: 'ETH', - decimals: 18, - }, - }, - { - chainId: '137', - rpcUrls: ['https://polygon-rpc.com'], - chainName: 'Polygon Mainnet', - blockExplorerUrls: ['https://polygonscan.com'], - favicon: 'polygon-icon', - isCustom: false, - nativeCurrency: { - symbol: 'MATIC', - decimals: 18, - }, - }, - { - chainId: '80001', - rpcUrls: ['https://rpc-mumbai.maticvigil.com'], - chainName: 'Polygon Mumbai (Testnet)', - blockExplorerUrls: ['https://mumbai.polygonscan.com'], - favicon: 'polygon-icon', - isCustom: false, - nativeCurrency: { - symbol: 'MATIC', - decimals: 18, - }, - }, - { - chainId: '11155111', - rpcUrls: ['https://rpc.sepolia.org'], - chainName: 'Sepolia (Testnet)', - blockExplorerUrls: ['https://sepolia.etherscan.io'], - favicon: 'ethereum-icon', - isCustom: false, - nativeCurrency: { - symbol: 'ETH', - decimals: 18, - }, - }, -] - -const DEFAULT_CHAIN_ID = '1' - export type { RpcConfigWallet } -export { CHAIN_LIST, DEFAULT_CHAIN_ID } diff --git a/src/pages/AddTokenScreen.vue b/src/pages/AddTokenScreen.vue index 2fc5fdec..99835a68 100644 --- a/src/pages/AddTokenScreen.vue +++ b/src/pages/AddTokenScreen.vue @@ -10,7 +10,7 @@ import type { AssetContract, EthAssetContract } from '@/models/Asset' import { useModalStore } from '@/store/modal' import { useRpcStore } from '@/store/rpc' import { useUserStore } from '@/store/user' -import { content, errors } from '@/utils/content' +import { content } from '@/utils/content' import { getTokenSymbolAndDecimals } from '@/utils/contractUtil' import { getImage } from '@/utils/getImage' import { getStorage } from '@/utils/storageWrapper' diff --git a/src/pages/MFARestoreScreen.vue b/src/pages/MFARestoreScreen.vue index 23327575..cc2c247e 100644 --- a/src/pages/MFARestoreScreen.vue +++ b/src/pages/MFARestoreScreen.vue @@ -2,8 +2,6 @@ import { StateInfo, decodeJSON } from '@arcana/auth-core' import { Core, SecurityQuestionModule } from '@arcana/key-helper' import dayjs from 'dayjs' -import { addHexPrefix } from 'ethereumjs-util' -import { ethers } from 'ethers' import { getUniqueId } from 'json-rpc-engine' import { connectToParent } from 'penpal' import { v4 as genUUID } from 'uuid' diff --git a/src/pages/MFASetup.vue b/src/pages/MFASetup.vue index 5ec3d69b..59c1d680 100644 --- a/src/pages/MFASetup.vue +++ b/src/pages/MFASetup.vue @@ -14,7 +14,7 @@ import SearchQuestion from '@/components/SearchQuestion.vue' import { RedirectParentConnectionApi } from '@/models/Connection' import { useAppStore } from '@/store/app' import { GATEWAY_URL, AUTH_NETWORK } from '@/utils/constants' -import { content, errors } from '@/utils/content' +import { content } from '@/utils/content' import { devLogger } from '@/utils/devLogger' import { getImage } from '@/utils/getImage' import { getStorage, initStorage } from '@/utils/storageWrapper' diff --git a/src/pages/PermissionRequest.vue b/src/pages/PermissionRequest.vue index b93040a1..c9caaf59 100644 --- a/src/pages/PermissionRequest.vue +++ b/src/pages/PermissionRequest.vue @@ -31,8 +31,8 @@ import { EIP1559GasFee, LegacyGasFee } from '@/store/request' import { useRpcStore } from '@/store/rpc' import { CreateAccountHandler, - EVMAccountHandler, - SolanaAccountHandler, + type EVMAccountHandler, + type SolanaAccountHandler, } from '@/utils/accountHandler' import { advancedInfo } from '@/utils/advancedInfo' import { ChainType } from '@/utils/chainType' @@ -105,7 +105,7 @@ async function initAccountHandler(rpcUrl) { const { privateKey } = getStorage().local.getUserInfo() if (!requestHandlerExists()) { const accountHandler = await CreateAccountHandler(privateKey, rpcUrl) - setRequestHandler(accountHandler) + await setRequestHandler(accountHandler) } } diff --git a/src/pages/RequestsScreen.vue b/src/pages/RequestsScreen.vue index a9429925..8346cfe9 100644 --- a/src/pages/RequestsScreen.vue +++ b/src/pages/RequestsScreen.vue @@ -11,7 +11,7 @@ import { router } from '@/routes' import { useAppStore } from '@/store/app' import { useRequestStore } from '@/store/request' import { useRpcStore } from '@/store/rpc' -import { content, errors } from '@/utils/content' +import { content } from '@/utils/content' import { useImage } from '@/utils/useImage' const getImage = useImage() diff --git a/src/pages/SendNft.vue b/src/pages/SendNft.vue index 6bdb3ec6..e61c17fd 100644 --- a/src/pages/SendNft.vue +++ b/src/pages/SendNft.vue @@ -15,7 +15,7 @@ import { useAppStore } from '@/store/app' import { EIP1559GasFee } from '@/store/request' import { useRpcStore } from '@/store/rpc' import { useUserStore } from '@/store/user' -import { +import type { EVMAccountHandler, MultiversXAccountHandler, SolanaAccountHandler, diff --git a/src/pages/SendTokens.vue b/src/pages/SendTokens.vue index af91109d..31009ad6 100644 --- a/src/pages/SendTokens.vue +++ b/src/pages/SendTokens.vue @@ -27,7 +27,7 @@ import { useAppStore } from '@/store/app' import type { EIP1559GasFee } from '@/store/request' import { useRpcStore } from '@/store/rpc' import { useUserStore } from '@/store/user' -import { +import type { EVMAccountHandler, MultiversXAccountHandler, SolanaAccountHandler, diff --git a/src/pages/StarterTips/index-page.vue b/src/pages/StarterTips/index-page.vue index a69bb1c8..582406b3 100644 --- a/src/pages/StarterTips/index-page.vue +++ b/src/pages/StarterTips/index-page.vue @@ -2,9 +2,6 @@ import { ref, watch } from 'vue' import { useRouter } from 'vue-router' -import NFTIcon from '@/assets/images/starter-tips/nft-icon.png' -import ProfileIcon from '@/assets/images/starter-tips/profile-icon.png' -import TokensIcon from '@/assets/images/starter-tips/tokens-icon.png' import Page1 from '@/pages/StarterTips/page-1.vue' import Page2 from '@/pages/StarterTips/page-2.vue' import Page3 from '@/pages/StarterTips/page-3.vue' @@ -104,7 +101,7 @@ watch( class="h-16 flex justify-around items-center dark:bg-black-100 bg-gray-900" > token nft profile - profile + profile diff --git a/src/pages/TransakSell.vue b/src/pages/TransakSell.vue index 61059d1a..ec2abe31 100644 --- a/src/pages/TransakSell.vue +++ b/src/pages/TransakSell.vue @@ -1,6 +1,6 @@