hooks_rs::api

Function etxn_fee_base

Source
pub fn etxn_fee_base<T>(tx_blob: &[T]) -> Result<u64>
Expand description

Estimate the required fee for a txn to be emitted successfully

Note that this function can only be called after the transaction buffer is filled except the fee part. The fee part should only include its ‘header’ part and the rest of it filled with zero. Zero is not equivalent to being uninitialized.

§Example

let xrp_payment_txn_buffer = XrpPaymentBuilder::uninit_buffer();

// fill the tranasction buffer
// ...
// ...

// finally, once the transaction buffer is filled except the fee part, estimate the fee.
let fee = match etxn_fee_base(&xrp_payment_txn_buffer);