@instadapp/avocado-base 0.0.0-dev.97f9db0 → 0.0.0-dev.980f139

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.
Files changed (85) hide show
  1. package/.github/workflows/npm-publish-dev.yml +2 -5
  2. package/abi/forwarder.json +1253 -149
  3. package/abi/multisigForwarder.json +697 -0
  4. package/app.vue +7 -0
  5. package/assets/images/icons/arrow-left.svg +5 -0
  6. package/assets/images/icons/arrow-right.svg +5 -0
  7. package/assets/images/icons/avocado.svg +4 -0
  8. package/assets/images/icons/bridge-2.svg +3 -0
  9. package/assets/images/icons/bridge.svg +7 -0
  10. package/assets/images/icons/calendar.svg +8 -0
  11. package/assets/images/icons/change-threshold.svg +4 -0
  12. package/assets/images/icons/check-circle.svg +4 -0
  13. package/assets/images/icons/chevron-down.svg +4 -0
  14. package/assets/images/icons/clipboard.svg +7 -0
  15. package/assets/images/icons/clock-circle.svg +5 -0
  16. package/assets/images/icons/copy.svg +5 -0
  17. package/assets/images/icons/cross-transfer.svg +7 -0
  18. package/assets/images/icons/dapp.svg +4 -0
  19. package/assets/images/icons/deploy.svg +12 -0
  20. package/assets/images/icons/error-circle.svg +6 -0
  21. package/assets/images/icons/exclamation-circle.svg +13 -0
  22. package/assets/images/icons/exclamation-octagon.svg +13 -0
  23. package/assets/images/icons/exclamation-triangle.svg +5 -0
  24. package/assets/images/icons/external-link.svg +6 -0
  25. package/assets/images/icons/eye.svg +4 -0
  26. package/assets/images/icons/flowers.svg +8 -0
  27. package/assets/images/icons/gas-emoji.svg +193 -0
  28. package/assets/images/icons/gas.svg +14 -0
  29. package/assets/images/icons/gift.svg +153 -0
  30. package/assets/images/icons/globe.svg +110 -0
  31. package/assets/images/icons/hamburger.svg +6 -0
  32. package/assets/images/icons/hammer.svg +5 -0
  33. package/assets/images/icons/info-2.svg +12 -0
  34. package/assets/images/icons/instadapp-pro.svg +4 -0
  35. package/assets/images/icons/logout.svg +3 -0
  36. package/assets/images/icons/moon.svg +3 -0
  37. package/assets/images/icons/multi-send.svg +7 -0
  38. package/assets/images/icons/network.svg +13 -0
  39. package/assets/images/icons/options.svg +5 -0
  40. package/assets/images/icons/permit-sign.svg +11 -0
  41. package/assets/images/icons/plus-circle.svg +6 -0
  42. package/assets/images/icons/plus.svg +5 -0
  43. package/assets/images/icons/power-off-bg.svg +24 -0
  44. package/assets/images/icons/power-off.svg +19 -0
  45. package/assets/images/icons/power-on.svg +19 -0
  46. package/assets/images/icons/qr.svg +20 -0
  47. package/assets/images/icons/question-circle.svg +14 -0
  48. package/assets/images/icons/refresh.svg +6 -0
  49. package/assets/images/icons/reject-proposal.svg +6 -0
  50. package/assets/images/icons/search.svg +12 -0
  51. package/assets/images/icons/sun.svg +3 -0
  52. package/assets/images/icons/transfer.svg +5 -0
  53. package/assets/images/icons/trash-2.svg +8 -0
  54. package/assets/images/icons/upgrade.svg +4 -0
  55. package/assets/images/icons/wave.svg +214 -0
  56. package/assets/images/icons/x.svg +5 -0
  57. package/components/ActionLogo.vue +40 -0
  58. package/components/ActionMetadata.vue +78 -0
  59. package/components/AuthorityAvatar.vue +37 -0
  60. package/components/ChainLogo.vue +14 -563
  61. package/components/CopyClipboard.vue +58 -0
  62. package/components/metadata/Bridge.vue +59 -0
  63. package/components/metadata/CrossTransfer.vue +79 -0
  64. package/components/metadata/GasTopup.vue +39 -0
  65. package/components/metadata/Permit2.vue +42 -0
  66. package/components/metadata/Signers.vue +66 -0
  67. package/components/metadata/Swap.vue +67 -0
  68. package/components/metadata/Transfer.vue +50 -0
  69. package/components.d.ts +13 -0
  70. package/contracts/Forwarder.ts +856 -2
  71. package/contracts/MultisigForwarder.ts +859 -0
  72. package/contracts/factories/Forwarder__factory.ts +816 -16
  73. package/contracts/factories/MultisigForwarder__factory.ts +721 -0
  74. package/contracts/factories/index.ts +1 -0
  75. package/contracts/index.ts +2 -0
  76. package/nuxt.config.ts +17 -1
  77. package/package.json +16 -8
  78. package/utils/avocado.ts +2 -0
  79. package/utils/bignumber.ts +20 -0
  80. package/utils/formatter.ts +49 -6
  81. package/utils/helper.ts +8 -0
  82. package/utils/metadata.ts +406 -134
  83. package/utils/network.ts +334 -71
  84. package/utils/services.ts +21 -0
  85. package/utils/utils.d.ts +135 -96
package/utils/network.ts CHANGED
@@ -1,36 +1,83 @@
1
1
  import { ethers } from "ethers";
2
+ import {
3
+ polygon,
4
+ arbitrum,
5
+ mainnet,
6
+ base,
7
+ optimism,
8
+ polygonZkEvm,
9
+ bsc,
10
+ avalanche,
11
+ fantom,
12
+ gnosis,
13
+ aurora,
14
+ fuse,
15
+ scroll,
16
+ opBNB,
17
+ } from "viem/chains";
18
+ import {
19
+ AVO_PROD_CHAIN_NAME,
20
+ AVO_PROD_CHAIN_ID,
21
+ AVO_PROD_RPC_URL,
22
+ AVO_PROD_EXPLORER_URL,
23
+ AVO_STAGING_CHAIN_NAME,
24
+ AVO_STAGING_CHAIN_ID,
25
+ AVO_STAGING_RPC_URL,
26
+ AVO_STAGING_EXPLORER_URL,
27
+ } from "./avocado";
28
+ import { defineChain } from "viem";
2
29
 
3
- export const bridgeDisabledNetworks = [1101];
30
+ export const bridgeDisabledNetworks = [];
4
31
 
5
- export const networks: Network[] = [
6
- {
7
- name: "Mainnet",
8
- debankName: "eth",
9
- ankrName: "eth",
10
- chainId: 1,
11
- explorerUrl: "https://etherscan.io",
12
- get serverRpcUrl() {
13
- return process.env?.MAINNET_RPC_URL || this.params.rpcUrls[0];
14
- },
15
- balanceResolverAddress: "0x5b7D61b389D12e1f5873d0cCEe7E675915AB5F43",
16
- usdcAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
17
- params: {
18
- rpcUrls: ["https://rpc.ankr.com/eth"],
19
- nativeCurrency: {
20
- name: "Ethereum",
21
- symbol: "ETH",
22
- decimals: 18,
23
- },
24
- },
32
+ export const networksSimulationNotSupported = [1313161554, 1101];
33
+
34
+ const avocado = defineChain({
35
+ id: AVO_PROD_CHAIN_ID,
36
+ name: AVO_PROD_CHAIN_NAME,
37
+ nativeCurrency: {
38
+ name: "Avocado",
39
+ symbol: "USDC",
40
+ decimals: 18,
41
+ },
42
+ rpcUrls: {
43
+ default: { http: [AVO_PROD_RPC_URL] },
44
+ },
45
+ blockExplorers: {
46
+ default: { name: "Avoscan", url: AVO_PROD_EXPLORER_URL },
25
47
  },
48
+ });
49
+
50
+ const avocadoStaging = defineChain({
51
+ id: AVO_STAGING_CHAIN_ID,
52
+ name: AVO_STAGING_CHAIN_NAME,
53
+ nativeCurrency: {
54
+ name: "Avocado",
55
+ symbol: "USDC",
56
+ decimals: 18,
57
+ },
58
+ rpcUrls: {
59
+ default: { http: [AVO_STAGING_RPC_URL] },
60
+ },
61
+ blockExplorers: {
62
+ default: { name: "Avoscan", url: AVO_STAGING_EXPLORER_URL },
63
+ },
64
+ });
65
+
66
+ export const networks: Network[] = [
26
67
  {
27
68
  name: "Polygon",
28
69
  debankName: "matic",
29
70
  ankrName: "polygon",
71
+ zerionName: "polygon",
72
+ color: "#7A4ADD",
30
73
  chainId: 137,
74
+ viemChain: polygon,
31
75
  balanceResolverAddress: "0x58632D23120b20650262b8A629a14e4F4043E0D9",
32
76
  usdcAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
33
77
  explorerUrl: "https://polygonscan.com",
78
+ apiURL: "https://api.polygonscan.com",
79
+ fakeTransactionHash:
80
+ "0x906c551abd5873a428505b6530ac14d91367820706c7ee525f6d7313265d1c92",
34
81
  get serverRpcUrl() {
35
82
  return process.env?.POLYGON_RPC_URL || this.params.rpcUrls[0];
36
83
  },
@@ -48,10 +95,16 @@ export const networks: Network[] = [
48
95
  name: "Arbitrum",
49
96
  debankName: "arb",
50
97
  ankrName: "arbitrum",
98
+ zerionName: "arbitrum",
99
+ viemChain: arbitrum,
100
+ color: "#2D374B",
51
101
  chainId: 42161,
52
102
  usdcAddress: "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",
53
103
  balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
104
+ fakeTransactionHash:
105
+ "0x9fa291c3b09d31f19b1fa5dd05f30169d1364036d5f7c14b026410bc07bd8843",
54
106
  explorerUrl: "https://arbiscan.io",
107
+ apiURL: "https://api.arbiscan.io",
55
108
  get serverRpcUrl() {
56
109
  return process.env?.ARBITRUM_RPC_URL || this.params.rpcUrls[0];
57
110
  },
@@ -65,13 +118,70 @@ export const networks: Network[] = [
65
118
  rpcUrls: ["https://arb1.arbitrum.io/rpc"],
66
119
  },
67
120
  },
121
+ {
122
+ name: "Ethereum",
123
+ debankName: "eth",
124
+ ankrName: "eth",
125
+ zerionName: "ethereum",
126
+ viemChain: mainnet,
127
+ chainId: 1,
128
+ explorerUrl: "https://etherscan.io",
129
+ fakeTransactionHash:
130
+ "0x13232dd32cef2f641ead890a507710c96560c8c9c3d5fab6facb5ec563c49433",
131
+ apiURL: "https://api.etherscan.io",
132
+ color: "#5D5FEF",
133
+ get serverRpcUrl() {
134
+ return process.env?.MAINNET_RPC_URL || this.params.rpcUrls[0];
135
+ },
136
+ balanceResolverAddress: "0x5b7D61b389D12e1f5873d0cCEe7E675915AB5F43",
137
+ usdcAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
138
+ params: {
139
+ rpcUrls: ["https://rpc.ankr.com/eth"],
140
+ nativeCurrency: {
141
+ name: "Ethereum",
142
+ symbol: "ETH",
143
+ decimals: 18,
144
+ },
145
+ },
146
+ },
147
+ {
148
+ name: "Base",
149
+ chainId: 8453,
150
+ color: "#1E2024",
151
+ ankrName: "base",
152
+ viemChain: base,
153
+ explorerUrl: "https://basescan.org",
154
+ fakeTransactionHash:
155
+ "0xf7833d80da33730c4fc5d4c64151f0eaa64c0c0535be022af0228a44cc4e9c8e",
156
+ apiURL: "https://api.basescan.org",
157
+ get serverRpcUrl() {
158
+ return process.env?.BASE_RPC_URL || this.params.rpcUrls[0];
159
+ },
160
+ usdcAddress: "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA",
161
+ balanceResolverAddress: "0x23c8EAb8a4373dD16b0947Ebe8bf76Ff7A49d13C",
162
+ params: {
163
+ rpcUrls: ["https://rpc.ankr.com/base"],
164
+ chainName: "Base",
165
+ nativeCurrency: {
166
+ name: "Ethereum",
167
+ symbol: "ETH",
168
+ decimals: 18,
169
+ },
170
+ },
171
+ },
68
172
  {
69
173
  name: "Optimism",
70
174
  debankName: "op",
71
175
  ankrName: "optimism",
176
+ zerionName: "optimism",
177
+ color: "#FF0420",
178
+ viemChain: optimism,
72
179
  chainId: 10,
180
+ apiURL: "https://api-optimistic.etherscan.io",
73
181
  usdcAddress: "0x7f5c764cbc14f9669b88837ca1490cca17c31607",
74
182
  balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
183
+ fakeTransactionHash:
184
+ "0xee7311d68059732b05088f2144dfec6c7a4f5fd0433eb85306afcd6bdf17cebc",
75
185
  explorerUrl: "https://optimistic.etherscan.io",
76
186
  get serverRpcUrl() {
77
187
  return process.env?.OPTIMISM_RPC_URL || this.params.rpcUrls[0];
@@ -83,36 +193,46 @@ export const networks: Network[] = [
83
193
  symbol: "ETH",
84
194
  decimals: 18,
85
195
  },
86
- rpcUrls: ["https://mainnet.optimism.io"],
196
+ rpcUrls: ["https://rpc.ankr.com/optimism"],
87
197
  },
88
198
  },
89
199
  {
90
- name: "Avalanche",
91
- debankName: "avax",
92
- ankrName: "avalanche",
93
- chainId: 43114,
94
- usdcAddress: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
95
- balanceResolverAddress: "0x63009f31D054E0ac9F321Cf0D642375236A4Bf1E",
96
- explorerUrl: "https://snowtrace.io",
200
+ name: "Polygon zkEVM",
201
+ chainId: 1101,
202
+ color: "#8544f6",
203
+ ankrName: "polygon_zkevm",
204
+ viemChain: polygonZkEvm,
205
+ explorerUrl: "https://zkevm.polygonscan.com",
206
+ apiURL: "https://api-zkevm.polygonscan.com",
207
+ balanceResolverAddress: "0x48D1Fa5Ee6691a1E0B45d2B515650997BEA27a01",
208
+ fakeTransactionHash:
209
+ "0x1077130463ade91ad4e9c43c3195298e26a99970975238128912490eea12bf41",
210
+ usdcAddress: "0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035",
97
211
  get serverRpcUrl() {
98
- return process.env?.AVALANCHE_RPC_URL || this.params.rpcUrls[0];
212
+ return process.env?.POLYGON_ZKEVM_RPC_URL || this.params.rpcUrls[0];
99
213
  },
100
214
  params: {
101
- chainName: "Avalanche Network",
215
+ chainName: "polygon zkEVM",
216
+ rpcUrls: ["https://zkevm-rpc.com"],
102
217
  nativeCurrency: {
103
- name: "Avalanche",
104
- symbol: "AVAX",
218
+ name: "Ethereum",
219
+ symbol: "ETH",
105
220
  decimals: 18,
106
221
  },
107
- rpcUrls: ["https://api.avax.network/ext/bc/C/rpc"],
108
222
  },
109
223
  },
110
224
  {
111
225
  name: "BSC",
112
226
  debankName: "bsc",
113
227
  ankrName: "bsc",
228
+ zerionName: "binance-smart-chain",
229
+ color: "#F3BA2F",
114
230
  chainId: 56,
115
231
  explorerUrl: "https://bscscan.com",
232
+ viemChain: bsc,
233
+ fakeTransactionHash:
234
+ "0x897d54bf8e492f840bd4d8f1e743bfcab8226ab4d5a899e47ee433dcd6d6abf7",
235
+ apiURL: "https://api.bscscan.com",
116
236
  usdcAddress: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
117
237
  balanceResolverAddress: "0xb808cff38706e267067b0af427726aa099f69f89",
118
238
  get serverRpcUrl() {
@@ -128,13 +248,71 @@ export const networks: Network[] = [
128
248
  },
129
249
  },
130
250
  },
251
+ {
252
+ name: "Avalanche",
253
+ debankName: "avax",
254
+ ankrName: "avalanche",
255
+ zerionName: "avalanche",
256
+ color: "#EB5757",
257
+ viemChain: avalanche,
258
+ chainId: 43114,
259
+ usdcAddress: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
260
+ balanceResolverAddress: "0x63009f31D054E0ac9F321Cf0D642375236A4Bf1E",
261
+ explorerUrl: "https://snowtrace.io",
262
+ fakeTransactionHash:
263
+ "0x233aac7402558dd4e23f938a50f983e67f5c9604233981c7ac74e63737b8294e",
264
+ apiURL: "https://api.snowtrace.io",
265
+ get serverRpcUrl() {
266
+ return process.env?.AVALANCHE_RPC_URL || this.params.rpcUrls[0];
267
+ },
268
+ params: {
269
+ chainName: "Avalanche Network",
270
+ nativeCurrency: {
271
+ name: "Avalanche",
272
+ symbol: "AVAX",
273
+ decimals: 18,
274
+ },
275
+ rpcUrls: ["https://rpc.ankr.com/avalanche"],
276
+ },
277
+ },
278
+ {
279
+ name: "Fantom",
280
+ chainId: 250,
281
+ zerionName: "fantom",
282
+ explorerUrl: "https://ftmscan.com",
283
+ ankrName: "fantom",
284
+ color: "#1969ff",
285
+ viemChain: fantom,
286
+ get serverRpcUrl() {
287
+ return process.env?.FANTOM_RPC_URL || this.params.rpcUrls[0];
288
+ },
289
+ usdcAddress: "0x04068da6c83afcfa0e13ba15a6696662335d5b75",
290
+ balanceResolverAddress: "0x929376c77a2fb8152375a089a4fccf84ff481479",
291
+ fakeTransactionHash:
292
+ "0x1e9a8405d660172314124e06896212c0786d7fb1550b89410d4bc87e9e8054e4",
293
+ params: {
294
+ rpcUrls: ["https://rpc.ankr.com/fantom"],
295
+ chainName: "Fantom",
296
+ nativeCurrency: {
297
+ name: "Fantom",
298
+ symbol: "FTM",
299
+ decimals: 18,
300
+ },
301
+ },
302
+ },
131
303
  {
132
304
  name: "Gnosis",
133
305
  debankName: "xdai",
306
+ zerionName: "xdai",
307
+ color: "#04795C",
134
308
  ankrName: "gnosis",
309
+ viemChain: gnosis,
135
310
  chainId: 100,
136
311
  balanceResolverAddress: "0xfaa244e276b1597f663975ed007ee4ff70d27849",
137
312
  explorerUrl: "https://gnosisscan.io",
313
+ fakeTransactionHash:
314
+ "0x1513033806310a2c3b29f2276f8aa7388461b0ef9f8499c297e68c12187c179b",
315
+ apiURL: "https://api.gnosisscan.io",
138
316
  usdcAddress: "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
139
317
  get serverRpcUrl() {
140
318
  return process.env?.GNOSIS_RPC_URL || this.params.rpcUrls[0];
@@ -149,30 +327,15 @@ export const networks: Network[] = [
149
327
  },
150
328
  },
151
329
  },
152
- {
153
- name: "Polygon zkEVM",
154
- chainId: 1101,
155
- explorerUrl: "https://zkevm.polygonscan.com",
156
- balanceResolverAddress: "0x48D1Fa5Ee6691a1E0B45d2B515650997BEA27a01",
157
- usdcAddress: "0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035",
158
- get serverRpcUrl() {
159
- return process.env?.POLYGON_ZKEVM_RPC_URL || this.params.rpcUrls[0];
160
- },
161
- params: {
162
- chainName: "polygon zkEVM",
163
- rpcUrls: ["https://rpc.ankr.com/polygon_zkevm"],
164
-
165
- nativeCurrency: {
166
- name: "Ethereum",
167
- symbol: "ETH",
168
- decimals: 18,
169
- },
170
- },
171
- },
172
330
  {
173
331
  name: "Aurora",
174
332
  chainId: 1313161554,
333
+ zerionName: "aurora",
334
+ color: "#78d64b",
335
+ viemChain: aurora,
175
336
  explorerUrl: "https://explorer.mainnet.aurora.dev",
337
+ fakeTransactionHash:
338
+ "0x0923401c5a80c39a5cd57c098a6c4729edbefd0db6894def7d349493f4ff3ec6",
176
339
  get serverRpcUrl() {
177
340
  return process.env?.AURORA_RPC_URL || this.params.rpcUrls[0];
178
341
  },
@@ -189,29 +352,98 @@ export const networks: Network[] = [
189
352
  },
190
353
  },
191
354
  {
192
- name: "Fantom Opera",
193
- chainId: 250,
194
- explorerUrl: "https://ftmscan.com",
355
+ name: "Fuse",
356
+ chainId: 122,
357
+ zerionName: "fuse",
358
+ color: "#78d64b",
359
+ explorerUrl: "https://explorer.fuse.io",
360
+ viemChain: fuse,
361
+ fakeTransactionHash:
362
+ "0xf22a8031de9b978a57c728e18c6b54633356c39db4d0466e53b9b7c3ee7f8def",
195
363
  get serverRpcUrl() {
196
- return process.env?.FANTOM_RPC_URL || this.params.rpcUrls[0];
364
+ return process.env?.FUSE_RPC_URL || this.params.rpcUrls[0];
197
365
  },
198
- usdcAddress: "0x04068da6c83afcfa0e13ba15a6696662335d5b75",
199
- balanceResolverAddress: "0x929376c77a2fb8152375a089a4fccf84ff481479",
366
+ usdcAddress: "",
367
+ balanceResolverAddress: "0xdF19Da523DA64bBE82eE0E4DFf00d676A8386474",
200
368
  params: {
201
- rpcUrls: ["https://rpc.ankr.com/fantom"],
202
- chainName: "Fantom Opera",
369
+ rpcUrls: ["https://fuse-mainnet.chainstacklabs.com"],
370
+ chainName: "Fuse",
203
371
  nativeCurrency: {
204
- name: "Fantom",
205
- symbol: "FTM",
206
372
  decimals: 18,
373
+ name: "Fuse",
374
+ symbol: "fuse",
207
375
  },
208
376
  },
209
377
  },
378
+ {
379
+ name: "Scroll",
380
+ chainId: 534352,
381
+ color: "#78d64b",
382
+ explorerUrl: "https://scrollscan.com",
383
+ viemChain: scroll,
384
+ fakeTransactionHash:
385
+ "0x6bf297c414264fc8cddd47224632b4426a02138df2f50fe891eca87f6aefea01",
386
+ get serverRpcUrl() {
387
+ return process.env?.SCROLL_RPC_URL || this.params.rpcUrls[0];
388
+ },
389
+ params: {
390
+ rpcUrls: ["https://rpc.scroll.io"],
391
+ chainName: "Scroll",
392
+ nativeCurrency: {
393
+ name: "Ethereum",
394
+ symbol: "ETH",
395
+ decimals: 18,
396
+ },
397
+ },
398
+ },
399
+ {
400
+ name: "opBNB",
401
+ chainId: 204,
402
+ color: "#78d64b",
403
+ explorerUrl: "https://opbnbscan.com",
404
+ viemChain: opBNB,
405
+ fakeTransactionHash:
406
+ "0xb9438a3eae61442bc7d419d79930370ce09ac0f46e0695025751e3bfe1a931e7",
407
+ get serverRpcUrl() {
408
+ return process.env?.OPBNB_RPC_URL || this.params.rpcUrls[0];
409
+ },
410
+ params: {
411
+ rpcUrls: ["https://opbnb-mainnet-rpc.bnbchain.org"],
412
+ chainName: "opBNB",
413
+ nativeCurrency: {
414
+ name: "BNB",
415
+ symbol: "BNB",
416
+ decimals: 18,
417
+ },
418
+ },
419
+ },
420
+ // {
421
+ // name: "Manta Pacific",
422
+ // chainId: 169,
423
+ // explorerUrl: "https://pacific-explorer.manta.network",
424
+ // params: {
425
+ // rpcUrls: ["https://pacific-rpc.manta.network/http"],
426
+ // chainName: "Manta Pacific",
427
+ // nativeCurrency: {
428
+ // name: "Ethereum",
429
+ // symbol: "ETH",
430
+ // decimals: 18,
431
+ // },
432
+ // },
433
+ // color: "#78d64b",
434
+ // fakeTransactionHash: "0x3fB128aA5AC254C8539996B11C587E521AE0d3ab",
435
+ // get serverRpcUrl() {
436
+ // return process.env?.MANTA_RPC_URL || this.params.rpcUrls[0];
437
+ // },
438
+ // },
210
439
  {
211
440
  name: AVO_PROD_CHAIN_NAME,
212
441
  chainId: AVO_PROD_CHAIN_ID,
213
442
  isAvocado: true,
214
443
  balanceResolverAddress: "",
444
+ fakeTransactionHash: "",
445
+ viemChain: avocado,
446
+ color: "#16A34A",
215
447
  usdcAddress: "",
216
448
  serverRpcUrl: AVO_PROD_RPC_URL,
217
449
  explorerUrl: AVO_PROD_EXPLORER_URL,
@@ -230,7 +462,10 @@ export const networks: Network[] = [
230
462
  name: AVO_STAGING_CHAIN_NAME,
231
463
  chainId: AVO_STAGING_CHAIN_ID,
232
464
  serverRpcUrl: AVO_STAGING_RPC_URL,
465
+ color: "#16A34A",
233
466
  explorerUrl: AVO_STAGING_EXPLORER_URL,
467
+ viemChain: avocadoStaging,
468
+ fakeTransactionHash: "",
234
469
  isAvocado: true,
235
470
  balanceResolverAddress: "",
236
471
  usdcAddress: "",
@@ -247,6 +482,26 @@ export const networks: Network[] = [
247
482
  },
248
483
  ];
249
484
 
485
+ export const chainUsdcAddresses = [
486
+ { chainId: 1, address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" },
487
+ { chainId: 10, address: "0x7f5c764cbc14f9669b88837ca1490cca17c31607" },
488
+ { chainId: 56, address: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d" },
489
+ { chainId: 100, address: "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83" },
490
+ { chainId: 137, address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174" },
491
+ { chainId: 137, address: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359" },
492
+ { chainId: 250, address: "0x04068da6c83afcfa0e13ba15a6696662335d5b75" },
493
+ { chainId: 42161, address: "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8" },
494
+ { chainId: 42161, address: "0xaf88d065e77c8cc2239327c5edb3a432268e5831" },
495
+ { chainId: 43114, address: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e" },
496
+ { chainId: 43114, address: "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664" },
497
+ { chainId: 1101, address: "0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035" },
498
+ {
499
+ chainId: 1313161554,
500
+ address: "0xB12BFcA5A55806AaF64E99521918A4bf0fC40802",
501
+ },
502
+ { chainId: 8453, address: "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA" },
503
+ ];
504
+
250
505
  export const getNetworkByChainId = (
251
506
  chainId: ChainId | number | string
252
507
  ): Network => {
@@ -259,12 +514,16 @@ export const availableNetworks = networks.filter(
259
514
 
260
515
  export const chainIdToName = (chainId: ChainId | number | string) => {
261
516
  const network = getNetworkByChainId(chainId);
262
- return network.name;
517
+ return network?.name;
263
518
  };
264
519
 
265
520
  export const getRpcURLByChainId = (chainId: ChainId | number | string) => {
266
- const network = getNetworkByChainId(chainId);
267
- return network.params.rpcUrls[0];
521
+ try {
522
+ const network = getNetworkByChainId(chainId);
523
+ return network.params.rpcUrls[0];
524
+ } catch (e) {
525
+ return "";
526
+ }
268
527
  };
269
528
 
270
529
  export const RPCMap = networks.reduce((acc, network) => {
@@ -274,13 +533,16 @@ export const RPCMap = networks.reduce((acc, network) => {
274
533
 
275
534
  export const networkIds = networks.map((network) => network.chainId);
276
535
 
277
- const rpcInstances: Record<string, ethers.providers.JsonRpcProvider> = {};
278
- const serverRpcInstances: Record<string, ethers.providers.JsonRpcProvider> = {};
536
+ const rpcInstances: Record<string, ethers.providers.StaticJsonRpcProvider> = {};
537
+ const serverRpcInstances: Record<
538
+ string,
539
+ ethers.providers.StaticJsonRpcProvider
540
+ > = {};
279
541
 
280
542
  export const getServerRpcProvider = (chainId: number | string) => {
281
543
  if (!rpcInstances[chainId]) {
282
544
  const network = networks.find((n) => n.chainId == chainId);
283
- serverRpcInstances[chainId] = new ethers.providers.JsonRpcProvider(
545
+ serverRpcInstances[chainId] = new ethers.providers.StaticJsonRpcProvider(
284
546
  network?.serverRpcUrl
285
547
  );
286
548
  }
@@ -290,7 +552,7 @@ export const getServerRpcProvider = (chainId: number | string) => {
290
552
 
291
553
  export const getRpcProvider = (chainId: number | string) => {
292
554
  if (!rpcInstances[chainId]) {
293
- rpcInstances[chainId] = new ethers.providers.JsonRpcProvider(
555
+ rpcInstances[chainId] = new ethers.providers.StaticJsonRpcProvider(
294
556
  getRpcURLByChainId(Number(chainId))
295
557
  );
296
558
  }
@@ -303,5 +565,6 @@ export const getExplorerUrl = (
303
565
  suffix: `/${string}` = "/"
304
566
  ) => {
305
567
  const network = getNetworkByChainId(chainId);
568
+ if (!network) return "";
306
569
  return `${network.explorerUrl}${suffix}`;
307
570
  };
@@ -0,0 +1,21 @@
1
+ export const fetchTokenByAddress = async (
2
+ address: string,
3
+ chainId: string | number,
4
+ tokens?: ITokenPrice[]
5
+ ) => {
6
+ if (!address || !chainId) return null;
7
+
8
+ if (tokens?.length) {
9
+ const token = tokens.find((token) => token.address?.toLocaleLowerCase() === address?.toLocaleLowerCase() && token.chain_id == chainId);
10
+ if (token) return token;
11
+ }
12
+
13
+ const [token] = (await $fetch(`${blockQueryURL}/${chainId}/tokens`, {
14
+ params: {
15
+ sparkline: false,
16
+ "addresses[]": [address],
17
+ },
18
+ })) as ITokenPrice[];
19
+
20
+ return token;
21
+ };