Documentation
¶
Index ¶
- Constants
- func CreateWalletAccount() (privateKeyHex, address string, err error)
- func WalletAddressFromPrivateKey(privateKeyHex string) (address string, err error)
- type Gas
- type ParsedLog
- type ParsedTx
- type ParsedTxFee
- type TxParser
- type WalletClient
- func NewWalletClient(endpoint, privateKeyHex string) (wc *WalletClient, cleanup func(), err error)
- func NewWalletClientWithBasicAuth(endpoint, token, privateKeyHex string) (wc *WalletClient, cleanup func(), err error)
- func NewWalletClientWithXToken(endpoint, token, privateKeyHex string) (wc *WalletClient, cleanup func(), err error)
- func (wc *WalletClient) EstimateGasTransferTRC20Token(ctx context.Context, tokenAddress, to string, amount *big.Int, feeLimit int64) (gas Gas, err error)
- func (wc *WalletClient) EstimateGasTransferTRC20TokenV2(ctx context.Context, tokenAddress, to string, amount *big.Int, feeLimit int64) (gas Gas, err error)
- func (wc *WalletClient) EstimateGasTransferTRX(ctx context.Context, to string, amount int64) (gas Gas, err error)
- func (wc *WalletClient) GetTRC20TokenBalance(ctx context.Context, tokenAddress string) (balance *big.Int, err error)
- func (wc *WalletClient) GetTRC20TokenBalanceByAddress(ctx context.Context, tokenAddress, address string) (balance *big.Int, err error)
- func (wc *WalletClient) GetTRXBalance(ctx context.Context) (balance int64, err error)
- func (wc *WalletClient) GetTRXBalanceByAddress(ctx context.Context, address string) (balance int64, err error)
- func (wc *WalletClient) TransferTRC20Token(ctx context.Context, tokenAddress, to string, amount *big.Int, feeLimit int64) (txHash string, err error)
- func (wc *WalletClient) TransferTRX(ctx context.Context, to string, amount int64) (txHash string, err error)
Constants ¶
View Source
const ( SunPerTRX int64 = 1000000 // 1 TRX = 1,000,000 Sun TRXDecimals uint8 = 6 )
Variables ¶
This section is empty.
Functions ¶
func CreateWalletAccount ¶
Types ¶
type Gas ¶
type Gas struct {
Total int64 // = Bandwidth * BandwidthUnitPrice + Energy + EnergyUnitPrice
BandwidthUsed int64
BandwidthUnitPrice int64
// --- contract deploy or call ---
EnergyUsed int64
EnergyUnitPrice int64
// --- only transfer trx to inactivated account ---
CreateAccountFee int64
CreateAccountBandwidthFee int64
}
type ParsedTx ¶
type ParsedTx struct {
Block int64 // block height
Timestamp int64 // block timestamp // milliseconds
TxHash string // transaction hash
Status string // transaction status // success or fail
From string // from address
To string // to address // wallet or contract address
Value int64 // transaction value
Fee ParsedTxFee // transaction fee
FeeLimit int64 // transaction fee limit
InputData string // transaction input data // hex string
Logs []*ParsedLog // transaction logs
TxType int32 // transaction type // https://github.com/tronprotocol/java-tron/blob/develop/protocol/src/main/protos/core/Tron.proto#L338
}
type ParsedTxFee ¶
type TxParser ¶
type TxParser struct {
// contains filtered or unexported fields
}
func NewTxParser ¶
func NewTxParserWithXToken ¶
type WalletClient ¶
type WalletClient struct {
// contains filtered or unexported fields
}
func NewWalletClient ¶
func NewWalletClient(endpoint, privateKeyHex string) (wc *WalletClient, cleanup func(), err error)
func NewWalletClientWithBasicAuth ¶
func NewWalletClientWithBasicAuth(endpoint, token, privateKeyHex string) (wc *WalletClient, cleanup func(), err error)
func NewWalletClientWithXToken ¶
func NewWalletClientWithXToken(endpoint, token, privateKeyHex string) (wc *WalletClient, cleanup func(), err error)
func (*WalletClient) EstimateGasTransferTRC20Token ¶
func (*WalletClient) EstimateGasTransferTRC20TokenV2 ¶
func (*WalletClient) EstimateGasTransferTRX ¶
func (*WalletClient) GetTRC20TokenBalance ¶
func (*WalletClient) GetTRC20TokenBalanceByAddress ¶
func (*WalletClient) GetTRXBalance ¶
func (wc *WalletClient) GetTRXBalance(ctx context.Context) (balance int64, err error)
func (*WalletClient) GetTRXBalanceByAddress ¶
func (*WalletClient) TransferTRC20Token ¶
func (*WalletClient) TransferTRX ¶
Click to show internal directories.
Click to hide internal directories.