UNPKG

@gear-js/api

Version:

A JavaScript library that provides functionality to connect GEAR Component APIs.

105 lines (104 loc) 3.41 kB
import type { GearApi } from '../../GearApi'; import type { HexString, Proof } from '../../types'; import { GearEthBridgeEvents } from './events'; import { GearEthBridgeTransactions } from './tx'; /** * API for interacting with the Gear-Ethereum bridge pallet. * * Provides access to bridge state queries, transaction building, and event monitoring. * The bridge enables bidirectional message passing between Gear and Ethereum networks. */ export declare class GearEthBridge { private _api; /** Transaction building utilities for bridge operations */ readonly tx: GearEthBridgeTransactions; /** Event monitoring and filtering utilities */ readonly events: GearEthBridgeEvents; constructor(_api: GearApi); /** * Get the merkle proof for a given hash. * @param hash The hash of the message to get the merkle proof for. * @param at (optional) The block hash to query at. * @returns The merkle proof. */ merkleProof(hash: HexString | Uint8Array, at?: HexString | Uint8Array): Promise<Proof>; /** * Get the current authority set hash. * * @returns The authority set hash as a hex string * @throws {AuthoritySetHashError} When the authority set hash is not available */ authoritySetHash(): Promise<HexString>; /** * Get the current clear timer value. * * @returns The clear timer value as a number * @throws {ClearTimerError} When the clear timer is not available */ clearTimer(): Promise<number>; /** * Check if the bridge has been initialized. * * @returns True if the bridge is initialized, false otherwise */ isInitialized(): Promise<boolean>; /** * Get the current message nonce. * * @returns The current message nonce as a bigint */ getMessageNonce(): Promise<bigint>; /** * Check if the bridge is currently paused. * * When paused, the bridge will not process new messages. * * @returns True if the bridge is paused, false otherwise */ isPaused(): Promise<boolean>; /** * Get the current message queue. * * Returns an array of message hashes that are queued for processing. * * @returns Array of message hashes in the queue */ getQueue(): Promise<Array<HexString>>; /** * Check if the message queue has changed. * * @returns True if the queue has changed, false otherwise */ isQueueChanged(): Promise<boolean>; /** * Get the merkle root of the current message queue. * * @returns The queue merkle root as a hex string * @throws {GetQueueMerkleRootError} When the merkle root is not available */ getQueueMerkleRoot(): Promise<HexString>; /** * Get the current sessions timer value. * * @returns The sessions timer value as a number */ getSessionsTimer(): Promise<number>; /** * Get the maximum allowed payload size for bridge messages. * * @returns The maximum payload size in bytes */ get maxPayloadSize(): number; /** * Get the maximum capacity of the message queue. * * @returns The queue capacity as a number of messages */ get queueCapacity(): number; /** * Get the number of sessions per era. * * @returns The number of sessions per era */ get sessionsPerEra(): number; }