diff --git a/lerna.json b/lerna.json index 88a69a86..251709ee 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "packages": ["packages/*"], - "version": "0.8.16", + "version": "0.8.17", "npmClient": "yarn", "useWorkspaces": true } diff --git a/package.json b/package.json index 3b1c3806..e13e4e27 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.8.16", + "version": "0.8.17", "private": true, "name": "alephium-browser-extension-wallet", "repository": "github:alephium/extension-wallet", diff --git a/packages/dapp/package.json b/packages/dapp/package.json index 2e4f9210..845e8e10 100644 --- a/packages/dapp/package.json +++ b/packages/dapp/package.json @@ -1,6 +1,6 @@ { "name": "@alephium/dapp", - "version": "0.8.16", + "version": "0.8.17", "private": true, "scripts": { "dev": "next dev", diff --git a/packages/extension/manifest/v2.json b/packages/extension/manifest/v2.json index 3532ce79..e8a0c648 100644 --- a/packages/extension/manifest/v2.json +++ b/packages/extension/manifest/v2.json @@ -2,7 +2,7 @@ "$schema": "https://json.schemastore.org/chrome-manifest.json", "name": "Alephium Extension Wallet", "description": "Alephium's official extension wallet with powerful features and a clean UI.", - "version": "0.8.16", + "version": "0.8.17", "manifest_version": 2, "browser_action": { "default_icon": { diff --git a/packages/extension/manifest/v3.json b/packages/extension/manifest/v3.json index d3a9ecb7..dd827293 100644 --- a/packages/extension/manifest/v3.json +++ b/packages/extension/manifest/v3.json @@ -2,7 +2,7 @@ "$schema": "https://json.schemastore.org/chrome-manifest.json", "name": "Alephium Extension Wallet", "description": "Alephium's official extension wallet with powerful features and a clean UI.", - "version": "0.8.16", + "version": "0.8.17", "manifest_version": 3, "action": { "default_icon": { diff --git a/packages/extension/package.json b/packages/extension/package.json index ede0cd93..43f2430d 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -1,6 +1,6 @@ { "name": "@alephium/extension", - "version": "0.8.16", + "version": "0.8.17", "main": "index.js", "license": "MIT", "devDependencies": { diff --git a/packages/extension/src/background/accountMessaging.ts b/packages/extension/src/background/accountMessaging.ts index ffc69dd5..6929aa96 100644 --- a/packages/extension/src/background/accountMessaging.ts +++ b/packages/extension/src/background/accountMessaging.ts @@ -12,42 +12,42 @@ export const handleAccountMessage: HandleMessage = async ({ respond, }) => { switch (msg.type) { - case "GET_ACCOUNTS": { + case "ALPH_GET_ACCOUNTS": { return sendMessageToUi({ - type: "GET_ACCOUNTS_RES", + type: "ALPH_GET_ACCOUNTS_RES", data: await getAccounts(msg.data?.showHidden ? () => true : undefined), }) } - case "CONNECT_ACCOUNT": { + case "ALPH_CONNECT_ACCOUNT": { // Select an Account of BaseWalletAccount type const selectedAccount = await wallet.getSelectedAccount() return respond({ - type: "CONNECT_ACCOUNT_RES", + type: "ALPH_CONNECT_ACCOUNT_RES", data: selectedAccount, }) } - case "DISCOVER_ACCOUNTS": { + case "ALPH_DISCOVER_ACCOUNTS": { const { networkId } = msg.data try { const discoveredAccounts = await wallet.discoverActiveAccounts(networkId) return respond({ - type: "DISCOVER_ACCOUNTS_RES", + type: "ALPH_DISCOVER_ACCOUNTS_RES", data: { accounts: discoveredAccounts } }) } catch (exception) { console.error("Failed to discover accounts", exception) return respond({ - type: "DISCOVER_ACCOUNTS_REJ", + type: "ALPH_DISCOVER_ACCOUNTS_REJ", data: { error: `${exception}` }, }) } } - case "NEW_ACCOUNT": { + case "ALPH_NEW_ACCOUNT": { if (!(await wallet.isSessionOpen())) { throw Error("you need an open session") } @@ -64,7 +64,7 @@ export const handleAccountMessage: HandleMessage = async ({ const accounts = await getAccounts() return sendMessageToUi({ - type: "NEW_ACCOUNT_RES", + type: "ALPH_NEW_ACCOUNT_RES", data: { account, accounts, @@ -80,13 +80,13 @@ export const handleAccountMessage: HandleMessage = async ({ }) return sendMessageToUi({ - type: "NEW_ACCOUNT_REJ", + type: "ALPH_NEW_ACCOUNT_REJ", data: { error }, }) } } - case "NEW_LEDGER_ACCOUNT": { + case "ALPH_NEW_LEDGER_ACCOUNT": { if (!(await wallet.isSessionOpen())) { throw Error("you need an open session") } @@ -95,7 +95,7 @@ export const handleAccountMessage: HandleMessage = async ({ try { const baseAccount = await wallet.importLedgerAccount(account, hdIndex, networkId) return sendMessageToUi({ - type: "NEW_LEDGER_ACCOUNT_RES", + type: "ALPH_NEW_LEDGER_ACCOUNT_RES", data: { account: baseAccount } @@ -110,38 +110,38 @@ export const handleAccountMessage: HandleMessage = async ({ }) return sendMessageToUi({ - type: "NEW_LEDGER_ACCOUNT_REJ", + type: "ALPH_NEW_LEDGER_ACCOUNT_REJ", data: { error }, }) } } - case "GET_SELECTED_ACCOUNT": { + case "ALPH_GET_SELECTED_ACCOUNT": { const selectedAccount = await wallet.getSelectedAccount() return sendMessageToUi({ - type: "GET_SELECTED_ACCOUNT_RES", + type: "ALPH_GET_SELECTED_ACCOUNT_RES", data: selectedAccount, }) } - case "UPGRADE_ACCOUNT": { + case "ALPH_UPGRADE_ACCOUNT": { try { - return sendMessageToUi({ type: "UPGRADE_ACCOUNT_RES" }) + return sendMessageToUi({ type: "ALPH_UPGRADE_ACCOUNT_RES" }) } catch { - return sendMessageToUi({ type: "UPGRADE_ACCOUNT_REJ" }) + return sendMessageToUi({ type: "ALPH_UPGRADE_ACCOUNT_REJ" }) } } - case "DELETE_ACCOUNT": { + case "ALPH_DELETE_ACCOUNT": { try { await removeAccount(msg.data) - return sendMessageToUi({ type: "DELETE_ACCOUNT_RES" }) + return sendMessageToUi({ type: "ALPH_DELETE_ACCOUNT_RES" }) } catch { - return sendMessageToUi({ type: "DELETE_ACCOUNT_REJ" }) + return sendMessageToUi({ type: "ALPH_DELETE_ACCOUNT_REJ" }) } } - case "GET_ENCRYPTED_PRIVATE_KEY": { + case "ALPH_GET_ENCRYPTED_PRIVATE_KEY": { if (!(await wallet.isSessionOpen())) { throw Error("you need an open session") } @@ -153,12 +153,12 @@ export const handleAccountMessage: HandleMessage = async ({ ) return sendMessageToUi({ - type: "GET_ENCRYPTED_PRIVATE_KEY_RES", + type: "ALPH_GET_ENCRYPTED_PRIVATE_KEY_RES", data: { encryptedPrivateKey }, }) } - case "GET_ENCRYPTED_SEED_PHRASE": { + case "ALPH_GET_ENCRYPTED_SEED_PHRASE": { if (!(await wallet.isSessionOpen())) { throw Error("you need an open session") } @@ -170,7 +170,7 @@ export const handleAccountMessage: HandleMessage = async ({ ) return sendMessageToUi({ - type: "GET_ENCRYPTED_SEED_PHRASE_RES", + type: "ALPH_GET_ENCRYPTED_SEED_PHRASE_RES", data: { encryptedSeedPhrase }, }) } diff --git a/packages/extension/src/background/actionHandlers.ts b/packages/extension/src/background/actionHandlers.ts index ddc480d9..c71cb2da 100644 --- a/packages/extension/src/background/actionHandlers.ts +++ b/packages/extension/src/background/actionHandlers.ts @@ -24,7 +24,7 @@ export const handleActionApproval = async ( const actionHash = action.meta.hash switch (action.type) { - case "CONNECT_DAPP": { + case "ALPH_CONNECT_DAPP": { const { host, networkId, group, keyType } = action.payload const selectedAccount = await wallet.getAlephiumSelectedAddress( networkId, @@ -48,7 +48,7 @@ export const handleActionApproval = async ( return { type: "ALPH_CONNECT_DAPP_RES", data: walletAccountWithNetwork } } - case "TRANSACTION": { + case "ALPH_TRANSACTION": { const { signature: signatureOpt, ...transaction } = additionalData as ReviewTransactionResult & { signature?: string } try { @@ -63,7 +63,7 @@ export const handleActionApproval = async ( return { type: "ALPH_TRANSACTION_SUBMITTED", - data: { result: { ...transaction.result, signature } , actionHash }, + data: { result: { ...transaction.result, signature }, actionHash }, } } catch (error: unknown) { return { @@ -73,7 +73,7 @@ export const handleActionApproval = async ( } } - case "SIGN_MESSAGE": { + case "ALPH_SIGN_MESSAGE": { const account = await wallet.getAccount({ address: action.payload.signerAddress, networkId: action.payload.networkId, @@ -93,7 +93,7 @@ export const handleActionApproval = async ( } } - case "SIGN_UNSIGNED_TX": { + case "ALPH_SIGN_UNSIGNED_TX": { try { const account = await wallet.getAccount({ address: action.payload.signerAddress, @@ -117,29 +117,29 @@ export const handleActionApproval = async ( } } - case "REQUEST_ADD_TOKEN": { + case "ALPH_REQUEST_ADD_TOKEN": { return { - type: "APPROVE_REQUEST_ADD_TOKEN", + type: "ALPH_APPROVE_REQUEST_ADD_TOKEN", data: { actionHash }, } } - case "REQUEST_ADD_CUSTOM_NETWORK": { + case "ALPH_REQUEST_ADD_CUSTOM_NETWORK": { try { await addNetwork(action.payload) return { - type: "APPROVE_REQUEST_ADD_CUSTOM_NETWORK", + type: "ALPH_APPROVE_REQUEST_ADD_CUSTOM_NETWORK", data: { actionHash }, } } catch (error) { return { - type: "REJECT_REQUEST_ADD_CUSTOM_NETWORK", + type: "ALPH_REJECT_REQUEST_ADD_CUSTOM_NETWORK", data: { actionHash }, } } } - case "REQUEST_SWITCH_CUSTOM_NETWORK": { + case "ALPH_REQUEST_SWITCH_CUSTOM_NETWORK": { try { const networks = await getNetworks() @@ -176,12 +176,12 @@ export const handleActionApproval = async ( } return { - type: "APPROVE_REQUEST_SWITCH_CUSTOM_NETWORK", + type: "ALPH_APPROVE_REQUEST_SWITCH_CUSTOM_NETWORK", data: { actionHash, selectedAccount }, } } catch (error) { return { - type: "REJECT_REQUEST_SWITCH_CUSTOM_NETWORK", + type: "ALPH_REJECT_REQUEST_SWITCH_CUSTOM_NETWORK", data: { actionHash }, } } @@ -199,7 +199,7 @@ export const handleActionRejection = async ( const actionHash = action.meta.hash switch (action.type) { - case "CONNECT_DAPP": { + case "ALPH_CONNECT_DAPP": { return { type: "ALPH_REJECT_PREAUTHORIZATION", data: { @@ -209,44 +209,44 @@ export const handleActionRejection = async ( } } - case "TRANSACTION": { + case "ALPH_TRANSACTION": { return { type: "ALPH_TRANSACTION_FAILED", data: { actionHash }, } } - case "SIGN_MESSAGE": { + case "ALPH_SIGN_MESSAGE": { return { type: "ALPH_SIGN_MESSAGE_FAILURE", data: { actionHash }, } } - case "SIGN_UNSIGNED_TX": { + case "ALPH_SIGN_UNSIGNED_TX": { return { type: "ALPH_SIGN_UNSIGNED_TX_FAILURE", data: { actionHash }, } } - case "REQUEST_ADD_TOKEN": { + case "ALPH_REQUEST_ADD_TOKEN": { return { - type: "REJECT_REQUEST_ADD_TOKEN", + type: "ALPH_REJECT_REQUEST_ADD_TOKEN", data: { actionHash }, } } - case "REQUEST_ADD_CUSTOM_NETWORK": { + case "ALPH_REQUEST_ADD_CUSTOM_NETWORK": { return { - type: "REJECT_REQUEST_ADD_CUSTOM_NETWORK", + type: "ALPH_REJECT_REQUEST_ADD_CUSTOM_NETWORK", data: { actionHash }, } } - case "REQUEST_SWITCH_CUSTOM_NETWORK": { + case "ALPH_REQUEST_SWITCH_CUSTOM_NETWORK": { return { - type: "REJECT_REQUEST_SWITCH_CUSTOM_NETWORK", + type: "ALPH_REJECT_REQUEST_SWITCH_CUSTOM_NETWORK", data: { actionHash }, } } diff --git a/packages/extension/src/background/actionMessaging.ts b/packages/extension/src/background/actionMessaging.ts index fce83221..f5ee38ad 100644 --- a/packages/extension/src/background/actionMessaging.ts +++ b/packages/extension/src/background/actionMessaging.ts @@ -12,15 +12,15 @@ export const handleActionMessage: HandleMessage = async ({ const { actionQueue } = background switch (msg.type) { - case "GET_ACTIONS": { + case "ALPH_GET_ACTIONS": { const actions = await actionQueue.getAll() return await sendMessageToUi({ - type: "GET_ACTIONS_RES", + type: "ALPH_GET_ACTIONS_RES", data: actions, }) } - case "APPROVE_ACTION": { + case "ALPH_APPROVE_ACTION": { const { actionHash, additionalData } = msg.data const action = await actionQueue.remove(actionHash) if (!action) { @@ -38,7 +38,7 @@ export const handleActionMessage: HandleMessage = async ({ return } - case "REJECT_ACTION": { + case "ALPH_REJECT_ACTION": { const payload = msg.data.actionHash const actionHashes = Array.isArray(payload) ? payload : [payload] @@ -58,7 +58,7 @@ export const handleActionMessage: HandleMessage = async ({ case "ALPH_SIGN_MESSAGE": { const { meta } = await actionQueue.push({ - type: "SIGN_MESSAGE", + type: "ALPH_SIGN_MESSAGE", payload: msg.data, }) @@ -72,7 +72,7 @@ export const handleActionMessage: HandleMessage = async ({ case "ALPH_SIGN_UNSIGNED_TX": { const { meta } = await actionQueue.push({ - type: 'SIGN_UNSIGNED_TX', + type: 'ALPH_SIGN_UNSIGNED_TX', payload: msg.data }) diff --git a/packages/extension/src/background/index.ts b/packages/extension/src/background/index.ts index 37c3164f..48567cd6 100644 --- a/packages/extension/src/background/index.ts +++ b/packages/extension/src/background/index.ts @@ -81,20 +81,20 @@ getAccounts() await transactionTracker.prune() await transactionTracker.loadHistory(x) })()) - .catch(() => console.warn("failed to prune and load latest transactions")) + .catch((e) => console.warn("failed to prune and load latest transactions", e)) const safeMessages: MessageType["type"][] = [ "ALPH_IS_PREAUTHORIZED", "ALPH_REMOVE_PREAUTHORIZATION", "ALPH_CONNECT_DAPP", - "DISCONNECT_ACCOUNT", + "ALPH_DISCONNECT_ACCOUNT", "ALPH_EXECUTE_TRANSACTION", "ALPH_OPEN_UI", "ALPH_SIGN_MESSAGE", "ALPH_SIGN_UNSIGNED_TX", - "REQUEST_ADD_TOKEN", - "REQUEST_ADD_CUSTOM_NETWORK", - "REQUEST_SWITCH_CUSTOM_NETWORK", + "ALPH_REQUEST_ADD_TOKEN", + "ALPH_REQUEST_ADD_CUSTOM_NETWORK", + "ALPH_REQUEST_SWITCH_CUSTOM_NETWORK", "REQUEST_DECLARE_CONTRACT", // answers "ALPH_EXECUTE_TRANSACTION_RES", @@ -108,18 +108,18 @@ const safeMessages: MessageType["type"][] = [ "ALPH_SIGN_UNSIGNED_TX_FAILURE", "ALPH_IS_PREAUTHORIZED_RES", "ALPH_REMOVE_PREAUTHORIZATION_RES", - "REQUEST_ADD_TOKEN_RES", - "APPROVE_REQUEST_ADD_TOKEN", - "REJECT_REQUEST_ADD_TOKEN", - "REQUEST_ADD_CUSTOM_NETWORK_RES", - "APPROVE_REQUEST_ADD_CUSTOM_NETWORK", - "REJECT_REQUEST_ADD_CUSTOM_NETWORK", - "REQUEST_SWITCH_CUSTOM_NETWORK_RES", - "APPROVE_REQUEST_SWITCH_CUSTOM_NETWORK", - "REJECT_REQUEST_SWITCH_CUSTOM_NETWORK", + "ALPH_REQUEST_ADD_TOKEN_RES", + "ALPH_APPROVE_REQUEST_ADD_TOKEN", + "ALPH_REJECT_REQUEST_ADD_TOKEN", + "ALPH_REQUEST_ADD_CUSTOM_NETWORK_RES", + "ALPH_APPROVE_REQUEST_ADD_CUSTOM_NETWORK", + "ALPH_REJECT_REQUEST_ADD_CUSTOM_NETWORK", + "ALPH_REQUEST_SWITCH_CUSTOM_NETWORK_RES", + "ALPH_APPROVE_REQUEST_SWITCH_CUSTOM_NETWORK", + "ALPH_REJECT_REQUEST_SWITCH_CUSTOM_NETWORK", "ALPH_CONNECT_DAPP_RES", - "CONNECT_ACCOUNT_RES", - "CONNECT_ACCOUNT", + "ALPH_CONNECT_ACCOUNT_RES", + "ALPH_CONNECT_ACCOUNT", "ALPH_REJECT_PREAUTHORIZATION", "REQUEST_DECLARE_CONTRACT_RES", "DECLARE_CONTRACT_ACTION_FAILED", diff --git a/packages/extension/src/background/miscellaneousMessaging.ts b/packages/extension/src/background/miscellaneousMessaging.ts index fac6cb67..7144146c 100644 --- a/packages/extension/src/background/miscellaneousMessaging.ts +++ b/packages/extension/src/background/miscellaneousMessaging.ts @@ -14,7 +14,7 @@ export const handleMiscellaneousMessage: HandleMessage< return openUi() } - case "RESET_ALL": { + case "ALPH_RESET_ALL": { try { browser.storage.local.clear() browser.storage.sync.clear() @@ -23,12 +23,12 @@ export const handleMiscellaneousMessage: HandleMessage< } catch { // Ignore browser.storage.session error "This is a read-only store" } - return respond({ type: "DISCONNECT_ACCOUNT" }) + return respond({ type: "ALPH_DISCONNECT_ACCOUNT" }) } - case "GET_MESSAGING_PUBLIC_KEY": { + case "ALPH_GET_MESSAGING_PUBLIC_KEY": { return sendMessageToUi({ - type: "GET_MESSAGING_PUBLIC_KEY_RES", + type: "ALPH_GET_MESSAGING_PUBLIC_KEY_RES", data: publicKeyJwk, }) } diff --git a/packages/extension/src/background/networkMessaging.ts b/packages/extension/src/background/networkMessaging.ts index 0db70b38..e4a50e3c 100644 --- a/packages/extension/src/background/networkMessaging.ts +++ b/packages/extension/src/background/networkMessaging.ts @@ -10,14 +10,14 @@ export const handleNetworkMessage: HandleMessage = async ({ respond, }) => { switch (msg.type) { - case "GET_NETWORKS": { + case "ALPH_GET_NETWORKS": { return respond({ - type: "GET_NETWORKS_RES", + type: "ALPH_GET_NETWORKS_RES", data: await getNetworks(), }) } - case "GET_NETWORK": { + case "ALPH_GET_NETWORK": { const allNetworks = await getNetworks() const network = allNetworks.find((n) => n.id === msg.data) @@ -27,26 +27,26 @@ export const handleNetworkMessage: HandleMessage = async ({ } return respond({ - type: "GET_NETWORK_RES", + type: "ALPH_GET_NETWORK_RES", data: network, }) } - case "GET_NETWORK_STATUSES": { + case "ALPH_GET_NETWORK_STATUSES": { const networks = msg.data?.length ? msg.data : await getNetworks() const statuses = await getNetworkStatuses(networks) return respond({ - type: "GET_NETWORK_STATUSES_RES", + type: "ALPH_GET_NETWORK_STATUSES_RES", data: statuses, }) } - case "REQUEST_ADD_CUSTOM_NETWORK": { + case "ALPH_REQUEST_ADD_CUSTOM_NETWORK": { const exists = await getNetwork(msg.data.id) if (exists) { return respond({ - type: "REQUEST_ADD_CUSTOM_NETWORK_REJ", + type: "ALPH_REQUEST_ADD_CUSTOM_NETWORK_REJ", data: { error: `Network with id ${msg.data.id} already exists`, }, @@ -54,26 +54,26 @@ export const handleNetworkMessage: HandleMessage = async ({ } const { meta } = await actionQueue.push({ - type: "REQUEST_ADD_CUSTOM_NETWORK", + type: "ALPH_REQUEST_ADD_CUSTOM_NETWORK", payload: msg.data, }) return respond({ - type: "REQUEST_ADD_CUSTOM_NETWORK_RES", + type: "ALPH_REQUEST_ADD_CUSTOM_NETWORK_RES", data: { actionHash: meta.hash, }, }) } - case "REQUEST_SWITCH_CUSTOM_NETWORK": { + case "ALPH_REQUEST_SWITCH_CUSTOM_NETWORK": { const { id } = msg.data const network = await getNetworkById(id) if (!network) { return respond({ - type: "REQUEST_SWITCH_CUSTOM_NETWORK_REJ", + type: "ALPH_REQUEST_SWITCH_CUSTOM_NETWORK_REJ", data: { error: `Network with id ${id} does not exist. Please add the network with wallet_addStarknetChain request`, }, @@ -81,20 +81,20 @@ export const handleNetworkMessage: HandleMessage = async ({ } const { meta } = await actionQueue.push({ - type: "REQUEST_SWITCH_CUSTOM_NETWORK", + type: "ALPH_REQUEST_SWITCH_CUSTOM_NETWORK", payload: network, }) return respond({ - type: "REQUEST_SWITCH_CUSTOM_NETWORK_RES", + type: "ALPH_REQUEST_SWITCH_CUSTOM_NETWORK_RES", data: { actionHash: meta.hash, }, }) } - case "REJECT_REQUEST_ADD_CUSTOM_NETWORK": - case "REJECT_REQUEST_SWITCH_CUSTOM_NETWORK": { + case "ALPH_REJECT_REQUEST_ADD_CUSTOM_NETWORK": + case "ALPH_REJECT_REQUEST_SWITCH_CUSTOM_NETWORK": { return await actionQueue.remove(msg.data.actionHash) } } diff --git a/packages/extension/src/background/preAuthorizationMessaging.ts b/packages/extension/src/background/preAuthorizationMessaging.ts index 3832d853..c3daf10c 100644 --- a/packages/extension/src/background/preAuthorizationMessaging.ts +++ b/packages/extension/src/background/preAuthorizationMessaging.ts @@ -12,7 +12,7 @@ preAuthorizeStore.subscribe(async (_, changeSet) => { const removed = differenceWith(changeSet.oldValue ?? [], changeSet.newValue ?? [], isEqual) for (const preAuthorization of removed) { await sendMessageToHost( - { type: "DISCONNECT_ACCOUNT" }, + { type: "ALPH_DISCONNECT_ACCOUNT" }, preAuthorization.host, ) } @@ -39,7 +39,7 @@ export const handlePreAuthorizationMessage: HandleMessage< if (!authorized) { await actionQueue.push({ - type: "CONNECT_DAPP", + type: "ALPH_CONNECT_DAPP", payload: { host: msg.data.host, networkId: msg.data.networkId, group: msg.data.group, keyType: msg.data.keyType }, }) } diff --git a/packages/extension/src/background/recoveryMessaging.ts b/packages/extension/src/background/recoveryMessaging.ts index 1b7d3beb..a0335056 100644 --- a/packages/extension/src/background/recoveryMessaging.ts +++ b/packages/extension/src/background/recoveryMessaging.ts @@ -14,24 +14,24 @@ export const handleRecoveryMessage: HandleMessage = async ({ background: { wallet, transactionTracker }, }) => { switch (msg.type) { - case "RECOVER_BACKUP": { + case "ALPH_RECOVER_BACKUP": { try { await wallet.importBackup(msg.data) - return sendMessageToUi({ type: "RECOVER_BACKUP_RES" }) + return sendMessageToUi({ type: "ALPH_RECOVER_BACKUP_RES" }) } catch (error) { return sendMessageToUi({ - type: "RECOVER_BACKUP_REJ", + type: "ALPH_RECOVER_BACKUP_REJ", data: `${error}`, }) } } - case "DOWNLOAD_BACKUP_FILE": { + case "ALPH_DOWNLOAD_BACKUP_FILE": { await downloadFile(await wallet.exportBackup()) - return sendMessageToUi({ type: "DOWNLOAD_BACKUP_FILE_RES" }) + return sendMessageToUi({ type: "ALPH_DOWNLOAD_BACKUP_FILE_RES" }) } - case "RECOVER_SEEDPHRASE": { + case "ALPH_RECOVER_SEEDPHRASE": { try { const { secure, body } = msg.data if (secure !== true) { @@ -49,10 +49,10 @@ export const handleRecoveryMessage: HandleMessage = async ({ await wallet.restoreSeedPhrase(seedPhrase, newPassword) transactionTracker.loadHistory(await getAccounts()) - return sendMessageToUi({ type: "RECOVER_SEEDPHRASE_RES" }) + return sendMessageToUi({ type: "ALPH_RECOVER_SEEDPHRASE_RES" }) } catch (error) { console.error(error) - return sendMessageToUi({ type: "RECOVER_SEEDPHRASE_REJ" }) + return sendMessageToUi({ type: "ALPH_RECOVER_SEEDPHRASE_REJ" }) } } } diff --git a/packages/extension/src/background/sessionMessaging.ts b/packages/extension/src/background/sessionMessaging.ts index 34a355ec..f3126a6c 100644 --- a/packages/extension/src/background/sessionMessaging.ts +++ b/packages/extension/src/background/sessionMessaging.ts @@ -13,7 +13,7 @@ export const handleSessionMessage: HandleMessage = async ({ respond, }) => { switch (msg.type) { - case "START_SESSION": { + case "ALPH_START_SESSION": { const { secure, body } = msg.data if (secure !== true) { throw Error("session can only be started with encryption") @@ -25,39 +25,39 @@ export const handleSessionMessage: HandleMessage = async ({ if (result) { const selectedAccount = await wallet.getAlephiumSelectedAddress() return respond({ - type: "START_SESSION_RES", + type: "ALPH_START_SESSION_RES", data: selectedAccount, }) } - return respond({ type: "START_SESSION_REJ" }) + return respond({ type: "ALPH_START_SESSION_REJ" }) } - case "CHECK_PASSWORD": { + case "ALPH_CHECK_PASSWORD": { const { body } = msg.data const { plaintext } = await compactDecrypt(body, privateKey) const password = encode.arrayBufferToString(plaintext) if (await wallet.checkPassword(password)) { - return sendMessageToUi({ type: "CHECK_PASSWORD_RES" }) + return sendMessageToUi({ type: "ALPH_CHECK_PASSWORD_RES" }) } - return sendMessageToUi({ type: "CHECK_PASSWORD_REJ" }) + return sendMessageToUi({ type: "ALPH_CHECK_PASSWORD_REJ" }) } - case "HAS_SESSION": { + case "ALPH_HAS_SESSION": { return respond({ - type: "HAS_SESSION_RES", + type: "ALPH_HAS_SESSION_RES", data: await wallet.isSessionOpen(), }) } - case "STOP_SESSION": { + case "ALPH_STOP_SESSION": { await wallet.lock() - return respond({ type: "DISCONNECT_ACCOUNT" }) + return respond({ type: "ALPH_DISCONNECT_ACCOUNT" }) } - case "IS_INITIALIZED": { + case "ALPH_IS_INITIALIZED": { const initialized = await wallet.isInitialized() return respond({ - type: "IS_INITIALIZED_RES", + type: "ALPH_IS_INITIALIZED_RES", data: { initialized }, }) } diff --git a/packages/extension/src/background/tokenMessaging.ts b/packages/extension/src/background/tokenMessaging.ts index 9dc9eccd..9c5620a5 100644 --- a/packages/extension/src/background/tokenMessaging.ts +++ b/packages/extension/src/background/tokenMessaging.ts @@ -9,7 +9,7 @@ export const handleTokenMessaging: HandleMessage = async ({ respond, }) => { switch (msg.type) { - case "REQUEST_ADD_TOKEN": { + case "ALPH_REQUEST_ADD_TOKEN": { const selectedAccount = await wallet.getSelectedAccount() const networkId = msg.data.networkId ?? selectedAccount?.networkId ?? defaultNetwork.id const exists = await hasToken({ @@ -19,12 +19,12 @@ export const handleTokenMessaging: HandleMessage = async ({ if (!exists) { const { meta } = await actionQueue.push({ - type: "REQUEST_ADD_TOKEN", + type: "ALPH_REQUEST_ADD_TOKEN", payload: msg.data, }) return respond({ - type: "REQUEST_ADD_TOKEN_RES", + type: "ALPH_REQUEST_ADD_TOKEN_RES", data: { actionHash: meta.hash, }, @@ -32,12 +32,12 @@ export const handleTokenMessaging: HandleMessage = async ({ } return respond({ - type: "REQUEST_ADD_TOKEN_RES", + type: "ALPH_REQUEST_ADD_TOKEN_RES", data: {}, }) } - case "REJECT_REQUEST_ADD_TOKEN": { + case "ALPH_REJECT_REQUEST_ADD_TOKEN": { return await actionQueue.remove(msg.data.actionHash) } } diff --git a/packages/extension/src/background/transactions/transactionMessaging.ts b/packages/extension/src/background/transactions/transactionMessaging.ts index 481a76b8..3be2beff 100644 --- a/packages/extension/src/background/transactions/transactionMessaging.ts +++ b/packages/extension/src/background/transactions/transactionMessaging.ts @@ -9,7 +9,7 @@ export const handleTransactionMessage: HandleMessage< switch (msg.type) { case "ALPH_EXECUTE_TRANSACTION": { const { meta } = await actionQueue.push({ - type: "TRANSACTION", + type: "ALPH_TRANSACTION", payload: msg.data, }) diff --git a/packages/extension/src/inpage/account.ts b/packages/extension/src/inpage/account.ts index 0e964db0..6c0b9ffd 100644 --- a/packages/extension/src/inpage/account.ts +++ b/packages/extension/src/inpage/account.ts @@ -1,5 +1,5 @@ import { sendMessage } from "./messageActions" export const disconnectAccount = async () => { - sendMessage({ type: "DISCONNECT_ACCOUNT" }) + sendMessage({ type: "ALPH_DISCONNECT_ACCOUNT" }) } diff --git a/packages/extension/src/inpage/index.ts b/packages/extension/src/inpage/index.ts index 34e890d1..b6b76c8d 100644 --- a/packages/extension/src/inpage/index.ts +++ b/packages/extension/src/inpage/index.ts @@ -69,7 +69,7 @@ window.addEventListener( return } - if (data.type === "DISCONNECT_ACCOUNT") { + if (data.type === "ALPH_DISCONNECT_ACCOUNT") { await alephium.disconnect() } }, diff --git a/packages/extension/src/inpage/messaging.ts b/packages/extension/src/inpage/messaging.ts index a2980459..1fb441e3 100644 --- a/packages/extension/src/inpage/messaging.ts +++ b/packages/extension/src/inpage/messaging.ts @@ -31,10 +31,10 @@ export const removePreAuthorization = async () => { export const getNetwork = async (networkId: string) => { try { sendMessage({ - type: "GET_NETWORK", + type: "ALPH_GET_NETWORK", data: networkId, }) - return await waitForMessage("GET_NETWORK_RES", 2000) + return await waitForMessage("ALPH_GET_NETWORK_RES", 2000) } catch (error) { console.error(`Error getting network: ${error} for networkId: ${networkId}`) throw error diff --git a/packages/extension/src/inpage/requestMessageHandlers.ts b/packages/extension/src/inpage/requestMessageHandlers.ts index 20afb81f..d0b9df25 100644 --- a/packages/extension/src/inpage/requestMessageHandlers.ts +++ b/packages/extension/src/inpage/requestMessageHandlers.ts @@ -7,7 +7,7 @@ export async function handleAddTokenRequest( callParams: AddNewTokenParameters, ): Promise { sendMessage({ - type: "REQUEST_ADD_TOKEN", + type: "ALPH_REQUEST_ADD_TOKEN", data: { id: callParams.id, networkId: callParams.networkId, @@ -17,7 +17,7 @@ export async function handleAddTokenRequest( logoURI: callParams.logoURI }, }) - const { actionHash } = await waitForMessage("REQUEST_ADD_TOKEN_RES", 1000) + const { actionHash } = await waitForMessage("ALPH_REQUEST_ADD_TOKEN_RES", 1000) if (!actionHash) { // token already exists @@ -28,18 +28,18 @@ export async function handleAddTokenRequest( const result = await Promise.race([ waitForMessage( - "APPROVE_REQUEST_ADD_TOKEN", + "ALPH_APPROVE_REQUEST_ADD_TOKEN", 11 * 60 * 1000, (x) => x.data.actionHash === actionHash, ), waitForMessage( - "REJECT_REQUEST_ADD_TOKEN", + "ALPH_REJECT_REQUEST_ADD_TOKEN", 10 * 60 * 1000, (x) => x.data.actionHash === actionHash, ) .then(() => "error" as const) .catch(() => { - sendMessage({ type: "REJECT_REQUEST_ADD_TOKEN", data: { actionHash } }) + sendMessage({ type: "ALPH_REJECT_REQUEST_ADD_TOKEN", data: { actionHash } }) return "timeout" as const }), ]) @@ -58,7 +58,7 @@ export async function handleAddNetworkRequest( callParams: AddStarknetChainParameters, ): Promise { sendMessage({ - type: "REQUEST_ADD_CUSTOM_NETWORK", + type: "ALPH_REQUEST_ADD_CUSTOM_NETWORK", data: { id: callParams.id, name: callParams.chainName, @@ -69,8 +69,8 @@ export async function handleAddNetworkRequest( }) const req = await Promise.race([ - waitForMessage("REQUEST_ADD_CUSTOM_NETWORK_RES", 1000), - waitForMessage("REQUEST_ADD_CUSTOM_NETWORK_REJ", 1000), + waitForMessage("ALPH_REQUEST_ADD_CUSTOM_NETWORK_RES", 1000), + waitForMessage("ALPH_REQUEST_ADD_CUSTOM_NETWORK_REJ", 1000), ]) if ("error" in req) { @@ -83,19 +83,19 @@ export async function handleAddNetworkRequest( const result = await Promise.race([ waitForMessage( - "APPROVE_REQUEST_ADD_CUSTOM_NETWORK", + "ALPH_APPROVE_REQUEST_ADD_CUSTOM_NETWORK", 11 * 60 * 1000, (x) => x.data.actionHash === actionHash, ), waitForMessage( - "REJECT_REQUEST_ADD_CUSTOM_NETWORK", + "ALPH_REJECT_REQUEST_ADD_CUSTOM_NETWORK", 10 * 60 * 1000, (x) => x.data.actionHash === actionHash, ) .then(() => "error" as const) .catch(() => { sendMessage({ - type: "REJECT_REQUEST_ADD_CUSTOM_NETWORK", + type: "ALPH_REJECT_REQUEST_ADD_CUSTOM_NETWORK", data: { actionHash }, }) return "timeout" as const @@ -116,13 +116,13 @@ export async function handleSwitchNetworkRequest(callParams: { id: Network["id"] }): Promise { sendMessage({ - type: "REQUEST_SWITCH_CUSTOM_NETWORK", + type: "ALPH_REQUEST_SWITCH_CUSTOM_NETWORK", data: { id: callParams.id }, }) const req = await Promise.race([ - waitForMessage("REQUEST_SWITCH_CUSTOM_NETWORK_RES", 1000), - waitForMessage("REQUEST_SWITCH_CUSTOM_NETWORK_REJ", 1000), + waitForMessage("ALPH_REQUEST_SWITCH_CUSTOM_NETWORK_RES", 1000), + waitForMessage("ALPH_REQUEST_SWITCH_CUSTOM_NETWORK_REJ", 1000), ]) if ("error" in req) { @@ -135,19 +135,19 @@ export async function handleSwitchNetworkRequest(callParams: { const result = await Promise.race([ waitForMessage( - "APPROVE_REQUEST_SWITCH_CUSTOM_NETWORK", + "ALPH_APPROVE_REQUEST_SWITCH_CUSTOM_NETWORK", 11 * 60 * 1000, (x) => x.data.actionHash === actionHash, ), waitForMessage( - "REJECT_REQUEST_SWITCH_CUSTOM_NETWORK", + "ALPH_REJECT_REQUEST_SWITCH_CUSTOM_NETWORK", 10 * 60 * 1000, (x) => x.data.actionHash === actionHash, ) .then(() => "error" as const) .catch(() => { sendMessage({ - type: "REJECT_REQUEST_SWITCH_CUSTOM_NETWORK", + type: "ALPH_REJECT_REQUEST_SWITCH_CUSTOM_NETWORK", data: { actionHash }, }) return "timeout" as const diff --git a/packages/extension/src/shared/actionQueue/store.ts b/packages/extension/src/shared/actionQueue/store.ts index ceb5a042..3d50ee44 100644 --- a/packages/extension/src/shared/actionQueue/store.ts +++ b/packages/extension/src/shared/actionQueue/store.ts @@ -4,7 +4,7 @@ import { ExtensionActionItem } from "./types" export const globalActionQueueStore = new ArrayStorage( [], { - namespace: "core:actionQueue", + namespace: "core:alphActionQueue", areaName: "local", compare: (a, b) => a.meta.hash === b.meta.hash, }, diff --git a/packages/extension/src/shared/actionQueue/types.ts b/packages/extension/src/shared/actionQueue/types.ts index 03775c36..40d3fc98 100644 --- a/packages/extension/src/shared/actionQueue/types.ts +++ b/packages/extension/src/shared/actionQueue/types.ts @@ -96,7 +96,7 @@ export type TransactionResult = export type ActionItem = | { - type: "CONNECT_DAPP" + type: "ALPH_CONNECT_DAPP" payload: { host: string networkId?: string @@ -105,23 +105,23 @@ export type ActionItem = } } | { - type: "TRANSACTION" + type: "ALPH_TRANSACTION" payload: TransactionParams } | { - type: "SIGN_MESSAGE" + type: "ALPH_SIGN_MESSAGE" payload: SignMessageParams & { networkId?: string; host: string } } | { - type: "SIGN_UNSIGNED_TX" + type: "ALPH_SIGN_UNSIGNED_TX" payload: SignUnsignedTxParams & { networkId?: string; host: string } } | { - type: "REQUEST_ADD_TOKEN" + type: "ALPH_REQUEST_ADD_TOKEN" payload: Token } | { - type: "REQUEST_ADD_CUSTOM_NETWORK" + type: "ALPH_REQUEST_ADD_CUSTOM_NETWORK" payload: { id: string name: string @@ -131,7 +131,7 @@ export type ActionItem = } } | { - type: "REQUEST_SWITCH_CUSTOM_NETWORK" + type: "ALPH_REQUEST_SWITCH_CUSTOM_NETWORK" payload: { id: string name: string diff --git a/packages/extension/src/shared/messages/AccountMessage.ts b/packages/extension/src/shared/messages/AccountMessage.ts index d61a15e8..db3b314f 100644 --- a/packages/extension/src/shared/messages/AccountMessage.ts +++ b/packages/extension/src/shared/messages/AccountMessage.ts @@ -6,69 +6,69 @@ import { } from "../wallet.model" export type AccountMessage = - | { type: "NEW_ACCOUNT"; data: { networkId: string; keyType: KeyType; group?: number } } + | { type: "ALPH_NEW_ACCOUNT"; data: { networkId: string; keyType: KeyType; group?: number } } | { - type: "NEW_ACCOUNT_RES" + type: "ALPH_NEW_ACCOUNT_RES" data: { account: WalletAccount accounts: WalletAccount[] } } - | { type: "NEW_ACCOUNT_REJ"; data: { error: string } } - | { type: "NEW_LEDGER_ACCOUNT"; data: { account: Account; hdIndex: number, networkId: string } } + | { type: "ALPH_NEW_ACCOUNT_REJ"; data: { error: string } } + | { type: "ALPH_NEW_LEDGER_ACCOUNT"; data: { account: Account; hdIndex: number, networkId: string } } | { - type: "NEW_LEDGER_ACCOUNT_RES" + type: "ALPH_NEW_LEDGER_ACCOUNT_RES" data: { account: BaseWalletAccount } } - | { type: "NEW_LEDGER_ACCOUNT_REJ"; data: { error: string } } - | { type: "GET_ACCOUNTS"; data?: { showHidden: boolean } } - | { type: "GET_ACCOUNTS_RES"; data: WalletAccount[] } - | { type: "CONNECT_ACCOUNT"; data?: BaseWalletAccount } - | { type: "CONNECT_ACCOUNT_RES"; data?: WalletAccount } - | { type: "DISCONNECT_ACCOUNT" } - | { type: "GET_SELECTED_ACCOUNT" } - | { type: "GET_SELECTED_ACCOUNT_RES"; data: WalletAccount | undefined } - | { type: "DELETE_ACCOUNT"; data: BaseWalletAccount } - | { type: "DELETE_ACCOUNT_RES" } - | { type: "DELETE_ACCOUNT_REJ" } + | { type: "ALPH_NEW_LEDGER_ACCOUNT_REJ"; data: { error: string } } + | { type: "ALPH_GET_ACCOUNTS"; data?: { showHidden: boolean } } + | { type: "ALPH_GET_ACCOUNTS_RES"; data: WalletAccount[] } + | { type: "ALPH_CONNECT_ACCOUNT"; data?: BaseWalletAccount } + | { type: "ALPH_CONNECT_ACCOUNT_RES"; data?: WalletAccount } + | { type: "ALPH_DISCONNECT_ACCOUNT" } + | { type: "ALPH_GET_SELECTED_ACCOUNT" } + | { type: "ALPH_GET_SELECTED_ACCOUNT_RES"; data: WalletAccount | undefined } + | { type: "ALPH_DELETE_ACCOUNT"; data: BaseWalletAccount } + | { type: "ALPH_DELETE_ACCOUNT_RES" } + | { type: "ALPH_DELETE_ACCOUNT_REJ" } | { - type: "UPGRADE_ACCOUNT" + type: "ALPH_UPGRADE_ACCOUNT" data: { wallet: BaseWalletAccount targetImplementationType?: ArgentAccountType } } - | { type: "UPGRADE_ACCOUNT_RES" } - | { type: "UPGRADE_ACCOUNT_REJ" } + | { type: "ALPH_UPGRADE_ACCOUNT_RES" } + | { type: "ALPH_UPGRADE_ACCOUNT_REJ" } | { - type: "GET_ENCRYPTED_PRIVATE_KEY" + type: "ALPH_GET_ENCRYPTED_PRIVATE_KEY" data: { encryptedSecret: string } } | { - type: "GET_ENCRYPTED_PRIVATE_KEY_RES" + type: "ALPH_GET_ENCRYPTED_PRIVATE_KEY_RES" data: { encryptedPrivateKey: string } } | { - type: "GET_ENCRYPTED_SEED_PHRASE" + type: "ALPH_GET_ENCRYPTED_SEED_PHRASE" data: { encryptedSecret: string } } | { - type: "GET_ENCRYPTED_SEED_PHRASE_RES" + type: "ALPH_GET_ENCRYPTED_SEED_PHRASE_RES" data: { encryptedSeedPhrase: string } } | { - type: "DISCOVER_ACCOUNTS" + type: "ALPH_DISCOVER_ACCOUNTS" data: { networkId: string } } | { - type: "DISCOVER_ACCOUNTS_RES" + type: "ALPH_DISCOVER_ACCOUNTS_RES" data: { accounts: WalletAccount[] } } | { - type: "DISCOVER_ACCOUNTS_REJ" + type: "ALPH_DISCOVER_ACCOUNTS_REJ" data: { error: string } } diff --git a/packages/extension/src/shared/messages/ActionMessage.ts b/packages/extension/src/shared/messages/ActionMessage.ts index bdb119a3..54544b71 100644 --- a/packages/extension/src/shared/messages/ActionMessage.ts +++ b/packages/extension/src/shared/messages/ActionMessage.ts @@ -4,20 +4,20 @@ import { ExtensionActionItem, TransactionResult } from "../actionQueue/types" import { SignMessageParams, SignUnsignedTxParams, SignUnsignedTxResult } from "@alephium/web3" export type ActionMessage = - | { type: "GET_ACTIONS" } + | { type: "ALPH_GET_ACTIONS" } | { - type: "GET_ACTIONS_RES" + type: "ALPH_GET_ACTIONS_RES" data: ExtensionActionItem[] } | { - type: "APPROVE_ACTION" + type: "ALPH_APPROVE_ACTION" data: { actionHash: string; additionalData?: any } } | { - type: "APPROVE_Transaction_ACTION" + type: "ALPH_APPROVE_Transaction_ACTION" data: { actionHash: string; result: TransactionResult } } - | { type: "REJECT_ACTION"; data: { actionHash: string | string[] } } + | { type: "ALPH_REJECT_ACTION"; data: { actionHash: string | string[] } } | { type: "ALPH_SIGN_MESSAGE"; data: SignMessageParams & { networkId?: string, host: string } } | { type: "ALPH_SIGN_MESSAGE_RES"; data: { actionHash: string } } | { type: "ALPH_SIGN_MESSAGE_FAILURE"; data: { actionHash: string } } diff --git a/packages/extension/src/shared/messages/MiscellaneousMessage.ts b/packages/extension/src/shared/messages/MiscellaneousMessage.ts index 495c084f..4fd0b23d 100644 --- a/packages/extension/src/shared/messages/MiscellaneousMessage.ts +++ b/packages/extension/src/shared/messages/MiscellaneousMessage.ts @@ -2,6 +2,6 @@ import type { JWK } from "jose" export type MiscenalleousMessage = | { type: "ALPH_OPEN_UI" } - | { type: "RESET_ALL" } - | { type: "GET_MESSAGING_PUBLIC_KEY" } - | { type: "GET_MESSAGING_PUBLIC_KEY_RES"; data: JWK } + | { type: "ALPH_RESET_ALL" } + | { type: "ALPH_GET_MESSAGING_PUBLIC_KEY" } + | { type: "ALPH_GET_MESSAGING_PUBLIC_KEY_RES"; data: JWK } diff --git a/packages/extension/src/shared/messages/NetworkMessage.ts b/packages/extension/src/shared/messages/NetworkMessage.ts index 0ddbce8a..b031effe 100644 --- a/packages/extension/src/shared/messages/NetworkMessage.ts +++ b/packages/extension/src/shared/messages/NetworkMessage.ts @@ -3,47 +3,47 @@ import { WalletAccount } from "../wallet.model" export type NetworkMessage = // ***** networks ***** - | { type: "GET_NETWORKS" } - | { type: "GET_NETWORKS_RES"; data: Network[] } - | { type: "GET_NETWORK"; data: Network["id"] } - | { type: "GET_NETWORK_RES"; data: Network } - | { type: "GET_CUSTOM_NETWORKS" } - | { type: "GET_CUSTOM_NETWORKS_RES"; data: Network[] } - | { type: "ADD_CUSTOM_NETWORKS"; data: Network[] } - | { type: "ADD_CUSTOM_NETWORKS_RES"; data: Network[] } - | { type: "REMOVE_CUSTOM_NETWORKS"; data: Network["id"][] } - | { type: "REMOVE_CUSTOM_NETWORKS_RES"; data: Network[] } - | { type: "GET_NETWORK_STATUSES"; data?: Network[] } // allows ui to get specific network statuses and defaults to all + | { type: "ALPH_GET_NETWORKS" } + | { type: "ALPH_GET_NETWORKS_RES"; data: Network[] } + | { type: "ALPH_GET_NETWORK"; data: Network["id"] } + | { type: "ALPH_GET_NETWORK_RES"; data: Network } + | { type: "ALPH_GET_CUSTOM_NETWORKS" } + | { type: "ALPH_GET_CUSTOM_NETWORKS_RES"; data: Network[] } + | { type: "ALPH_ADD_CUSTOM_NETWORKS"; data: Network[] } + | { type: "ALPH_ADD_CUSTOM_NETWORKS_RES"; data: Network[] } + | { type: "ALPH_REMOVE_CUSTOM_NETWORKS"; data: Network["id"][] } + | { type: "ALPH_REMOVE_CUSTOM_NETWORKS_RES"; data: Network[] } + | { type: "ALPH_GET_NETWORK_STATUSES"; data?: Network[] } // allows ui to get specific network statuses and defaults to all | { - type: "GET_NETWORK_STATUSES_RES" + type: "ALPH_GET_NETWORK_STATUSES_RES" data: Partial> } // - used by dapps to request addition of custom network - | { type: "REQUEST_ADD_CUSTOM_NETWORK"; data: Network } - | { type: "REQUEST_ADD_CUSTOM_NETWORK_RES"; data: { actionHash: string } } + | { type: "ALPH_REQUEST_ADD_CUSTOM_NETWORK"; data: Network } + | { type: "ALPH_REQUEST_ADD_CUSTOM_NETWORK_RES"; data: { actionHash: string } } | { - type: "REQUEST_ADD_CUSTOM_NETWORK_REJ" + type: "ALPH_REQUEST_ADD_CUSTOM_NETWORK_REJ" data: { error: string } } - | { type: "REJECT_REQUEST_ADD_CUSTOM_NETWORK"; data: { actionHash: string } } - | { type: "APPROVE_REQUEST_ADD_CUSTOM_NETWORK"; data: { actionHash: string } } + | { type: "ALPH_REJECT_REQUEST_ADD_CUSTOM_NETWORK"; data: { actionHash: string } } + | { type: "ALPH_APPROVE_REQUEST_ADD_CUSTOM_NETWORK"; data: { actionHash: string } } // - used by dapps to request switching of already added custom network | { - type: "REQUEST_SWITCH_CUSTOM_NETWORK" + type: "ALPH_REQUEST_SWITCH_CUSTOM_NETWORK" data: { id: Network["id"] } } - | { type: "REQUEST_SWITCH_CUSTOM_NETWORK_RES"; data: { actionHash: string } } + | { type: "ALPH_REQUEST_SWITCH_CUSTOM_NETWORK_RES"; data: { actionHash: string } } | { - type: "REQUEST_SWITCH_CUSTOM_NETWORK_REJ" + type: "ALPH_REQUEST_SWITCH_CUSTOM_NETWORK_REJ" data: { error: string } } | { - type: "REJECT_REQUEST_SWITCH_CUSTOM_NETWORK" + type: "ALPH_REJECT_REQUEST_SWITCH_CUSTOM_NETWORK" data: { actionHash: string } } | { - type: "APPROVE_REQUEST_SWITCH_CUSTOM_NETWORK" + type: "ALPH_APPROVE_REQUEST_SWITCH_CUSTOM_NETWORK" data: { actionHash: string; selectedAccount: WalletAccount } } diff --git a/packages/extension/src/shared/messages/RecoveryMessage.ts b/packages/extension/src/shared/messages/RecoveryMessage.ts index 54aeb0f8..c8924e53 100644 --- a/packages/extension/src/shared/messages/RecoveryMessage.ts +++ b/packages/extension/src/shared/messages/RecoveryMessage.ts @@ -1,9 +1,9 @@ export type RecoveryMessage = - | { type: "RECOVER_BACKUP"; data: string } - | { type: "RECOVER_BACKUP_RES" } - | { type: "RECOVER_BACKUP_REJ"; data: string } - | { type: "RECOVER_SEEDPHRASE"; data: { secure: true; body: string } } - | { type: "RECOVER_SEEDPHRASE_RES" } - | { type: "RECOVER_SEEDPHRASE_REJ" } - | { type: "DOWNLOAD_BACKUP_FILE" } - | { type: "DOWNLOAD_BACKUP_FILE_RES" } + | { type: "ALPH_RECOVER_BACKUP"; data: string } + | { type: "ALPH_RECOVER_BACKUP_RES" } + | { type: "ALPH_RECOVER_BACKUP_REJ"; data: string } + | { type: "ALPH_RECOVER_SEEDPHRASE"; data: { secure: true; body: string } } + | { type: "ALPH_RECOVER_SEEDPHRASE_RES" } + | { type: "ALPH_RECOVER_SEEDPHRASE_REJ" } + | { type: "ALPH_DOWNLOAD_BACKUP_FILE" } + | { type: "ALPH_DOWNLOAD_BACKUP_FILE_RES" } diff --git a/packages/extension/src/shared/messages/SessionMessage.ts b/packages/extension/src/shared/messages/SessionMessage.ts index 0aca28f2..a072d924 100644 --- a/packages/extension/src/shared/messages/SessionMessage.ts +++ b/packages/extension/src/shared/messages/SessionMessage.ts @@ -1,18 +1,18 @@ import { WalletAccount } from "../wallet.model" export type SessionMessage = - | { type: "STOP_SESSION" } - | { type: "HAS_SESSION" } - | { type: "HAS_SESSION_RES"; data: boolean } - | { type: "IS_INITIALIZED" } + | { type: "ALPH_STOP_SESSION" } + | { type: "ALPH_HAS_SESSION" } + | { type: "ALPH_HAS_SESSION_RES"; data: boolean } + | { type: "ALPH_IS_INITIALIZED" } | { - type: "IS_INITIALIZED_RES" + type: "ALPH_IS_INITIALIZED_RES" data: { initialized: boolean } } - | { type: "START_SESSION"; data: { secure: true; body: string } } - | { type: "START_SESSION_REJ" } - | { type: "START_SESSION_RES"; data?: WalletAccount } - | { type: "LOADING_PROGRESS"; data: number } - | { type: "CHECK_PASSWORD"; data: { body: string } } - | { type: "CHECK_PASSWORD_REJ" } - | { type: "CHECK_PASSWORD_RES" } + | { type: "ALPH_START_SESSION"; data: { secure: true; body: string } } + | { type: "ALPH_START_SESSION_REJ" } + | { type: "ALPH_START_SESSION_RES"; data?: WalletAccount } + | { type: "ALPH_LOADING_PROGRESS"; data: number } + | { type: "ALPH_CHECK_PASSWORD"; data: { body: string } } + | { type: "ALPH_CHECK_PASSWORD_REJ" } + | { type: "ALPH_CHECK_PASSWORD_RES" } diff --git a/packages/extension/src/shared/messages/TokenMessage.ts b/packages/extension/src/shared/messages/TokenMessage.ts index 24ed5573..a092e188 100644 --- a/packages/extension/src/shared/messages/TokenMessage.ts +++ b/packages/extension/src/shared/messages/TokenMessage.ts @@ -2,7 +2,7 @@ import { Token } from "../token/type" export type TokenMessage = // - used by dapps to request tokens - | { type: "REQUEST_ADD_TOKEN"; data: Token } - | { type: "REQUEST_ADD_TOKEN_RES"; data: { actionHash?: string } } // returns no actionHash if the token already exists - | { type: "REJECT_REQUEST_ADD_TOKEN"; data: { actionHash: string } } - | { type: "APPROVE_REQUEST_ADD_TOKEN"; data: { actionHash: string } } + | { type: "ALPH_REQUEST_ADD_TOKEN"; data: Token } + | { type: "ALPH_REQUEST_ADD_TOKEN_RES"; data: { actionHash?: string } } // returns no actionHash if the token already exists + | { type: "ALPH_REJECT_REQUEST_ADD_TOKEN"; data: { actionHash: string } } + | { type: "ALPH_APPROVE_REQUEST_ADD_TOKEN"; data: { actionHash: string } } diff --git a/packages/extension/src/ui/app.state.ts b/packages/extension/src/ui/app.state.ts index c30ca220..475318e9 100644 --- a/packages/extension/src/ui/app.state.ts +++ b/packages/extension/src/ui/app.state.ts @@ -22,7 +22,7 @@ export const useLoadingProgress = () => { useEffect(() => { messageStream.subscribe(([message]) => { - if (message.type === "LOADING_PROGRESS") { + if (message.type === "ALPH_LOADING_PROGRESS") { setProgress(message.data >= 1 ? undefined : message.data) } }) diff --git a/packages/extension/src/ui/features/accounts/accounts.state.ts b/packages/extension/src/ui/features/accounts/accounts.state.ts index 1b9b98d9..5aeee9b3 100644 --- a/packages/extension/src/ui/features/accounts/accounts.state.ts +++ b/packages/extension/src/ui/features/accounts/accounts.state.ts @@ -76,7 +76,9 @@ export const useAccountsOnNetwork = ({ export const useAccount = ( account?: BaseWalletAccount, ): Account | undefined => { - const accounts = useAccounts({ showHidden: true }) + const network = useCurrentNetwork() + const allNetworks = account?.networkId !== network.id + const accounts = useAccounts({ showHidden: true, allNetworks }) return useMemo(() => { if (!account) { return undefined diff --git a/packages/extension/src/ui/features/actions/ActionScreen.tsx b/packages/extension/src/ui/features/actions/ActionScreen.tsx index 0e39fd1e..83ca3c0e 100644 --- a/packages/extension/src/ui/features/actions/ActionScreen.tsx +++ b/packages/extension/src/ui/features/actions/ActionScreen.tsx @@ -1,6 +1,5 @@ import { FC, useCallback, useEffect } from "react" import { useNavigate } from "react-router-dom" -import { TransactionResult } from "../../../shared/actionQueue/types" import { waitForMessage } from "../../../shared/messages" import { removePreAuthorization } from "../../../shared/preAuthorizations" @@ -30,9 +29,9 @@ export const ActionScreen: FC = () => { const [action] = actions const isLastAction = actions.length === 1 - const signerAccount = useAccount(action.type === 'TRANSACTION' && selectedAccount + const signerAccount = useAccount(action.type === 'ALPH_TRANSACTION' && selectedAccount ? { address: action.payload.params.signerAddress, networkId: action.payload.params.networkId ?? selectedAccount.networkId } - : (action.type === 'SIGN_MESSAGE' || action.type === 'SIGN_UNSIGNED_TX') && selectedAccount + : (action.type === 'ALPH_SIGN_MESSAGE' || action.type === 'ALPH_SIGN_UNSIGNED_TX') && selectedAccount ? { address: action.payload.signerAddress, networkId: action.payload.networkId ?? selectedAccount.networkId } : undefined ) @@ -74,7 +73,7 @@ export const ActionScreen: FC = () => { }, [extensionIsInTab, action?.type]) switch (action?.type) { - case "CONNECT_DAPP": + case "ALPH_CONNECT_DAPP": return ( { /> ) - case "REQUEST_ADD_TOKEN": + case "ALPH_REQUEST_ADD_TOKEN": return ( { /> ) - case "REQUEST_ADD_CUSTOM_NETWORK": + case "ALPH_REQUEST_ADD_CUSTOM_NETWORK": return ( { /> ) - case "REQUEST_SWITCH_CUSTOM_NETWORK": + case "ALPH_REQUEST_SWITCH_CUSTOM_NETWORK": return ( { /> ) - case "TRANSACTION": + case "ALPH_TRANSACTION": return ( { /> ) - case "SIGN_MESSAGE": + case "ALPH_SIGN_MESSAGE": return ( { /> ) - case 'SIGN_UNSIGNED_TX': + case 'ALPH_SIGN_UNSIGNED_TX': return ( = ({ }, [selectedAccount, buildResult, onSubmit, onReject, navigate]) if (!selectedAccount) { - return + throw Error(`No account found for network ${networkId}`) } if (!buildResult) { diff --git a/packages/extension/src/ui/services/background.ts b/packages/extension/src/ui/services/background.ts index 506d0c26..6dcd73e7 100644 --- a/packages/extension/src/ui/services/background.ts +++ b/packages/extension/src/ui/services/background.ts @@ -6,12 +6,12 @@ import { import { IS_DEV } from "../../shared/utils/dev" export const getMessagingPublicKey = async () => { - sendMessage({ type: "GET_MESSAGING_PUBLIC_KEY" }) - return waitForMessage("GET_MESSAGING_PUBLIC_KEY_RES") + sendMessage({ type: "ALPH_GET_MESSAGING_PUBLIC_KEY" }) + return waitForMessage("ALPH_GET_MESSAGING_PUBLIC_KEY_RES") } export const resetAll = () => { - sendMessage({ type: "RESET_ALL" }) + sendMessage({ type: "ALPH_RESET_ALL" }) } if (IS_DEV) { diff --git a/packages/extension/src/ui/services/backgroundAccounts.ts b/packages/extension/src/ui/services/backgroundAccounts.ts index 2f7ad436..b4905dad 100644 --- a/packages/extension/src/ui/services/backgroundAccounts.ts +++ b/packages/extension/src/ui/services/backgroundAccounts.ts @@ -9,11 +9,11 @@ import { walletStore } from "../../shared/wallet/walletStore" import { decryptFromBackground, generateEncryptedSecret } from "./crypto" export const createNewAccount = async (networkId: string, keyType: KeyType, group?: number) => { - sendMessage({ type: "NEW_ACCOUNT", data: { networkId: networkId, keyType: keyType, group: group } }) + sendMessage({ type: "ALPH_NEW_ACCOUNT", data: { networkId: networkId, keyType: keyType, group: group } }) try { return await Promise.race([ - waitForMessage("NEW_ACCOUNT_RES"), - waitForMessage("NEW_ACCOUNT_REJ").then(() => "error" as const), + waitForMessage("ALPH_NEW_ACCOUNT_RES"), + waitForMessage("ALPH_NEW_ACCOUNT_REJ").then(() => "error" as const), ]) } catch { throw Error("Could not add new account") @@ -21,11 +21,11 @@ export const createNewAccount = async (networkId: string, keyType: KeyType, grou } export const discoverAccounts = async (networkId: string) => { - sendMessage({ type: "DISCOVER_ACCOUNTS", data: { networkId } }) + sendMessage({ type: "ALPH_DISCOVER_ACCOUNTS", data: { networkId } }) try { return await Promise.race([ - waitForMessage("DISCOVER_ACCOUNTS_RES"), - waitForMessage("DISCOVER_ACCOUNTS_REJ").then(() => "error" as const), + waitForMessage("ALPH_DISCOVER_ACCOUNTS_RES"), + waitForMessage("ALPH_DISCOVER_ACCOUNTS_REJ").then(() => "error" as const), ]) } catch { throw Error(`Could not discover active accounts for ${networkId}.`) @@ -33,11 +33,11 @@ export const discoverAccounts = async (networkId: string) => { } export const importNewLedgerAccount = async (account: Account, hdIndex: number, networkId: string) => { - sendMessage({ type: "NEW_LEDGER_ACCOUNT", data: { account, hdIndex, networkId } }) + sendMessage({ type: "ALPH_NEW_LEDGER_ACCOUNT", data: { account, hdIndex, networkId } }) try { return await Promise.race([ - waitForMessage("NEW_LEDGER_ACCOUNT_RES"), - waitForMessage("NEW_LEDGER_ACCOUNT_REJ").then(() => "error" as const), + waitForMessage("ALPH_NEW_LEDGER_ACCOUNT_RES"), + waitForMessage("ALPH_NEW_LEDGER_ACCOUNT_REJ").then(() => "error" as const), ]) } catch { throw Error("Could add new ledger account") @@ -45,13 +45,13 @@ export const importNewLedgerAccount = async (account: Account, hdIndex: number, } export const getLastSelectedAccount = async () => { - sendMessage({ type: "GET_SELECTED_ACCOUNT" }) - return waitForMessage("GET_SELECTED_ACCOUNT_RES") + sendMessage({ type: "ALPH_GET_SELECTED_ACCOUNT" }) + return waitForMessage("ALPH_GET_SELECTED_ACCOUNT_RES") } export const getAccounts = async (showHidden = false) => { - sendMessage({ type: "GET_ACCOUNTS", data: { showHidden } }) - return waitForMessage("GET_ACCOUNTS_RES") + sendMessage({ type: "ALPH_GET_ACCOUNTS", data: { showHidden } }) + return waitForMessage("ALPH_GET_ACCOUNTS_RES") } export const accountsOnNetwork = ( @@ -69,21 +69,21 @@ export const selectAccount = async ( export const connectAccount = (account?: BaseWalletAccount) => { sendMessage({ - type: "CONNECT_ACCOUNT", + type: "ALPH_CONNECT_ACCOUNT", data: account, }) } export const deleteAccount = async (address: string, networkId: string) => { sendMessage({ - type: "DELETE_ACCOUNT", + type: "ALPH_DELETE_ACCOUNT", data: { address, networkId }, }) try { await Promise.race([ - waitForMessage("DELETE_ACCOUNT_RES"), - waitForMessage("DELETE_ACCOUNT_REJ").then(() => { + waitForMessage("ALPH_DELETE_ACCOUNT_RES"), + waitForMessage("ALPH_DELETE_ACCOUNT_REJ").then(() => { throw new Error("Rejected") }), ]) @@ -97,13 +97,13 @@ export const upgradeAccount = async ( targetImplementationType?: ArgentAccountType, ) => { sendMessage({ - type: "UPGRADE_ACCOUNT", + type: "ALPH_UPGRADE_ACCOUNT", data: { wallet, targetImplementationType }, }) try { await Promise.race([ - waitForMessage("UPGRADE_ACCOUNT_RES"), - waitForMessage("UPGRADE_ACCOUNT_REJ").then(() => { + waitForMessage("ALPH_UPGRADE_ACCOUNT_RES"), + waitForMessage("ALPH_UPGRADE_ACCOUNT_REJ").then(() => { throw new Error("Rejected") }), ]) @@ -115,12 +115,12 @@ export const upgradeAccount = async ( export const getPrivateKey = async () => { const { secret, encryptedSecret } = await generateEncryptedSecret() sendMessage({ - type: "GET_ENCRYPTED_PRIVATE_KEY", + type: "ALPH_GET_ENCRYPTED_PRIVATE_KEY", data: { encryptedSecret }, }) const { encryptedPrivateKey } = await waitForMessage( - "GET_ENCRYPTED_PRIVATE_KEY_RES", + "ALPH_GET_ENCRYPTED_PRIVATE_KEY_RES", ) return await decryptFromBackground(encryptedPrivateKey, secret) @@ -129,12 +129,12 @@ export const getPrivateKey = async () => { export const getSeedPhrase = async (): Promise => { const { secret, encryptedSecret } = await generateEncryptedSecret() sendMessage({ - type: "GET_ENCRYPTED_SEED_PHRASE", + type: "ALPH_GET_ENCRYPTED_SEED_PHRASE", data: { encryptedSecret }, }) const { encryptedSeedPhrase } = await waitForMessage( - "GET_ENCRYPTED_SEED_PHRASE_RES", + "ALPH_GET_ENCRYPTED_SEED_PHRASE_RES", ) return await decryptFromBackground(encryptedSeedPhrase, secret) diff --git a/packages/extension/src/ui/services/backgroundActions.ts b/packages/extension/src/ui/services/backgroundActions.ts index bb57c35b..d3bbadc5 100644 --- a/packages/extension/src/ui/services/backgroundActions.ts +++ b/packages/extension/src/ui/services/backgroundActions.ts @@ -5,15 +5,15 @@ import { sendMessage, waitForMessage } from "../../shared/messages" import { AllowArray } from "../../shared/storage/types" export const getActions = async () => { - sendMessage({ type: "GET_ACTIONS" }) - return waitForMessage("GET_ACTIONS_RES") + sendMessage({ type: "ALPH_GET_ACTIONS" }) + return waitForMessage("ALPH_GET_ACTIONS_RES") } export const approveAction = (action: ExtensionActionItem | string, additionalData?: any) => { const actionHash = isString(action) ? action : action.meta.hash - return sendMessage({ type: "APPROVE_ACTION", data: { actionHash, additionalData } }) + return sendMessage({ type: "ALPH_APPROVE_ACTION", data: { actionHash, additionalData } }) } export const rejectAction = (actionHash: AllowArray) => { - return sendMessage({ type: "REJECT_ACTION", data: { actionHash } }) + return sendMessage({ type: "ALPH_REJECT_ACTION", data: { actionHash } }) } diff --git a/packages/extension/src/ui/services/backgroundNetworks.ts b/packages/extension/src/ui/services/backgroundNetworks.ts index 430cdfb6..80fe358b 100644 --- a/packages/extension/src/ui/services/backgroundNetworks.ts +++ b/packages/extension/src/ui/services/backgroundNetworks.ts @@ -2,6 +2,6 @@ import { sendMessage, waitForMessage } from "../../shared/messages" import { Network } from "../../shared/network" export const getNetworkStatuses = async (networks: Network[] = []) => { - sendMessage({ type: "GET_NETWORK_STATUSES", data: networks }) - return waitForMessage("GET_NETWORK_STATUSES_RES") + sendMessage({ type: "ALPH_GET_NETWORK_STATUSES", data: networks }) + return waitForMessage("ALPH_GET_NETWORK_STATUSES_RES") } diff --git a/packages/extension/src/ui/services/backgroundRecovery.ts b/packages/extension/src/ui/services/backgroundRecovery.ts index 98c4f6c0..4238543a 100644 --- a/packages/extension/src/ui/services/backgroundRecovery.ts +++ b/packages/extension/src/ui/services/backgroundRecovery.ts @@ -2,11 +2,11 @@ import { sendMessage, waitForMessage } from "../../shared/messages" import { encryptForBackground } from "./crypto" export const recoverBackup = async (backup: string) => { - sendMessage({ type: "RECOVER_BACKUP", data: backup }) + sendMessage({ type: "ALPH_RECOVER_BACKUP", data: backup }) await Promise.race([ - waitForMessage("RECOVER_BACKUP_RES"), - waitForMessage("RECOVER_BACKUP_REJ").then((error) => { + waitForMessage("ALPH_RECOVER_BACKUP_RES"), + waitForMessage("ALPH_RECOVER_BACKUP_REJ").then((error) => { throw new Error(error) }), ]) @@ -20,13 +20,13 @@ export const recoverBySeedPhrase = async ( const body = await encryptForBackground(message) sendMessage({ - type: "RECOVER_SEEDPHRASE", + type: "ALPH_RECOVER_SEEDPHRASE", data: { secure: true, body }, }) const succeeded = await Promise.race([ - waitForMessage("RECOVER_SEEDPHRASE_RES").then(() => true), - waitForMessage("RECOVER_SEEDPHRASE_REJ") + waitForMessage("ALPH_RECOVER_SEEDPHRASE_RES").then(() => true), + waitForMessage("ALPH_RECOVER_SEEDPHRASE_REJ") .then(() => false) .catch(() => false), ]) @@ -37,12 +37,12 @@ export const recoverBySeedPhrase = async ( } export const downloadBackupFile = () => { - sendMessage({ type: "DOWNLOAD_BACKUP_FILE" }) + sendMessage({ type: "ALPH_DOWNLOAD_BACKUP_FILE" }) } // for debugging purposes try { - ;(window as any).downloadBackup = downloadBackupFile + ; (window as any).downloadBackup = downloadBackupFile } catch { // ignore } diff --git a/packages/extension/src/ui/services/backgroundSessions.ts b/packages/extension/src/ui/services/backgroundSessions.ts index 88e71edc..9226fc21 100644 --- a/packages/extension/src/ui/services/backgroundSessions.ts +++ b/packages/extension/src/ui/services/backgroundSessions.ts @@ -2,23 +2,23 @@ import { sendMessage, waitForMessage } from "../../shared/messages" import { encryptForBackground } from "./crypto" export const hasActiveSession = async () => { - sendMessage({ type: "HAS_SESSION" }) - return waitForMessage("HAS_SESSION_RES") + sendMessage({ type: "ALPH_HAS_SESSION" }) + return waitForMessage("ALPH_HAS_SESSION_RES") } export const isInitialized = async () => { - sendMessage({ type: "IS_INITIALIZED" }) - return await waitForMessage("IS_INITIALIZED_RES") + sendMessage({ type: "ALPH_IS_INITIALIZED" }) + return await waitForMessage("ALPH_IS_INITIALIZED_RES") } export const startSession = async (password: string): Promise => { const body = await encryptForBackground(password) - sendMessage({ type: "START_SESSION", data: { secure: true, body } }) + sendMessage({ type: "ALPH_START_SESSION", data: { secure: true, body } }) const succeeded = await Promise.race([ - waitForMessage("START_SESSION_RES").then(() => true), - waitForMessage("START_SESSION_REJ") + waitForMessage("ALPH_START_SESSION_RES").then(() => true), + waitForMessage("ALPH_START_SESSION_REJ") .then(() => false) .catch(() => false), ]) @@ -29,17 +29,17 @@ export const startSession = async (password: string): Promise => { } export const stopSession = () => { - sendMessage({ type: "STOP_SESSION" }) + sendMessage({ type: "ALPH_STOP_SESSION" }) } export const checkPassword = async (password: string): Promise => { const body = await encryptForBackground(password) - sendMessage({ type: "CHECK_PASSWORD", data: { body } }) + sendMessage({ type: "ALPH_CHECK_PASSWORD", data: { body } }) return await Promise.race([ - waitForMessage("CHECK_PASSWORD_RES").then(() => true), - waitForMessage("CHECK_PASSWORD_REJ") + waitForMessage("ALPH_CHECK_PASSWORD_RES").then(() => true), + waitForMessage("ALPH_CHECK_PASSWORD_REJ") .then(() => false) .catch(() => false), ]) diff --git a/packages/extension/src/ui/services/backgroundTransactions.ts b/packages/extension/src/ui/services/backgroundTransactions.ts index cf39709e..963bc5ce 100644 --- a/packages/extension/src/ui/services/backgroundTransactions.ts +++ b/packages/extension/src/ui/services/backgroundTransactions.ts @@ -65,7 +65,7 @@ export const getDeployContractEstimatedFee = async ( // for debugging purposes try { ; (window as any).downloadBackup = () => { - sendMessage({ type: "DOWNLOAD_BACKUP_FILE" }) + sendMessage({ type: "ALPH_DOWNLOAD_BACKUP_FILE" }) } } catch { // ignore diff --git a/packages/stack-router/package.json b/packages/stack-router/package.json index fdd3fd28..52b64102 100644 --- a/packages/stack-router/package.json +++ b/packages/stack-router/package.json @@ -1,6 +1,6 @@ { "name": "@argent/stack-router", - "version": "0.8.16", + "version": "0.8.17", "license": "MIT", "private": true, "files": [ diff --git a/packages/storybook/package.json b/packages/storybook/package.json index f0e55d37..f4b9b0fa 100644 --- a/packages/storybook/package.json +++ b/packages/storybook/package.json @@ -1,6 +1,6 @@ { "name": "@argent-x/storybook", - "version": "0.8.16", + "version": "0.8.17", "private": true, "devDependencies": { "@alephium/extension": "^0.8.1", diff --git a/packages/ui/package.json b/packages/ui/package.json index 5286da80..42f0758f 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "@argent/ui", - "version": "0.8.16", + "version": "0.8.17", "license": "MIT", "private": true, "files": [