Documentation ¶
Index ¶
- Constants
- func DecodePrivateKey(hexKey string) (*btcec.PrivateKey, error)
- func ExportPrivateKeyAsHex(privateKey *btcec.PrivateKey) string
- func GenerateAccent() (string, string)
- func IsTrc20Address(address string) bool
- func PublicKeyToTronAddress(pubKey *btcec.PublicKey) (string, error)
- type Balance
- type EasyUtilsSDK
- func (e *EasyUtilsSDK) Balance(address string) (*Balance, error)
- func (e EasyUtilsSDK) GetTransactionByID(txHash string) (*core.Transaction, error)
- func (e *EasyUtilsSDK) ParseBlock(block *api.BlockExtention, contract string) (result []TxNode, err bool)
- func (e *EasyUtilsSDK) ParseTRC20(tx *core.Transaction, contract string) (*TxNode, error)
- func (e *EasyUtilsSDK) SendSignedTx(tx *core.Transaction) (*api.Return, error)
- func (e *EasyUtilsSDK) SendTRC20ToAddress(privateKeyStr string, toAddress string, contract string, value float64, ...) (*core.Transaction, error)
- func (e *EasyUtilsSDK) SendTRXToAddress(privateKeyStr string, toAddress string, value float64, numberQueries int) (*core.Transaction, error)
- func (e *EasyUtilsSDK) SignTx(privateKey *ecdsa.PrivateKey, tx *core.Transaction) (*core.Transaction, error)
- func (e *EasyUtilsSDK) TRC20Balance(address string, contract string) (float64, error)
- func (e *EasyUtilsSDK) TRC20TransactionHistory(address string, contract string, limit int, onlyTo bool, onlyFrom bool) ([]TRC20TransactionHistoryItem, error)
- func (e *EasyUtilsSDK) TRC20Tx(contract string, nodeChannel chan TxNode)
- func (e *EasyUtilsSDK) TransactionHash(tx *core.Transaction) (string, error)
- func (e *EasyUtilsSDK) TxConfirmation(tx *core.Transaction, numberQueries int) (*core.TransactionInfo, error)
- func (e *EasyUtilsSDK) TxConfirmationByHash(txHash string, numberQueries int) (*core.TransactionInfo, error)
- func (e *EasyUtilsSDK) UnpackInput(txInput, abiJson string) ([]interface{}, string, error)
- type TRC20TransactionHistoryItem
- type TxNode
Constants ¶
const StandardTokenABI = "" /* 3791-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func DecodePrivateKey ¶
DecodePrivateKey decodes a hex string to a btcec private key 将十六进制字符串解码为 btcec 私钥
func ExportPrivateKeyAsHex ¶
func ExportPrivateKeyAsHex(privateKey *btcec.PrivateKey) string
ExportPrivateKeyAsHex exports the private key as a hex string
func IsTrc20Address ¶
func PublicKeyToTronAddress ¶
PublicKeyToTronAddress converts a public key to a Tron address PublicKeyToTronAddress 将公钥转换为 Tron 地址
Types ¶
type Balance ¶
type EasyUtilsSDK ¶
type EasyUtilsSDK struct {
// contains filtered or unexported fields
}
func NewEasyUtilsSDK ¶
func NewEasyUtilsSDK(nodeAddress string, nodeHTTPAddress string, token string, withTLS bool, gasLimit int64) (*EasyUtilsSDK, error)
NewEasyUtilsSDK 交易用sdk
func (*EasyUtilsSDK) Balance ¶
func (e *EasyUtilsSDK) Balance(address string) (*Balance, error)
Balance 獲取balance 新用戶沒有幣記錄會報用戶不存在
func (EasyUtilsSDK) GetTransactionByID ¶
func (e EasyUtilsSDK) GetTransactionByID(txHash string) (*core.Transaction, error)
func (*EasyUtilsSDK) ParseBlock ¶
func (e *EasyUtilsSDK) ParseBlock(block *api.BlockExtention, contract string) (result []TxNode, err bool)
func (*EasyUtilsSDK) ParseTRC20 ¶
func (e *EasyUtilsSDK) ParseTRC20(tx *core.Transaction, contract string) (*TxNode, error)
ParseTRC20ByTxHash 解析TRC20交易
func (*EasyUtilsSDK) SendSignedTx ¶
func (e *EasyUtilsSDK) SendSignedTx(tx *core.Transaction) (*api.Return, error)
SendSignedTx 发送签名消息
func (*EasyUtilsSDK) SendTRC20ToAddress ¶
func (e *EasyUtilsSDK) SendTRC20ToAddress(privateKeyStr string, toAddress string, contract string, value float64, numberQueries int) (*core.Transaction, error)
SendTRC20ToAddress 发送TRC20代币 (privateKeyStr, toAddress,contract string, value float64, numberQueries int)
func (*EasyUtilsSDK) SendTRXToAddress ¶
func (e *EasyUtilsSDK) SendTRXToAddress(privateKeyStr string, toAddress string, value float64, numberQueries int) (*core.Transaction, error)
SendTRXToAddress fromPrivateKey,toAddress string, value float,numberQueries 查詢交易是否成功次數
func (*EasyUtilsSDK) SignTx ¶
func (e *EasyUtilsSDK) SignTx(privateKey *ecdsa.PrivateKey, tx *core.Transaction) (*core.Transaction, error)
SignTx 簽名交易
func (*EasyUtilsSDK) TRC20Balance ¶
func (e *EasyUtilsSDK) TRC20Balance(address string, contract string) (float64, error)
TRC20Balance 獲取TRC20代币余额
func (*EasyUtilsSDK) TRC20TransactionHistory ¶
func (e *EasyUtilsSDK) TRC20TransactionHistory(address string, contract string, limit int, onlyTo bool, onlyFrom bool) ([]TRC20TransactionHistoryItem, error)
TRC20TransactionHistory 获取TRC20代币交易历史 (address, contract string 合於地址爲空則查詢全部trc20, limit int, onlyTo bool 只查入金, onlyFrom bool 之查詢出金)
func (*EasyUtilsSDK) TRC20Tx ¶
func (e *EasyUtilsSDK) TRC20Tx(contract string, nodeChannel chan TxNode)
TRC20Tx 监听TRC20交易 可指定合约
func (*EasyUtilsSDK) TransactionHash ¶
func (e *EasyUtilsSDK) TransactionHash(tx *core.Transaction) (string, error)
TransactionHash 獲取tx id/hash
func (*EasyUtilsSDK) TxConfirmation ¶
func (e *EasyUtilsSDK) TxConfirmation(tx *core.Transaction, numberQueries int) (*core.TransactionInfo, error)
TxConfirmation 確認交易 (tx,查詢次數)
func (*EasyUtilsSDK) TxConfirmationByHash ¶
func (e *EasyUtilsSDK) TxConfirmationByHash(txHash string, numberQueries int) (*core.TransactionInfo, error)
TxConfirmationByHash 確認交易 (tx,查詢次數)
func (*EasyUtilsSDK) UnpackInput ¶
func (e *EasyUtilsSDK) UnpackInput(txInput, abiJson string) ([]interface{}, string, error)
type TRC20TransactionHistoryItem ¶
type TRC20TransactionHistoryItem struct { TransactionId string `json:"transaction_id"` BlockTimestamp int64 `json:"block_timestamp"` From string `json:"from"` To string `json:"to"` Value string `json:"value"` ValueFloat float64 `json:"value_float"` Type string `json:"type"` TokenInfo struct { Name string `json:"name"` Symbol string `json:"symbol"` Decimals int `json:"decimals"` Address string `json:"address"` } `json:"token_info"` }