/* tslint:disable */ /* eslint-disable */ /** */ export function core_network_set_panic_hook(): void; /** * @returns {string} */ export function core_network_gather_metrics(): string; /** * Used to pre-compute ping responses * @param {Uint8Array} u8a * @returns {Uint8Array} */ export function generate_ping_response(u8a: Uint8Array): Uint8Array; /** * @param {AsyncIterator} stream * @returns {AsyncIterableHelperCoreHeartbeat} */ export function reply_to_ping(stream: AsyncIterator): AsyncIterableHelperCoreHeartbeat; /** * @param {number} h * @returns {string} */ export function health_to_string(h: number): string; /** * A naive merging method for two serialized metric registries. * It performs union of the sets, removing those metrics which have the same name and type. * @param {string} metrics1 * @param {string} metrics2 * @returns {string} */ export function merge_encoded_metrics(metrics1: string, metrics2: string): string; /** */ export function utils_metrics_set_panic_hook(): void; /** * @returns {string} */ export function gather_all_metrics(): string; /** * @param {string} name * @param {string} description * @returns {SimpleCounter} */ export function create_counter(name: string, description: string): SimpleCounter; /** * @param {string} name * @param {string} description * @param {(string)[]} labels * @returns {MultiCounter} */ export function create_multi_counter(name: string, description: string, labels: (string)[]): MultiCounter; /** * @param {string} name * @param {string} description * @returns {SimpleGauge} */ export function create_gauge(name: string, description: string): SimpleGauge; /** * @param {string} name * @param {string} description * @param {(string)[]} labels * @returns {MultiGauge} */ export function create_multi_gauge(name: string, description: string, labels: (string)[]): MultiGauge; /** * @param {string} name * @param {string} description * @returns {SimpleHistogram} */ export function create_histogram(name: string, description: string): SimpleHistogram; /** * @param {string} name * @param {string} description * @param {Float64Array} buckets * @returns {SimpleHistogram} */ export function create_histogram_with_buckets(name: string, description: string, buckets: Float64Array): SimpleHistogram; /** * @param {string} name * @param {string} description * @param {(string)[]} labels * @returns {MultiHistogram} */ export function create_multi_histogram(name: string, description: string, labels: (string)[]): MultiHistogram; /** * @param {string} name * @param {string} description * @param {Float64Array} buckets * @param {(string)[]} labels * @returns {MultiHistogram} */ export function create_multi_histogram_with_buckets(name: string, description: string, buckets: Float64Array, labels: (string)[]): MultiHistogram; /** * @param {Uint8Array} key * @param {Uint8Array} data * @returns {Uint8Array} */ export function calculate_mac(key: Uint8Array, data: Uint8Array): Uint8Array; /** * @param {Uint8Array} secret * @param {Uint8Array} data * @returns {Uint8Array} */ export function create_tagged_mac(secret: Uint8Array, data: Uint8Array): Uint8Array; /** * @returns {number} */ export function random_float(): number; /** * @param {bigint} bound * @returns {bigint} */ export function random_bounded_integer(bound: bigint): bigint; /** * @param {bigint} start * @param {bigint | undefined} end * @returns {bigint} */ export function random_integer(start: bigint, end?: bigint): bigint; /** * @param {Uint8Array} buffer * @param {number} from * @param {number} len */ export function random_fill(buffer: Uint8Array, from: number, len: number): void; /** * @param {Uint8Array} seed * @param {number} iterations * @param {number} step_size * @returns {IteratedHash} */ export function iterate_hash(seed: Uint8Array, iterations: number, step_size: number): IteratedHash; /** * @param {Uint8Array} hash_value * @param {Function} hints * @param {number} max_iterations * @param {number} step_size * @param {number | undefined} index_hint * @returns {Intermediate} */ export function recover_iterated_hash(hash_value: Uint8Array, hints: Function, max_iterations: number, step_size: number, index_hint?: number): Intermediate; /** */ export function core_crypto_set_panic_hook(): void; /** * @param {Uint8Array} secret * @returns {Uint8Array} */ export function derive_packet_tag(secret: Uint8Array): Uint8Array; /** * @param {Uint8Array} private_key * @param {Uint8Array} channel_info * @returns {Uint8Array} */ export function derive_commitment_seed(private_key: Uint8Array, channel_info: Uint8Array): Uint8Array; /** * @param {Uint8Array} secret * @returns {Uint8Array} */ export function derive_mac_key(secret: Uint8Array): Uint8Array; /** * Reads the given package.json file and determines its version. * @param {string} package_file * @returns {string} */ export function get_package_version(package_file: string): string; /** */ export function utils_misc_set_panic_hook(): void; /** * Dummy function to test WASM. * @returns {string} */ export function dummy_get_one(): string; /** */ export function utils_types_set_panic_hook(): void; /** */ export function utils_log_set_panic_hook(): void; /** */ export enum PeerOrigin { Initialization = 0, NetworkRegistry = 1, IncomingConnection = 2, OutgoingConnection = 3, StrategyExistingChannel = 4, StrategyConsideringChannel = 5, StrategyNewChannel = 6, ManualPing = 7, Testing = 8, } /** */ export enum Health { /** * Unknown health, on application startup */ Unknown = 0, /** * No connection, default */ Red = 1, /** * Low quality connection to at least 1 public relay */ Orange = 2, /** * High quality connection to at least 1 public relay */ Yellow = 3, /** * High quality connection to at least 1 public relay and 1 NAT node */ Green = 4, } /** * Represents a type of the balance: native or HOPR tokens. */ export enum BalanceType { Native = 0, HOPR = 1, } /** * Represents an Ethereum address */ export class Address { free(): void; /** * @param {Uint8Array} bytes */ constructor(bytes: Uint8Array); /** * @returns {string} */ to_string(): string; /** * @param {Uint8Array} data * @returns {Address} */ static deserialize(data: Uint8Array): Address; /** * @returns {string} */ to_hex(): string; /** * @returns {Uint8Array} */ serialize(): Uint8Array; /** * @param {Address} other * @returns {boolean} */ eq(other: Address): boolean; /** * @returns {number} */ static size(): number; } /** * Helper struct to export Rust Streams into Javascript AsyncIterables * * ``` * use futures::stream::{Stream, StreamExt}; * use wasm_bindgen::prelude::*; * use wasm_bindgen_futures::stream::JsStream; * use js_sys::AsyncIterator; * use utils_misc::async_iterable::wasm::to_box_u8_stream; * * #[wasm_bindgen] * pub struct AsyncIterableHelper { * stream: Box, String>> + Unpin>, // must not be pub * } * #[wasm_bindgen] * pub fn async_test(some_async_iterable: AsyncIterator) -> Result { * let stream = JsStream::from(some_async_iterable); * * let stream = stream.map(to_box_u8_stream); * * Ok(AsyncIterableHelper { * stream: Box::new(stream), * }) * } * ``` */ export class AsyncIterableHelper { free(): void; /** * @returns {Promise} */ next(): Promise; } /** */ export class AsyncIterableHelperCoreHeartbeat { free(): void; /** * @returns {Promise} */ next(): Promise; } /** * Represents balance of some coin or token. */ export class Balance { free(): void; /** * @param {string} value * @param {number} balance_type */ constructor(value: string, balance_type: number); /** * Retrieves the type (symbol) of the balance * @returns {number} */ balance_type(): number; /** * @returns {string} */ to_hex(): string; /** * @returns {string} */ to_string(): string; /** * Serializes just the value of the balance (not the symbol) * @returns {Uint8Array} */ serialize_value(): Uint8Array; /** * @param {Balance} other * @returns {boolean} */ lt(other: Balance): boolean; /** * @param {Balance} other * @returns {boolean} */ lte(other: Balance): boolean; /** * @param {Balance} other * @returns {boolean} */ gt(other: Balance): boolean; /** * @param {Balance} other * @returns {boolean} */ gte(other: Balance): boolean; /** * @param {Balance} other * @returns {Balance} */ add(other: Balance): Balance; /** * @param {bigint} amount * @returns {Balance} */ iadd(amount: bigint): Balance; /** * @param {Balance} other * @returns {Balance} */ sub(other: Balance): Balance; /** * @param {bigint} amount * @returns {Balance} */ isub(amount: bigint): Balance; /** * @param {Uint8Array} data * @param {number} balance_type * @returns {Balance} */ static deserialize(data: Uint8Array, balance_type: number): Balance; /** * @param {Balance} other * @returns {boolean} */ eq(other: Balance): boolean; } /** * Natural extension of the Curve Point to the PoR challenge */ export class Challenge { free(): void; /** * @returns {EthereumChallenge} */ to_ethereum_challenge(): EthereumChallenge; /** * @param {HalfKeyChallenge} own_share * @param {HalfKeyChallenge} hint * @returns {Challenge} */ static from_hint_and_share(own_share: HalfKeyChallenge, hint: HalfKeyChallenge): Challenge; /** * @param {HalfKeyChallenge} own_share * @param {HalfKey} half_key * @returns {Challenge} */ static from_own_share_and_half_key(own_share: HalfKeyChallenge, half_key: HalfKey): Challenge; /** */ curve_point: CurvePoint; } /** * Represent an uncompressed elliptic curve point on the secp256k1 curve */ export class CurvePoint { free(): void; /** * @returns {Address} */ to_address(): Address; /** * @param {Uint8Array} exponent * @returns {CurvePoint} */ static from_exponent(exponent: Uint8Array): CurvePoint; /** * @param {string} str * @returns {CurvePoint} */ static from_str(str: string): CurvePoint; /** * @param {string} peer_id * @returns {CurvePoint} */ static from_peerid_str(peer_id: string): CurvePoint; /** * @returns {string} */ to_peerid_str(): string; /** * @param {Uint8Array} bytes * @returns {CurvePoint} */ static deserialize(bytes: Uint8Array): CurvePoint; /** * @returns {string} */ to_hex(): string; /** * @returns {Uint8Array} */ serialize(): Uint8Array; /** * @param {CurvePoint} other * @returns {boolean} */ eq(other: CurvePoint): boolean; /** * @returns {number} */ static size(): number; } /** * Represents and Ethereum challenge. */ export class EthereumChallenge { free(): void; /** * @param {Uint8Array} data */ constructor(data: Uint8Array); /** * @param {Uint8Array} data * @returns {EthereumChallenge} */ static deserialize(data: Uint8Array): EthereumChallenge; /** * @returns {Uint8Array} */ serialize(): Uint8Array; /** * @returns {string} */ to_hex(): string; /** * @param {EthereumChallenge} other * @returns {boolean} */ eq(other: EthereumChallenge): boolean; /** * @returns {number} */ static size(): number; } /** */ export class GroupElement { free(): void; /** * @returns {GroupElement} */ static random(): GroupElement; /** * @returns {Uint8Array} */ coefficient(): Uint8Array; /** * @returns {CurvePoint} */ element(): CurvePoint; } /** * Represents a half-key used for Proof of Relay */ export class HalfKey { free(): void; /** * @param {Uint8Array} half_key */ constructor(half_key: Uint8Array); /** * @param {Uint8Array} data * @returns {HalfKey} */ static deserialize(data: Uint8Array): HalfKey; /** * @returns {string} */ to_hex(): string; /** * @returns {Uint8Array} */ serialize(): Uint8Array; /** * @returns {HalfKey} */ clone(): HalfKey; /** * @param {HalfKey} other * @returns {boolean} */ eq(other: HalfKey): boolean; /** * @returns {number} */ static size(): number; } /** * Represents a challange for the half-key in Proof of Relay */ export class HalfKeyChallenge { free(): void; /** * @param {Uint8Array} half_key_challenge */ constructor(half_key_challenge: Uint8Array); /** * @returns {Address} */ to_address(): Address; /** * @returns {string} */ to_hex(): string; /** * @param {HalfKeyChallenge} other * @returns {boolean} */ eq(other: HalfKeyChallenge): boolean; /** * @returns {HalfKeyChallenge} */ clone(): HalfKeyChallenge; /** * @returns {string} */ to_peerid_str(): string; /** * @param {Uint8Array} data * @returns {HalfKeyChallenge} */ static deserialize(data: Uint8Array): HalfKeyChallenge; /** * @param {string} str * @returns {HalfKeyChallenge} */ static from_str(str: string): HalfKeyChallenge; /** * @param {string} peer_id * @returns {HalfKeyChallenge} */ static from_peerid_str(peer_id: string): HalfKeyChallenge; /** * @returns {number} */ static size(): number; } /** * Represents a 256-bit hash value * This implementation instantiates the hash via Keccak256 digest. */ export class Hash { free(): void; /** * @param {Uint8Array} hash */ constructor(hash: Uint8Array); /** * @param {(Uint8Array)[]} inputs * @returns {Hash} */ static create(inputs: (Uint8Array)[]): Hash; /** * @param {Uint8Array} data * @returns {Hash} */ static deserialize(data: Uint8Array): Hash; /** * @returns {string} */ to_hex(): string; /** * @returns {Uint8Array} */ serialize(): Uint8Array; /** * @param {Hash} other * @returns {boolean} */ eq(other: Hash): boolean; /** * @returns {number} */ static size(): number; } /** * Configuration of the Heartbeat */ export class HeartbeatConfig { free(): void; /** * @param {number} max_parallel_heartbeats * @param {number} heartbeat_variance * @param {number} heartbeat_interval * @param {bigint} heartbeat_threshold * @returns {HeartbeatConfig} */ static build(max_parallel_heartbeats: number, heartbeat_variance: number, heartbeat_interval: number, heartbeat_threshold: bigint): HeartbeatConfig; /** */ heartbeat_interval: number; /** */ heartbeat_threshold: bigint; /** */ heartbeat_variance: number; /** */ max_parallel_heartbeats: number; } /** * Contains the intermediate result in the hash iteration progression */ export class Intermediate { free(): void; /** */ intermediate: Uint8Array; /** */ iteration: number; } /** */ export class IteratedHash { free(): void; /** * @returns {Uint8Array} */ hash(): Uint8Array; /** * @returns {number} */ count_intermediates(): number; /** * @param {number} index * @returns {Intermediate | undefined} */ intermediate(index: number): Intermediate | undefined; } /** */ export class IteratorResult { free(): void; } /** * Represents a vector of named monotonic unsigned integer counters. * Wrapper for IntCounterVec type */ export class MultiCounter { free(): void; /** * Returns the name of the counter vector given at construction. * @returns {string} */ name(): string; /** * @param {(string)[]} label_values * @param {bigint} by */ increment_by(label_values: (string)[], by: bigint): void; /** * @param {(string)[]} label_values */ increment(label_values: (string)[]): void; /** * @param {(string)[]} label_values * @returns {bigint} */ get(label_values: (string)[]): bigint; } /** * Represents a vector of gauges with floating point values. * Wrapper for GaugeVec type */ export class MultiGauge { free(): void; /** * Returns the name of the gauge vector given at construction. * @returns {string} */ name(): string; /** * @param {(string)[]} label_values * @param {number} by */ increment_by(label_values: (string)[], by: number): void; /** * @param {(string)[]} label_values */ increment(label_values: (string)[]): void; /** * @param {(string)[]} label_values * @param {number} by */ decrement_by(label_values: (string)[], by: number): void; /** * @param {(string)[]} label_values */ decrement(label_values: (string)[]): void; /** * @param {(string)[]} label_values * @param {number} value */ set(label_values: (string)[], value: number): void; /** * @param {(string)[]} label_values * @returns {number} */ get(label_values: (string)[]): number; } /** * Represents a vector of histograms with floating point values. * Wrapper for HistogramVec type */ export class MultiHistogram { free(): void; /** * Stops the given timer and records the elapsed duration in seconds to the multi-histogram. * @param {SimpleTimer} timer */ record_measure(timer: SimpleTimer): void; /** * Stops the given timer and discards the measured duration in seconds and returns it. * @param {SimpleTimer} timer * @returns {number} */ cancel_measure(timer: SimpleTimer): number; /** * Returns the name of the histogram given at construction. * @returns {string} */ name(): string; /** * @param {(string)[]} label_values * @param {number} value */ observe(label_values: (string)[], value: number): void; /** * @param {(string)[]} label_values * @returns {SimpleTimer} */ start_measure(label_values: (string)[]): SimpleTimer; /** * @param {(string)[]} label_values * @returns {bigint} */ get_sample_count(label_values: (string)[]): bigint; /** * @param {(string)[]} label_values * @returns {number} */ get_sample_sum(label_values: (string)[]): number; } /** */ export class Network { free(): void; /** * Total count of the peers observed withing the network * @returns {number} */ length(): number; /** * Returns the quality of the network as a network health indicator. * @returns {number} */ health(): number; /** * @returns {string} */ debug_output(): string; /** * @param {string} me * @param {number} quality_threshold * @param {Function} on_peer_offline * @param {Function} on_network_health_change * @param {Function} is_public * @param {Function} close_connection * @returns {Network} */ static build(me: string, quality_threshold: number, on_peer_offline: Function, on_network_health_change: Function, is_public: Function, close_connection: Function): Network; /** * @param {bigint} threshold * @returns {(string)[]} */ peers_to_ping(threshold: bigint): (string)[]; /** * @param {string} peer * @returns {boolean} */ contains(peer: string): boolean; /** * @param {string} peer * @param {number} origin */ register(peer: string, origin: number): void; /** * @param {string} peer * @param {number} origin * @param {Map} metadata */ register_with_metadata(peer: string, origin: number, metadata: Map): void; /** * @param {string} peer */ unregister(peer: string): void; /** * @param {string} peer * @param {any} timestamp */ refresh(peer: string, timestamp: any): void; /** * @param {string} peer * @param {any} timestamp * @param {Map} metadata */ refresh_with_metadata(peer: string, timestamp: any, metadata: Map): void; /** * @param {string} peer * @returns {number} */ quality_of(peer: string): number; /** * @returns {(string)[]} */ all(): (string)[]; /** * @param {string} peer * @returns {PeerStatus | undefined} */ get_peer_info(peer: string): PeerStatus | undefined; } /** */ export class NetworkConfig { free(): void; } /** * Pseudo-Random Generator (PRG) function that is instantiated * using AES-128 block cipher in Counter mode (with 32-bit counter). * It forms an infinite sequence of pseudo-random bytes (generated deterministically from the parameters) * and can be queried by chunks using the `digest` function. */ export class PRG { free(): void; /** * Creates a PRG instance using the raw key and IV for the underlying block cipher. * @param {Uint8Array} key * @param {Uint8Array} iv */ constructor(key: Uint8Array, iv: Uint8Array); /** * Creates a new PRG instance using the given parameters * @param {PRGParameters} params * @returns {PRG} */ static from_parameters(params: PRGParameters): PRG; /** * @param {number} from * @param {number} to * @returns {Uint8Array} */ digest(from: number, to: number): Uint8Array; } /** * Parameters for the Pseudo-Random Generator (PRG) function * This consists of IV and the raw secret key for use by the underlying block cipher. */ export class PRGParameters { free(): void; /** * Creates new parameters for the PRG by expanding the given * keying material into the secret key and IV for the underlying block cipher. * @param {Uint8Array} secret */ constructor(secret: Uint8Array); /** * @returns {Uint8Array} */ key(): Uint8Array; /** * @returns {Uint8Array} */ iv(): Uint8Array; } /** * Implementation of Pseudo-Random Permutation (PRP). * Currently based on the Lioness wide-block cipher. */ export class PRP { free(): void; /** * @param {Uint8Array} plaintext * @returns {Uint8Array} */ forward(plaintext: Uint8Array): Uint8Array; /** * @param {Uint8Array} ciphertext * @returns {Uint8Array} */ inverse(ciphertext: Uint8Array): Uint8Array; /** * Creates new instance of the PRP using the raw key and IV. * @param {Uint8Array} key * @param {Uint8Array} iv * @returns {PRP} */ static new(key: Uint8Array, iv: Uint8Array): PRP; /** * Creates a new PRP instance using the given parameters * @param {PRPParameters} params */ constructor(params: PRPParameters); } /** * Parameters for the Pseudo-Random Permutation (PRP) function * This consists of IV and the raw secret key for use by the underlying cryptographic transformation. */ export class PRPParameters { free(): void; /** * @returns {Uint8Array} */ key(): Uint8Array; /** * @returns {Uint8Array} */ iv(): Uint8Array; /** * Creates new parameters for the PRP by expanding the given * keying material into the secret key and IV for the underlying cryptographic transformation. * @param {Uint8Array} secret */ constructor(secret: Uint8Array); } /** */ export class PeerStatus { free(): void; /** * @returns {string} */ peer_id(): string; /** * @returns {Map} */ metadata(): Map; /** * @param {string} peer * @param {number} origin * @param {boolean} is_public * @param {bigint} last_seen * @param {number} quality * @param {bigint} heartbeats_sent * @param {bigint} heartbeats_succeeded * @param {number} backoff * @param {Map} peer_metadata * @returns {PeerStatus} */ static build(peer: string, origin: number, is_public: boolean, last_seen: bigint, quality: number, heartbeats_sent: bigint, heartbeats_succeeded: bigint, backoff: number, peer_metadata: Map): PeerStatus; /** */ backoff: number; /** */ heartbeats_sent: bigint; /** */ heartbeats_succeeded: bigint; /** */ is_public: boolean; /** */ last_seen: bigint; /** */ origin: number; /** */ quality: number; } /** */ export class Ping { free(): void; } /** * WASM wrapper for the Ping that accepts a JS function for sending a ping message and returing * a Future for the peer reply. */ export class Pinger { free(): void; /** * @param {string} environment_id * @param {string} version * @param {Function} on_finished_ping_cb * @param {Function} send_msg_cb * @returns {Pinger} */ static build(environment_id: string, version: string, on_finished_ping_cb: Function, send_msg_cb: Function): Pinger; /** * Ping the peers represented as a Vec values that are converted into usable * PeerIds. * * # Arguments * * `peers` - Vector of String representations of the PeerIds to be pinged. * @param {(string)[]} peers * @returns {Promise} */ ping(peers: (string)[]): Promise; } /** * Represents a secp256k1 public key. * This is a "Schrödinger public key", both compressed and uncompressed to save some cycles. */ export class PublicKey { free(): void; /** * @returns {Address} */ to_address(): Address; /** * @param {boolean} compressed * @returns {Uint8Array} */ serialize(compressed: boolean): Uint8Array; /** * @param {boolean} compressed * @returns {string} */ to_hex(compressed: boolean): string; /** * @param {Uint8Array} bytes * @returns {PublicKey} */ static deserialize(bytes: Uint8Array): PublicKey; /** * @param {string} peer_id * @returns {PublicKey} */ static from_peerid_str(peer_id: string): PublicKey; /** * @returns {string} */ to_peerid_str(): string; /** * @param {Uint8Array} hash * @param {Uint8Array} r * @param {Uint8Array} s * @param {number} v * @returns {PublicKey} */ static from_signature(hash: Uint8Array, r: Uint8Array, s: Uint8Array, v: number): PublicKey; /** * @param {Uint8Array} private_key * @returns {PublicKey} */ static from_privkey(private_key: Uint8Array): PublicKey; /** * @param {PublicKey} other * @returns {boolean} */ eq(other: PublicKey): boolean; /** * @returns {number} */ static size_compressed(): number; /** * @returns {number} */ static size_uncompressed(): number; } /** * Structure containing shared keys for peers. * The members are exposed only using specialized methods. */ export class SharedKeys { free(): void; /** * Get the `alpha` value of the derived shared secrets. * @returns {Uint8Array} */ get_alpha(): Uint8Array; /** * Gets the shared secret of the peer on the given index. * The indices are assigned in the same order as they were given to the * [`generate`] function. * @param {number} peer_idx * @returns {Uint8Array | undefined} */ get_peer_shared_key(peer_idx: number): Uint8Array | undefined; /** * Returns the number of shared keys generated in this structure. * @returns {number} */ count_shared_keys(): number; /** * @param {Uint8Array} alpha * @param {Uint8Array} public_key * @param {Uint8Array} private_key * @returns {SharedKeys} */ static forward_transform(alpha: Uint8Array, public_key: Uint8Array, private_key: Uint8Array): SharedKeys; /** * Generate shared keys given the peer public keys * @param {(Uint8Array)[]} peer_public_keys * @returns {SharedKeys} */ static generate(peer_public_keys: (Uint8Array)[]): SharedKeys; } /** * Represents an ECDSA signature based on the secp256k1 curve with recoverable public key. * This signature encodes the 2-bit recovery information into the * upper-most bits of MSB of the S value, which are never used by this ECDSA * instantiation over secp256k1. */ export class Signature { free(): void; /** * @param {Uint8Array} raw_bytes * @param {number} recovery */ constructor(raw_bytes: Uint8Array, recovery: number); /** * Signs the given message using the raw private key. * @param {Uint8Array} message * @param {Uint8Array} private_key * @returns {Signature} */ static sign_message(message: Uint8Array, private_key: Uint8Array): Signature; /** * Signs the given hash using the raw private key. * @param {Uint8Array} hash * @param {Uint8Array} private_key * @returns {Signature} */ static sign_hash(hash: Uint8Array, private_key: Uint8Array): Signature; /** * Verifies this signature against the given message and a public key (compressed or uncompressed) * @param {Uint8Array} message * @param {Uint8Array} public_key * @returns {boolean} */ verify_message(message: Uint8Array, public_key: Uint8Array): boolean; /** * Verifies this signature against the given message and a public key object * @param {Uint8Array} message * @param {PublicKey} public_key * @returns {boolean} */ verify_message_with_pubkey(message: Uint8Array, public_key: PublicKey): boolean; /** * Verifies this signature against the given hash and a public key (compressed or uncompressed) * @param {Uint8Array} hash * @param {Uint8Array} public_key * @returns {boolean} */ verify_hash(hash: Uint8Array, public_key: Uint8Array): boolean; /** * Verifies this signature against the given message and a public key object * @param {Uint8Array} message * @param {PublicKey} public_key * @returns {boolean} */ verify_hash_with_pubkey(message: Uint8Array, public_key: PublicKey): boolean; /** * @returns {Uint8Array} */ raw_signature(): Uint8Array; /** * @param {Uint8Array} signature * @returns {Signature} */ static deserialize(signature: Uint8Array): Signature; /** * @returns {string} */ to_hex(): string; /** * @returns {Uint8Array} */ serialize(): Uint8Array; /** * @returns {number} */ static size(): number; } /** * Represents a simple monotonic unsigned integer counter. * Wrapper for IntCounter type */ export class SimpleCounter { free(): void; /** * Retrieves the value of the counter * @returns {bigint} */ get(): bigint; /** * Increments the counter by the given number. * @param {bigint} by */ increment_by(by: bigint): void; /** * Increments the counter by 1 */ increment(): void; /** * Returns the name of the counter given at construction. * @returns {string} */ name(): string; } /** * Represents a simple gauge with floating point values. * Wrapper for Gauge type */ export class SimpleGauge { free(): void; /** * Increments the gauge by the given value. * @param {number} by */ increment(by: number): void; /** * Decrements the gauge by the given value. * @param {number} by */ decrement(by: number): void; /** * Sets the gauge to the given value. * @param {number} value */ set(value: number): void; /** * Retrieves the value of the gauge * @returns {number} */ get(): number; /** * Returns the name of the gauge given at construction. * @returns {string} */ name(): string; } /** * Represents a histogram with floating point values. * Wrapper for Histogram type */ export class SimpleHistogram { free(): void; /** * Records a value observation to the histogram. * @param {number} value */ observe(value: number): void; /** * Stops the given timer and records the elapsed duration in seconds to the histogram. * @param {SimpleTimer} timer */ record_measure(timer: SimpleTimer): void; /** * Stops the given timer and discards the measured duration in seconds and returns it. * @param {SimpleTimer} timer * @returns {number} */ cancel_measure(timer: SimpleTimer): number; /** * Get all samples count * @returns {bigint} */ get_sample_count(): bigint; /** * Get all samples sum * @returns {number} */ get_sample_sum(): number; /** * Returns the name of the histogram given at construction. * @returns {string} */ name(): string; /** * @returns {SimpleTimer} */ start_measure(): SimpleTimer; } /** * Represents a timer handle. */ export class SimpleTimer { free(): void; } /** * Represents a snapshot in the blockchain */ export class Snapshot { free(): void; /** * @param {U256} block_number * @param {U256} transaction_index * @param {U256} log_index */ constructor(block_number: U256, transaction_index: U256, log_index: U256); /** * @param {Uint8Array} data * @returns {Snapshot} */ static deserialize(data: Uint8Array): Snapshot; /** * @returns {Uint8Array} */ serialize(): Uint8Array; /** * @returns {number} */ static size(): number; /** */ block_number: U256; /** */ log_index: U256; /** */ transaction_index: U256; } /** * Represents the Ethereum's basic numeric type - unsigned 256-bit integer */ export class U256 { free(): void; /** * @param {string} value */ constructor(value: string); /** * @param {Uint8Array} data * @returns {U256} */ static deserialize(data: Uint8Array): U256; /** * @returns {Uint8Array} */ serialize(): Uint8Array; /** * @returns {string} */ to_hex(): string; /** * @param {U256} inverse_prob * @returns {U256} */ static from_inverse_probability(inverse_prob: U256): U256; /** * @param {U256} other * @returns {boolean} */ eq(other: U256): boolean; /** * @param {U256} other * @returns {number} */ cmp(other: U256): number; } /** */ export class WasmNetworkApi { free(): void; } /** */ export class WasmPingApi { free(): void; }