pub fn emit<T>(tx: &[T]) -> Result<[u8; 32]>
Expand description
Emit a new transaction from the hook and return the 32-bytes long txn hash
T should almost always be MaybeUninit<u8>
or u8
type depending on your use case.
ยงExample
let xrp_payment_txn_builder = XrpPaymentBuilder::new(1000, &otxn_account, 0, 0);
let mut xrp_payment_txn_buffer = XrpPaymentBuilder::uninit_buffer();
match xrp_payment_txn_builder.build(&mut xrp_payment_txn_buffer) {
Ok(ptr) => ptr,
Err(err) => {
rollback(b"could not build xrp payment txn", err.into());
}
};
let txn_hash = match emit(
&xrp_payment_txn_buffer,
) {
Ok(hash) => hash,
Err(err) => {
rollback(b"could not emit xrp payment txn", err.into());
}
};