@instadapp/avocado-base 0.0.0-dev.9853aa2 → 0.0.0-dev.9c7000a
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/.github/workflows/npm-publish-dev.yml +2 -5
- package/.vscode/settings.json +67 -0
- package/abi/avoFactoryProxy.json +1 -1
- package/abi/forwarder.json +1 -1
- package/abi/multisigAgnosticForwarder.json +937 -0
- package/abi/multisigForwarder.json +697 -0
- package/app.vue +9 -2
- package/assets/images/icons/change-threshold.svg +4 -0
- package/assets/images/icons/check.svg +3 -0
- package/assets/images/icons/copy.svg +9 -2
- 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/gas.svg +12 -5
- package/assets/images/icons/hammer.svg +5 -0
- package/assets/images/icons/info-2.svg +12 -0
- package/assets/images/icons/instadapp-pro.svg +4 -0
- package/assets/images/icons/multi-send.svg +7 -0
- package/assets/images/icons/permit-sign.svg +11 -0
- package/assets/images/icons/plus-circle.svg +6 -0
- package/assets/images/icons/refresh.svg +4 -4
- package/assets/images/icons/reject-proposal.svg +6 -0
- package/assets/images/icons/stars.svg +4 -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/components/ActionLogo.vue +42 -0
- package/components/ActionMetadata.vue +56 -21
- package/components/Address.vue +74 -0
- package/components/AuthorityAvatar.vue +39 -0
- package/components/ChainLogo.vue +18 -563
- package/components/CopyClipboard.vue +42 -0
- package/components/metadata/Bridge.vue +33 -14
- package/components/metadata/CrossTransfer.vue +37 -28
- package/components/metadata/GasTopup.vue +17 -12
- package/components/metadata/Permit2.vue +14 -10
- package/components/metadata/Signers.vue +19 -0
- package/components/metadata/Swap.vue +45 -46
- package/components/metadata/Transfer.vue +27 -25
- package/contracts/MultisigAgnosticForwarder.ts +1423 -0
- package/contracts/MultisigForwarder.ts +859 -0
- package/contracts/factories/MultisigAgnosticForwarder__factory.ts +2135 -0
- package/contracts/factories/MultisigForwarder__factory.ts +721 -0
- package/contracts/factories/index.ts +2 -0
- package/contracts/index.ts +4 -0
- package/eslint.config.mjs +34 -0
- package/nuxt.config.ts +21 -12
- package/package.json +16 -14
- package/server/utils/index.ts +4 -4
- package/utils/avocado.ts +17 -17
- package/utils/bignumber.ts +47 -36
- package/utils/formatter.ts +55 -61
- package/utils/helper.ts +39 -28
- package/utils/metadata.ts +538 -361
- package/utils/network.ts +552 -184
- package/utils/services.ts +15 -10
- package/utils/utils.d.ts +146 -129
package/utils/services.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
export
|
|
2
|
-
address
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (
|
|
1
|
+
export async function fetchTokenByAddress(address: string, chainId: string | number, tokens?: ITokenPrice[]) {
|
|
2
|
+
if (!address || !chainId)
|
|
3
|
+
return null
|
|
4
|
+
|
|
5
|
+
if (tokens?.length) {
|
|
6
|
+
const token = tokens.find(token => token.address?.toLocaleLowerCase() === address?.toLocaleLowerCase() && token.chain_id == chainId)
|
|
7
|
+
if (token)
|
|
8
|
+
return token
|
|
9
|
+
}
|
|
10
|
+
|
|
6
11
|
const [token] = (await $fetch(`${blockQueryURL}/${chainId}/tokens`, {
|
|
7
12
|
params: {
|
|
8
|
-
sparkline: false,
|
|
9
|
-
|
|
13
|
+
'sparkline': false,
|
|
14
|
+
'addresses[]': [address],
|
|
10
15
|
},
|
|
11
|
-
})) as ITokenPrice[]
|
|
16
|
+
})) as ITokenPrice[]
|
|
12
17
|
|
|
13
|
-
return token
|
|
14
|
-
}
|
|
18
|
+
return token
|
|
19
|
+
}
|
package/utils/utils.d.ts
CHANGED
|
@@ -1,131 +1,148 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
import type { Chain } from 'viem'
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
type ChainId =
|
|
5
|
+
| 1
|
|
6
|
+
| 137
|
|
7
|
+
| 42161
|
|
8
|
+
| 10
|
|
9
|
+
| 56
|
|
10
|
+
| 43114
|
|
11
|
+
| 100
|
|
12
|
+
| 1101
|
|
13
|
+
| 250
|
|
14
|
+
| 634
|
|
15
|
+
| 1313161554
|
|
16
|
+
| 8453
|
|
17
|
+
| 122
|
|
18
|
+
| 534352
|
|
19
|
+
| 204
|
|
20
|
+
| 63400
|
|
21
|
+
| 169
|
|
22
|
+
| 34443
|
|
23
|
+
| 81457
|
|
24
|
+
| 59144
|
|
25
|
+
| 146
|
|
26
|
+
|
|
27
|
+
type ISlackMessageType = 'danger' | 'error' | 'success' | 'banner'
|
|
28
|
+
|
|
29
|
+
type MetadataTypes = keyof typeof MetadataEnums
|
|
30
|
+
|
|
31
|
+
type PayloadFunction = (data: any, type: MetadataTypes) => any
|
|
32
|
+
|
|
33
|
+
type IPayload = Record<MetadataTypes, PayloadFunction>
|
|
34
|
+
|
|
35
|
+
interface Network {
|
|
36
|
+
name: string
|
|
37
|
+
debankName?: string
|
|
38
|
+
ankrName?: string
|
|
39
|
+
zerionName?: string
|
|
40
|
+
chainId: ChainId
|
|
41
|
+
color: string
|
|
42
|
+
isAvocado?: boolean
|
|
43
|
+
serverRpcUrl: string | undefined
|
|
44
|
+
balanceResolverAddress?: string
|
|
45
|
+
usdcAddress?: string
|
|
46
|
+
explorerUrl: string
|
|
47
|
+
fakeTransactionHash: string
|
|
48
|
+
viemChain: Chain
|
|
49
|
+
legacySupported: boolean
|
|
50
|
+
// must start with https://
|
|
51
|
+
apiURL: `https://${string}` | null
|
|
52
|
+
params: {
|
|
53
|
+
chainName?: string
|
|
54
|
+
iconUrls?: string[]
|
|
55
|
+
rpcUrls: string[]
|
|
56
|
+
nativeCurrency?: {
|
|
57
|
+
name: string
|
|
58
|
+
symbol: string
|
|
59
|
+
decimals: number
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface SignMetadataProps {
|
|
65
|
+
token: string
|
|
66
|
+
spender: string
|
|
67
|
+
amount: string
|
|
68
|
+
expiration: string
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface DappMetadataProps {
|
|
72
|
+
name: string
|
|
73
|
+
url: string
|
|
74
|
+
}
|
|
40
75
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
| "dapp"
|
|
112
|
-
| "deploy"
|
|
113
|
-
| "permit2"
|
|
114
|
-
| "cross-transfer"
|
|
115
|
-
| "auth"
|
|
116
|
-
| "reject";
|
|
117
|
-
encodedData: string;
|
|
118
|
-
version?: string;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
interface ITokenPrice {
|
|
122
|
-
address: string;
|
|
123
|
-
chain_id: string;
|
|
124
|
-
name: string;
|
|
125
|
-
symbol: string;
|
|
126
|
-
decimals: number;
|
|
127
|
-
logo_url: string;
|
|
128
|
-
price: string;
|
|
129
|
-
coingecko_id: string;
|
|
130
|
-
sparkline_price_7d: number[];
|
|
76
|
+
interface SendMetadataProps {
|
|
77
|
+
token: string
|
|
78
|
+
amount: string
|
|
79
|
+
receiver: string
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
interface CrossSendMetadataProps {
|
|
83
|
+
fromToken: string
|
|
84
|
+
toToken: string
|
|
85
|
+
toChainId: string
|
|
86
|
+
amount: string
|
|
87
|
+
receiver: string
|
|
88
|
+
provider?: string
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface AuthMetadataProps {
|
|
92
|
+
address: string
|
|
93
|
+
chainId: string
|
|
94
|
+
remove: boolean
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
interface UpgradeMetadataProps {
|
|
98
|
+
version: string
|
|
99
|
+
walletImpl: string
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
interface TopupMetadataProps {
|
|
103
|
+
amount: string
|
|
104
|
+
token: string
|
|
105
|
+
onBehalf: string
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
interface BridgeMetadataProps {
|
|
109
|
+
amount: string
|
|
110
|
+
receiver: string
|
|
111
|
+
fromToken: string
|
|
112
|
+
toToken: string
|
|
113
|
+
toChainId: string
|
|
114
|
+
bridgeFee: string
|
|
115
|
+
nativeToken: string
|
|
116
|
+
version?: string
|
|
117
|
+
provider: string
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
interface SwapMetadataProps {
|
|
121
|
+
sellToken: string
|
|
122
|
+
buyToken: string
|
|
123
|
+
sellAmount: string
|
|
124
|
+
buyAmount: string
|
|
125
|
+
receiver: string
|
|
126
|
+
protocol?: string
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
interface MetadataProps {
|
|
130
|
+
type: MetadataTypes
|
|
131
|
+
encodedData: string
|
|
132
|
+
version?: string
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
interface ITokenPrice {
|
|
136
|
+
address: string
|
|
137
|
+
chain_id: string
|
|
138
|
+
name: string
|
|
139
|
+
symbol: string
|
|
140
|
+
decimals: number
|
|
141
|
+
logo_url: string
|
|
142
|
+
price: string
|
|
143
|
+
coingecko_id: string
|
|
144
|
+
sparkline_price_7d: number[]
|
|
145
|
+
}
|
|
131
146
|
}
|
|
147
|
+
|
|
148
|
+
export {}
|