deployment

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeSACContractID

func ComputeSACContractID(networkPassphrase string, asset xdr.Asset) (string, error)

ComputeSACContractID returns the deterministic contract address (C… strkey) for a Soroban Asset Contract wrapping the given classic Stellar asset.

func GenerateDeterministicSalt

func GenerateDeterministicSalt(deployerAddress, contractName string) [32]byte

GenerateDeterministicSalt generates a deterministic salt for contract deployment.

Types

type Deployer

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

Deployer handles Soroban contract deployment and initialization.

func NewDeployer

func NewDeployer(rpcClient *rpcclient.Client, networkPassphrase string, signer *keypair.Full, opts ...DeployerOption) *Deployer

NewDeployer creates a new Deployer instance. Options can be passed to customise behaviour (e.g. WithAutoRestore(false) to disable automatic restoration of expired persistent entries).

The signer argument is a *keypair.Full to preserve compatibility with the majority of call sites (tests, dev tooling, deployment changesets) that already hold a raw seed. For keystore-backed signing in production binaries use NewDeployerWithSigner.

func NewDeployerFromChain

func NewDeployerFromChain(ch cldfstellar.Chain, opts ...DeployerOption) (*Deployer, error)

NewDeployerFromChain creates a Deployer directly from a CLDF Stellar chain, using the chain's Signer, Client, and NetworkPassphrase.

When the chain signer exposes a non-nil keypair.Full via KeypairFull(), the deployer uses NewKeypairSigner (same path as NewDeployer). When KeypairFull is nil (e.g. keystore-backed signers that only implement SignDecorated), the deployer uses NewSDKSigner with NewDeployerWithSigner so raw key material is not required.

func NewDeployerWithSigner

func NewDeployerWithSigner(rpcClient *rpcclient.Client, networkPassphrase string, signer TxSigner, opts ...DeployerOption) *Deployer

NewDeployerWithSigner is like NewDeployer but accepts an arbitrary TxSigner, allowing the caller to back the deployer with a keystore-managed key whose raw bytes are never exposed. Used by ccv/accessors when the bootstrapper keystore provides the Stellar transmitter / deployer Ed25519 key.

func (*Deployer) DeployContract

func (d *Deployer) DeployContract(ctx context.Context, wasmPath string, salt [32]byte) (string, error)

DeployContract deploys a Soroban contract from a WASM file and returns the contract ID. This performs two operations: 1. Upload the WASM code (installContractCode) 2. Deploy a contract instance (createContract)

func (*Deployer) DeploySACToken

func (d *Deployer) DeploySACToken(ctx context.Context, asset xdr.Asset) (string, error)

DeploySACToken deploys a Soroban Asset Contract (SAC) wrapper for a classic Stellar asset and returns the resulting contract ID (C… strkey). The contract address is deterministic based on the network passphrase and asset.

func (*Deployer) GetEvents

func (d *Deployer) GetEvents(ctx context.Context, contractID string, startLedger uint32, topics []string) ([]protocolrpc.EventInfo, error)

GetEvents returns events from a ledger range.

func (*Deployer) InvokeContract

func (d *Deployer) InvokeContract(ctx context.Context, contractID string, functionName string, args []xdr.ScVal) (*xdr.ScVal, error)

InvokeContract invokes a contract function and returns the result.

func (*Deployer) NativeAccountState

func (d *Deployer) NativeAccountState(ctx context.Context, rawAccountKey []byte) (balance *big.Int, seq uint64, exists bool, err error)

NativeAccountState returns the account native balance (stroops) and sequence number from the ledger. rawAccountKey must be the 32-byte Ed25519 public key (Stellar account id).

func (*Deployer) SendNativePayment

func (d *Deployer) SendNativePayment(ctx context.Context, destinationStrkey string, stroops int64) error

SendNativePayment submits a payment of stroops native XLM from the deployer's account.

func (*Deployer) SignerAddress

func (d *Deployer) SignerAddress() string

SignerAddress returns the G… strkey of the deployer's signing keypair.

func (*Deployer) SimulateContract

func (d *Deployer) SimulateContract(ctx context.Context, contractID string, functionName string, args []xdr.ScVal) (*xdr.ScVal, error)

SimulateContract simulates a contract invocation without submitting.

func (*Deployer) SubmitClassicOperation

func (d *Deployer) SubmitClassicOperation(ctx context.Context, op txnbuild.Operation) error

SubmitClassicOperation builds, signs, and submits a single classic Stellar operation (e.g. ChangeTrust, Payment) via the Soroban RPC. Classic operations cannot be simulated through the Soroban RPC, so this method bypasses simulation and submits the transaction directly.

type DeployerOption

type DeployerOption func(*Deployer)

DeployerOption configures optional Deployer behaviour.

func WithAutoRestore

func WithAutoRestore(enabled bool) DeployerOption

WithAutoRestore controls whether the Deployer automatically submits a RestoreFootprint transaction when simulation indicates that persistent ledger entries have expired. Enabled by default.

func WithFeeBumpFactor

func WithFeeBumpFactor(factor float64) DeployerOption

WithFeeBumpFactor sets the multiplier applied to the simulation's MinResourceFee to derive the submitted transaction fee. For example, 1.25 submits at 25% above the simulated minimum, providing headroom during network fee surges. A floor of minFeeBuffer (10 000 stroops) is always applied on top of the simulation minimum. Non-finite values and values below 1.0 are clamped to 1.0 (no bump).

func WithTxnTimeBound

func WithTxnTimeBound(d time.Duration) DeployerOption

WithTxnTimeBound sets the validity window for every transaction submitted by the Deployer. The same duration is used as the transaction's MaxTime and as the confirmation poll timeout, keeping them in sync. Durations of zero or below are ignored and the default (120s) is kept.

type TxSigner

type TxSigner interface {
	// Address returns the Stellar account strkey (G...) of the signer.
	Address() string
	// SignTransaction signs the given transaction for the given network passphrase
	// and returns a new transaction with the signature appended.
	SignTransaction(networkPassphrase string, tx *txnbuild.Transaction) (*txnbuild.Transaction, error)
}

TxSigner abstracts transaction signing so the Deployer can use either an in-process *keypair.Full (test paths) or a remote keystore-backed signer that never exposes raw key material (production / chainlink-ccv keystore).

Implementations MUST NOT mutate the input transaction; they should clone it and return the signed clone, mirroring (*txnbuild.Transaction).Sign.

func NewKeypairSigner

func NewKeypairSigner(kp *keypair.Full) TxSigner

NewKeypairSigner returns a TxSigner backed by the given Stellar keypair. The keypair MUST be non-nil; the caller is responsible for safe handling of the underlying private seed.

func NewSDKSigner

func NewSDKSigner(sdk stellarSDKSigner) TxSigner

NewSDKSigner wraps a Stellar SDK-shaped signer (any value providing Address() and SignDecorated()) as a deployment.TxSigner. Returns nil if sdk is nil so callers can fall back to a different signer source.

Directories

Path Synopsis
Package adapters registers Stellar with chainlink-ccip CCIP 2.0 tooling (v2_0_0 adapter registries), chainlink-ccv/deployment/adapters for service-config changesets, and shared infrastructure (MCMS, transfer ownership, token pools, fees, RMN curse).
Package adapters registers Stellar with chainlink-ccip CCIP 2.0 tooling (v2_0_0 adapter registries), chainlink-ccv/deployment/adapters for service-config changesets, and shared infrastructure (MCMS, transfer ownership, token pools, fees, RMN curse).
Package ccip holds Stellar CCIP deployment helpers: datastore contract types, lane/onramp config, topology conversion, the CCIPDevenvHost surface for Soroban devenv, post-deploy token pool (DeployLockReleaseTestTokenPool), CLDF-backed devenv host (NewCLDFStellarCCIPDevenvHost), and stellarutil/.
Package ccip holds Stellar CCIP deployment helpers: datastore contract types, lane/onramp config, topology conversion, the CCIPDevenvHost surface for Soroban devenv, post-deploy token pool (DeployLockReleaseTestTokenPool), CLDF-backed devenv host (NewCLDFStellarCCIPDevenvHost), and stellarutil/.
Package operations hosts CLDF-style deployment operations for Stellar Soroban contracts (thin wrappers around generated bindings plus chain I/O).
Package operations hosts CLDF-style deployment operations for Stellar Soroban contracts (thin wrappers around generated bindings plus chain I/O).
lock_release_pool
Package lock_release_pool defines CLDF operations for the Soroban lock-release pool contract.
Package lock_release_pool defines CLDF operations for the Soroban lock-release pool contract.
offramp
Package offramp defines CLDF operations for the Soroban OffRamp contract.
Package offramp defines CLDF operations for the Soroban OffRamp contract.
Package sequences defines CLDF deployment sequences for Stellar CCIP.
Package sequences defines CLDF deployment sequences for Stellar CCIP.

Jump to

Keyboard shortcuts

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