Establish a JSON RPC connection
URL to the fullnode JSON RPC endpoint
Optional
commitmentOrConfig: Commitment | ConnectionConfigoptional default commitment level or optional ConnectionConfig configuration object
Optional
commitmentOrConfig: Commitment | GetBlockHeightConfigThe default commitment used for requests
The RPC endpoint
Optional
override: CommitmentOptional
encoding: "base64" | "jsonParsed"Optional
extra: anyOptional
commitment: CommitmentInstead, call confirmTransaction
and pass in TransactionConfirmationStrategy
Optional
commitment: CommitmentFetch all the account info for the specified public key
Optional
commitmentOrConfig: Commitment | GetAccountInfoConfigFetch all the account info for the specified public key, return with context
Optional
commitmentOrConfig: Commitment | GetAccountInfoConfigOptional
config: GetAccountInfoConfigFetch the balance for the specified public key
Optional
commitmentOrConfig: Commitment | GetBalanceConfigFetch the balance for the specified public key, return with context
Optional
commitmentOrConfig: Commitment | GetBalanceConfigFetch a processed block from the cluster.
Instead, call getBlock
using a GetVersionedBlockConfig
by
setting the maxSupportedTransactionVersion
property.
Optional
rawConfig: GetBlockConfigInstead, call getBlock
using a GetVersionedBlockConfig
by
setting the maxSupportedTransactionVersion
property.
Instead, call getBlock
using a GetVersionedBlockConfig
by
setting the maxSupportedTransactionVersion
property.
Fetch a processed block from the cluster.
Optional
rawConfig: GetVersionedBlockConfigFetch a processed block from the cluster.
Fetch a processed block from the cluster.
Optional
configOrCommitment: Commitment | GetBlockProductionConfigFetch a list of Signatures from the cluster for a block, excluding rewards
Optional
commitment: FinalityReturn the list of nodes that are currently participating in the cluster
Fetch a list of Transactions and transaction statuses from the cluster for a confirmed block.
Deprecated since v1.13.0. Please use getBlock instead.
Optional
commitment: FinalityFetch a list of Signatures from the cluster for a confirmed block, excluding rewards
Deprecated since Solana v1.8.0. Please use getBlockSignatures instead.
Optional
commitment: FinalityFetch a list of all the confirmed signatures for transactions involving an address within a specified slot range. Max range allowed is 10,000 slots.
Deprecated since v1.3. Please use getConfirmedSignaturesForAddress2 instead.
queried address
start slot, inclusive
end slot, inclusive
Returns confirmed signatures for transactions involving an address backwards in time from the provided signature or most recent confirmed block
queried address
Optional
options: ConfirmedSignaturesForAddress2OptionsOptional
commitment: FinalityFetch a transaction details for a confirmed transaction
Deprecated since Solana v1.8.0. Please use getTransaction instead.
Optional
commitment: FinalityFetch the Epoch Info parameters
Optional
commitmentOrConfig: Commitment | GetEpochInfoConfigFetch the Epoch Schedule parameters
Fetch the fee calculator for a recent blockhash from the cluster, return with context
Deprecated since Solana v1.8.0. Please use getFeeForMessage instead.
Optional
commitment: CommitmentFetch the fee for a message from the cluster, return with context
Optional
commitment: CommitmentFetch the cluster InflationGovernor parameters
Optional
commitment: CommitmentFetch the specific inflation values for the current epoch
Fetch the inflation reward for a list of addresses for an epoch
Optional
epoch: numberOptional
commitmentOrConfig: Commitment | GetInflationRewardConfigFetch the 20 largest accounts with their current balances
Optional
config: GetLargestAccountsConfigFetch the latest blockhash from the cluster
Optional
commitmentOrConfig: Commitment | GetLatestBlockhashConfigFetch the latest blockhash from the cluster
Optional
commitmentOrConfig: Commitment | GetLatestBlockhashConfigFetch the leader schedule for the current epoch
Fetch the minimum balance needed to exempt an account of dataLength
size from rent
Optional
commitment: CommitmentFetch all the account info for multiple accounts specified by an array of public keys
Optional
commitmentOrConfig: Commitment | GetMultipleAccountsConfigFetch all the account info for multiple accounts specified by an array of public keys, return with context
Optional
commitmentOrConfig: Commitment | GetMultipleAccountsConfigFetch all the account info for multiple accounts specified by an array of public keys, return with context
Optional
rawConfig: GetMultipleAccountsConfigFetch the contents of a Nonce account from the cluster
Optional
commitmentOrConfig: Commitment | GetNonceConfigFetch the contents of a Nonce account from the cluster, return with context
Optional
commitmentOrConfig: Commitment | GetNonceAndContextConfigFetch parsed account info for the specified public key
Optional
commitmentOrConfig: Commitment | GetAccountInfoConfigFetch parsed transaction details for a confirmed or finalized block
Optional
rawConfig: GetVersionedBlockConfigFetch parsed transaction details for a confirmed transaction
Deprecated since Solana v1.8.0. Please use getParsedTransaction instead.
Optional
commitment: FinalityFetch parsed transaction details for a batch of confirmed transactions
Deprecated since Solana v1.8.0. Please use getParsedTransactions instead.
Optional
commitment: FinalityFetch and parse all the accounts owned by the specified program id
Optional
configOrCommitment: Commitment | GetParsedProgramAccountsConfigFetch parsed token accounts owned by the specified account
Optional
commitment: CommitmentFetch parsed transaction details for a confirmed or finalized transaction
Optional
commitmentOrConfig: Finality | GetVersionedTransactionConfigFetch parsed transaction details for a batch of confirmed transactions
Optional
commitmentOrConfig: Finality | GetVersionedTransactionConfigFetch all the accounts owned by the specified program id
Optional
configOrCommitment: Commitment | GetProgramAccountsConfigFetch a recent blockhash from the cluster
Deprecated since Solana v1.8.0. Please use getLatestBlockhash instead.
Optional
commitment: CommitmentFetch a recent blockhash from the cluster, return with context
Deprecated since Solana v1.8.0. Please use getLatestBlockhash instead.
Optional
commitment: CommitmentFetch recent performance samples
Optional
limit: numberFetch a list of prioritization fees from recent blocks.
Optional
config: GetRecentPrioritizationFeesConfigFetch the current status of a signature
Optional
config: SignatureStatusConfigFetch the current statuses of a batch of signatures
Optional
config: SignatureStatusConfigReturns confirmed signatures for transactions involving an address backwards in time from the provided signature or most recent confirmed block
queried address
Optional
options: SignaturesForAddressOptionsOptional
commitment: FinalityFetch the current slot that the node is processing
Optional
commitmentOrConfig: Commitment | GetSlotConfigFetch the current slot leader of the cluster
Optional
commitmentOrConfig: Commitment | GetSlotLeaderConfigReturns epoch activation information for a stake account that has been delegated
Optional
commitmentOrConfig: Commitment | GetStakeActivationConfigOptional
epoch: numberget the stake minimum delegation
Optional
config: GetStakeMinimumDelegationConfigFetch information about the current supply
Optional
config: Commitment | GetSupplyConfigFetch the current balance of a token account
Optional
commitment: CommitmentFetch all the token accounts owned by the specified account
Optional
commitmentOrConfig: Commitment | GetTokenAccountsByOwnerConfigFetch the 20 largest token accounts with their current balances for a given mint.
Optional
commitment: CommitmentFetch the current supply of a token mint
Optional
commitment: CommitmentFetch the current total currency supply of the cluster in lamports
Deprecated since v1.2.8. Please use getSupply instead.
Optional
commitment: CommitmentFetch a confirmed or finalized transaction from the cluster.
Instead, call getTransaction
using a
GetVersionedTransactionConfig
by setting the
maxSupportedTransactionVersion
property.
Optional
rawConfig: GetTransactionConfigFetch a confirmed or finalized transaction from the cluster.
Fetch the current transaction count of the cluster
Optional
commitmentOrConfig: Commitment | GetTransactionCountConfigFetch transaction details for a batch of confirmed transactions. Similar to getParsedTransactions but returns a TransactionResponse.
Instead, call getTransactions
using a
GetVersionedTransactionConfig
by setting the
maxSupportedTransactionVersion
property.
Optional
commitmentOrConfig: Finality | GetTransactionConfigFetch transaction details for a batch of confirmed transactions. Similar to getParsedTransactions but returns a VersionedTransactionResponse.
Return the list of nodes that are currently participating in the cluster
Optional
commitment: CommitmentRegister a callback to be invoked whenever the specified account changes
subscription id
Public key of the account to monitor
Function to invoke whenever the account is changed
Optional
commitment: CommitmentSpecify the commitment level account changes must reach before notification
Registers a callback to be invoked whenever logs are emitted.
Optional
commitment: CommitmentRegister a callback to be invoked whenever accounts owned by the specified program change
subscription id
Public key of the program to monitor
Function to invoke whenever the account is changed
Optional
commitment: CommitmentSpecify the commitment level account changes must reach before notification
Optional
filters: GetProgramAccountsFilter[]The program account filters to pass into the RPC method
Register a callback to be invoked upon root changes
subscription id
Function to invoke whenever the root changes
Register a callback to be invoked upon signature updates
subscription id
Transaction signature string in base 58
Function to invoke on signature notifications
Optional
commitment: CommitmentSpecify the commitment level signature must reach before notification
Register a callback to be invoked when a transaction is received and/or processed.
subscription id
Transaction signature string in base 58
Function to invoke on signature notifications
Optional
options: SignatureSubscriptionOptionsEnable received notifications and set the commitment level that signature must reach before notification
Register a callback to be invoked upon slot changes
subscription id
Function to invoke whenever the slot changes
Register a callback to be invoked upon slot updates. SlotUpdate's may be useful to track live progress of a cluster.
subscription id
Function to invoke whenever the slot updates
Request an allocation of lamports to the specified address
import { Connection, PublicKey, LAMPORTS_PER_SOL } from "@solana/web3.js";
(async () => {
const connection = new Connection("https://api.testnet.solana.com", "confirmed");
const myAddress = new PublicKey("2nr1bHFT86W9tGnyvmYW4vcHKsQB3sVQfnddasz4kExM");
const signature = await connection.requestAirdrop(myAddress, LAMPORTS_PER_SOL);
await connection.confirmTransaction(signature);
})();
Send a transaction that has already been signed, serialized into the wire format, and encoded as a base64 string
Optional
options: SendOptionsSend a transaction that has already been signed and serialized into the wire format
Optional
options: SendOptionsOptional
options: SendOptionsSend a signed transaction
Optional
options: SendOptionsSimulate a transaction
Instead, call simulateTransaction with VersionedTransaction and SimulateTransactionConfig parameters
Optional
signers: Signer[]Optional
includeAccounts: boolean | PublicKey[]Simulate a transaction
Optional
config: SimulateTransactionConfigGenerated using TypeDoc
A connection to a fullnode JSON RPC endpoint