xpop_slot
Behaviour
Section titled “Behaviour”- Locate the XPOP on the originating
Importtransaction and extract its inner transaction and metadata. - Place the transaction into
slot_no_txand the metadata intoslot_no_meta. - A slot argument of
0asks the host to allocate a free slot. A nonzero argument must be1..255and is overwritten if it already holds an object. - Two nonzero arguments must name different slots.
- On success, returns both slot numbers packed into one value:
(tx_slot << 16) | meta_slot.
Definition
Section titled “Definition”int64_t xpop_slot ( uint32_t slot_no_tx, uint32_t slot_no_meta);function xpop_slot(slotno_tx: number, slotno_meta: number): ErrorCode | numberExample
Section titled “Example”int64_t slots = xpop_slot(0, 0); // let the host allocate both slotsif (slots < 0) rollback(SBUF("No XPOP"), 1);
uint32_t tx_slot = (uint32_t)(slots >> 16);uint32_t meta_slot = (uint32_t)(slots & 0xFFFF);const result = xpop_slot(1, 2)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
| slot_no_tx | uint32_t | Slot to receive the XPOP’s inner transaction: 0 to allocate one, or 1..255. |
| slot_no_meta | uint32_t | Slot to receive the XPOP’s metadata: 0 to allocate one, or 1..255. Must differ from a nonzero slot_no_tx. |
| Name | Type | Description |
|---|---|---|
| slotno_tx | number | Slot for the XPOP’s inner transaction. |
| slotno_meta | number | Slot for the XPOP’s metadata. |
Return Code
Section titled “Return Code”| Type | Description |
|---|---|
| int64_t | On success, |
| Type | Description |
|---|---|
| number or ErrorCode | Returns an error code, or a non-negative result on success. |