Solana Object
The Solana global object.
Solana Object Documentation
The Solana
class encapsulates various methods for interacting with Solana blockchain transactions and accounts. It provides functionality for submitting transactions, transferring tokens, setting compute budgets, and estimating priority fees. This class extends the Subscribable
class, making it possible to watch and subscribe to address events.
Methods
watchAddress
Description Watches a specified address for transactions and invokes a callback when an event occurs.
Signature
Parameters
address
(string
): The address to watch for transactions.callback
((event: RoboqoTransaction) => void
): The callback function to invoke when a transaction event is detected.
Returns
Promise<SubscriptionResult>
: The result of the subscription operation.
transferTokens
Description Transfers tokens to a specified public key.
Signature
Parameters
toPublicKey
(PublicKeyOrString
): The recipient's public key.mintPublicKey
(PublicKeyOrString
): The mint address of the token.amount
(number | string
): The amount of tokens to transfer.
Returns
Promise<Transaction>
: The deserialized transaction object.
transferSol
Description Transfers SOL to a specified public key.
Signature
Parameters
toPublicKey
(PublicKeyOrString
): The recipient's public key.amountLamports
(number | string
): The amount in lamports to transfer.
Returns
Promise<Transaction>
: The deserialized transaction object.
submitTransaction
Description Submits a single transaction to the Solana blockchain.
Signature
Parameters
transaction
(Transaction | VersionedTransaction
): The transaction to submit.options
({ skipPreFlight?: boolean }
): Optional. Whether to skip the pre-flight check.
Returns
Promise<SolanaTransaction>
: An object containing the transaction signature.
submitTransactions
Description Submits multiple transactions to the Solana blockchain.
Signature
Parameters
request
(SubmitTransactionsRequest
): An object containing:transactions
((Transaction | VersionedTransaction)[]
): Array of transactions to submit.skipPreFlight
(boolean
): Optional. Whether to skip the pre-flight check.
Returns
Promise<SolanaBundle>
: The result of the RPC call containing transaction signatures.
setComputeBudget
Description Sets a custom compute budget for a transaction.
Signature
Parameters
tx
(Transaction | VersionedTransaction
): The transaction to modify.microLamports
(number
): The compute budget in micro-lamports.
Returns
Promise<Transaction>
: The deserialized transaction with the updated compute budget.
getPriorityFeeEstimates
Description Fetches priority fee estimates for transactions based on historical data.
Signature
Parameters
request
(PriorityFeeEstimatesRequest
): Optional. An object containing:account
(string
): Optional. The account to estimate fees for.lastNBlocks
(number
): Optional. The number of blocks to consider.
Returns
Promise<PriorityFeeEstimates>
: The estimated priority fee details for transactions.
getPriorityFeeEstimate
Description Estimates the priority fee for a transaction based on the specified priority level.
Signature
Parameters
request
(PriorityFeeEstimateRequest
): An object containing:priorityLevel
(string
): The priority level (e.g., "Low", "Medium", "High").account
(string
): Optional. The account to estimate fees for.lastNBlocks
(number
): Optional. The number of blocks to consider.
Returns
Promise<any>
: The estimated priority fee.
addPriorityFee
Description Adds a specified priority fee to a transaction.
Signature
Parameters
transaction
(Transaction | VersionedTransaction
): The transaction to modify.microLamports
(number
): The priority fee in micro-lamports.
Returns
Promise<Transaction>
: The deserialized transaction with the added priority fee.
addPriorityFeeWithEstimate
Description Adds an estimated priority fee to a transaction based on the specified priority level.
Signature
Parameters
transaction
(Transaction | VersionedTransaction
): The transaction to modify.priorityLevel
(string
): Optional. The priority level (default is "Medium").
Returns
Promise<Transaction>
: The deserialized transaction with the estimated priority fee added.
Last updated