tron

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: MIT Imports: 7 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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
	DeployerSeed  string                                                   // Optional: mnemonic or raw seed

	// 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 = cld_common.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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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