@instadapp/avocado-base 0.0.21 → 0.0.25
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/abi/forwarder.json +1253 -149
- package/contracts/Forwarder.ts +856 -2
- package/contracts/factories/Forwarder__factory.ts +816 -16
- package/package.json +1 -1
- package/utils/metadata.ts +41 -2
- package/utils/utils.d.ts +8 -1
package/package.json
CHANGED
package/utils/metadata.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ethers, utils } from "ethers";
|
|
2
|
-
import { Forwarder__factory } from "
|
|
2
|
+
import { Forwarder__factory } from "../contracts";
|
|
3
3
|
|
|
4
4
|
const multiMetadataTypes = ["bytes[]"];
|
|
5
5
|
|
|
@@ -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",
|
|
@@ -238,7 +256,7 @@ export const decodeMetadata = (data: string) => {
|
|
|
238
256
|
} else {
|
|
239
257
|
metadata = executeData.metadata_;
|
|
240
258
|
}
|
|
241
|
-
} else {
|
|
259
|
+
} else if (data.startsWith("0x14f80a8d")) {
|
|
242
260
|
const executeDataV2 = iface.decodeFunctionData("executeV2", data);
|
|
243
261
|
if (
|
|
244
262
|
executeDataV2.params_.metadata === "0x" ||
|
|
@@ -248,6 +266,16 @@ export const decodeMetadata = (data: string) => {
|
|
|
248
266
|
} else {
|
|
249
267
|
metadata = executeDataV2.params_.metadata;
|
|
250
268
|
}
|
|
269
|
+
} else {
|
|
270
|
+
const executeDataV3 = iface.decodeFunctionData("executeV3", data);
|
|
271
|
+
if (
|
|
272
|
+
executeDataV3.params_.metadata === "0x" ||
|
|
273
|
+
!executeDataV3.params_.metadata
|
|
274
|
+
) {
|
|
275
|
+
return null;
|
|
276
|
+
} else {
|
|
277
|
+
metadata = executeDataV3.params_.metadata;
|
|
278
|
+
}
|
|
251
279
|
}
|
|
252
280
|
|
|
253
281
|
const metadataArr = [];
|
|
@@ -356,6 +384,17 @@ export const decodeMetadata = (data: string) => {
|
|
|
356
384
|
receiver: decodedData.receiver,
|
|
357
385
|
};
|
|
358
386
|
|
|
387
|
+
break;
|
|
388
|
+
case "auth":
|
|
389
|
+
payload = {
|
|
390
|
+
type,
|
|
391
|
+
address: decodedData.address,
|
|
392
|
+
chainId: decodedData.chainId
|
|
393
|
+
? decodedData.chainId.toString()
|
|
394
|
+
: null,
|
|
395
|
+
remove: decodedData.remove,
|
|
396
|
+
};
|
|
397
|
+
|
|
359
398
|
break;
|
|
360
399
|
}
|
|
361
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
|
};
|