/* tslint:disable */ /* eslint-disable */ /** */ export function core_strategy_set_panic_hook(): void; /** * @param {Address} source * @param {Address} destination * @returns {Hash} */ export function generate_channel_id(source: Address, destination: Address): Hash; /** * @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} 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} 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; /** */ export function utils_misc_set_panic_hook(): void; /** * @param {number} status * @returns {number} */ export function channel_status_to_number(status: number): number; /** * @param {number} number * @returns {number | undefined} */ export function number_to_channel_status(number: number): number | undefined; /** * @param {number} status * @returns {string} */ export function channel_status_to_string(status: number): string; /** * Dummy function to test WASM. * @returns {string} */ export function dummy_get_one(): string; /** * 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_types_set_panic_hook(): void; /** */ export function utils_log_set_panic_hook(): void; /** */ export function core_types_set_panic_hook(): void; /** * Describes status of a channel */ export enum ChannelStatus { Closed = 0, WaitingForCommitment = 1, Open = 2, PendingToClose = 3, } /** * Represents a type of the balance: native or HOPR tokens. */ export enum BalanceType { Native = 0, HOPR = 1, } /** * Contains acknowledgment information and the respective ticket */ export class AcknowledgedTicket { free(): void; /** * @param {Ticket} ticket * @param {Response} response * @param {Hash} pre_image * @param {PublicKey} signer */ constructor(ticket: Ticket, response: Response, pre_image: Hash, signer: PublicKey); /** */ pre_image: Hash; /** */ response: Response; /** */ signer: PublicKey; /** */ ticket: Ticket; } /** * 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; } /** * 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; } /** * Overall description of a channel */ export class ChannelEntry { free(): void; /** * Generates the ticket ID using the source and destination address * @returns {Hash} */ get_id(): Hash; /** * Checks if the closure time of this channel has passed. * @returns {boolean} */ closure_time_passed(): boolean; /** * Calculates the remaining channel closure grace period. * @returns {bigint} */ remaining_closure_time(): bigint; /** * @param {PublicKey} source * @param {PublicKey} destination * @param {Balance} balance * @param {Hash} commitment * @param {U256} ticket_epoch * @param {U256} ticket_index * @param {number} status * @param {U256} channel_epoch * @param {U256} closure_time */ constructor(source: PublicKey, destination: PublicKey, balance: Balance, commitment: Hash, ticket_epoch: U256, ticket_index: U256, status: number, channel_epoch: U256, closure_time: U256); /** * @param {Uint8Array} data * @returns {ChannelEntry} */ static deserialize(data: Uint8Array): ChannelEntry; /** * @returns {Uint8Array} */ serialize(): Uint8Array; /** */ balance: Balance; /** */ channel_epoch: U256; /** */ closure_time: U256; /** */ commitment: Hash; /** */ destination: PublicKey; /** */ source: PublicKey; /** */ status: number; /** */ ticket_epoch: U256; /** */ ticket_index: U256; } /** * 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; } /** * 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; } /** * 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); } /** * Implements passive strategy which does nothing. */ export class PassiveStrategy { free(): void; /** */ constructor(); /** * @param {Balance} balance * @param {Iterator} peer_ids * @param {any} outgoing_channels * @param {Function} quality_of * @returns {StrategyTickResult} */ tick(balance: Balance, peer_ids: Iterator, outgoing_channels: any, quality_of: Function): StrategyTickResult; /** */ readonly name: string; } /** * Implements promiscuous strategy. * This strategy opens outgoing channels to peers, which have quality above a given threshold. * At the same time, it closes outgoing channels opened to peers whose quality dropped below this threshold. */ export class PromiscuousStrategy { free(): void; /** */ constructor(); /** * @param {Balance} balance * @param {Iterator} peer_ids * @param {any} outgoing_channels * @param {Function} quality_of * @returns {StrategyTickResult} */ tick(balance: Balance, peer_ids: Iterator, outgoing_channels: any, quality_of: Function): StrategyTickResult; /** * Determines if the strategy should automatically redeem tickets. * Defaults to false */ auto_redeem_tickets: boolean; /** * If set, the strategy will aggressively close channels (even with peers above the `network_quality_threshold`) * if the number of opened outgoing channels (regardless if opened by the strategy or manually) exceeds the * `max_channels` limit. * Defaults to true */ enforce_max_channels: boolean; /** * Maximum number of opened channels the strategy should maintain. * Defaults to square-root of the sampled network size. */ max_channels?: number; /** * A minimum channel token stake. If reached, the channel will be closed and re-opened with `new_channel_stake`. * Defaults to 0.01 HOPR */ minimum_channel_balance: Balance; /** * Minimum token balance of the node. When reached, the strategy will not open any new channels. * Defaults to 0.01 HOPR */ minimum_node_balance: Balance; /** */ readonly name: string; /** * A quality threshold between 0 and 1 used to determine whether the strategy should open channel with the peer. * Defaults to 0.5 */ network_quality_threshold: number; /** * A stake of tokens that should be allocated to a channel opened by the strategy. * Defaults to 0.1 HOPR */ new_channel_stake: Balance; } /** * 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; } /** * Implements random strategy (cover traffic) */ export class RandomStrategy { free(): void; /** */ constructor(); /** * @param {Balance} balance * @param {Iterator} peer_ids * @param {any} outgoing_channels * @param {Function} quality_of * @returns {StrategyTickResult} */ tick(balance: Balance, peer_ids: Iterator, outgoing_channels: any, quality_of: Function): StrategyTickResult; /** */ readonly name: string; } /** * Contains a response upon ticket acknowledgement */ export class Response { free(): void; /** * @param {Uint8Array} data */ constructor(data: Uint8Array); /** * @param {Uint8Array} data * @returns {Response} */ static deserialize(data: Uint8Array): Response; /** * @returns {Uint8Array} */ serialize(): Uint8Array; /** * @returns {string} */ to_hex(): string; /** * @returns {number} */ static size(): 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 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; } /** */ export class StrategyTickResult { free(): void; /** * @param {number} max_auto_channels * @param {any} to_open * @param {(string)[]} to_close */ constructor(max_auto_channels: number, to_open: any, to_close: (string)[]); /** * @returns {any} */ to_open(): any; /** * @returns {(string)[]} */ to_close(): (string)[]; /** */ readonly max_auto_channels: number; } /** * Contains the overall description of a ticket with a signature */ export class Ticket { free(): void; /** * Creates a new Ticket given the raw Challenge and signs it using the given key. * @param {Address} counterparty * @param {Challenge} challenge * @param {U256} epoch * @param {U256} index * @param {Balance} amount * @param {U256} win_prob * @param {U256} channel_epoch * @param {Uint8Array} signing_key * @returns {Ticket} */ static create(counterparty: Address, challenge: Challenge, epoch: U256, index: U256, amount: Balance, win_prob: U256, channel_epoch: U256, signing_key: Uint8Array): Ticket; /** * Serializes the ticket except the signature * @returns {Uint8Array} */ serialize_unsigned(): Uint8Array; /** * Computes Ethereum signature hash of the ticket * @returns {Hash} */ get_hash(): Hash; /** * Recovers the signer public key from the embedded ticket signature. * This is possible due this specific instantiation of the ECDSA over the secp256k1 curve. * @returns {PublicKey} */ recover_signer(): PublicKey; /** * Verifies the signature of this ticket * @param {PublicKey} public_key * @returns {boolean} */ verify(public_key: PublicKey): boolean; /** * Computes a candidate check value to verify if this ticket is winning * @param {Hash} preimage * @param {Response} channel_response * @returns {U256} */ get_luck(preimage: Hash, channel_response: Response): U256; /** * Decides whether a ticket is a win or not. * Note that this mimics the on-chain logic. * Purpose of the function is to check the validity of ticket before we submit it to the blockchain. * @param {Hash} preimage * @param {Response} channel_response * @param {U256} win_prob * @returns {boolean} */ is_winning(preimage: Hash, channel_response: Response, win_prob: U256): boolean; /** * Based on the price of this ticket, determines the path position (hop number) this ticket * relates to. * @param {U256} price_per_packet * @param {U256} inverse_ticket_win_prob * @returns {number} */ get_path_position(price_per_packet: U256, inverse_ticket_win_prob: U256): number; /** * @param {Address} counterparty * @param {EthereumChallenge} challenge * @param {U256} epoch * @param {U256} index * @param {Balance} amount * @param {U256} win_prob * @param {U256} channel_epoch * @param {Signature} signature */ constructor(counterparty: Address, challenge: EthereumChallenge, epoch: U256, index: U256, amount: Balance, win_prob: U256, channel_epoch: U256, signature: Signature); /** * @param {Uint8Array} bytes * @returns {Ticket} */ static deserialize(bytes: Uint8Array): Ticket; /** * @returns {Uint8Array} */ serialize(): Uint8Array; /** */ amount: Balance; /** */ challenge: EthereumChallenge; /** */ channel_epoch: U256; /** */ counterparty: Address; /** */ epoch: U256; /** */ index: U256; /** */ signature: Signature; /** */ win_prob: 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; }