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,82 +65,78 @@
|
|||||||
></ion-toast>
|
></ion-toast>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
||||||
<ion-modal
|
<ion-modal :is-open="accountsModal">
|
||||||
:is-open="accountsModal"
|
<ion-header>
|
||||||
>
|
<ion-toolbar>
|
||||||
<ion-header>
|
<ion-buttons slot="start">
|
||||||
<ion-toolbar>
|
<ion-button @click="accountsModal = false">Close</ion-button>
|
||||||
<ion-buttons slot="start">
|
</ion-buttons>
|
||||||
<ion-button @click="accountsModal=false">Close</ion-button>
|
<ion-title>Select</ion-title>
|
||||||
</ion-buttons>
|
</ion-toolbar>
|
||||||
<ion-title>Select</ion-title>
|
</ion-header>
|
||||||
</ion-toolbar>
|
<ion-content class="ion-padding">
|
||||||
</ion-header>
|
<ion-list style="margin-bottom: 4rem">
|
||||||
<ion-content class="ion-padding">
|
<ion-radio-group :value="selectedAccount?.address ?? ''">
|
||||||
<ion-list style="margin-bottom: 4rem">
|
<ion-list-header>
|
||||||
<ion-radio-group :value="selectedAccount?.address ?? ''">
|
<ion-label>Accounts</ion-label>
|
||||||
<ion-list-header>
|
</ion-list-header>
|
||||||
<ion-label>Accounts</ion-label>
|
|
||||||
</ion-list-header>
|
|
||||||
|
|
||||||
<ion-list
|
<ion-list
|
||||||
@click="changeSelectedAccount(account.address)"
|
@click="changeSelectedAccount(account.address)"
|
||||||
class="ion-padding"
|
class="ion-padding"
|
||||||
v-for="account of accounts"
|
v-for="account of accounts"
|
||||||
:key="account.address"
|
:key="account.address"
|
||||||
button
|
button
|
||||||
>
|
>
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-radio slot="start" :value="account.address" />
|
<ion-radio slot="start" :value="account.address" />
|
||||||
<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-radio-group>
|
|
||||||
</ion-list>
|
</ion-list>
|
||||||
</ion-content>
|
</ion-radio-group>
|
||||||
</ion-modal>
|
</ion-list>
|
||||||
<ion-modal
|
</ion-content>
|
||||||
:is-open="networksModal"
|
</ion-modal>
|
||||||
>
|
<ion-modal :is-open="networksModal">
|
||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar>
|
<ion-toolbar>
|
||||||
<ion-buttons slot="start">
|
<ion-buttons slot="start">
|
||||||
<ion-button @click="networksModal=false">Close</ion-button>
|
<ion-button @click="networksModal = false">Close</ion-button>
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>Select</ion-title>
|
<ion-title>Select</ion-title>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content class="ion-padding">
|
<ion-content class="ion-padding">
|
||||||
<ion-list style="margin-bottom: 4rem">
|
<ion-list style="margin-bottom: 4rem">
|
||||||
<ion-radio-group :value="selectedNetwork.chainId">
|
<ion-radio-group :value="selectedNetwork.chainId">
|
||||||
<ion-list-header>
|
<ion-list-header>
|
||||||
<ion-label>Networks</ion-label>
|
<ion-label>Networks</ion-label>
|
||||||
</ion-list-header>
|
</ion-list-header>
|
||||||
|
|
||||||
<ion-list
|
<ion-list
|
||||||
class="ion-padding"
|
class="ion-padding"
|
||||||
v-for="network of networks"
|
v-for="network of networks"
|
||||||
:key="network.chainId"
|
:key="network.chainId"
|
||||||
>
|
>
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-radio
|
<ion-radio
|
||||||
@click="changeSelectedNetwork(network.chainId)"
|
@click="changeSelectedNetwork(network.chainId)"
|
||||||
slot="start"
|
slot="start"
|
||||||
:value="network.chainId"
|
:value="network.chainId"
|
||||||
/>
|
/>
|
||||||
<ion-label>{{ network.name }}</ion-label>
|
<ion-label>{{ network.name }}</ion-label>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-text>{{ network.rpc }}</ion-text>
|
<ion-text>{{ network.rpc }}</ion-text>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</ion-list>
|
|
||||||
</ion-radio-group>
|
|
||||||
</ion-list>
|
</ion-list>
|
||||||
</ion-content>
|
</ion-radio-group>
|
||||||
</ion-modal>
|
</ion-list>
|
||||||
|
</ion-content>
|
||||||
|
</ion-modal>
|
||||||
</ion-page>
|
</ion-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -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