Overview
ThesendSignedTransaction method submits a signed transaction to the NEAR network and waits for it to be finalized. This method is used to execute state-changing operations like transfers, function calls, and account management.
Method Signature
packages/near-api-ts/universal/src/client/methods/transaction/sendSignedTransaction/sendSignedTransaction.ts:22
Parameters
The signed transaction object containing:
The transaction details including:
signerId- Account ID of the transaction signerpublicKey- Public key used to sign the transactionnonce- Transaction nonce (must be greater than current account nonce)receiverId- Account ID of the transaction receiveractions- Array of actions to executeblockHash- Recent block hash for replay protection
Cryptographic signature of the transaction
Transport-level policies for the request (retry, timeout, etc.)
Response
Indicates if the transaction was successful
Raw RPC response containing:
The transaction that was executed
Outcome of the transaction execution
Outcomes of all receipts generated by the transaction
Final status of the transaction:
SuccessValue- Transaction succeeded with a return valueSuccessReceiptId- Transaction succeeded with a receipt IDFailure- Transaction failed (contains error details)
Error object if the transaction failed. Possible error kinds:Transaction Validation Errors:
Client.SendSignedTransaction.Args.InvalidSchema- Invalid argumentsClient.SendSignedTransaction.Rpc.Transaction.Expired- Transaction expiredClient.SendSignedTransaction.Rpc.Transaction.Nonce.Invalid- Invalid nonceClient.SendSignedTransaction.Rpc.Transaction.Signature.Invalid- Invalid signature
Client.SendSignedTransaction.Rpc.Transaction.Signer.NotFound- Signer account not foundClient.SendSignedTransaction.Rpc.Transaction.Receiver.NotFound- Receiver account not foundClient.SendSignedTransaction.Rpc.Transaction.Signer.Balance.TooLow- Insufficient balance
Client.SendSignedTransaction.Rpc.Transaction.Action.CreateAccount.AlreadyExist- Account already existsClient.SendSignedTransaction.Rpc.Transaction.Action.Stake.BelowThreshold- Stake too lowClient.SendSignedTransaction.Rpc.Transaction.Action.Stake.Balance.TooLow- Insufficient balance for staking
Client.SendSignedTransaction.Timeout- Request timed outClient.SendSignedTransaction.Aborted- Request was abortedClient.SendSignedTransaction.Exhausted- Retries exhausted
Implementation Details
The method serializes the signed transaction to Borsh format and sends it via RPC:wait_until: 'FINAL', meaning the method waits for the transaction to be finalized on the blockchain.
Examples
Basic Transfer Transaction
Function Call Transaction
Error Handling
With Custom Transport Policy
With Abort Signal
Inspecting Transaction Outcomes
Transaction Lifecycle
- Creation - Build transaction with actions, nonce, and block hash
- Signing - Sign transaction with private key
- Serialization - Convert to Borsh format (done automatically)
- Submission - Send to RPC node via
send_txmethod - Execution - Transaction is included in a block and executed
- Finalization - Wait for block finalization (2-3 blocks, ~2-3 seconds)
- Response - Receive transaction outcome and receipt results
Notes
- Transactions must be signed with the correct private key for the signer account
- The nonce must be exactly 1 greater than the current access key nonce
- Block hash must be recent (within ~2 minutes)
- Gas is charged for transaction execution
- The method waits for finalization (
FINAL) by default - Failed transactions still consume gas
- Receipt outcomes may include cross-contract call results
Related Methods
- Get Transaction Status - Check status of a submitted transaction
- Call Contract Read Function - Execute read-only contract calls