ethcli

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: MIT Imports: 13 Imported by: 1

README

evm client

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToHex

func BytesToHex(bz []byte) string

func BytesToHexWith0x

func BytesToHexWith0x(bz []byte) string

func GenKey

func GenKey() (string, string, string, error)

GenKey return pk,address,sk

func HashToAddress

func HashToAddress(hx common.Hash) common.Address

func HashToBigInt

func HashToBigInt(hx common.Hash) *big.Int

func HexToBytes

func HexToBytes(str string) []byte

func ToEther

func ToEther(v *big.Int) *big.Int

func ToWei

func ToWei(v *big.Int) *big.Int

func ValidAddress

func ValidAddress(address string) bool

Types

type EvmClient

type EvmClient struct {
	*ethclient.Client
}

func New

func New(rawurl string) (*EvmClient, error)

func (*EvmClient) BuildDynamicFeeTx added in v0.5.0

func (cli *EvmClient) BuildDynamicFeeTx(chainId *big.Int, nonce uint64, baseFee, priorityFee *big.Int,
	gas uint64, to *common.Address, value *big.Int, data []byte) *types.Transaction

BuildDynamicFeeTx build DynamicFee transaction

func (*EvmClient) BuildLegacyTx

func (cli *EvmClient) BuildLegacyTx(nonce uint64, gasPrice *big.Int,
	gas uint64, to *common.Address, value *big.Int, data []byte) *types.Transaction

BuildLegacyTx build Legacy transaction

func (*EvmClient) ERC20Allowance

func (cli *EvmClient) ERC20Allowance(ctx context.Context, token, owner, spender string, blockNumber *big.Int) (*big.Int, error)

func (*EvmClient) ERC20Approve

func (cli *EvmClient) ERC20Approve(ctx context.Context, token, key, spender, value string) (string, error)

func (*EvmClient) ERC20BalanceOf

func (cli *EvmClient) ERC20BalanceOf(ctx context.Context, token string, address string, blockNumber *big.Int) (*big.Int, error)

func (*EvmClient) ERC20Burn

func (cli *EvmClient) ERC20Burn(ctx context.Context, token, key, value string) (string, error)

func (*EvmClient) ERC20BurnFrom

func (cli *EvmClient) ERC20BurnFrom(ctx context.Context, token, key, owner, value string) (string, error)

func (*EvmClient) ERC20Decimals

func (cli *EvmClient) ERC20Decimals(ctx context.Context, token string, blockNumber *big.Int) (uint8, error)

func (*EvmClient) ERC20Mint

func (cli *EvmClient) ERC20Mint(ctx context.Context, token, key, to, value string) (string, error)

func (*EvmClient) ERC20Name

func (cli *EvmClient) ERC20Name(ctx context.Context, token string, blockNumber *big.Int) (string, error)

func (*EvmClient) ERC20Symbol

func (cli *EvmClient) ERC20Symbol(ctx context.Context, token string, blockNumber *big.Int) (string, error)

func (*EvmClient) ERC20TotalSupply

func (cli *EvmClient) ERC20TotalSupply(ctx context.Context, token string, blockNumber *big.Int) (*big.Int, error)

func (*EvmClient) ERC20Transfer

func (cli *EvmClient) ERC20Transfer(ctx context.Context, token, key, to, value string) (string, error)

func (*EvmClient) ERC20TransferFrom

func (cli *EvmClient) ERC20TransferFrom(ctx context.Context, token, key, from, to, value string) (string, error)

func (*EvmClient) ERC721Approve

func (cli *EvmClient) ERC721Approve(ctx context.Context, token string, key, to string, tokenId *big.Int) (string, error)

func (*EvmClient) ERC721BalanceOf

func (cli *EvmClient) ERC721BalanceOf(ctx context.Context, token string, owner string, blockNumber *big.Int) (*big.Int, error)

func (*EvmClient) ERC721Burn

func (cli *EvmClient) ERC721Burn(ctx context.Context, token string, key string, tokenId *big.Int) (string, error)

func (*EvmClient) ERC721Exists

func (cli *EvmClient) ERC721Exists(ctx context.Context, token string, tokenId *big.Int, blockNumber *big.Int) (bool, error)

func (*EvmClient) ERC721GetApproved

func (cli *EvmClient) ERC721GetApproved(ctx context.Context, token string, tokenId *big.Int, blockNumber *big.Int) (string, error)

func (*EvmClient) ERC721IsApprovedForAll

func (cli *EvmClient) ERC721IsApprovedForAll(ctx context.Context, token string, owner, operator string, blockNumber *big.Int) (bool, error)

func (*EvmClient) ERC721Mint

func (cli *EvmClient) ERC721Mint(ctx context.Context, token string, key string, to string) (string, error)

func (*EvmClient) ERC721MintWithTokenIdAndURI

func (cli *EvmClient) ERC721MintWithTokenIdAndURI(ctx context.Context, token string, key string, to string, tokenId *big.Int, uri string) (string, error)

func (*EvmClient) ERC721MintWithTokenURI

func (cli *EvmClient) ERC721MintWithTokenURI(ctx context.Context, token string, key string, to string, uri string) (string, error)

func (*EvmClient) ERC721Name

func (cli *EvmClient) ERC721Name(ctx context.Context, token string, blockNumber *big.Int) (string, error)

func (*EvmClient) ERC721OwnerOf

func (cli *EvmClient) ERC721OwnerOf(ctx context.Context, token string, tokenId *big.Int, blockNumber *big.Int) (string, error)

func (*EvmClient) ERC721Pause

func (cli *EvmClient) ERC721Pause(ctx context.Context, token string, key string) (string, error)

func (*EvmClient) ERC721Paused

func (cli *EvmClient) ERC721Paused(ctx context.Context, token string, blockNumber *big.Int) (bool, error)

func (*EvmClient) ERC721SafeTransferFrom

func (cli *EvmClient) ERC721SafeTransferFrom(ctx context.Context, token string, key, from, to string, tokenId *big.Int) (string, error)

func (*EvmClient) ERC721SafeTransferFromWithData

func (cli *EvmClient) ERC721SafeTransferFromWithData(ctx context.Context, token string, key, from, to string, tokenId *big.Int, calldata []byte) (string, error)

func (*EvmClient) ERC721SetApprovalForAll

func (cli *EvmClient) ERC721SetApprovalForAll(ctx context.Context, token string, key, operator string, approved bool) (string, error)

func (*EvmClient) ERC721SupportsInterface

func (cli *EvmClient) ERC721SupportsInterface(ctx context.Context, token string, blockNumber *big.Int) (bool, error)

func (*EvmClient) ERC721Symbol

func (cli *EvmClient) ERC721Symbol(ctx context.Context, token string, blockNumber *big.Int) (string, error)

func (*EvmClient) ERC721TokenByIndex

func (cli *EvmClient) ERC721TokenByIndex(ctx context.Context, token string, index *big.Int, blockNumber *big.Int) (*big.Int, error)

func (*EvmClient) ERC721TokenOfOwnerByIndex

func (cli *EvmClient) ERC721TokenOfOwnerByIndex(ctx context.Context, token string, owner string, index *big.Int, blockNumber *big.Int) (*big.Int, error)

func (*EvmClient) ERC721TokenURI

func (cli *EvmClient) ERC721TokenURI(ctx context.Context, token string, tokenId *big.Int, blockNumber *big.Int) (string, error)

ERC721TokenURI for ERC721Metadata && ERC721URIStorage

func (*EvmClient) ERC721TotalSupply

func (cli *EvmClient) ERC721TotalSupply(ctx context.Context, token string, blockNumber *big.Int) (*big.Int, error)

func (*EvmClient) ERC721TransferFrom

func (cli *EvmClient) ERC721TransferFrom(ctx context.Context, token string, key, from, to string, tokenId *big.Int) (string, error)

func (*EvmClient) ERC721Unpause

func (cli *EvmClient) ERC721Unpause(ctx context.Context, token string, key string) (string, error)

func (*EvmClient) ERC1155BalanceOf

func (cli *EvmClient) ERC1155BalanceOf(ctx context.Context, token string, owner string, tokenId *big.Int, blockNumber *big.Int) (*big.Int, error)

func (*EvmClient) ERC1155BalanceOfBatch

func (cli *EvmClient) ERC1155BalanceOfBatch(ctx context.Context, token string, owners []string, tokenIds []*big.Int, blockNumber *big.Int) ([]*big.Int, error)

func (*EvmClient) ERC1155Burn

func (cli *EvmClient) ERC1155Burn(ctx context.Context, key string, token string, to string, id *big.Int, amount *big.Int) (string, error)

func (*EvmClient) ERC1155BurnBatch

func (cli *EvmClient) ERC1155BurnBatch(ctx context.Context, key string, token string, to string, ids []*big.Int, amounts []*big.Int) (string, error)

func (*EvmClient) ERC1155IsApprovedForAll

func (cli *EvmClient) ERC1155IsApprovedForAll(ctx context.Context, token string, owner string, operator string, blockNumber *big.Int) (bool, error)

func (*EvmClient) ERC1155Mint

func (cli *EvmClient) ERC1155Mint(ctx context.Context, key string, token string, to string, id *big.Int, amount *big.Int, data []byte) (string, error)

func (*EvmClient) ERC1155MintBatch

func (cli *EvmClient) ERC1155MintBatch(ctx context.Context, key string, token string, to string, ids []*big.Int, amounts []*big.Int, data []byte) (string, error)

func (*EvmClient) ERC1155SafeBatchTransferFrom

func (cli *EvmClient) ERC1155SafeBatchTransferFrom(ctx context.Context, key string, token string, owner string, to string, ids []*big.Int, amounts []*big.Int) (string, error)

func (*EvmClient) ERC1155SafeTransferFrom

func (cli *EvmClient) ERC1155SafeTransferFrom(ctx context.Context, key string, token string, owner string, to string, id *big.Int, amount *big.Int, data []byte) (string, error)

func (*EvmClient) ERC1155SetApprovalForAll

func (cli *EvmClient) ERC1155SetApprovalForAll(ctx context.Context, key string, token string, owner string, operator string, id *big.Int) (string, error)

func (*EvmClient) ERC1155SupportsInterface

func (cli *EvmClient) ERC1155SupportsInterface(ctx context.Context, token string, interfaceId [4]byte, blockNumber *big.Int) (bool, error)

func (*EvmClient) ERC1155Uri

func (cli *EvmClient) ERC1155Uri(ctx context.Context, token string, tokenId *big.Int, blockNumber *big.Int) (string, error)

func (*EvmClient) SendDynamicFeeTx added in v0.5.0

func (cli *EvmClient) SendDynamicFeeTx(ctx context.Context, key string, to *string, amount string, payload string) (string, error)

SendDynamicFeeTx High-level Send DynamicFee Transaction

func (*EvmClient) SendLegacyTx

func (cli *EvmClient) SendLegacyTx(ctx context.Context, key string, to *string, amount string, payload string, gasPrice string, gasLimit uint64) (string, error)

SendLegacyTx High-level Send Legacy Transaction

func (*EvmClient) SendTx

func (cli *EvmClient) SendTx(ctx context.Context, signedTx *types.Transaction) error

SendTx Send signed transaction

func (*EvmClient) SignTx added in v0.5.0

func (cli *EvmClient) SignTx(ctx context.Context, tx *types.Transaction, key string) (*types.Transaction, error)

SignTx sign transaction

Jump to

Keyboard shortcuts

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