@instadapp/avocado-base 0.0.0-dev.babcb27 → 0.0.0-dev.bf2fef7
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 +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 +49 -6
- package/utils/helper.ts +7 -0
- package/utils/metadata.ts +317 -123
- package/utils/network.ts +33 -9
- package/utils/services.ts +14 -0
- package/utils/utils.d.ts +48 -10
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",
|
|
@@ -83,13 +91,15 @@ export const networks: Network[] = [
|
|
|
83
91
|
symbol: "ETH",
|
|
84
92
|
decimals: 18,
|
|
85
93
|
},
|
|
86
|
-
rpcUrls: ["https://
|
|
94
|
+
rpcUrls: ["https://rpc.ankr.com/optimism"],
|
|
87
95
|
},
|
|
88
96
|
},
|
|
89
97
|
{
|
|
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",
|
|
@@ -172,6 +186,8 @@ export const networks: Network[] = [
|
|
|
172
186
|
{
|
|
173
187
|
name: "Aurora",
|
|
174
188
|
chainId: 1313161554,
|
|
189
|
+
zerionName: "aurora",
|
|
190
|
+
color: "#78d64b",
|
|
175
191
|
explorerUrl: "https://explorer.mainnet.aurora.dev",
|
|
176
192
|
get serverRpcUrl() {
|
|
177
193
|
return process.env?.AURORA_RPC_URL || this.params.rpcUrls[0];
|
|
@@ -191,7 +207,10 @@ export const networks: Network[] = [
|
|
|
191
207
|
{
|
|
192
208
|
name: "Fantom",
|
|
193
209
|
chainId: 250,
|
|
210
|
+
zerionName: "fantom",
|
|
194
211
|
explorerUrl: "https://ftmscan.com",
|
|
212
|
+
ankrName: "fantom",
|
|
213
|
+
color: "#1969ff",
|
|
195
214
|
get serverRpcUrl() {
|
|
196
215
|
return process.env?.FANTOM_RPC_URL || this.params.rpcUrls[0];
|
|
197
216
|
},
|
|
@@ -212,6 +231,7 @@ export const networks: Network[] = [
|
|
|
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: "",
|
|
@@ -274,13 +295,16 @@ export const RPCMap = networks.reduce((acc, network) => {
|
|
|
274
295
|
|
|
275
296
|
export const networkIds = networks.map((network) => network.chainId);
|
|
276
297
|
|
|
277
|
-
const rpcInstances: Record<string, ethers.providers.
|
|
278
|
-
const serverRpcInstances: Record<
|
|
298
|
+
const rpcInstances: Record<string, ethers.providers.StaticJsonRpcProvider> = {};
|
|
299
|
+
const serverRpcInstances: Record<
|
|
300
|
+
string,
|
|
301
|
+
ethers.providers.StaticJsonRpcProvider
|
|
302
|
+
> = {};
|
|
279
303
|
|
|
280
304
|
export const getServerRpcProvider = (chainId: number | string) => {
|
|
281
305
|
if (!rpcInstances[chainId]) {
|
|
282
306
|
const network = networks.find((n) => n.chainId == chainId);
|
|
283
|
-
serverRpcInstances[chainId] = new ethers.providers.
|
|
307
|
+
serverRpcInstances[chainId] = new ethers.providers.StaticJsonRpcProvider(
|
|
284
308
|
network?.serverRpcUrl
|
|
285
309
|
);
|
|
286
310
|
}
|
|
@@ -290,7 +314,7 @@ export const getServerRpcProvider = (chainId: number | string) => {
|
|
|
290
314
|
|
|
291
315
|
export const getRpcProvider = (chainId: number | string) => {
|
|
292
316
|
if (!rpcInstances[chainId]) {
|
|
293
|
-
rpcInstances[chainId] = new ethers.providers.
|
|
317
|
+
rpcInstances[chainId] = new ethers.providers.StaticJsonRpcProvider(
|
|
294
318
|
getRpcURLByChainId(Number(chainId))
|
|
295
319
|
);
|
|
296
320
|
}
|
|
@@ -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
|
@@ -13,12 +13,33 @@ type ChainId =
|
|
|
13
13
|
| 63400;
|
|
14
14
|
|
|
15
15
|
type ISlackMessageType = "danger" | "error" | "success" | "banner";
|
|
16
|
+
type MetadataTypes = "transfer"
|
|
17
|
+
| "bridge"
|
|
18
|
+
| "swap"
|
|
19
|
+
| "gas-topup"
|
|
20
|
+
| "upgrade"
|
|
21
|
+
| "dapp"
|
|
22
|
+
| "deploy"
|
|
23
|
+
| "permit2"
|
|
24
|
+
| "cross-transfer"
|
|
25
|
+
| "auth"
|
|
26
|
+
| "rejection"
|
|
27
|
+
| 'instadapp-pro'
|
|
28
|
+
| 'add-signers'
|
|
29
|
+
| 'remove-signers'
|
|
30
|
+
| 'change-threshold'
|
|
31
|
+
|
|
32
|
+
type PayloadFunction = (data: any, type: MetadataTypes) => any;
|
|
33
|
+
|
|
34
|
+
type IPayload = Record<MetadataTypes, PayloadFunction>;
|
|
16
35
|
|
|
17
36
|
interface Network {
|
|
18
37
|
name: string;
|
|
19
38
|
debankName?: string;
|
|
20
39
|
ankrName?: string;
|
|
40
|
+
zerionName?: string;
|
|
21
41
|
chainId: ChainId;
|
|
42
|
+
color: string;
|
|
22
43
|
isAvocado?: boolean;
|
|
23
44
|
serverRpcUrl: string | undefined;
|
|
24
45
|
balanceResolverAddress?: string;
|
|
@@ -54,6 +75,20 @@ type SendMetadataProps = {
|
|
|
54
75
|
receiver: string;
|
|
55
76
|
};
|
|
56
77
|
|
|
78
|
+
type CrossSendMetadataProps = {
|
|
79
|
+
fromToken: string;
|
|
80
|
+
toToken: string;
|
|
81
|
+
toChainId: string;
|
|
82
|
+
amount: string;
|
|
83
|
+
receiver: string;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
type AuthMetadataProps = {
|
|
87
|
+
address: string;
|
|
88
|
+
chainId: string;
|
|
89
|
+
remove: boolean;
|
|
90
|
+
};
|
|
91
|
+
|
|
57
92
|
type UpgradeMetadataProps = {
|
|
58
93
|
version: string;
|
|
59
94
|
walletImpl: string;
|
|
@@ -85,16 +120,19 @@ type SwapMetadataProps = {
|
|
|
85
120
|
};
|
|
86
121
|
|
|
87
122
|
type MetadataProps = {
|
|
88
|
-
type:
|
|
89
|
-
| "transfer"
|
|
90
|
-
| "bridge"
|
|
91
|
-
| "swap"
|
|
92
|
-
| "multi"
|
|
93
|
-
| "gas-topup"
|
|
94
|
-
| "upgrade"
|
|
95
|
-
| "dapp"
|
|
96
|
-
| "deploy"
|
|
97
|
-
| "permit2";
|
|
123
|
+
type: MetadataTypes,
|
|
98
124
|
encodedData: string;
|
|
99
125
|
version?: string;
|
|
100
126
|
};
|
|
127
|
+
|
|
128
|
+
interface ITokenPrice {
|
|
129
|
+
address: string;
|
|
130
|
+
chain_id: string;
|
|
131
|
+
name: string;
|
|
132
|
+
symbol: string;
|
|
133
|
+
decimals: number;
|
|
134
|
+
logo_url: string;
|
|
135
|
+
price: string;
|
|
136
|
+
coingecko_id: string;
|
|
137
|
+
sparkline_price_7d: number[];
|
|
138
|
+
}
|