
Broadcast a Signed Transaction to the NEAR Network
Source:R/near_broadcast_tx.R
near_broadcast_tx.RdSends a pre-signed transaction using the send_tx RPC method.
Supports different wait levels for outcome confirmation.
Usage
near_broadcast_tx(
signed_tx_base64,
wait_until = c("EXECUTED_OPTIMISTIC", "NONE", "INCLUDED", "INCLUDED_FINAL", "FINAL")
)Arguments
- signed_tx_base64
Character scalar. Base64-encoded signed transaction. Generate with
near-cliusing--signWithOfflineKeyPair.- wait_until
Character. How long to wait for result:
"NONE"— return hash immediately (fastest)"INCLUDED"— wait for block inclusion"INCLUDED_FINAL"— wait for finalization"EXECUTED_OPTIMISTIC"— wait for execution (default)"FINAL"— wait for final outcome (safest)
Value
A tibble with:
hash: transaction hashstatus: execution outcome (list-column)transaction: transaction detailsreceipts: receipt outcomesraw_response: full response for debugging
For wait_until = "NONE", only hash is returned.
Examples
if (FALSE) { # \dontrun{
# Generate a signed transaction using near-cli (harmless view call):
# In your terminal run:
# near call wrap.testnet ft_metadata \'{}\' \
# --accountId sawsimeon.testnet \
# --signWithOfflineKeyPair
# Copy the printed base64 string and paste below:
signed_tx_b64 <- "YOUR_BASE64_STRING_FROM_NEAR_CLI"
near_set_endpoint("testnet")
# Get only the hash (fast)
near_broadcast_tx(signed_tx_b64, wait_until = "NONE")
# Wait for full execution
result <- near_broadcast_tx(signed_tx_b64, wait_until = "EXECUTED_OPTIMISTIC")
result$hash
result$status[[1]]
# Wait for finality
near_broadcast_tx(signed_tx_b64, wait_until = "FINAL")
} # }