tron

package
v0.0.0-...-d4ead40 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: Apache-2.0, MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const TRANSFER_EVENT_HASH_HEX = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
View Source
const TX_TIMEOUT = 2 * time.Hour

Variables

This section is empty.

Functions

func CheckError

func CheckError(err error) errors.Status

func NewAddressBuilder

func NewAddressBuilder(cfgI *xc.ChainBaseConfig) (xc.AddressBuilder, error)

NewAddressBuilder creates a new Template AddressBuilder

func Signature

func Signature(method string) []byte

Signature of a method

Types

type AddressBuilder

type AddressBuilder struct {
}

AddressBuilder for Template

func (AddressBuilder) GetAddressFromPublicKey

func (ab AddressBuilder) GetAddressFromPublicKey(publicKeyBytes []byte) (xc.Address, error)

GetAddressFromPublicKey returns an Address given a public key

func (AddressBuilder) GetAllPossibleAddressesFromPublicKey

func (ab AddressBuilder) GetAllPossibleAddressesFromPublicKey(publicKeyBytes []byte) ([]xc.PossibleAddress, error)

GetAllPossibleAddressesFromPublicKey returns all PossubleAddress(es) given a public key

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client for Template

func NewClient

func NewClient(cfgI xc.ITask) (*Client, error)

NewClient returns a new Template Client

func (*Client) FetchBalance

func (client *Client) FetchBalance(ctx context.Context, args *xclient.BalanceArgs) (xc.AmountBlockchain, error)

func (*Client) FetchBlock

func (client *Client) FetchBlock(ctx context.Context, args *xclient.BlockArgs) (*xclient.BlockWithTransactions, error)

func (*Client) FetchDecimals

func (client *Client) FetchDecimals(ctx context.Context, contract xc.ContractAddress) (int, error)

func (*Client) FetchLegacyTxInfo

func (client *Client) FetchLegacyTxInfo(ctx context.Context, txHash xc.TxHash) (xc.LegacyTxInfo, error)

func (*Client) FetchLegacyTxInput

func (client *Client) FetchLegacyTxInput(ctx context.Context, from xc.Address, to xc.Address) (xc.TxInput, error)

func (*Client) FetchNativeBalance

func (client *Client) FetchNativeBalance(ctx context.Context, address xc.Address) (xc.AmountBlockchain, error)

func (*Client) FetchTransferInput

func (client *Client) FetchTransferInput(ctx context.Context, args xcbuilder.TransferArgs) (xc.TxInput, error)

func (*Client) FetchTxInfo

func (client *Client) FetchTxInfo(ctx context.Context, txHashStr xc.TxHash) (xclient.TxInfo, error)

func (*Client) SubmitTx

func (client *Client) SubmitTx(ctx context.Context, tx xc.Tx) error

SubmitTx submits a Tron tx

type Tx

type Tx struct {
	// contains filtered or unexported fields
}

Tx for Template

func (*Tx) AddSignatures

func (tx *Tx) AddSignatures(signatures ...xc.TxSignature) error

AddSignatures adds a signature to Tx

func (*Tx) GetSignatures

func (tx *Tx) GetSignatures() []xc.TxSignature

func (Tx) Hash

func (tx Tx) Hash() xc.TxHash

Hash returns the tx hash or id

func (Tx) Serialize

func (tx Tx) Serialize() ([]byte, error)

Serialize returns the serialized tx

func (Tx) Sighashes

func (tx Tx) Sighashes() ([]xc.TxDataToSign, error)

Sighashes returns the tx payload to sign, aka sighash

type TxBuilder

type TxBuilder struct {
	Asset *xc.ChainBaseConfig
}

TxBuilder for Template

func NewTxBuilder

func NewTxBuilder(cfgI *xc.ChainBaseConfig) (TxBuilder, error)

NewTxBuilder creates a new Template TxBuilder

func (TxBuilder) NewNativeTransfer

func (txBuilder TxBuilder) NewNativeTransfer(from xc.Address, to xc.Address, amount xc.AmountBlockchain, input xc.TxInput) (xc.Tx, error)

NewNativeTransfer creates a new transfer for a native asset

func (TxBuilder) NewTokenTransfer

func (txBuilder TxBuilder) NewTokenTransfer(from xc.Address, to xc.Address, amount xc.AmountBlockchain, contract xc.ContractAddress, input xc.TxInput) (xc.Tx, error)

NewTokenTransfer creates a new transfer for a token asset

func (TxBuilder) Transfer

func (txBuilder TxBuilder) Transfer(args xcbuilder.TransferArgs, input xc.TxInput) (xc.Tx, error)

NewTransfer creates a new transfer for an Asset, either native or token

type TxInput

type TxInput struct {
	xc.TxInputEnvelope

	// 6th to 8th (exclusive) byte of the reference block height
	RefBlockBytes []byte `json:"ref_block_bytes,omitempty"`
	// 8th to 16th (exclusive) byte of the reference block hash
	RefBlockHash []byte `json:"ref_block_hash,omitempty"`

	// Expiration time (seconds)
	Expiration int64 `json:"expiration,omitempty"`
	// Transaction creation time (seconds)
	Timestamp int64 `json:"timestamp,omitempty"`
	// Max fee budget
	MaxFee xc.AmountBlockchain `json:"max_fee,omitempty"`
}

TxInput for Template

func NewTxInput

func NewTxInput() *TxInput

func (*TxInput) GetDriver

func (input *TxInput) GetDriver() xc.Driver

func (*TxInput) GetFeeLimit

func (input *TxInput) GetFeeLimit() (xc.AmountBlockchain, xc.ContractAddress)

func (*TxInput) IndependentOf

func (input *TxInput) IndependentOf(other xc.TxInput) (independent bool)

func (*TxInput) SafeFromDoubleSend

func (input *TxInput) SafeFromDoubleSend(others ...xc.TxInput) (safe bool)

func (*TxInput) SetGasFeePriority

func (input *TxInput) SetGasFeePriority(other xc.GasFeePriority) error

func (*TxInput) SetUnix

func (input *TxInput) SetUnix(unix int64)

func (*TxInput) ToRawData

func (input *TxInput) ToRawData(contract *core.Transaction_Contract) *core.TransactionRaw

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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