sendTransaction abstract method

Future<TransactionId> sendTransaction(
  1. String transaction, {
  2. Encoding encoding = Encoding.base64,
  3. Commitment? preflightCommitment = Commitment.finalized,
  4. bool? skipPreflight = false,
  5. int? maxRetries,
  6. num? minContextSlot,
})

Submits a signed transaction to the cluster for processing.

This method does not alter the transaction in any way; it relays the transaction created by clients to the node as-is.

If the node's rpc service receives the transaction, this method immediately succeeds, without waiting for any confirmations. A successful response from this method does not guarantee the transaction is processed or confirmed by the cluster.

While the rpc service will reasonably retry to submit it, the transaction could be rejected if transaction's recent_blockhash expires before it lands.

Use RPCClient.getSignatureStatuses() to ensure a transaction is processed and confirmed.

Before submitting, the following preflight checks are performed:

  • The transaction signatures are verified
  • The transaction is simulated against the bank slot specified by the preflight commitment. On failure an error will be returned. Preflight checks may be disabled if desired. It is recommended to specify the same commitment and preflight commitment to avoid confusing behavior.
  • The returned signature is the first signature in the transaction, which is used to identify the transaction (transaction id). This identifier can be easily extracted from the transaction data before submission.

transaction fully-signed Transaction, as encoded string

encoding Only Encoding.base64 is acceptable

preflightCommitment For preflightCommitment parameter description see this document

skipPreflight If true, skip the preflight transaction checks (default: false).

maxRetries Maximum number of times for the RPC node to retry sending the transaction to the leader. If this parameter not provided, the RPC node will retry the transaction until it is finalized or until the blockhash expires.

minContextSlot Set the minimum slot at which to perform preflight transaction checks

Implementation

Future<TransactionId> sendTransaction(
  String transaction, {
  Encoding encoding = Encoding.base64,
  Commitment? preflightCommitment = Commitment.finalized,
  bool? skipPreflight = false,
  int? maxRetries,
  num? minContextSlot,
});