import { ContractTransaction, Overrides } from 'ethers'; import { BigNumber } from '@ethersproject/bignumber'; import { TransactionReceipt } from '@ethersproject/abstract-provider'; import * as core from '@nomad-xyz/contracts-core'; import { NomadContext } from '..'; import { MessageProof } from '../NomadContext'; import { Dispatch, ParsedMessage, MessageStatus, ReplicaMessageStatus } from './types'; import { MessageBackend } from '../messageBackend'; /** * Parse a serialized Nomad message from raw bytes. * * @param message * @returns */ export declare function parseMessage(message: string): ParsedMessage; /** * A deserialized Nomad message. */ export declare class NomadMessage { readonly dispatch: Dispatch; readonly message: ParsedMessage; readonly home: core.Home; readonly replica: core.Replica; readonly context: T; protected _confirmAt?: Date; readonly _backend?: MessageBackend; constructor(context: T, dispatch: Dispatch, _backend?: MessageBackend); get backend(): MessageBackend; get messageHash(): string; /** * Instantiate one or more messages from a receipt. * * @param context the {@link NomadContext} object to use * @param receipt the receipt * @returns an array of {@link NomadMessage} objects */ static baseFromReceipt(context: T, receipt: TransactionReceipt): Promise[]>; /** * Instantiate EXACTLY one message from a receipt. * * @param context the {@link NomadContext} object to use * @param receipt the receipt * @returns an array of {@link NomadMessage} objects * @throws if there is not EXACTLY 1 dispatch in the receipt */ static baseSingleFromReceipt(context: T, receipt: TransactionReceipt): Promise>; /** * Instantiate one or more messages from a tx hash. * * @param context the {@link NomadContext} object to use * @param nameOrDomain the domain on which the receipt was logged * @param transactionHash the transaction hash on the origin chain * @returns an array of {@link NomadMessage} objects * @throws if there is no receipt for the TX */ static baseFromTransactionHash(context: T, nameOrDomain: string | number, transactionHash: string): Promise[]>; /** * Instantiate EXACTLY one message from a transaction has. * * @param context the {@link NomadContext} object to use * @param nameOrDomain the domain on which the receipt was logged * @param transactionHash the transaction hash on the origin chain * @returns an array of {@link NomadMessage} objects * @throws if there is no receipt for the TX, or if not EXACTLY 1 dispatch in * the receipt */ static baseSingleFromTransactionHash(context: T, nameOrDomain: string | number, transactionHash: string): Promise>; static baseFirstFromBackend(context: T, transactionHash: string): Promise>; static baseFromMessageHash(context: T, messageHash: string): Promise>; /** * Get the `Relay` event associated with this message (if any) * * @returns An relay tx (if any) */ getRelay(): Promise; /** * Get the `Update` event associated with this message (if any) * * @returns An update tx (if any) */ getUpdate(): Promise; /** * Get the Replica `Process` event associated with this message (if any) * * @returns An process tx (if any) */ getProcess(): Promise; /** * Returns the timestamp after which it is possible to process this message. * * Note: return the timestamp after which it is possible to process messages * within an Update. The timestamp is most relevant during the time AFTER the * Update has been Relayed to the Replica and BEFORE the message in question * has been Processed. * * Considerations: * - the timestamp will be 0 if the Update has not been relayed to the Replica * - after the Update has been relayed to the Replica, the timestamp will be * non-zero forever (even after all messages in the Update have been * processed) * - if the timestamp is in the future, the challenge period has not elapsed * yet; messages in the Update cannot be processed yet * - if the timestamp is in the past, this does not necessarily mean that all * messages in the Update have been processed * * @returns The timestamp at which a message can confirm */ /** * Calculates an expected confirmation timestamp from relayed event * * @returns Timestamp (if any) */ confirmAt(messageHash: string): Promise; process(overrides?: Overrides): Promise; /** * Retrieve the replica status of this message. * * @returns The {@link ReplicaMessageStatus} corresponding to the solidity * status of the message. */ replicaStatus(): Promise; /** * Checks whether the message has been delivered. * * @returns true if processed, else false. */ delivered(): Promise; /** * Returns a promise that resolves when the message has been delivered. * * WARNING: May never resolve. Oftern takes hours to resolve. * * @param opts Polling options. */ wait(opts?: { pollTime?: number; }): Promise; /** * Get the status of a message * * 0 = dispatched * 1 = included * 2 = relayed * 3 = updated * 4 = received * 5 = processed * * @returns An record of all events and correlating txs */ status(): Promise; /** * The domain from which the message was sent */ get from(): number; /** * The domain from which the message was sent. Alias for `from` */ get origin(): number; /** * The name of the domain from which the message was sent */ get originName(): string; /** * Get the name of this file in the s3 bucket */ get s3Name(): string; /** * Get the URI for the proof in S3 */ get s3Uri(): string | undefined; /** * The identifier for the sender of this message */ get sender(): string; /** * The domain nonce for this message */ get nonce(): number; /** * The destination domain for this message */ get destination(): number; /** * The identifer for the recipient for this message */ get recipient(): string; /** * The message body */ get body(): string; /** * The keccak256 hash of the message body */ get bodyHash(): string; /** * The hash of the transaction that dispatched this message */ get transactionHash(): string; /** * The messageHash committed to the tree in the Home contract. */ get leaf(): string; /** * The index of the leaf in the contract. */ get leafIndex(): BigNumber; /** * The destination and nonceof this message. */ get destinationAndNonce(): BigNumber; /** * The committed root when this message was dispatched. */ get committedRoot(): string; /** * Get the proof associated with this message * * @returns a proof, or undefined if no proof available * @throws if s3 is not configured for this env */ getProof(): Promise; } //# sourceMappingURL=NomadMessage.d.ts.map