@instadapp/avocado-base 0.0.0-dev.fc86158 → 0.0.0-dev.fcdcc0f
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/abi/multisigForwarder.json +697 -0
- package/app.vue +7 -0
- 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/change-threshold.svg +4 -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/cross-transfer.svg +7 -0
- package/assets/images/icons/dapp.svg +4 -0
- package/assets/images/icons/deploy.svg +12 -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 +14 -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/info-2.svg +12 -0
- package/assets/images/icons/instadapp-pro.svg +4 -0
- package/assets/images/icons/logout.svg +3 -0
- package/assets/images/icons/moon.svg +3 -0
- package/assets/images/icons/multi-send.svg +7 -0
- package/assets/images/icons/network.svg +13 -0
- package/assets/images/icons/options.svg +5 -0
- package/assets/images/icons/permit-sign.svg +11 -0
- package/assets/images/icons/plus-circle.svg +6 -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/reject-proposal.svg +6 -0
- package/assets/images/icons/search.svg +12 -0
- package/assets/images/icons/sun.svg +3 -0
- package/assets/images/icons/transfer.svg +5 -0
- package/assets/images/icons/trash-2.svg +8 -0
- package/assets/images/icons/upgrade.svg +4 -0
- package/assets/images/icons/wave.svg +214 -0
- package/assets/images/icons/x.svg +5 -0
- package/components/ActionLogo.vue +38 -0
- package/components/ActionMetadata.vue +72 -0
- package/components/AuthorityAvatar.vue +38 -0
- package/components/ChainLogo.vue +14 -556
- package/components/CopyClipboard.vue +64 -0
- package/components/metadata/Bridge.vue +59 -0
- package/components/metadata/CrossTransfer.vue +71 -0
- package/components/metadata/GasTopup.vue +39 -0
- package/components/metadata/Permit2.vue +42 -0
- package/components/metadata/Signers.vue +62 -0
- package/components/metadata/Swap.vue +74 -0
- package/components/metadata/Transfer.vue +50 -0
- package/components.d.ts +13 -0
- package/contracts/Forwarder.ts +856 -2
- package/contracts/MultisigForwarder.ts +859 -0
- package/contracts/factories/Forwarder__factory.ts +816 -16
- package/contracts/factories/MultisigForwarder__factory.ts +721 -0
- package/contracts/factories/index.ts +1 -0
- package/contracts/index.ts +2 -0
- package/nuxt.config.ts +17 -1
- package/package.json +9 -4
- package/utils/avocado.ts +2 -0
- package/utils/bignumber.ts +20 -0
- package/utils/formatter.ts +49 -6
- package/utils/helper.ts +8 -0
- package/utils/metadata.ts +335 -133
- package/utils/network.ts +157 -82
- package/utils/services.ts +21 -0
- package/utils/utils.d.ts +129 -96
package/contracts/index.ts
CHANGED
|
@@ -6,9 +6,11 @@ export type { BalanceResolver } from "./BalanceResolver";
|
|
|
6
6
|
export type { Erc20 } from "./Erc20";
|
|
7
7
|
export type { Forwarder } from "./Forwarder";
|
|
8
8
|
export type { GaslessWallet } from "./GaslessWallet";
|
|
9
|
+
export type { MultisigForwarder } from "./MultisigForwarder";
|
|
9
10
|
export * as factories from "./factories";
|
|
10
11
|
export { AvoFactoryProxy__factory } from "./factories/AvoFactoryProxy__factory";
|
|
11
12
|
export { BalanceResolver__factory } from "./factories/BalanceResolver__factory";
|
|
12
13
|
export { Erc20__factory } from "./factories/Erc20__factory";
|
|
13
14
|
export { Forwarder__factory } from "./factories/Forwarder__factory";
|
|
14
15
|
export { GaslessWallet__factory } from "./factories/GaslessWallet__factory";
|
|
16
|
+
export { MultisigForwarder__factory } from "./factories/MultisigForwarder__factory";
|
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.fcdcc0f",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"types": "global.d.ts",
|
|
@@ -16,12 +16,17 @@
|
|
|
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",
|
|
24
|
+
"vue-tippy": "^6.0.0"
|
|
22
25
|
},
|
|
23
26
|
"dependencies": {
|
|
27
|
+
"@vueuse/nuxt": "^10.2.0",
|
|
24
28
|
"bignumber.js": "^9.1.1",
|
|
25
|
-
"ethers": "^5.7.2"
|
|
29
|
+
"ethers": "^5.7.2",
|
|
30
|
+
"xxhashjs": "^0.2.2"
|
|
26
31
|
}
|
|
27
32
|
}
|
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/formatter.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export function formatPercent(
|
|
2
|
-
value
|
|
2
|
+
value?: number | string,
|
|
3
3
|
fractionDigits = 2,
|
|
4
4
|
maxValue = null
|
|
5
5
|
) {
|
|
6
|
-
if (isZero(value)) return "0.00%";
|
|
6
|
+
if (!value || isZero(value)) return "0.00%";
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const valueAsNumber = toBN(value).toNumber();
|
|
9
|
+
|
|
10
|
+
if (maxValue && gt(times(valueAsNumber, "100"), maxValue))
|
|
11
|
+
return `>${maxValue}%`;
|
|
9
12
|
|
|
10
13
|
const formatter = new Intl.NumberFormat("en-US", {
|
|
11
14
|
style: "percent",
|
|
@@ -13,7 +16,7 @@ export function formatPercent(
|
|
|
13
16
|
maximumFractionDigits: fractionDigits,
|
|
14
17
|
});
|
|
15
18
|
|
|
16
|
-
return formatter.format(
|
|
19
|
+
return formatter.format(valueAsNumber);
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
export function shortenHash(hash: string, length: number = 4) {
|
|
@@ -42,10 +45,50 @@ export function signedNumber(numb: string | number) {
|
|
|
42
45
|
}).format(toBN(numb).toNumber());
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
|
|
48
|
+
function getFractionDigits(value: string | number) {
|
|
49
|
+
const absoluteValue = toBN(value).abs();
|
|
50
|
+
|
|
51
|
+
if (isZero(absoluteValue)) {
|
|
52
|
+
return 2;
|
|
53
|
+
} else if (lt(absoluteValue, 0.01)) {
|
|
54
|
+
return 6;
|
|
55
|
+
} else if (lt(absoluteValue, 1)) {
|
|
56
|
+
return 4;
|
|
57
|
+
} else if (lt(absoluteValue, 10000)) {
|
|
58
|
+
return 2;
|
|
59
|
+
} else {
|
|
60
|
+
return 0;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function formatDecimal(value: string | number, fractionDigits?: number) {
|
|
46
65
|
if (!value) {
|
|
47
66
|
value = "0";
|
|
48
67
|
}
|
|
68
|
+
if (lt(value, "0.0001") && gt(value, "0")) {
|
|
69
|
+
return "< 0.0001";
|
|
70
|
+
} else {
|
|
71
|
+
const num = toBN(value);
|
|
72
|
+
let decimals;
|
|
73
|
+
|
|
74
|
+
if (num.lt(1)) {
|
|
75
|
+
decimals = 4;
|
|
76
|
+
} else if (num.lt(10)) {
|
|
77
|
+
decimals = 6;
|
|
78
|
+
} else if (num.lt(100)) {
|
|
79
|
+
decimals = 4;
|
|
80
|
+
} else if (num.lt(1000)) {
|
|
81
|
+
decimals = 3;
|
|
82
|
+
} else if (num.lt(10000)) {
|
|
83
|
+
decimals = 2;
|
|
84
|
+
} else if (num.lt(100000)) {
|
|
85
|
+
decimals = 1;
|
|
86
|
+
} else {
|
|
87
|
+
decimals = 0;
|
|
88
|
+
}
|
|
49
89
|
|
|
50
|
-
|
|
90
|
+
const formattedNumber = num.toFixed(fractionDigits || decimals);
|
|
91
|
+
|
|
92
|
+
return toBN(formattedNumber).toFormat();
|
|
93
|
+
}
|
|
51
94
|
}
|
package/utils/helper.ts
CHANGED
|
@@ -52,3 +52,11 @@ export function onImageError(this: HTMLImageElement) {
|
|
|
52
52
|
parentElement.classList.add("bg-gray-300");
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
export function formatMultipleAddresses(addresses: string[], shorten = true) {
|
|
57
|
+
const formatter = new Intl.ListFormat('en', { style: 'long', type: 'conjunction' })
|
|
58
|
+
const formattedString = formatter.format(addresses.map(i => shorten ? shortenHash(i) || '' : i))
|
|
59
|
+
|
|
60
|
+
return formattedString
|
|
61
|
+
}
|
|
62
|
+
|