easy_utils

package
v0.0.0-...-647c4c0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2024 License: LGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const StandardTokenABI = "" /* 3791-byte string literal not displayed */

Variables

This section is empty.

Functions

func DecodePrivateKey

func DecodePrivateKey(hexKey string) (*btcec.PrivateKey, error)

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 GenerateAccent

func GenerateAccent() (string, string)

GenerateAccent generates a new accent

func IsTrc20Address

func IsTrc20Address(address string) bool

func PublicKeyToTronAddress

func PublicKeyToTronAddress(pubKey *btcec.PublicKey) (string, error)

PublicKeyToTronAddress converts a public key to a Tron address PublicKeyToTronAddress 将公钥转换为 Tron 地址

Types

type Balance

type Balance struct {
	Address   string  `json:"address"`
	Type      int     `json:"type"`
	Allowance float64 `json:"allowance"`
	Balance   float64 `json:"balance"`
}

func (*Balance) Print

func (b *Balance) Print()

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"`
}

type TxNode

type TxNode struct {
	FromAddress string
	ToAddress   string
	Contract    string
	Amount      float64
	Success     bool
	TxHash      string
}

func (*TxNode) Print

func (t *TxNode) Print()

Jump to

Keyboard shortcuts

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