ethereum

package
v0.0.0-...-101354e Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	ProviderURI string
}

Options service options

type Service

type Service struct {
	Client *ethclient.Client
}

Service service

func New

func New(opts *Options) (*Service, error)

New returns new service

func (*Service) GetAccountBalance

func (s *Service) GetAccountBalance(address string) (*big.Int, error)

GetAccountBalance get account balance

func (*Service) GetGasPrice

func (s *Service) GetGasPrice() *big.Int

GetGasPrice gets clamped gas price

func (*Service) GetLatestBlockNumber

func (s *Service) GetLatestBlockNumber() (*big.Int, error)

GetLatestBlockNumber get the latest block number

func (*Service) GetPublicAddressFromPrivateKey

func (s *Service) GetPublicAddressFromPrivateKey(priv *ecdsa.PrivateKey) (common.Address, error)

GetPublicAddressFromPrivateKey returns public address from private key

func (*Service) GetTokenBalance

func (s *Service) GetTokenBalance(_tokenAddress string, _accountAddress string) (*big.Int, error)

GetTokenBalance get token balance

func (*Service) GetTokenDecimals

func (s *Service) GetTokenDecimals(tokenAddress string) (*big.Int, error)

GetTokenDecimals get token decimals

func (*Service) SendTx

func (s *Service) SendTx(tx *types.Transaction) error

SendTx send a transaction to the network

func (*Service) SignTx

func (s *Service) SignTx(nonce uint64, _toAddress string, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, privateKey string) (*types.Transaction, error)

SignTx sign a transaction with a private key

func (*Service) TransferEth

func (s *Service) TransferEth(privateKey string, _toAddress string, amount *big.Int) (*types.Transaction, error)

TransferEth transfer ETH to an address

func (*Service) TransferTokens

func (s *Service) TransferTokens(auth bind.TransactOpts, _tokenAddress string, _toAddress string, amount *big.Int) (*types.Transaction, error)

TransferTokens transfer tokens to an address

func (*Service) TransferTokensTxData

func (s *Service) TransferTokensTxData(_toAddress string, amount *big.Int) ([]byte, error)

TransferTokensTxData generate transaction data for transfer token call

Jump to

Keyboard shortcuts

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