eth

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedOperation = errors.New("operation not supported for this blockchain")

Functions

This section is empty.

Types

type Ethereum

type Ethereum struct {
	EndpointURL string
}

func (Ethereum) CreateWallet

func (e Ethereum) CreateWallet(cwp types.CWParam) (types.Wallet, error)

CreateWallet generates a wallet from a given passphrase (password), and returns a Wallet struct containing the mnemonic, private key, public key, and Ethereum address.

func (Ethereum) GetAddressFromPrivateKey

func (e Ethereum) GetAddressFromPrivateKey(privateKey string) (types.Address, error)

Get address from Private Key

func (Ethereum) GetBalance

func (e Ethereum) GetBalance(bp types.BalanceParam) (types.Balance, error)

GetBalance checks for the balance of the native network token of an address It returns a Balance struct containing the address, balance (in wei) and the network

func (Ethereum) GetTokenBalance

func (e Ethereum) GetTokenBalance(tbp types.TBParam) (types.TokenBalance, error)

GetTokenBalance checks for the balance of an ERC20 token for an address. It takes in struct as argument `balancePayload` containing address, rpc url, network and contract address of the ERC 20 token. It returns a Balance struct containing the address, balance (in wei) and the network

func (Ethereum) GetTokenInfo

func (e Ethereum) GetTokenInfo(tip types.TokenInfoParam) (types.TokenInfo, error)

Get Token Info provides the name, symbol, decimals, token supply and token address of a token.

func (Ethereum) GetTxByHash

func (e Ethereum) GetTxByHash(hp types.HashParam) (types.TransactionByHash, error)

GetTxByHash retrieves the transaction and its pending status given its hash and an RPC URL. It returns the transaction object and a boolean indicating whether the transaction is pending.

func (Ethereum) SmartContractCall

func (e Ethereum) SmartContractCall(payload types.SmartContractCallPayload) ([]interface{}, error)

SmartContractCalls performs a generic method call on a specified smart contract. It accepts the contract address, method name, parameters, and ABI, and returns the method results.

func (Ethereum) Transfer

func (e Ethereum) Transfer(tp types.TransferParam) (types.TransferData, error)

TransferETH sends ETH from one wallet to a specified recipient address. It returns the transaction hash, sender address, recipient address, amount transferred and transaction info like gas limit, gas price and block number.

func (Ethereum) TransferToken

func (e Ethereum) TransferToken(ttp types.TransferTokenParam) (types.TransferData, error)

TransferToken sends tokens from a wallet to a specified recipient address. It returns the transaction hash, sender address, recipient address, amount transferred and transaction info like gas limit, gas price and block number.

func (Ethereum) WalletFromMnemonic

func (e Ethereum) WalletFromMnemonic(wp types.WalletParam) (types.Wallet, error)

WalletFromMnemonic generates an Ethereum wallet from a given mnemonic and passphrase (password). It returns a Wallet struct containing the mnemonic, private key, public key, and address.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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