@instadapp/avocado-base 0.0.0-dev.fc86158 → 0.0.0-dev.fd1507c
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/abi/forwarder.json +1253 -149
- package/assets/images/icons/arrow-left.svg +5 -0
- package/assets/images/icons/arrow-right.svg +5 -0
- package/assets/images/icons/avocado.svg +4 -0
- package/assets/images/icons/bridge-2.svg +3 -0
- package/assets/images/icons/bridge.svg +7 -0
- package/assets/images/icons/calendar.svg +8 -0
- package/assets/images/icons/check-circle.svg +4 -0
- package/assets/images/icons/chevron-down.svg +4 -0
- package/assets/images/icons/clipboard.svg +7 -0
- package/assets/images/icons/clock-circle.svg +5 -0
- package/assets/images/icons/copy.svg +5 -0
- package/assets/images/icons/error-circle.svg +6 -0
- package/assets/images/icons/exclamation-circle.svg +13 -0
- package/assets/images/icons/exclamation-octagon.svg +13 -0
- package/assets/images/icons/exclamation-triangle.svg +5 -0
- package/assets/images/icons/external-link.svg +6 -0
- package/assets/images/icons/eye.svg +4 -0
- package/assets/images/icons/flowers.svg +8 -0
- package/assets/images/icons/gas-emoji.svg +193 -0
- package/assets/images/icons/gas.svg +7 -0
- package/assets/images/icons/gift.svg +153 -0
- package/assets/images/icons/globe.svg +110 -0
- package/assets/images/icons/hamburger.svg +6 -0
- package/assets/images/icons/logout.svg +3 -0
- package/assets/images/icons/moon.svg +3 -0
- package/assets/images/icons/network.svg +13 -0
- package/assets/images/icons/options.svg +5 -0
- package/assets/images/icons/plus.svg +5 -0
- package/assets/images/icons/power-off-bg.svg +24 -0
- package/assets/images/icons/power-off.svg +19 -0
- package/assets/images/icons/power-on.svg +19 -0
- package/assets/images/icons/qr.svg +20 -0
- package/assets/images/icons/question-circle.svg +14 -0
- package/assets/images/icons/refresh.svg +6 -0
- package/assets/images/icons/search.svg +12 -0
- package/assets/images/icons/sun.svg +3 -0
- package/assets/images/icons/wave.svg +214 -0
- package/assets/images/icons/x.svg +5 -0
- package/components/ActionMetadata.vue +50 -0
- package/components/ChainLogo.vue +1 -1
- package/components/metadata/Bridge.vue +37 -0
- package/components/metadata/CrossTransfer.vue +65 -0
- package/components/metadata/GasTopup.vue +31 -0
- package/components/metadata/Permit2.vue +37 -0
- package/components/metadata/Swap.vue +66 -0
- package/components/metadata/Transfer.vue +43 -0
- package/components.d.ts +13 -0
- package/contracts/Forwarder.ts +856 -2
- package/contracts/factories/Forwarder__factory.ts +816 -16
- package/nuxt.config.ts +17 -1
- package/package.json +6 -3
- package/utils/avocado.ts +2 -0
- package/utils/bignumber.ts +20 -0
- package/utils/formatter.ts +49 -6
- package/utils/metadata.ts +121 -3
- package/utils/network.ts +63 -42
- package/utils/services.ts +14 -0
- package/utils/utils.d.ts +31 -1
package/nuxt.config.ts
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
// https://nuxt.com/docs/api/configuration/nuxt-config
|
|
2
|
+
import ViteComponents from "unplugin-vue-components/vite";
|
|
3
|
+
|
|
2
4
|
export default defineNuxtConfig({
|
|
3
|
-
modules: ["@nuxtjs/tailwindcss"],
|
|
5
|
+
modules: ["@nuxtjs/tailwindcss", "nuxt-svgo", "@vueuse/nuxt"],
|
|
6
|
+
svgo: {
|
|
7
|
+
defaultImport: "component",
|
|
8
|
+
autoImportPath: "./assets/images/icons",
|
|
9
|
+
svgoConfig: {
|
|
10
|
+
plugins: ["prefixIds"],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
vite: {
|
|
14
|
+
plugins: [
|
|
15
|
+
ViteComponents({
|
|
16
|
+
dts: true,
|
|
17
|
+
}),
|
|
18
|
+
],
|
|
19
|
+
},
|
|
4
20
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instadapp/avocado-base",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.fd1507c",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"types": "global.d.ts",
|
|
@@ -16,11 +16,14 @@
|
|
|
16
16
|
"@instadapp/avocado-dev": "npm:@instadapp/avocado@dev",
|
|
17
17
|
"@nuxtjs/tailwindcss": "^6.6.5",
|
|
18
18
|
"@typechain/ethers-v5": "^10.2.0",
|
|
19
|
-
"nuxt": "^3.
|
|
19
|
+
"nuxt": "^3.6.1",
|
|
20
|
+
"nuxt-svgo": "^3.1.0",
|
|
20
21
|
"rimraf": "^3.0.2",
|
|
21
|
-
"typechain": "^8.1.1"
|
|
22
|
+
"typechain": "^8.1.1",
|
|
23
|
+
"unplugin-vue-components": "^0.25.1"
|
|
22
24
|
},
|
|
23
25
|
"dependencies": {
|
|
26
|
+
"@vueuse/nuxt": "^10.2.0",
|
|
24
27
|
"bignumber.js": "^9.1.1",
|
|
25
28
|
"ethers": "^5.7.2"
|
|
26
29
|
}
|
package/utils/avocado.ts
CHANGED
package/utils/bignumber.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { BigNumber } from "bignumber.js";
|
|
2
2
|
import { BigNumber as BN } from "ethers";
|
|
3
3
|
|
|
4
|
+
type CombinedBigNumber = BigNumber | string | number;
|
|
5
|
+
|
|
4
6
|
export const toBN = (value: BigNumber.Value | BN) =>
|
|
5
7
|
new BigNumber(BN.isBigNumber(value) ? value.toString() : value);
|
|
6
8
|
export const isZero = (value: BigNumber.Value | BN) => toBN(value).isZero();
|
|
@@ -29,3 +31,21 @@ export const ensureValue = (value: any) => {
|
|
|
29
31
|
export const max = (...args: BigNumber.Value[]) => {
|
|
30
32
|
return BigNumber.max(...args);
|
|
31
33
|
};
|
|
34
|
+
|
|
35
|
+
export function pow(value: CombinedBigNumber, exponent: string | number) {
|
|
36
|
+
return toBN(value).pow(toBN(exponent));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function toWei(val: CombinedBigNumber, decimals: number): string {
|
|
40
|
+
const num = toBN(val);
|
|
41
|
+
const multiplier = pow(10, decimals);
|
|
42
|
+
return times(num, multiplier).toFixed(0);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function fromWei(val: CombinedBigNumber, decimal = 18) {
|
|
46
|
+
return toBN(val).div(new BigNumber(10).pow(decimal));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function abs(value: CombinedBigNumber) {
|
|
50
|
+
return toBN(value).abs();
|
|
51
|
+
}
|
package/utils/formatter.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export function formatPercent(
|
|
2
|
-
value
|
|
2
|
+
value?: number | string,
|
|
3
3
|
fractionDigits = 2,
|
|
4
4
|
maxValue = null
|
|
5
5
|
) {
|
|
6
|
-
if (isZero(value)) return "0.00%";
|
|
6
|
+
if (!value || isZero(value)) return "0.00%";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const valueAsNumber = toBN(value).toNumber();
|
|
9
|
+
|
|
10
|
+
if (maxValue && gt(times(valueAsNumber, "100"), maxValue))
|
|
11
|
+
return `>${maxValue}%`;
|
|
9
12
|
|
|
10
13
|
const formatter = new Intl.NumberFormat("en-US", {
|
|
11
14
|
style: "percent",
|
|
@@ -13,7 +16,7 @@ export function formatPercent(
|
|
|
13
16
|
maximumFractionDigits: fractionDigits,
|
|
14
17
|
});
|
|
15
18
|
|
|
16
|
-
return formatter.format(
|
|
19
|
+
return formatter.format(valueAsNumber);
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
export function shortenHash(hash: string, length: number = 4) {
|
|
@@ -42,10 +45,50 @@ export function signedNumber(numb: string | number) {
|
|
|
42
45
|
}).format(toBN(numb).toNumber());
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
|
|
48
|
+
function getFractionDigits(value: string | number) {
|
|
49
|
+
const absoluteValue = toBN(value).abs();
|
|
50
|
+
|
|
51
|
+
if (isZero(absoluteValue)) {
|
|
52
|
+
return 2;
|
|
53
|
+
} else if (lt(absoluteValue, 0.01)) {
|
|
54
|
+
return 6;
|
|
55
|
+
} else if (lt(absoluteValue, 1)) {
|
|
56
|
+
return 4;
|
|
57
|
+
} else if (lt(absoluteValue, 10000)) {
|
|
58
|
+
return 2;
|
|
59
|
+
} else {
|
|
60
|
+
return 0;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function formatDecimal(value: string | number, fractionDigits?: number) {
|
|
46
65
|
if (!value) {
|
|
47
66
|
value = "0";
|
|
48
67
|
}
|
|
68
|
+
if (lt(value, "0.0001") && gt(value, "0")) {
|
|
69
|
+
return "< 0.0001";
|
|
70
|
+
} else {
|
|
71
|
+
const num = toBN(value);
|
|
72
|
+
let decimals;
|
|
73
|
+
|
|
74
|
+
if (num.lt(1)) {
|
|
75
|
+
decimals = 8;
|
|
76
|
+
} else if (num.lt(10)) {
|
|
77
|
+
decimals = 6;
|
|
78
|
+
} else if (num.lt(100)) {
|
|
79
|
+
decimals = 4;
|
|
80
|
+
} else if (num.lt(1000)) {
|
|
81
|
+
decimals = 3;
|
|
82
|
+
} else if (num.lt(10000)) {
|
|
83
|
+
decimals = 2;
|
|
84
|
+
} else if (num.lt(100000)) {
|
|
85
|
+
decimals = 1;
|
|
86
|
+
} else {
|
|
87
|
+
decimals = 0;
|
|
88
|
+
}
|
|
49
89
|
|
|
50
|
-
|
|
90
|
+
const formattedNumber = num.toFixed(fractionDigits || decimals);
|
|
91
|
+
|
|
92
|
+
return toBN(formattedNumber).toFormat();
|
|
93
|
+
}
|
|
51
94
|
}
|
package/utils/metadata.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ethers, utils } from "ethers";
|
|
2
|
-
import { Forwarder__factory } from "
|
|
2
|
+
import { Forwarder__factory } from "../contracts";
|
|
3
3
|
|
|
4
4
|
const multiMetadataTypes = ["bytes[]"];
|
|
5
5
|
|
|
@@ -7,6 +7,13 @@ const metadataTypes = ["bytes32 type", "uint8 version", "bytes data"];
|
|
|
7
7
|
|
|
8
8
|
const actionMetadataTypes = {
|
|
9
9
|
transfer: ["address token", "uint256 amount", "address receiver"],
|
|
10
|
+
"cross-transfer": [
|
|
11
|
+
"address fromToken",
|
|
12
|
+
"address toToken",
|
|
13
|
+
"uint256 toChainId",
|
|
14
|
+
"uint256 amount",
|
|
15
|
+
"address receiver",
|
|
16
|
+
],
|
|
10
17
|
bridge: [
|
|
11
18
|
"uint256 amount",
|
|
12
19
|
"address receiver",
|
|
@@ -27,6 +34,7 @@ const actionMetadataTypes = {
|
|
|
27
34
|
"gas-topup": ["uint256 amount", "address token", "address onBehalf"],
|
|
28
35
|
upgrade: ["bytes32 version", "address walletImpl"],
|
|
29
36
|
dapp: ["string name", "string url"],
|
|
37
|
+
auth: ["address address", "uint256 chainId", "bool remove"],
|
|
30
38
|
deploy: [],
|
|
31
39
|
permit2: [
|
|
32
40
|
"address token",
|
|
@@ -34,6 +42,7 @@ const actionMetadataTypes = {
|
|
|
34
42
|
"uint160 amount",
|
|
35
43
|
"uint48 expiration",
|
|
36
44
|
],
|
|
45
|
+
"instadapp-pro": ["string castDetails"],
|
|
37
46
|
};
|
|
38
47
|
|
|
39
48
|
const encodeMetadata = (props: MetadataProps) => {
|
|
@@ -78,6 +87,46 @@ export const encodeTransferMetadata = (
|
|
|
78
87
|
return single ? encodeMultipleActions(data) : data;
|
|
79
88
|
};
|
|
80
89
|
|
|
90
|
+
export const encodeCrossTransferMetadata = (
|
|
91
|
+
params: CrossSendMetadataProps,
|
|
92
|
+
single = true
|
|
93
|
+
) => {
|
|
94
|
+
const encodedData = ethers.utils.defaultAbiCoder.encode(
|
|
95
|
+
actionMetadataTypes["cross-transfer"],
|
|
96
|
+
[
|
|
97
|
+
params.fromToken,
|
|
98
|
+
params.toToken,
|
|
99
|
+
params.toChainId,
|
|
100
|
+
params.amount,
|
|
101
|
+
params.receiver,
|
|
102
|
+
]
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
const data = encodeMetadata({
|
|
106
|
+
type: "cross-transfer",
|
|
107
|
+
encodedData,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
return single ? encodeMultipleActions(data) : data;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export const encodeAuthMetadata = (
|
|
114
|
+
params: AuthMetadataProps,
|
|
115
|
+
single = true
|
|
116
|
+
) => {
|
|
117
|
+
const encodedData = ethers.utils.defaultAbiCoder.encode(
|
|
118
|
+
actionMetadataTypes["auth"],
|
|
119
|
+
[params.address, params.chainId, params.remove]
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
const data = encodeMetadata({
|
|
123
|
+
type: "auth",
|
|
124
|
+
encodedData,
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
return single ? encodeMultipleActions(data) : data;
|
|
128
|
+
};
|
|
129
|
+
|
|
81
130
|
export const encodeDeployMetadata = (single = true) => {
|
|
82
131
|
const data = encodeMetadata({
|
|
83
132
|
type: "deploy",
|
|
@@ -208,7 +257,7 @@ export const decodeMetadata = (data: string) => {
|
|
|
208
257
|
} else {
|
|
209
258
|
metadata = executeData.metadata_;
|
|
210
259
|
}
|
|
211
|
-
} else {
|
|
260
|
+
} else if (data.startsWith("0x14f80a8d")) {
|
|
212
261
|
const executeDataV2 = iface.decodeFunctionData("executeV2", data);
|
|
213
262
|
if (
|
|
214
263
|
executeDataV2.params_.metadata === "0x" ||
|
|
@@ -218,6 +267,29 @@ export const decodeMetadata = (data: string) => {
|
|
|
218
267
|
} else {
|
|
219
268
|
metadata = executeDataV2.params_.metadata;
|
|
220
269
|
}
|
|
270
|
+
} else if (data.startsWith("0x85114d53")) {
|
|
271
|
+
const executeDataV3 = iface.decodeFunctionData("executeV3", data);
|
|
272
|
+
if (
|
|
273
|
+
executeDataV3.params_.metadata === "0x" ||
|
|
274
|
+
!executeDataV3.params_.metadata
|
|
275
|
+
) {
|
|
276
|
+
return null;
|
|
277
|
+
} else {
|
|
278
|
+
metadata = executeDataV3.params_.metadata;
|
|
279
|
+
}
|
|
280
|
+
} else {
|
|
281
|
+
const executeDataMultisigV3 = iface.decodeFunctionData(
|
|
282
|
+
"executeMultisigV3",
|
|
283
|
+
data
|
|
284
|
+
);
|
|
285
|
+
if (
|
|
286
|
+
executeDataMultisigV3.params_.metadata === "0x" ||
|
|
287
|
+
!executeDataMultisigV3.params_.metadata
|
|
288
|
+
) {
|
|
289
|
+
return null;
|
|
290
|
+
} else {
|
|
291
|
+
metadata = executeDataMultisigV3.params_.metadata;
|
|
292
|
+
}
|
|
221
293
|
}
|
|
222
294
|
|
|
223
295
|
const metadataArr = [];
|
|
@@ -302,6 +374,7 @@ export const decodeMetadata = (data: string) => {
|
|
|
302
374
|
payload = {
|
|
303
375
|
type,
|
|
304
376
|
};
|
|
377
|
+
break;
|
|
305
378
|
|
|
306
379
|
case "permit2":
|
|
307
380
|
payload = {
|
|
@@ -311,6 +384,37 @@ export const decodeMetadata = (data: string) => {
|
|
|
311
384
|
amount: toBN(decodedData.amount).toFixed(),
|
|
312
385
|
expiration: decodedData.expiration,
|
|
313
386
|
};
|
|
387
|
+
break;
|
|
388
|
+
|
|
389
|
+
case "cross-transfer":
|
|
390
|
+
payload = {
|
|
391
|
+
type,
|
|
392
|
+
fromToken: decodedData.fromToken,
|
|
393
|
+
toToken: decodedData.toToken,
|
|
394
|
+
toChainId: decodedData.toChainId
|
|
395
|
+
? decodedData.toChainId.toString()
|
|
396
|
+
: null,
|
|
397
|
+
amount: toBN(decodedData.amount).toFixed(),
|
|
398
|
+
receiver: decodedData.receiver,
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
break;
|
|
402
|
+
case "auth":
|
|
403
|
+
payload = {
|
|
404
|
+
type: decodedData.remove ? "remove-authority" : "add-authority",
|
|
405
|
+
address: decodedData.address,
|
|
406
|
+
chainId: decodedData.chainId
|
|
407
|
+
? decodedData.chainId.toString()
|
|
408
|
+
: null,
|
|
409
|
+
remove: decodedData.remove,
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
break;
|
|
413
|
+
case "instadapp-pro":
|
|
414
|
+
payload = {
|
|
415
|
+
type,
|
|
416
|
+
castDetails: decodedData.castDetails,
|
|
417
|
+
};
|
|
314
418
|
|
|
315
419
|
break;
|
|
316
420
|
}
|
|
@@ -320,7 +424,21 @@ export const decodeMetadata = (data: string) => {
|
|
|
320
424
|
|
|
321
425
|
return metadataArr;
|
|
322
426
|
} catch (e) {
|
|
323
|
-
console.log(e);
|
|
427
|
+
// console.log(e);
|
|
324
428
|
return null;
|
|
325
429
|
}
|
|
326
430
|
};
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Replaces hyphens with spaces and capitalizes the first letter of each word in a sentence.
|
|
434
|
+
* @param {string} txType - The input sentence to modify
|
|
435
|
+
*
|
|
436
|
+
* @returns {string} - The modified sentence with hyphens replaced with spaces and the first letter of each word capitalized.
|
|
437
|
+
*/
|
|
438
|
+
export const formatTxType = (txType: string) => {
|
|
439
|
+
const finalSentence = txType
|
|
440
|
+
.replace("-", " ")
|
|
441
|
+
.replace(/(^\w{1})|(\s+\w{1})/g, (letter) => letter.toUpperCase());
|
|
442
|
+
|
|
443
|
+
return finalSentence;
|
|
444
|
+
};
|
package/utils/network.ts
CHANGED
|
@@ -4,11 +4,13 @@ export const bridgeDisabledNetworks = [1101];
|
|
|
4
4
|
|
|
5
5
|
export const networks: Network[] = [
|
|
6
6
|
{
|
|
7
|
-
name: "
|
|
7
|
+
name: "Ethereum",
|
|
8
8
|
debankName: "eth",
|
|
9
9
|
ankrName: "eth",
|
|
10
|
+
zerionName: "ethereum",
|
|
10
11
|
chainId: 1,
|
|
11
12
|
explorerUrl: "https://etherscan.io",
|
|
13
|
+
color: "#5D5FEF",
|
|
12
14
|
get serverRpcUrl() {
|
|
13
15
|
return process.env?.MAINNET_RPC_URL || this.params.rpcUrls[0];
|
|
14
16
|
},
|
|
@@ -27,6 +29,8 @@ export const networks: Network[] = [
|
|
|
27
29
|
name: "Polygon",
|
|
28
30
|
debankName: "matic",
|
|
29
31
|
ankrName: "polygon",
|
|
32
|
+
zerionName: "polygon",
|
|
33
|
+
color: "#7A4ADD",
|
|
30
34
|
chainId: 137,
|
|
31
35
|
balanceResolverAddress: "0x58632D23120b20650262b8A629a14e4F4043E0D9",
|
|
32
36
|
usdcAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
|
|
@@ -48,6 +52,8 @@ export const networks: Network[] = [
|
|
|
48
52
|
name: "Arbitrum",
|
|
49
53
|
debankName: "arb",
|
|
50
54
|
ankrName: "arbitrum",
|
|
55
|
+
zerionName: "arbitrum",
|
|
56
|
+
color: "#2D374B",
|
|
51
57
|
chainId: 42161,
|
|
52
58
|
usdcAddress: "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",
|
|
53
59
|
balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
|
|
@@ -69,6 +75,8 @@ export const networks: Network[] = [
|
|
|
69
75
|
name: "Optimism",
|
|
70
76
|
debankName: "op",
|
|
71
77
|
ankrName: "optimism",
|
|
78
|
+
zerionName: "optimism",
|
|
79
|
+
color: "#FF0420",
|
|
72
80
|
chainId: 10,
|
|
73
81
|
usdcAddress: "0x7f5c764cbc14f9669b88837ca1490cca17c31607",
|
|
74
82
|
balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
|
|
@@ -90,6 +98,8 @@ export const networks: Network[] = [
|
|
|
90
98
|
name: "Avalanche",
|
|
91
99
|
debankName: "avax",
|
|
92
100
|
ankrName: "avalanche",
|
|
101
|
+
zerionName: "avalanche",
|
|
102
|
+
color: "#EB5757",
|
|
93
103
|
chainId: 43114,
|
|
94
104
|
usdcAddress: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
|
|
95
105
|
balanceResolverAddress: "0x63009f31D054E0ac9F321Cf0D642375236A4Bf1E",
|
|
@@ -104,13 +114,15 @@ export const networks: Network[] = [
|
|
|
104
114
|
symbol: "AVAX",
|
|
105
115
|
decimals: 18,
|
|
106
116
|
},
|
|
107
|
-
rpcUrls: ["https://
|
|
117
|
+
rpcUrls: ["https://rpc.ankr.com/avalanche"],
|
|
108
118
|
},
|
|
109
119
|
},
|
|
110
120
|
{
|
|
111
121
|
name: "BSC",
|
|
112
122
|
debankName: "bsc",
|
|
113
123
|
ankrName: "bsc",
|
|
124
|
+
zerionName: "binance-smart-chain",
|
|
125
|
+
color: "#F3BA2F",
|
|
114
126
|
chainId: 56,
|
|
115
127
|
explorerUrl: "https://bscscan.com",
|
|
116
128
|
usdcAddress: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
|
|
@@ -131,7 +143,8 @@ export const networks: Network[] = [
|
|
|
131
143
|
{
|
|
132
144
|
name: "Gnosis",
|
|
133
145
|
debankName: "xdai",
|
|
134
|
-
|
|
146
|
+
zerionName: "xdai",
|
|
147
|
+
color: "#04795C",
|
|
135
148
|
chainId: 100,
|
|
136
149
|
balanceResolverAddress: "0xfaa244e276b1597f663975ed007ee4ff70d27849",
|
|
137
150
|
explorerUrl: "https://gnosisscan.io",
|
|
@@ -152,6 +165,7 @@ export const networks: Network[] = [
|
|
|
152
165
|
{
|
|
153
166
|
name: "Polygon zkEVM",
|
|
154
167
|
chainId: 1101,
|
|
168
|
+
color: "#8544f6",
|
|
155
169
|
explorerUrl: "https://zkevm.polygonscan.com",
|
|
156
170
|
balanceResolverAddress: "0x48D1Fa5Ee6691a1E0B45d2B515650997BEA27a01",
|
|
157
171
|
usdcAddress: "0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035",
|
|
@@ -160,7 +174,7 @@ export const networks: Network[] = [
|
|
|
160
174
|
},
|
|
161
175
|
params: {
|
|
162
176
|
chainName: "polygon zkEVM",
|
|
163
|
-
rpcUrls: ["https://rpc.
|
|
177
|
+
rpcUrls: ["https://zkevm-rpc.com"],
|
|
164
178
|
|
|
165
179
|
nativeCurrency: {
|
|
166
180
|
name: "Ethereum",
|
|
@@ -169,49 +183,55 @@ export const networks: Network[] = [
|
|
|
169
183
|
},
|
|
170
184
|
},
|
|
171
185
|
},
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
186
|
+
{
|
|
187
|
+
name: "Aurora",
|
|
188
|
+
chainId: 1313161554,
|
|
189
|
+
zerionName: "aurora",
|
|
190
|
+
color: "#78d64b",
|
|
191
|
+
explorerUrl: "https://explorer.mainnet.aurora.dev",
|
|
192
|
+
get serverRpcUrl() {
|
|
193
|
+
return process.env?.AURORA_RPC_URL || this.params.rpcUrls[0];
|
|
194
|
+
},
|
|
195
|
+
usdcAddress: "0xB12BFcA5A55806AaF64E99521918A4bf0fC40802",
|
|
196
|
+
balanceResolverAddress: "0xdF19Da523DA64bBE82eE0E4DFf00d676A8386474",
|
|
197
|
+
params: {
|
|
198
|
+
rpcUrls: ["https://mainnet.aurora.dev"],
|
|
199
|
+
chainName: "Aurora",
|
|
200
|
+
nativeCurrency: {
|
|
201
|
+
decimals: 18,
|
|
202
|
+
name: "Aurora ETH",
|
|
203
|
+
symbol: "AETH",
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
name: "Fantom",
|
|
209
|
+
chainId: 250,
|
|
210
|
+
zerionName: "fantom",
|
|
211
|
+
explorerUrl: "https://ftmscan.com",
|
|
212
|
+
ankrName: "fantom",
|
|
213
|
+
color: "#1969ff",
|
|
214
|
+
get serverRpcUrl() {
|
|
215
|
+
return process.env?.FANTOM_RPC_URL || this.params.rpcUrls[0];
|
|
216
|
+
},
|
|
217
|
+
usdcAddress: "0x04068da6c83afcfa0e13ba15a6696662335d5b75",
|
|
218
|
+
balanceResolverAddress: "0x929376c77a2fb8152375a089a4fccf84ff481479",
|
|
219
|
+
params: {
|
|
220
|
+
rpcUrls: ["https://rpc.ankr.com/fantom"],
|
|
221
|
+
chainName: "Fantom",
|
|
222
|
+
nativeCurrency: {
|
|
223
|
+
name: "Fantom",
|
|
224
|
+
symbol: "FTM",
|
|
225
|
+
decimals: 18,
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
},
|
|
210
229
|
{
|
|
211
230
|
name: AVO_PROD_CHAIN_NAME,
|
|
212
231
|
chainId: AVO_PROD_CHAIN_ID,
|
|
213
232
|
isAvocado: true,
|
|
214
233
|
balanceResolverAddress: "",
|
|
234
|
+
color: "#16A34A",
|
|
215
235
|
usdcAddress: "",
|
|
216
236
|
serverRpcUrl: AVO_PROD_RPC_URL,
|
|
217
237
|
explorerUrl: AVO_PROD_EXPLORER_URL,
|
|
@@ -230,6 +250,7 @@ export const networks: Network[] = [
|
|
|
230
250
|
name: AVO_STAGING_CHAIN_NAME,
|
|
231
251
|
chainId: AVO_STAGING_CHAIN_ID,
|
|
232
252
|
serverRpcUrl: AVO_STAGING_RPC_URL,
|
|
253
|
+
color: "#16A34A",
|
|
233
254
|
explorerUrl: AVO_STAGING_EXPLORER_URL,
|
|
234
255
|
isAvocado: true,
|
|
235
256
|
balanceResolverAddress: "",
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const fetchTokenByAddress = async (
|
|
2
|
+
address: string,
|
|
3
|
+
chainId: string | number
|
|
4
|
+
) => {
|
|
5
|
+
if (!address || !chainId) return null;
|
|
6
|
+
const [token] = (await $fetch(`${blockQueryURL}/${chainId}/tokens`, {
|
|
7
|
+
params: {
|
|
8
|
+
sparkline: false,
|
|
9
|
+
"addresses[]": [address],
|
|
10
|
+
},
|
|
11
|
+
})) as ITokenPrice[];
|
|
12
|
+
|
|
13
|
+
return token;
|
|
14
|
+
};
|
package/utils/utils.d.ts
CHANGED
|
@@ -18,7 +18,9 @@ interface Network {
|
|
|
18
18
|
name: string;
|
|
19
19
|
debankName?: string;
|
|
20
20
|
ankrName?: string;
|
|
21
|
+
zerionName?: string;
|
|
21
22
|
chainId: ChainId;
|
|
23
|
+
color: string;
|
|
22
24
|
isAvocado?: boolean;
|
|
23
25
|
serverRpcUrl: string | undefined;
|
|
24
26
|
balanceResolverAddress?: string;
|
|
@@ -54,6 +56,20 @@ type SendMetadataProps = {
|
|
|
54
56
|
receiver: string;
|
|
55
57
|
};
|
|
56
58
|
|
|
59
|
+
type CrossSendMetadataProps = {
|
|
60
|
+
fromToken: string;
|
|
61
|
+
toToken: string;
|
|
62
|
+
toChainId: string;
|
|
63
|
+
amount: string;
|
|
64
|
+
receiver: string;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
type AuthMetadataProps = {
|
|
68
|
+
address: string;
|
|
69
|
+
chainId: string;
|
|
70
|
+
remove: boolean;
|
|
71
|
+
};
|
|
72
|
+
|
|
57
73
|
type UpgradeMetadataProps = {
|
|
58
74
|
version: string;
|
|
59
75
|
walletImpl: string;
|
|
@@ -94,7 +110,21 @@ type MetadataProps = {
|
|
|
94
110
|
| "upgrade"
|
|
95
111
|
| "dapp"
|
|
96
112
|
| "deploy"
|
|
97
|
-
| "permit2"
|
|
113
|
+
| "permit2"
|
|
114
|
+
| "cross-transfer"
|
|
115
|
+
| "auth";
|
|
98
116
|
encodedData: string;
|
|
99
117
|
version?: string;
|
|
100
118
|
};
|
|
119
|
+
|
|
120
|
+
interface ITokenPrice {
|
|
121
|
+
address: string;
|
|
122
|
+
chain_id: string;
|
|
123
|
+
name: string;
|
|
124
|
+
symbol: string;
|
|
125
|
+
decimals: number;
|
|
126
|
+
logo_url: string;
|
|
127
|
+
price: string;
|
|
128
|
+
coingecko_id: string;
|
|
129
|
+
sparkline_price_7d: number[];
|
|
130
|
+
}
|