@instadapp/avocado-base 0.0.4 → 0.0.6

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.
@@ -380,6 +380,146 @@
380
380
  </defs>
381
381
  </svg>
382
382
 
383
+ <svg
384
+ v-else-if="chain == 1313161554"
385
+ width="24"
386
+ height="24"
387
+ viewBox="0 0 24 24"
388
+ fill="none"
389
+ xmlns="http://www.w3.org/2000/svg"
390
+ >
391
+ <rect
392
+ x="1"
393
+ y="1"
394
+ width="22"
395
+ height="22"
396
+ rx="11"
397
+ :fill="generateID('aurora', true)"
398
+ />
399
+ <path
400
+ d="M11.9961 7.26624C12.4182 7.26624 12.8014 7.505 12.9902 7.88257L16.1114 14.1291C16.3835 14.6788 16.1614 15.3451 15.6116 15.6172C15.4561 15.6949 15.2894 15.7338 15.1173 15.7338H8.87486C8.26395 15.7338 7.76411 15.234 7.76411 14.6233C7.76411 14.4511 7.80299 14.279 7.88074 14.1291L11.0019 7.88257C11.1908 7.49944 11.574 7.26069 11.9961 7.26624ZM11.9961 6.5C11.2852 6.5 10.6354 6.89978 10.3188 7.53831L7.19763 13.7848C6.73667 14.7121 7.10877 15.8337 8.03624 16.3001C8.29727 16.4278 8.58607 16.5 8.87486 16.5H15.1228C16.1558 16.5 17 15.6616 17 14.6288C17 14.3401 16.9334 14.0514 16.8001 13.7904L13.6733 7.53831C13.3567 6.89978 12.707 6.5 11.9961 6.5Z"
401
+ fill="white"
402
+ />
403
+ <rect
404
+ x="1"
405
+ y="1"
406
+ width="22"
407
+ height="22"
408
+ rx="11"
409
+ stroke="black"
410
+ stroke-width="2"
411
+ v-if="stroke"
412
+ :class="strokeClass"
413
+ />
414
+ <defs>
415
+ <linearGradient
416
+ :id="generateID('aurora')"
417
+ x1="12"
418
+ y1="2"
419
+ x2="12"
420
+ y2="22"
421
+ gradientUnits="userSpaceOnUse"
422
+ >
423
+ <stop stop-color="#8EEF6B" />
424
+ <stop offset="1" stop-color="#70D44B" />
425
+ </linearGradient>
426
+ </defs>
427
+ </svg>
428
+
429
+ <svg
430
+ v-else-if="chain === 250"
431
+ width="24"
432
+ height="24"
433
+ viewBox="0 0 24 24"
434
+ fill="none"
435
+ xmlns="http://www.w3.org/2000/svg"
436
+ >
437
+ <rect
438
+ x="1"
439
+ y="1"
440
+ width="22"
441
+ height="22"
442
+ rx="11"
443
+ :fill="generateID('fantom', true)"
444
+ />
445
+ <path
446
+ fill-rule="evenodd"
447
+ clip-rule="evenodd"
448
+ d="M12.75 10.0625L15 8.75V11.375L12.75 10.0625ZM15 15.6875L12 17.4375L9 15.6875V12.625L12 14.375L15 12.625V15.6875ZM9 8.75L11.25 10.0625L9 11.375V8.75ZM12.375 10.6875L14.625 12L12.375 13.3125V10.6875ZM11.625 13.3125L9.375 12L11.625 10.6875V13.3125ZM14.625 8.125L12 9.625L9.375 8.125L12 6.5625L14.625 8.125ZM8.25 7.875V16.0625L12 18.1875L15.75 16.0625V7.875L12 5.75L8.25 7.875Z"
449
+ fill="white"
450
+ />
451
+ <rect
452
+ x="1"
453
+ y="1"
454
+ width="22"
455
+ height="22"
456
+ rx="11"
457
+ stroke="black"
458
+ stroke-width="2"
459
+ v-if="stroke"
460
+ :class="strokeClass"
461
+ />
462
+ <defs>
463
+ <linearGradient
464
+ :id="generateID('fantom')"
465
+ x1="12"
466
+ y1="2"
467
+ x2="12"
468
+ y2="22"
469
+ gradientUnits="userSpaceOnUse"
470
+ >
471
+ <stop stop-color="#51D3FF" />
472
+ <stop offset="1" stop-color="#13B5EC" />
473
+ </linearGradient>
474
+ </defs>
475
+ </svg>
476
+
477
+ <svg
478
+ v-else-if="chain == 634 || chain == 63400"
479
+ width="24"
480
+ height="24"
481
+ viewBox="0 0 24 24"
482
+ fill="none"
483
+ xmlns="http://www.w3.org/2000/svg"
484
+ >
485
+ <rect
486
+ x="1"
487
+ y="1"
488
+ width="22"
489
+ height="22"
490
+ rx="11"
491
+ :fill="generateID('avo', true)"
492
+ />
493
+ <path
494
+ d="M11.9999 17.4052C11.9999 17.7497 12.2787 18.0322 12.6197 17.997C15.6422 17.6854 18 15.1194 18 12C18 8.88061 15.6422 6.31462 12.6197 6.00299C12.2787 5.96765 11.9999 6.25038 11.9999 6.59486V8.25799C11.9999 8.60246 12.2806 8.87521 12.6167 8.94319C14.0353 9.2307 15.1035 10.4899 15.1035 12C15.1035 13.5101 14.0353 14.7693 12.6167 15.0569C12.2806 15.1248 11.9999 15.3978 11.9999 15.7421V17.4052ZM10.1378 7.12664C10.1378 6.70254 9.7247 6.4036 9.34642 6.59132C7.36369 7.57527 6 9.62756 6 12C6 14.3725 7.36369 16.4248 9.34642 17.4087C9.7247 17.5964 10.1378 17.2975 10.1378 16.8734V7.12685V7.12664Z"
495
+ fill="white"
496
+ />
497
+ <rect
498
+ x="1"
499
+ y="1"
500
+ width="22"
501
+ height="22"
502
+ rx="11"
503
+ stroke="black"
504
+ stroke-width="2"
505
+ v-if="stroke"
506
+ :class="strokeClass"
507
+ />
508
+ <defs>
509
+ <linearGradient
510
+ :id="generateID('avo')"
511
+ x1="12"
512
+ y1="2"
513
+ x2="12"
514
+ y2="22"
515
+ gradientUnits="userSpaceOnUse"
516
+ >
517
+ <stop stop-color="#6ED578" />
518
+ <stop offset="1" stop-color="#4CA054" />
519
+ </linearGradient>
520
+ </defs>
521
+ </svg>
522
+
383
523
  <template v-else>
384
524
  <svg
385
525
  v-bind="$attrs"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instadapp/avocado-base",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "type": "module",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "global.d.ts",
package/utils/network.ts CHANGED
@@ -8,14 +8,14 @@ export const networks: Network[] = [
8
8
  debankName: "eth",
9
9
  ankrName: "eth",
10
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",
11
17
  params: {
12
18
  rpcUrls: ["https://rpc.ankr.com/eth"],
13
- explorerUrl: "https://etherscan.io",
14
- get serverRpcUrl() {
15
- return process.env?.MAINNET_RPC_URL || this.rpcUrls[0];
16
- },
17
- balanceResolverAddress: "0x5b7D61b389D12e1f5873d0cCEe7E675915AB5F43",
18
- usdcAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
19
19
  nativeCurrency: {
20
20
  name: "Ethereum",
21
21
  symbol: "ETH",
@@ -28,6 +28,12 @@ export const networks: Network[] = [
28
28
  debankName: "matic",
29
29
  ankrName: "polygon",
30
30
  chainId: 137,
31
+ balanceResolverAddress: "0x58632D23120b20650262b8A629a14e4F4043E0D9",
32
+ usdcAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
33
+ explorerUrl: "https://polygonscan.com",
34
+ get serverRpcUrl() {
35
+ return process.env?.POLYGON_RPC_URL || this.params.rpcUrls[0];
36
+ },
31
37
  params: {
32
38
  chainName: "Matic(Polygon) Mainnet",
33
39
  nativeCurrency: {
@@ -35,13 +41,7 @@ export const networks: Network[] = [
35
41
  symbol: "MATIC",
36
42
  decimals: 18,
37
43
  },
38
- balanceResolverAddress: "0x58632D23120b20650262b8A629a14e4F4043E0D9",
39
- usdcAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
40
44
  rpcUrls: ["https://polygon-rpc.com"],
41
- get serverRpcUrl() {
42
- return process.env?.POLYGON_RPC_URL || this.rpcUrls[0];
43
- },
44
- explorerUrl: "https://polygonscan.com",
45
45
  },
46
46
  },
47
47
  {
@@ -49,6 +49,12 @@ export const networks: Network[] = [
49
49
  debankName: "arb",
50
50
  ankrName: "arbitrum",
51
51
  chainId: 42161,
52
+ usdcAddress: "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",
53
+ balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
54
+ explorerUrl: "https://arbiscan.io",
55
+ get serverRpcUrl() {
56
+ return process.env?.ARBITRUM_RPC_URL || this.params.rpcUrls[0];
57
+ },
52
58
  params: {
53
59
  chainName: "Arbitrum One",
54
60
  nativeCurrency: {
@@ -56,13 +62,7 @@ export const networks: Network[] = [
56
62
  symbol: "ETH",
57
63
  decimals: 18,
58
64
  },
59
- usdcAddress: "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",
60
- balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
61
- get serverRpcUrl() {
62
- return process.env?.ARBITRUM_RPC_URL || this.rpcUrls[0];
63
- },
64
65
  rpcUrls: ["https://arb1.arbitrum.io/rpc"],
65
- explorerUrl: "https://arbiscan.io",
66
66
  },
67
67
  },
68
68
  {
@@ -70,6 +70,12 @@ export const networks: Network[] = [
70
70
  debankName: "op",
71
71
  ankrName: "optimism",
72
72
  chainId: 10,
73
+ usdcAddress: "0x7f5c764cbc14f9669b88837ca1490cca17c31607",
74
+ balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
75
+ explorerUrl: "https://optimistic.etherscan.io",
76
+ get serverRpcUrl() {
77
+ return process.env?.OPTIMISM_RPC_URL || this.params.rpcUrls[0];
78
+ },
73
79
  params: {
74
80
  chainName: "Optimistic Ethereum",
75
81
  nativeCurrency: {
@@ -77,13 +83,7 @@ export const networks: Network[] = [
77
83
  symbol: "ETH",
78
84
  decimals: 18,
79
85
  },
80
- usdcAddress: "0x7f5c764cbc14f9669b88837ca1490cca17c31607",
81
- balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
82
- get serverRpcUrl() {
83
- return process.env?.OPTIMISM_RPC_URL || this.rpcUrls[0];
84
- },
85
86
  rpcUrls: ["https://mainnet.optimism.io"],
86
- explorerUrl: "https://optimistic.etherscan.io",
87
87
  },
88
88
  },
89
89
  {
@@ -91,20 +91,20 @@ export const networks: Network[] = [
91
91
  debankName: "avax",
92
92
  ankrName: "avalanche",
93
93
  chainId: 43114,
94
+ usdcAddress: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
95
+ balanceResolverAddress: "0x63009f31D054E0ac9F321Cf0D642375236A4Bf1E",
96
+ explorerUrl: "https://snowtrace.io",
97
+ get serverRpcUrl() {
98
+ return process.env?.AVALANCHE_RPC_URL || this.params.rpcUrls[0];
99
+ },
94
100
  params: {
95
101
  chainName: "Avalanche Network",
96
- get serverRpcUrl() {
97
- return process.env?.AVALANCHE_RPC_URL || this.rpcUrls[0];
98
- },
99
102
  nativeCurrency: {
100
103
  name: "Avalanche",
101
104
  symbol: "AVAX",
102
105
  decimals: 18,
103
106
  },
104
- usdcAddress: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
105
- balanceResolverAddress: "0x63009f31D054E0ac9F321Cf0D642375236A4Bf1E",
106
107
  rpcUrls: ["https://api.avax.network/ext/bc/C/rpc"],
107
- explorerUrl: "https://snowtrace.io",
108
108
  },
109
109
  },
110
110
  {
@@ -112,15 +112,15 @@ export const networks: Network[] = [
112
112
  debankName: "bsc",
113
113
  ankrName: "bsc",
114
114
  chainId: 56,
115
+ explorerUrl: "https://bscscan.com",
116
+ usdcAddress: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
117
+ balanceResolverAddress: "0xb808cff38706e267067b0af427726aa099f69f89",
118
+ get serverRpcUrl() {
119
+ return process.env?.BSC_RPC_URL || this.params.rpcUrls[0];
120
+ },
115
121
  params: {
116
122
  chainName: "Binance Smart Chain",
117
- explorerUrl: "https://bscscan.com",
118
123
  rpcUrls: ["https://rpc.ankr.com/bsc"],
119
- get serverRpcUrl() {
120
- return process.env?.BSC_RPC_URL || this.rpcUrls[0];
121
- },
122
- usdcAddress: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
123
- balanceResolverAddress: "0xb808cff38706e267067b0af427726aa099f69f89",
124
124
  nativeCurrency: {
125
125
  name: "Binance Coin",
126
126
  symbol: "BNB",
@@ -133,15 +133,15 @@ export const networks: Network[] = [
133
133
  debankName: "xdai",
134
134
  ankrName: "gnosis",
135
135
  chainId: 100,
136
+ balanceResolverAddress: "0xfaa244e276b1597f663975ed007ee4ff70d27849",
137
+ explorerUrl: "https://gnosisscan.io",
138
+ usdcAddress: "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
139
+ get serverRpcUrl() {
140
+ return process.env?.GNOSIS_RPC_URL || this.params.rpcUrls[0];
141
+ },
136
142
  params: {
137
143
  chainName: "Gnosis Safe",
138
- explorerUrl: "https://gnosisscan.io",
139
144
  rpcUrls: ["https://rpc.ankr.com/gnosis"],
140
- get serverRpcUrl() {
141
- return process.env?.GNOSIS_RPC_URL || this.rpcUrls[0];
142
- },
143
- balanceResolverAddress: "0xfaa244e276b1597f663975ed007ee4ff70d27849",
144
- usdcAddress: "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
145
145
  nativeCurrency: {
146
146
  name: "xdaistable",
147
147
  symbol: "xDAI",
@@ -152,15 +152,16 @@ export const networks: Network[] = [
152
152
  {
153
153
  name: "Polygon zkEVM",
154
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
+ },
155
161
  params: {
156
162
  chainName: "polygon zkEVM",
157
- explorerUrl: "https://zkevm.polygonscan.com",
158
163
  rpcUrls: ["https://rpc.ankr.com/polygon_zkevm"],
159
- get serverRpcUrl() {
160
- return process.env?.POLYGON_ZKEVM_RPC_URL || this.rpcUrls[0];
161
- },
162
- balanceResolverAddress: "0x48D1Fa5Ee6691a1E0B45d2B515650997BEA27a01",
163
- usdcAddress: "0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035",
164
+
164
165
  nativeCurrency: {
165
166
  name: "Ethereum",
166
167
  symbol: "ETH",
@@ -168,10 +169,52 @@ export const networks: Network[] = [
168
169
  },
169
170
  },
170
171
  },
172
+ {
173
+ name: "Aurora",
174
+ chainId: 1313161554,
175
+ explorerUrl: "https://explorer.mainnet.aurora.dev",
176
+ get serverRpcUrl() {
177
+ return process.env?.AURORA_RPC_URL || this.params.rpcUrls[0];
178
+ },
179
+ usdcAddress: "0xB12BFcA5A55806AaF64E99521918A4bf0fC40802",
180
+ balanceResolverAddress: "0xdF19Da523DA64bBE82eE0E4DFf00d676A8386474",
181
+ params: {
182
+ rpcUrls: ["https://mainnet.aurora.dev"],
183
+ chainName: "Aurora",
184
+ nativeCurrency: {
185
+ decimals: 18,
186
+ name: "Aurora ETH",
187
+ symbol: "AETH",
188
+ },
189
+ },
190
+ },
191
+ {
192
+ name: "Fantom Opera",
193
+ chainId: 250,
194
+ explorerUrl: "https://ftmscan.com",
195
+ get serverRpcUrl() {
196
+ return process.env?.FANTOM_RPC_URL || this.params.rpcUrls[0];
197
+ },
198
+ usdcAddress: "0x04068da6c83afcfa0e13ba15a6696662335d5b75",
199
+ balanceResolverAddress: "0x929376c77a2fb8152375a089a4fccf84ff481479",
200
+ params: {
201
+ rpcUrls: ["https://rpc.ankr.com/fantom"],
202
+ chainName: "Fantom Opera",
203
+ nativeCurrency: {
204
+ name: "Fantom",
205
+ symbol: "FTM",
206
+ decimals: 18,
207
+ },
208
+ },
209
+ },
171
210
  {
172
211
  name: AVO_PROD_CHAIN_NAME,
173
212
  chainId: AVO_PROD_CHAIN_ID,
174
213
  isAvocado: true,
214
+ balanceResolverAddress: "",
215
+ usdcAddress: "",
216
+ serverRpcUrl: AVO_PROD_RPC_URL,
217
+ explorerUrl: AVO_PROD_EXPLORER_URL,
175
218
  params: {
176
219
  chainName: AVO_PROD_CHAIN_NAME,
177
220
  nativeCurrency: {
@@ -180,17 +223,17 @@ export const networks: Network[] = [
180
223
  decimals: 18,
181
224
  },
182
225
  iconUrls: ["https://avocado.instadapp.io/logo.svg"],
183
- balanceResolverAddress: "",
184
- usdcAddress: "",
185
- serverRpcUrl: AVO_PROD_RPC_URL,
186
226
  rpcUrls: [AVO_PROD_RPC_URL],
187
- explorerUrl: AVO_PROD_EXPLORER_URL,
188
227
  },
189
228
  },
190
229
  {
191
230
  name: AVO_STAGING_CHAIN_NAME,
192
231
  chainId: AVO_STAGING_CHAIN_ID,
232
+ serverRpcUrl: AVO_STAGING_RPC_URL,
233
+ explorerUrl: AVO_STAGING_EXPLORER_URL,
193
234
  isAvocado: true,
235
+ balanceResolverAddress: "",
236
+ usdcAddress: "",
194
237
  params: {
195
238
  chainName: AVO_STAGING_CHAIN_NAME,
196
239
  nativeCurrency: {
@@ -198,12 +241,8 @@ export const networks: Network[] = [
198
241
  symbol: "USDC",
199
242
  decimals: 18,
200
243
  },
201
- serverRpcUrl: AVO_STAGING_RPC_URL,
202
- balanceResolverAddress: "",
203
- usdcAddress: "",
204
244
  iconUrls: ["https://avocado.instadapp.io/logo.svg"],
205
245
  rpcUrls: [AVO_STAGING_RPC_URL],
206
- explorerUrl: AVO_STAGING_EXPLORER_URL,
207
246
  },
208
247
  },
209
248
  ];
@@ -242,7 +281,7 @@ export const getServerRpcProvider = (chainId: number | string) => {
242
281
  if (!rpcInstances[chainId]) {
243
282
  const network = networks.find((n) => n.chainId == chainId);
244
283
  serverRpcInstances[chainId] = new ethers.providers.JsonRpcProvider(
245
- network?.params.serverRpcUrl
284
+ network?.serverRpcUrl
246
285
  );
247
286
  }
248
287
 
@@ -264,5 +303,5 @@ export const getExplorerUrl = (
264
303
  suffix: `/${string}` = "/"
265
304
  ) => {
266
305
  const network = getNetworkByChainId(chainId);
267
- return `${network.params.explorerUrl}${suffix}`;
306
+ return `${network.explorerUrl}${suffix}`;
268
307
  };
package/utils/utils.d.ts CHANGED
@@ -1,4 +1,16 @@
1
- type ChainId = 1 | 137 | 42161 | 10 | 56 | 43114 | 100 | 1101 | 634 | 63400;
1
+ type ChainId =
2
+ | 1
3
+ | 137
4
+ | 42161
5
+ | 10
6
+ | 56
7
+ | 43114
8
+ | 100
9
+ | 1101
10
+ | 250
11
+ | 634
12
+ | 1313161554
13
+ | 63400;
2
14
 
3
15
  type ISlackMessageType = "danger" | "error" | "success" | "banner";
4
16
 
@@ -8,14 +20,14 @@ interface Network {
8
20
  ankrName?: string;
9
21
  chainId: ChainId;
10
22
  isAvocado?: boolean;
23
+ serverRpcUrl: string | undefined;
24
+ balanceResolverAddress?: string;
25
+ usdcAddress: string;
26
+ explorerUrl: string;
11
27
  params: {
12
28
  chainName?: string;
13
- rpcUrls: string[];
14
- serverRpcUrl: string | undefined;
15
- balanceResolverAddress?: string;
16
- usdcAddress: string;
17
- explorerUrl: string;
18
29
  iconUrls?: string[];
30
+ rpcUrls: string[];
19
31
  nativeCurrency?: {
20
32
  name: string;
21
33
  symbol: string;