util_keylet
Conceptos
Sección titulada «Conceptos»Comportamiento
Sección titulada «Comportamiento»- Calcula un keylet del tipo
keylet_typesegún los parámetrosaaf - Escribe el keylet serializado de 34 bytes en
write_ptr
Definición
Sección titulada «Definición»int64_t util_keylet ( uint32_t write_ptr, uint32_t write_len, uint32_t keylet_type, uint32_t a, uint32_t b, uint32_t c, uint32_t d, uint32_t e, uint32_t f);function util_keylet( keylet_type: number, accountid: ByteArray | HexString, statekey: ByteArray | HexString, namespace: ByteArray | HexString ): ErrorCode | ByteArrayEjemplo
Sección titulada «Ejemplo»uint8_t keylet[34];if (util_keylet(keylet, 34, KEYLET_LINE, hook_accid, 20, account_field, 20, currency_code, 20) != 34) rollback("Keylet Failed.", 14, 1);if (util_keylet( KEYLET_LINE, hook_accid, account_field, currency_code ).length < 34) rollback("Keylet Failed.", 1)Parámetros
Sección titulada «Parámetros»| Nombre | Tipo | Descripción |
|---|---|---|
| write_ptr | uint32_t | Puntero al buffer donde se escribirá el keylet |
| write_len | uint32_t | Longitud del buffer (mínimo 34 bytes) |
| keylet_type | uint32_t | Tipo de keylet definido en hookapi.h |
| a | uint32_t | Ver tabla inferior |
| b | uint32_t | Ver tabla inferior |
| c | uint32_t | Ver tabla inferior |
| d | uint32_t | Ver tabla inferior |
| e | uint32_t | Ver tabla inferior |
| f | uint32_t | Ver tabla inferior |
| Nombre | Tipo | Descripción |
|---|---|---|
| keylet_type | number | Tipo de keylet a crear |
| accountid | (Opcional) Primer dato del keylet | |
| statekey | (Opcional) Segundo dato del keylet | |
| namespace | (Opcional) Tercer dato del keylet |
Tabla de Keylets
Sección titulada «Tabla de Keylets»| Tipo de Keylet | Parámetros |
|---|---|
| KEYLET_HOOK_STATE | a=AccountID, b=20, c=clave estado, d=32, e=namespace, f=32 |
| KEYLET_AMENDMENTS / KEYLET_FEES / KEYLET_NEGATIVE_UNL / KEYLET_EMITTED_DIR | Todos 0 |
| KEYLET_SKIP | Todos 0 o a=LedgerIndex, b=1 |
| KEYLET_LINE | a=Account High, b=20, c=Account Low, d=20, e=Currency, f=20 |
| KEYLET_QUALITY | a=keylet, b=34, c/d=uint64, e/f=0 |
| KEYLET_DEPOSIT_PREAUTH | a/b=Account1, c/d=Account2 |
| KEYLET_UNCHECKED / CHILD / EMITTED_TXN | a=clave, b=32 |
| KEYLET_OWNER_DIR / SIGNERS / ACCOUNT / HOOK | a=AccountID, b=20 |
| KEYLET_PAGE | a=clave, b=32, c/d=uint64 |
| KEYLET_OFFER / CHECK / ESCROW / NFT_OFFER | a=AccountID, b=20 + secuencia o clave |
| KEYLET_PAYCHAN | combinación de cuentas + secuencia o clave |
Código de retorno
Sección titulada «Código de retorno»| Tipo | Descripción |
|---|---|
| int64_t | Bytes escritos (34). Error si negativo: OUT_OF_BOUNDS, INVALID_ARGUMENT, TOO_SMALL |
| Tipo | Descripción |
|---|---|
| number | ErrorCode o keylet como array de números |