Module midnight_helpers

Source
Expand description

Helper functions for Midnight-specific operations.

This module provides utility functions for working with Midnight-specific data types and formatting, including address normalization, value parsing, and operation processing.

Functions§

are_same_address
Compares two addresses for equality, ignoring case and “0x” prefixes.
are_same_hash
Compares two hashes for equality, ignoring case and “0x” prefixes.
are_same_signature
Compares two function signatures for equality, ignoring case and whitespace. We remove anything between parentheses from the signatures before comparing them because we cannot access the function arguments from the transaction in Midnight.
map_chain_type
Map a chain type to a NetworkId
normalize_address
Normalizes an address string by removing “0x” prefix, spaces, and converting to lowercase.
normalize_address_size
Normalize the size of an address
normalize_hash
Normalizes a hash by removing “0x” prefix, spaces, and converting to lowercase.
normalize_signature
Normalizes a function signature by removing spaces and converting to lowercase.
parse_tx_index_item
Parse a transaction index item
process_transaction_for_coins
Process the coins in a transaction
remove_parentheses
Removes anything after the first parenthesis from a string
seed_to_secret_keys
Convert a seed to a viewing key
try_decrypt_coin
Try to decrypt a coin ciphertext using a viewing key