@instadapp/avocado-base 0.1.9 → 0.2.0
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/eslint.config.mjs +1 -0
- package/package.json +1 -1
- package/utils/network.ts +19 -0
- package/utils/utils.d.ts +108 -108
package/eslint.config.mjs
CHANGED
package/package.json
CHANGED
package/utils/network.ts
CHANGED
|
@@ -74,6 +74,7 @@ export const networks: Network[] = [
|
|
|
74
74
|
zerionName: 'polygon',
|
|
75
75
|
color: '#7A4ADD',
|
|
76
76
|
chainId: 137,
|
|
77
|
+
legacySupported: true,
|
|
77
78
|
viemChain: polygon,
|
|
78
79
|
balanceResolverAddress: '0x58632D23120b20650262b8A629a14e4F4043E0D9',
|
|
79
80
|
usdcAddress: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174',
|
|
@@ -99,6 +100,7 @@ export const networks: Network[] = [
|
|
|
99
100
|
debankName: 'arb',
|
|
100
101
|
ankrName: 'arbitrum',
|
|
101
102
|
zerionName: 'arbitrum',
|
|
103
|
+
legacySupported: true,
|
|
102
104
|
viemChain: arbitrum,
|
|
103
105
|
color: '#2D374B',
|
|
104
106
|
chainId: 42161,
|
|
@@ -129,6 +131,7 @@ export const networks: Network[] = [
|
|
|
129
131
|
viemChain: mainnet,
|
|
130
132
|
chainId: 1,
|
|
131
133
|
explorerUrl: 'https://etherscan.io',
|
|
134
|
+
legacySupported: true,
|
|
132
135
|
fakeTransactionHash:
|
|
133
136
|
'0x13232dd32cef2f641ead890a507710c96560c8c9c3d5fab6facb5ec563c49433',
|
|
134
137
|
apiURL: 'https://api.etherscan.io/api',
|
|
@@ -154,6 +157,7 @@ export const networks: Network[] = [
|
|
|
154
157
|
ankrName: 'base',
|
|
155
158
|
viemChain: base,
|
|
156
159
|
explorerUrl: 'https://basescan.org',
|
|
160
|
+
legacySupported: true,
|
|
157
161
|
fakeTransactionHash:
|
|
158
162
|
'0xf7833d80da33730c4fc5d4c64151f0eaa64c0c0535be022af0228a44cc4e9c8e',
|
|
159
163
|
apiURL: 'https://api.basescan.org/api',
|
|
@@ -178,6 +182,7 @@ export const networks: Network[] = [
|
|
|
178
182
|
ankrName: 'optimism',
|
|
179
183
|
zerionName: 'optimism',
|
|
180
184
|
color: '#FF0420',
|
|
185
|
+
legacySupported: true,
|
|
181
186
|
viemChain: optimism,
|
|
182
187
|
chainId: 10,
|
|
183
188
|
apiURL: 'https://api-optimistic.etherscan.io/api',
|
|
@@ -205,6 +210,7 @@ export const networks: Network[] = [
|
|
|
205
210
|
color: '#8544f6',
|
|
206
211
|
ankrName: 'polygon_zkevm',
|
|
207
212
|
viemChain: polygonZkEvm,
|
|
213
|
+
legacySupported: true,
|
|
208
214
|
explorerUrl: 'https://zkevm.polygonscan.com',
|
|
209
215
|
apiURL: 'https://api-zkevm.polygonscan.com/api',
|
|
210
216
|
balanceResolverAddress: '0x48D1Fa5Ee6691a1E0B45d2B515650997BEA27a01',
|
|
@@ -231,6 +237,7 @@ export const networks: Network[] = [
|
|
|
231
237
|
zerionName: 'binance-smart-chain',
|
|
232
238
|
color: '#F3BA2F',
|
|
233
239
|
chainId: 56,
|
|
240
|
+
legacySupported: true,
|
|
234
241
|
explorerUrl: 'https://bscscan.com',
|
|
235
242
|
viemChain: bsc,
|
|
236
243
|
fakeTransactionHash:
|
|
@@ -258,6 +265,7 @@ export const networks: Network[] = [
|
|
|
258
265
|
zerionName: 'avalanche',
|
|
259
266
|
color: '#EB5757',
|
|
260
267
|
viemChain: avalanche,
|
|
268
|
+
legacySupported: true,
|
|
261
269
|
chainId: 43114,
|
|
262
270
|
usdcAddress: '0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e',
|
|
263
271
|
balanceResolverAddress: '0x63009f31D054E0ac9F321Cf0D642375236A4Bf1E',
|
|
@@ -286,6 +294,7 @@ export const networks: Network[] = [
|
|
|
286
294
|
apiURL: 'https://api.ftmscan.com/api',
|
|
287
295
|
ankrName: 'fantom',
|
|
288
296
|
color: '#1969ff',
|
|
297
|
+
legacySupported: true,
|
|
289
298
|
viemChain: fantom,
|
|
290
299
|
get serverRpcUrl() {
|
|
291
300
|
return process.env?.FANTOM_RPC_URL || this.params.rpcUrls[0]
|
|
@@ -311,6 +320,7 @@ export const networks: Network[] = [
|
|
|
311
320
|
color: '#04795C',
|
|
312
321
|
ankrName: 'gnosis',
|
|
313
322
|
viemChain: gnosis,
|
|
323
|
+
legacySupported: true,
|
|
314
324
|
chainId: 100,
|
|
315
325
|
balanceResolverAddress: '0xfaa244e276b1597f663975ed007ee4ff70d27849',
|
|
316
326
|
explorerUrl: 'https://gnosisscan.io',
|
|
@@ -337,6 +347,7 @@ export const networks: Network[] = [
|
|
|
337
347
|
zerionName: 'aurora',
|
|
338
348
|
color: '#78d64b',
|
|
339
349
|
viemChain: aurora,
|
|
350
|
+
legacySupported: true,
|
|
340
351
|
explorerUrl: 'https://explorer.mainnet.aurora.dev',
|
|
341
352
|
apiURL: 'https://explorer.mainnet.aurora.dev/api/v2',
|
|
342
353
|
fakeTransactionHash:
|
|
@@ -364,6 +375,7 @@ export const networks: Network[] = [
|
|
|
364
375
|
explorerUrl: 'https://explorer.fuse.io',
|
|
365
376
|
apiURL: 'https://explorer.fuse.io/api/v2',
|
|
366
377
|
viemChain: fuse,
|
|
378
|
+
legacySupported: false,
|
|
367
379
|
fakeTransactionHash:
|
|
368
380
|
'0xf22a8031de9b978a57c728e18c6b54633356c39db4d0466e53b9b7c3ee7f8def',
|
|
369
381
|
get serverRpcUrl() {
|
|
@@ -386,6 +398,7 @@ export const networks: Network[] = [
|
|
|
386
398
|
chainId: 534352,
|
|
387
399
|
color: '#78d64b',
|
|
388
400
|
ankrName: 'scroll',
|
|
401
|
+
legacySupported: false,
|
|
389
402
|
explorerUrl: 'https://scrollscan.com',
|
|
390
403
|
apiURL: 'https://api.scrollscan.com/api',
|
|
391
404
|
viemChain: scroll,
|
|
@@ -411,6 +424,7 @@ export const networks: Network[] = [
|
|
|
411
424
|
explorerUrl: 'https://opbnbscan.com',
|
|
412
425
|
apiURL: null,
|
|
413
426
|
viemChain: opBNB,
|
|
427
|
+
legacySupported: false,
|
|
414
428
|
fakeTransactionHash:
|
|
415
429
|
'0xb9438a3eae61442bc7d419d79930370ce09ac0f46e0695025751e3bfe1a931e7',
|
|
416
430
|
get serverRpcUrl() {
|
|
@@ -431,6 +445,7 @@ export const networks: Network[] = [
|
|
|
431
445
|
name: 'Mode',
|
|
432
446
|
color: '#d7ff00',
|
|
433
447
|
explorerUrl: 'https://explorer.mode.network',
|
|
448
|
+
legacySupported: false,
|
|
434
449
|
fakeTransactionHash: '0xb58002db3481f2c51855a91280ec940d0bebec075c4b362b9f90c21a2b14edbe',
|
|
435
450
|
apiURL: 'https://explorer.mode.network/api/v2',
|
|
436
451
|
params: {
|
|
@@ -453,6 +468,7 @@ export const networks: Network[] = [
|
|
|
453
468
|
color: '#78d64b',
|
|
454
469
|
explorerUrl: 'https://blastscan.io',
|
|
455
470
|
apiURL: 'https://api.blastscan.io/api',
|
|
471
|
+
legacySupported: false,
|
|
456
472
|
fakeTransactionHash: '0x934ed8516242f8c08bb9e0e90bb1f989d92ceb6b0333e86ac2d555f25ac27e58',
|
|
457
473
|
params: {
|
|
458
474
|
rpcUrls: ['https://rpc.ankr.com/blast'],
|
|
@@ -474,6 +490,7 @@ export const networks: Network[] = [
|
|
|
474
490
|
apiURL: 'https://api.lineascan.build/api',
|
|
475
491
|
color: '#78d64b',
|
|
476
492
|
explorerUrl: 'https://lineascan.build',
|
|
493
|
+
legacySupported: false,
|
|
477
494
|
params: {
|
|
478
495
|
rpcUrls: ['https://linea-mainnet.public.blastapi.io'],
|
|
479
496
|
chainName: 'Linea',
|
|
@@ -516,6 +533,7 @@ export const networks: Network[] = [
|
|
|
516
533
|
isAvocado: true,
|
|
517
534
|
balanceResolverAddress: '',
|
|
518
535
|
fakeTransactionHash: '',
|
|
536
|
+
legacySupported: false,
|
|
519
537
|
viemChain: avocado,
|
|
520
538
|
color: '#16A34A',
|
|
521
539
|
usdcAddress: '',
|
|
@@ -539,6 +557,7 @@ export const networks: Network[] = [
|
|
|
539
557
|
serverRpcUrl: AVO_STAGING_RPC_URL,
|
|
540
558
|
color: '#16A34A',
|
|
541
559
|
explorerUrl: AVO_STAGING_EXPLORER_URL,
|
|
560
|
+
legacySupported: false,
|
|
542
561
|
viemChain: avocadoStaging,
|
|
543
562
|
fakeTransactionHash: '',
|
|
544
563
|
isAvocado: true,
|
package/utils/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Chain } from
|
|
1
|
+
import type { Chain } from 'viem'
|
|
2
2
|
|
|
3
3
|
declare global {
|
|
4
4
|
type ChainId =
|
|
@@ -23,125 +23,125 @@ declare global {
|
|
|
23
23
|
| 81457
|
|
24
24
|
| 59144
|
|
25
25
|
|
|
26
|
-
type ISlackMessageType =
|
|
26
|
+
type ISlackMessageType = 'danger' | 'error' | 'success' | 'banner'
|
|
27
27
|
|
|
28
|
-
type MetadataTypes = keyof typeof MetadataEnums
|
|
28
|
+
type MetadataTypes = keyof typeof MetadataEnums
|
|
29
29
|
|
|
30
|
-
type PayloadFunction = (data: any, type: MetadataTypes) => any
|
|
30
|
+
type PayloadFunction = (data: any, type: MetadataTypes) => any
|
|
31
31
|
|
|
32
|
-
type IPayload = Record<MetadataTypes, PayloadFunction
|
|
32
|
+
type IPayload = Record<MetadataTypes, PayloadFunction>
|
|
33
33
|
|
|
34
34
|
interface Network {
|
|
35
|
-
name: string
|
|
36
|
-
debankName?: string
|
|
37
|
-
ankrName?: string
|
|
38
|
-
zerionName?: string
|
|
39
|
-
chainId: ChainId
|
|
40
|
-
color: string
|
|
41
|
-
isAvocado?: boolean
|
|
42
|
-
serverRpcUrl: string | undefined
|
|
43
|
-
balanceResolverAddress?: string
|
|
44
|
-
usdcAddress?: string
|
|
45
|
-
explorerUrl: string
|
|
46
|
-
fakeTransactionHash: string
|
|
47
|
-
viemChain: Chain
|
|
35
|
+
name: string
|
|
36
|
+
debankName?: string
|
|
37
|
+
ankrName?: string
|
|
38
|
+
zerionName?: string
|
|
39
|
+
chainId: ChainId
|
|
40
|
+
color: string
|
|
41
|
+
isAvocado?: boolean
|
|
42
|
+
serverRpcUrl: string | undefined
|
|
43
|
+
balanceResolverAddress?: string
|
|
44
|
+
usdcAddress?: string
|
|
45
|
+
explorerUrl: string
|
|
46
|
+
fakeTransactionHash: string
|
|
47
|
+
viemChain: Chain
|
|
48
|
+
legacySupported: boolean
|
|
48
49
|
// must start with https://
|
|
49
|
-
apiURL: `https://${string}` | null
|
|
50
|
+
apiURL: `https://${string}` | null
|
|
50
51
|
params: {
|
|
51
|
-
chainName?: string
|
|
52
|
-
iconUrls?: string[]
|
|
53
|
-
rpcUrls: string[]
|
|
52
|
+
chainName?: string
|
|
53
|
+
iconUrls?: string[]
|
|
54
|
+
rpcUrls: string[]
|
|
54
55
|
nativeCurrency?: {
|
|
55
|
-
name: string
|
|
56
|
-
symbol: string
|
|
57
|
-
decimals: number
|
|
58
|
-
}
|
|
59
|
-
}
|
|
56
|
+
name: string
|
|
57
|
+
symbol: string
|
|
58
|
+
decimals: number
|
|
59
|
+
}
|
|
60
|
+
}
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
token: string
|
|
64
|
-
spender: string
|
|
65
|
-
amount: string
|
|
66
|
-
expiration: string
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
name: string
|
|
71
|
-
url: string
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
token: string
|
|
76
|
-
amount: string
|
|
77
|
-
receiver: string
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
fromToken: string
|
|
82
|
-
toToken: string
|
|
83
|
-
toChainId: string
|
|
84
|
-
amount: string
|
|
85
|
-
receiver: string
|
|
86
|
-
provider?: string
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
};
|
|
63
|
+
interface SignMetadataProps {
|
|
64
|
+
token: string
|
|
65
|
+
spender: string
|
|
66
|
+
amount: string
|
|
67
|
+
expiration: string
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
interface DappMetadataProps {
|
|
71
|
+
name: string
|
|
72
|
+
url: string
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
interface SendMetadataProps {
|
|
76
|
+
token: string
|
|
77
|
+
amount: string
|
|
78
|
+
receiver: string
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface CrossSendMetadataProps {
|
|
82
|
+
fromToken: string
|
|
83
|
+
toToken: string
|
|
84
|
+
toChainId: string
|
|
85
|
+
amount: string
|
|
86
|
+
receiver: string
|
|
87
|
+
provider?: string
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface AuthMetadataProps {
|
|
91
|
+
address: string
|
|
92
|
+
chainId: string
|
|
93
|
+
remove: boolean
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
interface UpgradeMetadataProps {
|
|
97
|
+
version: string
|
|
98
|
+
walletImpl: string
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
interface TopupMetadataProps {
|
|
102
|
+
amount: string
|
|
103
|
+
token: string
|
|
104
|
+
onBehalf: string
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
interface BridgeMetadataProps {
|
|
108
|
+
amount: string
|
|
109
|
+
receiver: string
|
|
110
|
+
fromToken: string
|
|
111
|
+
toToken: string
|
|
112
|
+
toChainId: string
|
|
113
|
+
bridgeFee: string
|
|
114
|
+
nativeToken: string
|
|
115
|
+
version?: string
|
|
116
|
+
provider: string
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
interface SwapMetadataProps {
|
|
120
|
+
sellToken: string
|
|
121
|
+
buyToken: string
|
|
122
|
+
sellAmount: string
|
|
123
|
+
buyAmount: string
|
|
124
|
+
receiver: string
|
|
125
|
+
protocol?: string
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
interface MetadataProps {
|
|
129
|
+
type: MetadataTypes
|
|
130
|
+
encodedData: string
|
|
131
|
+
version?: string
|
|
132
|
+
}
|
|
133
133
|
|
|
134
134
|
interface ITokenPrice {
|
|
135
|
-
address: string
|
|
136
|
-
chain_id: string
|
|
137
|
-
name: string
|
|
138
|
-
symbol: string
|
|
139
|
-
decimals: number
|
|
140
|
-
logo_url: string
|
|
141
|
-
price: string
|
|
142
|
-
coingecko_id: string
|
|
143
|
-
sparkline_price_7d: number[]
|
|
135
|
+
address: string
|
|
136
|
+
chain_id: string
|
|
137
|
+
name: string
|
|
138
|
+
symbol: string
|
|
139
|
+
decimals: number
|
|
140
|
+
logo_url: string
|
|
141
|
+
price: string
|
|
142
|
+
coingecko_id: string
|
|
143
|
+
sparkline_price_7d: number[]
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
export {}
|
|
147
|
+
export {}
|