TypeAlias.Balance
type Balance: {
decimals: number;
isFees: boolean;
isNative: boolean;
raw: string | bigint;
symbol: string;
};
Represents a balance with optional metadata.
Type declaration
Name | Type | Description |
---|---|---|
decimals ? | number | The number of decimal places for the balance. |
isFees ? | boolean | Indicates if the balance is used for fees. |
isNative ? | boolean | Indicates if the balance is in the native currency. |
raw | string | bigint | The raw balance value. |
symbol ? | string | The 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'
};