@instadapp/avocado-base 0.0.36 → 0.0.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instadapp/avocado-base",
3
- "version": "0.0.36",
3
+ "version": "0.0.37",
4
4
  "type": "module",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "global.d.ts",
package/utils/metadata.ts CHANGED
@@ -43,6 +43,7 @@ const actionMetadataTypes = {
43
43
  "uint48 expiration",
44
44
  ],
45
45
  "instadapp-pro": ["string castDetails"],
46
+ reject: ["string reason"],
46
47
  };
47
48
 
48
49
  const encodeMetadata = (props: MetadataProps) => {
@@ -87,6 +88,20 @@ export const encodeTransferMetadata = (
87
88
  return single ? encodeMultipleActions(data) : data;
88
89
  };
89
90
 
91
+ export const encodeRejectMetadata = (reason: string, single = true) => {
92
+ const encodedData = ethers.utils.defaultAbiCoder.encode(
93
+ actionMetadataTypes.reject,
94
+ [reason]
95
+ );
96
+
97
+ const data = encodeMetadata({
98
+ type: "reject",
99
+ encodedData,
100
+ });
101
+
102
+ return single ? encodeMultipleActions(data) : data;
103
+ };
104
+
90
105
  export const encodeCrossTransferMetadata = (
91
106
  params: CrossSendMetadataProps,
92
107
  single = true
@@ -435,6 +450,13 @@ const parseMetadata = (metadata: string) => {
435
450
  };
436
451
 
437
452
  break;
453
+
454
+ case "reject":
455
+ payload = {
456
+ type,
457
+ reason: decodedData.reason,
458
+ };
459
+ break;
438
460
  }
439
461
 
440
462
  metadataArr.push(payload);
package/utils/utils.d.ts CHANGED
@@ -112,7 +112,8 @@ type MetadataProps = {
112
112
  | "deploy"
113
113
  | "permit2"
114
114
  | "cross-transfer"
115
- | "auth";
115
+ | "auth"
116
+ | "reject";
116
117
  encodedData: string;
117
118
  version?: string;
118
119
  };