Documentation
¶
Overview ¶
Package deploy provides a clean, composable interface for deploying subnets and blockchains to any Lux network endpoint.
Index ¶
- Variables
- func EWOQKeychain() *primary.KeychainAdapter
- func KeychainFromPrivateKey(key *secp256k1.PrivateKey) *primary.KeychainAdapter
- func KeychainFromPrivateKeyBytes(keyBytes []byte) (*primary.KeychainAdapter, error)
- func MustVMID(chainName string) ids.ID
- func VMID(chainName string) (ids.ID, error)
- type DeploySubnetResult
- type Deployer
- func (d *Deployer) AddValidator(ctx context.Context, subnetID ids.ID, nodeID ids.NodeID, weight uint64, ...) (ids.ID, error)
- func (d *Deployer) CreateBlockchain(ctx context.Context, subnetID ids.ID, genesis []byte, vmID ids.ID, name string) (ids.ID, error)
- func (d *Deployer) CreateSubnet(ctx context.Context, controlKeys []ids.ShortID, threshold uint32) (ids.ID, error)
- func (d *Deployer) DeploySubnet(ctx context.Context, genesis []byte, vmID ids.ID, chainName string, ...) (*DeploySubnetResult, error)
- func (d *Deployer) Endpoint() string
- func (d *Deployer) RemoveValidator(ctx context.Context, subnetID ids.ID, nodeID ids.NodeID) (ids.ID, error)
- type Option
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoEndpoint is returned when no endpoint is configured ErrNoEndpoint = errors.New("no endpoint configured") // ErrNoKeychain is returned when no keychain is configured ErrNoKeychain = errors.New("no keychain configured") // ErrInvalidThreshold is returned when threshold exceeds control key count ErrInvalidThreshold = errors.New("threshold cannot exceed number of control keys") )
var ( // SubnetEVMID is the VM ID for SubnetEVM/LuxEVM SubnetEVMID = ids.ID{'s', 'r', 'E', 'X', 'i', 'W', 'a', 'H', 'u', 'h', 'N', 'y', 'G', 'w', 'P', 'U', 'i', '4', '4', '4', 'T', 'u', '4', '7', 'Z', 'E', 'D', 'w', 'x', 'T', 'W', 'r'} // XSVMID is the example cross-subnet VM XSVMID ids.ID )
Well-known VM IDs
var EWOQKeyBytes = []byte{
0x56, 0x28, 0x9e, 0x99, 0xc9, 0x4b, 0x69, 0x12,
0xbf, 0xc1, 0x2a, 0xdc, 0x09, 0x3c, 0x9b, 0x51,
0x12, 0x4f, 0x0d, 0xc5, 0x4a, 0xc7, 0xa7, 0x66,
0xb2, 0xbc, 0x5c, 0xcf, 0x55, 0x8d, 0x80, 0x27,
}
EWOQKeyBytes are the genesis key bytes used in local networks
Functions ¶
func EWOQKeychain ¶
func EWOQKeychain() *primary.KeychainAdapter
EWOQKeychain returns a keychain containing the EWOQ (genesis) key. This is useful for local development and testing.
func KeychainFromPrivateKey ¶
func KeychainFromPrivateKey(key *secp256k1.PrivateKey) *primary.KeychainAdapter
KeychainFromPrivateKey creates a keychain adapter from a single private key. The returned adapter implements both wallet/keychain.Keychain and c.EthKeychain.
func KeychainFromPrivateKeyBytes ¶
func KeychainFromPrivateKeyBytes(keyBytes []byte) (*primary.KeychainAdapter, error)
KeychainFromPrivateKeyBytes creates a keychain adapter from private key bytes.
Types ¶
type DeploySubnetResult ¶
DeploySubnetResult contains the result of a full subnet deployment
type Deployer ¶
type Deployer struct {
// contains filtered or unexported fields
}
Deployer provides a clean interface for deploying subnets and blockchains. It wraps the node wallet functionality with a simpler, more composable API.
func (*Deployer) AddValidator ¶
func (d *Deployer) AddValidator( ctx context.Context, subnetID ids.ID, nodeID ids.NodeID, weight uint64, startTime time.Time, endTime time.Time, ) (ids.ID, error)
AddValidator adds a validator to a subnet.
func (*Deployer) CreateBlockchain ¶
func (d *Deployer) CreateBlockchain( ctx context.Context, subnetID ids.ID, genesis []byte, vmID ids.ID, name string, ) (ids.ID, error)
CreateBlockchain creates a new blockchain on the given subnet. Returns the blockchain ID on success.
func (*Deployer) CreateSubnet ¶
func (d *Deployer) CreateSubnet(ctx context.Context, controlKeys []ids.ShortID, threshold uint32) (ids.ID, error)
CreateSubnet creates a new subnet with the given control keys and threshold. Returns the subnet ID on success.
func (*Deployer) DeploySubnet ¶
func (d *Deployer) DeploySubnet( ctx context.Context, genesis []byte, vmID ids.ID, chainName string, controlKeys []ids.ShortID, threshold uint32, ) (*DeploySubnetResult, error)
DeploySubnet creates a subnet and blockchain in one operation. This is the most common deployment pattern.
type Option ¶
type Option func(*Deployer)
Option configures a Deployer
func WithKeychain ¶
func WithKeychain(kc *primary.KeychainAdapter) Option
WithKeychain sets the keychain adapter for signing transactions. Use KeychainFromPrivateKey or EWOQKeychain to create one.
func WithTimeout ¶
WithTimeout sets the operation timeout