common.tools¶
-
compute_locator
(tx_id)[source]¶ Computes an appointment locator given a transaction id.
- Parameters
tx_id (
str
) – the transaction id used to compute the locator.- Returns
The computed locator.
- Return type
str
-
intify
(obj)[source]¶ Takes an object that is a recursive composition of primitive types, lists and dictionaries, and returns an equivalent object where every float number that is actually an integer is replaced with the corresponding
int
.- Parameters
obj – an object as specified.
- Returns
The modified version of
obj
.
-
is_256b_hex_str
(value)[source]¶ Checks if a given value is a 32-byte hex encoded string.
- Parameters
value (
str
) – the value to be checked.- Returns
Whether or not the value matches the format.
- Return type
bool
-
is_compressed_pk
(value)[source]¶ Checks if a given value is a 33-byte hex-encoded string starting by 02 or 03.
- Parameters
value (
str
) – the value to be checked.- Returns
Whether or not the value matches the format.
- Return type
bool
-
is_locator
(value)[source]¶ Checks if a given value is a 16-byte hex encoded string.
- Parameters
value (
str
) – the value to be checked.- Returns
Whether or not the value matches the format.
- Return type
bool