@instadapp/avocado-base 0.0.0-dev.fadc946 → 0.0.0-dev.fcdcc0f

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.
@@ -6,9 +6,11 @@ export type { BalanceResolver } from "./BalanceResolver";
6
6
  export type { Erc20 } from "./Erc20";
7
7
  export type { Forwarder } from "./Forwarder";
8
8
  export type { GaslessWallet } from "./GaslessWallet";
9
+ export type { MultisigForwarder } from "./MultisigForwarder";
9
10
  export * as factories from "./factories";
10
11
  export { AvoFactoryProxy__factory } from "./factories/AvoFactoryProxy__factory";
11
12
  export { BalanceResolver__factory } from "./factories/BalanceResolver__factory";
12
13
  export { Erc20__factory } from "./factories/Erc20__factory";
13
14
  export { Forwarder__factory } from "./factories/Forwarder__factory";
14
15
  export { GaslessWallet__factory } from "./factories/GaslessWallet__factory";
16
+ export { MultisigForwarder__factory } from "./factories/MultisigForwarder__factory";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instadapp/avocado-base",
3
- "version": "0.0.0-dev.fadc946",
3
+ "version": "0.0.0-dev.fcdcc0f",
4
4
  "type": "module",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "global.d.ts",
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "@vueuse/nuxt": "^10.2.0",
28
28
  "bignumber.js": "^9.1.1",
29
- "crypto-js": "^4.1.1",
30
- "ethers": "^5.7.2"
29
+ "ethers": "^5.7.2",
30
+ "xxhashjs": "^0.2.2"
31
31
  }
32
32
  }
package/utils/helper.ts CHANGED
@@ -1,5 +1,3 @@
1
- import * as CryptoJS from 'crypto-js';
2
-
3
1
  export const indexSorter = (aIndex: number, bIndex: number) => {
4
2
  if (aIndex === -1 && bIndex === -1) {
5
3
  return 0; // fallback to other sorting criteria
@@ -62,12 +60,3 @@ export function formatMultipleAddresses(addresses: string[], shorten = true) {
62
60
  return formattedString
63
61
  }
64
62
 
65
- export function generateColor(address: string) {
66
- const hash = parseInt(CryptoJS.MD5(address).toString().substr(0, 8), 16);
67
-
68
- const hue = hash % 360;
69
- const saturation = 80 + (hash % 30);
70
- const lightness = 70 + (hash % 20);
71
-
72
- return `hsl(${hue}, ${saturation}%, ${lightness}%)`;
73
- }
package/utils/metadata.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ethers, utils } from "ethers";
2
- import { Forwarder__factory } from "../contracts";
2
+ import { Forwarder__factory, MultisigForwarder__factory } from "../contracts";
3
3
 
4
4
  export const MetadataEnums = {
5
5
  "transfer": "transfer",
@@ -346,8 +346,10 @@ export const decodeMetadata = (metadata: string) => {
346
346
  }
347
347
  };
348
348
 
349
+ const iface = Forwarder__factory.createInterface();
350
+ const ifaceMultisig = MultisigForwarder__factory.createInterface();
351
+
349
352
  const getMetadataFromData = (data: string) => {
350
- const iface = Forwarder__factory.createInterface();
351
353
  let metadata = "0x";
352
354
 
353
355
  if (data.startsWith("0x18e7f485")) {
@@ -367,28 +369,18 @@ const getMetadataFromData = (data: string) => {
367
369
  } else {
368
370
  metadata = executeDataV2.params_.metadata;
369
371
  }
370
- } else if (data.startsWith("0x85114d53")) {
371
- const executeDataV3 = iface.decodeFunctionData("executeV3", data);
372
- if (
373
- executeDataV3.params_.metadata === "0x" ||
374
- !executeDataV3.params_.metadata
375
- ) {
376
- return null;
377
- } else {
378
- metadata = executeDataV3.params_.metadata;
379
- }
380
372
  } else {
381
- const executeDataMultisigV3 = iface.decodeFunctionData(
382
- "executeMultisigV3",
373
+ const executeDataMultisig = ifaceMultisig.decodeFunctionData(
374
+ "executeV1",
383
375
  data
384
376
  );
385
377
  if (
386
- executeDataMultisigV3.params_.metadata === "0x" ||
387
- !executeDataMultisigV3.params_.metadata
378
+ executeDataMultisig.params_.metadata === "0x" ||
379
+ !executeDataMultisig.params_.metadata
388
380
  ) {
389
381
  return null;
390
382
  } else {
391
- metadata = executeDataMultisigV3.params_.metadata;
383
+ metadata = executeDataMultisig.params_.metadata;
392
384
  }
393
385
  }
394
386
 
package/utils/network.ts CHANGED
@@ -1,30 +1,18 @@
1
1
  import { ethers } from "ethers";
2
+ import {
3
+ AVO_PROD_CHAIN_NAME,
4
+ AVO_PROD_CHAIN_ID,
5
+ AVO_PROD_RPC_URL,
6
+ AVO_PROD_EXPLORER_URL,
7
+ AVO_STAGING_CHAIN_NAME,
8
+ AVO_STAGING_CHAIN_ID,
9
+ AVO_STAGING_RPC_URL,
10
+ AVO_STAGING_EXPLORER_URL,
11
+ } from './avocado'
2
12
 
3
13
  export const bridgeDisabledNetworks = [1101];
4
14
 
5
15
  export const networks: Network[] = [
6
- {
7
- name: "Ethereum",
8
- debankName: "eth",
9
- ankrName: "eth",
10
- zerionName: "ethereum",
11
- chainId: 1,
12
- explorerUrl: "https://etherscan.io",
13
- color: "#5D5FEF",
14
- get serverRpcUrl() {
15
- return process.env?.MAINNET_RPC_URL || this.params.rpcUrls[0];
16
- },
17
- balanceResolverAddress: "0x5b7D61b389D12e1f5873d0cCEe7E675915AB5F43",
18
- usdcAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
19
- params: {
20
- rpcUrls: ["https://rpc.ankr.com/eth"],
21
- nativeCurrency: {
22
- name: "Ethereum",
23
- symbol: "ETH",
24
- decimals: 18,
25
- },
26
- },
27
- },
28
16
  {
29
17
  name: "Polygon",
30
18
  debankName: "matic",
@@ -35,6 +23,7 @@ export const networks: Network[] = [
35
23
  balanceResolverAddress: "0x58632D23120b20650262b8A629a14e4F4043E0D9",
36
24
  usdcAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
37
25
  explorerUrl: "https://polygonscan.com",
26
+ apiURL: 'https://api.polygonscan.com',
38
27
  get serverRpcUrl() {
39
28
  return process.env?.POLYGON_RPC_URL || this.params.rpcUrls[0];
40
29
  },
@@ -58,6 +47,7 @@ export const networks: Network[] = [
58
47
  usdcAddress: "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",
59
48
  balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
60
49
  explorerUrl: "https://arbiscan.io",
50
+ apiURL: 'https://api.arbiscan.io',
61
51
  get serverRpcUrl() {
62
52
  return process.env?.ARBITRUM_RPC_URL || this.params.rpcUrls[0];
63
53
  },
@@ -71,6 +61,50 @@ export const networks: Network[] = [
71
61
  rpcUrls: ["https://arb1.arbitrum.io/rpc"],
72
62
  },
73
63
  },
64
+ {
65
+ name: "Ethereum",
66
+ debankName: "eth",
67
+ ankrName: "eth",
68
+ zerionName: "ethereum",
69
+ chainId: 1,
70
+ explorerUrl: "https://etherscan.io",
71
+ apiURL: 'https://api.etherscan.io',
72
+ color: "#5D5FEF",
73
+ get serverRpcUrl() {
74
+ return process.env?.MAINNET_RPC_URL || this.params.rpcUrls[0];
75
+ },
76
+ balanceResolverAddress: "0x5b7D61b389D12e1f5873d0cCEe7E675915AB5F43",
77
+ usdcAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
78
+ params: {
79
+ rpcUrls: ["https://rpc.ankr.com/eth"],
80
+ nativeCurrency: {
81
+ name: "Ethereum",
82
+ symbol: "ETH",
83
+ decimals: 18,
84
+ },
85
+ },
86
+ },
87
+ {
88
+ name: 'Base',
89
+ chainId: 8453,
90
+ color: '#1E2024',
91
+ explorerUrl: 'https://basescan.org',
92
+ apiURL: 'https://api.basescan.org',
93
+ get serverRpcUrl() {
94
+ return process.env?.BASE_RPC_URL || this.params.rpcUrls[0];
95
+ },
96
+ usdcAddress: '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA',
97
+ balanceResolverAddress: '0x23c8EAb8a4373dD16b0947Ebe8bf76Ff7A49d13C',
98
+ params: {
99
+ rpcUrls: ['https://rpc.ankr.com/base'],
100
+ chainName: "Base",
101
+ nativeCurrency: {
102
+ name: "Ethereum",
103
+ symbol: "ETH",
104
+ decimals: 18,
105
+ },
106
+ }
107
+ },
74
108
  {
75
109
  name: "Optimism",
76
110
  debankName: "op",
@@ -78,6 +112,7 @@ export const networks: Network[] = [
78
112
  zerionName: "optimism",
79
113
  color: "#FF0420",
80
114
  chainId: 10,
115
+ apiURL: 'https://api-optimistic.etherscan.io',
81
116
  usdcAddress: "0x7f5c764cbc14f9669b88837ca1490cca17c31607",
82
117
  balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
83
118
  explorerUrl: "https://optimistic.etherscan.io",
@@ -95,26 +130,24 @@ export const networks: Network[] = [
95
130
  },
96
131
  },
97
132
  {
98
- name: "Avalanche",
99
- debankName: "avax",
100
- ankrName: "avalanche",
101
- zerionName: "avalanche",
102
- color: "#EB5757",
103
- chainId: 43114,
104
- usdcAddress: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
105
- balanceResolverAddress: "0x63009f31D054E0ac9F321Cf0D642375236A4Bf1E",
106
- explorerUrl: "https://snowtrace.io",
133
+ name: "Polygon zkEVM",
134
+ chainId: 1101,
135
+ color: "#8544f6",
136
+ explorerUrl: "https://zkevm.polygonscan.com",
137
+ apiURL: 'https://api-zkevm.polygonscan.com',
138
+ balanceResolverAddress: "0x48D1Fa5Ee6691a1E0B45d2B515650997BEA27a01",
139
+ usdcAddress: "0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035",
107
140
  get serverRpcUrl() {
108
- return process.env?.AVALANCHE_RPC_URL || this.params.rpcUrls[0];
141
+ return process.env?.POLYGON_ZKEVM_RPC_URL || this.params.rpcUrls[0];
109
142
  },
110
143
  params: {
111
- chainName: "Avalanche Network",
144
+ chainName: "polygon zkEVM",
145
+ rpcUrls: ["https://zkevm-rpc.com"],
112
146
  nativeCurrency: {
113
- name: "Avalanche",
114
- symbol: "AVAX",
147
+ name: "Ethereum",
148
+ symbol: "ETH",
115
149
  decimals: 18,
116
150
  },
117
- rpcUrls: ["https://rpc.ankr.com/avalanche"],
118
151
  },
119
152
  },
120
153
  {
@@ -125,6 +158,7 @@ export const networks: Network[] = [
125
158
  color: "#F3BA2F",
126
159
  chainId: 56,
127
160
  explorerUrl: "https://bscscan.com",
161
+ apiURL: 'https://api.bscscan.com',
128
162
  usdcAddress: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
129
163
  balanceResolverAddress: "0xb808cff38706e267067b0af427726aa099f69f89",
130
164
  get serverRpcUrl() {
@@ -140,6 +174,52 @@ export const networks: Network[] = [
140
174
  },
141
175
  },
142
176
  },
177
+ {
178
+ name: "Avalanche",
179
+ debankName: "avax",
180
+ ankrName: "avalanche",
181
+ zerionName: "avalanche",
182
+ color: "#EB5757",
183
+ chainId: 43114,
184
+ usdcAddress: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
185
+ balanceResolverAddress: "0x63009f31D054E0ac9F321Cf0D642375236A4Bf1E",
186
+ explorerUrl: "https://snowtrace.io",
187
+ apiURL: 'https://api.snowtrace.io',
188
+ get serverRpcUrl() {
189
+ return process.env?.AVALANCHE_RPC_URL || this.params.rpcUrls[0];
190
+ },
191
+ params: {
192
+ chainName: "Avalanche Network",
193
+ nativeCurrency: {
194
+ name: "Avalanche",
195
+ symbol: "AVAX",
196
+ decimals: 18,
197
+ },
198
+ rpcUrls: ["https://rpc.ankr.com/avalanche"],
199
+ },
200
+ },
201
+ {
202
+ name: "Fantom",
203
+ chainId: 250,
204
+ zerionName: "fantom",
205
+ explorerUrl: "https://ftmscan.com",
206
+ ankrName: "fantom",
207
+ color: "#1969ff",
208
+ get serverRpcUrl() {
209
+ return process.env?.FANTOM_RPC_URL || this.params.rpcUrls[0];
210
+ },
211
+ usdcAddress: "0x04068da6c83afcfa0e13ba15a6696662335d5b75",
212
+ balanceResolverAddress: "0x929376c77a2fb8152375a089a4fccf84ff481479",
213
+ params: {
214
+ rpcUrls: ["https://rpc.ankr.com/fantom"],
215
+ chainName: "Fantom",
216
+ nativeCurrency: {
217
+ name: "Fantom",
218
+ symbol: "FTM",
219
+ decimals: 18,
220
+ },
221
+ },
222
+ },
143
223
  {
144
224
  name: "Gnosis",
145
225
  debankName: "xdai",
@@ -148,6 +228,7 @@ export const networks: Network[] = [
148
228
  chainId: 100,
149
229
  balanceResolverAddress: "0xfaa244e276b1597f663975ed007ee4ff70d27849",
150
230
  explorerUrl: "https://gnosisscan.io",
231
+ apiURL:'https://api.gnosisscan.io',
151
232
  usdcAddress: "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
152
233
  get serverRpcUrl() {
153
234
  return process.env?.GNOSIS_RPC_URL || this.params.rpcUrls[0];
@@ -162,26 +243,6 @@ export const networks: Network[] = [
162
243
  },
163
244
  },
164
245
  },
165
- {
166
- name: "Polygon zkEVM",
167
- chainId: 1101,
168
- color: "#8544f6",
169
- explorerUrl: "https://zkevm.polygonscan.com",
170
- balanceResolverAddress: "0x48D1Fa5Ee6691a1E0B45d2B515650997BEA27a01",
171
- usdcAddress: "0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035",
172
- get serverRpcUrl() {
173
- return process.env?.POLYGON_ZKEVM_RPC_URL || this.params.rpcUrls[0];
174
- },
175
- params: {
176
- chainName: "polygon zkEVM",
177
- rpcUrls: ["https://zkevm-rpc.com"],
178
- nativeCurrency: {
179
- name: "Ethereum",
180
- symbol: "ETH",
181
- decimals: 18,
182
- },
183
- },
184
- },
185
246
  {
186
247
  name: "Aurora",
187
248
  chainId: 1313161554,
@@ -203,48 +264,6 @@ export const networks: Network[] = [
203
264
  },
204
265
  },
205
266
  },
206
- {
207
- name: "Fantom",
208
- chainId: 250,
209
- zerionName: "fantom",
210
- explorerUrl: "https://ftmscan.com",
211
- ankrName: "fantom",
212
- color: "#1969ff",
213
- get serverRpcUrl() {
214
- return process.env?.FANTOM_RPC_URL || this.params.rpcUrls[0];
215
- },
216
- usdcAddress: "0x04068da6c83afcfa0e13ba15a6696662335d5b75",
217
- balanceResolverAddress: "0x929376c77a2fb8152375a089a4fccf84ff481479",
218
- params: {
219
- rpcUrls: ["https://rpc.ankr.com/fantom"],
220
- chainName: "Fantom",
221
- nativeCurrency: {
222
- name: "Fantom",
223
- symbol: "FTM",
224
- decimals: 18,
225
- },
226
- },
227
- },
228
- {
229
- name: 'Base',
230
- chainId: 8453,
231
- color: '#1E2024',
232
- explorerUrl: 'https://basescan.org',
233
- get serverRpcUrl() {
234
- return process.env?.BASE_RPC_URL || this.params.rpcUrls[0];
235
- },
236
- usdcAddress: '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA',
237
- balanceResolverAddress: '0x23c8EAb8a4373dD16b0947Ebe8bf76Ff7A49d13C',
238
- params: {
239
- rpcUrls: ['https://rpc.ankr.com/base'],
240
- chainName: "Base",
241
- nativeCurrency: {
242
- name: "Ethereum",
243
- symbol: "ETH",
244
- decimals: 18,
245
- },
246
- }
247
- },
248
267
  {
249
268
  name: AVO_PROD_CHAIN_NAME,
250
269
  chainId: AVO_PROD_CHAIN_ID,
package/utils/utils.d.ts CHANGED
@@ -34,6 +34,7 @@ declare global {
34
34
  balanceResolverAddress?: string;
35
35
  usdcAddress: string;
36
36
  explorerUrl: string;
37
+ apiURL?: string;
37
38
  params: {
38
39
  chainName?: string;
39
40
  iconUrls?: string[];