balance

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsFiat added in v1.1.0

func AsFiat(tokenBalance *big.Int, tokenDecimals int, dollarRate int64, centsRate float64) int64

AsFiat will convert the given token balance into a fiat value, expressed as the number of cents (e.g., $123.45 fiat of a token balance will be returned as 12345).

Types

type ERC20Fetcher added in v1.1.0

type ERC20Fetcher struct {
	// contains filtered or unexported fields
}

ERC20Fetcher is a Fetcher implementation for EVM chains.

func NewERC20Fetcher added in v1.1.0

func NewERC20Fetcher(nodeURL string, doer synchttp.Doer) *ERC20Fetcher

NewERC20Fetcher builds an ERC20Fetcher instance that communicates with the given node URL.

func (*ERC20Fetcher) FetchBalance added in v1.1.0

func (e *ERC20Fetcher) FetchBalance(ctx context.Context, tokenAddress string, walletAddress string) (*big.Int, error)

type Fetcher

type Fetcher interface {
	// FetchBalance gets the balance of the given token for the given wallet address.
	FetchBalance(ctx context.Context, tokenAddress string, walletAddress string) (*big.Int, error)
}

Fetcher defines a way to fetch balance information.

type StakewiseVaultFetcher added in v1.1.0

type StakewiseVaultFetcher struct {
	// contains filtered or unexported fields
}

StakewiseVaultFetcher will fetch a wallet's balance from a Stakewise vault.

func NewStakewiseVaultFetcher added in v1.1.0

func NewStakewiseVaultFetcher(nodeURL string, doer synchttp.Doer) *StakewiseVaultFetcher

func (*StakewiseVaultFetcher) FetchBalance added in v1.1.0

func (s *StakewiseVaultFetcher) FetchBalance(ctx context.Context, tokenAddress string, walletAddress string) (*big.Int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL