tron

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAddressFromPrivateKey

func GetAddressFromPrivateKey(privateKey *secp256k1.PrivateKey) string

@title 获取钱包地址 @param privateKey *secp256k1.PrivateKey 私钥 @return _ string 地址

Types

type Account

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

func NewAccountFromMnemonic

func NewAccountFromMnemonic(mnemonic string, password string, index int64) (*Account, error)

@title 创建账户 @param mnemonic string 助记词 @param password string 密码 @param index int64 账户索引 @return _ *Account 账户 @return _ error 异常信息

func NewAccountFromSeed

func NewAccountFromSeed(seed []byte, index int64) (*Account, error)

@title 创建账户 @param seed []byte 种子 @param index int64 账户索引 @return _ *Account 账户 @return _ error 异常信息

func (*Account) Chain

func (Self *Account) Chain() common.Chain

@title 链类型 @param Self *Account @return _ common.Chain 链类型

func (*Account) GetAddress

func (Self *Account) GetAddress() (string, error)

@title 获取钱包地址 @param Self *Account @return _ string 地址 @return _ error 异常信息

func (*Account) GetPrivateKey

func (Self *Account) GetPrivateKey() (*secp256k1.PrivateKey, error)

@title 获取私钥 @param Self *Account @return _ *secp256k1.PrivateKey 私钥 @return _ error 异常信息

type ChainClient

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

func NewChainClient

func NewChainClient(nodes map[string]int, apiKeys []string, currencies map[string]Currency) *ChainClient

@title 创建链客户端 @param nodes map[string]int 节点列表 @param apiKeys []string ApiKey列表 @param currencies map[string]Currency 币种列表 @return _ *ChainClient 链客户端

func (*ChainClient) Chain

func (Self *ChainClient) Chain() common.Chain

@title 链类型 @param Self *ChainClient @return _ common.Chain 链类型

func (*ChainClient) GetBalance

func (Self *ChainClient) GetBalance(address string, currency string, args any) (float64, error)

@title 查询余额 @param Self *ChainClient @param address string 地址 @param currency string 币种 @param args any 参数 @return _ float64 余额 @return _ error 异常信息

func (*ChainClient) GetCurrentHeight

func (Self *ChainClient) GetCurrentHeight() (uint64, error)

@title 获取当前高度 @param Self *ChainClient @return _ uint64 当前高度 @return _ error 异常信息

func (*ChainClient) GetTransaction

func (Self *ChainClient) GetTransaction(txHash string) (*common.Transaction, error)

@title 查询交易 @param Self *ChainClient @param txHash string 交易Hash @return _ *Transaction 交易信息 @return _ error 异常信息

func (*ChainClient) Transfer

func (Self *ChainClient) Transfer(privateKey *secp256k1.PrivateKey, to string, currency string, value float64, args any) (string, error)

@title 转账 @param Self *ChainClient @param privateKey *secp256k1.PrivateKey 私钥 @param to string 接收方 @param currency string 币种 @param value float64 金额 @param args any 参数 @return _ string 交易哈希 @return _ error 异常信息

type Currency

type Currency struct {
	Contract string `json:"," default:""`
	Decimals int    `json:","`
}

type GetBalanceParameter

type GetBalanceParameter struct {
}

type TransferParameter

type TransferParameter struct {
}

Jump to

Keyboard shortcuts

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