token

package
v0.115.3 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	RPCClient *rpc.Client
	// contains filtered or unexported fields
}

func NewTokenManager

func NewTokenManager(
	db *sql.DB,
	RPCClient *rpc.Client,
	networkManager *network.Manager,
) *Manager

func (*Manager) DeleteCustom

func (tm *Manager) DeleteCustom(chainID uint64, address common.Address) error

func (*Manager) DiscoverToken

func (tm *Manager) DiscoverToken(ctx context.Context, chainID uint64, address common.Address) (*Token, error)

func (*Manager) FindSNT

func (tm *Manager) FindSNT(chainID uint64) *Token

func (*Manager) FindToken

func (tm *Manager) FindToken(network *params.Network, tokenSymbol string) *Token

func (*Manager) GetBalance

func (tm *Manager) GetBalance(ctx context.Context, client *chain.Client, account common.Address, token common.Address) (*big.Int, error)

func (*Manager) GetBalances

func (tm *Manager) GetBalances(parent context.Context, clients []*chain.Client, accounts, tokens []common.Address) (map[common.Address]map[common.Address]*hexutil.Big, error)

func (*Manager) GetChainBalance

func (tm *Manager) GetChainBalance(ctx context.Context, client *chain.Client, account common.Address) (*big.Int, error)

func (*Manager) GetCustoms

func (tm *Manager) GetCustoms() ([]*Token, error)

func (*Manager) GetCustomsByChainID

func (tm *Manager) GetCustomsByChainID(chainID uint64) ([]*Token, error)

func (*Manager) GetTokenBalance

func (tm *Manager) GetTokenBalance(ctx context.Context, client *chain.Client, account common.Address, token common.Address) (*big.Int, error)

func (*Manager) GetTokens

func (tm *Manager) GetTokens(chainID uint64) ([]*Token, error)

func (*Manager) GetVisible

func (tm *Manager) GetVisible(chainIDs []uint64) (map[uint64][]*Token, error)

func (*Manager) IsTokenVisible

func (tm *Manager) IsTokenVisible(chainID uint64, address common.Address) (bool, error)

func (*Manager) Toggle

func (tm *Manager) Toggle(chainID uint64, address common.Address) error

func (*Manager) UpsertCustom

func (tm *Manager) UpsertCustom(token Token) error

type Token

type Token struct {
	Address common.Address `json:"address"`
	Name    string         `json:"name"`
	Symbol  string         `json:"symbol"`
	Color   string         `json:"color"`
	// Decimals defines how divisible the token is. For example, 0 would be
	// indivisible, whereas 18 would allow very small amounts of the token
	// to be traded.
	Decimals uint   `json:"decimals"`
	ChainID  uint64 `json:"chainId"`
}

func (*Token) IsNative

func (t *Token) IsNative() bool

Jump to

Keyboard shortcuts

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