@instadapp/avocado-base 0.0.4 → 0.0.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instadapp/avocado-base",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
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",
@@ -172,6 +173,10 @@ export const networks: Network[] = [
172
173
  name: AVO_PROD_CHAIN_NAME,
173
174
  chainId: AVO_PROD_CHAIN_ID,
174
175
  isAvocado: true,
176
+ balanceResolverAddress: "",
177
+ usdcAddress: "",
178
+ serverRpcUrl: AVO_PROD_RPC_URL,
179
+ explorerUrl: AVO_PROD_EXPLORER_URL,
175
180
  params: {
176
181
  chainName: AVO_PROD_CHAIN_NAME,
177
182
  nativeCurrency: {
@@ -180,17 +185,17 @@ export const networks: Network[] = [
180
185
  decimals: 18,
181
186
  },
182
187
  iconUrls: ["https://avocado.instadapp.io/logo.svg"],
183
- balanceResolverAddress: "",
184
- usdcAddress: "",
185
- serverRpcUrl: AVO_PROD_RPC_URL,
186
188
  rpcUrls: [AVO_PROD_RPC_URL],
187
- explorerUrl: AVO_PROD_EXPLORER_URL,
188
189
  },
189
190
  },
190
191
  {
191
192
  name: AVO_STAGING_CHAIN_NAME,
192
193
  chainId: AVO_STAGING_CHAIN_ID,
194
+ serverRpcUrl: AVO_STAGING_RPC_URL,
195
+ explorerUrl: AVO_STAGING_EXPLORER_URL,
193
196
  isAvocado: true,
197
+ balanceResolverAddress: "",
198
+ usdcAddress: "",
194
199
  params: {
195
200
  chainName: AVO_STAGING_CHAIN_NAME,
196
201
  nativeCurrency: {
@@ -198,12 +203,8 @@ export const networks: Network[] = [
198
203
  symbol: "USDC",
199
204
  decimals: 18,
200
205
  },
201
- serverRpcUrl: AVO_STAGING_RPC_URL,
202
- balanceResolverAddress: "",
203
- usdcAddress: "",
204
206
  iconUrls: ["https://avocado.instadapp.io/logo.svg"],
205
207
  rpcUrls: [AVO_STAGING_RPC_URL],
206
- explorerUrl: AVO_STAGING_EXPLORER_URL,
207
208
  },
208
209
  },
209
210
  ];
@@ -242,7 +243,7 @@ export const getServerRpcProvider = (chainId: number | string) => {
242
243
  if (!rpcInstances[chainId]) {
243
244
  const network = networks.find((n) => n.chainId == chainId);
244
245
  serverRpcInstances[chainId] = new ethers.providers.JsonRpcProvider(
245
- network?.params.serverRpcUrl
246
+ network?.serverRpcUrl
246
247
  );
247
248
  }
248
249
 
@@ -264,5 +265,5 @@ export const getExplorerUrl = (
264
265
  suffix: `/${string}` = "/"
265
266
  ) => {
266
267
  const network = getNetworkByChainId(chainId);
267
- return `${network.params.explorerUrl}${suffix}`;
268
+ return `${network.explorerUrl}${suffix}`;
268
269
  };
package/utils/utils.d.ts CHANGED
@@ -8,14 +8,14 @@ interface Network {
8
8
  ankrName?: string;
9
9
  chainId: ChainId;
10
10
  isAvocado?: boolean;
11
+ serverRpcUrl: string | undefined;
12
+ balanceResolverAddress?: string;
13
+ usdcAddress: string;
14
+ explorerUrl: string;
11
15
  params: {
12
16
  chainName?: string;
13
- rpcUrls: string[];
14
- serverRpcUrl: string | undefined;
15
- balanceResolverAddress?: string;
16
- usdcAddress: string;
17
- explorerUrl: string;
18
17
  iconUrls?: string[];
18
+ rpcUrls: string[];
19
19
  nativeCurrency?: {
20
20
  name: string;
21
21
  symbol: string;