@aarc-dev/core-viem
Advanced tools
Comparing version 0.1.16 to 0.1.17
@@ -12,3 +12,11 @@ import { BalancesData, BalancesResponse, CheckoutDto, CheckoutOnrampParams, CheckoutRouteDto, DepositCalldataResponse, DepositDto, DepositOnRampParams, DepositRouteDto, ExecuteMigrationForwardDto, ExecuteMigrationGaslessDto, ExecuteMigrationNonGaslessDto, IsTokenSupportedResponse, MoonpayOnRampParams, PriceData, RelayedTxListResponse, SupportedChainInfo, SupportedTokensResponse, TrxStatusResponse, KadoOnRampParams, DepositAddressData, StatusResponseDto, DepositAddressDTO } from "./utils/CoreTypes"; | ||
fetchBalances(eoaAddress: string, chainId: number, fetchBalancesOnly?: boolean, tokenAddresses?: string[]): Promise<BalancesResponse>; | ||
fetchMultiChainBalances(eoaAddress: string): Promise<BalancesData>; | ||
/** | ||
* @description this function will return balances of ERC-20, ERC-721 and native tokens | ||
* if given tokenSymbol and tokenAmount then it will return balances of given token | ||
* @param eoaAddress wallet address | ||
* @param tokenSymbol token symbol eg: USDT, ETH, BTC | ||
* @param tokenAmount token amount eg: 100, 200, 300 | ||
* @returns | ||
*/ | ||
fetchMultiChainBalances(eoaAddress: string, tokenSymbol?: string, tokenAmount?: string): Promise<BalancesData>; | ||
fetchTokenPrice(tokenSymbol: string): Promise<PriceData>; | ||
@@ -15,0 +23,0 @@ isTokenSupported(chainId: number, tokenAddress: string): Promise<IsTokenSupportedResponse>; |
@@ -177,4 +177,12 @@ "use strict"; | ||
} | ||
async fetchMultiChainBalances(eoaAddress) { | ||
return await (0, Helper_1.getMultiChainBalances)(this.apiKey, eoaAddress); | ||
/** | ||
* @description this function will return balances of ERC-20, ERC-721 and native tokens | ||
* if given tokenSymbol and tokenAmount then it will return balances of given token | ||
* @param eoaAddress wallet address | ||
* @param tokenSymbol token symbol eg: USDT, ETH, BTC | ||
* @param tokenAmount token amount eg: 100, 200, 300 | ||
* @returns | ||
*/ | ||
async fetchMultiChainBalances(eoaAddress, tokenSymbol, tokenAmount) { | ||
return await (0, Helper_1.getMultiChainBalances)(this.apiKey, eoaAddress, tokenSymbol, tokenAmount); | ||
} | ||
@@ -181,0 +189,0 @@ async fetchTokenPrice(tokenSymbol) { |
@@ -15,3 +15,3 @@ import { BalancesData, BalancesResponse, CheckoutCallDataDto, CheckoutCalldataResponse, DepositCallDataDto, DepositCalldataResponse, ForwardCallDataDto, ForwardCalldataRes, GaslessCalldataResponse, IsTokenSupportedResponse, PriceData, RelayedTxListResponse, SupportedChainInfo, SupportedTokensResponse, TRX_RESPONSE } from "./CoreTypes"; | ||
export declare const fetchBalances: (apiKey: string, chainId: number, eoaAddress: string, fetchBalancesOnly?: boolean, tokenAddresses?: string[]) => Promise<BalancesResponse>; | ||
export declare const getMultiChainBalances: (apiKey: string, walletAddress: string) => Promise<BalancesData>; | ||
export declare const getMultiChainBalances: (apiKey: string, walletAddress: string, tokenSymbol?: string, tokenAmount?: string) => Promise<BalancesData>; | ||
export declare const IsTokenSupported: (apiKey: string, chainId: number, address: string) => Promise<IsTokenSupportedResponse>; | ||
@@ -18,0 +18,0 @@ export declare const GetSupportedTokens: (apiKey: string, chainId: number, isShortList?: boolean) => Promise<SupportedTokensResponse>; |
@@ -121,3 +121,3 @@ "use strict"; | ||
...rest, | ||
...outputTokenPreferences | ||
...outputTokenPreferences, | ||
}; | ||
@@ -203,4 +203,9 @@ // Convert callDataDto to a query string using URLSearchParams | ||
exports.fetchBalances = fetchBalances; | ||
const getMultiChainBalances = async (apiKey, walletAddress) => { | ||
const response = await fetch(`${Constants_1.MULTI_CHAIN_BALANCES_ENDPOINT}/${walletAddress}`, { | ||
const getMultiChainBalances = async (apiKey, walletAddress, tokenSymbol, tokenAmount) => { | ||
const payload = ""; | ||
if (tokenSymbol) | ||
payload.concat(`?tokenSymbol=${tokenSymbol}`); | ||
if (tokenAmount) | ||
payload.concat(`&tokenAmount=${tokenAmount}`); | ||
const response = await fetch(`${Constants_1.MULTI_CHAIN_BALANCES_ENDPOINT}/${walletAddress}?${payload}`, { | ||
method: "GET", | ||
@@ -207,0 +212,0 @@ headers: { |
{ | ||
"name": "@aarc-dev/core-viem", | ||
"version": "0.1.16", | ||
"version": "0.1.17", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./dist/src/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
217842
2247