@instadapp/avocado-base 0.0.0-dev.19925f5 → 0.0.0-dev.21292ef

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 (107) hide show
  1. package/.github/workflows/npm-publish-dev.yml +2 -5
  2. package/.vscode/settings.json +68 -0
  3. package/abi/avoFactoryProxy.json +109 -0
  4. package/abi/balanceResolver.json +110 -0
  5. package/abi/erc20.json +350 -0
  6. package/abi/forwarder.json +1435 -0
  7. package/abi/gaslessWallet.json +289 -0
  8. package/abi/multisigAgnosticForwarder.json +938 -0
  9. package/abi/multisigForwarder.json +697 -0
  10. package/app.vue +27 -0
  11. package/assets/images/icons/arrow-left.svg +5 -0
  12. package/assets/images/icons/arrow-right.svg +5 -0
  13. package/assets/images/icons/avocado.svg +4 -0
  14. package/assets/images/icons/bridge-2.svg +3 -0
  15. package/assets/images/icons/bridge.svg +7 -0
  16. package/assets/images/icons/calendar.svg +8 -0
  17. package/assets/images/icons/change-threshold.svg +4 -0
  18. package/assets/images/icons/check-circle.svg +4 -0
  19. package/assets/images/icons/check.svg +3 -0
  20. package/assets/images/icons/chevron-down.svg +4 -0
  21. package/assets/images/icons/clipboard.svg +7 -0
  22. package/assets/images/icons/clock-circle.svg +5 -0
  23. package/assets/images/icons/copy.svg +12 -0
  24. package/assets/images/icons/cross-transfer.svg +7 -0
  25. package/assets/images/icons/dapp.svg +4 -0
  26. package/assets/images/icons/deploy.svg +12 -0
  27. package/assets/images/icons/error-circle.svg +6 -0
  28. package/assets/images/icons/exclamation-circle.svg +13 -0
  29. package/assets/images/icons/exclamation-octagon.svg +13 -0
  30. package/assets/images/icons/exclamation-triangle.svg +5 -0
  31. package/assets/images/icons/external-link.svg +6 -0
  32. package/assets/images/icons/eye.svg +4 -0
  33. package/assets/images/icons/flowers.svg +8 -0
  34. package/assets/images/icons/gas-emoji.svg +193 -0
  35. package/assets/images/icons/gas.svg +14 -0
  36. package/assets/images/icons/gift.svg +153 -0
  37. package/assets/images/icons/globe.svg +110 -0
  38. package/assets/images/icons/hamburger.svg +6 -0
  39. package/assets/images/icons/hammer.svg +5 -0
  40. package/assets/images/icons/info-2.svg +12 -0
  41. package/assets/images/icons/instadapp-pro.svg +4 -0
  42. package/assets/images/icons/logout.svg +3 -0
  43. package/assets/images/icons/moon.svg +3 -0
  44. package/assets/images/icons/multi-send.svg +7 -0
  45. package/assets/images/icons/network.svg +13 -0
  46. package/assets/images/icons/options.svg +5 -0
  47. package/assets/images/icons/permit-sign.svg +11 -0
  48. package/assets/images/icons/plus-circle.svg +6 -0
  49. package/assets/images/icons/plus.svg +5 -0
  50. package/assets/images/icons/power-off-bg.svg +24 -0
  51. package/assets/images/icons/power-off.svg +19 -0
  52. package/assets/images/icons/power-on.svg +19 -0
  53. package/assets/images/icons/qr.svg +20 -0
  54. package/assets/images/icons/question-circle.svg +14 -0
  55. package/assets/images/icons/refresh.svg +6 -0
  56. package/assets/images/icons/reject-proposal.svg +6 -0
  57. package/assets/images/icons/search.svg +12 -0
  58. package/assets/images/icons/stars.svg +4 -0
  59. package/assets/images/icons/sun.svg +3 -0
  60. package/assets/images/icons/transfer.svg +5 -0
  61. package/assets/images/icons/trash-2.svg +8 -0
  62. package/assets/images/icons/upgrade.svg +4 -0
  63. package/assets/images/icons/wave.svg +214 -0
  64. package/assets/images/icons/x.svg +5 -0
  65. package/components/ActionLogo.vue +42 -0
  66. package/components/ActionMetadata.vue +88 -0
  67. package/components/Address.vue +74 -0
  68. package/components/AuthorityAvatar.vue +37 -0
  69. package/components/ChainLogo.vue +14 -423
  70. package/components/CopyClipboard.vue +42 -0
  71. package/components/metadata/Bridge.vue +59 -0
  72. package/components/metadata/CrossTransfer.vue +76 -0
  73. package/components/metadata/GasTopup.vue +39 -0
  74. package/components/metadata/Permit2.vue +42 -0
  75. package/components/metadata/Signers.vue +19 -0
  76. package/components/metadata/Swap.vue +66 -0
  77. package/components/metadata/Transfer.vue +48 -0
  78. package/components.d.ts +13 -0
  79. package/contracts/AvoFactoryProxy.ts +302 -0
  80. package/contracts/BalanceResolver.ts +321 -0
  81. package/contracts/Erc20.ts +526 -0
  82. package/contracts/Forwarder.ts +1644 -0
  83. package/contracts/GaslessWallet.ts +660 -0
  84. package/contracts/MultisigAgnosticForwarder.ts +1423 -0
  85. package/contracts/MultisigForwarder.ts +859 -0
  86. package/contracts/common.ts +46 -0
  87. package/contracts/factories/AvoFactoryProxy__factory.ts +181 -0
  88. package/contracts/factories/BalanceResolver__factory.ts +212 -0
  89. package/contracts/factories/Erc20__factory.ts +368 -0
  90. package/contracts/factories/Forwarder__factory.ts +1456 -0
  91. package/contracts/factories/GaslessWallet__factory.ts +499 -0
  92. package/contracts/factories/MultisigAgnosticForwarder__factory.ts +2135 -0
  93. package/contracts/factories/MultisigForwarder__factory.ts +721 -0
  94. package/contracts/factories/index.ts +10 -0
  95. package/contracts/index.ts +18 -0
  96. package/eslint.config.mjs +20 -0
  97. package/nuxt.config.ts +23 -2
  98. package/package.json +24 -8
  99. package/server/utils/index.ts +2 -0
  100. package/utils/avocado.ts +2 -0
  101. package/utils/bignumber.ts +51 -0
  102. package/utils/formatter.ts +94 -0
  103. package/utils/helper.ts +62 -0
  104. package/utils/metadata.ts +694 -0
  105. package/utils/network.ts +560 -91
  106. package/utils/services.ts +21 -0
  107. package/utils/utils.d.ts +146 -16
package/utils/network.ts CHANGED
@@ -1,192 +1,661 @@
1
- import { ethers } from "ethers";
1
+ import { ethers } from 'ethers'
2
+ import {
3
+ arbitrum,
4
+ aurora,
5
+ avalanche,
6
+ base,
7
+ blast,
8
+ bsc,
9
+ fantom,
10
+ fuse,
11
+ gnosis,
12
+ linea,
13
+ mainnet,
14
+ mode,
15
+ opBNB,
16
+ optimism,
17
+ polygon,
18
+ polygonZkEvm,
19
+ scroll,
20
+ } from 'viem/chains'
21
+ import { defineChain } from 'viem'
2
22
  import {
3
- AVO_PROD_CHAIN_NAME,
4
23
  AVO_PROD_CHAIN_ID,
5
- AVO_STAGING_CHAIN_NAME,
6
- AVO_STAGING_RPC_URL,
24
+ AVO_PROD_CHAIN_NAME,
25
+ AVO_PROD_EXPLORER_URL,
7
26
  AVO_PROD_RPC_URL,
8
27
  AVO_STAGING_CHAIN_ID,
9
- } from "./avocado";
28
+ AVO_STAGING_CHAIN_NAME,
29
+ AVO_STAGING_EXPLORER_URL,
30
+ AVO_STAGING_RPC_URL,
31
+ } from './avocado'
32
+
33
+ export const bridgeDisabledNetworks = []
10
34
 
11
- export const bridgeDisabledNetworks = [1101];
35
+ export const networksSimulationNotSupported = [1313161554, 1101]
36
+
37
+ const avocado = defineChain({
38
+ id: AVO_PROD_CHAIN_ID,
39
+ name: AVO_PROD_CHAIN_NAME,
40
+ nativeCurrency: {
41
+ name: 'Avocado',
42
+ symbol: 'USDC',
43
+ decimals: 18,
44
+ },
45
+ rpcUrls: {
46
+ default: { http: [AVO_PROD_RPC_URL] },
47
+ },
48
+ blockExplorers: {
49
+ default: { name: 'Avoscan', url: AVO_PROD_EXPLORER_URL },
50
+ },
51
+ })
52
+
53
+ const avocadoStaging = defineChain({
54
+ id: AVO_STAGING_CHAIN_ID,
55
+ name: AVO_STAGING_CHAIN_NAME,
56
+ nativeCurrency: {
57
+ name: 'Avocado',
58
+ symbol: 'USDC',
59
+ decimals: 18,
60
+ },
61
+ rpcUrls: {
62
+ default: { http: [AVO_STAGING_RPC_URL] },
63
+ },
64
+ blockExplorers: {
65
+ default: { name: 'Avoscan', url: AVO_STAGING_EXPLORER_URL },
66
+ },
67
+ })
12
68
 
13
69
  export const networks: Network[] = [
14
70
  {
15
- name: "Mainnet",
16
- chainId: 1,
71
+ name: 'Polygon',
72
+ debankName: 'matic',
73
+ ankrName: 'polygon',
74
+ zerionName: 'polygon',
75
+ color: '#7A4ADD',
76
+ chainId: 137,
77
+ legacySupported: true,
78
+ viemChain: polygon,
79
+ balanceResolverAddress: '0x58632D23120b20650262b8A629a14e4F4043E0D9',
80
+ usdcAddress: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174',
81
+ explorerUrl: 'https://polygonscan.com',
82
+ apiURL: 'https://api.polygonscan.com/api',
83
+ fakeTransactionHash:
84
+ '0x906c551abd5873a428505b6530ac14d91367820706c7ee525f6d7313265d1c92',
85
+ get serverRpcUrl() {
86
+ return process.env?.POLYGON_RPC_URL || this.params.rpcUrls[0]
87
+ },
17
88
  params: {
18
- rpcUrls: ["https://rpc.ankr.com/eth"],
89
+ chainName: 'Matic(Polygon) Mainnet',
19
90
  nativeCurrency: {
20
- name: "Ethereum",
21
- symbol: "ETH",
91
+ name: 'Matic',
92
+ symbol: 'MATIC',
22
93
  decimals: 18,
23
94
  },
95
+ rpcUrls: ['https://polygon-rpc.com'],
24
96
  },
25
97
  },
26
98
  {
27
- name: "Polygon",
28
- chainId: 137,
99
+ name: 'Arbitrum',
100
+ debankName: 'arb',
101
+ ankrName: 'arbitrum',
102
+ zerionName: 'arbitrum',
103
+ legacySupported: true,
104
+ viemChain: arbitrum,
105
+ color: '#2D374B',
106
+ chainId: 42161,
107
+ usdcAddress: '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8',
108
+ balanceResolverAddress: '0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2',
109
+ fakeTransactionHash:
110
+ '0x9fa291c3b09d31f19b1fa5dd05f30169d1364036d5f7c14b026410bc07bd8843',
111
+ explorerUrl: 'https://arbiscan.io',
112
+ apiURL: 'https://api.arbiscan.io/api',
113
+ get serverRpcUrl() {
114
+ return process.env?.ARBITRUM_RPC_URL || this.params.rpcUrls[0]
115
+ },
29
116
  params: {
30
- chainName: "Matic(Polygon) Mainnet",
117
+ chainName: 'Arbitrum One',
31
118
  nativeCurrency: {
32
- name: "Matic",
33
- symbol: "MATIC",
119
+ name: 'Ethereum',
120
+ symbol: 'ETH',
34
121
  decimals: 18,
35
122
  },
36
- rpcUrls: ["https://polygon-rpc.com"],
37
- blockExplorerUrls: ["https://polygonscan.com/"],
123
+ rpcUrls: ['https://arb1.arbitrum.io/rpc'],
38
124
  },
39
125
  },
40
126
  {
41
- name: "Arbitrum",
42
- chainId: 42161,
127
+ name: 'Ethereum',
128
+ debankName: 'eth',
129
+ ankrName: 'eth',
130
+ zerionName: 'ethereum',
131
+ viemChain: mainnet,
132
+ chainId: 1,
133
+ explorerUrl: 'https://etherscan.io',
134
+ legacySupported: true,
135
+ fakeTransactionHash:
136
+ '0x13232dd32cef2f641ead890a507710c96560c8c9c3d5fab6facb5ec563c49433',
137
+ apiURL: 'https://api.etherscan.io/api',
138
+ color: '#5D5FEF',
139
+ get serverRpcUrl() {
140
+ return process.env?.MAINNET_RPC_URL || this.params.rpcUrls[0]
141
+ },
142
+ balanceResolverAddress: '0x5b7D61b389D12e1f5873d0cCEe7E675915AB5F43',
143
+ usdcAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
144
+ params: {
145
+ rpcUrls: ['https://rpc.ankr.com/eth'],
146
+ nativeCurrency: {
147
+ name: 'Ethereum',
148
+ symbol: 'ETH',
149
+ decimals: 18,
150
+ },
151
+ },
152
+ },
153
+ {
154
+ name: 'Base',
155
+ chainId: 8453,
156
+ color: '#1E2024',
157
+ ankrName: 'base',
158
+ viemChain: base,
159
+ explorerUrl: 'https://basescan.org',
160
+ legacySupported: true,
161
+ fakeTransactionHash:
162
+ '0xf7833d80da33730c4fc5d4c64151f0eaa64c0c0535be022af0228a44cc4e9c8e',
163
+ apiURL: 'https://api.basescan.org/api',
164
+ get serverRpcUrl() {
165
+ return process.env?.BASE_RPC_URL || this.params.rpcUrls[0]
166
+ },
167
+ usdcAddress: '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA',
168
+ balanceResolverAddress: '0x23c8EAb8a4373dD16b0947Ebe8bf76Ff7A49d13C',
43
169
  params: {
44
- chainName: "Arbitrum One",
170
+ rpcUrls: ['https://rpc.ankr.com/base'],
171
+ chainName: 'Base',
45
172
  nativeCurrency: {
46
- name: "Ethereum",
47
- symbol: "ETH",
173
+ name: 'Ethereum',
174
+ symbol: 'ETH',
48
175
  decimals: 18,
49
176
  },
50
- rpcUrls: ["https://arb1.arbitrum.io/rpc"],
51
- blockExplorerUrls: ["https://arbiscan.io"],
52
177
  },
53
178
  },
54
179
  {
55
- name: "Optimism",
180
+ name: 'Optimism',
181
+ debankName: 'op',
182
+ ankrName: 'optimism',
183
+ zerionName: 'optimism',
184
+ color: '#FF0420',
185
+ legacySupported: true,
186
+ viemChain: optimism,
56
187
  chainId: 10,
188
+ apiURL: 'https://api-optimistic.etherscan.io/api',
189
+ usdcAddress: '0x7f5c764cbc14f9669b88837ca1490cca17c31607',
190
+ balanceResolverAddress: '0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2',
191
+ fakeTransactionHash:
192
+ '0xee7311d68059732b05088f2144dfec6c7a4f5fd0433eb85306afcd6bdf17cebc',
193
+ explorerUrl: 'https://optimistic.etherscan.io',
194
+ get serverRpcUrl() {
195
+ return process.env?.OPTIMISM_RPC_URL || this.params.rpcUrls[0]
196
+ },
57
197
  params: {
58
- chainName: "Optimistic Ethereum",
198
+ chainName: 'Optimistic Ethereum',
59
199
  nativeCurrency: {
60
- name: "Ethereum",
61
- symbol: "ETH",
200
+ name: 'Ethereum',
201
+ symbol: 'ETH',
62
202
  decimals: 18,
63
203
  },
64
- rpcUrls: ["https://mainnet.optimism.io"],
65
- blockExplorerUrls: ["https://optimistic.etherscan.io"],
204
+ rpcUrls: ['https://rpc.ankr.com/optimism'],
66
205
  },
67
206
  },
68
207
  {
69
- name: "Avalanche",
70
- chainId: 43114,
208
+ name: 'Polygon zkEVM',
209
+ chainId: 1101,
210
+ color: '#8544f6',
211
+ ankrName: 'polygon_zkevm',
212
+ viemChain: polygonZkEvm,
213
+ legacySupported: true,
214
+ explorerUrl: 'https://zkevm.polygonscan.com',
215
+ apiURL: 'https://api-zkevm.polygonscan.com/api',
216
+ balanceResolverAddress: '0x48D1Fa5Ee6691a1E0B45d2B515650997BEA27a01',
217
+ fakeTransactionHash:
218
+ '0x1077130463ade91ad4e9c43c3195298e26a99970975238128912490eea12bf41',
219
+ usdcAddress: '0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035',
220
+ get serverRpcUrl() {
221
+ return process.env?.POLYGON_ZKEVM_RPC_URL || this.params.rpcUrls[0]
222
+ },
71
223
  params: {
72
- chainName: "Avalanche Network",
224
+ chainName: 'polygon zkEVM',
225
+ rpcUrls: ['https://zkevm-rpc.com'],
73
226
  nativeCurrency: {
74
- name: "Avalanche",
75
- symbol: "AVAX",
227
+ name: 'Ethereum',
228
+ symbol: 'ETH',
76
229
  decimals: 18,
77
230
  },
78
- rpcUrls: ["https://api.avax.network/ext/bc/C/rpc"],
79
- blockExplorerUrls: ["https://snowtrace.io/"],
80
231
  },
81
232
  },
82
233
  {
83
- name: "BSC",
234
+ name: 'BSC',
235
+ debankName: 'bsc',
236
+ ankrName: 'bsc',
237
+ zerionName: 'binance-smart-chain',
238
+ color: '#F3BA2F',
84
239
  chainId: 56,
240
+ legacySupported: true,
241
+ explorerUrl: 'https://bscscan.com',
242
+ viemChain: bsc,
243
+ fakeTransactionHash:
244
+ '0x897d54bf8e492f840bd4d8f1e743bfcab8226ab4d5a899e47ee433dcd6d6abf7',
245
+ apiURL: 'https://api.bscscan.com/api',
246
+ usdcAddress: '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d',
247
+ balanceResolverAddress: '0xb808cff38706e267067b0af427726aa099f69f89',
248
+ get serverRpcUrl() {
249
+ return process.env?.BSC_RPC_URL || this.params.rpcUrls[0]
250
+ },
85
251
  params: {
86
- chainName: "Binance Smart Chain",
87
- rpcUrls: ["https://rpc.ankr.com/bsc"],
252
+ chainName: 'Binance Smart Chain',
253
+ rpcUrls: ['https://rpc.ankr.com/bsc'],
88
254
  nativeCurrency: {
89
- name: "Binance Coin",
90
- symbol: "BNB",
255
+ name: 'Binance Coin',
256
+ symbol: 'BNB',
91
257
  decimals: 18,
92
258
  },
93
259
  },
94
260
  },
95
261
  {
96
- name: "Gnosis",
262
+ name: 'Avalanche',
263
+ debankName: 'avax',
264
+ ankrName: 'avalanche',
265
+ zerionName: 'avalanche',
266
+ color: '#EB5757',
267
+ viemChain: avalanche,
268
+ legacySupported: true,
269
+ chainId: 43114,
270
+ usdcAddress: '0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e',
271
+ balanceResolverAddress: '0x63009f31D054E0ac9F321Cf0D642375236A4Bf1E',
272
+ explorerUrl: 'https://snowtrace.io',
273
+ fakeTransactionHash:
274
+ '0x233aac7402558dd4e23f938a50f983e67f5c9604233981c7ac74e63737b8294e',
275
+ apiURL: 'https://api.routescan.io/v2/network/mainnet/evm/43114/etherscan/api',
276
+ get serverRpcUrl() {
277
+ return process.env?.AVALANCHE_RPC_URL || this.params.rpcUrls[0]
278
+ },
279
+ params: {
280
+ chainName: 'Avalanche Network',
281
+ nativeCurrency: {
282
+ name: 'Avalanche',
283
+ symbol: 'AVAX',
284
+ decimals: 18,
285
+ },
286
+ rpcUrls: ['https://rpc.ankr.com/avalanche'],
287
+ },
288
+ },
289
+ {
290
+ name: 'Fantom',
291
+ chainId: 250,
292
+ zerionName: 'fantom',
293
+ explorerUrl: 'https://ftmscan.com',
294
+ apiURL: 'https://api.ftmscan.com/api',
295
+ ankrName: 'fantom',
296
+ color: '#1969ff',
297
+ legacySupported: true,
298
+ viemChain: fantom,
299
+ get serverRpcUrl() {
300
+ return process.env?.FANTOM_RPC_URL || this.params.rpcUrls[0]
301
+ },
302
+ usdcAddress: '0x04068da6c83afcfa0e13ba15a6696662335d5b75',
303
+ balanceResolverAddress: '0x929376c77a2fb8152375a089a4fccf84ff481479',
304
+ fakeTransactionHash:
305
+ '0x1e9a8405d660172314124e06896212c0786d7fb1550b89410d4bc87e9e8054e4',
306
+ params: {
307
+ rpcUrls: ['https://rpc.ankr.com/fantom'],
308
+ chainName: 'Fantom',
309
+ nativeCurrency: {
310
+ name: 'Fantom',
311
+ symbol: 'FTM',
312
+ decimals: 18,
313
+ },
314
+ },
315
+ },
316
+ {
317
+ name: 'Gnosis',
318
+ debankName: 'xdai',
319
+ zerionName: 'xdai',
320
+ color: '#04795C',
321
+ ankrName: 'gnosis',
322
+ viemChain: gnosis,
323
+ legacySupported: true,
97
324
  chainId: 100,
325
+ balanceResolverAddress: '0xfaa244e276b1597f663975ed007ee4ff70d27849',
326
+ explorerUrl: 'https://gnosisscan.io',
327
+ fakeTransactionHash:
328
+ '0x1513033806310a2c3b29f2276f8aa7388461b0ef9f8499c297e68c12187c179b',
329
+ apiURL: 'https://api.gnosisscan.io/api',
330
+ usdcAddress: '0xddafbb505ad214d7b80b1f830fccc89b60fb7a83',
331
+ get serverRpcUrl() {
332
+ return process.env?.GNOSIS_RPC_URL || this.params.rpcUrls[0]
333
+ },
98
334
  params: {
99
- chainName: "Gnosis Safe",
100
- rpcUrls: ["https://rpc.ankr.com/gnosis"],
335
+ chainName: 'Gnosis Safe',
336
+ rpcUrls: ['https://rpc.ankr.com/gnosis'],
101
337
  nativeCurrency: {
102
- name: "xdaistable",
103
- symbol: "xDAI",
338
+ name: 'xdaistable',
339
+ symbol: 'xDAI',
104
340
  decimals: 18,
105
341
  },
106
342
  },
107
343
  },
108
344
  {
109
- name: "Polygon zkEVM",
110
- chainId: 1101,
345
+ name: 'Aurora',
346
+ chainId: 1313161554,
347
+ zerionName: 'aurora',
348
+ color: '#78d64b',
349
+ viemChain: aurora,
350
+ legacySupported: true,
351
+ explorerUrl: 'https://explorer.mainnet.aurora.dev',
352
+ apiURL: 'https://explorer.mainnet.aurora.dev/api/v2',
353
+ fakeTransactionHash:
354
+ '0x0923401c5a80c39a5cd57c098a6c4729edbefd0db6894def7d349493f4ff3ec6',
355
+ get serverRpcUrl() {
356
+ return process.env?.AURORA_RPC_URL || this.params.rpcUrls[0]
357
+ },
358
+ usdcAddress: '0xB12BFcA5A55806AaF64E99521918A4bf0fC40802',
359
+ balanceResolverAddress: '0xdF19Da523DA64bBE82eE0E4DFf00d676A8386474',
111
360
  params: {
112
- chainName: "polygon zkEVM",
113
- rpcUrls: ["https://rpc.ankr.com/polygon_zkevm"],
361
+ rpcUrls: ['https://mainnet.aurora.dev'],
362
+ chainName: 'Aurora',
114
363
  nativeCurrency: {
115
- name: "Ethereum",
116
- symbol: "ETH",
117
364
  decimals: 18,
365
+ name: 'Aurora ETH',
366
+ symbol: 'AETH',
118
367
  },
119
368
  },
120
369
  },
370
+ {
371
+ name: 'Fuse',
372
+ chainId: 122,
373
+ zerionName: 'fuse',
374
+ color: '#78d64b',
375
+ explorerUrl: 'https://explorer.fuse.io',
376
+ apiURL: 'https://explorer.fuse.io/api/v2',
377
+ viemChain: fuse,
378
+ legacySupported: false,
379
+ fakeTransactionHash:
380
+ '0xf22a8031de9b978a57c728e18c6b54633356c39db4d0466e53b9b7c3ee7f8def',
381
+ get serverRpcUrl() {
382
+ return process.env?.FUSE_RPC_URL || this.params.rpcUrls[0]
383
+ },
384
+ usdcAddress: '',
385
+ balanceResolverAddress: '0xdF19Da523DA64bBE82eE0E4DFf00d676A8386474',
386
+ params: {
387
+ rpcUrls: ['https://fuse-mainnet.chainstacklabs.com'],
388
+ chainName: 'Fuse',
389
+ nativeCurrency: {
390
+ decimals: 18,
391
+ name: 'Fuse',
392
+ symbol: 'fuse',
393
+ },
394
+ },
395
+ },
396
+ {
397
+ name: 'Scroll',
398
+ chainId: 534352,
399
+ color: '#78d64b',
400
+ ankrName: 'scroll',
401
+ legacySupported: false,
402
+ explorerUrl: 'https://scrollscan.com',
403
+ apiURL: 'https://api.scrollscan.com/api',
404
+ viemChain: scroll,
405
+ fakeTransactionHash:
406
+ '0x6bf297c414264fc8cddd47224632b4426a02138df2f50fe891eca87f6aefea01',
407
+ get serverRpcUrl() {
408
+ return process.env?.SCROLL_RPC_URL || this.params.rpcUrls[0]
409
+ },
410
+ params: {
411
+ rpcUrls: ['https://rpc.scroll.io'],
412
+ chainName: 'Scroll',
413
+ nativeCurrency: {
414
+ name: 'Ethereum',
415
+ symbol: 'ETH',
416
+ decimals: 18,
417
+ },
418
+ },
419
+ },
420
+ {
421
+ name: 'opBNB',
422
+ chainId: 204,
423
+ color: '#78d64b',
424
+ explorerUrl: 'https://opbnbscan.com',
425
+ apiURL: null,
426
+ viemChain: opBNB,
427
+ legacySupported: false,
428
+ fakeTransactionHash:
429
+ '0xb9438a3eae61442bc7d419d79930370ce09ac0f46e0695025751e3bfe1a931e7',
430
+ get serverRpcUrl() {
431
+ return process.env?.OPBNB_RPC_URL || this.params.rpcUrls[0]
432
+ },
433
+ params: {
434
+ rpcUrls: ['https://opbnb-mainnet-rpc.bnbchain.org'],
435
+ chainName: 'opBNB',
436
+ nativeCurrency: {
437
+ name: 'BNB',
438
+ symbol: 'BNB',
439
+ decimals: 18,
440
+ },
441
+ },
442
+ },
443
+ {
444
+ chainId: 34443,
445
+ name: 'Mode',
446
+ color: '#d7ff00',
447
+ explorerUrl: 'https://explorer.mode.network',
448
+ legacySupported: false,
449
+ fakeTransactionHash: '0xb58002db3481f2c51855a91280ec940d0bebec075c4b362b9f90c21a2b14edbe',
450
+ apiURL: 'https://explorer.mode.network/api/v2',
451
+ params: {
452
+ rpcUrls: ['https://1rpc.io/mode'],
453
+ chainName: 'Mode',
454
+ nativeCurrency: {
455
+ name: 'Ethereum',
456
+ symbol: 'ETH',
457
+ decimals: 18,
458
+ },
459
+ },
460
+ get serverRpcUrl() {
461
+ return process.env?.MODE_RPC_URL || this.params.rpcUrls[0]
462
+ },
463
+ viemChain: mode,
464
+ },
465
+ {
466
+ chainId: 81457,
467
+ name: 'Blast',
468
+ color: '#78d64b',
469
+ explorerUrl: 'https://blastscan.io',
470
+ apiURL: 'https://api.blastscan.io/api',
471
+ legacySupported: false,
472
+ fakeTransactionHash: '0x934ed8516242f8c08bb9e0e90bb1f989d92ceb6b0333e86ac2d555f25ac27e58',
473
+ params: {
474
+ rpcUrls: ['https://rpc.ankr.com/blast'],
475
+ chainName: 'Blast',
476
+ nativeCurrency: {
477
+ name: 'Ethereum',
478
+ symbol: 'ETH',
479
+ decimals: 18,
480
+ },
481
+ },
482
+ get serverRpcUrl() {
483
+ return process.env?.BLAST_RPC_URL || this.params.rpcUrls[0]
484
+ },
485
+ viemChain: blast,
486
+ },
487
+ {
488
+ chainId: 59144,
489
+ name: 'Linea',
490
+ apiURL: 'https://api.lineascan.build/api',
491
+ color: '#78d64b',
492
+ explorerUrl: 'https://lineascan.build',
493
+ legacySupported: false,
494
+ params: {
495
+ rpcUrls: ['https://linea-mainnet.public.blastapi.io'],
496
+ chainName: 'Linea',
497
+ nativeCurrency: {
498
+ name: 'Linea Ether',
499
+ symbol: 'ETH',
500
+ decimals: 18,
501
+ },
502
+ },
503
+ fakeTransactionHash: '0x62d068a66eb1515a09e993200e8a495c7fead512689ba78e50523c8e83bbf5b5',
504
+ get serverRpcUrl() {
505
+ return process.env?.LINEA_RPC_URL || this.params.rpcUrls[0]
506
+ },
507
+ viemChain: linea,
508
+ ankrName: 'linea',
509
+ },
510
+ // {
511
+ // name: "Manta Pacific",
512
+ // chainId: 169,
513
+ // explorerUrl: "https://pacific-explorer.manta.network",
514
+ // params: {
515
+ // rpcUrls: ["https://pacific-rpc.manta.network/http"],
516
+ // chainName: "Manta Pacific",
517
+ // nativeCurrency: {
518
+ // name: "Ethereum",
519
+ // symbol: "ETH",
520
+ // decimals: 18,
521
+ // },
522
+ // },
523
+ // color: "#78d64b",
524
+ // fakeTransactionHash: "0x3fB128aA5AC254C8539996B11C587E521AE0d3ab",
525
+ // get serverRpcUrl() {
526
+ // return process.env?.MANTA_RPC_URL || this.params.rpcUrls[0];
527
+ // },
528
+ // },
121
529
  {
122
530
  name: AVO_PROD_CHAIN_NAME,
123
531
  chainId: AVO_PROD_CHAIN_ID,
532
+ apiURL: null,
533
+ isAvocado: true,
534
+ balanceResolverAddress: '',
535
+ fakeTransactionHash: '',
536
+ legacySupported: false,
537
+ viemChain: avocado,
538
+ color: '#16A34A',
539
+ usdcAddress: '',
540
+ serverRpcUrl: AVO_PROD_RPC_URL,
541
+ explorerUrl: AVO_PROD_EXPLORER_URL,
124
542
  params: {
125
543
  chainName: AVO_PROD_CHAIN_NAME,
126
544
  nativeCurrency: {
127
- name: "Avocado",
128
- symbol: "USDC",
545
+ name: 'Avocado',
546
+ symbol: 'USDC',
129
547
  decimals: 18,
130
548
  },
131
- iconUrls: ["https://avocado.instadapp.io/logo.svg"],
549
+ iconUrls: ['https://avocado.instadapp.io/logo.svg'],
132
550
  rpcUrls: [AVO_PROD_RPC_URL],
133
- blockExplorerUrls: ["https://avocado.instadapp.io"],
134
551
  },
135
552
  },
136
553
  {
137
554
  name: AVO_STAGING_CHAIN_NAME,
555
+ apiURL: null,
138
556
  chainId: AVO_STAGING_CHAIN_ID,
557
+ serverRpcUrl: AVO_STAGING_RPC_URL,
558
+ color: '#16A34A',
559
+ explorerUrl: AVO_STAGING_EXPLORER_URL,
560
+ legacySupported: false,
561
+ viemChain: avocadoStaging,
562
+ fakeTransactionHash: '',
563
+ isAvocado: true,
564
+ balanceResolverAddress: '',
565
+ usdcAddress: '',
139
566
  params: {
140
567
  chainName: AVO_STAGING_CHAIN_NAME,
141
568
  nativeCurrency: {
142
- name: "Avocado",
143
- symbol: "USDC",
569
+ name: 'Avocado',
570
+ symbol: 'USDC',
144
571
  decimals: 18,
145
572
  },
146
- iconUrls: ["https://avocado.instadapp.io/logo.svg"],
573
+ iconUrls: ['https://avocado.instadapp.io/logo.svg'],
147
574
  rpcUrls: [AVO_STAGING_RPC_URL],
148
- blockExplorerUrls: ["https://avocado.instadapp.io"],
149
575
  },
150
576
  },
151
- ];
577
+ ]
578
+
579
+ export const chainUsdcAddresses = [
580
+ { chainId: 1, address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' },
581
+ { chainId: 10, address: '0x7f5c764cbc14f9669b88837ca1490cca17c31607' },
582
+ { chainId: 56, address: '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d' },
583
+ { chainId: 100, address: '0xddafbb505ad214d7b80b1f830fccc89b60fb7a83' },
584
+ { chainId: 137, address: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174' },
585
+ { chainId: 137, address: '0x3c499c542cef5e3811e1192ce70d8cc03d5c3359' },
586
+ { chainId: 250, address: '0x04068da6c83afcfa0e13ba15a6696662335d5b75' },
587
+ { chainId: 42161, address: '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8' },
588
+ { chainId: 42161, address: '0xaf88d065e77c8cc2239327c5edb3a432268e5831' },
589
+ { chainId: 43114, address: '0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e' },
590
+ { chainId: 43114, address: '0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664' },
591
+ { chainId: 1101, address: '0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035' },
592
+ {
593
+ chainId: 1313161554,
594
+ address: '0xB12BFcA5A55806AaF64E99521918A4bf0fC40802',
595
+ },
596
+ { chainId: 8453, address: '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA' },
597
+ ]
152
598
 
153
- export const getNetworkByChainId = (
154
- chainId: Network["chainId"] | number | string
155
- ) => {
156
- return networks.find((i) => i.chainId === Number(chainId))!;
157
- };
599
+ export function getNetworkByChainId(chainId: ChainId | number | string): Network {
600
+ return networks.find(i => i.chainId == chainId)!
601
+ }
158
602
 
159
603
  export const availableNetworks = networks.filter(
160
- (network) =>
161
- network.chainId != AVO_STAGING_CHAIN_ID &&
162
- network.chainId != AVO_PROD_CHAIN_ID
163
- );
604
+ network => !network.isAvocado,
605
+ )
164
606
 
165
- export const chainIdToName = (chainId: ChainId | number | string) => {
166
- const network = getNetworkByChainId(chainId);
167
- return network.name;
168
- };
607
+ export function chainIdToName(chainId: ChainId | number | string) {
608
+ const network = getNetworkByChainId(chainId)
609
+ return network?.name
610
+ }
169
611
 
170
- export const getRpcURLByChainId = (chainId: ChainId | number | string) => {
171
- const network = getNetworkByChainId(chainId);
172
- return network.params.rpcUrls[0];
173
- };
612
+ export function getRpcURLByChainId(chainId: ChainId | number | string) {
613
+ try {
614
+ const network = getNetworkByChainId(chainId)
615
+ return network.params.rpcUrls[0]
616
+ }
617
+ catch (e) {
618
+ return ''
619
+ }
620
+ }
174
621
 
175
622
  export const RPCMap = networks.reduce((acc, network) => {
176
- acc[network.chainId] = network.params.rpcUrls[0];
177
- return acc;
178
- }, {} as Record<number, string>);
623
+ acc[network.chainId] = network.params.rpcUrls[0]
624
+ return acc
625
+ }, {} as Record<number, string>)
179
626
 
180
- export const networkIds = networks.map((network) => network.chainId);
627
+ export const networkIds = networks.map(network => network.chainId)
181
628
 
182
- const rpcInstances: Record<string, ethers.providers.JsonRpcProvider> = {};
629
+ const rpcInstances: Record<string, ethers.providers.StaticJsonRpcProvider> = {}
630
+ const serverRpcInstances: Record<
631
+ string,
632
+ ethers.providers.StaticJsonRpcProvider
633
+ > = {}
183
634
 
184
- export const getRpcProvider = (chainId: number | string) => {
635
+ export function getServerRpcProvider(chainId: number | string) {
185
636
  if (!rpcInstances[chainId]) {
186
- rpcInstances[chainId] = new ethers.providers.JsonRpcProvider(
187
- getRpcURLByChainId(Number(chainId))
188
- );
637
+ const network = networks.find(n => n.chainId == chainId)
638
+ serverRpcInstances[chainId] = new ethers.providers.StaticJsonRpcProvider(
639
+ network?.serverRpcUrl,
640
+ )
189
641
  }
190
642
 
191
- return rpcInstances[chainId];
192
- };
643
+ return serverRpcInstances[chainId]
644
+ }
645
+
646
+ export function getRpcProvider(chainId: number | string) {
647
+ if (!rpcInstances[chainId]) {
648
+ rpcInstances[chainId] = new ethers.providers.StaticJsonRpcProvider(
649
+ getRpcURLByChainId(Number(chainId)),
650
+ )
651
+ }
652
+
653
+ return rpcInstances[chainId]
654
+ }
655
+
656
+ export function getExplorerUrl(chainId: ChainId | number | string, suffix: `/${string}` = '/') {
657
+ const network = getNetworkByChainId(chainId)
658
+ if (!network)
659
+ return ''
660
+ return `${network.explorerUrl}${suffix}`
661
+ }