Skip to content

xport

  • Wraps a serialized unsigned target transaction in an emitted Export transaction.
  • Writes the emitted wrapper transaction hash W to write_ptr. W is the lifecycle handle used by xport_cancel(), the ExportLatch, stream events, and the signature witness.
  • The wrapper creates an ExportLatch when it is admitted. Selected validators sign only after that ledger validates; witness materialization happens later.
  • xport_reserve() must be called before xport().
  • The target transaction must satisfy the same rules as a user-submitted Export: matching Account, Sequence: 0, a nonzero TicketSequence, an empty SigningPubKey, no signatures, valid cross-chain NetworkID handling, and no reserved xahau/export Memo.
  • committee_hash_ptr identifies an existing immutable ExportCommittee owned by the Hook account. xport() does not create a committee or select a default.
  • callback_fee_drops optionally sets ExportCallbackFee on the outer intent. Zero omits the field; a positive legal native amount authorizes third-party delivery of the matching Import at exactly that fee.
  • Target-chain fee, Ticket, and SignerList configuration remain the Hook author’s responsibility.
int64_t xport (
uint32_t write_ptr,
uint32_t write_len,
uint32_t read_ptr,
uint32_t read_len,
uint32_t committee_hash_ptr,
uint32_t committee_hash_len,
uint64_t callback_fee_drops
);

This seven-argument signature requires recompiling Hooks built for the earlier six-argument version.

if (xport_reserve(1) < 0)
rollback(SBUF("Export reserve failed"), 1);
// ... build the unsigned target transaction blob ...
uint8_t origin[32];
uint8_t committee_hash[32] = { /* existing committee digest */ };
// Zero keeps ordinary account authorization for the returning Import.
int64_t result = xport(SBUF(origin), SBUF(tx_blob), SBUF(committee_hash), 0);
if (result != 32)
rollback(SBUF("Export failed"), 1);

To opt into third-party delivery, replace the final 0 with the exact callback fee in drops, for example 100000 for 0.1 XAH. This does not change the target transaction’s Fee or prepay the Import fee. The account must have sufficient funds when the callback applies. See Import callback authorization.

NameTypeDescription
write_ptruint32_tPointer to a buffer that receives W.
write_lenuint32_tWrite buffer length; must be at least 32.
read_ptruint32_tPointer to the serialized unsigned target transaction.
read_lenuint32_tSerialized transaction length.
committee_hash_ptruint32_tPointer to the 32-byte digest of an existing ExportCommittee owned by the Hook account.
committee_hash_lenuint32_tCommittee digest length; must be exactly 32.
callback_fee_dropsuint64_t0 omits the opt-in. A positive value sets the exact Import fee, up to the maximum legal native amount of 100000000000000000 drops. Values above that bound are invalid even though they fit in uint64_t.

Returns 32 when the wrapper is queued, not when the intent is admitted or the target transaction executes. The Hook must accept for its emission to survive. Negative results include:

ErrorDescription
PREREQUISITE_NOT_METxport_reserve() was not called.
TOO_MANY_EXPORTED_TXNThe Hook exceeded its reserved Export count.
TOO_MANY_EMITTED_TXNThe Hook exceeded its combined emitted-transaction reservation.
TOO_SMALLwrite_len is less than 32.
OUT_OF_BOUNDSA pointer or length is outside Hook memory.
INVALID_ARGUMENTcommittee_hash_len is not 32, the committee digest is zero, or callback_fee_drops exceeds the maximum legal native amount.
DOESNT_EXISTThe Hook account does not own the identified ExportCommittee.
EXPORT_FAILUREThe committee object is malformed, the target cannot be wrapped, the wrapper fails Export preflight, or the emission generation is too deep.
INTERNAL_ERRORA required export nonce cannot be allocated.