Documentation
¶
Index ¶
- Constants
- func AddressToBytes(address string) ([]byte, error)
- type AddressConverter
- type Chain
- func (c Chain) ChainSelector() uint64
- func (c Chain) CloseBuffers(logger logger.Logger, buffer string) error
- func (c Chain) DeployProgram(logger logger.Logger, programInfo ProgramInfo, isUpgrade bool, ...) (string, error)
- func (c Chain) Deployer() Signer
- func (c Chain) Family() string
- func (c Chain) GetAccountDataBorshInto(ctx context.Context, pubkey sollib.PublicKey, accountState interface{}) error
- func (c Chain) IsNetworkType(networkType chainsel.NetworkType) bool
- func (c Chain) Name() string
- func (c Chain) NetworkType() (chainsel.NetworkType, error)
- func (c Chain) ReadOnly() (chaincommon.BlockChain, error)
- func (c Chain) String() string
- type KMSSigner
- type ProgramInfo
- type Signer
Constants ¶
const ( ProgramIDPrefix = "Program Id: " BufferIDPrefix = "Buffer: " SolDefaultCommitment = solrpc.CommitmentConfirmed )
Variables ¶
This section is empty.
Functions ¶
func AddressToBytes ¶ added in v0.44.0
AddressToBytes converts a Solana address string to bytes. Solana addresses are base58-encoded public keys (32 bytes).
Types ¶
type AddressConverter ¶ added in v0.44.0
type AddressConverter struct{}
AddressConverter implements address conversion for Solana chains. This struct implements the AddressConverter strategy interface.
func (AddressConverter) ConvertToBytes ¶ added in v0.44.0
func (s AddressConverter) ConvertToBytes(address string) ([]byte, error)
ConvertToBytes converts a Solana address string to bytes.
func (AddressConverter) Supports ¶ added in v0.44.0
func (s AddressConverter) Supports(family string) bool
Supports returns true if this converter supports the given chain family.
type Chain ¶
type Chain struct {
Selector uint64
// RPC client
Client *solrpc.Client
URL string
WSURL string
// DeployerKey is the deployer's raw private key. It is nil when the deployer signs remotely
// (e.g. with AWS KMS). Prefer Deployer(), which works in both cases.
DeployerKey *sollib.PrivateKey
// DeployerSigner signs transactions on behalf of the deployer. If DeployerKey is nil, the
// keypair at KeypairPath (if any) is a separate key used only by the Solana CLI.
DeployerSigner Signer
// SendAndConfim provides a utility function to send a transaction and waits for confirmation.
// Options can be passed to modify the transaction such as setting additional signers or
// modifying compute unit limits.
SendAndConfirm func(
ctx context.Context, instructions []sollib.Instruction, opts ...rpcclient.TxModifier,
) error
// Legacy: Use SendAndConfirm instead. This function will be removed in the future.
// Confirm is a legacy function that sends a transaction and waits for confirmation.
Confirm func(instructions []sollib.Instruction, opts ...solCommonUtil.TxModifier) error
// deploy uses the solana CLI which needs a keyfile
KeypairPath string
ProgramsPath string
}
Chain represents a Solana chain.
func (Chain) ChainSelector ¶
ChainSelector returns the chain selector of the chain
func (Chain) DeployProgram ¶
func (c Chain) DeployProgram(logger logger.Logger, programInfo ProgramInfo, isUpgrade bool, overallocate bool) (string, error)
Overallocate should be set when deploying any program that may eventually be owned by timelock Overallocate is mutually exclusive with isUpgrade
func (Chain) Deployer ¶ added in v0.128.0
Deployer returns the signer for the deployer account, or nil if the chain has no deployer.
func (Chain) GetAccountDataBorshInto ¶
func (Chain) IsNetworkType ¶ added in v0.78.0
func (c Chain) IsNetworkType(networkType chainsel.NetworkType) bool
IsNetworkType checks if the chain is on the given network type
func (Chain) NetworkType ¶ added in v0.78.0
func (c Chain) NetworkType() (chainsel.NetworkType, error)
NetworkType returns the type of network the chain is on (e.g. mainnet, testnet)
func (Chain) ReadOnly ¶ added in v0.100.0
func (c Chain) ReadOnly() (chaincommon.BlockChain, error)
type KMSSigner ¶ added in v0.128.0
type KMSSigner struct {
// contains filtered or unexported fields
}
KMSSigner signs Solana transactions with an Ed25519 key held in AWS KMS. The private key never leaves KMS.
func NewKMSSigner ¶ added in v0.128.0
NewKMSSigner builds a Signer backed by an AWS KMS Ed25519 key. The ctx is only used to fetch the public key and is not retained.
type ProgramInfo ¶
ProgramInfo contains information about a Solana program.
type Signer ¶ added in v0.128.0
Signer signs Solana transaction messages on behalf of a single account.
func NewPrivateKeySigner ¶ added in v0.128.0
func NewPrivateKeySigner(key sollib.PrivateKey) Signer
NewPrivateKeySigner returns a Signer backed by a local private key.