Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddressToBytes ¶ added in v0.44.0
AddressToBytes converts a Tron address string to bytes. Tron addresses can be in base58 format (like "TLyqzVGLV1srkB7dToTAEqgDSfPtXRJZYH").
Types ¶
type AddressConverter ¶ added in v0.44.0
type AddressConverter struct{}
AddressConverter implements address conversion for Tron chains. This struct implements the AddressConverter strategy interface.
func (AddressConverter) ConvertToBytes ¶ added in v0.44.0
func (t AddressConverter) ConvertToBytes(address string) ([]byte, error)
ConvertToBytes converts a Tron address string to bytes.
func (AddressConverter) Supports ¶ added in v0.44.0
func (t AddressConverter) Supports(family string) bool
Supports returns true if this converter supports the given chain family.
type Chain ¶
type Chain struct { ChainMetadata // Chain selector and metadata Client sdk.CombinedClient // Combined client for Tron operations SignHash func(ctx context.Context, txHash []byte) ([]byte, error) // Function for signing transaction hashes Address address.Address // Address of the account used for transactions URL string // Optional: Client URL // SendAndConfirm provides a utility function to send a transaction and waits for confirmation. SendAndConfirm func(ctx context.Context, tx *common.Transaction, opts *ConfirmRetryOptions) (*soliditynode.TransactionInfo, error) // DeployContractAndConfirm provides a utility function to deploy a contract and waits for confirmation. DeployContractAndConfirm func( ctx context.Context, contractName string, abi string, bytecode string, params []interface{}, opts *DeployOptions, ) (address.Address, *soliditynode.TransactionInfo, error) // TriggerContractAndConfim provides a utility function to send a contract transaction and waits for confirmation. TriggerContractAndConfirm func( ctx context.Context, contractAddr address.Address, functionName string, params []interface{}, opts *TriggerOptions, ) (*soliditynode.TransactionInfo, error) }
Chain represents a Tron chain
type ChainMetadata ¶
type ChainMetadata = chaincommon.ChainMetadata
ChainMetadata = generic metadata from the framework
type ConfirmRetryOptions ¶
type ConfirmRetryOptions struct { RetryAttempts uint // Max number of retries for confirming a transaction. RetryDelay time.Duration // Delay between retries for confirming a transaction. }
func DefaultConfirmRetryOptions ¶
func DefaultConfirmRetryOptions() *ConfirmRetryOptions
DefaultConfirmRetryOptions returns standard retry options used across contract deployment and invocation. Defaults to 180 retries with a 500ms delay between each attempt.
type DeployOptions ¶
type DeployOptions struct { OeLimit int // Max energy the creator is willing to provide during execution. CurPercent int // Percentage of resource consumption charged to the contract caller (0–100). FeeLimit int // Max TRX to be used for deploying the contract (gas limit in Tron terms). ConfirmRetryOptions *ConfirmRetryOptions // Retry options for confirming the transaction. }
DeployOptions defines optional parameters for deploying a smart contract.
func DefaultDeployOptions ¶
func DefaultDeployOptions() *DeployOptions
DefaultDeployOptions returns default options used when deploying a contract. It includes a high fee and energy limit suitable for development/testing, and standard retry behavior.
type TriggerOptions ¶
type TriggerOptions struct { FeeLimit int32 // Max TRX to be used for this transaction call. TAmount int64 // Amount of TRX to transfer along with the contract call (like msg.value). ConfirmRetryOptions *ConfirmRetryOptions // Retry options for confirming the transaction. }
TriggerOptions defines optional parameters for triggering (calling) a smart contract.
func DefaultTriggerOptions ¶
func DefaultTriggerOptions() *TriggerOptions
DefaultTriggerOptions returns default options for calling smart contract methods. These defaults ensure calls succeed on local/dev environments without TRX transfer.