xport
Behaviour
Section titled “Behaviour”- Wraps a serialized unsigned target transaction in an emitted
Exporttransaction. - Writes the emitted wrapper transaction hash W to
write_ptr. W is the lifecycle handle used byxport_cancel(), the ExportLatch, stream events, and the signature witness. - The wrapper creates an
ExportLatchwhen it is admitted. Selected validators sign only after that ledger validates; witness materialization happens later. xport_reserve()must be called beforexport().- The target transaction must satisfy the same rules as a user-submitted Export: matching
Account,Sequence: 0, a nonzeroTicketSequence, an emptySigningPubKey, no signatures, valid cross-chainNetworkIDhandling, and no reservedxahau/exportMemo. committee_hash_ptridentifies an existing immutable ExportCommittee owned by the Hook account.xport()does not create a committee or select a default.callback_fee_dropsoptionally setsExportCallbackFeeon 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.
Definition
Section titled “Definition”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.
Example
Section titled “Example”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.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
write_ptr | uint32_t | Pointer to a buffer that receives W. |
write_len | uint32_t | Write buffer length; must be at least 32. |
read_ptr | uint32_t | Pointer to the serialized unsigned target transaction. |
read_len | uint32_t | Serialized transaction length. |
committee_hash_ptr | uint32_t | Pointer to the 32-byte digest of an existing ExportCommittee owned by the Hook account. |
committee_hash_len | uint32_t | Committee digest length; must be exactly 32. |
callback_fee_drops | uint64_t | 0 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. |
Return Code
Section titled “Return Code”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:
| Error | Description |
|---|---|
PREREQUISITE_NOT_MET | xport_reserve() was not called. |
TOO_MANY_EXPORTED_TXN | The Hook exceeded its reserved Export count. |
TOO_MANY_EMITTED_TXN | The Hook exceeded its combined emitted-transaction reservation. |
TOO_SMALL | write_len is less than 32. |
OUT_OF_BOUNDS | A pointer or length is outside Hook memory. |
INVALID_ARGUMENT | committee_hash_len is not 32, the committee digest is zero, or callback_fee_drops exceeds the maximum legal native amount. |
DOESNT_EXIST | The Hook account does not own the identified ExportCommittee. |
EXPORT_FAILURE | The committee object is malformed, the target cannot be wrapped, the wrapper fails Export preflight, or the emission generation is too deep. |
INTERNAL_ERROR | A required export nonce cannot be allocated. |