@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 +1 -1
- package/utils/metadata.ts +22 -0
- package/utils/utils.d.ts +2 -1
package/package.json
CHANGED
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);
|