@instadapp/avocado-base 0.0.0-dev.19925f5 → 0.0.0-dev.24c65ca

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.
@@ -0,0 +1,326 @@
1
+ import { ethers, utils } from "ethers";
2
+ import { Forwarder__factory } from "@/contracts";
3
+
4
+ const multiMetadataTypes = ["bytes[]"];
5
+
6
+ const metadataTypes = ["bytes32 type", "uint8 version", "bytes data"];
7
+
8
+ const actionMetadataTypes = {
9
+ transfer: ["address token", "uint256 amount", "address receiver"],
10
+ bridge: [
11
+ "uint256 amount",
12
+ "address receiver",
13
+ "address fromToken",
14
+ "address toToken",
15
+ "uint256 toChainId",
16
+ "uint256 bridgeFee",
17
+ "address nativeToken",
18
+ ],
19
+ swap: [
20
+ "address sellToken",
21
+ "address buyToken",
22
+ "uint256 sellAmount",
23
+ "uint256 buyAmount",
24
+ "address receiver",
25
+ "bytes32 protocol",
26
+ ],
27
+ "gas-topup": ["uint256 amount", "address token", "address onBehalf"],
28
+ upgrade: ["bytes32 version", "address walletImpl"],
29
+ dapp: ["string name", "string url"],
30
+ deploy: [],
31
+ permit2: [
32
+ "address token",
33
+ "address spender",
34
+ "uint160 amount",
35
+ "uint48 expiration",
36
+ ],
37
+ };
38
+
39
+ const encodeMetadata = (props: MetadataProps) => {
40
+ return ethers.utils.defaultAbiCoder.encode(metadataTypes, [
41
+ ethers.utils.formatBytes32String(props.type),
42
+ props.version || "1",
43
+ props.encodedData,
44
+ ]);
45
+ };
46
+
47
+ export const encodeDappMetadata = (
48
+ params: DappMetadataProps,
49
+ single = true
50
+ ) => {
51
+ const encodedData = ethers.utils.defaultAbiCoder.encode(
52
+ actionMetadataTypes.dapp,
53
+ [params.name, params.url]
54
+ );
55
+
56
+ const data = encodeMetadata({
57
+ type: "dapp",
58
+ encodedData,
59
+ });
60
+
61
+ return single ? encodeMultipleActions(data) : data;
62
+ };
63
+
64
+ export const encodeTransferMetadata = (
65
+ params: SendMetadataProps,
66
+ single = true
67
+ ) => {
68
+ const encodedData = ethers.utils.defaultAbiCoder.encode(
69
+ actionMetadataTypes.transfer,
70
+ [params.token, params.amount, params.receiver]
71
+ );
72
+
73
+ const data = encodeMetadata({
74
+ type: "transfer",
75
+ encodedData,
76
+ });
77
+
78
+ return single ? encodeMultipleActions(data) : data;
79
+ };
80
+
81
+ export const encodeDeployMetadata = (single = true) => {
82
+ const data = encodeMetadata({
83
+ type: "deploy",
84
+ encodedData: "0x",
85
+ });
86
+
87
+ return single ? encodeMultipleActions(data) : data;
88
+ };
89
+
90
+ export const encodeWCSignMetadata = (
91
+ params: SignMetadataProps,
92
+ single = true
93
+ ) => {
94
+ const encodedData = ethers.utils.defaultAbiCoder.encode(
95
+ actionMetadataTypes["permit2"],
96
+ [params.token, params.spender, params.amount, params.expiration]
97
+ );
98
+
99
+ const data = encodeMetadata({
100
+ type: "permit2",
101
+ encodedData,
102
+ });
103
+
104
+ return single ? encodeMultipleActions(data) : data;
105
+ };
106
+
107
+ export const encodeUpgradeMetadata = (
108
+ params: UpgradeMetadataProps,
109
+ single = true
110
+ ) => {
111
+ const encodedData = ethers.utils.defaultAbiCoder.encode(
112
+ actionMetadataTypes.upgrade,
113
+ [params.version, params.walletImpl]
114
+ );
115
+
116
+ const data = encodeMetadata({
117
+ type: "upgrade",
118
+ encodedData,
119
+ });
120
+
121
+ return single ? encodeMultipleActions(data) : data;
122
+ };
123
+
124
+ export const encodeSwapMetadata = (
125
+ params: SwapMetadataProps,
126
+ single = true
127
+ ) => {
128
+ const encodedData = ethers.utils.defaultAbiCoder.encode(
129
+ actionMetadataTypes.swap,
130
+ [
131
+ params.sellToken,
132
+ params.buyToken,
133
+ params.sellAmount,
134
+ params.buyAmount,
135
+ params.receiver,
136
+ params.protocol,
137
+ ]
138
+ );
139
+
140
+ const data = encodeMetadata({
141
+ type: "swap",
142
+ encodedData,
143
+ });
144
+
145
+ return single ? encodeMultipleActions(data) : data;
146
+ };
147
+
148
+ export const encodeTopupMetadata = (
149
+ params: TopupMetadataProps,
150
+ single = true
151
+ ) => {
152
+ const encodedData = ethers.utils.defaultAbiCoder.encode(
153
+ actionMetadataTypes["gas-topup"],
154
+ [params.amount, params.token, params.onBehalf]
155
+ );
156
+
157
+ console.log(params);
158
+
159
+ const data = encodeMetadata({
160
+ type: "gas-topup",
161
+ encodedData,
162
+ });
163
+
164
+ return single ? encodeMultipleActions(data) : data;
165
+ };
166
+
167
+ export const encodeBridgeMetadata = (
168
+ params: BridgeMetadataProps,
169
+ single = true
170
+ ) => {
171
+ const encodedData = ethers.utils.defaultAbiCoder.encode(
172
+ actionMetadataTypes.bridge,
173
+ [
174
+ params.amount,
175
+ params.receiver,
176
+ params.fromToken,
177
+ params.toToken,
178
+ params.toChainId,
179
+ params.bridgeFee,
180
+ params.nativeToken,
181
+ ]
182
+ );
183
+
184
+ const data = encodeMetadata({
185
+ type: "bridge",
186
+ encodedData,
187
+ });
188
+
189
+ return single ? encodeMultipleActions(data) : data;
190
+ };
191
+
192
+ export const encodeMultipleActions = (...actionData: string[]) => {
193
+ return ethers.utils.defaultAbiCoder.encode(multiMetadataTypes, [actionData]);
194
+ };
195
+
196
+ export const decodeMetadata = (data: string) => {
197
+ try {
198
+ const iface = Forwarder__factory.createInterface();
199
+ let metadata = "0x";
200
+ let payload = {};
201
+
202
+ if (!data) return payload;
203
+
204
+ if (data.startsWith("0x18e7f485")) {
205
+ const executeData = iface.decodeFunctionData("execute", data);
206
+ if (executeData.metadata_ === "0x" || !executeData.metadata_) {
207
+ return null;
208
+ } else {
209
+ metadata = executeData.metadata_;
210
+ }
211
+ } else {
212
+ const executeDataV2 = iface.decodeFunctionData("executeV2", data);
213
+ if (
214
+ executeDataV2.params_.metadata === "0x" ||
215
+ !executeDataV2.params_.metadata
216
+ ) {
217
+ return null;
218
+ } else {
219
+ metadata = executeDataV2.params_.metadata;
220
+ }
221
+ }
222
+
223
+ const metadataArr = [];
224
+
225
+ const [decodedMultiMetadata = []] =
226
+ (ethers.utils.defaultAbiCoder.decode(
227
+ multiMetadataTypes,
228
+ metadata
229
+ ) as string[]) || [];
230
+
231
+ for (let metadata of decodedMultiMetadata) {
232
+ const decodedMetadata = ethers.utils.defaultAbiCoder.decode(
233
+ metadataTypes,
234
+ metadata
235
+ );
236
+
237
+ const type = ethers.utils.parseBytes32String(
238
+ decodedMetadata.type
239
+ ) as keyof typeof actionMetadataTypes;
240
+
241
+ const decodedData = ethers.utils.defaultAbiCoder.decode(
242
+ actionMetadataTypes[type],
243
+ decodedMetadata.data
244
+ );
245
+
246
+ switch (type) {
247
+ case "transfer":
248
+ payload = {
249
+ type,
250
+ token: decodedData.token,
251
+ amount: toBN(decodedData.amount).toFixed(),
252
+ receiver: decodedData.receiver,
253
+ };
254
+ break;
255
+ case "bridge":
256
+ payload = {
257
+ type,
258
+ amount: toBN(decodedData.amount).toFixed(),
259
+ receiver: decodedData.receiver,
260
+ toToken: decodedData.toToken,
261
+ fromToken: decodedData.fromToken,
262
+ toChainId: decodedData.toChainId
263
+ ? decodedData.toChainId.toString()
264
+ : null,
265
+ bridgeFee: toBN(decodedData.bridgeFee).toFixed(),
266
+ };
267
+ break;
268
+ case "swap":
269
+ payload = {
270
+ type,
271
+ buyAmount: toBN(decodedData.buyAmount).toFixed(),
272
+ sellAmount: toBN(decodedData.sellAmount).toFixed(),
273
+ buyToken: decodedData.buyToken,
274
+ sellToken: decodedData.sellToken,
275
+ receiver: decodedData.receiver,
276
+ protocol: utils.parseBytes32String(decodedData?.protocol || ""),
277
+ };
278
+ break;
279
+ case "upgrade":
280
+ payload = {
281
+ type,
282
+ version: utils.parseBytes32String(decodedData?.version || ""),
283
+ walletImpl: decodedData?.walletImpl,
284
+ };
285
+ break;
286
+ case "gas-topup":
287
+ payload = {
288
+ type,
289
+ amount: toBN(decodedData.amount).toFixed(),
290
+ token: decodedData.token,
291
+ onBehalf: decodedData.onBehalf,
292
+ };
293
+ break;
294
+ case "dapp":
295
+ payload = {
296
+ type,
297
+ name: decodedData?.name,
298
+ url: decodedData?.url,
299
+ };
300
+ break;
301
+ case "deploy":
302
+ payload = {
303
+ type,
304
+ };
305
+
306
+ case "permit2":
307
+ payload = {
308
+ type,
309
+ token: decodedData.token,
310
+ spender: decodedData.spender,
311
+ amount: toBN(decodedData.amount).toFixed(),
312
+ expiration: decodedData.expiration,
313
+ };
314
+
315
+ break;
316
+ }
317
+
318
+ metadataArr.push(payload);
319
+ }
320
+
321
+ return metadataArr;
322
+ } catch (e) {
323
+ console.log(e);
324
+ return null;
325
+ }
326
+ };
package/utils/network.ts CHANGED
@@ -1,19 +1,19 @@
1
1
  import { ethers } from "ethers";
2
- import {
3
- AVO_PROD_CHAIN_NAME,
4
- AVO_PROD_CHAIN_ID,
5
- AVO_STAGING_CHAIN_NAME,
6
- AVO_STAGING_RPC_URL,
7
- AVO_PROD_RPC_URL,
8
- AVO_STAGING_CHAIN_ID,
9
- } from "./avocado";
10
2
 
11
3
  export const bridgeDisabledNetworks = [1101];
12
4
 
13
5
  export const networks: Network[] = [
14
6
  {
15
7
  name: "Mainnet",
8
+ debankName: "eth",
9
+ ankrName: "eth",
16
10
  chainId: 1,
11
+ explorerUrl: "https://etherscan.io",
12
+ get serverRpcUrl() {
13
+ return process.env?.MAINNET_RPC_URL || this.params.rpcUrls[0];
14
+ },
15
+ balanceResolverAddress: "0x5b7D61b389D12e1f5873d0cCEe7E675915AB5F43",
16
+ usdcAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
17
17
  params: {
18
18
  rpcUrls: ["https://rpc.ankr.com/eth"],
19
19
  nativeCurrency: {
@@ -25,7 +25,15 @@ export const networks: Network[] = [
25
25
  },
26
26
  {
27
27
  name: "Polygon",
28
+ debankName: "matic",
29
+ ankrName: "polygon",
28
30
  chainId: 137,
31
+ balanceResolverAddress: "0x58632D23120b20650262b8A629a14e4F4043E0D9",
32
+ usdcAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
33
+ explorerUrl: "https://polygonscan.com",
34
+ get serverRpcUrl() {
35
+ return process.env?.POLYGON_RPC_URL || this.params.rpcUrls[0];
36
+ },
29
37
  params: {
30
38
  chainName: "Matic(Polygon) Mainnet",
31
39
  nativeCurrency: {
@@ -34,12 +42,19 @@ export const networks: Network[] = [
34
42
  decimals: 18,
35
43
  },
36
44
  rpcUrls: ["https://polygon-rpc.com"],
37
- blockExplorerUrls: ["https://polygonscan.com/"],
38
45
  },
39
46
  },
40
47
  {
41
48
  name: "Arbitrum",
49
+ debankName: "arb",
50
+ ankrName: "arbitrum",
42
51
  chainId: 42161,
52
+ usdcAddress: "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",
53
+ balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
54
+ explorerUrl: "https://arbiscan.io",
55
+ get serverRpcUrl() {
56
+ return process.env?.ARBITRUM_RPC_URL || this.params.rpcUrls[0];
57
+ },
43
58
  params: {
44
59
  chainName: "Arbitrum One",
45
60
  nativeCurrency: {
@@ -48,12 +63,19 @@ export const networks: Network[] = [
48
63
  decimals: 18,
49
64
  },
50
65
  rpcUrls: ["https://arb1.arbitrum.io/rpc"],
51
- blockExplorerUrls: ["https://arbiscan.io"],
52
66
  },
53
67
  },
54
68
  {
55
69
  name: "Optimism",
70
+ debankName: "op",
71
+ ankrName: "optimism",
56
72
  chainId: 10,
73
+ usdcAddress: "0x7f5c764cbc14f9669b88837ca1490cca17c31607",
74
+ balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
75
+ explorerUrl: "https://optimistic.etherscan.io",
76
+ get serverRpcUrl() {
77
+ return process.env?.OPTIMISM_RPC_URL || this.params.rpcUrls[0];
78
+ },
57
79
  params: {
58
80
  chainName: "Optimistic Ethereum",
59
81
  nativeCurrency: {
@@ -62,12 +84,19 @@ export const networks: Network[] = [
62
84
  decimals: 18,
63
85
  },
64
86
  rpcUrls: ["https://mainnet.optimism.io"],
65
- blockExplorerUrls: ["https://optimistic.etherscan.io"],
66
87
  },
67
88
  },
68
89
  {
69
90
  name: "Avalanche",
91
+ debankName: "avax",
92
+ ankrName: "avalanche",
70
93
  chainId: 43114,
94
+ usdcAddress: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
95
+ balanceResolverAddress: "0x63009f31D054E0ac9F321Cf0D642375236A4Bf1E",
96
+ explorerUrl: "https://snowtrace.io",
97
+ get serverRpcUrl() {
98
+ return process.env?.AVALANCHE_RPC_URL || this.params.rpcUrls[0];
99
+ },
71
100
  params: {
72
101
  chainName: "Avalanche Network",
73
102
  nativeCurrency: {
@@ -76,12 +105,19 @@ export const networks: Network[] = [
76
105
  decimals: 18,
77
106
  },
78
107
  rpcUrls: ["https://api.avax.network/ext/bc/C/rpc"],
79
- blockExplorerUrls: ["https://snowtrace.io/"],
80
108
  },
81
109
  },
82
110
  {
83
111
  name: "BSC",
112
+ debankName: "bsc",
113
+ ankrName: "bsc",
84
114
  chainId: 56,
115
+ explorerUrl: "https://bscscan.com",
116
+ usdcAddress: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
117
+ balanceResolverAddress: "0xb808cff38706e267067b0af427726aa099f69f89",
118
+ get serverRpcUrl() {
119
+ return process.env?.BSC_RPC_URL || this.params.rpcUrls[0];
120
+ },
85
121
  params: {
86
122
  chainName: "Binance Smart Chain",
87
123
  rpcUrls: ["https://rpc.ankr.com/bsc"],
@@ -94,7 +130,15 @@ export const networks: Network[] = [
94
130
  },
95
131
  {
96
132
  name: "Gnosis",
133
+ debankName: "xdai",
134
+ ankrName: "gnosis",
97
135
  chainId: 100,
136
+ balanceResolverAddress: "0xfaa244e276b1597f663975ed007ee4ff70d27849",
137
+ explorerUrl: "https://gnosisscan.io",
138
+ usdcAddress: "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
139
+ get serverRpcUrl() {
140
+ return process.env?.GNOSIS_RPC_URL || this.params.rpcUrls[0];
141
+ },
98
142
  params: {
99
143
  chainName: "Gnosis Safe",
100
144
  rpcUrls: ["https://rpc.ankr.com/gnosis"],
@@ -108,9 +152,16 @@ export const networks: Network[] = [
108
152
  {
109
153
  name: "Polygon zkEVM",
110
154
  chainId: 1101,
155
+ explorerUrl: "https://zkevm.polygonscan.com",
156
+ balanceResolverAddress: "0x48D1Fa5Ee6691a1E0B45d2B515650997BEA27a01",
157
+ usdcAddress: "0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035",
158
+ get serverRpcUrl() {
159
+ return process.env?.POLYGON_ZKEVM_RPC_URL || this.params.rpcUrls[0];
160
+ },
111
161
  params: {
112
162
  chainName: "polygon zkEVM",
113
163
  rpcUrls: ["https://rpc.ankr.com/polygon_zkevm"],
164
+
114
165
  nativeCurrency: {
115
166
  name: "Ethereum",
116
167
  symbol: "ETH",
@@ -118,9 +169,52 @@ export const networks: Network[] = [
118
169
  },
119
170
  },
120
171
  },
172
+ {
173
+ name: "Aurora",
174
+ chainId: 1313161554,
175
+ explorerUrl: "https://explorer.mainnet.aurora.dev",
176
+ get serverRpcUrl() {
177
+ return process.env?.AURORA_RPC_URL || this.params.rpcUrls[0];
178
+ },
179
+ usdcAddress: "0xB12BFcA5A55806AaF64E99521918A4bf0fC40802",
180
+ balanceResolverAddress: "0xdF19Da523DA64bBE82eE0E4DFf00d676A8386474",
181
+ params: {
182
+ rpcUrls: ["https://mainnet.aurora.dev"],
183
+ chainName: "Aurora",
184
+ nativeCurrency: {
185
+ decimals: 18,
186
+ name: "Aurora ETH",
187
+ symbol: "AETH",
188
+ },
189
+ },
190
+ },
191
+ {
192
+ name: "Fantom",
193
+ chainId: 250,
194
+ explorerUrl: "https://ftmscan.com",
195
+ get serverRpcUrl() {
196
+ return process.env?.FANTOM_RPC_URL || this.params.rpcUrls[0];
197
+ },
198
+ usdcAddress: "0x04068da6c83afcfa0e13ba15a6696662335d5b75",
199
+ balanceResolverAddress: "0x929376c77a2fb8152375a089a4fccf84ff481479",
200
+ params: {
201
+ rpcUrls: ["https://rpc.ankr.com/fantom"],
202
+ chainName: "Fantom",
203
+ nativeCurrency: {
204
+ name: "Fantom",
205
+ symbol: "FTM",
206
+ decimals: 18,
207
+ },
208
+ },
209
+ },
121
210
  {
122
211
  name: AVO_PROD_CHAIN_NAME,
123
212
  chainId: AVO_PROD_CHAIN_ID,
213
+ isAvocado: true,
214
+ balanceResolverAddress: "",
215
+ usdcAddress: "",
216
+ serverRpcUrl: AVO_PROD_RPC_URL,
217
+ explorerUrl: AVO_PROD_EXPLORER_URL,
124
218
  params: {
125
219
  chainName: AVO_PROD_CHAIN_NAME,
126
220
  nativeCurrency: {
@@ -130,12 +224,16 @@ export const networks: Network[] = [
130
224
  },
131
225
  iconUrls: ["https://avocado.instadapp.io/logo.svg"],
132
226
  rpcUrls: [AVO_PROD_RPC_URL],
133
- blockExplorerUrls: ["https://avocado.instadapp.io"],
134
227
  },
135
228
  },
136
229
  {
137
230
  name: AVO_STAGING_CHAIN_NAME,
138
231
  chainId: AVO_STAGING_CHAIN_ID,
232
+ serverRpcUrl: AVO_STAGING_RPC_URL,
233
+ explorerUrl: AVO_STAGING_EXPLORER_URL,
234
+ isAvocado: true,
235
+ balanceResolverAddress: "",
236
+ usdcAddress: "",
139
237
  params: {
140
238
  chainName: AVO_STAGING_CHAIN_NAME,
141
239
  nativeCurrency: {
@@ -145,21 +243,18 @@ export const networks: Network[] = [
145
243
  },
146
244
  iconUrls: ["https://avocado.instadapp.io/logo.svg"],
147
245
  rpcUrls: [AVO_STAGING_RPC_URL],
148
- blockExplorerUrls: ["https://avocado.instadapp.io"],
149
246
  },
150
247
  },
151
248
  ];
152
249
 
153
250
  export const getNetworkByChainId = (
154
- chainId: Network["chainId"] | number | string
155
- ) => {
156
- return networks.find((i) => i.chainId === Number(chainId))!;
251
+ chainId: ChainId | number | string
252
+ ): Network => {
253
+ return networks.find((i) => i.chainId == chainId)!;
157
254
  };
158
255
 
159
256
  export const availableNetworks = networks.filter(
160
- (network) =>
161
- network.chainId != AVO_STAGING_CHAIN_ID &&
162
- network.chainId != AVO_PROD_CHAIN_ID
257
+ (network) => !network.isAvocado
163
258
  );
164
259
 
165
260
  export const chainIdToName = (chainId: ChainId | number | string) => {
@@ -180,6 +275,18 @@ export const RPCMap = networks.reduce((acc, network) => {
180
275
  export const networkIds = networks.map((network) => network.chainId);
181
276
 
182
277
  const rpcInstances: Record<string, ethers.providers.JsonRpcProvider> = {};
278
+ const serverRpcInstances: Record<string, ethers.providers.JsonRpcProvider> = {};
279
+
280
+ export const getServerRpcProvider = (chainId: number | string) => {
281
+ if (!rpcInstances[chainId]) {
282
+ const network = networks.find((n) => n.chainId == chainId);
283
+ serverRpcInstances[chainId] = new ethers.providers.JsonRpcProvider(
284
+ network?.serverRpcUrl
285
+ );
286
+ }
287
+
288
+ return serverRpcInstances[chainId];
289
+ };
183
290
 
184
291
  export const getRpcProvider = (chainId: number | string) => {
185
292
  if (!rpcInstances[chainId]) {
@@ -190,3 +297,11 @@ export const getRpcProvider = (chainId: number | string) => {
190
297
 
191
298
  return rpcInstances[chainId];
192
299
  };
300
+
301
+ export const getExplorerUrl = (
302
+ chainId: ChainId | number | string,
303
+ suffix: `/${string}` = "/"
304
+ ) => {
305
+ const network = getNetworkByChainId(chainId);
306
+ return `${network.explorerUrl}${suffix}`;
307
+ };
package/utils/utils.d.ts CHANGED
@@ -1,13 +1,33 @@
1
- type ChainId = 1 | 137 | 42161 | 10 | 56 | 43114 | 100 | 1101 | 634 | 63400;
1
+ type ChainId =
2
+ | 1
3
+ | 137
4
+ | 42161
5
+ | 10
6
+ | 56
7
+ | 43114
8
+ | 100
9
+ | 1101
10
+ | 250
11
+ | 634
12
+ | 1313161554
13
+ | 63400;
14
+
15
+ type ISlackMessageType = "danger" | "error" | "success" | "banner";
2
16
 
3
17
  interface Network {
4
18
  name: string;
19
+ debankName?: string;
20
+ ankrName?: string;
5
21
  chainId: ChainId;
22
+ isAvocado?: boolean;
23
+ serverRpcUrl: string | undefined;
24
+ balanceResolverAddress?: string;
25
+ usdcAddress: string;
26
+ explorerUrl: string;
6
27
  params: {
7
28
  chainName?: string;
8
- rpcUrls: string[];
9
- blockExplorerUrls?: string[];
10
29
  iconUrls?: string[];
30
+ rpcUrls: string[];
11
31
  nativeCurrency?: {
12
32
  name: string;
13
33
  symbol: string;
@@ -15,3 +35,66 @@ interface Network {
15
35
  };
16
36
  };
17
37
  }
38
+
39
+ type SignMetadataProps = {
40
+ token: string;
41
+ spender: string;
42
+ amount: string;
43
+ expiration: string;
44
+ };
45
+
46
+ type DappMetadataProps = {
47
+ name: string;
48
+ url: string;
49
+ };
50
+
51
+ type SendMetadataProps = {
52
+ token: string;
53
+ amount: string;
54
+ receiver: string;
55
+ };
56
+
57
+ type UpgradeMetadataProps = {
58
+ version: string;
59
+ walletImpl: string;
60
+ };
61
+
62
+ type TopupMetadataProps = {
63
+ amount: string;
64
+ token: string;
65
+ onBehalf: string;
66
+ };
67
+
68
+ type BridgeMetadataProps = {
69
+ amount: string;
70
+ receiver: string;
71
+ fromToken: string;
72
+ toToken: string;
73
+ toChainId: string;
74
+ bridgeFee: string;
75
+ nativeToken: string;
76
+ };
77
+
78
+ type SwapMetadataProps = {
79
+ sellToken: string;
80
+ buyToken: string;
81
+ sellAmount: string;
82
+ buyAmount: string;
83
+ receiver: string;
84
+ protocol?: string;
85
+ };
86
+
87
+ type MetadataProps = {
88
+ type:
89
+ | "transfer"
90
+ | "bridge"
91
+ | "swap"
92
+ | "multi"
93
+ | "gas-topup"
94
+ | "upgrade"
95
+ | "dapp"
96
+ | "deploy"
97
+ | "permit2";
98
+ encodedData: string;
99
+ version?: string;
100
+ };