@instadapp/avocado-base 0.2.2 → 0.2.3

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/utils/network.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ethers } from 'ethers'
2
+ import { defineChain } from 'viem'
2
3
  import {
3
4
  arbitrum,
4
5
  aurora,
@@ -18,7 +19,6 @@ import {
18
19
  polygonZkEvm,
19
20
  scroll,
20
21
  } from 'viem/chains'
21
- import { defineChain } from 'viem'
22
22
  import {
23
23
  AVO_PROD_CHAIN_ID,
24
24
  AVO_PROD_CHAIN_NAME,
@@ -614,7 +614,7 @@ export function getRpcURLByChainId(chainId: ChainId | number | string) {
614
614
  const network = getNetworkByChainId(chainId)
615
615
  return network.params.rpcUrls[0]
616
616
  }
617
- catch (e) {
617
+ catch {
618
618
  return ''
619
619
  }
620
620
  }
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
+ }