Skip to main content

TypeAlias.Balance

type Balance: {
decimals: number;
isFees: boolean;
isNative: boolean;
raw: string | bigint;
symbol: string;
};

Represents a balance with optional metadata.

Type declaration

NameTypeDescription
decimals?numberThe number of decimal places for the balance.
isFees?booleanIndicates if the balance is used for fees.
isNative?booleanIndicates if the balance is in the native currency.
rawstring | bigintThe raw balance value.
symbol?stringThe symbol of the currency.

Examples

// Example of a balance in native currency with fees
const balance: Balance = {
raw: '1000000000000000000',
decimals: 18,
symbol: 'ETH',
isNative: true,
isFees: true
};
// Example of a balance in a token
const tokenBalance: Balance = {
raw: BigInt('500000000000000000'),
decimals: 18,
symbol: 'DAI'
};