@instadapp/avocado-base 0.0.46 → 0.0.48
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/components/ActionMetadata.vue +2 -0
- package/components/metadata/Bridge.vue +5 -1
- package/components/metadata/CrossTransfer.vue +5 -1
- package/components/metadata/GasTopup.vue +7 -1
- package/components/metadata/Permit2.vue +6 -1
- package/components/metadata/Swap.vue +9 -2
- package/components/metadata/Transfer.vue +5 -1
- package/package.json +1 -1
- package/utils/network.ts +21 -1
- package/utils/services.ts +8 -1
- package/utils/utils.d.ts +1 -0
|
@@ -6,9 +6,13 @@ const props = defineProps<{
|
|
|
6
6
|
}>();
|
|
7
7
|
|
|
8
8
|
const compact = inject('compact');
|
|
9
|
+
const tokens = inject<ITokenPrice[]>('tokens');
|
|
9
10
|
|
|
10
11
|
const toToken = asyncComputed(() =>
|
|
11
|
-
|
|
12
|
+
{
|
|
13
|
+
if (Array.isArray(tokens) && !tokens.length) return null;
|
|
14
|
+
return fetchTokenByAddress(props.metadata?.toToken, props.metadata?.toChainId, tokens)
|
|
15
|
+
}
|
|
12
16
|
);
|
|
13
17
|
|
|
14
18
|
const bridgeAmountFormatted = computed(() =>
|
|
@@ -6,13 +6,17 @@ const props = defineProps<{
|
|
|
6
6
|
}>();
|
|
7
7
|
|
|
8
8
|
const compact = inject('compact');
|
|
9
|
+
const tokens = inject<ITokenPrice[]>('tokens');
|
|
9
10
|
|
|
10
11
|
const fromToken = asyncComputed(() => {
|
|
11
12
|
if (!props?.chain_id) return null;
|
|
12
13
|
|
|
14
|
+
if (Array.isArray(tokens) && !tokens.length) return null;
|
|
15
|
+
|
|
13
16
|
return fetchTokenByAddress(
|
|
14
17
|
props.metadata?.fromToken,
|
|
15
|
-
props?.chain_id
|
|
18
|
+
props?.chain_id,
|
|
19
|
+
tokens
|
|
16
20
|
);
|
|
17
21
|
});
|
|
18
22
|
|
|
@@ -5,8 +5,14 @@ const props = defineProps<{
|
|
|
5
5
|
chain_id: number | string
|
|
6
6
|
}>();
|
|
7
7
|
|
|
8
|
+
const tokens = inject<ITokenPrice[]>('tokens');
|
|
9
|
+
|
|
8
10
|
const token = asyncComputed(() =>
|
|
9
|
-
|
|
11
|
+
{
|
|
12
|
+
if (Array.isArray(tokens) && !tokens.length) return null;
|
|
13
|
+
|
|
14
|
+
return fetchTokenByAddress(props.metadata?.token, props?.chain_id, tokens)
|
|
15
|
+
}
|
|
10
16
|
);
|
|
11
17
|
|
|
12
18
|
const compact = inject('compact');
|
|
@@ -5,8 +5,13 @@ const props = defineProps<{
|
|
|
5
5
|
chain_id: number | string
|
|
6
6
|
}>();
|
|
7
7
|
|
|
8
|
+
const tokens = inject<ITokenPrice[]>('tokens');
|
|
9
|
+
|
|
8
10
|
const token = asyncComputed(() =>
|
|
9
|
-
|
|
11
|
+
{
|
|
12
|
+
if (Array.isArray(tokens) && !tokens.length) return null;
|
|
13
|
+
return fetchTokenByAddress(props.metadata?.token, props?.chain_id, tokens)
|
|
14
|
+
}
|
|
10
15
|
);
|
|
11
16
|
|
|
12
17
|
const calculateDate = (timestamp: number) => {
|
|
@@ -6,12 +6,19 @@ const props = defineProps<{
|
|
|
6
6
|
}>();
|
|
7
7
|
|
|
8
8
|
const compact = inject('compact');
|
|
9
|
+
const tokens = inject<ITokenPrice[]>('tokens');
|
|
9
10
|
|
|
10
11
|
const buyToken = asyncComputed(() =>
|
|
11
|
-
|
|
12
|
+
{
|
|
13
|
+
if (Array.isArray(tokens) && !tokens.length) return null;
|
|
14
|
+
return fetchTokenByAddress(props.metadata?.buyToken, props?.chain_id, tokens)
|
|
15
|
+
}
|
|
12
16
|
);
|
|
13
17
|
const sellToken = asyncComputed(() =>
|
|
14
|
-
|
|
18
|
+
{
|
|
19
|
+
if (Array.isArray(tokens) && !tokens.length) return null;
|
|
20
|
+
return fetchTokenByAddress(props.metadata?.sellToken, props?.chain_id, tokens)
|
|
21
|
+
}
|
|
15
22
|
);
|
|
16
23
|
|
|
17
24
|
const sellAmountFormatted = computed(() =>
|
|
@@ -6,13 +6,17 @@ const props = defineProps<{
|
|
|
6
6
|
}>();
|
|
7
7
|
|
|
8
8
|
const compact = inject('compact');
|
|
9
|
+
const tokens = inject<ITokenPrice[]>('tokens');
|
|
9
10
|
|
|
10
11
|
const token = asyncComputed(() => {
|
|
11
12
|
if (!props?.chain_id) return null;
|
|
12
13
|
|
|
14
|
+
if (Array.isArray(tokens) && !tokens.length) return null;
|
|
15
|
+
|
|
13
16
|
return fetchTokenByAddress(
|
|
14
17
|
props.metadata?.token,
|
|
15
|
-
props?.chain_id
|
|
18
|
+
props?.chain_id,
|
|
19
|
+
tokens
|
|
16
20
|
);
|
|
17
21
|
});
|
|
18
22
|
|
package/package.json
CHANGED
package/utils/network.ts
CHANGED
|
@@ -175,7 +175,6 @@ export const networks: Network[] = [
|
|
|
175
175
|
params: {
|
|
176
176
|
chainName: "polygon zkEVM",
|
|
177
177
|
rpcUrls: ["https://zkevm-rpc.com"],
|
|
178
|
-
|
|
179
178
|
nativeCurrency: {
|
|
180
179
|
name: "Ethereum",
|
|
181
180
|
symbol: "ETH",
|
|
@@ -225,6 +224,26 @@ export const networks: Network[] = [
|
|
|
225
224
|
decimals: 18,
|
|
226
225
|
},
|
|
227
226
|
},
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
name: 'Base',
|
|
230
|
+
chainId: 8453,
|
|
231
|
+
color: '#1E2024',
|
|
232
|
+
explorerUrl: 'https://basescan.org',
|
|
233
|
+
get serverRpcUrl() {
|
|
234
|
+
return process.env?.BASE_RPC_URL || this.params.rpcUrls[0];
|
|
235
|
+
},
|
|
236
|
+
usdcAddress: '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA',
|
|
237
|
+
balanceResolverAddress: '0x23c8EAb8a4373dD16b0947Ebe8bf76Ff7A49d13C',
|
|
238
|
+
params: {
|
|
239
|
+
rpcUrls: ['https://rpc.ankr.com/base'],
|
|
240
|
+
chainName: "Base",
|
|
241
|
+
nativeCurrency: {
|
|
242
|
+
name: "Ethereum",
|
|
243
|
+
symbol: "ETH",
|
|
244
|
+
decimals: 18,
|
|
245
|
+
},
|
|
246
|
+
}
|
|
228
247
|
},
|
|
229
248
|
{
|
|
230
249
|
name: AVO_PROD_CHAIN_NAME,
|
|
@@ -281,6 +300,7 @@ export const chainUsdcAddresses = [
|
|
|
281
300
|
{ chainId: 43114, address: '0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664' },
|
|
282
301
|
{ chainId: 1101, address: '0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035' },
|
|
283
302
|
{ chainId: 1313161554, address: '0xB12BFcA5A55806AaF64E99521918A4bf0fC40802' },
|
|
303
|
+
{ chainId: 8453, address: '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA'}
|
|
284
304
|
];
|
|
285
305
|
|
|
286
306
|
export const getNetworkByChainId = (
|
package/utils/services.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
export const fetchTokenByAddress = async (
|
|
2
2
|
address: string,
|
|
3
|
-
chainId: string | number
|
|
3
|
+
chainId: string | number,
|
|
4
|
+
tokens?: ITokenPrice[]
|
|
4
5
|
) => {
|
|
5
6
|
if (!address || !chainId) return null;
|
|
7
|
+
|
|
8
|
+
if (tokens?.length) {
|
|
9
|
+
const token = tokens.find((token) => token.address?.toLocaleLowerCase() === address?.toLocaleLowerCase() && token.chain_id == chainId);
|
|
10
|
+
if (token) return token;
|
|
11
|
+
}
|
|
12
|
+
|
|
6
13
|
const [token] = (await $fetch(`${blockQueryURL}/${chainId}/tokens`, {
|
|
7
14
|
params: {
|
|
8
15
|
sparkline: false,
|