prepare

Prepares a JSON transaction for emission.

Concepts

Behaviour

  • This function takes a transaction JSON object and prepares it for emission.

  • The transaction must be complete except for the Account field, which should always be the Hook account.

Definition

function prepare(
    txJson: Record<string, any> | Transaction
  ): ErrorCode | Record<string, any> | Transaction

Example

const prepared_txn = prepare({
                TransactionType: "Payment",
                Destination: util_raddr(p1address_ns),
                Amount: parseFloat(drops_sent)*2
            })

Parameters

Name
Type
Description

txJson

Record<string, any> | Transaction

The transaction JSON, must be a complete transaction except for Account (always the Hook account).

Return Code

Type
Description

ErrorCode | Record<string, any> | Transaction

Returns an ErrorCode if there is an error, or the prepared transaction JSON or Transaction object.

Last updated

Was this helpful?