diff --git a/CHANGELOG.md b/CHANGELOG.md index 4743bee..b1da692 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## Manifest Version 1.3.5 + +- added copy button to chainId for easier development +- added settings to be able to transfrom address to lower case when copying +- added a check in get recepit to return null if hash is missing +- added version display to wallet first page + ## Manifest Version 1.3.4 - bump fake Metamask version signature to 11.0.0 diff --git a/src/extension/manifest.json b/src/extension/manifest.json index fbe0e80..51aa604 100644 --- a/src/extension/manifest.json +++ b/src/extension/manifest.json @@ -3,8 +3,8 @@ "name": "__MSG_appName__", "description": "__MSG_appDesc__", "default_locale": "en", - "version": "1.3.4", - "version_name": "1.3.4", + "version": "1.3.5", + "version_name": "1.3.5", "icons": { "16": "assets/extension-icon/wallet_16.png", "32": "assets/extension-icon/wallet_32.png", diff --git a/src/extension/types.ts b/src/extension/types.ts index aeffe07..3198ec2 100644 --- a/src/extension/types.ts +++ b/src/extension/types.ts @@ -57,6 +57,7 @@ export interface Settings { theme: 'system' | 'light' | 'dark' lastLock: number lockOutBlocked: boolean + copyLowerCaseAddress?: boolean } export type listnerType = 'accountsChanged' | 'connect' | 'disconnect' | 'chainChanged' diff --git a/src/utils/platform.ts b/src/utils/platform.ts index 407b9a4..411ea29 100644 --- a/src/utils/platform.ts +++ b/src/utils/platform.ts @@ -1,6 +1,8 @@ import type { Network, Account, Prices, Settings, Networks, HistoryItem, ContractActions, ContractAction, Contact } from '@/extension/types' import type { Ref } from 'vue' +const pottentialMissingSettings = ['copyLowerCaseAddress'] + const defaultSettings = { enableStorageEnctyption: false, encryptAfterEveryTx: false, @@ -8,7 +10,8 @@ const defaultSettings = { lockOutPeriod: 2, lockOutBlocked: false, theme: 'system', - lastLock: Date.now() + lastLock: Date.now(), + copyLowerCaseAddress: false } const defaultAbis = {} as { @@ -118,7 +121,13 @@ export const wipeHistory = async (): Promise => { } export const getSettings = async (): Promise => { - return (await storageGet('settings'))?.settings ?? defaultSettings as unknown as Settings + const settings = (await storageGet('settings'))?.settings ?? defaultSettings as unknown as Settings + pottentialMissingSettings.forEach( (s: string) => { + if(settings[s] === undefined) { + settings[s as keyof Settings] = defaultSettings[s as keyof Settings] + } + }) + return settings } export const setSettings = async (settings: Settings): Promise => { @@ -264,7 +273,7 @@ export const strToHex = (str: string) => `0x${str.split('').map( s => s.charCod export const numToHexStr = (num: number | bigint) => `0x${num.toString(16)}` -export const copyAddress = async (address: string, toastRef: Ref) => { +export const copyText = async (address: string, toastRef: Ref) => { await navigator.clipboard.writeText(address) toastRef.value = true } @@ -305,3 +314,5 @@ export const openTab = (url: string) => { url }); } + +export const getVersion = () => chrome?.runtime?.getManifest()?.version ?? '' diff --git a/src/utils/wallet.ts b/src/utils/wallet.ts index 5064f8a..342a9fe 100644 --- a/src/utils/wallet.ts +++ b/src/utils/wallet.ts @@ -108,6 +108,7 @@ export const getTxByHash = async (hash: string) => { export const getTxReceipt = async (hash: string) => { try { + if (!hash) return null const network = await getSelectedNetwork() const provider = new ethers.JsonRpcProvider(network.rpc) const receipt = await provider.getTransactionReceipt(hash) diff --git a/src/views/AccountsTab.vue b/src/views/AccountsTab.vue index caa1c1f..9078658 100644 --- a/src/views/AccountsTab.vue +++ b/src/views/AccountsTab.vue @@ -31,7 +31,7 @@ {{ account.name }} - +

{{ account.address }}

@@ -52,7 +52,7 @@ - + PK Assests for Account: {{ selectedAccount?.name }} - +

{{ selectedAccount?.address }}

@@ -184,7 +184,7 @@ import { IonLoading, IonIcon, } from "@ionic/vue"; -import { getSelectedAccount, copyAddress, getUrl } from "@/utils/platform"; +import { getSelectedAccount, copyText, getUrl } from "@/utils/platform"; import type { Account } from "@/extension/types"; import { copyOutline } from "ionicons/icons"; @@ -564,7 +564,7 @@ export default defineComponent({ isError, noAssets, getToastRef, - copyAddress, + copyText, copyOutline, ethTokens, polyTokens, diff --git a/src/views/HistoryTab.vue b/src/views/HistoryTab.vue index 1e7d5b6..4fa5356 100644 --- a/src/views/HistoryTab.vue +++ b/src/views/HistoryTab.vue @@ -21,7 +21,7 @@ >Date: {{ new Date(item.date).toDateString() }}
- +

CL Wallet + Version: {{ version }} @@ -32,7 +45,17 @@ >Select - +

{{ selectedAccount?.address }}

@@ -49,6 +72,7 @@ ) " expand="block" + style="margin: auto; width: 98%; font-size: 0.8rem; padding: 0.6rem" >View Address on {{ `${selectedNetwork.explorer}`.replace("https://", "").replace("http://", "") @@ -71,11 +95,15 @@ /> Selected Network ID: {{ selectedNetwork?.chainId - }} + }} + + ; const selectedNetwork = (ref(null) as unknown) as Ref; const toastState = ref(false); + const settings = ref({}) as Ref>>; const getToastRef = () => toastState; @@ -292,15 +325,21 @@ export default defineComponent({ const pNetworks = getNetworks(); const pSelectedAccount = getSelectedAccount(); const pSelectedNetwork = getSelectedNetwork(); - Promise.all([pAccounts, pNetworks, pSelectedAccount, pSelectedNetwork]).then( - (res) => { - accounts.value = res[0]; - networks.value = res[1]; - selectedAccount.value = res[2]; - selectedNetwork.value = res[3]; - loading.value = false; - } - ); + const pSettings = getSettings(); + Promise.all([ + pAccounts, + pNetworks, + pSelectedAccount, + pSelectedNetwork, + pSettings, + ]).then((res) => { + accounts.value = res[0]; + networks.value = res[1]; + selectedAccount.value = res[2]; + selectedNetwork.value = res[3]; + settings.value = res[4]; + loading.value = false; + }); }; onIonViewWillEnter(() => { @@ -361,7 +400,7 @@ export default defineComponent({ selectedNetwork, changeSelectedAccount, changeSelectedNetwork, - copyAddress, + copyText, copyOutline, toastState, getToastRef, @@ -369,6 +408,8 @@ export default defineComponent({ mainNets, getUrl, openTab, + settings, + version, }; }, }); diff --git a/src/views/NetworksTab.vue b/src/views/NetworksTab.vue index 4b334fd..04808d9 100644 --- a/src/views/NetworksTab.vue +++ b/src/views/NetworksTab.vue @@ -4,11 +4,11 @@ - - - - - + + + + + Networks @@ -19,30 +19,34 @@ Add Network
- - - - - - - {{ network.name }} - - - ID: {{ network.chainId }} - - + - Edit - Delete + + + + + {{ network.name }} + + ID: {{ network.chainId }} - + + Edit + Delete + +
diff --git a/src/views/SettingsTab.vue b/src/views/SettingsTab.vue index d334a6b..109633f 100644 --- a/src/views/SettingsTab.vue +++ b/src/views/SettingsTab.vue @@ -89,7 +89,7 @@ - Theme + Theme & Misc
@@ -107,6 +107,18 @@ Light + + Convert Address to lowercase on copy + +
@@ -408,6 +420,12 @@ export default defineComponent({ defaultAccordionOpen.value = "1"; }; + const changeCopyLowerCaseAddress = async () => { + settings.s.copyLowerCaseAddress = !settings.s?.copyLowerCaseAddress; + await saveSettings(); + defaultAccordionOpen.value = "2"; + }; + const changeTheme = async (theme: "system" | "light" | "dark") => { document.body.classList.remove(radioTheme.value); document.body.classList.add(theme); @@ -697,6 +715,7 @@ export default defineComponent({ openTab, radioTheme, changePermaLock, + changeCopyLowerCaseAddress, }; }, });