@instadapp/avocado-base 0.0.0-dev.8d2b9ac → 0.0.0-dev.8e9feac
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 +5 -5
- package/assets/images/icons/check.svg +3 -0
- package/assets/images/icons/copy.svg +9 -2
- package/assets/images/icons/hammer.svg +5 -0
- package/assets/images/icons/info-2.svg +12 -0
- package/assets/images/icons/stars.svg +4 -0
- package/components/ActionLogo.vue +33 -29
- package/components/ActionMetadata.vue +45 -29
- package/components/Address.vue +74 -0
- package/components/AuthorityAvatar.vue +15 -2
- package/components/ChainLogo.vue +22 -224
- package/components/CopyClipboard.vue +16 -38
- package/components/metadata/Bridge.vue +22 -23
- package/components/metadata/CrossTransfer.vue +35 -30
- package/components/metadata/GasTopup.vue +14 -15
- package/components/metadata/Permit2.vue +12 -13
- package/components/metadata/Signers.vue +12 -38
- package/components/metadata/Swap.vue +45 -53
- package/components/metadata/Transfer.vue +26 -27
- 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/nuxt.config.ts +8 -13
- package/package.json +16 -18
- 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 +33 -41
- package/utils/metadata.ts +431 -310
- package/utils/network.ts +543 -193
- package/utils/services.ts +11 -13
- package/utils/utils.d.ts +122 -104
- package/components.d.ts +0 -13
package/utils/services.ts
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
export
|
|
2
|
-
address
|
|
3
|
-
|
|
4
|
-
tokens?: ITokenPrice[]
|
|
5
|
-
) => {
|
|
6
|
-
if (!address || !chainId) return null;
|
|
1
|
+
export async function fetchTokenByAddress(address: string, chainId: string | number, tokens?: ITokenPrice[]) {
|
|
2
|
+
if (!address || !chainId)
|
|
3
|
+
return null
|
|
7
4
|
|
|
8
5
|
if (tokens?.length) {
|
|
9
|
-
const token = tokens.find(
|
|
10
|
-
if (token)
|
|
6
|
+
const token = tokens.find(token => token.address?.toLocaleLowerCase() === address?.toLocaleLowerCase() && token.chain_id == chainId)
|
|
7
|
+
if (token)
|
|
8
|
+
return token
|
|
11
9
|
}
|
|
12
10
|
|
|
13
11
|
const [token] = (await $fetch(`${blockQueryURL}/${chainId}/tokens`, {
|
|
14
12
|
params: {
|
|
15
|
-
sparkline: false,
|
|
16
|
-
|
|
13
|
+
'sparkline': false,
|
|
14
|
+
'addresses[]': [address],
|
|
17
15
|
},
|
|
18
|
-
})) as ITokenPrice[]
|
|
16
|
+
})) as ITokenPrice[]
|
|
19
17
|
|
|
20
|
-
return token
|
|
21
|
-
}
|
|
18
|
+
return token
|
|
19
|
+
}
|
package/utils/utils.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Chain } from 'viem'
|
|
2
|
+
|
|
1
3
|
declare global {
|
|
2
4
|
type ChainId =
|
|
3
5
|
| 1
|
|
@@ -12,121 +14,137 @@ declare global {
|
|
|
12
14
|
| 634
|
|
13
15
|
| 1313161554
|
|
14
16
|
| 8453
|
|
15
|
-
|
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
| 122
|
|
18
|
+
| 534352
|
|
19
|
+
| 204
|
|
20
|
+
| 63400
|
|
21
|
+
| 169
|
|
22
|
+
| 34443
|
|
23
|
+
| 81457
|
|
24
|
+
| 59144
|
|
25
|
+
| 146
|
|
26
|
+
| 9745
|
|
27
|
+
| 57073
|
|
28
|
+
|
|
29
|
+
type ISlackMessageType = 'danger' | 'error' | 'success' | 'banner'
|
|
18
30
|
|
|
19
|
-
type MetadataTypes = keyof typeof MetadataEnums
|
|
31
|
+
type MetadataTypes = keyof typeof MetadataEnums
|
|
20
32
|
|
|
21
|
-
type PayloadFunction = (data: any, type: MetadataTypes) => any
|
|
33
|
+
type PayloadFunction = (data: any, type: MetadataTypes) => any
|
|
22
34
|
|
|
23
|
-
type IPayload = Record<MetadataTypes, PayloadFunction
|
|
35
|
+
type IPayload = Record<MetadataTypes, PayloadFunction>
|
|
24
36
|
|
|
25
37
|
interface Network {
|
|
26
|
-
name: string
|
|
27
|
-
debankName?: string
|
|
28
|
-
ankrName?: string
|
|
29
|
-
zerionName?: string
|
|
30
|
-
chainId: ChainId
|
|
31
|
-
color: string
|
|
32
|
-
isAvocado?: boolean
|
|
33
|
-
serverRpcUrl: string | undefined
|
|
34
|
-
balanceResolverAddress?: string
|
|
35
|
-
usdcAddress
|
|
36
|
-
explorerUrl: string
|
|
38
|
+
name: string
|
|
39
|
+
debankName?: string
|
|
40
|
+
ankrName?: string
|
|
41
|
+
zerionName?: string
|
|
42
|
+
chainId: ChainId
|
|
43
|
+
color: string
|
|
44
|
+
isAvocado?: boolean
|
|
45
|
+
serverRpcUrl: string | undefined
|
|
46
|
+
balanceResolverAddress?: string
|
|
47
|
+
usdcAddress?: string
|
|
48
|
+
explorerUrl: string
|
|
49
|
+
fakeTransactionHash: string
|
|
50
|
+
viemChain: Chain
|
|
51
|
+
legacySupported: boolean
|
|
52
|
+
// must start with https://
|
|
53
|
+
apiURL: `https://${string}` | null
|
|
37
54
|
params: {
|
|
38
|
-
chainName?: string
|
|
39
|
-
iconUrls?: string[]
|
|
40
|
-
rpcUrls: string[]
|
|
55
|
+
chainName?: string
|
|
56
|
+
iconUrls?: string[]
|
|
57
|
+
rpcUrls: string[] | readonly string[]
|
|
41
58
|
nativeCurrency?: {
|
|
42
|
-
name: string
|
|
43
|
-
symbol: string
|
|
44
|
-
decimals: number
|
|
45
|
-
}
|
|
46
|
-
}
|
|
59
|
+
name: string
|
|
60
|
+
symbol: string
|
|
61
|
+
decimals: number
|
|
62
|
+
}
|
|
63
|
+
}
|
|
47
64
|
}
|
|
48
65
|
|
|
49
|
-
|
|
50
|
-
token: string
|
|
51
|
-
spender: string
|
|
52
|
-
amount: string
|
|
53
|
-
expiration: string
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
type DappMetadataProps = {
|
|
57
|
-
name: string;
|
|
58
|
-
url: string;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
type SendMetadataProps = {
|
|
62
|
-
token: string;
|
|
63
|
-
amount: string;
|
|
64
|
-
receiver: string;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
type CrossSendMetadataProps = {
|
|
68
|
-
fromToken: string;
|
|
69
|
-
toToken: string;
|
|
70
|
-
toChainId: string;
|
|
71
|
-
amount: string;
|
|
72
|
-
receiver: string;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
type AuthMetadataProps = {
|
|
76
|
-
address: string;
|
|
77
|
-
chainId: string;
|
|
78
|
-
remove: boolean;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
type UpgradeMetadataProps = {
|
|
82
|
-
version: string;
|
|
83
|
-
walletImpl: string;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
type TopupMetadataProps = {
|
|
87
|
-
amount: string;
|
|
88
|
-
token: string;
|
|
89
|
-
onBehalf: string;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
type BridgeMetadataProps = {
|
|
93
|
-
amount: string;
|
|
94
|
-
receiver: string;
|
|
95
|
-
fromToken: string;
|
|
96
|
-
toToken: string;
|
|
97
|
-
toChainId: string;
|
|
98
|
-
bridgeFee: string;
|
|
99
|
-
nativeToken: string;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
type SwapMetadataProps = {
|
|
103
|
-
sellToken: string;
|
|
104
|
-
buyToken: string;
|
|
105
|
-
sellAmount: string;
|
|
106
|
-
buyAmount: string;
|
|
107
|
-
receiver: string;
|
|
108
|
-
protocol?: string;
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
type MetadataProps = {
|
|
112
|
-
type: MetadataTypes,
|
|
113
|
-
encodedData: string;
|
|
114
|
-
version?: string;
|
|
115
|
-
};
|
|
66
|
+
interface SignMetadataProps {
|
|
67
|
+
token: string
|
|
68
|
+
spender: string
|
|
69
|
+
amount: string
|
|
70
|
+
expiration: string
|
|
71
|
+
}
|
|
116
72
|
|
|
117
|
-
interface
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
name: string;
|
|
121
|
-
symbol: string;
|
|
122
|
-
decimals: number;
|
|
123
|
-
logo_url: string;
|
|
124
|
-
price: string;
|
|
125
|
-
coingecko_id: string;
|
|
126
|
-
sparkline_price_7d: number[];
|
|
73
|
+
interface DappMetadataProps {
|
|
74
|
+
name: string
|
|
75
|
+
url: string
|
|
127
76
|
}
|
|
128
77
|
|
|
129
|
-
|
|
78
|
+
interface SendMetadataProps {
|
|
79
|
+
token: string
|
|
80
|
+
amount: string
|
|
81
|
+
receiver: string
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface CrossSendMetadataProps {
|
|
85
|
+
fromToken: string
|
|
86
|
+
toToken: string
|
|
87
|
+
toChainId: string
|
|
88
|
+
amount: string
|
|
89
|
+
receiver: string
|
|
90
|
+
provider?: string
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface AuthMetadataProps {
|
|
94
|
+
address: string
|
|
95
|
+
chainId: string
|
|
96
|
+
remove: boolean
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
interface UpgradeMetadataProps {
|
|
100
|
+
version: string
|
|
101
|
+
walletImpl: string
|
|
102
|
+
}
|
|
130
103
|
|
|
131
|
-
|
|
104
|
+
interface TopupMetadataProps {
|
|
105
|
+
amount: string
|
|
106
|
+
token: string
|
|
107
|
+
onBehalf: string
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
interface BridgeMetadataProps {
|
|
111
|
+
amount: string
|
|
112
|
+
receiver: string
|
|
113
|
+
fromToken: string
|
|
114
|
+
toToken: string
|
|
115
|
+
toChainId: string
|
|
116
|
+
bridgeFee: string
|
|
117
|
+
nativeToken: string
|
|
118
|
+
version?: string
|
|
119
|
+
provider: string
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
interface SwapMetadataProps {
|
|
123
|
+
sellToken: string
|
|
124
|
+
buyToken: string
|
|
125
|
+
sellAmount: string
|
|
126
|
+
buyAmount: string
|
|
127
|
+
receiver: string
|
|
128
|
+
protocol?: string
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
interface MetadataProps {
|
|
132
|
+
type: MetadataTypes
|
|
133
|
+
encodedData: string
|
|
134
|
+
version?: string
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
interface ITokenPrice {
|
|
138
|
+
address: string
|
|
139
|
+
chain_id: string
|
|
140
|
+
name: string
|
|
141
|
+
symbol: string
|
|
142
|
+
decimals: number
|
|
143
|
+
logo_url: string
|
|
144
|
+
price: string
|
|
145
|
+
coingecko_id: string
|
|
146
|
+
sparkline_price_7d: number[]
|
|
147
|
+
}
|
|
148
|
+
}
|
|
132
149
|
|
|
150
|
+
export {}
|
package/components.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/* prettier-ignore */
|
|
3
|
-
// @ts-nocheck
|
|
4
|
-
// Generated by unplugin-vue-components
|
|
5
|
-
// Read more: https://github.com/vuejs/core/pull/3399
|
|
6
|
-
export {}
|
|
7
|
-
|
|
8
|
-
declare module 'vue' {
|
|
9
|
-
export interface GlobalComponents {
|
|
10
|
-
RouterLink: typeof import('vue-router')['RouterLink']
|
|
11
|
-
RouterView: typeof import('vue-router')['RouterView']
|
|
12
|
-
}
|
|
13
|
-
}
|