Establish a JSON RPC connection
URL to the fullnode JSON RPC endpoint
Optional
commitmentOrConfig: Commitment | ConnectionConfigoptional default commitment level or optional ConnectionConfig configuration object
The default commitment used for requests
The RPC endpoint
Optional
override: CommitmentOptional
encoding: "base64" | "jsonParsed"Optional
extra: anyOptional
commitment: CommitmentOptional
commitment: CommitmentInstead, call confirmTransaction
and pass in TransactionConfirmationStrategy
Fetch 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.
Optional
rawConfig: GetBlockConfigFetch a processed block from the cluster.
Optional
rawConfig: GetVersionedBlockConfigOptional
configOrCommitment: Commitment | GetBlockProductionConfigFetch a list of Signatures from the cluster for a block, excluding rewards
Optional
commitment: FinalityFetch confirmed blocks between two slots
Optional
endSlot: numberOptional
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.
Optional
commitment: FinalityDeprecated since RPC v1.7.0. Please use getBlock instead.
Fetch a list of Signatures from the cluster for a confirmed block, excluding rewards
Optional
commitment: FinalityDeprecated since RPC v1.7.0. Please use getBlockSignatures instead.
Fetch a list of all the confirmed signatures for transactions involving an address within a specified slot range. Max range allowed is 10,000 slots.
queried address
start slot, inclusive
end slot, inclusive
Deprecated since RPC v1.3. Please use getConfirmedSignaturesForAddress2 instead.
Returns confirmed signatures for transactions involving an address backwards in time from the provided signature or most recent confirmed block
Optional
options: ConfirmedSignaturesForAddress2OptionsOptional
commitment: FinalityDeprecated since RPC v1.7.0. Please use getSignaturesForAddress instead.
Fetch a transaction details for a confirmed transaction
Optional
commitment: FinalityDeprecated since RPC v1.7.0. Please use getTransaction instead.
Fetch 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
Optional
commitment: CommitmentDeprecated since RPC v1.9.0. Please use getFeeForMessage instead.
Fetch 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
Optional
commitment: FinalityDeprecated since RPC v1.7.0. Please use getParsedTransaction instead.
Fetch parsed transaction details for a batch of confirmed transactions
Optional
commitment: FinalityDeprecated since RPC v1.7.0. Please use getParsedTransactions instead.
Fetch 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: GetVersionedTransactionConfig | FinalityFetch parsed transaction details for a batch of confirmed transactions
Optional
commitmentOrConfig: GetVersionedTransactionConfig | FinalityFetch all the accounts owned by the specified program id
Optional
configOrCommitment: Commitment | GetProgramAccountsConfigFetch a recent blockhash from the cluster
Optional
commitment: CommitmentDeprecated since RPC v1.8.0. Please use getLatestBlockhash instead.
Fetch a recent blockhash from the cluster, return with context
Optional
commitment: CommitmentDeprecated since RPC v1.9.0. Please use getLatestBlockhash instead.
Fetch 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
Optional
commitment: CommitmentDeprecated since RPC v1.2.8. Please use getSupply instead.
Fetch a confirmed or finalized transaction from the cluster.
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.
Optional
commitmentOrConfig: GetTransactionConfig | FinalityFetch 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: CommitmentReturns whether a blockhash is still valid or not
Optional
rawConfig: IsBlockhashValidConfigRegister a callback to be invoked whenever the specified account changes
Public key of the account to monitor
Function to invoke whenever the account is changed
Optional
config: Readonly<{ subscription id
Optional
commitment: CommitmentInstead, pass in an AccountSubscriptionConfig
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
Public key of the program to monitor
Function to invoke whenever the account is changed
Optional
config: Readonly<{ subscription id
Optional
commitment: CommitmentOptional
filters: GetProgramAccountsFilter[]Instead, pass in a ProgramAccountSubscriptionConfig
Register a callback to be invoked upon root changes
Function to invoke whenever the root changes
subscription id
Register a callback to be invoked upon signature updates
Transaction signature string in base 58
Function to invoke on signature notifications
Optional
commitment: CommitmentSpecify the commitment level signature must reach before notification
subscription id
Register a callback to be invoked when a transaction is received and/or processed.
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
subscription id
Register a callback to be invoked upon slot changes
Function to invoke whenever the slot changes
subscription id
Register a callback to be invoked upon slot updates. SlotUpdate's may be useful to track live progress of a cluster.
Function to invoke whenever the slot updates
subscription id
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: SendOptionsSign and send a transaction
Optional
options: SendOptionsInstead, call sendTransaction with a VersionedTransaction
Send a signed transaction
Optional
options: SendOptionsSimulate a transaction
Optional
signers: Signer[]Optional
includeAccounts: boolean | PublicKey[]Instead, call simulateTransaction with VersionedTransaction and SimulateTransactionConfig parameters
Simulate a transaction
Optional
config: SimulateTransactionConfig
A connection to a fullnode JSON RPC endpoint