@instadapp/avocado-base 0.0.0-dev.312663d → 0.0.0-dev.31df1b6

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.312663d",
3
+ "version": "0.0.0-dev.31df1b6",
4
4
  "type": "module",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "global.d.ts",
package/utils/helper.ts CHANGED
@@ -1,5 +1,3 @@
1
- import * as XXH from 'xxhashjs';
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): string {
66
- const hash = XXH.h32(address, 0xABCD).toNumber()
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,6 @@
1
1
  import { ethers, utils } from "ethers";
2
- import { Forwarder__factory } from "../contracts";
2
+ import { Forwarder__factory, MultisigForwarder__factory } from "../contracts";
3
+ import { toBN } from "./bignumber";
3
4
 
4
5
  export const MetadataEnums = {
5
6
  "transfer": "transfer",
@@ -346,8 +347,10 @@ export const decodeMetadata = (metadata: string) => {
346
347
  }
347
348
  };
348
349
 
350
+ const iface = Forwarder__factory.createInterface();
351
+ const ifaceMultisig = MultisigForwarder__factory.createInterface();
352
+
349
353
  const getMetadataFromData = (data: string) => {
350
- const iface = Forwarder__factory.createInterface();
351
354
  let metadata = "0x";
352
355
 
353
356
  if (data.startsWith("0x18e7f485")) {
@@ -367,28 +370,18 @@ const getMetadataFromData = (data: string) => {
367
370
  } else {
368
371
  metadata = executeDataV2.params_.metadata;
369
372
  }
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
373
  } else {
381
- const executeDataMultisigV3 = iface.decodeFunctionData(
382
- "executeMultisigV3",
374
+ const executeDataMultisig = ifaceMultisig.decodeFunctionData(
375
+ "executeV1",
383
376
  data
384
377
  );
385
378
  if (
386
- executeDataMultisigV3.params_.metadata === "0x" ||
387
- !executeDataMultisigV3.params_.metadata
379
+ executeDataMultisig.params_.metadata === "0x" ||
380
+ !executeDataMultisig.params_.metadata
388
381
  ) {
389
382
  return null;
390
383
  } else {
391
- metadata = executeDataMultisigV3.params_.metadata;
384
+ metadata = executeDataMultisig.params_.metadata;
392
385
  }
393
386
  }
394
387
 
package/utils/network.ts CHANGED
@@ -1,30 +1,20 @@
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
- export const bridgeDisabledNetworks = [1101];
13
+ export const bridgeDisabledNetworks = [];
14
+
15
+ export const networksSimulationNotSupported = [1313161554, 1101]
4
16
 
5
17
  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
18
  {
29
19
  name: "Polygon",
30
20
  debankName: "matic",
@@ -35,6 +25,7 @@ export const networks: Network[] = [
35
25
  balanceResolverAddress: "0x58632D23120b20650262b8A629a14e4F4043E0D9",
36
26
  usdcAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
37
27
  explorerUrl: "https://polygonscan.com",
28
+ apiURL: 'https://api.polygonscan.com',
38
29
  get serverRpcUrl() {
39
30
  return process.env?.POLYGON_RPC_URL || this.params.rpcUrls[0];
40
31
  },
@@ -58,6 +49,7 @@ export const networks: Network[] = [
58
49
  usdcAddress: "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",
59
50
  balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
60
51
  explorerUrl: "https://arbiscan.io",
52
+ apiURL: 'https://api.arbiscan.io',
61
53
  get serverRpcUrl() {
62
54
  return process.env?.ARBITRUM_RPC_URL || this.params.rpcUrls[0];
63
55
  },
@@ -71,6 +63,50 @@ export const networks: Network[] = [
71
63
  rpcUrls: ["https://arb1.arbitrum.io/rpc"],
72
64
  },
73
65
  },
66
+ {
67
+ name: "Ethereum",
68
+ debankName: "eth",
69
+ ankrName: "eth",
70
+ zerionName: "ethereum",
71
+ chainId: 1,
72
+ explorerUrl: "https://etherscan.io",
73
+ apiURL: 'https://api.etherscan.io',
74
+ color: "#5D5FEF",
75
+ get serverRpcUrl() {
76
+ return process.env?.MAINNET_RPC_URL || this.params.rpcUrls[0];
77
+ },
78
+ balanceResolverAddress: "0x5b7D61b389D12e1f5873d0cCEe7E675915AB5F43",
79
+ usdcAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
80
+ params: {
81
+ rpcUrls: ["https://rpc.ankr.com/eth"],
82
+ nativeCurrency: {
83
+ name: "Ethereum",
84
+ symbol: "ETH",
85
+ decimals: 18,
86
+ },
87
+ },
88
+ },
89
+ {
90
+ name: 'Base',
91
+ chainId: 8453,
92
+ color: '#1E2024',
93
+ explorerUrl: 'https://basescan.org',
94
+ apiURL: 'https://api.basescan.org',
95
+ get serverRpcUrl() {
96
+ return process.env?.BASE_RPC_URL || this.params.rpcUrls[0];
97
+ },
98
+ usdcAddress: '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA',
99
+ balanceResolverAddress: '0x23c8EAb8a4373dD16b0947Ebe8bf76Ff7A49d13C',
100
+ params: {
101
+ rpcUrls: ['https://rpc.ankr.com/base'],
102
+ chainName: "Base",
103
+ nativeCurrency: {
104
+ name: "Ethereum",
105
+ symbol: "ETH",
106
+ decimals: 18,
107
+ },
108
+ }
109
+ },
74
110
  {
75
111
  name: "Optimism",
76
112
  debankName: "op",
@@ -78,6 +114,7 @@ export const networks: Network[] = [
78
114
  zerionName: "optimism",
79
115
  color: "#FF0420",
80
116
  chainId: 10,
117
+ apiURL: 'https://api-optimistic.etherscan.io',
81
118
  usdcAddress: "0x7f5c764cbc14f9669b88837ca1490cca17c31607",
82
119
  balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
83
120
  explorerUrl: "https://optimistic.etherscan.io",
@@ -95,26 +132,24 @@ export const networks: Network[] = [
95
132
  },
96
133
  },
97
134
  {
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",
135
+ name: "Polygon zkEVM",
136
+ chainId: 1101,
137
+ color: "#8544f6",
138
+ explorerUrl: "https://zkevm.polygonscan.com",
139
+ apiURL: 'https://api-zkevm.polygonscan.com',
140
+ balanceResolverAddress: "0x48D1Fa5Ee6691a1E0B45d2B515650997BEA27a01",
141
+ usdcAddress: "0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035",
107
142
  get serverRpcUrl() {
108
- return process.env?.AVALANCHE_RPC_URL || this.params.rpcUrls[0];
143
+ return process.env?.POLYGON_ZKEVM_RPC_URL || this.params.rpcUrls[0];
109
144
  },
110
145
  params: {
111
- chainName: "Avalanche Network",
146
+ chainName: "polygon zkEVM",
147
+ rpcUrls: ["https://zkevm-rpc.com"],
112
148
  nativeCurrency: {
113
- name: "Avalanche",
114
- symbol: "AVAX",
149
+ name: "Ethereum",
150
+ symbol: "ETH",
115
151
  decimals: 18,
116
152
  },
117
- rpcUrls: ["https://rpc.ankr.com/avalanche"],
118
153
  },
119
154
  },
120
155
  {
@@ -125,6 +160,7 @@ export const networks: Network[] = [
125
160
  color: "#F3BA2F",
126
161
  chainId: 56,
127
162
  explorerUrl: "https://bscscan.com",
163
+ apiURL: 'https://api.bscscan.com',
128
164
  usdcAddress: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
129
165
  balanceResolverAddress: "0xb808cff38706e267067b0af427726aa099f69f89",
130
166
  get serverRpcUrl() {
@@ -140,6 +176,52 @@ export const networks: Network[] = [
140
176
  },
141
177
  },
142
178
  },
179
+ {
180
+ name: "Avalanche",
181
+ debankName: "avax",
182
+ ankrName: "avalanche",
183
+ zerionName: "avalanche",
184
+ color: "#EB5757",
185
+ chainId: 43114,
186
+ usdcAddress: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
187
+ balanceResolverAddress: "0x63009f31D054E0ac9F321Cf0D642375236A4Bf1E",
188
+ explorerUrl: "https://snowtrace.io",
189
+ apiURL: 'https://api.snowtrace.io',
190
+ get serverRpcUrl() {
191
+ return process.env?.AVALANCHE_RPC_URL || this.params.rpcUrls[0];
192
+ },
193
+ params: {
194
+ chainName: "Avalanche Network",
195
+ nativeCurrency: {
196
+ name: "Avalanche",
197
+ symbol: "AVAX",
198
+ decimals: 18,
199
+ },
200
+ rpcUrls: ["https://rpc.ankr.com/avalanche"],
201
+ },
202
+ },
203
+ {
204
+ name: "Fantom",
205
+ chainId: 250,
206
+ zerionName: "fantom",
207
+ explorerUrl: "https://ftmscan.com",
208
+ ankrName: "fantom",
209
+ color: "#1969ff",
210
+ get serverRpcUrl() {
211
+ return process.env?.FANTOM_RPC_URL || this.params.rpcUrls[0];
212
+ },
213
+ usdcAddress: "0x04068da6c83afcfa0e13ba15a6696662335d5b75",
214
+ balanceResolverAddress: "0x929376c77a2fb8152375a089a4fccf84ff481479",
215
+ params: {
216
+ rpcUrls: ["https://rpc.ankr.com/fantom"],
217
+ chainName: "Fantom",
218
+ nativeCurrency: {
219
+ name: "Fantom",
220
+ symbol: "FTM",
221
+ decimals: 18,
222
+ },
223
+ },
224
+ },
143
225
  {
144
226
  name: "Gnosis",
145
227
  debankName: "xdai",
@@ -148,6 +230,7 @@ export const networks: Network[] = [
148
230
  chainId: 100,
149
231
  balanceResolverAddress: "0xfaa244e276b1597f663975ed007ee4ff70d27849",
150
232
  explorerUrl: "https://gnosisscan.io",
233
+ apiURL:'https://api.gnosisscan.io',
151
234
  usdcAddress: "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
152
235
  get serverRpcUrl() {
153
236
  return process.env?.GNOSIS_RPC_URL || this.params.rpcUrls[0];
@@ -162,26 +245,6 @@ export const networks: Network[] = [
162
245
  },
163
246
  },
164
247
  },
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
248
  {
186
249
  name: "Aurora",
187
250
  chainId: 1313161554,
@@ -203,48 +266,6 @@ export const networks: Network[] = [
203
266
  },
204
267
  },
205
268
  },
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
269
  {
249
270
  name: AVO_PROD_CHAIN_NAME,
250
271
  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[];