provider

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: MIT Imports: 29 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignerGenCTFDefault added in v0.25.0

func SignerGenCTFDefault() (*signerGenCTFDefault, error)

SignerGenCTFDefault creates a new instance of signerGenCTFDefault. It uses the default TRON account and private key from the blockchain package.

func SignerGenKMS added in v0.25.0

func SignerGenKMS(keyID, keyRegion, awsProfile string) (*signerGenKMS, error)

func SignerGenPrivateKey added in v0.25.0

func SignerGenPrivateKey(privateKey string) (*signerGenPrivateKey, error)

SignerGenPrivateKey creates a new instance of signerGenPrivateKey with the provided private key.

func SignerRandom added in v0.25.0

func SignerRandom() (*signerRandom, error)

SignerRandom creates a new instance of the signerRandom generator.

Types

type CTFChainProvider

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

CTFChainProvider manages a TRON chain instance running inside a Chainlink Testing Framework (CTF) Docker container.

This provider requires Docker to be installed and operational. Spinning up a new container can be slow, so it is recommended to initialize the provider only once per test suite or parent test to optimize performance.

func NewCTFChainProvider

func NewCTFChainProvider(
	t *testing.T, selector uint64, config CTFChainProviderConfig,
) *CTFChainProvider

NewCTFChainProvider creates a new CTFChainProvider with the given selector and configuration. The actual connection is deferred until Initialize is called.

func (*CTFChainProvider) BlockChain

func (p *CTFChainProvider) BlockChain() chain.BlockChain

BlockChain returns the TRON chain instance managed by this provider. You must call Initialize before using this method to ensure the chain is properly set up.

func (*CTFChainProvider) ChainSelector

func (p *CTFChainProvider) ChainSelector() uint64

ChainSelector returns the chain selector of the TRON chain managed by this provider.

func (*CTFChainProvider) Initialize

func (p *CTFChainProvider) Initialize(_ context.Context) (chain.BlockChain, error)

Initialize sets up the TRON chain by validating the configuration, starting a CTF container, generating a deployer account, and constructing the chain instance.

func (*CTFChainProvider) Name

func (*CTFChainProvider) Name() string

Name returns the name of the CTFChainProvider.

type CTFChainProviderConfig

type CTFChainProviderConfig struct {
	// Required: A generator for the deployer signer. Use SignerGenCTFDefault to
	// create a deployer signer from the default CTF account. Alternatively, you can use
	// SignerRandom to create a new random signer.
	DeployerSignerGen SignerGenerator

	// Required: A sync.Once instance to ensure that the CTF framework only sets up the new
	// DefaultNetwork once
	Once *sync.Once
}

CTFChainProviderConfig holds the configuration to initialize the CTFChainProvider.

type RPCChainProvider

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

RPCChainProvider implements the Chainlink `chain.Provider` interface for interacting with a Tron blockchain using RPC. It encapsulates configuration and connection details needed to interact with a live or local Tron node.

func NewRPCChainProvider

func NewRPCChainProvider(selector uint64, config RPCChainProviderConfig) *RPCChainProvider

NewRPCChainProvider creates a new Tron RPC provider instance with the given chain selector and configuration. The actual connection is deferred until Initialize is called.

func (*RPCChainProvider) BlockChain

func (p *RPCChainProvider) BlockChain() chain.BlockChain

BlockChain returns the initialized Tron chain instance.

func (*RPCChainProvider) ChainSelector

func (p *RPCChainProvider) ChainSelector() uint64

ChainSelector returns the chain selector value used to identify this chain.

func (*RPCChainProvider) Initialize

func (p *RPCChainProvider) Initialize(ctx context.Context) (chain.BlockChain, error)

Initialize sets up the Tron chain provider and returns a Chain instance. It connects to the configured full and solidity nodes, initializes the keystore, and wires up helper methods.

func (*RPCChainProvider) Name

func (p *RPCChainProvider) Name() string

Name returns the name of the provider.

type RPCChainProviderConfig

type RPCChainProviderConfig struct {
	FullNodeURL       string          // URL of the full node.
	SolidityNodeURL   string          // URL of the solidity node.
	DeployerSignerGen SignerGenerator // Generator used to create the deployer's signer and address.
}

RPCChainProviderConfig holds the configuration required to initialize a Tron RPC chain provider.

type SignerGenerator added in v0.25.0

type SignerGenerator interface {
	// Sign signs the given transaction hash and returns the signature bytes.
	Sign(ctx context.Context, txHash []byte) ([]byte, error)
	// GetAddress returns the TRON address associated with this signer generator.
	GetAddress() (address.Address, error)
}

SignerGenerator is an interface for signing TRON transactions.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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