Module: Solana::Ruby::Kit::Rpc::Api::SendTransaction
Overview
Submits a signed transaction to the cluster for processing. Mirrors TypeScript’s ‘SendTransactionApi.sendTransaction(transaction, config?)`.
Accepts the transaction in two forms:
- A `Solana::Ruby::Kit::Transactions::Transaction` struct (wire bytes are base64-encoded internally).
- A raw base64 String (the already-encoded wire transaction).
Returns a Solana::Ruby::Kit::Keys::Signature (base58-encoded transaction signature).
Note: This method returns as soon as the node receives the transaction; it does NOT wait for confirmation. Use get_signature_statuses to poll for commitment.
Instance Method Summary collapse
Instance Method Details
#send_transaction(transaction, skip_preflight: false, preflight_commitment: nil, max_retries: nil, min_context_slot: nil) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/solana/ruby/kit/rpc/api/send_transaction.rb', line 34 def send_transaction( transaction, skip_preflight: false, preflight_commitment: nil, max_retries: nil, min_context_slot: nil ) wire_base64 = case transaction when String transaction else # Assume it responds to .message_bytes (Transactions::Transaction) Base64.strict_encode64(Transactions.wire_encode_transaction(transaction)) end config = { 'encoding' => 'base64' } config['skipPreflight'] = skip_preflight if skip_preflight config['preflightCommitment'] = preflight_commitment.to_s if preflight_commitment config['maxRetries'] = max_retries if max_retries config['minContextSlot'] = min_context_slot if min_context_slot sig_str = transport.request('sendTransaction', [wire_base64, config]) Keys::Signature.new(sig_str) end |