blockchain

package
v1.11.11 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenPocketRPC = "https://web3.mytokenpocket.vip"
	BinanceRPC     = "https://bsc.nodereal.io"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Ethereum

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

func NewEthereum

func NewEthereum() *Ethereum

NewEthereum 创建ETH对象

func (*Ethereum) Balance

func (_Ethereum *Ethereum) Balance(address common.Address) (*big.Float, error)

Balance 获取余额

func (*Ethereum) CloseClient added in v1.11.6

func (_Ethereum *Ethereum) CloseClient()

CloseClient 关闭连接

func (*Ethereum) FormatEther

func (_Ethereum *Ethereum) FormatEther(wei *big.Int, decimals int) *big.Float

FormatEther 获取以太单位

func (*Ethereum) FormatWei added in v1.11.7

func (_Ethereum *Ethereum) FormatWei(value *big.Float, decimals int) *big.Int

FormatWei 浮点数转

func (*Ethereum) GenerateKey

func (_Ethereum *Ethereum) GenerateKey() (string, string, error)

GenerateKey 生成 私钥|地址

func (*Ethereum) GetAccountAuth

func (_Ethereum *Ethereum) GetAccountAuth() (*bind.TransactOpts, error)

GetAccountAuth 获取账号权限

func (*Ethereum) GetTokenDecimalsAmount

func (_Ethereum *Ethereum) GetTokenDecimalsAmount(value *big.Float) (*big.Int, error)

GetTokenDecimalsAmount 转换Token的数量

func (*Ethereum) IsAddress

func (_Ethereum *Ethereum) IsAddress(address string) bool

IsAddress 验证地址是否有效

func (*Ethereum) SetClient

func (_Ethereum *Ethereum) SetClient(rpcURL string) *Ethereum

SetClient 设置PRC对象

func (*Ethereum) SetContract added in v1.11.2

func (_Ethereum *Ethereum) SetContract(address string) *Ethereum

SetContract 设置合约

func (*Ethereum) SetPrivateKey

func (_Ethereum *Ethereum) SetPrivateKey(privateStr string) *Ethereum

SetPrivateKey 设置私钥

func (*Ethereum) TokenBalance

func (_Ethereum *Ethereum) TokenBalance(address common.Address) (*big.Float, error)

TokenBalance 合约余额

func (*Ethereum) TokenDecimals added in v1.11.7

func (_Ethereum *Ethereum) TokenDecimals() (*big.Int, error)

TokenDecimals 合约精度

func (*Ethereum) TokenTransfer

func (_Ethereum *Ethereum) TokenTransfer(address common.Address, value *big.Float) (*types.Transaction, error)

TokenTransfer 合约转账

func (*Ethereum) TokenTransferFrom

func (_Ethereum *Ethereum) TokenTransferFrom(fromAddress, toAddress common.Address, value *big.Float) (*types.Transaction, error)

TokenTransferFrom 合约授权转账

func (*Ethereum) TransactionAsMessage added in v1.11.4

func (_Ethereum *Ethereum) TransactionAsMessage(tx *types.Transaction) (types.Message, error)

TransactionAsMessage 获取哈希消息

func (*Ethereum) TransactionByHash added in v1.11.4

func (_Ethereum *Ethereum) TransactionByHash(hashTxStr string) (*types.Transaction, bool)

TransactionByHash 查询交易hex状态

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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