Documentation
¶
Index ¶
- func CompileTronTransaction(inputData []byte, signatures [][]byte, publicKeys [][]byte) ([]byte, error)
- func CreateAndSignTronTransaction(input *tron.SigningInput, privateKey []byte) ([]byte, error)
- func DecodeBase58(data string) ([]byte, error)
- func DecodeBase64(data string) ([]byte, error)
- func EncodeBase58(data []byte) string
- func EncodeBase64(data []byte) string
- func FormatTRC20Amount(amount *big.Int) []byte
- func GetTronPreimageHash(preimageData []byte) ([]byte, []byte, error)
- func GetTronTransactionHash(encodedTx []byte) (string, error)
- func ParseTRC20Amount(data []byte) *big.Int
- func SignTronPreimage(preimage []byte, privateKey []byte) ([]byte, error)
- func SunToTRX(sun int64) float64
- func TRXToSun(trx float64) int64
- func ValidateTronTransactionInput(input interface{}) error
- type TronChain
- func (c *TronChain) BuildSigningInput(ownerAddress string, transfer *tron.TransferContract, ...) (*tron.SigningInput, error)
- func (c *TronChain) BuildSigningInputFromTokenTransferRequest(req *TronTokenTransferRequest) (*tron.SigningInput, error)
- func (c *TronChain) BuildSigningInputFromTransferRequest(req *TronTransferRequest) (*tron.SigningInput, error)
- func (c *TronChain) BuildTokenTransferTransaction(contractAddress string, toAddress string, amount []byte) *tron.TransferTRC20Contract
- func (c *TronChain) BuildTransferTransaction(toAddress string, amount int64, memo string) *tron.TransferContract
- func (c *TronChain) CompileTransaction(input *chain_abstraction.TransactionInput, signatures [][]byte, ...) ([]byte, error)
- func (c *TronChain) ConvertAmount(amount float64, toSun bool) int64
- func (c *TronChain) CreateAndSignTransaction(input interface{}, privateKey []byte) ([]byte, error)
- func (c *TronChain) GetPreimageHash(input *chain_abstraction.TransactionInput) ([]byte, []byte, error)
- func (c *TronChain) GetTransactionHash(encodedTx []byte) (string, error)
- func (c *TronChain) PrepareTransaction(input interface{}) (*chain_abstraction.TransactionInput, error)
- func (c *TronChain) Sign(preimage []byte, privateKey []byte) ([]byte, error)
- func (c *TronChain) ValidateTransactionInput(input interface{}) error
- type TronTokenTransferRequest
- type TronTransferRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompileTronTransaction ¶
func CompileTronTransaction(inputData []byte, signatures [][]byte, publicKeys [][]byte) ([]byte, error)
CompileTronTransaction compiles the transaction with signatures
func CreateAndSignTronTransaction ¶
func CreateAndSignTronTransaction(input *tron.SigningInput, privateKey []byte) ([]byte, error)
CreateAndSignTronTransaction creates and signs a transaction
func DecodeBase58 ¶
DecodeBase58 decodes a base58 string
func DecodeBase64 ¶
DecodeBase64 decodes a base64 string
func FormatTRC20Amount ¶
FormatTRC20Amount formats a uint256 amount for TRC20 transfers
func GetTronPreimageHash ¶
GetTronPreimageHash gets the preimage and hash for external signing
func GetTronTransactionHash ¶
GetTronTransactionHash calculates Tron transaction hash using SHA256
func ParseTRC20Amount ¶
ParseTRC20Amount parses a uint256 amount from TRC20 transfer data
func SignTronPreimage ¶
SignTronPreimage signs the preimage with the private key
func ValidateTronTransactionInput ¶
func ValidateTronTransactionInput(input interface{}) error
ValidateTronTransactionInput validates the transaction input
Types ¶
type TronChain ¶
type TronChain struct {
chain_abstraction.BaseChain
}
TronChain implements the Chain interface for Tron blockchain
func (*TronChain) BuildSigningInput ¶
func (c *TronChain) BuildSigningInput( ownerAddress string, transfer *tron.TransferContract, tokenTransfer *tron.TransferTRC20Contract, ) (*tron.SigningInput, error)
BuildSigningInput builds a signing input for the given transaction
func (*TronChain) BuildSigningInputFromTokenTransferRequest ¶
func (c *TronChain) BuildSigningInputFromTokenTransferRequest(req *TronTokenTransferRequest) (*tron.SigningInput, error)
BuildSigningInputFromTokenTransferRequest builds a signing input from a TRC20 token transfer request
func (*TronChain) BuildSigningInputFromTransferRequest ¶
func (c *TronChain) BuildSigningInputFromTransferRequest(req *TronTransferRequest) (*tron.SigningInput, error)
BuildSigningInputFromTransferRequest builds a signing input from a TRX transfer request
func (*TronChain) BuildTokenTransferTransaction ¶
func (c *TronChain) BuildTokenTransferTransaction( contractAddress string, toAddress string, amount []byte, ) *tron.TransferTRC20Contract
BuildTokenTransferTransaction builds a TRC20 token transfer transaction
func (*TronChain) BuildTransferTransaction ¶
func (c *TronChain) BuildTransferTransaction( toAddress string, amount int64, memo string, ) *tron.TransferContract
BuildTransferTransaction builds a TRX transfer transaction
func (*TronChain) CompileTransaction ¶
func (c *TronChain) CompileTransaction(input *chain_abstraction.TransactionInput, signatures [][]byte, publicKeys [][]byte) ([]byte, error)
CompileTransaction compiles the transaction with signatures
func (*TronChain) ConvertAmount ¶
ConvertAmount converts between TRX and sun (smallest unit)
func (*TronChain) CreateAndSignTransaction ¶
CreateAndSignTransaction creates and signs a transaction
func (*TronChain) GetPreimageHash ¶
func (c *TronChain) GetPreimageHash(input *chain_abstraction.TransactionInput) ([]byte, []byte, error)
GetPreimageHash gets the preimage and hash for external signing
func (*TronChain) GetTransactionHash ¶
GetTransactionHash calculates the transaction hash for Tron transactions
func (*TronChain) PrepareTransaction ¶
func (c *TronChain) PrepareTransaction(input interface{}) (*chain_abstraction.TransactionInput, error)
PrepareTransaction prepares a transaction for external signing
func (*TronChain) ValidateTransactionInput ¶
ValidateTransactionInput validates the transaction input
type TronTokenTransferRequest ¶
type TronTokenTransferRequest struct { FromAddress string `json:"from_address"` ToAddress string `json:"to_address"` ContractAddress string `json:"contract_address"` Amount float64 `json:"amount"` // Amount in token units Decimals int `json:"decimals"` // Token decimals }
TronTokenTransferRequest represents a TRC20 token transfer request