Documentation ¶
Index ¶
- func DecodeAddressToPublicKey(address string) (string, error)
- func DecodeCheck(input string) ([]byte, error)
- func EncodePublicKeyToAddress(publicKey string) (string, error)
- func IsValidAddress(address string) bool
- func SignTransaction(transaction *core.Transaction, key *ecdsa.PrivateKey) ([]byte, error)
- type Account
- func (a Account) Address() string
- func (a Account) PrivateKey() ([]byte, error)
- func (a Account) PrivateKeyHex() (string, error)
- func (a Account) PublicKey() []byte
- func (a Account) PublicKeyHex() string
- func (a Account) Sign(message []byte, password string) ([]byte, error)
- func (a Account) SignHex(messageHex string, password string) (*base.OptionalString, error)
- type Chain
- func (c *Chain) BalanceOfAccount(account base.Account) (*base.Balance, error)
- func (c *Chain) BalanceOfAddress(address string) (*base.Balance, error)
- func (c *Chain) BalanceOfPublicKey(publicKey string) (*base.Balance, error)deprecated
- func (c *Chain) BatchFetchTransactionStatus(hashListString string) string
- func (c *Chain) EstimateTransactionFee(transaction base.Transaction) (fee *base.OptionalString, err error)
- func (c *Chain) EstimateTransactionFeeUsePublicKey(transaction base.Transaction, pubkey string) (fee *base.OptionalString, err error)
- func (c *Chain) FetchTransactionDetail(hash string) (*base.TransactionDetail, error)
- func (c *Chain) FetchTransactionStatus(hash string) base.TransactionStatus
- func (c *Chain) MainToken() base.Token
- func (c *Chain) SendRawTransaction(signedTx string) (string, error)
- func (c *Chain) SendSignedTransaction(signedTxn base.SignedTransaction) (*base.OptionalString, error)
- type IChain
- type Token
- func (t *Token) BalanceOfAccount(account base.Account) (*base.Balance, error)
- func (t *Token) BalanceOfAddress(address string) (*base.Balance, error)
- func (t *Token) BalanceOfPublicKey(publicKey string) (*base.Balance, error)
- func (t *Token) Chain() base.Chain
- func (t *Token) TokenInfo() (*base.TokenInfo, error)
- type TokenProtocol
- type TronChain
- func (e *TronChain) Balance(address string) (string, error)
- func (e *TronChain) BroadcastTransaction(transaction *core.Transaction) error
- func (e *TronChain) Close()
- func (e *TronChain) ConnectRemote(rpcUrl string) error
- func (e *TronChain) CreateRemote(rpcUrl string) (chain *TronChain, err error)
- func (e *TronChain) CreateRemoteWithTimeout(rpcUrl string, timeout int64) (chain *TronChain, err error)
- func (e *TronChain) FreezeBalance(from, delegateTo string, ownerKey *ecdsa.PrivateKey, ...) (*api.TransactionExtention, error)
- func (e *TronChain) GetTrc10Balance(addr, assetId string) (int64, error)
- func (e *TronChain) GetTrc20Balance(addr, contractAddress string) (*big.Int, error)
- func (e *TronChain) GetTrxBalance(addr string) (*core.Account, error)
- func (e *TronChain) GetTrxTransaction(txhash string) (*core.TransactionInfo, error)
- func (e *TronChain) LatestBlockNumber() (string, error)
- func (e *TronChain) Transfer(from, to string, amount int64) (*api.TransactionExtention, error)
- func (e *TronChain) TransferTrc10(from, to, assetId string, amount int64) (*api.TransactionExtention, error)
- func (e *TronChain) TransferTrc20(from, to, contract string, amount *big.Int, feeLimit int64) (*api.TransactionExtention, error)
- func (e *TronChain) UnFreezeBalance(from, delegateTo string, ownerKey *ecdsa.PrivateKey, ...) (*api.TransactionExtention, error)
- type Util
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeCheck ¶
func IsValidAddress ¶
IsValidAddress Check if address is 34 hexadecimal characters
func SignTransaction ¶
func SignTransaction(transaction *core.Transaction, key *ecdsa.PrivateKey) ([]byte, error)
SignTransaction 签名交易
Types ¶
type Account ¶
type Account struct { *Util // contains filtered or unexported fields }
func AccountWithPrivateKey ¶
AccountWithPrivateKey creates a new account with a given private key
func NewAccountWithMnemonic ¶
NewAccountWithMnemonic creates a new account with a given mnemonic
func (Account) PrivateKey ¶
func (Account) PrivateKeyHex ¶
func (Account) PublicKeyHex ¶
type Chain ¶
type Chain struct {
RpcUrl string
}
func NewChainWithRpc ¶
func (*Chain) BalanceOfAccount ¶
func (*Chain) BalanceOfAddress ¶
func (*Chain) BatchFetchTransactionStatus ¶
func (*Chain) EstimateTransactionFee ¶
func (c *Chain) EstimateTransactionFee(transaction base.Transaction) (fee *base.OptionalString, err error)
func (*Chain) EstimateTransactionFeeUsePublicKey ¶
func (c *Chain) EstimateTransactionFeeUsePublicKey(transaction base.Transaction, pubkey string) (fee *base.OptionalString, err error)
func (*Chain) FetchTransactionDetail ¶
func (c *Chain) FetchTransactionDetail(hash string) (*base.TransactionDetail, error)
func (*Chain) FetchTransactionStatus ¶
func (c *Chain) FetchTransactionStatus(hash string) base.TransactionStatus
func (*Chain) SendRawTransaction ¶
func (*Chain) SendSignedTransaction ¶
func (c *Chain) SendSignedTransaction(signedTxn base.SignedTransaction) (*base.OptionalString, error)
type Token ¶
type Token struct {
// contains filtered or unexported fields
}
func (*Token) BalanceOfAccount ¶
func (*Token) BalanceOfAddress ¶
func (*Token) BalanceOfPublicKey ¶
type TokenProtocol ¶
type TronChain ¶
type TronChain struct { RemoteRpcClient *client.GrpcClient RpcClient *client.GrpcClient // contains filtered or unexported fields }
func NewTronChain ¶
func NewTronChain() *TronChain
func (*TronChain) Balance ¶
@title 主网代币余额查询 @description 返回主网代币余额,decimal为代币精度 @param (walletAddress) (string) 合约名称,钱包地址 @return (string,error) 代币余额,错误信息
func (*TronChain) BroadcastTransaction ¶
func (e *TronChain) BroadcastTransaction(transaction *core.Transaction) error
func (*TronChain) ConnectRemote ¶
func (*TronChain) CreateRemote ¶
func (*TronChain) CreateRemoteWithTimeout ¶
func (e *TronChain) CreateRemoteWithTimeout(rpcUrl string, timeout int64) (chain *TronChain, err error)
@param timeout time unit millsecond. 0 means use chain's default: 60000ms.
func (*TronChain) FreezeBalance ¶
func (e *TronChain) FreezeBalance(from, delegateTo string, ownerKey *ecdsa.PrivateKey, resource core.ResourceCode, frozenBalance int64) (*api.TransactionExtention, error)
func (*TronChain) GetTrc10Balance ¶
func (*TronChain) GetTrc20Balance ¶
func (*TronChain) GetTrxBalance ¶
func (*TronChain) GetTrxTransaction ¶
func (e *TronChain) GetTrxTransaction(txhash string) (*core.TransactionInfo, error)
func (*TronChain) LatestBlockNumber ¶
获取最新区块高度
func (*TronChain) TransferTrc10 ¶
func (*TronChain) TransferTrc20 ¶
func (*TronChain) UnFreezeBalance ¶
func (e *TronChain) UnFreezeBalance(from, delegateTo string, ownerKey *ecdsa.PrivateKey, resource core.ResourceCode) (*api.TransactionExtention, error)
type Util ¶
type Util struct { }
func (*Util) DecodeAddressToPublicKey ¶
func (*Util) EncodePublicKeyToAddress ¶
func (*Util) IsValidAddress ¶
Check if address is 40 hexadecimal characters
Click to show internal directories.
Click to hide internal directories.