SolanaClient

class SolanaClient(client: RpcKtorClient, headerProviders: Map<String, suspend () -> String?> = mapOf())

Constructors

Link copied to clipboard
constructor(url: String, authorizationHeaderProvider: (completion: (String?) -> Unit) -> Unit)
constructor(client: RpcKtorClient, headerProviders: Map<String, suspend () -> String?> = mapOf())

Functions

Link copied to clipboard
suspend fun SolanaClient.getAccountInfo(publicKey: PublicKey, commitment: Commitment? = null): Response<Response.RPC<AccountInfo?>>
Link copied to clipboard
suspend fun SolanaClient.getBalance(account: PublicKey, commitment: Commitment? = null): Response<Response.RPC<Long>>
Link copied to clipboard
suspend fun SolanaClient.getFeeForMessage(message: ByteArray, commitment: Commitment? = null): Response<Response.RPC<Long?>>

Get the fee the network will charge for a particular Message

Link copied to clipboard

Returns the latest blockhash

Link copied to clipboard
suspend fun SolanaClient.getMinimumBalanceForRentExemption(dataLength: Long, commitment: Commitment? = null): Response<Long>

Returns minimum balance required to make account rent exempt.

Link copied to clipboard
suspend fun SolanaClient.getNonce(publicKey: PublicKey, commitment: Commitment? = null): NonceAccount?
Link copied to clipboard

Returns the latest blockhash

Link copied to clipboard
suspend fun SolanaClient.getSignaturesForAddress(account: PublicKey, commitment: Commitment? = null): Response<List<SignatureInformation>>

Returns Signatures for confirmed transactions that include the given address in their accountKeys list. Returns signatures backwards in time from the provided signature or most recent confirmed block

Link copied to clipboard
suspend fun SolanaClient.getTokenAccountBalance(tokenAccount: PublicKey, commitment: Commitment? = null): Response<Response.RPC<TokenAmountInfo?>>

Returns the token balance of an SPL Token account.

Link copied to clipboard
suspend fun SolanaClient.getTransaction(signature: String, commitment: Commitment? = null): Response<TransactionResponse?>

Returns transaction details for a confirmed transaction

Link copied to clipboard
suspend fun SolanaClient.isBlockHashValid(blockHash: String, commitment: Commitment? = null, minContextSlot: Long? = null): Response<Response.RPC<Boolean>>

Returns whether a blockhash is still valid or not

Link copied to clipboard
suspend fun SolanaClient.requestAirdrop(publicKey: PublicKey, lamports: Long, commitment: Commitment? = null): Response<String>

Requests an airdrop of lamports to a Pubkey

Link copied to clipboard
suspend fun SolanaClient.sendTransaction(transaction: Transaction, skipPreflight: Boolean = false, preflightCommitment: Commitment = Commitment.Finalized, maxRetries: Int? = null, minContextSlot: Long? = null): Response<String>

Send a signed transaction to the cluster