Class Connection

A connection to a fullnode JSON RPC endpoint

Hierarchy

  • Connection

Constructors

Accessors

Methods

_buildArgs confirmTransaction getAccountInfo getAccountInfoAndContext getAddressLookupTable getBalance getBalanceAndContext getBlock getBlockHeight getBlockProduction getBlockSignatures getBlockTime getBlocks getClusterNodes getConfirmedBlock getConfirmedBlockSignatures getConfirmedSignaturesForAddress getConfirmedSignaturesForAddress2 getConfirmedTransaction getEpochInfo getEpochSchedule getFeeCalculatorForBlockhash getFeeForMessage getFirstAvailableBlock getGenesisHash getInflationGovernor getInflationRate getInflationReward getLargestAccounts getLatestBlockhash getLatestBlockhashAndContext getLeaderSchedule getMinimumBalanceForRentExemption getMinimumLedgerSlot getMultipleAccountsInfo getMultipleAccountsInfoAndContext getMultipleParsedAccounts getNonce getNonceAndContext getParsedAccountInfo getParsedBlock getParsedConfirmedTransaction getParsedConfirmedTransactions getParsedProgramAccounts getParsedTokenAccountsByOwner getParsedTransaction getParsedTransactions getProgramAccounts getRecentBlockhash getRecentBlockhashAndContext getRecentPerformanceSamples getSignatureStatus getSignatureStatuses getSignaturesForAddress getSlot getSlotLeader getSlotLeaders getStakeActivation getStakeMinimumDelegation getSupply getTokenAccountBalance getTokenAccountsByOwner getTokenLargestAccounts getTokenSupply getTotalSupply getTransaction getTransactionCount getTransactions getVersion getVoteAccounts onAccountChange onLogs onProgramAccountChange onRootChange onSignature onSignatureWithOptions onSlotChange onSlotUpdate removeAccountChangeListener removeOnLogsListener removeProgramAccountChangeListener removeRootChangeListener removeSignatureListener removeSlotChangeListener removeSlotUpdateListener requestAirdrop sendEncodedTransaction sendRawTransaction sendTransaction simulateTransaction

Constructors

Accessors

Methods

  • Parameters

    • args: any[]
    • Optional override: Commitment
    • Optional encoding: "base64" | "jsonParsed"
    • Optional extra: any

    Returns any[]

  • Fetch the estimated production time of a block

    Parameters

    • slot: number

    Returns Promise<null | number>

  • Fetch confirmed blocks between two slots

    Parameters

    • startSlot: number
    • Optional endSlot: number
    • Optional commitment: Finality

    Returns Promise<number[]>

  • 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.

    Deprecated

    Deprecated since v1.3. Please use getConfirmedSignaturesForAddress2 instead.

    Parameters

    • address: PublicKey

      queried address

    • startSlot: number

      start slot, inclusive

    • endSlot: number

      end slot, inclusive

    Returns Promise<string[]>

  • Fetch the slot of the lowest confirmed block that has not been purged from the ledger

    Returns Promise<number>

  • Fetch the genesis hash

    Returns Promise<string>

  • Fetch the minimum balance needed to exempt an account of dataLength size from rent

    Parameters

    • dataLength: number
    • Optional commitment: Commitment

    Returns Promise<number>

  • Fetch the lowest slot that the node has information about in its ledger. This value may increase over time if the node is configured to purge older ledger data

    Returns Promise<number>

  • Fetch limit number of slot leaders starting from startSlot

    Parameters

    • startSlot: number

      fetch slot leaders starting from this slot

    • limit: number

      number of slot leaders to return

    Returns Promise<PublicKey[]>

  • Fetch the current total currency supply of the cluster in lamports

    Deprecated

    Deprecated since v1.2.8. Please use getSupply instead.

    Parameters

    Returns Promise<number>

  • Register a callback to be invoked upon signature updates

    Returns

    subscription id

    Parameters

    • signature: string

      Transaction signature string in base 58

    • callback: SignatureResultCallback

      Function to invoke on signature notifications

    • Optional commitment: Commitment

      Specify the commitment level signature must reach before notification

    Returns number

  • Deregister an account notification callback

    Parameters

    • clientSubscriptionId: number

    Returns Promise<void>

  • Deregister a logs callback.

    Parameters

    • clientSubscriptionId: number

    Returns Promise<void>

  • Deregister an account notification callback

    Parameters

    • clientSubscriptionId: number

    Returns Promise<void>

  • Deregister a root notification callback

    Parameters

    • clientSubscriptionId: number

    Returns Promise<void>

  • Deregister a signature notification callback

    Parameters

    • clientSubscriptionId: number

    Returns Promise<void>

  • Deregister a slot notification callback

    Parameters

    • clientSubscriptionId: number

    Returns Promise<void>

  • Deregister a slot update notification callback

    Parameters

    • clientSubscriptionId: number

    Returns Promise<void>

  • 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);
    })();

    Parameters

    Returns Promise<string>

  • Send a transaction that has already been signed, serialized into the wire format, and encoded as a base64 string

    Parameters

    • encodedTransaction: string
    • Optional options: SendOptions

    Returns Promise<string>

  • Send a transaction that has already been signed and serialized into the wire format

    Parameters

    • rawTransaction: number[] | Uint8Array | Buffer
    • Optional options: SendOptions

    Returns Promise<string>

Generated using TypeDoc