@instadapp/avocado-base 0.0.0-dev.30dac02 → 0.0.0-dev.37aef1c
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 +8 -8
- package/assets/images/icons/arrow-left.svg +5 -0
- package/assets/images/icons/arrow-right.svg +5 -0
- package/assets/images/icons/avocado.svg +4 -0
- package/assets/images/icons/bridge-2.svg +3 -0
- package/assets/images/icons/bridge.svg +7 -0
- package/assets/images/icons/calendar.svg +8 -0
- package/assets/images/icons/check-circle.svg +4 -0
- package/assets/images/icons/chevron-down.svg +4 -0
- package/assets/images/icons/clipboard.svg +7 -0
- package/assets/images/icons/clock-circle.svg +5 -0
- package/assets/images/icons/copy.svg +5 -0
- package/assets/images/icons/error-circle.svg +6 -0
- package/assets/images/icons/exclamation-circle.svg +13 -0
- package/assets/images/icons/exclamation-octagon.svg +13 -0
- package/assets/images/icons/exclamation-triangle.svg +5 -0
- package/assets/images/icons/external-link.svg +6 -0
- package/assets/images/icons/eye.svg +4 -0
- package/assets/images/icons/flowers.svg +8 -0
- package/assets/images/icons/gas-emoji.svg +193 -0
- package/assets/images/icons/gas.svg +7 -0
- package/assets/images/icons/gift.svg +153 -0
- package/assets/images/icons/globe.svg +110 -0
- package/assets/images/icons/hamburger.svg +6 -0
- package/assets/images/icons/logout.svg +3 -0
- package/assets/images/icons/moon.svg +3 -0
- package/assets/images/icons/network.svg +13 -0
- package/assets/images/icons/options.svg +5 -0
- package/assets/images/icons/plus.svg +5 -0
- package/assets/images/icons/power-off-bg.svg +24 -0
- package/assets/images/icons/power-off.svg +19 -0
- package/assets/images/icons/power-on.svg +19 -0
- package/assets/images/icons/qr.svg +20 -0
- package/assets/images/icons/question-circle.svg +14 -0
- package/assets/images/icons/refresh.svg +6 -0
- package/assets/images/icons/search.svg +12 -0
- package/assets/images/icons/sun.svg +3 -0
- package/assets/images/icons/wave.svg +214 -0
- package/assets/images/icons/x.svg +5 -0
- package/components/ActionMetadata.vue +50 -0
- package/components/ChainLogo.vue +1 -1
- package/components/metadata/Bridge.vue +37 -0
- package/components/metadata/CrossTransfer.vue +65 -0
- package/components/metadata/GasTopup.vue +31 -0
- package/components/metadata/Permit2.vue +37 -0
- package/components/metadata/Swap.vue +66 -0
- package/components/metadata/Transfer.vue +43 -0
- package/components.d.ts +13 -0
- package/contracts/Forwarder.ts +4 -4
- package/contracts/factories/Forwarder__factory.ts +8 -8
- package/nuxt.config.ts +17 -1
- package/package.json +6 -3
- package/utils/avocado.ts +2 -0
- package/utils/bignumber.ts +20 -0
- package/utils/metadata.ts +23 -2
- package/utils/network.ts +1 -1
- package/utils/services.ts +14 -0
- package/utils/utils.d.ts +12 -0
|
@@ -535,7 +535,7 @@ const _abi = [
|
|
|
535
535
|
},
|
|
536
536
|
{
|
|
537
537
|
internalType: "uint256",
|
|
538
|
-
name: "
|
|
538
|
+
name: "gasPrice",
|
|
539
539
|
type: "uint256",
|
|
540
540
|
},
|
|
541
541
|
{
|
|
@@ -545,7 +545,7 @@ const _abi = [
|
|
|
545
545
|
},
|
|
546
546
|
{
|
|
547
547
|
internalType: "uint256",
|
|
548
|
-
name: "
|
|
548
|
+
name: "validUntil",
|
|
549
549
|
type: "uint256",
|
|
550
550
|
},
|
|
551
551
|
],
|
|
@@ -788,7 +788,7 @@ const _abi = [
|
|
|
788
788
|
},
|
|
789
789
|
{
|
|
790
790
|
internalType: "uint256",
|
|
791
|
-
name: "
|
|
791
|
+
name: "gasPrice",
|
|
792
792
|
type: "uint256",
|
|
793
793
|
},
|
|
794
794
|
{
|
|
@@ -798,7 +798,7 @@ const _abi = [
|
|
|
798
798
|
},
|
|
799
799
|
{
|
|
800
800
|
internalType: "uint256",
|
|
801
|
-
name: "
|
|
801
|
+
name: "validUntil",
|
|
802
802
|
type: "uint256",
|
|
803
803
|
},
|
|
804
804
|
],
|
|
@@ -1122,7 +1122,7 @@ const _abi = [
|
|
|
1122
1122
|
},
|
|
1123
1123
|
{
|
|
1124
1124
|
internalType: "uint256",
|
|
1125
|
-
name: "
|
|
1125
|
+
name: "gasPrice",
|
|
1126
1126
|
type: "uint256",
|
|
1127
1127
|
},
|
|
1128
1128
|
{
|
|
@@ -1132,7 +1132,7 @@ const _abi = [
|
|
|
1132
1132
|
},
|
|
1133
1133
|
{
|
|
1134
1134
|
internalType: "uint256",
|
|
1135
|
-
name: "
|
|
1135
|
+
name: "validUntil",
|
|
1136
1136
|
type: "uint256",
|
|
1137
1137
|
},
|
|
1138
1138
|
],
|
|
@@ -1393,7 +1393,7 @@ const _abi = [
|
|
|
1393
1393
|
},
|
|
1394
1394
|
{
|
|
1395
1395
|
internalType: "uint256",
|
|
1396
|
-
name: "
|
|
1396
|
+
name: "gasPrice",
|
|
1397
1397
|
type: "uint256",
|
|
1398
1398
|
},
|
|
1399
1399
|
{
|
|
@@ -1403,7 +1403,7 @@ const _abi = [
|
|
|
1403
1403
|
},
|
|
1404
1404
|
{
|
|
1405
1405
|
internalType: "uint256",
|
|
1406
|
-
name: "
|
|
1406
|
+
name: "validUntil",
|
|
1407
1407
|
type: "uint256",
|
|
1408
1408
|
},
|
|
1409
1409
|
],
|
package/nuxt.config.ts
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
// https://nuxt.com/docs/api/configuration/nuxt-config
|
|
2
|
+
import ViteComponents from "unplugin-vue-components/vite";
|
|
3
|
+
|
|
2
4
|
export default defineNuxtConfig({
|
|
3
|
-
modules: ["@nuxtjs/tailwindcss"],
|
|
5
|
+
modules: ["@nuxtjs/tailwindcss", "nuxt-svgo", "@vueuse/nuxt"],
|
|
6
|
+
svgo: {
|
|
7
|
+
defaultImport: "component",
|
|
8
|
+
autoImportPath: "./assets/images/icons",
|
|
9
|
+
svgoConfig: {
|
|
10
|
+
plugins: ["prefixIds"],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
vite: {
|
|
14
|
+
plugins: [
|
|
15
|
+
ViteComponents({
|
|
16
|
+
dts: true,
|
|
17
|
+
}),
|
|
18
|
+
],
|
|
19
|
+
},
|
|
4
20
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instadapp/avocado-base",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.37aef1c",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"types": "global.d.ts",
|
|
@@ -16,11 +16,14 @@
|
|
|
16
16
|
"@instadapp/avocado-dev": "npm:@instadapp/avocado@dev",
|
|
17
17
|
"@nuxtjs/tailwindcss": "^6.6.5",
|
|
18
18
|
"@typechain/ethers-v5": "^10.2.0",
|
|
19
|
-
"nuxt": "^3.
|
|
19
|
+
"nuxt": "^3.6.1",
|
|
20
|
+
"nuxt-svgo": "^3.1.0",
|
|
20
21
|
"rimraf": "^3.0.2",
|
|
21
|
-
"typechain": "^8.1.1"
|
|
22
|
+
"typechain": "^8.1.1",
|
|
23
|
+
"unplugin-vue-components": "^0.25.1"
|
|
22
24
|
},
|
|
23
25
|
"dependencies": {
|
|
26
|
+
"@vueuse/nuxt": "^10.2.0",
|
|
24
27
|
"bignumber.js": "^9.1.1",
|
|
25
28
|
"ethers": "^5.7.2"
|
|
26
29
|
}
|
package/utils/avocado.ts
CHANGED
package/utils/bignumber.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { BigNumber } from "bignumber.js";
|
|
2
2
|
import { BigNumber as BN } from "ethers";
|
|
3
3
|
|
|
4
|
+
type CombinedBigNumber = BigNumber | string | number;
|
|
5
|
+
|
|
4
6
|
export const toBN = (value: BigNumber.Value | BN) =>
|
|
5
7
|
new BigNumber(BN.isBigNumber(value) ? value.toString() : value);
|
|
6
8
|
export const isZero = (value: BigNumber.Value | BN) => toBN(value).isZero();
|
|
@@ -29,3 +31,21 @@ export const ensureValue = (value: any) => {
|
|
|
29
31
|
export const max = (...args: BigNumber.Value[]) => {
|
|
30
32
|
return BigNumber.max(...args);
|
|
31
33
|
};
|
|
34
|
+
|
|
35
|
+
export function pow(value: CombinedBigNumber, exponent: string | number) {
|
|
36
|
+
return toBN(value).pow(toBN(exponent));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function toWei(val: CombinedBigNumber, decimals: number): string {
|
|
40
|
+
const num = toBN(val);
|
|
41
|
+
const multiplier = pow(10, decimals);
|
|
42
|
+
return times(num, multiplier).toFixed(0);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function fromWei(val: CombinedBigNumber, decimal = 18) {
|
|
46
|
+
return toBN(val).div(new BigNumber(10).pow(decimal));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function abs(value: CombinedBigNumber) {
|
|
50
|
+
return toBN(value).abs();
|
|
51
|
+
}
|
package/utils/metadata.ts
CHANGED
|
@@ -42,6 +42,7 @@ const actionMetadataTypes = {
|
|
|
42
42
|
"uint160 amount",
|
|
43
43
|
"uint48 expiration",
|
|
44
44
|
],
|
|
45
|
+
"instadapp-pro": ["string castDetails"],
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
const encodeMetadata = (props: MetadataProps) => {
|
|
@@ -266,7 +267,7 @@ export const decodeMetadata = (data: string) => {
|
|
|
266
267
|
} else {
|
|
267
268
|
metadata = executeDataV2.params_.metadata;
|
|
268
269
|
}
|
|
269
|
-
} else {
|
|
270
|
+
} else if (data.startsWith("0x85114d53")) {
|
|
270
271
|
const executeDataV3 = iface.decodeFunctionData("executeV3", data);
|
|
271
272
|
if (
|
|
272
273
|
executeDataV3.params_.metadata === "0x" ||
|
|
@@ -276,6 +277,19 @@ export const decodeMetadata = (data: string) => {
|
|
|
276
277
|
} else {
|
|
277
278
|
metadata = executeDataV3.params_.metadata;
|
|
278
279
|
}
|
|
280
|
+
} else {
|
|
281
|
+
const executeDataMultisigV3 = iface.decodeFunctionData(
|
|
282
|
+
"executeMultisigV3",
|
|
283
|
+
data
|
|
284
|
+
);
|
|
285
|
+
if (
|
|
286
|
+
executeDataMultisigV3.params_.metadata === "0x" ||
|
|
287
|
+
!executeDataMultisigV3.params_.metadata
|
|
288
|
+
) {
|
|
289
|
+
return null;
|
|
290
|
+
} else {
|
|
291
|
+
metadata = executeDataMultisigV3.params_.metadata;
|
|
292
|
+
}
|
|
279
293
|
}
|
|
280
294
|
|
|
281
295
|
const metadataArr = [];
|
|
@@ -395,6 +409,13 @@ export const decodeMetadata = (data: string) => {
|
|
|
395
409
|
remove: decodedData.remove,
|
|
396
410
|
};
|
|
397
411
|
|
|
412
|
+
break;
|
|
413
|
+
case "instadapp-pro":
|
|
414
|
+
payload = {
|
|
415
|
+
type,
|
|
416
|
+
castDetails: decodedData.castDetails,
|
|
417
|
+
};
|
|
418
|
+
|
|
398
419
|
break;
|
|
399
420
|
}
|
|
400
421
|
|
|
@@ -403,7 +424,7 @@ export const decodeMetadata = (data: string) => {
|
|
|
403
424
|
|
|
404
425
|
return metadataArr;
|
|
405
426
|
} catch (e) {
|
|
406
|
-
console.log(e);
|
|
427
|
+
// console.log(e);
|
|
407
428
|
return null;
|
|
408
429
|
}
|
|
409
430
|
};
|
package/utils/network.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const fetchTokenByAddress = async (
|
|
2
|
+
address: string,
|
|
3
|
+
chainId: string | number
|
|
4
|
+
) => {
|
|
5
|
+
if (!address || !chainId) return null;
|
|
6
|
+
const [token] = (await $fetch(`${blockQueryURL}/${chainId}/tokens`, {
|
|
7
|
+
params: {
|
|
8
|
+
sparkline: false,
|
|
9
|
+
"addresses[]": [address],
|
|
10
|
+
},
|
|
11
|
+
})) as ITokenPrice[];
|
|
12
|
+
|
|
13
|
+
return token;
|
|
14
|
+
};
|
package/utils/utils.d.ts
CHANGED
|
@@ -116,3 +116,15 @@ type MetadataProps = {
|
|
|
116
116
|
encodedData: string;
|
|
117
117
|
version?: string;
|
|
118
118
|
};
|
|
119
|
+
|
|
120
|
+
interface ITokenPrice {
|
|
121
|
+
address: string;
|
|
122
|
+
chain_id: string;
|
|
123
|
+
name: string;
|
|
124
|
+
symbol: string;
|
|
125
|
+
decimals: number;
|
|
126
|
+
logo_url: string;
|
|
127
|
+
price: string;
|
|
128
|
+
coingecko_id: string;
|
|
129
|
+
sparkline_price_7d: number[];
|
|
130
|
+
}
|