mirror of
https://github.com/andrei0x309/clear-wallet.git
synced 2024-11-18 23:41:10 +00:00
remove: tabs permission, add view address on explorer button
This commit is contained in:
parent
03ac75bc11
commit
2642659ae0
@ -23,7 +23,6 @@
|
|||||||
"minimum_chrome_version": "93",
|
"minimum_chrome_version": "93",
|
||||||
|
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"tabs",
|
|
||||||
"notifications",
|
"notifications",
|
||||||
"storage",
|
"storage",
|
||||||
"alarms",
|
"alarms",
|
||||||
|
@ -37,6 +37,17 @@
|
|||||||
<ion-label>Selected Network ID: {{ selectedNetwork?.chainId }}</ion-label>
|
<ion-label>Selected Network ID: {{ selectedNetwork?.chainId }}</ion-label>
|
||||||
<ion-button @click="networksModal = true">Select</ion-button>
|
<ion-button @click="networksModal = true">Select</ion-button>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
<ion-item v-if="!loading && selectedNetwork?.explorer && selectedAccount?.address">
|
||||||
|
<ion-button
|
||||||
|
@click="
|
||||||
|
openTab(
|
||||||
|
`${selectedNetwork.explorer}/${selectedAccount?.address}`.replace('//', '/')
|
||||||
|
)
|
||||||
|
"
|
||||||
|
expand="block"
|
||||||
|
>View Address on {{ selectedNetwork.explorer }}
|
||||||
|
</ion-button>
|
||||||
|
</ion-item>
|
||||||
|
|
||||||
<ion-loading
|
<ion-loading
|
||||||
:is-open="loading"
|
:is-open="loading"
|
||||||
@ -54,9 +65,7 @@
|
|||||||
></ion-toast>
|
></ion-toast>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
||||||
<ion-modal
|
<ion-modal :is-open="accountsModal">
|
||||||
:is-open="accountsModal"
|
|
||||||
>
|
|
||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar>
|
<ion-toolbar>
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
@ -84,16 +93,14 @@
|
|||||||
<ion-label>{{ account.name }}</ion-label>
|
<ion-label>{{ account.name }}</ion-label>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-text style="font-size:0.8rem;">{{ account.address }}</ion-text>
|
<ion-text style="font-size: 0.8rem">{{ account.address }}</ion-text>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</ion-list>
|
</ion-list>
|
||||||
</ion-radio-group>
|
</ion-radio-group>
|
||||||
</ion-list>
|
</ion-list>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
</ion-modal>
|
</ion-modal>
|
||||||
<ion-modal
|
<ion-modal :is-open="networksModal">
|
||||||
:is-open="networksModal"
|
|
||||||
>
|
|
||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar>
|
<ion-toolbar>
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
@ -168,12 +175,13 @@ import {
|
|||||||
replaceNetworks,
|
replaceNetworks,
|
||||||
getUrl,
|
getUrl,
|
||||||
saveSelectedNetwork,
|
saveSelectedNetwork,
|
||||||
numToHexStr
|
numToHexStr,
|
||||||
|
openTab,
|
||||||
} from "@/utils/platform";
|
} from "@/utils/platform";
|
||||||
import type { Network, Account, Networks } from "@/extension/types";
|
import type { Network, Account, Networks } from "@/extension/types";
|
||||||
import { mainNets } from "@/utils/networks";
|
import { mainNets } from "@/utils/networks";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
import { triggerListner } from '@/extension/listners'
|
import { triggerListner } from "@/extension/listners";
|
||||||
|
|
||||||
import { copyOutline } from "ionicons/icons";
|
import { copyOutline } from "ionicons/icons";
|
||||||
|
|
||||||
@ -243,19 +251,21 @@ export default defineComponent({
|
|||||||
router.push("/tabs/add-network");
|
router.push("/tabs/add-network");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const changeSelectedAccount = async (address: string) => {
|
const changeSelectedAccount = async (address: string) => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const findIndex = accounts.value.findIndex(a => a.address == address)
|
const findIndex = accounts.value.findIndex((a) => a.address == address);
|
||||||
if (findIndex > -1) {
|
if (findIndex > -1) {
|
||||||
selectedAccount.value = accounts.value[findIndex]
|
selectedAccount.value = accounts.value[findIndex];
|
||||||
await saveSelectedAccount(selectedAccount.value)
|
await saveSelectedAccount(selectedAccount.value);
|
||||||
// console.log(({ [address]: accounts.value[address], ...accounts.value}))
|
// console.log(({ [address]: accounts.value[address], ...accounts.value}))
|
||||||
accounts.value.splice(findIndex, 1);
|
accounts.value.splice(findIndex, 1);
|
||||||
accounts.value.splice(0,0,selectedAccount.value)
|
accounts.value.splice(0, 0, selectedAccount.value);
|
||||||
const newAccounts = [...accounts.value]
|
const newAccounts = [...accounts.value];
|
||||||
await replaceAccounts(newAccounts)
|
await replaceAccounts(newAccounts);
|
||||||
triggerListner('accountsChanged', newAccounts.map(a => a.address))
|
triggerListner(
|
||||||
|
"accountsChanged",
|
||||||
|
newAccounts.map((a) => a.address)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
accountsModal.value = false;
|
accountsModal.value = false;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
@ -269,7 +279,7 @@ export default defineComponent({
|
|||||||
Object.assign({ [chainId]: networks.value[chainId] }, networks.value)
|
Object.assign({ [chainId]: networks.value[chainId] }, networks.value)
|
||||||
);
|
);
|
||||||
selectedNetwork.value = networks.value[chainId];
|
selectedNetwork.value = networks.value[chainId];
|
||||||
triggerListner('chainChanged', numToHexStr(chainId))
|
triggerListner("chainChanged", numToHexStr(chainId));
|
||||||
}
|
}
|
||||||
networksModal.value = false;
|
networksModal.value = false;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
@ -293,6 +303,7 @@ export default defineComponent({
|
|||||||
networksModal,
|
networksModal,
|
||||||
mainNets,
|
mainNets,
|
||||||
getUrl,
|
getUrl,
|
||||||
|
openTab,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user