@instadapp/avocado-base 0.0.0-dev.f0b0c4f → 0.0.0-dev.f307ae7

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