@instadapp/avocado-base 0.0.68 → 0.0.70
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 +25 -0
- package/utils/network.ts +3 -0
package/package.json
CHANGED
package/utils/metadata.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { toBN } from "./bignumber";
|
|
|
18
18
|
"add-signers": "add-signers",
|
|
19
19
|
"remove-signers": "remove-signers",
|
|
20
20
|
"change-threshold": "change-threshold",
|
|
21
|
+
"import": "import",
|
|
21
22
|
} as const;
|
|
22
23
|
|
|
23
24
|
const multiMetadataTypes = ["bytes[]"];
|
|
@@ -53,6 +54,7 @@ const actionMetadataTypes: Record<MetadataTypes, string[]> = {
|
|
|
53
54
|
"gas-topup": ["uint256 amount", "address token", "address onBehalf"],
|
|
54
55
|
upgrade: ["bytes32 version", "address walletImpl"],
|
|
55
56
|
dapp: ["string name", "string url"],
|
|
57
|
+
"import": ["bytes32 protocol", "uint256 valueInUsd"],
|
|
56
58
|
auth: ["address address", "uint256 chainId", "bool remove"],
|
|
57
59
|
deploy: [],
|
|
58
60
|
permit2: [
|
|
@@ -307,6 +309,24 @@ export const encodeRemoveSignersMetadata = (
|
|
|
307
309
|
return single ? encodeMultipleActions(data) : data;
|
|
308
310
|
};
|
|
309
311
|
|
|
312
|
+
export const encodeImportMetadata = (
|
|
313
|
+
protocol: string,
|
|
314
|
+
valueInUsd: string,
|
|
315
|
+
single = true
|
|
316
|
+
) => {
|
|
317
|
+
const encodedData = ethers.utils.defaultAbiCoder.encode(
|
|
318
|
+
actionMetadataTypes["import"],
|
|
319
|
+
[protocol, valueInUsd]
|
|
320
|
+
);
|
|
321
|
+
|
|
322
|
+
const data = encodeMetadata({
|
|
323
|
+
type: MetadataEnums["import"],
|
|
324
|
+
encodedData,
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
return single ? encodeMultipleActions(data) : data;
|
|
328
|
+
};
|
|
329
|
+
|
|
310
330
|
export const encodeAddSignersMetadata = (
|
|
311
331
|
addresses: string[],
|
|
312
332
|
single = true
|
|
@@ -390,6 +410,11 @@ const getMetadataFromData = (data: string) => {
|
|
|
390
410
|
|
|
391
411
|
|
|
392
412
|
const typesPayload: IPayload = {
|
|
413
|
+
import: (data, type) => ({
|
|
414
|
+
type,
|
|
415
|
+
protocol: utils.parseBytes32String(data.protocol || ""),
|
|
416
|
+
valueInUsd: toBN(data.valueInUsd).toFixed(),
|
|
417
|
+
}),
|
|
393
418
|
transfer: (data, type) => ({
|
|
394
419
|
type,
|
|
395
420
|
token: data.token,
|
package/utils/network.ts
CHANGED
|
@@ -90,6 +90,7 @@ export const networks: Network[] = [
|
|
|
90
90
|
name: 'Base',
|
|
91
91
|
chainId: 8453,
|
|
92
92
|
color: '#1E2024',
|
|
93
|
+
ankrName:'base',
|
|
93
94
|
explorerUrl: 'https://basescan.org',
|
|
94
95
|
apiURL: 'https://api.basescan.org',
|
|
95
96
|
get serverRpcUrl() {
|
|
@@ -135,6 +136,7 @@ export const networks: Network[] = [
|
|
|
135
136
|
name: "Polygon zkEVM",
|
|
136
137
|
chainId: 1101,
|
|
137
138
|
color: "#8544f6",
|
|
139
|
+
ankrName: 'polygon_zkevm',
|
|
138
140
|
explorerUrl: "https://zkevm.polygonscan.com",
|
|
139
141
|
apiURL: 'https://api-zkevm.polygonscan.com',
|
|
140
142
|
balanceResolverAddress: "0x48D1Fa5Ee6691a1E0B45d2B515650997BEA27a01",
|
|
@@ -227,6 +229,7 @@ export const networks: Network[] = [
|
|
|
227
229
|
debankName: "xdai",
|
|
228
230
|
zerionName: "xdai",
|
|
229
231
|
color: "#04795C",
|
|
232
|
+
ankrName: 'gnosis',
|
|
230
233
|
chainId: 100,
|
|
231
234
|
balanceResolverAddress: "0xfaa244e276b1597f663975ed007ee4ff70d27849",
|
|
232
235
|
explorerUrl: "https://gnosisscan.io",
|