Skip to contents

Sends 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-cli using --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 hash

  • status: execution outcome (list-column)

  • transaction: transaction details

  • receipts: receipt outcomes

  • raw_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")
} # }