Solana.RPC (Solana v0.2.0) View Source
Functions for dealing with Solana's JSON-RPC API.
Link to this section Summary
Functions
Creates an API client used to interact with Solana's JSON-RPC API.
Sends the provided requests to the configured Solana RPC endpoint.
Sends the provided transactions to the configured RPC endpoint, then confirms them.
Link to this section Types
Specs
client() :: Tesla.Client.t()
Solana JSON-RPC API client.
Link to this section Functions
Specs
Creates an API client used to interact with Solana's JSON-RPC API.
Example
iex> key = Solana.keypair() |> Solana.pubkey!()
iex> client = Solana.RPC.client(network: "localhost")
iex> {:ok, signature} = Solana.RPC.send(client, Solana.RPC.Request.request_airdrop(key, 1))
iex> is_binary(signature)
true
Options
:adapter
- WhichTesla
adapter to use. The default value isTesla.Adapter.Httpc
.:network
- Required. Which Solana cluster to connect to.:retry_options
- Options to pass toTesla.Middleware.Retry
. The default value is[]
.
Sends the provided requests to the configured Solana RPC endpoint.
Specs
send_and_confirm( client(), pid(), [Solana.Transaction.t()] | Solana.Transaction.t(), keyword() ) :: {:ok, [binary()]} | {:error, :timeout, [binary()]}
Sends the provided transactions to the configured RPC endpoint, then confirms them.
Returns a tuple containing all the transactions in the order they were confirmed, OR an error tuple containing the list of all the transactions that were confirmed before the error occurred.