solana

package
v1.9.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MaxSupportedTxVersion = 0
)

Functions

This section is empty.

Types

type Client

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

func (Client) FetchIDL

func (cl Client) FetchIDL(ctx context.Context, progID string, idlPtr interface{}) error

func (Client) GetAccountInfo

func (cl Client) GetAccountInfo(ctx context.Context, acAddr solana.PublicKey, accPtr interface{}) error

func (Client) GetAccountInfoRaw

func (cl Client) GetAccountInfoRaw(ctx context.Context, addr solana.PublicKey) (*solrpc.Account, error)

func (Client) GetBalance

func (cl Client) GetBalance(ctx context.Context, accAddr solana.PublicKey) (*solrpc.GetBalanceResult, error)

func (Client) GetBlock

func (cl Client) GetBlock(ctx context.Context, slot uint64) (*solrpc.GetBlockResult, error)

func (Client) GetLatestBlockHash

func (cl Client) GetLatestBlockHash(ctx context.Context) (*solana.Hash, error)

func (Client) GetLatestBlockHeight

func (cl Client) GetLatestBlockHeight(ctx context.Context, ctype solrpc.CommitmentType) (uint64, error)

func (Client) GetLatestSlot

func (cl Client) GetLatestSlot(ctx context.Context, ctype solrpc.CommitmentType) (uint64, error)

func (Client) GetMinBalanceForRentExemption

func (cl Client) GetMinBalanceForRentExemption(
	ctx context.Context,
	dataSize uint64,
) (uint64, error)

func (Client) GetRecentPriorityFee added in v1.9.0

func (cl Client) GetRecentPriorityFee(
	ctx context.Context,
	accounts solana.PublicKeySlice,
) (uint64, error)

func (Client) GetSignatureStatus

func (cl Client) GetSignatureStatus(
	ctx context.Context,
	searchTxHistory bool,
	sign solana.Signature,
) (*solrpc.SignatureStatusesResult, error)

func (Client) GetSignaturesForAddress

func (cl Client) GetSignaturesForAddress(
	ctx context.Context,
	account solana.PublicKey,
	opts *solrpc.GetSignaturesForAddressOpts,
) ([]*solrpc.TransactionSignature, error)

func (Client) GetTransaction

func (cl Client) GetTransaction(
	ctx context.Context,
	signature solana.Signature,
	opts *solrpc.GetTransactionOpts,
) (*solrpc.GetTransactionResult, error)

func (Client) SendTx

func (cl Client) SendTx(
	ctx context.Context,
	tx *solana.Transaction,
) (solana.Signature, error)

func (Client) SimulateTx

func (cl Client) SimulateTx(
	ctx context.Context,
	tx *solana.Transaction,
) (*solrpc.SimulateTransactionResult, error)

type Config

type Config struct {
	Disabled  bool   `yaml:"disabled" json:"disabled"`
	ChainName string `yaml:"-"`

	RPCUrl  string `yaml:"rpc-url" json:"rpc-url"`
	Address string `yaml:"address" json:"address"`

	XcallProgram string `yaml:"xcall-program" json:"xcall-program"`

	ConnectionProgram string   `yaml:"connection-program" json:"connection-program"`
	OtherConnections  []string `yaml:"other-connections" json:"other-connections"`

	Dapps []types.Dapp `yaml:"dapps" json:"dapps"`

	CpNIDs []string `yaml:"cp-nids" json:"cp-nids"` //counter party NIDs Eg: ["0x2.icon", "0x7.icon"]

	AltAddress string `yaml:"alt-address" json:"alt-address"` // address lookup table address

	NID         string `yaml:"nid" json:"nid"`
	HomeDir     string `yaml:"home-dir" json:"home-dir"`
	StartTxSign string `yaml:"start-tx-sign" json:"start-tx-sign"`

	TxConfirmationTime time.Duration `yaml:"tx-confirmation-time" json:"tx-confirmation-time"`

	ComputeUnitLimit uint64 `yaml:"compute-unit-limit" json:"compute-unit-limit"`
}

func (*Config) ContractsAddress added in v1.9.0

func (pc *Config) ContractsAddress() relayertypes.ContractConfigMap

func (*Config) Enabled

func (pc *Config) Enabled() bool

func (*Config) GetWallet

func (pc *Config) GetWallet() string

func (*Config) NewProvider

func (pc *Config) NewProvider(ctx context.Context, logger *zap.Logger, homePath string, debug bool, chainName string) (provider.ChainProvider, error)

func (*Config) SetWallet

func (pc *Config) SetWallet(addr string)

func (*Config) Validate

func (pc *Config) Validate() error

type IClient

type IClient interface {
	GetLatestBlockHeight(ctx context.Context, ctype solrpc.CommitmentType) (uint64, error)
	GetLatestSlot(ctx context.Context, ctype solrpc.CommitmentType) (uint64, error)
	GetLatestBlockHash(ctx context.Context) (*solana.Hash, error)
	GetBlock(ctx context.Context, slot uint64) (*solrpc.GetBlockResult, error)

	GetAccountInfoRaw(ctx context.Context, addr solana.PublicKey) (*solrpc.Account, error)
	GetAccountInfo(ctx context.Context, acAddr solana.PublicKey, accPtr interface{}) error

	GetBalance(ctx context.Context, accAddr solana.PublicKey) (*solrpc.GetBalanceResult, error)

	FetchIDL(ctx context.Context, idlAddress string, idlPtr interface{}) error

	GetSignatureStatus(
		ctx context.Context,
		searchTxHistory bool,
		sign solana.Signature,
	) (*solrpc.SignatureStatusesResult, error)

	GetMinBalanceForRentExemption(
		ctx context.Context,
		dataSize uint64,
	) (uint64, error)

	SimulateTx(
		ctx context.Context,
		tx *solana.Transaction,
	) (*solrpc.SimulateTransactionResult, error)

	SendTx(
		ctx context.Context,
		tx *solana.Transaction,
	) (solana.Signature, error)

	GetSignaturesForAddress(
		ctx context.Context,
		account solana.PublicKey,
		opts *solrpc.GetSignaturesForAddressOpts,
	) ([]*solrpc.TransactionSignature, error)

	GetTransaction(
		ctx context.Context,
		signature solana.Signature,
		opts *solrpc.GetTransactionOpts,
	) (*solrpc.GetTransactionResult, error)

	GetRecentPriorityFee(
		ctx context.Context,
		accounts solana.PublicKeySlice,
	) (uint64, error)
}

func NewClient

func NewClient(rpcCl *solrpc.Client) IClient

type IDL

type IDL struct {
	Address      string           `json:"address"`
	Metadata     IdlMetadata      `json:"metadata"`
	Instructions []IdlInstruction `json:"instructions"`
	Accounts     []IdlAccount     `json:"accounts"`
	Events       []IdlEvent       `json:"events"`
}

func (*IDL) GetInstructionDiscriminator

func (idl *IDL) GetInstructionDiscriminator(name string) ([]byte, error)

func (*IDL) GetProgramID

func (idl *IDL) GetProgramID() solana.PublicKey

type IdlAccount

type IdlAccount struct {
	Name          string `json:"name"`
	Address       string `json:"address"`
	Writable      bool   `json:"writeable"`
	Signer        bool   `json:"signer"`
	Discriminator []byte `json:"discriminator"`
}

type IdlEvent

type IdlEvent struct {
	Name          string `json:"name"`
	Discriminator []byte `json:"discriminator"`
}

type IdlField

type IdlField struct {
	Name string      `json:"name"`
	Type interface{} `json:"type"`
}

type IdlInstruction

type IdlInstruction struct {
	Name          string       `json:"name"`
	Discriminator []byte       `json:"discriminator"`
	Accounts      []IdlAccount `json:"accounts"`
	Args          []IdlField   `json:"args"`
}

type IdlMetadata

type IdlMetadata struct {
	Name        string `json:"name"`
	Version     string `json:"version"`
	Spec        string `json:"spec"`
	Description string `json:"description"`
}

type Provider

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

func (*Provider) ClaimFee

func (p *Provider) ClaimFee(ctx context.Context) error

func (*Provider) Config

func (p *Provider) Config() provider.Config

func (*Provider) FetchTxMessages added in v1.9.0

func (p *Provider) FetchTxMessages(ctx context.Context, txHash string) ([]*relayertypes.Message, error)

func (*Provider) FinalityBlock

func (p *Provider) FinalityBlock(ctx context.Context) uint64

FinalityBlock returns the number of blocks the chain has to advance from current block inorder to consider it as final. In Solana blocks once published are final. So Solana doesn't need to be checked for block finality.

func (*Provider) GenerateMessages

func (p *Provider) GenerateMessages(ctx context.Context, fromHeight, toHeight uint64) ([]*relayertypes.Message, error)

func (*Provider) GetFee

func (p *Provider) GetFee(ctx context.Context, networkID string, responseFee bool) (uint64, error)

func (*Provider) ImportKeystore

func (p *Provider) ImportKeystore(ctx context.Context, keyPath, passphrase string) (string, error)

func (*Provider) Init

func (p *Provider) Init(ctx context.Context, homePath string, kms kms.KMS) error

func (*Provider) Listener

func (p *Provider) Listener(ctx context.Context, lastProcessedTx relayertypes.LastProcessedTx, blockInfo chan *relayertypes.BlockInfo) error

func (*Provider) MessageReceived

func (p *Provider) MessageReceived(ctx context.Context, key *relayertypes.MessageKey) (bool, error)

func (*Provider) NID

func (p *Provider) NID() string

func (*Provider) Name

func (p *Provider) Name() string

func (*Provider) NewKeystore

func (p *Provider) NewKeystore(password string) (string, error)

func (*Provider) QueryBalance

func (p *Provider) QueryBalance(ctx context.Context, addr string) (*relayertypes.Coin, error)

func (*Provider) QueryLatestHeight

func (p *Provider) QueryLatestHeight(ctx context.Context) (uint64, error)

func (*Provider) QueryTransactionReceipt

func (p *Provider) QueryTransactionReceipt(ctx context.Context, txSign string) (*relayertypes.Receipt, error)

func (*Provider) RestoreKeystore

func (p *Provider) RestoreKeystore(ctx context.Context) error

func (*Provider) RevertMessage

func (p *Provider) RevertMessage(ctx context.Context, sn *big.Int) error

func (*Provider) Route

func (p *Provider) Route(ctx context.Context, message *relayertypes.Message, callback relayertypes.TxResponseFunc) error

func (*Provider) SetAdmin

func (p *Provider) SetAdmin(ctx context.Context, adminAddr string) error

SetAdmin transfers the ownership of solana connection module to new address

func (*Provider) SetFee

func (p *Provider) SetFee(ctx context.Context, networkID string, msgFee, resFee *big.Int) error

func (*Provider) SetLastSavedHeightFunc

func (p *Provider) SetLastSavedHeightFunc(f func() uint64)

func (*Provider) ShouldReceiveMessage

func (p *Provider) ShouldReceiveMessage(ctx context.Context, messagekey *relayertypes.Message) (bool, error)

func (*Provider) ShouldSendMessage

func (p *Provider) ShouldSendMessage(ctx context.Context, messageKey *relayertypes.Message) (bool, error)

func (*Provider) Type

func (p *Provider) Type() string

Type returns chain-type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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