@instadapp/avocado-base 0.0.0-dev.bf2fef7 → 0.0.0-dev.c2f5e67

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.
Files changed (46) hide show
  1. package/.github/workflows/npm-publish-dev.yml +2 -5
  2. package/abi/multisigAgnosticForwarder.json +1 -0
  3. package/abi/multisigForwarder.json +697 -0
  4. package/app.vue +7 -0
  5. package/assets/images/icons/change-threshold.svg +4 -0
  6. package/assets/images/icons/cross-transfer.svg +7 -0
  7. package/assets/images/icons/dapp.svg +4 -0
  8. package/assets/images/icons/deploy.svg +12 -0
  9. package/assets/images/icons/gas.svg +12 -5
  10. package/assets/images/icons/hammer.svg +5 -0
  11. package/assets/images/icons/info-2.svg +12 -0
  12. package/assets/images/icons/instadapp-pro.svg +4 -0
  13. package/assets/images/icons/multi-send.svg +7 -0
  14. package/assets/images/icons/permit-sign.svg +11 -0
  15. package/assets/images/icons/plus-circle.svg +6 -0
  16. package/assets/images/icons/refresh.svg +4 -4
  17. package/assets/images/icons/reject-proposal.svg +6 -0
  18. package/assets/images/icons/stars.svg +4 -0
  19. package/assets/images/icons/transfer.svg +5 -0
  20. package/assets/images/icons/trash-2.svg +8 -0
  21. package/assets/images/icons/upgrade.svg +4 -0
  22. package/components/ActionLogo.vue +42 -0
  23. package/components/ActionMetadata.vue +35 -26
  24. package/components/AuthorityAvatar.vue +37 -0
  25. package/components/ChainLogo.vue +14 -563
  26. package/components/CopyClipboard.vue +58 -0
  27. package/components/metadata/Bridge.vue +26 -6
  28. package/components/metadata/CrossTransfer.vue +16 -4
  29. package/components/metadata/GasTopup.vue +7 -1
  30. package/components/metadata/Permit2.vue +6 -1
  31. package/components/metadata/Signers.vue +66 -0
  32. package/components/metadata/Swap.vue +25 -25
  33. package/components/metadata/Transfer.vue +6 -2
  34. package/contracts/MultisigAgnosticForwarder.ts +1413 -0
  35. package/contracts/MultisigForwarder.ts +859 -0
  36. package/contracts/factories/MultisigAgnosticForwarder__factory.ts +2051 -0
  37. package/contracts/factories/MultisigForwarder__factory.ts +721 -0
  38. package/contracts/factories/index.ts +2 -0
  39. package/contracts/index.ts +4 -0
  40. package/package.json +14 -9
  41. package/utils/formatter.ts +2 -2
  42. package/utils/helper.ts +2 -1
  43. package/utils/metadata.ts +232 -59
  44. package/utils/network.ts +388 -74
  45. package/utils/services.ts +8 -1
  46. package/utils/utils.d.ts +143 -134
@@ -6,9 +6,13 @@ 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 { MultisigAgnosticForwarder } from "./MultisigAgnosticForwarder";
10
+ export type { MultisigForwarder } from "./MultisigForwarder";
9
11
  export * as factories from "./factories";
10
12
  export { AvoFactoryProxy__factory } from "./factories/AvoFactoryProxy__factory";
11
13
  export { BalanceResolver__factory } from "./factories/BalanceResolver__factory";
12
14
  export { Erc20__factory } from "./factories/Erc20__factory";
13
15
  export { Forwarder__factory } from "./factories/Forwarder__factory";
14
16
  export { GaslessWallet__factory } from "./factories/GaslessWallet__factory";
17
+ export { MultisigAgnosticForwarder__factory } from "./factories/MultisigAgnosticForwarder__factory";
18
+ export { MultisigForwarder__factory } from "./factories/MultisigForwarder__factory";
package/package.json CHANGED
@@ -1,30 +1,35 @@
1
1
  {
2
2
  "name": "@instadapp/avocado-base",
3
- "version": "0.0.0-dev.bf2fef7",
3
+ "version": "0.0.0-dev.c2f5e67",
4
4
  "type": "module",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "global.d.ts",
7
+ "engines": {
8
+ "node": ">=v18.18.0"
9
+ },
7
10
  "scripts": {
8
11
  "build": "nuxt build",
9
12
  "dev": "nuxt dev",
10
13
  "generate": "nuxt generate",
11
14
  "preview": "nuxt preview",
12
- "generate:contracts": "rimraf contracts && typechain --target=ethers-v5 'abi/*.json' --out-dir 'contracts'"
15
+ "generate:contracts": "rimraf contracts && typechain --target=ethers-v5 'abi/*.json' --out-dir 'contracts'",
16
+ "typecheck": "nuxi typecheck"
13
17
  },
14
18
  "devDependencies": {
15
- "@instadapp/avocado": "^0.1.10",
16
- "@instadapp/avocado-dev": "npm:@instadapp/avocado@dev",
17
- "@nuxtjs/tailwindcss": "^6.6.5",
19
+ "@nuxtjs/tailwindcss": "^6.11.3",
18
20
  "@typechain/ethers-v5": "^10.2.0",
19
- "nuxt": "^3.6.1",
20
- "nuxt-svgo": "^3.1.0",
21
+ "nuxt": "^3.10.1",
22
+ "nuxt-svgo": "^4.0.0",
21
23
  "rimraf": "^3.0.2",
22
24
  "typechain": "^8.1.1",
23
- "unplugin-vue-components": "^0.25.1"
25
+ "unplugin-vue-components": "^0.25.1",
26
+ "vue-tippy": "^6.0.0"
24
27
  },
25
28
  "dependencies": {
26
29
  "@vueuse/nuxt": "^10.2.0",
27
30
  "bignumber.js": "^9.1.1",
28
- "ethers": "^5.7.2"
31
+ "ethers": "^5.7.2",
32
+ "viem": "^2.10.5",
33
+ "xxhashjs": "^0.2.2"
29
34
  }
30
35
  }
@@ -19,7 +19,7 @@ export function formatPercent(
19
19
  return formatter.format(valueAsNumber);
20
20
  }
21
21
 
22
- export function shortenHash(hash: string, length: number = 4) {
22
+ export function shortenHash(hash: string | `0x${string}`, length: number = 4) {
23
23
  if (!hash) return;
24
24
  if (hash.length < 12) return hash;
25
25
  const beginningChars = hash.startsWith("0x") ? length + 2 : length;
@@ -72,7 +72,7 @@ export function formatDecimal(value: string | number, fractionDigits?: number) {
72
72
  let decimals;
73
73
 
74
74
  if (num.lt(1)) {
75
- decimals = 8;
75
+ decimals = 4;
76
76
  } else if (num.lt(10)) {
77
77
  decimals = 6;
78
78
  } else if (num.lt(100)) {
package/utils/helper.ts CHANGED
@@ -58,4 +58,5 @@ export function formatMultipleAddresses(addresses: string[], shorten = true) {
58
58
  const formattedString = formatter.format(addresses.map(i => shorten ? shortenHash(i) || '' : i))
59
59
 
60
60
  return formattedString
61
- }
61
+ }
62
+
package/utils/metadata.ts CHANGED
@@ -1,5 +1,30 @@
1
1
  import { ethers, utils } from "ethers";
2
- import { Forwarder__factory } from "../contracts";
2
+ import { Forwarder__factory, MultisigForwarder__factory, MultisigAgnosticForwarder__factory } from "../contracts";
3
+ import { toBN } from "./bignumber";
4
+
5
+ export const MetadataEnums = {
6
+ transfer: "transfer",
7
+ bridge: "bridge",
8
+ 'bridge-v2': 'bridge-v2',
9
+ swap: "swap",
10
+ "gas-topup": "gas-topup",
11
+ upgrade: "upgrade",
12
+ dapp: "dapp",
13
+ deploy: "deploy",
14
+ permit2: "permit2",
15
+ "cross-transfer": "cross-transfer",
16
+ 'cross-transfer-v2': 'cross-transfer-v2',
17
+ auth: "auth",
18
+ rejection: "rejection",
19
+ "instadapp-pro": "instadapp-pro",
20
+ "add-signers": "add-signers",
21
+ "remove-signers": "remove-signers",
22
+ "change-threshold": "change-threshold",
23
+ import: "import",
24
+ mass: "mass",
25
+ "tx-builder": "tx-builder",
26
+ "avocado-bridge": "avocado-bridge",
27
+ } as const;
3
28
 
4
29
  const multiMetadataTypes = ["bytes[]"];
5
30
 
@@ -14,6 +39,14 @@ const actionMetadataTypes: Record<MetadataTypes, string[]> = {
14
39
  "uint256 amount",
15
40
  "address receiver",
16
41
  ],
42
+ "cross-transfer-v2": [
43
+ "address fromToken",
44
+ "address toToken",
45
+ "uint256 toChainId",
46
+ "uint256 amount",
47
+ "address receiver",
48
+ "bytes32 provider",
49
+ ],
17
50
  bridge: [
18
51
  "uint256 amount",
19
52
  "address receiver",
@@ -23,6 +56,16 @@ const actionMetadataTypes: Record<MetadataTypes, string[]> = {
23
56
  "uint256 bridgeFee",
24
57
  "address nativeToken",
25
58
  ],
59
+ 'bridge-v2': [
60
+ "uint256 amount",
61
+ "address receiver",
62
+ "address fromToken",
63
+ "address toToken",
64
+ "uint256 toChainId",
65
+ "uint256 bridgeFee",
66
+ "address nativeToken",
67
+ "bytes32 provider",
68
+ ],
26
69
  swap: [
27
70
  "address sellToken",
28
71
  "address buyToken",
@@ -34,8 +77,10 @@ const actionMetadataTypes: Record<MetadataTypes, string[]> = {
34
77
  "gas-topup": ["uint256 amount", "address token", "address onBehalf"],
35
78
  upgrade: ["bytes32 version", "address walletImpl"],
36
79
  dapp: ["string name", "string url"],
80
+ import: ["bytes32 protocol", "uint256 valueInUsd"],
37
81
  auth: ["address address", "uint256 chainId", "bool remove"],
38
82
  deploy: [],
83
+ "tx-builder": ["bytes32 actionCount"],
39
84
  permit2: [
40
85
  "address token",
41
86
  "address spender",
@@ -43,10 +88,12 @@ const actionMetadataTypes: Record<MetadataTypes, string[]> = {
43
88
  "uint48 expiration",
44
89
  ],
45
90
  "instadapp-pro": ["string castDetails"],
46
- 'add-signers': ['address[] signers'],
47
- 'remove-signers': ['address[] signers'],
48
- 'change-threshold': ['uint8 count'],
49
- 'rejection': ['bytes32 id'],
91
+ "add-signers": ["address[] signers"],
92
+ "remove-signers": ["address[] signers"],
93
+ "change-threshold": ["uint8 count"],
94
+ rejection: ["bytes32 id"],
95
+ "avocado-bridge": ["bytes32 id", "uint256 toChainId"],
96
+ mass: ["bool isMass"],
50
97
  };
51
98
 
52
99
  const encodeMetadata = (props: MetadataProps) => {
@@ -67,7 +114,25 @@ export const encodeDappMetadata = (
67
114
  );
68
115
 
69
116
  const data = encodeMetadata({
70
- type: "dapp",
117
+ type: MetadataEnums.dapp,
118
+ encodedData,
119
+ });
120
+
121
+ return single ? encodeMultipleActions(data) : data;
122
+ };
123
+
124
+ export const encodeAvocadoBridgeMetadata = (
125
+ id: string,
126
+ toChainId: string | number,
127
+ single = true
128
+ ) => {
129
+ const encodedData = ethers.utils.defaultAbiCoder.encode(
130
+ actionMetadataTypes["avocado-bridge"],
131
+ [id, toChainId]
132
+ );
133
+
134
+ const data = encodeMetadata({
135
+ type: MetadataEnums["avocado-bridge"],
71
136
  encodedData,
72
137
  });
73
138
 
@@ -84,7 +149,7 @@ export const encodeTransferMetadata = (
84
149
  );
85
150
 
86
151
  const data = encodeMetadata({
87
- type: "transfer",
152
+ type: MetadataEnums.transfer,
88
153
  encodedData,
89
154
  });
90
155
 
@@ -98,7 +163,7 @@ export const encodeRejectionMetadata = (id: string, single = true) => {
98
163
  );
99
164
 
100
165
  const data = encodeMetadata({
101
- type: "rejection",
166
+ type: MetadataEnums.rejection,
102
167
  encodedData,
103
168
  });
104
169
 
@@ -109,8 +174,21 @@ export const encodeCrossTransferMetadata = (
109
174
  params: CrossSendMetadataProps,
110
175
  single = true
111
176
  ) => {
112
- const encodedData = ethers.utils.defaultAbiCoder.encode(
113
- actionMetadataTypes["cross-transfer"],
177
+
178
+ const type = params.provider ? MetadataEnums["cross-transfer-v2"] : MetadataEnums["cross-transfer"]
179
+
180
+ const encodedData = params.provider ? ethers.utils.defaultAbiCoder.encode(
181
+ actionMetadataTypes[type],
182
+ [
183
+ params.fromToken,
184
+ params.toToken,
185
+ params.toChainId,
186
+ params.amount,
187
+ params.receiver,
188
+ params.provider
189
+ ]
190
+ ) : ethers.utils.defaultAbiCoder.encode(
191
+ actionMetadataTypes[type],
114
192
  [
115
193
  params.fromToken,
116
194
  params.toToken,
@@ -121,7 +199,7 @@ export const encodeCrossTransferMetadata = (
121
199
  );
122
200
 
123
201
  const data = encodeMetadata({
124
- type: "cross-transfer",
202
+ type: MetadataEnums[type],
125
203
  encodedData,
126
204
  });
127
205
 
@@ -138,7 +216,7 @@ export const encodeAuthMetadata = (
138
216
  );
139
217
 
140
218
  const data = encodeMetadata({
141
- type: "auth",
219
+ type: MetadataEnums.auth,
142
220
  encodedData,
143
221
  });
144
222
 
@@ -147,13 +225,30 @@ export const encodeAuthMetadata = (
147
225
 
148
226
  export const encodeDeployMetadata = (single = true) => {
149
227
  const data = encodeMetadata({
150
- type: "deploy",
228
+ type: MetadataEnums.deploy,
151
229
  encodedData: "0x",
152
230
  });
153
231
 
154
232
  return single ? encodeMultipleActions(data) : data;
155
233
  };
156
234
 
235
+ export const encodeTransactionBuilderMetadata = (
236
+ actionCount: string,
237
+ single = true
238
+ ) => {
239
+ const encodedData = ethers.utils.defaultAbiCoder.encode(
240
+ actionMetadataTypes["tx-builder"],
241
+ [actionCount]
242
+ );
243
+
244
+ const data = encodeMetadata({
245
+ type: MetadataEnums["tx-builder"],
246
+ encodedData,
247
+ });
248
+
249
+ return single ? encodeMultipleActions(data) : data;
250
+ };
251
+
157
252
  export const encodeWCSignMetadata = (
158
253
  params: SignMetadataProps,
159
254
  single = true
@@ -164,7 +259,7 @@ export const encodeWCSignMetadata = (
164
259
  );
165
260
 
166
261
  const data = encodeMetadata({
167
- type: "permit2",
262
+ type: MetadataEnums.permit2,
168
263
  encodedData,
169
264
  });
170
265
 
@@ -181,7 +276,7 @@ export const encodeUpgradeMetadata = (
181
276
  );
182
277
 
183
278
  const data = encodeMetadata({
184
- type: "upgrade",
279
+ type: MetadataEnums.upgrade,
185
280
  encodedData,
186
281
  });
187
282
 
@@ -205,7 +300,7 @@ export const encodeSwapMetadata = (
205
300
  );
206
301
 
207
302
  const data = encodeMetadata({
208
- type: "swap",
303
+ type: MetadataEnums.swap,
209
304
  encodedData,
210
305
  });
211
306
 
@@ -221,10 +316,8 @@ export const encodeTopupMetadata = (
221
316
  [params.amount, params.token, params.onBehalf]
222
317
  );
223
318
 
224
- console.log(params);
225
-
226
319
  const data = encodeMetadata({
227
- type: "gas-topup",
320
+ type: MetadataEnums["gas-topup"],
228
321
  encodedData,
229
322
  });
230
323
 
@@ -235,7 +328,21 @@ export const encodeBridgeMetadata = (
235
328
  params: BridgeMetadataProps,
236
329
  single = true
237
330
  ) => {
238
- const encodedData = ethers.utils.defaultAbiCoder.encode(
331
+ const type = params.version === '2' ? MetadataEnums["bridge-v2"] : MetadataEnums.bridge
332
+
333
+ const encodedData = params.version === '2' ? ethers.utils.defaultAbiCoder.encode(
334
+ actionMetadataTypes["bridge-v2"],
335
+ [
336
+ params.amount,
337
+ params.receiver,
338
+ params.fromToken,
339
+ params.toToken,
340
+ params.toChainId,
341
+ params.bridgeFee,
342
+ params.nativeToken,
343
+ params.provider
344
+ ]
345
+ ): ethers.utils.defaultAbiCoder.encode(
239
346
  actionMetadataTypes.bridge,
240
347
  [
241
348
  params.amount,
@@ -249,7 +356,7 @@ export const encodeBridgeMetadata = (
249
356
  );
250
357
 
251
358
  const data = encodeMetadata({
252
- type: "bridge",
359
+ type,
253
360
  encodedData,
254
361
  });
255
362
 
@@ -266,7 +373,7 @@ export const encodeChangeThresholdMetadata = (
266
373
  );
267
374
 
268
375
  const data = encodeMetadata({
269
- type: "change-threshold",
376
+ type: MetadataEnums["change-threshold"],
270
377
  encodedData,
271
378
  });
272
379
 
@@ -283,13 +390,40 @@ export const encodeRemoveSignersMetadata = (
283
390
  );
284
391
 
285
392
  const data = encodeMetadata({
286
- type: "remove-signers",
393
+ type: MetadataEnums["remove-signers"],
287
394
  encodedData,
288
395
  });
289
396
 
290
397
  return single ? encodeMultipleActions(data) : data;
291
398
  };
292
399
 
400
+ export const encodeImportMetadata = (
401
+ protocol: string,
402
+ valueInUsd: string,
403
+ single = true
404
+ ) => {
405
+ const encodedData = ethers.utils.defaultAbiCoder.encode(
406
+ actionMetadataTypes["import"],
407
+ [protocol, valueInUsd]
408
+ );
409
+
410
+ const data = encodeMetadata({
411
+ type: MetadataEnums["import"],
412
+ encodedData,
413
+ });
414
+
415
+ return single ? encodeMultipleActions(data) : data;
416
+ };
417
+
418
+ export const encodeMassMetadata = (single = true) => {
419
+ const data = encodeMetadata({
420
+ type: MetadataEnums.mass,
421
+ encodedData: '0x',
422
+ });
423
+
424
+ return single ? encodeMultipleActions(data) : data;
425
+ }
426
+
293
427
  export const encodeAddSignersMetadata = (
294
428
  addresses: string[],
295
429
  single = true
@@ -300,7 +434,7 @@ export const encodeAddSignersMetadata = (
300
434
  );
301
435
 
302
436
  const data = encodeMetadata({
303
- type: "add-signers",
437
+ type: MetadataEnums["add-signers"],
304
438
  encodedData,
305
439
  });
306
440
 
@@ -330,11 +464,23 @@ export const decodeMetadata = (metadata: string) => {
330
464
  }
331
465
  };
332
466
 
467
+ const iface = Forwarder__factory.createInterface();
468
+ const ifaceMultisig = MultisigForwarder__factory.createInterface();
469
+ const ifaceAgnostic = MultisigAgnosticForwarder__factory.createInterface();
470
+
333
471
  const getMetadataFromData = (data: string) => {
334
- const iface = Forwarder__factory.createInterface();
335
472
  let metadata = "0x";
336
473
 
337
- if (data.startsWith("0x18e7f485")) {
474
+
475
+ if(data.startsWith('0x320036b4')) {
476
+ const executeData = ifaceAgnostic.decodeFunctionData("executeChainAgnosticV1", data);
477
+
478
+ const metadata = executeData?.params_?.params?.metadata
479
+
480
+ return metadata === '0x' || !metadata ? null : metadata
481
+ }
482
+
483
+ else if (data.startsWith("0x18e7f485")) {
338
484
  const executeData = iface.decodeFunctionData("execute", data);
339
485
  if (executeData.metadata_ === "0x" || !executeData.metadata_) {
340
486
  return null;
@@ -351,43 +497,37 @@ const getMetadataFromData = (data: string) => {
351
497
  } else {
352
498
  metadata = executeDataV2.params_.metadata;
353
499
  }
354
- } else if (data.startsWith("0x85114d53")) {
355
- const executeDataV3 = iface.decodeFunctionData("executeV3", data);
356
- if (
357
- executeDataV3.params_.metadata === "0x" ||
358
- !executeDataV3.params_.metadata
359
- ) {
360
- return null;
361
- } else {
362
- metadata = executeDataV3.params_.metadata;
363
- }
364
500
  } else {
365
- const executeDataMultisigV3 = iface.decodeFunctionData(
366
- "executeMultisigV3",
501
+ const executeDataMultisig = ifaceMultisig.decodeFunctionData(
502
+ "executeV1",
367
503
  data
368
504
  );
369
505
  if (
370
- executeDataMultisigV3.params_.metadata === "0x" ||
371
- !executeDataMultisigV3.params_.metadata
506
+ executeDataMultisig.params_.metadata === "0x" ||
507
+ !executeDataMultisig.params_.metadata
372
508
  ) {
373
509
  return null;
374
510
  } else {
375
- metadata = executeDataMultisigV3.params_.metadata;
511
+ metadata = executeDataMultisig.params_.metadata;
376
512
  }
377
513
  }
378
514
 
379
515
  return metadata;
380
516
  };
381
517
 
382
-
383
518
  const typesPayload: IPayload = {
384
- "transfer": (data, type) => ({
519
+ import: (data, type) => ({
520
+ type,
521
+ protocol: utils.parseBytes32String(data.protocol || ""),
522
+ valueInUsd: toBN(data.valueInUsd).toFixed(),
523
+ }),
524
+ transfer: (data, type) => ({
385
525
  type,
386
526
  token: data.token,
387
527
  amount: toBN(data.amount).toFixed(),
388
528
  receiver: data.receiver,
389
529
  }),
390
- "bridge": (data, type) => ({
530
+ bridge: (data, type) => ({
391
531
  type,
392
532
  amount: toBN(data.amount).toFixed(),
393
533
  receiver: data.receiver,
@@ -396,7 +536,17 @@ const typesPayload: IPayload = {
396
536
  toChainId: data.toChainId ? data.toChainId.toString() : null,
397
537
  bridgeFee: toBN(data.bridgeFee).toFixed(),
398
538
  }),
399
- "swap": (data, type) => ({
539
+ 'bridge-v2': (data, type) => ({
540
+ type: 'bridge',
541
+ amount: toBN(data.amount).toFixed(),
542
+ receiver: data.receiver,
543
+ toToken: data.toToken,
544
+ fromToken: data.fromToken,
545
+ toChainId: data.toChainId ? data.toChainId.toString() : null,
546
+ bridgeFee: toBN(data.bridgeFee).toFixed(),
547
+ provider: utils.parseBytes32String(data.provider || ""),
548
+ }),
549
+ swap: (data, type) => ({
400
550
  type,
401
551
  buyAmount: toBN(data.buyAmount).toFixed(),
402
552
  sellAmount: toBN(data.sellAmount).toFixed(),
@@ -405,7 +555,7 @@ const typesPayload: IPayload = {
405
555
  receiver: data.receiver,
406
556
  protocol: utils.parseBytes32String(data.protocol || ""),
407
557
  }),
408
- "upgrade": (data, type) => ({
558
+ upgrade: (data, type) => ({
409
559
  type,
410
560
  version: utils.parseBytes32String(data.version || ""),
411
561
  walletImpl: data.walletImpl,
@@ -416,15 +566,19 @@ const typesPayload: IPayload = {
416
566
  token: data.token,
417
567
  onBehalf: data.onBehalf,
418
568
  }),
419
- "dapp": (data, type) => ({
569
+ dapp: (data, type) => ({
420
570
  type,
421
571
  name: data.name,
422
572
  url: data.url,
423
573
  }),
424
- "deploy": (data, type) => ({
574
+ deploy: (data, type) => ({
575
+ type,
576
+ }),
577
+ "tx-builder": (data, type) => ({
425
578
  type,
579
+ actionCount: utils.parseBytes32String(data.actionCount || ""),
426
580
  }),
427
- "permit2": (data, type) => ({
581
+ permit2: (data, type) => ({
428
582
  type,
429
583
  token: data.token,
430
584
  spender: data.spender,
@@ -439,7 +593,16 @@ const typesPayload: IPayload = {
439
593
  amount: toBN(data.amount).toFixed(),
440
594
  receiver: data.receiver,
441
595
  }),
442
- "auth": (data) => ({
596
+ "cross-transfer-v2": (data, type) => ({
597
+ type: 'cross-transfer',
598
+ fromToken: data.fromToken,
599
+ toToken: data.toToken,
600
+ toChainId: data.toChainId ? data.toChainId.toString() : null,
601
+ amount: toBN(data.amount).toFixed(),
602
+ receiver: data.receiver,
603
+ provider: utils.parseBytes32String(data.provider || ""),
604
+ }),
605
+ auth: (data) => ({
443
606
  type: data.remove ? "remove-authority" : "add-authority",
444
607
  address: data.address,
445
608
  chainId: data.chainId ? data.chainId.toString() : null,
@@ -449,7 +612,7 @@ const typesPayload: IPayload = {
449
612
  type,
450
613
  castDetails: data.castDetails,
451
614
  }),
452
- "rejection": (data, type) => ({
615
+ rejection: (data, type) => ({
453
616
  type,
454
617
  id: data.id,
455
618
  }),
@@ -464,7 +627,16 @@ const typesPayload: IPayload = {
464
627
  "change-threshold": (data, type) => ({
465
628
  type,
466
629
  count: data.count,
467
- })
630
+ }),
631
+ "avocado-bridge": (data, type) => ({
632
+ type,
633
+ id: data.id,
634
+ toChainId: data.toChainId ? data.toChainId.toString() : null,
635
+ }),
636
+ mass: (data, type) => ({
637
+ type,
638
+ data,
639
+ }),
468
640
  };
469
641
 
470
642
  const parseMetadata = (metadata: string) => {
@@ -486,25 +658,22 @@ const parseMetadata = (metadata: string) => {
486
658
  decodedMetadata.type
487
659
  ) as keyof typeof actionMetadataTypes;
488
660
 
489
- const decodedData = ethers.utils.defaultAbiCoder.decode(
661
+ const decodedData = decodedMetadata?.data === '0x' ? '' : ethers.utils.defaultAbiCoder.decode(
490
662
  actionMetadataTypes[type],
491
663
  decodedMetadata.data
492
664
  );
493
665
 
494
- const payloadFunc = typesPayload[type]
495
-
666
+ const payloadFunc = typesPayload[type];
667
+
496
668
  if (payloadFunc) {
497
- const payload = payloadFunc(decodedData, type)
669
+ const payload = payloadFunc(decodedData, type);
498
670
  metadataArr.push(payload);
499
671
  }
500
-
501
672
  }
502
673
 
503
674
  return metadataArr;
504
675
  };
505
676
 
506
-
507
-
508
677
  /**
509
678
  * Replaces hyphens with spaces and capitalizes the first letter of each word in a sentence.
510
679
  * @param {string} txType - The input sentence to modify
@@ -512,6 +681,10 @@ const parseMetadata = (metadata: string) => {
512
681
  * @returns {string} - The modified sentence with hyphens replaced with spaces and the first letter of each word capitalized.
513
682
  */
514
683
  export const formatTxType = (txType: string) => {
684
+ if(txType === 'mass') {
685
+ return 'Chain Agnostic Payments'
686
+ }
687
+
515
688
  const finalSentence = txType
516
689
  .replace("-", " ")
517
690
  .replace(/(^\w{1})|(\s+\w{1})/g, (letter) => letter.toUpperCase());