Solana.RPC.Request (Solana v0.2.0) View Source

Functions for creating Solana JSON-RPC API requests.

This client only implements the most common methods (see the function documentation below). If you need a method that's on the full list but is not implemented here, please open an issue or contact the maintainers.

Link to this section Summary

Types

JSON-RPC API request (JSON encoding)

t()

JSON-RPC API request (pre-encoding)

Functions

Encodes a Solana.RPC.Request.t/0 (or a list of them) in the required format.

Returns all information associated with the account of the provided Pubkey.

Returns the balance of the provided pubkey's account.

Returns identity and transaction information about a confirmed block in the ledger.

Returns minimum balance required to make an account rent exempt.

Returns the account information for a list of pubkeys.

Returns a recent block hash from the ledger, and a fee schedule that can be used to compute the cost of submitting a transaction using it.

Returns the statuses of a list of signatures.

Returns confirmed signatures for transactions involving an address backwards in time from the provided signature or most recent confirmed block.

Returns the 20 largest accounts of a particular SPL Token type.

Returns the total supply of an SPL Token.

Returns transaction details for a confirmed transaction.

Requests an airdrop of lamports to an account.

Submits a signed transaction to the cluster for processing.

Link to this section Types

Specs

json() :: %{jsonrpc: String.t(), id: term(), method: String.t(), params: list()}

JSON-RPC API request (JSON encoding)

Specs

t() :: {String.t(), [String.t() | map()]}

JSON-RPC API request (pre-encoding)

Link to this section Functions

Specs

encode(requests :: [t()]) :: [json()]
encode(request :: t()) :: json()

Encodes a Solana.RPC.Request.t/0 (or a list of them) in the required format.

Link to this function

get_account_info(account, opts \\ [])

View Source

Specs

get_account_info(account :: Solana.key(), opts :: keyword()) :: t()

Returns all information associated with the account of the provided Pubkey.

For more information, see the Solana docs.

Link to this function

get_balance(account, opts \\ [])

View Source

Specs

get_balance(account :: Solana.key(), opts :: keyword()) :: t()

Returns the balance of the provided pubkey's account.

For more information, see the Solana docs.

Link to this function

get_block(start_slot, opts \\ [])

View Source

Specs

get_block(start_slot :: non_neg_integer(), opts :: keyword()) :: t()

Returns identity and transaction information about a confirmed block in the ledger.

For more information, see the Solana docs.

Link to this function

get_minimum_balance_for_rent_exemption(length, opts \\ [])

View Source

Specs

get_minimum_balance_for_rent_exemption(
  length :: non_neg_integer(),
  opts :: keyword()
) :: t()

Returns minimum balance required to make an account rent exempt.

For more information, see the Solana docs.

Link to this function

get_multiple_accounts(accounts, opts \\ [])

View Source

Specs

get_multiple_accounts(accounts :: [Solana.key()], opts :: keyword()) :: t()

Returns the account information for a list of pubkeys.

For more information, see the Solana docs.

Link to this function

get_recent_blockhash(opts \\ [])

View Source

Specs

get_recent_blockhash(opts :: keyword()) :: t()

Returns a recent block hash from the ledger, and a fee schedule that can be used to compute the cost of submitting a transaction using it.

For more information, see the Solana docs.

Link to this function

get_signature_statuses(signatures, opts \\ [])

View Source

Specs

get_signature_statuses(signatures :: [Solana.key()], opts :: keyword()) :: t()

Returns the statuses of a list of signatures.

Unless the searchTransactionHistory configuration parameter is included, this method only searches the recent status cache of signatures, which retains statuses for all active slots plus MAX_RECENT_BLOCKHASHES rooted slots.

For more information, see the Solana docs.

Link to this function

get_signatures_for_address(account, opts \\ [])

View Source

Specs

get_signatures_for_address(account :: Solana.key(), opts :: keyword()) :: t()

Returns confirmed signatures for transactions involving an address backwards in time from the provided signature or most recent confirmed block.

For more information, see the Solana docs.

Link to this function

get_token_largest_accounts(mint, opts \\ [])

View Source

Specs

get_token_largest_accounts(mint :: Solana.key(), opts :: keyword()) :: t()

Returns the 20 largest accounts of a particular SPL Token type.

For more information, see the Solana docs.

Link to this function

get_token_supply(mint, opts \\ [])

View Source

Specs

get_token_supply(mint :: Solana.key(), opts :: keyword()) :: t()

Returns the total supply of an SPL Token.

For more information, see the Solana docs.

Link to this function

get_transaction(signature, opts \\ [])

View Source

Specs

get_transaction(signature :: Solana.key(), opts :: keyword()) :: t()

Returns transaction details for a confirmed transaction.

For more information, see the Solana docs.

Link to this function

request_airdrop(account, sol, opts \\ [])

View Source

Specs

request_airdrop(
  account :: Solana.key(),
  sol :: pos_integer(),
  opts :: keyword()
) :: t()

Requests an airdrop of lamports to an account.

For more information, see the Solana docs.

Link to this function

send_transaction(tx, opts \\ [])

View Source

Specs

send_transaction(transaction :: Solana.Transaction.t(), opts :: keyword()) ::
  t()

Submits a signed transaction to the cluster for processing.

For more information, see the Solana docs.