@instadapp/avocado-base 0.0.24 → 0.0.26
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 +29 -0
- package/utils/utils.d.ts +8 -1
package/package.json
CHANGED
package/utils/metadata.ts
CHANGED
|
@@ -34,6 +34,7 @@ const actionMetadataTypes = {
|
|
|
34
34
|
"gas-topup": ["uint256 amount", "address token", "address onBehalf"],
|
|
35
35
|
upgrade: ["bytes32 version", "address walletImpl"],
|
|
36
36
|
dapp: ["string name", "string url"],
|
|
37
|
+
auth: ["address address", "uint256 chainId", "bool remove"],
|
|
37
38
|
deploy: [],
|
|
38
39
|
permit2: [
|
|
39
40
|
"address token",
|
|
@@ -108,6 +109,23 @@ export const encodeCrossTransferMetadata = (
|
|
|
108
109
|
return single ? encodeMultipleActions(data) : data;
|
|
109
110
|
};
|
|
110
111
|
|
|
112
|
+
export const encodeAuthMetadata = (
|
|
113
|
+
params: AuthMetadataProps,
|
|
114
|
+
single = true
|
|
115
|
+
) => {
|
|
116
|
+
const encodedData = ethers.utils.defaultAbiCoder.encode(
|
|
117
|
+
actionMetadataTypes["auth"],
|
|
118
|
+
[params.address, params.chainId, params.remove]
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
const data = encodeMetadata({
|
|
122
|
+
type: "auth",
|
|
123
|
+
encodedData,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
return single ? encodeMultipleActions(data) : data;
|
|
127
|
+
};
|
|
128
|
+
|
|
111
129
|
export const encodeDeployMetadata = (single = true) => {
|
|
112
130
|
const data = encodeMetadata({
|
|
113
131
|
type: "deploy",
|
|
@@ -366,6 +384,17 @@ export const decodeMetadata = (data: string) => {
|
|
|
366
384
|
receiver: decodedData.receiver,
|
|
367
385
|
};
|
|
368
386
|
|
|
387
|
+
break;
|
|
388
|
+
case "auth":
|
|
389
|
+
payload = {
|
|
390
|
+
type: decodedData.remove ? "remove-authority" : "add-authority",
|
|
391
|
+
address: decodedData.address,
|
|
392
|
+
chainId: decodedData.chainId
|
|
393
|
+
? decodedData.chainId.toString()
|
|
394
|
+
: null,
|
|
395
|
+
remove: decodedData.remove,
|
|
396
|
+
};
|
|
397
|
+
|
|
369
398
|
break;
|
|
370
399
|
}
|
|
371
400
|
|
package/utils/utils.d.ts
CHANGED
|
@@ -64,6 +64,12 @@ type CrossSendMetadataProps = {
|
|
|
64
64
|
receiver: string;
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
+
type AuthMetadataProps = {
|
|
68
|
+
address: string;
|
|
69
|
+
chainId: string;
|
|
70
|
+
remove: boolean;
|
|
71
|
+
};
|
|
72
|
+
|
|
67
73
|
type UpgradeMetadataProps = {
|
|
68
74
|
version: string;
|
|
69
75
|
walletImpl: string;
|
|
@@ -105,7 +111,8 @@ type MetadataProps = {
|
|
|
105
111
|
| "dapp"
|
|
106
112
|
| "deploy"
|
|
107
113
|
| "permit2"
|
|
108
|
-
| "cross-transfer"
|
|
114
|
+
| "cross-transfer"
|
|
115
|
+
| "auth";
|
|
109
116
|
encodedData: string;
|
|
110
117
|
version?: string;
|
|
111
118
|
};
|