util_keylet
Compute a serialized keylet of a given type
Concepts
📘TipNot every Keylet type is supported by this utility function. If you need another Keylet type you can derive it yourself using util_sha512h and by checking the required fields here. A further Keylet tool may assist you.
Behaviour
Compute a keylet of the specified
keylet_type
according to the parametersa
throughf
depending on type.Write the serialized 34 byte keylet into
write_ptr
Definition
C
Example
C
Parameters
write_ptr
uint32_t
Pointer to a buffer the serialized keylet will be written to
write_len
uint32_t
Length of output buffer, should be at least 34.
keylet_type
uint32_t
One of the keylet types as defined in hookapi.h
e.g. KEYLET_LINE
for a trustline.
a
uint32_t
See keylet table below
b
uint32_t
See keylet table below
c
uint32_t
See keylet table below
d
uint32_t
See keylet table below
e
uint32_t
See keylet table below
f
uint32_t
See keylet table below
Keylet Table
KEYLET_HOOK_STATE
a
points to an Account ID
b
is the length of the Account ID (should be 20)
c
points to a hook state key
d
is the length of the key (should be 32)
e
points to a hook state namespace
f
is the length of the namespace (should be 32)
KEYLET_AMENDMENTS KEYLET_FEES KEYLET_NEGATIVE_UNL KEYLET_EMITTED_DIR
a
, b
, c
, d
, e
, f
must all be zero
KEYLET_SKIP
Either:
a
, b
, c
, d
, e
, f
all zero
Or:
a
is a LedgerIndex
b
is 1
c
, d
, e
, f
must all be zero
KEYLET_LINE
a
points to the High Account ID
b
is the length of the above (should be 20)
c
points to the Low Account ID
d
is the length of the above (should be 20)
e
points to the Currency Code
f
is the length of the above (should be 20)
KEYLET_QUALITY
a
points to a serialized keylet
b
is the length of the above (should be 34)
c
is the high 32 bits of the uint64 to pass
d
is the low 32 bits of the uint64 to pass
e
, f
must all be zero
KEYLET_DEPOSIT_PREAUTH
a
points to an Account ID
b
is the length (should be 20)
c
points to an Account ID
d
is the length (should be 20)
e
, f
must all be zero
KEYLET_UNCHECKED KEYLET_CHILD KEYLET_EMITTED_TXN
a
points to a key.
b
is the length of the key (should be 32.)
c
, d
, e
, f
must both be zero
KEYLET_OWNER_DIR KEYLET_SIGNERS KEYLET_ACCOUNT KEYLET_HOOK
a
points to an Account ID.
b
is the length (should be 20.)
c
, d
, e
, f
must all be zero.
KEYLET_PAGE
a
points to a key.
b
is the length of the key (should be 32.)
c
is the high 32 bits of the uint64 to pass
d
is the low 32 bits of the uint64 to pass
e
, f
must both be zero
KEYLET_OFFER KEYLET_CHECK KEYLET_ESCROW KEYLET_NFT_OFFER
a
points to an Account ID.
b
is the length (should be 20.)
And Either:
c
is a 32bit unsigned integer (sequence)
d
is 0
Or:
c
points to a 32 byte key
d
is the length of the key (32).
In both cases:
e
and f
must be 0.
KEYLET_PAYCHAN
a
points to an Account ID
b
is the length (should be 20)
c
points to an Account ID
d
is the length (should be 20)
And Either:
e
32bit unsigned int to pass
f
is zero
Or:
e
points to a 32 byte key
f
is the length of the key (32)
Return Code
int64_t
The number of bytes written, should always be 34.
If negative, an error:
OUT_OF_BOUNDS
- pointers/lengths specified outside of hook memory.
INVALID_ARGUMENT
- Call didn't comply with the above table.
TOO_SMALL
- Writing buffer was smaller than 34 bytes.
Last updated