@instadapp/avocado-base 0.0.0-dev.637be1b → 0.0.0-dev.6c83321
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/app.vue +7 -0
- 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/change-threshold.svg +4 -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/cross-transfer.svg +7 -0
- package/assets/images/icons/dapp.svg +4 -0
- package/assets/images/icons/deploy.svg +12 -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 +14 -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/instadapp-pro.svg +4 -0
- package/assets/images/icons/logout.svg +3 -0
- package/assets/images/icons/moon.svg +3 -0
- package/assets/images/icons/multi-send.svg +7 -0
- package/assets/images/icons/network.svg +13 -0
- package/assets/images/icons/options.svg +5 -0
- package/assets/images/icons/permit-sign.svg +11 -0
- package/assets/images/icons/plus-circle.svg +6 -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/reject-proposal.svg +6 -0
- package/assets/images/icons/search.svg +12 -0
- package/assets/images/icons/sun.svg +3 -0
- package/assets/images/icons/transfer.svg +5 -0
- package/assets/images/icons/trash-2.svg +8 -0
- package/assets/images/icons/upgrade.svg +4 -0
- package/assets/images/icons/wave.svg +214 -0
- package/assets/images/icons/x.svg +5 -0
- package/components/ActionLogo.vue +38 -0
- package/components/ActionMetadata.vue +73 -0
- package/components/ChainLogo.vue +1 -1
- package/components/metadata/Bridge.vue +39 -0
- package/components/metadata/CrossTransfer.vue +67 -0
- package/components/metadata/GasTopup.vue +33 -0
- package/components/metadata/Permit2.vue +37 -0
- package/components/metadata/Swap.vue +67 -0
- package/components/metadata/Transfer.vue +46 -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 +22 -13
- package/utils/helper.ts +7 -0
- package/utils/metadata.ts +343 -133
- package/utils/network.ts +50 -23
- package/utils/services.ts +14 -0
- package/utils/utils.d.ts +127 -97
package/utils/network.ts
CHANGED
|
@@ -4,12 +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
10
|
zerionName: "ethereum",
|
|
11
11
|
chainId: 1,
|
|
12
12
|
explorerUrl: "https://etherscan.io",
|
|
13
|
+
color: "#5D5FEF",
|
|
13
14
|
get serverRpcUrl() {
|
|
14
15
|
return process.env?.MAINNET_RPC_URL || this.params.rpcUrls[0];
|
|
15
16
|
},
|
|
@@ -29,6 +30,7 @@ export const networks: Network[] = [
|
|
|
29
30
|
debankName: "matic",
|
|
30
31
|
ankrName: "polygon",
|
|
31
32
|
zerionName: "polygon",
|
|
33
|
+
color: "#7A4ADD",
|
|
32
34
|
chainId: 137,
|
|
33
35
|
balanceResolverAddress: "0x58632D23120b20650262b8A629a14e4F4043E0D9",
|
|
34
36
|
usdcAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
|
|
@@ -51,6 +53,7 @@ export const networks: Network[] = [
|
|
|
51
53
|
debankName: "arb",
|
|
52
54
|
ankrName: "arbitrum",
|
|
53
55
|
zerionName: "arbitrum",
|
|
56
|
+
color: "#2D374B",
|
|
54
57
|
chainId: 42161,
|
|
55
58
|
usdcAddress: "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",
|
|
56
59
|
balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
|
|
@@ -73,6 +76,7 @@ export const networks: Network[] = [
|
|
|
73
76
|
debankName: "op",
|
|
74
77
|
ankrName: "optimism",
|
|
75
78
|
zerionName: "optimism",
|
|
79
|
+
color: "#FF0420",
|
|
76
80
|
chainId: 10,
|
|
77
81
|
usdcAddress: "0x7f5c764cbc14f9669b88837ca1490cca17c31607",
|
|
78
82
|
balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
|
|
@@ -95,6 +99,7 @@ export const networks: Network[] = [
|
|
|
95
99
|
debankName: "avax",
|
|
96
100
|
ankrName: "avalanche",
|
|
97
101
|
zerionName: "avalanche",
|
|
102
|
+
color: "#EB5757",
|
|
98
103
|
chainId: 43114,
|
|
99
104
|
usdcAddress: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
|
|
100
105
|
balanceResolverAddress: "0x63009f31D054E0ac9F321Cf0D642375236A4Bf1E",
|
|
@@ -109,7 +114,7 @@ export const networks: Network[] = [
|
|
|
109
114
|
symbol: "AVAX",
|
|
110
115
|
decimals: 18,
|
|
111
116
|
},
|
|
112
|
-
rpcUrls: ["https://
|
|
117
|
+
rpcUrls: ["https://rpc.ankr.com/avalanche"],
|
|
113
118
|
},
|
|
114
119
|
},
|
|
115
120
|
{
|
|
@@ -117,6 +122,7 @@ export const networks: Network[] = [
|
|
|
117
122
|
debankName: "bsc",
|
|
118
123
|
ankrName: "bsc",
|
|
119
124
|
zerionName: "binance-smart-chain",
|
|
125
|
+
color: "#F3BA2F",
|
|
120
126
|
chainId: 56,
|
|
121
127
|
explorerUrl: "https://bscscan.com",
|
|
122
128
|
usdcAddress: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
|
|
@@ -138,6 +144,7 @@ export const networks: Network[] = [
|
|
|
138
144
|
name: "Gnosis",
|
|
139
145
|
debankName: "xdai",
|
|
140
146
|
zerionName: "xdai",
|
|
147
|
+
color: "#04795C",
|
|
141
148
|
chainId: 100,
|
|
142
149
|
balanceResolverAddress: "0xfaa244e276b1597f663975ed007ee4ff70d27849",
|
|
143
150
|
explorerUrl: "https://gnosisscan.io",
|
|
@@ -158,6 +165,7 @@ export const networks: Network[] = [
|
|
|
158
165
|
{
|
|
159
166
|
name: "Polygon zkEVM",
|
|
160
167
|
chainId: 1101,
|
|
168
|
+
color: "#8544f6",
|
|
161
169
|
explorerUrl: "https://zkevm.polygonscan.com",
|
|
162
170
|
balanceResolverAddress: "0x48D1Fa5Ee6691a1E0B45d2B515650997BEA27a01",
|
|
163
171
|
usdcAddress: "0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035",
|
|
@@ -166,7 +174,7 @@ export const networks: Network[] = [
|
|
|
166
174
|
},
|
|
167
175
|
params: {
|
|
168
176
|
chainName: "polygon zkEVM",
|
|
169
|
-
rpcUrls: ["https://rpc.
|
|
177
|
+
rpcUrls: ["https://zkevm-rpc.com"],
|
|
170
178
|
|
|
171
179
|
nativeCurrency: {
|
|
172
180
|
name: "Ethereum",
|
|
@@ -175,32 +183,34 @@ export const networks: Network[] = [
|
|
|
175
183
|
},
|
|
176
184
|
},
|
|
177
185
|
},
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
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
|
+
},
|
|
198
207
|
{
|
|
199
208
|
name: "Fantom",
|
|
200
209
|
chainId: 250,
|
|
201
210
|
zerionName: "fantom",
|
|
202
211
|
explorerUrl: "https://ftmscan.com",
|
|
203
212
|
ankrName: "fantom",
|
|
213
|
+
color: "#1969ff",
|
|
204
214
|
get serverRpcUrl() {
|
|
205
215
|
return process.env?.FANTOM_RPC_URL || this.params.rpcUrls[0];
|
|
206
216
|
},
|
|
@@ -221,6 +231,7 @@ export const networks: Network[] = [
|
|
|
221
231
|
chainId: AVO_PROD_CHAIN_ID,
|
|
222
232
|
isAvocado: true,
|
|
223
233
|
balanceResolverAddress: "",
|
|
234
|
+
color: "#16A34A",
|
|
224
235
|
usdcAddress: "",
|
|
225
236
|
serverRpcUrl: AVO_PROD_RPC_URL,
|
|
226
237
|
explorerUrl: AVO_PROD_EXPLORER_URL,
|
|
@@ -239,6 +250,7 @@ export const networks: Network[] = [
|
|
|
239
250
|
name: AVO_STAGING_CHAIN_NAME,
|
|
240
251
|
chainId: AVO_STAGING_CHAIN_ID,
|
|
241
252
|
serverRpcUrl: AVO_STAGING_RPC_URL,
|
|
253
|
+
color: "#16A34A",
|
|
242
254
|
explorerUrl: AVO_STAGING_EXPLORER_URL,
|
|
243
255
|
isAvocado: true,
|
|
244
256
|
balanceResolverAddress: "",
|
|
@@ -256,6 +268,21 @@ export const networks: Network[] = [
|
|
|
256
268
|
},
|
|
257
269
|
];
|
|
258
270
|
|
|
271
|
+
export const chainUsdcAddresses = [
|
|
272
|
+
{ chainId: 1, address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' },
|
|
273
|
+
{ chainId: 10, address: '0x7f5c764cbc14f9669b88837ca1490cca17c31607' },
|
|
274
|
+
{ chainId: 56, address: '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d' },
|
|
275
|
+
{ chainId: 100, address: '0xddafbb505ad214d7b80b1f830fccc89b60fb7a83' },
|
|
276
|
+
{ chainId: 137, address: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174' },
|
|
277
|
+
{ chainId: 250, address: '0x04068da6c83afcfa0e13ba15a6696662335d5b75' },
|
|
278
|
+
{ chainId: 42161, address: '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8' },
|
|
279
|
+
{ chainId: 42161, address: '0xaf88d065e77c8cc2239327c5edb3a432268e5831' },
|
|
280
|
+
{ chainId: 43114, address: '0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e' },
|
|
281
|
+
{ chainId: 43114, address: '0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664' },
|
|
282
|
+
{ chainId: 1101, address: '0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035' },
|
|
283
|
+
{ chainId: 1313161554, address: '0xB12BFcA5A55806AaF64E99521918A4bf0fC40802' },
|
|
284
|
+
];
|
|
285
|
+
|
|
259
286
|
export const getNetworkByChainId = (
|
|
260
287
|
chainId: ChainId | number | string
|
|
261
288
|
): Network => {
|
|
@@ -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
|
@@ -1,101 +1,131 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
declare global {
|
|
2
|
+
type ChainId =
|
|
3
|
+
| 1
|
|
4
|
+
| 137
|
|
5
|
+
| 42161
|
|
6
|
+
| 10
|
|
7
|
+
| 56
|
|
8
|
+
| 43114
|
|
9
|
+
| 100
|
|
10
|
+
| 1101
|
|
11
|
+
| 250
|
|
12
|
+
| 634
|
|
13
|
+
| 1313161554
|
|
14
|
+
| 63400;
|
|
15
|
+
|
|
16
|
+
type ISlackMessageType = "danger" | "error" | "success" | "banner";
|
|
17
|
+
|
|
18
|
+
type MetadataTypes = keyof typeof MetadataEnums;
|
|
19
|
+
|
|
20
|
+
type PayloadFunction = (data: any, type: MetadataTypes) => any;
|
|
21
|
+
|
|
22
|
+
type IPayload = Record<MetadataTypes, PayloadFunction>;
|
|
23
|
+
|
|
24
|
+
interface Network {
|
|
25
|
+
name: string;
|
|
26
|
+
debankName?: string;
|
|
27
|
+
ankrName?: string;
|
|
28
|
+
zerionName?: string;
|
|
29
|
+
chainId: ChainId;
|
|
30
|
+
color: string;
|
|
31
|
+
isAvocado?: boolean;
|
|
32
|
+
serverRpcUrl: string | undefined;
|
|
33
|
+
balanceResolverAddress?: string;
|
|
34
|
+
usdcAddress: string;
|
|
35
|
+
explorerUrl: string;
|
|
36
|
+
params: {
|
|
37
|
+
chainName?: string;
|
|
38
|
+
iconUrls?: string[];
|
|
39
|
+
rpcUrls: string[];
|
|
40
|
+
nativeCurrency?: {
|
|
41
|
+
name: string;
|
|
42
|
+
symbol: string;
|
|
43
|
+
decimals: number;
|
|
44
|
+
};
|
|
36
45
|
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
type SignMetadataProps = {
|
|
49
|
+
token: string;
|
|
50
|
+
spender: string;
|
|
51
|
+
amount: string;
|
|
52
|
+
expiration: string;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
type DappMetadataProps = {
|
|
56
|
+
name: string;
|
|
57
|
+
url: string;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
type SendMetadataProps = {
|
|
61
|
+
token: string;
|
|
62
|
+
amount: string;
|
|
63
|
+
receiver: string;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
type CrossSendMetadataProps = {
|
|
67
|
+
fromToken: string;
|
|
68
|
+
toToken: string;
|
|
69
|
+
toChainId: string;
|
|
70
|
+
amount: string;
|
|
71
|
+
receiver: string;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
type AuthMetadataProps = {
|
|
75
|
+
address: string;
|
|
76
|
+
chainId: string;
|
|
77
|
+
remove: boolean;
|
|
37
78
|
};
|
|
79
|
+
|
|
80
|
+
type UpgradeMetadataProps = {
|
|
81
|
+
version: string;
|
|
82
|
+
walletImpl: string;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
type TopupMetadataProps = {
|
|
86
|
+
amount: string;
|
|
87
|
+
token: string;
|
|
88
|
+
onBehalf: string;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
type BridgeMetadataProps = {
|
|
92
|
+
amount: string;
|
|
93
|
+
receiver: string;
|
|
94
|
+
fromToken: string;
|
|
95
|
+
toToken: string;
|
|
96
|
+
toChainId: string;
|
|
97
|
+
bridgeFee: string;
|
|
98
|
+
nativeToken: string;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
type SwapMetadataProps = {
|
|
102
|
+
sellToken: string;
|
|
103
|
+
buyToken: string;
|
|
104
|
+
sellAmount: string;
|
|
105
|
+
buyAmount: string;
|
|
106
|
+
receiver: string;
|
|
107
|
+
protocol?: string;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
type MetadataProps = {
|
|
111
|
+
type: MetadataTypes,
|
|
112
|
+
encodedData: string;
|
|
113
|
+
version?: string;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
interface ITokenPrice {
|
|
117
|
+
address: string;
|
|
118
|
+
chain_id: string;
|
|
119
|
+
name: string;
|
|
120
|
+
symbol: string;
|
|
121
|
+
decimals: number;
|
|
122
|
+
logo_url: string;
|
|
123
|
+
price: string;
|
|
124
|
+
coingecko_id: string;
|
|
125
|
+
sparkline_price_7d: number[];
|
|
126
|
+
}
|
|
127
|
+
|
|
38
128
|
}
|
|
39
129
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
spender: string;
|
|
43
|
-
amount: string;
|
|
44
|
-
expiration: string;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
type DappMetadataProps = {
|
|
48
|
-
name: string;
|
|
49
|
-
url: string;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
type SendMetadataProps = {
|
|
53
|
-
token: string;
|
|
54
|
-
amount: string;
|
|
55
|
-
receiver: string;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
type UpgradeMetadataProps = {
|
|
59
|
-
version: string;
|
|
60
|
-
walletImpl: string;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
type TopupMetadataProps = {
|
|
64
|
-
amount: string;
|
|
65
|
-
token: string;
|
|
66
|
-
onBehalf: string;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
type BridgeMetadataProps = {
|
|
70
|
-
amount: string;
|
|
71
|
-
receiver: string;
|
|
72
|
-
fromToken: string;
|
|
73
|
-
toToken: string;
|
|
74
|
-
toChainId: string;
|
|
75
|
-
bridgeFee: string;
|
|
76
|
-
nativeToken: string;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
type SwapMetadataProps = {
|
|
80
|
-
sellToken: string;
|
|
81
|
-
buyToken: string;
|
|
82
|
-
sellAmount: string;
|
|
83
|
-
buyAmount: string;
|
|
84
|
-
receiver: string;
|
|
85
|
-
protocol?: string;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
type MetadataProps = {
|
|
89
|
-
type:
|
|
90
|
-
| "transfer"
|
|
91
|
-
| "bridge"
|
|
92
|
-
| "swap"
|
|
93
|
-
| "multi"
|
|
94
|
-
| "gas-topup"
|
|
95
|
-
| "upgrade"
|
|
96
|
-
| "dapp"
|
|
97
|
-
| "deploy"
|
|
98
|
-
| "permit2";
|
|
99
|
-
encodedData: string;
|
|
100
|
-
version?: string;
|
|
101
|
-
};
|
|
130
|
+
export { }
|
|
131
|
+
|