@instadapp/avocado-base 0.0.0-dev.39149d7 → 0.0.0-dev.39c2fcc
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 +37 -0
- package/utils/network.ts +3 -3
- 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",
|
|
@@ -41,6 +42,7 @@ const actionMetadataTypes = {
|
|
|
41
42
|
"uint160 amount",
|
|
42
43
|
"uint48 expiration",
|
|
43
44
|
],
|
|
45
|
+
"instadapp-pro": ["string castDetails"],
|
|
44
46
|
};
|
|
45
47
|
|
|
46
48
|
const encodeMetadata = (props: MetadataProps) => {
|
|
@@ -108,6 +110,23 @@ export const encodeCrossTransferMetadata = (
|
|
|
108
110
|
return single ? encodeMultipleActions(data) : data;
|
|
109
111
|
};
|
|
110
112
|
|
|
113
|
+
export const encodeAuthMetadata = (
|
|
114
|
+
params: AuthMetadataProps,
|
|
115
|
+
single = true
|
|
116
|
+
) => {
|
|
117
|
+
const encodedData = ethers.utils.defaultAbiCoder.encode(
|
|
118
|
+
actionMetadataTypes["auth"],
|
|
119
|
+
[params.address, params.chainId, params.remove]
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
const data = encodeMetadata({
|
|
123
|
+
type: "auth",
|
|
124
|
+
encodedData,
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
return single ? encodeMultipleActions(data) : data;
|
|
128
|
+
};
|
|
129
|
+
|
|
111
130
|
export const encodeDeployMetadata = (single = true) => {
|
|
112
131
|
const data = encodeMetadata({
|
|
113
132
|
type: "deploy",
|
|
@@ -366,6 +385,24 @@ export const decodeMetadata = (data: string) => {
|
|
|
366
385
|
receiver: decodedData.receiver,
|
|
367
386
|
};
|
|
368
387
|
|
|
388
|
+
break;
|
|
389
|
+
case "auth":
|
|
390
|
+
payload = {
|
|
391
|
+
type: decodedData.remove ? "remove-authority" : "add-authority",
|
|
392
|
+
address: decodedData.address,
|
|
393
|
+
chainId: decodedData.chainId
|
|
394
|
+
? decodedData.chainId.toString()
|
|
395
|
+
: null,
|
|
396
|
+
remove: decodedData.remove,
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
break;
|
|
400
|
+
case "instadapp-pro":
|
|
401
|
+
payload = {
|
|
402
|
+
type,
|
|
403
|
+
castDetails: decodedData.castDetails,
|
|
404
|
+
};
|
|
405
|
+
|
|
369
406
|
break;
|
|
370
407
|
}
|
|
371
408
|
|
package/utils/network.ts
CHANGED
|
@@ -4,7 +4,7 @@ export const bridgeDisabledNetworks = [1101];
|
|
|
4
4
|
|
|
5
5
|
export const networks: Network[] = [
|
|
6
6
|
{
|
|
7
|
-
name: "
|
|
7
|
+
name: "Ethereum",
|
|
8
8
|
debankName: "eth",
|
|
9
9
|
ankrName: "eth",
|
|
10
10
|
zerionName: "ethereum",
|
|
@@ -114,7 +114,7 @@ export const networks: Network[] = [
|
|
|
114
114
|
symbol: "AVAX",
|
|
115
115
|
decimals: 18,
|
|
116
116
|
},
|
|
117
|
-
rpcUrls: ["https://
|
|
117
|
+
rpcUrls: ["https://rpc.ankr.com/avalanche"],
|
|
118
118
|
},
|
|
119
119
|
},
|
|
120
120
|
{
|
|
@@ -174,7 +174,7 @@ export const networks: Network[] = [
|
|
|
174
174
|
},
|
|
175
175
|
params: {
|
|
176
176
|
chainName: "polygon zkEVM",
|
|
177
|
-
rpcUrls: ["https://rpc.
|
|
177
|
+
rpcUrls: ["https://zkevm-rpc.com"],
|
|
178
178
|
|
|
179
179
|
nativeCurrency: {
|
|
180
180
|
name: "Ethereum",
|
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
|
};
|