Submit Raw Tx

The submitRawTx method submits a pre-signed raw transaction to the MNEE network for asynchronous processing. This is useful when you have a transaction that was created offline, received from another service, or created with broadcast: false and need to broadcast it later.

Usage

const rawTxHex = '0100000001...'; // Your signed raw transaction hex
const result = await mnee.submitRawTx(rawTxHex);
console.log('Ticket ID:', result.ticketId);

// Check transaction status
const status = await mnee.getTxStatus(result.ticketId);
console.log('Transaction ID:', status.tx_id);

With Webhook Callback

const rawTxHex = '0100000001...'; // Your signed raw transaction hex

// Submit with webhook for async status updates
const result = await mnee.submitRawTx(rawTxHex, {
  broadcast: true,
  callbackUrl: 'https://your-api.com/webhook'
});

console.log('Ticket ID:', result.ticketId);
// Your webhook will receive status updates as the transaction progresses

Parameters

  • rawTxHex: The complete, signed raw transaction in hexadecimal format

  • transferOptions (optional): Object containing:

    • broadcast: Whether to broadcast the transaction (default: true)

    • callbackUrl: Webhook URL for status updates (only when broadcast is true)

Response

Returns a TransferResponse object:

Common Use Cases

Delayed Broadcasting

Transaction Queue System

Multi-Stage Approval Process

Retry Failed Broadcasts

External Wallet Integration

Error Handling

The submitRawTx method can throw several specific errors:

Important Notes

  • The transaction must be completely signed before submission

  • The transaction must be valid according to MNEE protocol rules

  • Once broadcast, transactions cannot be reversed

  • If a transaction has already been broadcast, submitting again will fail

  • Transactions are processed asynchronously - a ticketId is returned immediately for tracking

  • Use getTxStatus to check if the transaction was successfully broadcast to the network

  • Webhook callbacks provide real-time status updates without polling

  • The transaction ID is only available after the status reaches SUCCESS

See Also

Last updated