Skip to content

getWalletBalances ​

You can use getWalletBalances method to retrieve all tokens on the connected user wallet address. For the full list of supported networks, see Supported Networks.

Usage ​

typescript
const data = await holyheldSDK.evm.getWalletBalances(
  '0x...',
);
typescript
const data = await holyheldSDK.solana.getWalletBalances(
  '...',
);

Parameters ​

Wallet Address ​

User's wallet address.

  • Type: string
typescript
const data = await holyheldSDK.evm.getWalletBalances(
  '0x...', 
);
typescript
const data = await holyheldSDK.solana.getWalletBalances(
  '...', 
);

Returns ​

The SDK exports WalletBalancesEVM, WalletBalancesSolana, WalletTokenEVM, and WalletTokenSolana types. In practice, getWalletBalances() returns the following concrete shapes:

typescript
import { Network, NetworkKind } from '@holyheld/sdk';

type WalletTokenEVM = {
  name: string;
  address: string;
  symbol: string;
  decimals: number;
  network: Network;
  networkKind: NetworkKind.EVM;
  iconURL: string;
  priceUSD: string;
  balance: string;
  priceInEURForTopUp: string;
  meta: {
    permitData: {
      hasPermit: boolean;
      permitType?: string;
      permitVersion?: string;
    };
  };
};

type WalletBalancesEVM = {
  tokens: WalletTokenEVM[];
};
typescript
import { NetworkKind, SolanaNetwork } from '@holyheld/sdk';

type WalletTokenSolana = {
  name: string;
  address: string;
  symbol: string;
  decimals: number;
  network: SolanaNetwork;
  networkKind: NetworkKind.Solana;
  iconURL: string;
  priceUSD: string;
  balance: string;
  priceInEURForTopUp: string;
  meta: {
    tokenProgramId?: string;
  };
};

type WalletBalancesSolana = {
  tokens: WalletTokenSolana[];
};

Fields ​

FieldTypeDescription
namestringToken display name, for example USD Coin.
addressstringToken contract or mint address.
symbolstringToken symbol, for example USDC.
decimalsnumberToken decimals.
networkNetwork / SolanaNetworkBlockchain network on which this token resides.
networkKindNetworkKindBlockchain family: EVM or Solana.
iconURLstringToken icon URL.
priceUSDstringCurrent token price in USD.
balancestringWallet balance as a decimal string.
priceInEURForTopUpstringToken price converted to EUR for top-up calculations.
metaobjectNetwork-specific metadata.

meta for EVM tokens ​

typescript
type WalletTokenEVMMeta = {
  permitData: {
    hasPermit: boolean;
    permitType?: string;
    permitVersion?: string;
  };
};

meta for Solana tokens ​

typescript
type WalletTokenSolanaMeta = {
  tokenProgramId?: string;
};