chains

package
v0.0.1-gowrapper-test Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrInvalidAddress      = "INVALID_ADDRESS"
	ErrInvalidAmount       = "INVALID_AMOUNT"
	ErrInvalidBlockhash    = "INVALID_BLOCKHASH"
	ErrInvalidMemo         = "INVALID_MEMO"
	ErrInvalidReferences   = "INVALID_REFERENCES"
	ErrInvalidPrivateKey   = "INVALID_PRIVATE_KEY"
	ErrInvalidPublicKey    = "INVALID_PUBLIC_KEY"
	ErrInvalidTokenProgram = "INVALID_TOKEN_PROGRAM"
	ErrInvalidStakeAccount = "INVALID_STAKE_ACCOUNT"
	ErrInvalidNonceAccount = "INVALID_NONCE_ACCOUNT"
	ErrInvalidValidator    = "INVALID_VALIDATOR"
	ErrInsufficientBalance = "INSUFFICIENT_BALANCE"
	ErrTransactionFailed   = "TRANSACTION_FAILED"
	ErrSigningFailed       = "SIGNING_FAILED"
	ErrValidationFailed    = "VALIDATION_FAILED"
	ErrCompilationFailed   = "COMPILATION_FAILED"
)

Common Solana error codes

Variables

This section is empty.

Functions

This section is empty.

Types

type SolanaAdvanceNonceAccountRequest

type SolanaAdvanceNonceAccountRequest struct {
	Sender           string  `json:"sender" validate:"required"`
	NonceAccount     string  `json:"nonce_account" validate:"required"`
	RecentBlockhash  string  `json:"recent_blockhash" validate:"required"`
	FeePayer         string  `json:"fee_payer,omitempty"`
	PriorityFeePrice *uint64 `json:"priority_fee_price,omitempty"`
	PriorityFeeLimit *uint32 `json:"priority_fee_limit,omitempty"`
	V0Message        bool    `json:"v0_message,omitempty"`
}

SolanaAdvanceNonceAccountRequest represents a request to advance nonce account

func NewSolanaAdvanceNonceAccountRequest

func NewSolanaAdvanceNonceAccountRequest(sender, nonceAccount, recentBlockhash string) *SolanaAdvanceNonceAccountRequest

NewSolanaAdvanceNonceAccountRequest creates a new advance nonce account request

func (*SolanaAdvanceNonceAccountRequest) ToSigningInput

ToSigningInput converts a SolanaAdvanceNonceAccountRequest to protobuf SigningInput

func (*SolanaAdvanceNonceAccountRequest) WithFeePayer

WithFeePayer sets the fee payer for advance nonce account request

func (*SolanaAdvanceNonceAccountRequest) WithPriorityFee

WithPriorityFee sets the priority fee for advance nonce account request

func (*SolanaAdvanceNonceAccountRequest) WithV0Message

WithV0Message enables V0 message format for advance nonce account request

type SolanaCache

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

SolanaCache holds cached data for performance

type SolanaChain

type SolanaChain struct {
	*chain_abstraction.BaseChain
}

SolanaChain implements the Chain interface for Solana blockchain

func NewSolanaChain

func NewSolanaChain() *SolanaChain

NewSolanaChain creates a new Solana chain instance

func (*SolanaChain) BuildSigningInput

func (c *SolanaChain) BuildSigningInput(
	recentBlockhash string,
	feePayer string,
	transfer *solana.Transfer,
	stake *solana.DelegateStake,
	tokenTransfer *solana.TokenTransfer,
) (*solana.SigningInput, error)

BuildSigningInput builds a signing input from individual parameters

func (*SolanaChain) BuildStakeTransaction

func (c *SolanaChain) BuildStakeTransaction(
	validatorPubkey string,
	value uint64,
	stakeAccount string,
) *solana.DelegateStake

BuildStakeTransaction builds a stake transaction

func (*SolanaChain) BuildTokenTransferTransaction

func (c *SolanaChain) BuildTokenTransferTransaction(
	tokenMintAddress string,
	senderTokenAddress string,
	recipientTokenAddress string,
	amount uint64,
	decimals uint32,
	memo string,
	references []string,
	tokenProgramId solana.TokenProgramId,
) *solana.TokenTransfer

BuildTokenTransferTransaction builds a token transfer transaction

func (*SolanaChain) BuildTransferTransaction

func (c *SolanaChain) BuildTransferTransaction(
	recipient string,
	value uint64,
	memo string,
	references []string,
) *solana.Transfer

BuildTransferTransaction builds a transfer transaction

func (*SolanaChain) CompileTransaction

func (c *SolanaChain) CompileTransaction(txInput *chain_abstraction.TransactionInput, signatures [][]byte, publicKeys [][]byte) ([]byte, error)

CompileTransaction compiles a transaction with external signatures

func (*SolanaChain) CreateAndSignTransaction

func (c *SolanaChain) CreateAndSignTransaction(input interface{}, privateKey []byte) ([]byte, error)

CreateAndSignTransaction creates and signs a transaction directly

func (*SolanaChain) GetPreimageHash

func (c *SolanaChain) GetPreimageHash(txInput *chain_abstraction.TransactionInput) ([]byte, []byte, error)

GetPreimageHash gets the preimage hash for external signing

func (*SolanaChain) GetPublicKeyFromPrivateKey

func (c *SolanaChain) GetPublicKeyFromPrivateKey(privateKey []byte) ([]byte, error)

GetPublicKeyFromPrivateKey derives a public key from a private key

func (*SolanaChain) GetTransactionHash

func (c *SolanaChain) GetTransactionHash(encodedTx []byte) (string, error)

GetTransactionHash calculates the transaction hash For Solana, the transaction hash is the first signature (base58 encoded)

func (*SolanaChain) PrepareTransaction

func (c *SolanaChain) PrepareTransaction(input interface{}) (*chain_abstraction.TransactionInput, error)

PrepareTransaction prepares a transaction for external signing

func (*SolanaChain) Sign

func (c *SolanaChain) Sign(data []byte, privateKey []byte) ([]byte, error)

Sign signs data with a private key

func (*SolanaChain) ValidateTransactionInput

func (c *SolanaChain) ValidateTransactionInput(input interface{}) error

ValidateTransactionInput validates Solana transaction input

type SolanaConfig

type SolanaConfig struct {
	DefaultFee           uint64 `json:"default_fee"`
	DefaultPriorityFee   uint64 `json:"default_priority_fee"`
	DefaultPriorityLimit uint32 `json:"default_priority_limit"`
	UseV0Message         bool   `json:"use_v0_message"`
	EnableCaching        bool   `json:"enable_caching"`
	CacheTTL             int64  `json:"cache_ttl"` // in seconds
}

SolanaConfig holds configuration for Solana operations

func NewSolanaConfig

func NewSolanaConfig() *SolanaConfig

NewSolanaConfig creates a new Solana configuration with defaults

func (*SolanaConfig) WithCaching

func (c *SolanaConfig) WithCaching() *SolanaConfig

WithCaching enables caching with default TTL

func (*SolanaConfig) WithCachingAndTTL

func (c *SolanaConfig) WithCachingAndTTL(ttlSeconds int64) *SolanaConfig

WithCachingAndTTL enables caching with custom TTL

func (*SolanaConfig) WithDefaultFee

func (c *SolanaConfig) WithDefaultFee(fee uint64) *SolanaConfig

WithDefaultFee sets the default fee

func (*SolanaConfig) WithDefaultPriorityFee

func (c *SolanaConfig) WithDefaultPriorityFee(priorityFee uint64) *SolanaConfig

WithDefaultPriorityFee sets the default priority fee

func (*SolanaConfig) WithDefaultPriorityLimit

func (c *SolanaConfig) WithDefaultPriorityLimit(priorityLimit uint32) *SolanaConfig

WithDefaultPriorityLimit sets the default priority limit

func (*SolanaConfig) WithV0Message

func (c *SolanaConfig) WithV0Message() *SolanaConfig

WithV0Message enables V0 message format by default

type SolanaCreateAndTransferTokenRequest

type SolanaCreateAndTransferTokenRequest struct {
	Sender             string                `json:"sender" validate:"required"`
	Recipient          string                `json:"recipient" validate:"required"`
	Amount             uint64                `json:"amount" validate:"required,min=1"`
	TokenMintAddress   string                `json:"token_mint_address" validate:"required"`
	Decimals           uint32                `json:"decimals" validate:"required"`
	RecentBlockhash    string                `json:"recent_blockhash" validate:"required"`
	FeePayer           string                `json:"fee_payer,omitempty"`
	FeePayerPrivateKey []byte                `json:"fee_payer_private_key,omitempty"`
	TokenProgramId     solana.TokenProgramId `json:"token_program_id,omitempty"`
	PriorityFeePrice   *uint64               `json:"priority_fee_price,omitempty"`
	PriorityFeeLimit   *uint32               `json:"priority_fee_limit,omitempty"`
	V0Message          bool                  `json:"v0_message,omitempty"`
}

SolanaCreateAndTransferTokenRequest represents a request to create token account and transfer

func (*SolanaCreateAndTransferTokenRequest) ToSigningInput

ToSigningInput converts a SolanaCreateAndTransferTokenRequest to protobuf SigningInput

type SolanaCreateNonceAccountRequest

type SolanaCreateNonceAccountRequest struct {
	Sender                 string  `json:"sender" validate:"required"`
	NonceAccount           string  `json:"nonce_account" validate:"required"`
	Rent                   uint64  `json:"rent" validate:"required"`
	RecentBlockhash        string  `json:"recent_blockhash" validate:"required"`
	NonceAccountPrivateKey []byte  `json:"nonce_account_private_key,omitempty"`
	FeePayer               string  `json:"fee_payer,omitempty"`
	PriorityFeePrice       *uint64 `json:"priority_fee_price,omitempty"`
	PriorityFeeLimit       *uint32 `json:"priority_fee_limit,omitempty"`
	V0Message              bool    `json:"v0_message,omitempty"`
}

SolanaCreateNonceAccountRequest represents a request to create a nonce account

func NewSolanaCreateNonceAccountRequest

func NewSolanaCreateNonceAccountRequest(sender, nonceAccount string, rent uint64, recentBlockhash string) *SolanaCreateNonceAccountRequest

NewSolanaCreateNonceAccountRequest creates a new create nonce account request

func (*SolanaCreateNonceAccountRequest) ToSigningInput

ToSigningInput converts a SolanaCreateNonceAccountRequest to protobuf SigningInput

func (*SolanaCreateNonceAccountRequest) WithFeePayer

WithFeePayer sets the fee payer for create nonce account request

func (*SolanaCreateNonceAccountRequest) WithNonceAccountPrivateKey

func (r *SolanaCreateNonceAccountRequest) WithNonceAccountPrivateKey(privateKey []byte) *SolanaCreateNonceAccountRequest

WithNonceAccountPrivateKey sets the nonce account private key

func (*SolanaCreateNonceAccountRequest) WithPriorityFee

WithPriorityFee sets the priority fee for create nonce account request

func (*SolanaCreateNonceAccountRequest) WithV0Message

WithV0Message enables V0 message format for create nonce account request

type SolanaCreateTokenAccountRequest

type SolanaCreateTokenAccountRequest struct {
	Sender           string  `json:"sender" validate:"required"`
	TokenMintAddress string  `json:"token_mint_address" validate:"required"`
	RecentBlockhash  string  `json:"recent_blockhash" validate:"required"`
	FeePayer         string  `json:"fee_payer,omitempty"`
	PriorityFeePrice *uint64 `json:"priority_fee_price,omitempty"`
	PriorityFeeLimit *uint32 `json:"priority_fee_limit,omitempty"`
	V0Message        bool    `json:"v0_message,omitempty"`
}

SolanaCreateTokenAccountRequest represents a request to create a token account

func (*SolanaCreateTokenAccountRequest) ToSigningInput

ToSigningInput converts a SolanaCreateTokenAccountRequest to protobuf SigningInput

type SolanaDeactivateAllStakeRequest

type SolanaDeactivateAllStakeRequest struct {
	Sender           string   `json:"sender" validate:"required"`
	StakeAccounts    []string `json:"stake_accounts" validate:"required,min=1"`
	RecentBlockhash  string   `json:"recent_blockhash" validate:"required"`
	FeePayer         string   `json:"fee_payer,omitempty"`
	PriorityFeePrice *uint64  `json:"priority_fee_price,omitempty"`
	PriorityFeeLimit *uint32  `json:"priority_fee_limit,omitempty"`
	V0Message        bool     `json:"v0_message,omitempty"`
}

SolanaDeactivateAllStakeRequest represents a request to deactivate all stakes

func NewSolanaDeactivateAllStakeRequest

func NewSolanaDeactivateAllStakeRequest(sender string, stakeAccounts []string, recentBlockhash string) *SolanaDeactivateAllStakeRequest

NewSolanaDeactivateAllStakeRequest creates a new deactivate all stake request

func (*SolanaDeactivateAllStakeRequest) ToSigningInput

ToSigningInput converts a SolanaDeactivateAllStakeRequest to protobuf SigningInput

func (*SolanaDeactivateAllStakeRequest) WithFeePayer

WithFeePayer sets the fee payer for deactivate all stake request

func (*SolanaDeactivateAllStakeRequest) WithPriorityFee

WithPriorityFee sets the priority fee for deactivate all stake request

func (*SolanaDeactivateAllStakeRequest) WithV0Message

WithV0Message enables V0 message format for deactivate all stake request

type SolanaDeactivateStakeRequest

type SolanaDeactivateStakeRequest struct {
	Sender           string  `json:"sender" validate:"required"`
	StakeAccount     string  `json:"stake_account" validate:"required"`
	RecentBlockhash  string  `json:"recent_blockhash" validate:"required"`
	FeePayer         string  `json:"fee_payer,omitempty"`
	PriorityFeePrice *uint64 `json:"priority_fee_price,omitempty"`
	PriorityFeeLimit *uint32 `json:"priority_fee_limit,omitempty"`
	V0Message        bool    `json:"v0_message,omitempty"`
}

SolanaDeactivateStakeRequest represents a request to deactivate stake

func NewSolanaDeactivateStakeRequest

func NewSolanaDeactivateStakeRequest(sender, stakeAccount, recentBlockhash string) *SolanaDeactivateStakeRequest

NewSolanaDeactivateStakeRequest creates a new deactivate stake request

func (*SolanaDeactivateStakeRequest) ToSigningInput

func (r *SolanaDeactivateStakeRequest) ToSigningInput() *solana.SigningInput

ToSigningInput converts a SolanaDeactivateStakeRequest to protobuf SigningInput

func (*SolanaDeactivateStakeRequest) WithFeePayer

WithFeePayer sets the fee payer for deactivate stake request

func (*SolanaDeactivateStakeRequest) WithPriorityFee

func (r *SolanaDeactivateStakeRequest) WithPriorityFee(price uint64, limit uint32) *SolanaDeactivateStakeRequest

WithPriorityFee sets the priority fee for deactivate stake request

func (*SolanaDeactivateStakeRequest) WithV0Message

WithV0Message enables V0 message format for deactivate stake request

type SolanaError

type SolanaError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Details string `json:"details,omitempty"`
}

SolanaError represents a Solana-specific error

func NewSolanaError

func NewSolanaError(code, message string) *SolanaError

NewSolanaError creates a new Solana error

func NewSolanaErrorWithDetails

func NewSolanaErrorWithDetails(code, message, details string) *SolanaError

NewSolanaErrorWithDetails creates a new Solana error with details

func (*SolanaError) Error

func (e *SolanaError) Error() string

type SolanaStakeAccountValue

type SolanaStakeAccountValue struct {
	StakeAccount string `json:"stake_account" validate:"required"`
	Value        uint64 `json:"value" validate:"required,min=1"`
}

SolanaStakeAccountValue represents a stake account with amount

type SolanaStakeRequest

type SolanaStakeRequest struct {
	Sender           string  `json:"sender" validate:"required"`
	ValidatorPubkey  string  `json:"validator_pubkey" validate:"required"`
	Amount           uint64  `json:"amount" validate:"required,min=1"`
	RecentBlockhash  string  `json:"recent_blockhash" validate:"required"`
	StakeAccount     string  `json:"stake_account,omitempty"`
	FeePayer         string  `json:"fee_payer,omitempty"`
	PriorityFeePrice *uint64 `json:"priority_fee_price,omitempty"`
	PriorityFeeLimit *uint32 `json:"priority_fee_limit,omitempty"`
	V0Message        bool    `json:"v0_message,omitempty"`
}

SolanaStakeRequest represents a request to stake SOL

func NewSolanaStakeRequest

func NewSolanaStakeRequest(sender, validatorPubkey string, amount uint64, recentBlockhash string) *SolanaStakeRequest

NewSolanaStakeRequest creates a new stake request

func (*SolanaStakeRequest) ToSigningInput

func (r *SolanaStakeRequest) ToSigningInput() *solana.SigningInput

ToSigningInput converts a SolanaStakeRequest to protobuf SigningInput

func (*SolanaStakeRequest) WithFeePayer

func (r *SolanaStakeRequest) WithFeePayer(feePayer string) *SolanaStakeRequest

WithFeePayer sets the fee payer

func (*SolanaStakeRequest) WithPriorityFee

func (r *SolanaStakeRequest) WithPriorityFee(price uint64, limit uint32) *SolanaStakeRequest

WithPriorityFee sets the priority fee

func (*SolanaStakeRequest) WithStakeAccount

func (r *SolanaStakeRequest) WithStakeAccount(stakeAccount string) *SolanaStakeRequest

WithStakeAccount sets the stake account

func (*SolanaStakeRequest) WithV0Message

func (r *SolanaStakeRequest) WithV0Message() *SolanaStakeRequest

WithV0Message enables V0 message format

type SolanaTokenTransferRequest

type SolanaTokenTransferRequest struct {
	Sender                string                `json:"sender" validate:"required"`
	Recipient             string                `json:"recipient" validate:"required"`
	Amount                uint64                `json:"amount" validate:"required,min=1"`
	TokenMintAddress      string                `json:"token_mint_address" validate:"required"`
	SenderTokenAddress    string                `json:"sender_token_address" validate:"required"`
	RecipientTokenAddress string                `json:"recipient_token_address" validate:"required"`
	Decimals              uint32                `json:"decimals" validate:"required"`
	RecentBlockhash       string                `json:"recent_blockhash" validate:"required"`
	FeePayer              string                `json:"fee_payer,omitempty"`
	FeePayerPrivateKey    []byte                `json:"fee_payer_private_key,omitempty"`
	Memo                  string                `json:"memo,omitempty"`
	References            []string              `json:"references,omitempty"`
	TokenProgramId        solana.TokenProgramId `json:"token_program_id,omitempty"`
	PriorityFeePrice      *uint64               `json:"priority_fee_price,omitempty"`
	PriorityFeeLimit      *uint32               `json:"priority_fee_limit,omitempty"`
	V0Message             bool                  `json:"v0_message,omitempty"`
}

SolanaTokenTransferRequest represents a request to transfer tokens

func NewSolanaTokenTransferRequest

func NewSolanaTokenTransferRequest(sender, recipient, tokenMintAddress, senderTokenAddress, recipientTokenAddress string, amount uint64, decimals uint32, recentBlockhash string) *SolanaTokenTransferRequest

NewSolanaTokenTransferRequest creates a new token transfer request

func (*SolanaTokenTransferRequest) ToSigningInput

func (r *SolanaTokenTransferRequest) ToSigningInput() *solana.SigningInput

ToSigningInput converts a SolanaTokenTransferRequest to protobuf SigningInput

func (*SolanaTokenTransferRequest) WithFeePayer

func (r *SolanaTokenTransferRequest) WithFeePayer(feePayer string, feePayerPrivateKey []byte) *SolanaTokenTransferRequest

WithFeePayer sets the fee payer

func (*SolanaTokenTransferRequest) WithMemo

WithMemo sets the memo

func (*SolanaTokenTransferRequest) WithPriorityFee

func (r *SolanaTokenTransferRequest) WithPriorityFee(price uint64, limit uint32) *SolanaTokenTransferRequest

WithPriorityFee sets the priority fee

func (*SolanaTokenTransferRequest) WithReferences

func (r *SolanaTokenTransferRequest) WithReferences(references []string) *SolanaTokenTransferRequest

WithReferences sets the references

func (*SolanaTokenTransferRequest) WithTokenProgramId

WithTokenProgramId sets the token program ID

func (*SolanaTokenTransferRequest) WithV0Message

WithV0Message enables V0 message format

type SolanaTransferRequest

type SolanaTransferRequest struct {
	Sender           string   `json:"sender" validate:"required"`
	Recipient        string   `json:"recipient" validate:"required"`
	Amount           uint64   `json:"amount" validate:"required,min=1"`
	RecentBlockhash  string   `json:"recent_blockhash" validate:"required"`
	FeePayer         string   `json:"fee_payer,omitempty"`
	Memo             string   `json:"memo,omitempty"`
	References       []string `json:"references,omitempty"`
	PriorityFeePrice *uint64  `json:"priority_fee_price,omitempty"`
	PriorityFeeLimit *uint32  `json:"priority_fee_limit,omitempty"`
	V0Message        bool     `json:"v0_message,omitempty"`
}

SolanaTransferRequest represents a request to transfer SOL

func NewSolanaTransferRequest

func NewSolanaTransferRequest(sender, recipient string, amount uint64, recentBlockhash string) *SolanaTransferRequest

NewSolanaTransferRequest creates a new SOL transfer request

func (*SolanaTransferRequest) ToSigningInput

func (r *SolanaTransferRequest) ToSigningInput() *solana.SigningInput

ToSigningInput converts a SolanaTransferRequest to protobuf SigningInput

func (*SolanaTransferRequest) WithFeePayer

func (r *SolanaTransferRequest) WithFeePayer(feePayer string) *SolanaTransferRequest

WithFeePayer sets the fee payer

func (*SolanaTransferRequest) WithMemo

WithMemo sets the memo

func (*SolanaTransferRequest) WithPriorityFee

func (r *SolanaTransferRequest) WithPriorityFee(price uint64, limit uint32) *SolanaTransferRequest

WithPriorityFee sets the priority fee

func (*SolanaTransferRequest) WithReferences

func (r *SolanaTransferRequest) WithReferences(references []string) *SolanaTransferRequest

WithReferences sets the references

func (*SolanaTransferRequest) WithV0Message

func (r *SolanaTransferRequest) WithV0Message() *SolanaTransferRequest

WithV0Message enables V0 message format

type SolanaUtils

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

func NewSolanaUtils

func NewSolanaUtils() *SolanaUtils

func NewSolanaUtilsWithConfig

func NewSolanaUtilsWithConfig(config *SolanaConfig) *SolanaUtils

NewSolanaUtilsWithConfig creates a new SolanaUtils with custom configuration

func (*SolanaUtils) BatchValidateAddresses

func (u *SolanaUtils) BatchValidateAddresses(addresses []string) (map[string]error, error)

BatchValidateAddresses validates multiple addresses efficiently

func (*SolanaUtils) CreatePriorityFeeLimit

func (u *SolanaUtils) CreatePriorityFeeLimit(limit uint32) *solana.PriorityFeeLimit

CreatePriorityFeeLimit creates a PriorityFeeLimit message

func (*SolanaUtils) CreatePriorityFeePrice

func (u *SolanaUtils) CreatePriorityFeePrice(price uint64) *solana.PriorityFeePrice

CreatePriorityFeePrice creates a PriorityFeePrice message

func (*SolanaUtils) EstimateTransactionFee

func (u *SolanaUtils) EstimateTransactionFee(request interface{}) (uint64, error)

EstimateTransactionFee estimates the transaction fee based on transaction type

func (*SolanaUtils) FormatSOLAmount

func (u *SolanaUtils) FormatSOLAmount(lamports uint64) string

FormatSOLAmount formats SOL amount with proper decimal places

func (*SolanaUtils) FormatTokenAmount

func (u *SolanaUtils) FormatTokenAmount(amount uint64, decimals uint32, symbol string) string

FormatTokenAmount formats token amount with proper decimal places

func (*SolanaUtils) GenerateRandomBlockhash

func (u *SolanaUtils) GenerateRandomBlockhash() string

GenerateRandomBlockhash generates a random blockhash for testing

func (*SolanaUtils) GetDefaultFee

func (u *SolanaUtils) GetDefaultFee() uint64

GetDefaultFee estimates default transaction fee in lamports

func (*SolanaUtils) GetPriorityFeeRange

func (u *SolanaUtils) GetPriorityFeeRange() (uint64, uint64)

GetPriorityFeeRange returns the range for priority fees

func (*SolanaUtils) GetRequiredSigners

func (u *SolanaUtils) GetRequiredSigners(request interface{}) int

GetRequiredSigners returns the number of required signers for a transaction

func (*SolanaUtils) GetTokenProgramID

func (u *SolanaUtils) GetTokenProgramID(isToken2022 bool) solana.TokenProgramId

GetTokenProgramID returns the token program ID based on the token type

func (*SolanaUtils) GetTransactionType

func (u *SolanaUtils) GetTransactionType(request interface{}) string

GetTransactionType returns the transaction type as a string

func (*SolanaUtils) IsV0MessageSupported

func (u *SolanaUtils) IsV0MessageSupported(request interface{}) bool

IsV0MessageSupported checks if V0 message is supported for the transaction type

func (*SolanaUtils) LamportsToSOL

func (u *SolanaUtils) LamportsToSOL(lamports uint64) float64

LamportsToSOL converts lamports to SOL

func (*SolanaUtils) ParseSOLAmount

func (u *SolanaUtils) ParseSOLAmount(amountStr string) (uint64, error)

ParseSOLAmount parses SOL amount string to lamports

func (*SolanaUtils) ParseTokenAmount

func (u *SolanaUtils) ParseTokenAmount(amountStr string, decimals uint32) (uint64, error)

ParseTokenAmount parses token amount string to raw amount

func (*SolanaUtils) SOLToLamports

func (u *SolanaUtils) SOLToLamports(sol float64) uint64

SOLToLamports converts SOL to lamports

func (*SolanaUtils) TokenAmountToDecimal

func (u *SolanaUtils) TokenAmountToDecimal(amount uint64, decimals uint32) float64

TokenAmountToDecimal converts token amount to decimal representation

func (*SolanaUtils) TokenDecimalToAmount

func (u *SolanaUtils) TokenDecimalToAmount(amount float64, decimals uint32) uint64

TokenDecimalToAmount converts decimal token amount to raw amount

func (*SolanaUtils) ValidateAndFormatAmount

func (u *SolanaUtils) ValidateAndFormatAmount(amountStr string, decimals uint32) (uint64, string, error)

ValidateAndFormatAmount validates and formats an amount string

func (*SolanaUtils) ValidateBlockhash

func (u *SolanaUtils) ValidateBlockhash(blockhash string) error

ValidateBlockhash validates a Solana blockhash format

func (*SolanaUtils) ValidateMemo

func (u *SolanaUtils) ValidateMemo(memo string) error

ValidateMemo validates a Solana memo

func (*SolanaUtils) ValidatePriorityFee

func (u *SolanaUtils) ValidatePriorityFee(price *uint64, limit *uint32) error

ValidatePriorityFee validates priority fee parameters

func (*SolanaUtils) ValidateReferences

func (u *SolanaUtils) ValidateReferences(references []string) error

ValidateReferences validates Solana transaction references

func (*SolanaUtils) ValidateSolanaAddress

func (u *SolanaUtils) ValidateSolanaAddress(address string) error

ValidateSolanaAddress validates a Solana address format

func (*SolanaUtils) ValidateSolanaAddressWithCache

func (u *SolanaUtils) ValidateSolanaAddressWithCache(address string) error

ValidateSolanaAddressWithCache validates a Solana address with caching

func (*SolanaUtils) ValidateTokenAccountAddress

func (u *SolanaUtils) ValidateTokenAccountAddress(address string) error

ValidateTokenAccountAddress validates a Solana token account address

func (*SolanaUtils) ValidateTokenMintAddress

func (u *SolanaUtils) ValidateTokenMintAddress(address string) error

ValidateTokenMintAddress validates a Solana token mint address

func (*SolanaUtils) ValidateTransactionRequest

func (u *SolanaUtils) ValidateTransactionRequest(request interface{}) error

ValidateTransactionRequest validates a transaction request with enhanced error handling

type SolanaWithdrawAllStakeRequest

type SolanaWithdrawAllStakeRequest struct {
	Sender           []SolanaStakeAccountValue `json:"sender" validate:"required,min=1"`
	RecentBlockhash  string                    `json:"recent_blockhash" validate:"required"`
	FeePayer         string                    `json:"fee_payer,omitempty"`
	PriorityFeePrice *uint64                   `json:"priority_fee_price,omitempty"`
	PriorityFeeLimit *uint32                   `json:"priority_fee_limit,omitempty"`
	V0Message        bool                      `json:"v0_message,omitempty"`
}

SolanaWithdrawAllStakeRequest represents a request to withdraw from multiple stake accounts

func NewSolanaWithdrawAllStakeRequest

func NewSolanaWithdrawAllStakeRequest(stakeAccounts []SolanaStakeAccountValue, recentBlockhash string) *SolanaWithdrawAllStakeRequest

NewSolanaWithdrawAllStakeRequest creates a new withdraw all stake request

func (*SolanaWithdrawAllStakeRequest) ToSigningInput

func (r *SolanaWithdrawAllStakeRequest) ToSigningInput() *solana.SigningInput

ToSigningInput converts a SolanaWithdrawAllStakeRequest to protobuf SigningInput

func (*SolanaWithdrawAllStakeRequest) WithFeePayer

WithFeePayer sets the fee payer for withdraw all stake request

func (*SolanaWithdrawAllStakeRequest) WithPriorityFee

WithPriorityFee sets the priority fee for withdraw all stake request

func (*SolanaWithdrawAllStakeRequest) WithV0Message

WithV0Message enables V0 message format for withdraw all stake request

type SolanaWithdrawNonceAccountRequest

type SolanaWithdrawNonceAccountRequest struct {
	Sender           string  `json:"sender" validate:"required"`
	NonceAccount     string  `json:"nonce_account" validate:"required"`
	Recipient        string  `json:"recipient" validate:"required"`
	Amount           uint64  `json:"amount" validate:"required,min=1"`
	RecentBlockhash  string  `json:"recent_blockhash" validate:"required"`
	FeePayer         string  `json:"fee_payer,omitempty"`
	PriorityFeePrice *uint64 `json:"priority_fee_price,omitempty"`
	PriorityFeeLimit *uint32 `json:"priority_fee_limit,omitempty"`
	V0Message        bool    `json:"v0_message,omitempty"`
}

SolanaWithdrawNonceAccountRequest represents a request to withdraw from nonce account

func NewSolanaWithdrawNonceAccountRequest

func NewSolanaWithdrawNonceAccountRequest(sender, nonceAccount, recipient string, amount uint64, recentBlockhash string) *SolanaWithdrawNonceAccountRequest

NewSolanaWithdrawNonceAccountRequest creates a new withdraw nonce account request

func (*SolanaWithdrawNonceAccountRequest) ToSigningInput

ToSigningInput converts a SolanaWithdrawNonceAccountRequest to protobuf SigningInput

func (*SolanaWithdrawNonceAccountRequest) WithFeePayer

WithFeePayer sets the fee payer for withdraw nonce account request

func (*SolanaWithdrawNonceAccountRequest) WithPriorityFee

WithPriorityFee sets the priority fee for withdraw nonce account request

func (*SolanaWithdrawNonceAccountRequest) WithV0Message

WithV0Message enables V0 message format for withdraw nonce account request

type SolanaWithdrawStakeRequest

type SolanaWithdrawStakeRequest struct {
	Sender           string  `json:"sender" validate:"required"`
	StakeAccount     string  `json:"stake_account" validate:"required"`
	Recipient        string  `json:"recipient" validate:"required"`
	Amount           uint64  `json:"amount" validate:"required,min=1"`
	RecentBlockhash  string  `json:"recent_blockhash" validate:"required"`
	FeePayer         string  `json:"fee_payer,omitempty"`
	PriorityFeePrice *uint64 `json:"priority_fee_price,omitempty"`
	PriorityFeeLimit *uint32 `json:"priority_fee_limit,omitempty"`
	V0Message        bool    `json:"v0_message,omitempty"`
}

SolanaWithdrawStakeRequest represents a request to withdraw stake

func (*SolanaWithdrawStakeRequest) ToSigningInput

func (r *SolanaWithdrawStakeRequest) ToSigningInput() *solana.SigningInput

ToSigningInput converts a SolanaWithdrawStakeRequest to protobuf SigningInput

Jump to

Keyboard shortcuts

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