@instadapp/avocado-base 0.0.0-dev.21292ef → 0.0.0-dev.22b3a7d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +64 -65
- package/abi/avoFactoryProxy.json +1 -1
- package/abi/forwarder.json +1 -1
- package/abi/multisigAgnosticForwarder.json +936 -937
- package/abi/multisigForwarder.json +680 -680
- package/app.vue +5 -5
- package/components/ActionLogo.vue +15 -15
- package/components/AuthorityAvatar.vue +8 -6
- package/components/ChainLogo.vue +19 -15
- package/components/CopyClipboard.vue +1 -1
- package/components/metadata/Bridge.vue +22 -23
- package/components/metadata/GasTopup.vue +14 -15
- package/components/metadata/Permit2.vue +12 -13
- package/components/metadata/Transfer.vue +1 -0
- package/eslint.config.mjs +14 -0
- package/nuxt.config.ts +17 -13
- package/package.json +8 -13
- package/server/utils/index.ts +4 -4
- package/utils/avocado.ts +17 -17
- package/utils/bignumber.ts +47 -36
- package/utils/formatter.ts +54 -60
- package/utils/helper.ts +33 -30
- package/utils/metadata.ts +366 -403
- package/utils/network.ts +49 -4
- package/utils/services.ts +11 -13
- package/utils/utils.d.ts +1 -0
package/utils/network.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ethers } from 'ethers'
|
|
2
|
+
import { defineChain } from 'viem'
|
|
2
3
|
import {
|
|
3
4
|
arbitrum,
|
|
4
5
|
aurora,
|
|
@@ -18,7 +19,6 @@ import {
|
|
|
18
19
|
polygonZkEvm,
|
|
19
20
|
scroll,
|
|
20
21
|
} from 'viem/chains'
|
|
21
|
-
import { defineChain } from 'viem'
|
|
22
22
|
import {
|
|
23
23
|
AVO_PROD_CHAIN_ID,
|
|
24
24
|
AVO_PROD_CHAIN_NAME,
|
|
@@ -64,6 +64,33 @@ const avocadoStaging = defineChain({
|
|
|
64
64
|
blockExplorers: {
|
|
65
65
|
default: { name: 'Avoscan', url: AVO_STAGING_EXPLORER_URL },
|
|
66
66
|
},
|
|
67
|
+
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
const sonic = defineChain({
|
|
71
|
+
id: 146,
|
|
72
|
+
name: 'Sonic',
|
|
73
|
+
nativeCurrency: {
|
|
74
|
+
decimals: 18,
|
|
75
|
+
name: 'Sonic',
|
|
76
|
+
symbol: 'S',
|
|
77
|
+
},
|
|
78
|
+
rpcUrls: {
|
|
79
|
+
default: { http: ['https://rpc.soniclabs.com'] },
|
|
80
|
+
},
|
|
81
|
+
blockExplorers: {
|
|
82
|
+
default: {
|
|
83
|
+
name: 'Sonic Explorer',
|
|
84
|
+
url: 'https://sonicscan.org',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
testnet: false,
|
|
88
|
+
contracts: {
|
|
89
|
+
multicall3: {
|
|
90
|
+
address: '0x266F33e4E7B44Af88F5B9171d3b5222cc1502b27',
|
|
91
|
+
blockCreated: 269715,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
67
94
|
})
|
|
68
95
|
|
|
69
96
|
export const networks: Network[] = [
|
|
@@ -88,8 +115,8 @@ export const networks: Network[] = [
|
|
|
88
115
|
params: {
|
|
89
116
|
chainName: 'Matic(Polygon) Mainnet',
|
|
90
117
|
nativeCurrency: {
|
|
91
|
-
name: '
|
|
92
|
-
symbol: '
|
|
118
|
+
name: 'POL (ex-MATIC)',
|
|
119
|
+
symbol: 'POL',
|
|
93
120
|
decimals: 18,
|
|
94
121
|
},
|
|
95
122
|
rpcUrls: ['https://polygon-rpc.com'],
|
|
@@ -508,6 +535,24 @@ export const networks: Network[] = [
|
|
|
508
535
|
ankrName: 'linea',
|
|
509
536
|
},
|
|
510
537
|
// {
|
|
538
|
+
// name: sonic.name,
|
|
539
|
+
// chainId: sonic.id,
|
|
540
|
+
// explorerUrl: sonic.blockExplorers.default.url,
|
|
541
|
+
// legacySupported: false,
|
|
542
|
+
// viemChain: sonic,
|
|
543
|
+
// color: '#78d64b',
|
|
544
|
+
// apiURL: null,
|
|
545
|
+
// fakeTransactionHash: '0xc8fe01a980987295c36e898b4681fa8c937eb8dfd48a3ae080956b36a66195ee',
|
|
546
|
+
// get serverRpcUrl() {
|
|
547
|
+
// return process.env?.SONIC_RPC_URL || this.params.rpcUrls[0]
|
|
548
|
+
// },
|
|
549
|
+
// params: {
|
|
550
|
+
// rpcUrls: sonic.rpcUrls.default.http as any,
|
|
551
|
+
// chainName: sonic.name,
|
|
552
|
+
// nativeCurrency: sonic.nativeCurrency,
|
|
553
|
+
// },
|
|
554
|
+
// },
|
|
555
|
+
// {
|
|
511
556
|
// name: "Manta Pacific",
|
|
512
557
|
// chainId: 169,
|
|
513
558
|
// explorerUrl: "https://pacific-explorer.manta.network",
|
|
@@ -614,7 +659,7 @@ export function getRpcURLByChainId(chainId: ChainId | number | string) {
|
|
|
614
659
|
const network = getNetworkByChainId(chainId)
|
|
615
660
|
return network.params.rpcUrls[0]
|
|
616
661
|
}
|
|
617
|
-
catch
|
|
662
|
+
catch {
|
|
618
663
|
return ''
|
|
619
664
|
}
|
|
620
665
|
}
|
package/utils/services.ts
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
export
|
|
2
|
-
address
|
|
3
|
-
|
|
4
|
-
tokens?: ITokenPrice[]
|
|
5
|
-
) => {
|
|
6
|
-
if (!address || !chainId) return null;
|
|
1
|
+
export async function fetchTokenByAddress(address: string, chainId: string | number, tokens?: ITokenPrice[]) {
|
|
2
|
+
if (!address || !chainId)
|
|
3
|
+
return null
|
|
7
4
|
|
|
8
5
|
if (tokens?.length) {
|
|
9
|
-
const token = tokens.find(
|
|
10
|
-
if (token)
|
|
6
|
+
const token = tokens.find(token => token.address?.toLocaleLowerCase() === address?.toLocaleLowerCase() && token.chain_id == chainId)
|
|
7
|
+
if (token)
|
|
8
|
+
return token
|
|
11
9
|
}
|
|
12
10
|
|
|
13
11
|
const [token] = (await $fetch(`${blockQueryURL}/${chainId}/tokens`, {
|
|
14
12
|
params: {
|
|
15
|
-
sparkline: false,
|
|
16
|
-
|
|
13
|
+
'sparkline': false,
|
|
14
|
+
'addresses[]': [address],
|
|
17
15
|
},
|
|
18
|
-
})) as ITokenPrice[]
|
|
16
|
+
})) as ITokenPrice[]
|
|
19
17
|
|
|
20
|
-
return token
|
|
21
|
-
}
|
|
18
|
+
return token
|
|
19
|
+
}
|