These docs are for v2.0. Click to read the latest docs for v3.0.

Estimate the required fee for a txn to be emitted successfully

🚧

Warning

Fees on a Hooks-enabled ledger are non trivial. See: Hook Fees for details.

Concepts

Behaviour

  • Return the amount of the fee in drops recommended for a to-be emitted transaction.

Definition

int64_t etxn_fee_base (
    uint32_t read_ptr,
  	uint32_t read_len
);

Example

int64_t fee_to_pay =
    etxn_fee_base(tx_blob, tx_blob_len);

Parameters

NameTypeDescription
read_ptruint32_tPointer to the buffer containing the serialized transaction you intend to emit. The fee field is required but ignored (you may use zero). Use the output of this function to populate the fee field correctly.
read_lenuint32_tThe length of the tx blob.

Return Code

TypeDescription
int64_tThe smallest number of drops that an emitted txn would need to be accepted.

If negative, an error:
OUT_OF_BOUNDS
- The provided buffer is not validly within the hook memory.

PREREQUISITE_NOT_MET
- etxn_reserve has not been called first.

INVALID_TXN
- The provided buffer did not contain a valid serialized transaction. (Deserialization failed, or a required field was missing.)