@instadapp/avocado-base 0.2.2 → 0.2.4
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/eslint.config.mjs +14 -0
- package/nuxt.config.ts +4 -0
- package/package.json +6 -6
- 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 +40 -2
- 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,
|
|
@@ -66,6 +66,26 @@ const avocadoStaging = defineChain({
|
|
|
66
66
|
},
|
|
67
67
|
})
|
|
68
68
|
|
|
69
|
+
const sonic = /* #__PURE__ */ defineChain({
|
|
70
|
+
id: 146,
|
|
71
|
+
name: 'Sonic',
|
|
72
|
+
nativeCurrency: {
|
|
73
|
+
decimals: 18,
|
|
74
|
+
name: 'Sonic',
|
|
75
|
+
symbol: 'S',
|
|
76
|
+
},
|
|
77
|
+
rpcUrls: {
|
|
78
|
+
default: { http: ['https://rpc.soniclabs.com'] },
|
|
79
|
+
},
|
|
80
|
+
blockExplorers: {
|
|
81
|
+
default: {
|
|
82
|
+
name: 'Sonic Explorer',
|
|
83
|
+
url: 'https://explorer.soniclabs.com',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
testnet: false,
|
|
87
|
+
})
|
|
88
|
+
|
|
69
89
|
export const networks: Network[] = [
|
|
70
90
|
{
|
|
71
91
|
name: 'Polygon',
|
|
@@ -507,6 +527,24 @@ export const networks: Network[] = [
|
|
|
507
527
|
viemChain: linea,
|
|
508
528
|
ankrName: 'linea',
|
|
509
529
|
},
|
|
530
|
+
{
|
|
531
|
+
name: sonic.name,
|
|
532
|
+
chainId: sonic.id,
|
|
533
|
+
explorerUrl: sonic.blockExplorers.default.url,
|
|
534
|
+
legacySupported: false,
|
|
535
|
+
viemChain: sonic,
|
|
536
|
+
color: '#78d64b',
|
|
537
|
+
apiURL: null,
|
|
538
|
+
fakeTransactionHash: '0xc8fe01a980987295c36e898b4681fa8c937eb8dfd48a3ae080956b36a66195ee',
|
|
539
|
+
get serverRpcUrl() {
|
|
540
|
+
return process.env?.SONIC_RPC_URL || this.params.rpcUrls[0]
|
|
541
|
+
},
|
|
542
|
+
params: {
|
|
543
|
+
rpcUrls: sonic.rpcUrls.default.http as any,
|
|
544
|
+
chainName: sonic.name,
|
|
545
|
+
nativeCurrency: sonic.nativeCurrency,
|
|
546
|
+
},
|
|
547
|
+
},
|
|
510
548
|
// {
|
|
511
549
|
// name: "Manta Pacific",
|
|
512
550
|
// chainId: 169,
|
|
@@ -614,7 +652,7 @@ export function getRpcURLByChainId(chainId: ChainId | number | string) {
|
|
|
614
652
|
const network = getNetworkByChainId(chainId)
|
|
615
653
|
return network.params.rpcUrls[0]
|
|
616
654
|
}
|
|
617
|
-
catch
|
|
655
|
+
catch {
|
|
618
656
|
return ''
|
|
619
657
|
}
|
|
620
658
|
}
|
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
|
+
}
|