chore: changes for 1.4.6

This commit is contained in:
Andrei O 2024-09-28 05:50:12 +03:00
parent 004fdcec64
commit 72656ded1e
No known key found for this signature in database
GPG Key ID: B961E5B68389457E
9 changed files with 231 additions and 23 deletions

View File

@ -1,5 +1,12 @@
# Changelog # Changelog
## Manifest Version 1.4.6
- added support for 24 words seed phrases besides 12 words
- added templete for Degen network with assets
- added search when selectiing accounts and networks
- added small memory cache layer to help with websites that spam the wallet with requests
## Manifest Version 1.4.5 ## Manifest Version 1.4.5
- improved gas estimation for transactions - improved gas estimation for transactions

Binary file not shown.

After

Width:  |  Height:  |  Size: 638 B

View File

@ -24,6 +24,9 @@ function loadEIP1193Provider(provider: any) {
function announceProvider() { function announceProvider() {
const info: EIP6963ProviderInfo = ProviderInfo const info: EIP6963ProviderInfo = ProviderInfo
if(!provider.accounts) {
return
}
window.dispatchEvent( window.dispatchEvent(
new CustomEvent("eip6963:announceProvider", { new CustomEvent("eip6963:announceProvider", {
detail: Object.freeze({ info, provider }), detail: Object.freeze({ info, provider }),
@ -40,6 +43,7 @@ function loadEIP1193Provider(provider: any) {
); );
announceProvider(); announceProvider();
console.info('EIP-1193 Provider loaded')
} }
const listners = { const listners = {
@ -119,7 +123,8 @@ const sendMessage = (args: RequestArguments, ping = false, from = 'request'): Pr
class MetaMaskAPI { class MetaMaskAPI {
isMetaMask = true isMetaMask = true
isClWallet = true isClWallet = true
_state = {accounts: Array(1), isConnected: true, isUnlocked: true, initialized: true, isPermanentlyDisconnected: false} accounts = []
_state = {accounts: [], isConnected: false, isUnlocked: true, initialized: true, isPermanentlyDisconnected: false}
_sentWarnings = {enable: false, experimentalMethods: false, send: false, events: {}} _sentWarnings = {enable: false, experimentalMethods: false, send: false, events: {}}
// Deprecated - hardcoded for now, websites should not access this directly since is deprecated for a long time // Deprecated - hardcoded for now, websites should not access this directly since is deprecated for a long time
chainId = "0x89" chainId = "0x89"
@ -145,7 +150,7 @@ class MetaMaskAPI {
_events: {}, _eventsCount: 0, _maxListeners: undefined, _middleware: Array(4) _events: {}, _eventsCount: 0, _maxListeners: undefined, _middleware: Array(4)
} }
isConnected() { isConnected() {
return true return false
} }
// for maximum compatibility since is cloning the same API // for maximum compatibility since is cloning the same API
@ -374,12 +379,15 @@ const listner = function(event: any) {
(<any>eth).chainId = eventDataDataData?.chainId ?? '0x89'; (<any>eth).chainId = eventDataDataData?.chainId ?? '0x89';
(<any>eth).selectedAddress = eventDataData?.address?.[0] ?? null; (<any>eth).selectedAddress = eventDataData?.address?.[0] ?? null;
(<any>eth).accounts = eventDataData.address?.[0] ? [eventDataData.address?.[0]] : []; (<any>eth).accounts = eventDataData.address?.[0] ? [eventDataData.address?.[0]] : [];
(<any>eth)._state.accounts = (<any>eth).accounts;
(<any>eth).isConnected = () => true; (<any>eth).isConnected = () => true;
loadEIP1193Provider(eth)
} else if( listnerName === 'chainChanged' ) { } else if( listnerName === 'chainChanged' ) {
(<any>eth).networkVersion = String(parseInt(eventDataDataData ?? "0x89", 16)); (<any>eth).networkVersion = String(parseInt(eventDataDataData ?? "0x89", 16));
(<any>eth).chainId = eventDataData ?? '0x89'; (<any>eth).chainId = eventDataData ?? '0x89';
} else if ( listnerName === 'accountsChanged' ) { } else if ( listnerName === 'accountsChanged' ) {
(<any>eth).accounts = eventDataData?.[0] ? [eventDataData?.[0]] : []; (<any>eth).accounts = eventDataData?.[0] ? [eventDataData?.[0]] : [];
(<any>eth)._state.accounts = (<any>eth).accounts;
(<any>eth).selectedAddress = eventDataData?.[0] ?? ''; (<any>eth).selectedAddress = eventDataData?.[0] ?? '';
} }
listners[listnerName].forEach(listner => listner(eventDataDataData)); listners[listnerName].forEach(listner => listner(eventDataDataData));
@ -433,8 +441,7 @@ sendMessage({
} }
injectWallet(); injectWallet();
loadEIP1193Provider(eth) loadEIP1193Provider(eth);
// HELPERS TO CLONE METAMASK API // HELPERS TO CLONE METAMASK API

View File

@ -3,8 +3,8 @@
"name": "__MSG_appName__", "name": "__MSG_appName__",
"description": "__MSG_appDesc__", "description": "__MSG_appDesc__",
"default_locale": "en", "default_locale": "en",
"version": "1.4.5", "version": "1.4.6",
"version_name": "1.4.5", "version_name": "1.4.6",
"icons": { "icons": {
"16": "assets/extension-icon/wallet_16.png", "16": "assets/extension-icon/wallet_16.png",
"32": "assets/extension-icon/wallet_32.png", "32": "assets/extension-icon/wallet_32.png",

View File

@ -39,12 +39,14 @@ import type { RequestArguments } from '@/extension/types'
import { rpcError } from '@/extension/rpcConstants' import { rpcError } from '@/extension/rpcConstants'
import { updatePrices } from '@/utils/gecko' import { updatePrices } from '@/utils/gecko'
import { allTemplateNets } from '@/utils/networks' import { allTemplateNets } from '@/utils/networks'
import { cyrb64Hash } from '@/utils/misc'
// const METAMAKS_EXTENSION_ID = 'nkbihfbeogaeaoehlefnkodbefgpgknn' // const METAMAKS_EXTENSION_ID = 'nkbihfbeogaeaoehlefnkodbefgpgknn'
let notificationUrl: string let notificationUrl: string
const chainIdThrottle: { [key: string]: number } = {} const chainIdThrottle: { [key: string]: number } = {}
const cache = new Map<string, { [key: string]: any }>()
const reInjectContentScripts = async () => { const reInjectContentScripts = async () => {
const cts = chrome.runtime.getManifest().content_scripts ?? [] const cts = chrome.runtime.getManifest().content_scripts ?? []
@ -223,7 +225,15 @@ const mainListner = (message: RequestArguments, sender: any, sendResponse: (a: a
switch (message.method) { switch (message.method) {
case 'eth_call': { case 'eth_call': {
try { try {
sendResponse(await evmCall(message?.params ?? [])) const hash = cyrb64Hash('eth_call' + JSON.stringify(message?.params))
const cacheItem = cache.get(hash)
if (cacheItem && cacheItem?.time > Date.now() - 5e3) {
sendResponse(cacheItem?.data);
break
}
const resp = await evmCall(message?.params ?? [])
sendResponse(resp)
cache.set(hash, { time: Date.now(), data: resp })
} catch (e) { } catch (e) {
sendResponse({ sendResponse({
error: true, error: true,
@ -236,6 +246,14 @@ const mainListner = (message: RequestArguments, sender: any, sendResponse: (a: a
} }
case 'eth_getBlockByNumber': { case 'eth_getBlockByNumber': {
try { try {
const hash = cyrb64Hash('eth_call' + JSON.stringify(message?.params))
const cacheItem = cache.get(hash)
if (cacheItem && cacheItem?.time > Date.now() - 5e3) {
sendResponse(cacheItem?.data);
break
}
const params = message?.params?.[0] as any const params = message?.params?.[0] as any
const block = await getBlockByNumber(params) as any const block = await getBlockByNumber(params) as any
const newBlock = { ...block } const newBlock = { ...block }
@ -245,6 +263,9 @@ const mainListner = (message: RequestArguments, sender: any, sendResponse: (a: a
newBlock._difficulty = numToHexStr(block.difficulty) newBlock._difficulty = numToHexStr(block.difficulty)
newBlock.difficulty = block._difficulty newBlock.difficulty = block._difficulty
sendResponse(newBlock) sendResponse(newBlock)
cache.set(hash, { time: Date.now(), data: newBlock })
} catch (e) { } catch (e) {
sendResponse({ sendResponse({
error: true, error: true,
@ -258,9 +279,25 @@ const mainListner = (message: RequestArguments, sender: any, sendResponse: (a: a
case 'eth_getTransactionCount': { case 'eth_getTransactionCount': {
try { try {
if (message?.params?.[1]) { if (message?.params?.[1]) {
sendResponse(numToHexStr(Number(await getTxCount(message?.params?.[0] as string, message?.params?.[1] as string)))) const hash = cyrb64Hash('eth_getTransactionCount' + JSON.stringify(message?.params))
const cacheItem = cache.get(hash)
if (cacheItem && cacheItem?.time > Date.now() - 5e3) {
sendResponse(cacheItem?.data);
break
}
const resp = numToHexStr(Number(await getTxCount(message?.params?.[0] as string, message?.params?.[1] as string)))
sendResponse(resp)
cache.set(hash, { time: Date.now(), data: resp })
} else { } else {
sendResponse(numToHexStr(Number(await getTxCount(message?.params?.[0] as string)))) const hash = cyrb64Hash('eth_getTransactionCount' + JSON.stringify(message?.params))
const cacheItem = cache.get(hash)
if (cacheItem && cacheItem?.time > Date.now() - 5e3) {
sendResponse(cacheItem?.data);
break
}
const resp = numToHexStr(Number(await getTxCount(message?.params?.[0] as string)))
sendResponse(resp)
cache.set(hash, { time: Date.now(), data: resp })
} }
} catch (e) { } catch (e) {
sendResponse({ sendResponse({
@ -274,7 +311,15 @@ const mainListner = (message: RequestArguments, sender: any, sendResponse: (a: a
} }
case 'eth_getTransactionByHash': { case 'eth_getTransactionByHash': {
try { try {
sendResponse(await getTxByHash(message?.params?.[0] as string)) const hash = cyrb64Hash('eth_getTransactionByHash' + JSON.stringify(message?.params))
const cacheItem = cache.get(hash)
if (cacheItem && cacheItem?.time > Date.now() - 5e3) {
sendResponse(cacheItem?.data);
break
}
const resp = await getTxByHash(message?.params?.[0] as string)
sendResponse(resp)
cache.set(hash, { time: Date.now(), data: resp })
} catch (e) { } catch (e) {
sendResponse({ sendResponse({
error: true, error: true,
@ -287,7 +332,15 @@ const mainListner = (message: RequestArguments, sender: any, sendResponse: (a: a
} }
case 'eth_getTransactionReceipt': { case 'eth_getTransactionReceipt': {
try { try {
sendResponse(await getTxReceipt(message?.params?.[0] as string)) const hash = cyrb64Hash('eth_getTransactionByHash' + JSON.stringify(message?.params))
const cacheItem = cache.get(hash)
if (cacheItem && cacheItem?.time > Date.now() - 5e3) {
sendResponse(cacheItem?.data);
break
}
const resp = await getTxReceipt(message?.params?.[0] as string)
sendResponse(resp)
cache.set(hash, { time: Date.now(), data: resp })
} catch (e) { } catch (e) {
sendResponse({ sendResponse({
error: true, error: true,
@ -300,7 +353,15 @@ const mainListner = (message: RequestArguments, sender: any, sendResponse: (a: a
} }
case 'eth_gasPrice': { case 'eth_gasPrice': {
try { try {
sendResponse(numToHexStr(BigInt(Math.trunc((await getGasPrice()).price * 1e9)))) const hash = cyrb64Hash('eth_gasPrice' + JSON.stringify(message?.params))
const cacheItem = cache.get(hash)
if (cacheItem && cacheItem?.time > Date.now() - 5e3) {
sendResponse(cacheItem?.data);
break
}
const resp = numToHexStr(BigInt(Math.trunc((await getGasPrice()).price * 1e9)))
sendResponse(resp)
cache.set(hash, { time: Date.now(), data: resp })
} catch (e) { } catch (e) {
sendResponse({ sendResponse({
error: true, error: true,
@ -313,9 +374,16 @@ const mainListner = (message: RequestArguments, sender: any, sendResponse: (a: a
} }
case 'eth_getBalance': { case 'eth_getBalance': {
try { try {
const hash = cyrb64Hash('eth_getBalance' + JSON.stringify(message?.params))
const cacheItem = cache.get(hash)
if (cacheItem && cacheItem?.time > Date.now() - 5e3) {
sendResponse(cacheItem?.data);
break
}
const balance = await getBalance() const balance = await getBalance()
const balanceHex = numToHexStr(balance ?? 0n) const balanceHex = numToHexStr(balance ?? 0n)
sendResponse(balanceHex) sendResponse(balanceHex)
cache.set(hash, { time: Date.now(), data: balanceHex })
} catch (e) { } catch (e) {
sendResponse({ sendResponse({
error: true, error: true,
@ -328,7 +396,15 @@ const mainListner = (message: RequestArguments, sender: any, sendResponse: (a: a
} }
case 'eth_getCode': { case 'eth_getCode': {
try { try {
sendResponse(await getCode(message?.params?.[0] as string)) const hash = cyrb64Hash('eth_getCode' + JSON.stringify(message?.params))
const cacheItem = cache.get(hash)
if (cacheItem && cacheItem?.time > Date.now() - 5e3) {
sendResponse(cacheItem?.data);
break
}
const resp = await getCode(message?.params?.[0] as string)
sendResponse(resp)
cache.set(hash, { time: Date.now(), data: resp })
} catch (e) { } catch (e) {
sendResponse({ sendResponse({
error: true, error: true,
@ -341,7 +417,15 @@ const mainListner = (message: RequestArguments, sender: any, sendResponse: (a: a
} }
case 'eth_blockNumber': { case 'eth_blockNumber': {
try { try {
sendResponse(numToHexStr(await getBlockNumber())) const hash = cyrb64Hash('eth_blockNumber' + JSON.stringify(message?.params))
const cacheItem = cache.get(hash)
if (cacheItem && cacheItem?.time > Date.now() - 5e3) {
sendResponse(cacheItem?.data);
break
}
const resp = numToHexStr(await getBlockNumber())
sendResponse(resp)
cache.set(hash, { time: Date.now(), data: resp })
} catch (e) { } catch (e) {
sendResponse({ sendResponse({
error: true, error: true,
@ -363,14 +447,22 @@ const mainListner = (message: RequestArguments, sender: any, sendResponse: (a: a
}) })
break break
} }
const hash = cyrb64Hash('eth_estimateGas' + JSON.stringify(message?.params))
const cacheItem = cache.get(hash)
if (cacheItem && cacheItem?.time > Date.now() - 3e3) {
sendResponse(cacheItem?.data);
break
}
const gas = await estimateGas({ const gas = await estimateGas({
to: params?.to ?? '', to: params?.to ?? '',
from: params?.from ?? '', from: params?.from ?? '',
data: params?.data ?? '', data: params?.data ?? '',
value: params?.value ?? '0x0' value: params?.value ?? '0x0'
}) })
const gasHex = numToHexStr(gas ?? 0n) const gasHex = numToHexStr(gas ?? 0n)
sendResponse(gasHex) sendResponse(gasHex)
cache.set(hash, { time: Date.now(), data: gasHex })
} catch (err) { } catch (err) {
if (String(err).includes('UNPREDICTABLE_GAS_LIMIT')) { if (String(err).includes('UNPREDICTABLE_GAS_LIMIT')) {
chrome.notifications.create({ chrome.notifications.create({
@ -398,7 +490,15 @@ const mainListner = (message: RequestArguments, sender: any, sendResponse: (a: a
case 'eth_requestAccounts': case 'eth_requestAccounts':
case 'eth_accounts': { case 'eth_accounts': {
try { try {
sendResponse(await getSelectedAddress()) const hash = cyrb64Hash('eth_accounts' + JSON.stringify(message?.params))
const cacheItem = cache.get(hash)
if (cacheItem && cacheItem?.time > Date.now() - 3e3) {
sendResponse(cacheItem?.data);
break
}
const resp = await getSelectedAddress()
sendResponse(resp)
cache.set(hash, { time: Date.now(), data: resp })
} catch (e) { } catch (e) {
sendResponse({ sendResponse({
error: true, error: true,
@ -413,12 +513,20 @@ const mainListner = (message: RequestArguments, sender: any, sendResponse: (a: a
case 'net_version': case 'net_version':
{ {
try { try {
const hash = cyrb64Hash('eth_chainId' + JSON.stringify(message?.params))
const cacheItem = cache.get(hash)
if (cacheItem && cacheItem?.time > Date.now() - 5e3) {
sendResponse(cacheItem?.data);
break
}
const isNetVersion = message.method === 'net_version' const isNetVersion = message.method === 'net_version'
const urlKey = await chainIdThrottleFn(message?.website ?? '') const urlKey = await chainIdThrottleFn(message?.website ?? '')
const network = await getSelectedNetwork() const network = await getSelectedNetwork()
const chainId = network?.chainId ?? 1 const chainId = network?.chainId ?? 1
sendResponse(isNetVersion ? chainId.toString() : `0x${chainId.toString(16)}`) const resp = isNetVersion ? chainId.toString() : `0x${chainId.toString(16)}`
sendResponse(resp)
chainIdThrottle[urlKey] -= 1 chainIdThrottle[urlKey] -= 1
cache.set(hash, { time: Date.now(), data: resp })
} catch (e) { } catch (e) {
sendResponse({ sendResponse({
error: true, error: true,
@ -515,7 +623,7 @@ const mainListner = (message: RequestArguments, sender: any, sendResponse: (a: a
const settings = await getSettings() const settings = await getSettings()
if (settings.encryptAfterEveryTx) { if (settings.encryptAfterEveryTx) {
clearPk() await clearPk()
} }
} catch (err) { } catch (err) {
@ -603,7 +711,7 @@ const mainListner = (message: RequestArguments, sender: any, sendResponse: (a: a
) )
const settings = await getSettings() const settings = await getSettings()
if (settings.encryptAfterEveryTx) { if (settings.encryptAfterEveryTx) {
clearPk() await clearPk()
} }
} catch (e) { } catch (e) {
console.warn('Error: signTypedData', e) console.warn('Error: signTypedData', e)

View File

@ -10,4 +10,23 @@ export const exportFile = (fileName: string, content: string, type = 'json') =>
document.body.removeChild(link) document.body.removeChild(link)
} }
export const wait = (ms: number) => new Promise(resolve => setTimeout(resolve, ms)) export const wait = (ms: number) => new Promise(resolve => setTimeout(resolve, ms))
const cyrb64 = (str: string, seed = 0) => {
let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
for(let i = 0, ch; i < str.length; i++) {
ch = str.charCodeAt(i);
h1 = Math.imul(h1 ^ ch, 2654435761);
h2 = Math.imul(h2 ^ ch, 1597334677);
}
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507);
h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909);
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507);
h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);
return [h2>>>0, h1>>>0];
};
export const cyrb64Hash = (str: string, seed = 0) => {
const [h2, h1] = cyrb64(str, seed);
return h2.toString(36).padStart(7, '0') + h1.toString(36).padStart(7, '0');
}

View File

@ -17,7 +17,7 @@ export const mainNets: {[key: number]: Network} = {
chainId: 137, chainId: 137,
explorer: 'https://polygonscan.com', explorer: 'https://polygonscan.com',
icon:'polygon.webp', icon:'polygon.webp',
symbol: 'MATIC', symbol: 'POL',
priceId: 'matic-network' priceId: 'matic-network'
}, },
100: { 100: {
@ -74,6 +74,15 @@ export const mainNets: {[key: number]: Network} = {
symbol: 'ETH', symbol: 'ETH',
priceId: 'ethereum' priceId: 'ethereum'
}, },
666666666: {
name: 'Degen',
rpc: 'https://rpc.degen.tips',
chainId: 666666666,
explorer: 'https://explorer.degen.tips/',
icon: 'degen.webp',
symbol: 'DEGEN',
priceId: 'degen'
},
} }
export const testNets = { export const testNets = {

View File

@ -339,8 +339,9 @@ export default defineComponent({
const extractMnemonic = () => { const extractMnemonic = () => {
mnemonic.value = mnemonic.value.trim().replace(/\s+/g, " "); mnemonic.value = mnemonic.value.trim().replace(/\s+/g, " ");
mnemonicIndex.value = Number(mnemonicIndex.value); mnemonicIndex.value = Number(mnemonicIndex.value);
const wordCount = mnemonic.value.trim().split(" ").length;
if (mnemonic.value.split(" ").length !== 12) { if (wordCount !== 12 && wordCount !== 24) {
alertMsg.value = "Invalid mnemonic."; alertMsg.value = "Invalid mnemonic.";
alertOpen.value = true; alertOpen.value = true;
return; return;

View File

@ -187,12 +187,16 @@
<ion-radio-group :value="selectedAccount?.address ?? ''"> <ion-radio-group :value="selectedAccount?.address ?? ''">
<ion-list-header> <ion-list-header>
<ion-label>Accounts</ion-label> <ion-label>Accounts</ion-label>
<ion-searchbar
placeholder="search..."
@ionInput="searchAccount"
></ion-searchbar>
</ion-list-header> </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 filtredAccounts"
:key="account.address" :key="account.address"
button button
> >
@ -228,11 +232,15 @@
<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-searchbar
placeholder="search..."
@ionInput="searchNetwork"
></ion-searchbar>
</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 filtredNetworks"
:key="network.chainId" :key="network.chainId"
> >
<ion-item> <ion-item>
@ -284,6 +292,7 @@ import {
IonToast, IonToast,
IonIcon, IonIcon,
IonAvatar, IonAvatar,
IonSearchbar,
} from "@ionic/vue"; } from "@ionic/vue";
import { import {
getAccounts, getAccounts,
@ -332,9 +341,12 @@ export default defineComponent({
IonIcon, IonIcon,
IonAvatar, IonAvatar,
GitHub, GitHub,
IonSearchbar,
}, },
setup: () => { setup: () => {
const loading = ref(false); const loading = ref(false);
const filtredAccounts = ref([]) as Ref<Account[]>;
const filtredNetworks = ref({}) as Ref<Networks>;
const accounts = ref([]) as Ref<Account[]>; const accounts = ref([]) as Ref<Account[]>;
const networks = ref({}) as Ref<Networks>; const networks = ref({}) as Ref<Networks>;
const accountsModal = ref(false) as Ref<boolean>; const accountsModal = ref(false) as Ref<boolean>;
@ -362,6 +374,8 @@ export default defineComponent({
]).then((res) => { ]).then((res) => {
accounts.value = res[0]; accounts.value = res[0];
networks.value = res[1]; networks.value = res[1];
filtredAccounts.value = res[0];
filtredNetworks.value = res[1];
selectedAccount.value = res[2]; selectedAccount.value = res[2];
selectedNetwork.value = res[3]; selectedNetwork.value = res[3];
settings.value = res[4]; settings.value = res[4];
@ -425,6 +439,45 @@ export default defineComponent({
loading.value = false; loading.value = false;
}; };
const searchAccount = (e: any) => {
const text = e.target.value;
if (text) {
filtredAccounts.value = accounts.value.filter(
(item) =>
item.name.toLowerCase().includes(text.toLowerCase()) ||
item.address.toLowerCase().includes(text.toLowerCase())
);
} else {
filtredAccounts.value = accounts.value;
}
};
const searchNetwork = (e: any) => {
const text = e.target.value;
if (text) {
const filtred = Object.keys(networks.value).reduce(
(acc: Networks, key: string) => {
if (
networks.value[Number(key)].name
.toLowerCase()
.includes(text.toLowerCase()) ||
networks.value[Number(key)].rpc
.toLowerCase()
.includes(text.toLowerCase()) ||
networks.value[Number(key)].chainId.toString().includes(text)
) {
acc[Number(key)] = networks.value[Number(key)];
}
return acc;
},
{} as Networks
);
filtredNetworks.value = filtred;
} else {
filtredNetworks.value = networks.value;
}
};
return { return {
loading, loading,
accounts, accounts,
@ -448,6 +501,10 @@ export default defineComponent({
version, version,
goToFarcasterActions, goToFarcasterActions,
goToPersonalSign, goToPersonalSign,
filtredAccounts,
filtredNetworks,
searchAccount,
searchNetwork,
}; };
}, },
}); });