Documentation
¶
Index ¶
- Constants
- type SolanaAdvanceNonceAccountRequest
- func (r *SolanaAdvanceNonceAccountRequest) ToSigningInput() *solana.SigningInput
- func (r *SolanaAdvanceNonceAccountRequest) WithFeePayer(feePayer string) *SolanaAdvanceNonceAccountRequest
- func (r *SolanaAdvanceNonceAccountRequest) WithPriorityFee(price uint64, limit uint32) *SolanaAdvanceNonceAccountRequest
- func (r *SolanaAdvanceNonceAccountRequest) WithV0Message() *SolanaAdvanceNonceAccountRequest
- type SolanaCache
- type SolanaChain
- func (c *SolanaChain) BuildSigningInput(recentBlockhash string, feePayer string, transfer *solana.Transfer, ...) (*solana.SigningInput, error)
- func (c *SolanaChain) BuildStakeTransaction(validatorPubkey string, value uint64, stakeAccount string) *solana.DelegateStake
- func (c *SolanaChain) BuildTokenTransferTransaction(tokenMintAddress string, senderTokenAddress string, ...) *solana.TokenTransfer
- func (c *SolanaChain) BuildTransferTransaction(recipient string, value uint64, memo string, references []string) *solana.Transfer
- func (c *SolanaChain) CompileTransaction(txInput *chain_abstraction.TransactionInput, signatures [][]byte, ...) ([]byte, error)
- func (c *SolanaChain) CreateAndSignTransaction(input interface{}, privateKey []byte) ([]byte, error)
- func (c *SolanaChain) GetPreimageHash(txInput *chain_abstraction.TransactionInput) ([]byte, []byte, error)
- func (c *SolanaChain) GetPublicKeyFromPrivateKey(privateKey []byte) ([]byte, error)
- func (c *SolanaChain) GetTransactionHash(encodedTx []byte) (string, error)
- func (c *SolanaChain) PrepareTransaction(input interface{}) (*chain_abstraction.TransactionInput, error)
- func (c *SolanaChain) Sign(data []byte, privateKey []byte) ([]byte, error)
- func (c *SolanaChain) ValidateTransactionInput(input interface{}) error
- type SolanaConfig
- func (c *SolanaConfig) WithCaching() *SolanaConfig
- func (c *SolanaConfig) WithCachingAndTTL(ttlSeconds int64) *SolanaConfig
- func (c *SolanaConfig) WithDefaultFee(fee uint64) *SolanaConfig
- func (c *SolanaConfig) WithDefaultPriorityFee(priorityFee uint64) *SolanaConfig
- func (c *SolanaConfig) WithDefaultPriorityLimit(priorityLimit uint32) *SolanaConfig
- func (c *SolanaConfig) WithV0Message() *SolanaConfig
- type SolanaCreateAndTransferTokenRequest
- type SolanaCreateNonceAccountRequest
- func (r *SolanaCreateNonceAccountRequest) ToSigningInput() *solana.SigningInput
- func (r *SolanaCreateNonceAccountRequest) WithFeePayer(feePayer string) *SolanaCreateNonceAccountRequest
- func (r *SolanaCreateNonceAccountRequest) WithNonceAccountPrivateKey(privateKey []byte) *SolanaCreateNonceAccountRequest
- func (r *SolanaCreateNonceAccountRequest) WithPriorityFee(price uint64, limit uint32) *SolanaCreateNonceAccountRequest
- func (r *SolanaCreateNonceAccountRequest) WithV0Message() *SolanaCreateNonceAccountRequest
- type SolanaCreateTokenAccountRequest
- type SolanaDeactivateAllStakeRequest
- func (r *SolanaDeactivateAllStakeRequest) ToSigningInput() *solana.SigningInput
- func (r *SolanaDeactivateAllStakeRequest) WithFeePayer(feePayer string) *SolanaDeactivateAllStakeRequest
- func (r *SolanaDeactivateAllStakeRequest) WithPriorityFee(price uint64, limit uint32) *SolanaDeactivateAllStakeRequest
- func (r *SolanaDeactivateAllStakeRequest) WithV0Message() *SolanaDeactivateAllStakeRequest
- type SolanaDeactivateStakeRequest
- func (r *SolanaDeactivateStakeRequest) ToSigningInput() *solana.SigningInput
- func (r *SolanaDeactivateStakeRequest) WithFeePayer(feePayer string) *SolanaDeactivateStakeRequest
- func (r *SolanaDeactivateStakeRequest) WithPriorityFee(price uint64, limit uint32) *SolanaDeactivateStakeRequest
- func (r *SolanaDeactivateStakeRequest) WithV0Message() *SolanaDeactivateStakeRequest
- type SolanaError
- type SolanaStakeAccountValue
- type SolanaStakeRequest
- func (r *SolanaStakeRequest) ToSigningInput() *solana.SigningInput
- func (r *SolanaStakeRequest) WithFeePayer(feePayer string) *SolanaStakeRequest
- func (r *SolanaStakeRequest) WithPriorityFee(price uint64, limit uint32) *SolanaStakeRequest
- func (r *SolanaStakeRequest) WithStakeAccount(stakeAccount string) *SolanaStakeRequest
- func (r *SolanaStakeRequest) WithV0Message() *SolanaStakeRequest
- type SolanaTokenTransferRequest
- func (r *SolanaTokenTransferRequest) ToSigningInput() *solana.SigningInput
- func (r *SolanaTokenTransferRequest) WithFeePayer(feePayer string, feePayerPrivateKey []byte) *SolanaTokenTransferRequest
- func (r *SolanaTokenTransferRequest) WithMemo(memo string) *SolanaTokenTransferRequest
- func (r *SolanaTokenTransferRequest) WithPriorityFee(price uint64, limit uint32) *SolanaTokenTransferRequest
- func (r *SolanaTokenTransferRequest) WithReferences(references []string) *SolanaTokenTransferRequest
- func (r *SolanaTokenTransferRequest) WithTokenProgramId(programId solana.TokenProgramId) *SolanaTokenTransferRequest
- func (r *SolanaTokenTransferRequest) WithV0Message() *SolanaTokenTransferRequest
- type SolanaTransferRequest
- func (r *SolanaTransferRequest) ToSigningInput() *solana.SigningInput
- func (r *SolanaTransferRequest) WithFeePayer(feePayer string) *SolanaTransferRequest
- func (r *SolanaTransferRequest) WithMemo(memo string) *SolanaTransferRequest
- func (r *SolanaTransferRequest) WithPriorityFee(price uint64, limit uint32) *SolanaTransferRequest
- func (r *SolanaTransferRequest) WithReferences(references []string) *SolanaTransferRequest
- func (r *SolanaTransferRequest) WithV0Message() *SolanaTransferRequest
- type SolanaUtils
- func (u *SolanaUtils) BatchValidateAddresses(addresses []string) (map[string]error, error)
- func (u *SolanaUtils) CreatePriorityFeeLimit(limit uint32) *solana.PriorityFeeLimit
- func (u *SolanaUtils) CreatePriorityFeePrice(price uint64) *solana.PriorityFeePrice
- func (u *SolanaUtils) EstimateTransactionFee(request interface{}) (uint64, error)
- func (u *SolanaUtils) FormatSOLAmount(lamports uint64) string
- func (u *SolanaUtils) FormatTokenAmount(amount uint64, decimals uint32, symbol string) string
- func (u *SolanaUtils) GenerateRandomBlockhash() string
- func (u *SolanaUtils) GetDefaultFee() uint64
- func (u *SolanaUtils) GetPriorityFeeRange() (uint64, uint64)
- func (u *SolanaUtils) GetRequiredSigners(request interface{}) int
- func (u *SolanaUtils) GetTokenProgramID(isToken2022 bool) solana.TokenProgramId
- func (u *SolanaUtils) GetTransactionType(request interface{}) string
- func (u *SolanaUtils) IsV0MessageSupported(request interface{}) bool
- func (u *SolanaUtils) LamportsToSOL(lamports uint64) float64
- func (u *SolanaUtils) ParseSOLAmount(amountStr string) (uint64, error)
- func (u *SolanaUtils) ParseTokenAmount(amountStr string, decimals uint32) (uint64, error)
- func (u *SolanaUtils) SOLToLamports(sol float64) uint64
- func (u *SolanaUtils) TokenAmountToDecimal(amount uint64, decimals uint32) float64
- func (u *SolanaUtils) TokenDecimalToAmount(amount float64, decimals uint32) uint64
- func (u *SolanaUtils) ValidateAndFormatAmount(amountStr string, decimals uint32) (uint64, string, error)
- func (u *SolanaUtils) ValidateBlockhash(blockhash string) error
- func (u *SolanaUtils) ValidateMemo(memo string) error
- func (u *SolanaUtils) ValidatePriorityFee(price *uint64, limit *uint32) error
- func (u *SolanaUtils) ValidateReferences(references []string) error
- func (u *SolanaUtils) ValidateSolanaAddress(address string) error
- func (u *SolanaUtils) ValidateSolanaAddressWithCache(address string) error
- func (u *SolanaUtils) ValidateTokenAccountAddress(address string) error
- func (u *SolanaUtils) ValidateTokenMintAddress(address string) error
- func (u *SolanaUtils) ValidateTransactionRequest(request interface{}) error
- type SolanaWithdrawAllStakeRequest
- func (r *SolanaWithdrawAllStakeRequest) ToSigningInput() *solana.SigningInput
- func (r *SolanaWithdrawAllStakeRequest) WithFeePayer(feePayer string) *SolanaWithdrawAllStakeRequest
- func (r *SolanaWithdrawAllStakeRequest) WithPriorityFee(price uint64, limit uint32) *SolanaWithdrawAllStakeRequest
- func (r *SolanaWithdrawAllStakeRequest) WithV0Message() *SolanaWithdrawAllStakeRequest
- type SolanaWithdrawNonceAccountRequest
- func (r *SolanaWithdrawNonceAccountRequest) ToSigningInput() *solana.SigningInput
- func (r *SolanaWithdrawNonceAccountRequest) WithFeePayer(feePayer string) *SolanaWithdrawNonceAccountRequest
- func (r *SolanaWithdrawNonceAccountRequest) WithPriorityFee(price uint64, limit uint32) *SolanaWithdrawNonceAccountRequest
- func (r *SolanaWithdrawNonceAccountRequest) WithV0Message() *SolanaWithdrawNonceAccountRequest
- type SolanaWithdrawStakeRequest
Constants ¶
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 ¶
func (r *SolanaAdvanceNonceAccountRequest) ToSigningInput() *solana.SigningInput
ToSigningInput converts a SolanaAdvanceNonceAccountRequest to protobuf SigningInput
func (*SolanaAdvanceNonceAccountRequest) WithFeePayer ¶
func (r *SolanaAdvanceNonceAccountRequest) WithFeePayer(feePayer string) *SolanaAdvanceNonceAccountRequest
WithFeePayer sets the fee payer for advance nonce account request
func (*SolanaAdvanceNonceAccountRequest) WithPriorityFee ¶
func (r *SolanaAdvanceNonceAccountRequest) WithPriorityFee(price uint64, limit uint32) *SolanaAdvanceNonceAccountRequest
WithPriorityFee sets the priority fee for advance nonce account request
func (*SolanaAdvanceNonceAccountRequest) WithV0Message ¶
func (r *SolanaAdvanceNonceAccountRequest) WithV0Message() *SolanaAdvanceNonceAccountRequest
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 ¶
func (r *SolanaCreateAndTransferTokenRequest) ToSigningInput() *solana.SigningInput
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 ¶
func (r *SolanaCreateNonceAccountRequest) ToSigningInput() *solana.SigningInput
ToSigningInput converts a SolanaCreateNonceAccountRequest to protobuf SigningInput
func (*SolanaCreateNonceAccountRequest) WithFeePayer ¶
func (r *SolanaCreateNonceAccountRequest) WithFeePayer(feePayer string) *SolanaCreateNonceAccountRequest
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 ¶
func (r *SolanaCreateNonceAccountRequest) WithPriorityFee(price uint64, limit uint32) *SolanaCreateNonceAccountRequest
WithPriorityFee sets the priority fee for create nonce account request
func (*SolanaCreateNonceAccountRequest) WithV0Message ¶
func (r *SolanaCreateNonceAccountRequest) WithV0Message() *SolanaCreateNonceAccountRequest
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 ¶
func (r *SolanaCreateTokenAccountRequest) ToSigningInput() *solana.SigningInput
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 ¶
func (r *SolanaDeactivateAllStakeRequest) ToSigningInput() *solana.SigningInput
ToSigningInput converts a SolanaDeactivateAllStakeRequest to protobuf SigningInput
func (*SolanaDeactivateAllStakeRequest) WithFeePayer ¶
func (r *SolanaDeactivateAllStakeRequest) WithFeePayer(feePayer string) *SolanaDeactivateAllStakeRequest
WithFeePayer sets the fee payer for deactivate all stake request
func (*SolanaDeactivateAllStakeRequest) WithPriorityFee ¶
func (r *SolanaDeactivateAllStakeRequest) WithPriorityFee(price uint64, limit uint32) *SolanaDeactivateAllStakeRequest
WithPriorityFee sets the priority fee for deactivate all stake request
func (*SolanaDeactivateAllStakeRequest) WithV0Message ¶
func (r *SolanaDeactivateAllStakeRequest) WithV0Message() *SolanaDeactivateAllStakeRequest
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 ¶
func (r *SolanaDeactivateStakeRequest) WithFeePayer(feePayer string) *SolanaDeactivateStakeRequest
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 ¶
func (r *SolanaDeactivateStakeRequest) WithV0Message() *SolanaDeactivateStakeRequest
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 ¶
func (r *SolanaTokenTransferRequest) WithMemo(memo string) *SolanaTokenTransferRequest
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 ¶
func (r *SolanaTokenTransferRequest) WithTokenProgramId(programId solana.TokenProgramId) *SolanaTokenTransferRequest
WithTokenProgramId sets the token program ID
func (*SolanaTokenTransferRequest) WithV0Message ¶
func (r *SolanaTokenTransferRequest) WithV0Message() *SolanaTokenTransferRequest
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 ¶
func (r *SolanaTransferRequest) WithMemo(memo string) *SolanaTransferRequest
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 ¶
func (r *SolanaWithdrawAllStakeRequest) WithFeePayer(feePayer string) *SolanaWithdrawAllStakeRequest
WithFeePayer sets the fee payer for withdraw all stake request
func (*SolanaWithdrawAllStakeRequest) WithPriorityFee ¶
func (r *SolanaWithdrawAllStakeRequest) WithPriorityFee(price uint64, limit uint32) *SolanaWithdrawAllStakeRequest
WithPriorityFee sets the priority fee for withdraw all stake request
func (*SolanaWithdrawAllStakeRequest) WithV0Message ¶
func (r *SolanaWithdrawAllStakeRequest) WithV0Message() *SolanaWithdrawAllStakeRequest
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 ¶
func (r *SolanaWithdrawNonceAccountRequest) ToSigningInput() *solana.SigningInput
ToSigningInput converts a SolanaWithdrawNonceAccountRequest to protobuf SigningInput
func (*SolanaWithdrawNonceAccountRequest) WithFeePayer ¶
func (r *SolanaWithdrawNonceAccountRequest) WithFeePayer(feePayer string) *SolanaWithdrawNonceAccountRequest
WithFeePayer sets the fee payer for withdraw nonce account request
func (*SolanaWithdrawNonceAccountRequest) WithPriorityFee ¶
func (r *SolanaWithdrawNonceAccountRequest) WithPriorityFee(price uint64, limit uint32) *SolanaWithdrawNonceAccountRequest
WithPriorityFee sets the priority fee for withdraw nonce account request
func (*SolanaWithdrawNonceAccountRequest) WithV0Message ¶
func (r *SolanaWithdrawNonceAccountRequest) WithV0Message() *SolanaWithdrawNonceAccountRequest
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