provider

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountGenCTFDefault

func AccountGenCTFDefault() *accountGenCTFDefault

AccountGenCTFDefault creates a new instance of accountGenCTFDefault. It uses the default Aptos account and private key from the blockchain package.

func AccountGenNewSingleSender

func AccountGenNewSingleSender() *accountGenNewSingleSender

AccountGenNewSingleSender creates a new instance of accountGenNewSingleSender.

func AccountGenPrivateKey

func AccountGenPrivateKey(privateKey string) *accountGenPrivateKey

AccountGenPrivateKey creates a new instance of accountGenPrivateKey with the provided private key.

Types

type AccountGenerator

type AccountGenerator interface {
	Generate() (*aptoslib.Account, error)
}

AccountGenerator is an interface for generating Aptos accounts.

type CTFChainProvider

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

CTFChainProvider manages an Aptos 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.

func (*CTFChainProvider) BlockChain

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

BlockChain returns the Aptos 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 Aptos chain managed by this provider.

func (*CTFChainProvider) Initialize

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

Initialize sets up the Aptos chain by validating the configuration, starting a CTF container, generating a deployer signer 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 account. Use AccountGenCTFDefault to
	// create a deployer signer from the default CTF account. Alternatively, you can use
	// AccountGenNewSingleSender to create a new single sender account.
	DeployerSignerGen AccountGenerator

	// 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 is a chain provider that provides a chain that connects to an Aptos node via RPC.

func NewRPCChainProvider

func NewRPCChainProvider(selector uint64, config RPCChainProviderConfig) *RPCChainProvider

NewRPCChainProvider creates a new RPCChainProvider with the given selector and configuration.

func (*RPCChainProvider) BlockChain

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

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

func (*RPCChainProvider) ChainSelector

func (p *RPCChainProvider) ChainSelector() uint64

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

func (*RPCChainProvider) Initialize

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

Initialize initializes the RPCChainProvider, validating the configuration and setting up the Aptos chain client.

func (*RPCChainProvider) Name

func (*RPCChainProvider) Name() string

Name returns the name of the RPCChainProvider.

type RPCChainProviderConfig

type RPCChainProviderConfig struct {
	// Required: The RPC URL to connect to the Aptos node
	RPCURL string
	// Required: A generator for the deployer signer account. Use AccountGenPrivateKey to
	// create a deployer signer from a private key.
	DeployerSignerGen AccountGenerator
}

RPCChainProviderConfig holds the configuration to initialize the RPCChainProvider.

Jump to

Keyboard shortcuts

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