import { BigNumber } from '@ethersproject/bignumber'; import { TransactionReceipt } from '@ethersproject/abstract-provider'; import { xapps } from 'optics-ts-interface'; import { BridgeContracts, OpticsContext } from '..'; import { ResolvedTokenInfo, TokenIdentifier } from '../tokens'; import { OpticsMessage } from './OpticsMessage'; import { AnnotatedDispatch } from '../events/opticsEvents'; declare type Transfer = { type: 'transfer'; to: string; amount: BigNumber; }; export declare type Details = { type: 'details'; name: string; symbol: string; decimals: number; }; export declare type RequestDetails = { type: 'requestDetails'; }; export declare type Action = Transfer | Details | RequestDetails; export declare type ParsedBridgeMessage = { token: TokenIdentifier; action: T; }; export declare type AnyBridgeMessage = TransferMessage | DetailsMessage | RequestDetailsMessage; export declare type ParsedTransferMessage = ParsedBridgeMessage; export declare type ParsedDetailsMessage = ParsedBridgeMessage
; export declare type ParsedRequestDetailsMesasage = ParsedBridgeMessage; /** * The BridgeMessage extends {@link OpticsMessage} with Bridge-specific * functionality. */ declare class BridgeMessage extends OpticsMessage { readonly token: TokenIdentifier; readonly fromBridge: BridgeContracts; readonly toBridge: BridgeContracts; /** * @hideconstructor */ constructor(context: OpticsContext, event: AnnotatedDispatch, token: TokenIdentifier, callerKnowsWhatTheyAreDoing: boolean); /** * Attempt to instantiate a BridgeMessage from an existing * {@link OpticsMessage} * * @param context The {@link OpticsContext} to use. * @param opticsMessage The existing OpticsMessage * @returns A Bridge message * @throws if the message cannot be parsed as a bridge message */ static fromOpticsMessage(context: OpticsContext, opticsMessage: OpticsMessage): AnyBridgeMessage; /** * Attempt to instantiate some BridgeMessages from a transaction receipt * * @param context The {@link OpticsContext} to use. * @param nameOrDomain the domain on which the receipt was logged * @param receipt The receipt * @returns an array of {@link BridgeMessage} objects * @throws if any message cannot be parsed as a bridge message */ static fromReceipt(context: OpticsContext, nameOrDomain: string | number, receipt: TransactionReceipt): AnyBridgeMessage[]; /** * Attempt to instantiate EXACTLY one BridgeMessage from a transaction receipt * * @param context The {@link OpticsContext} to use. * @param nameOrDomain the domain on which the receipt was logged * @param receipt The receipt * @returns an array of {@link BridgeMessage} objects * @throws if any message cannot be parsed as a bridge message, or if there * is not EXACTLY 1 BridgeMessage in the receipt */ static singleFromReceipt(context: OpticsContext, nameOrDomain: string | number, receipt: TransactionReceipt): AnyBridgeMessage; /** * Attempt to instantiate some BridgeMessages from a transaction hash by * retrieving and parsing the receipt. * * @param context The {@link OpticsContext} to use. * @param nameOrDomain the domain on which the receipt was logged * @param transactionHash The transaction hash * @returns an array of {@link BridgeMessage} objects * @throws if any message cannot be parsed as a bridge message */ static fromTransactionHash(context: OpticsContext, nameOrDomain: string | number, transactionHash: string): Promise; /** * Attempt to instantiate EXACTLY one BridgeMessages from a transaction hash * by retrieving and parsing the receipt. * * @param context The {@link OpticsContext} to use. * @param nameOrDomain the domain on which the receipt was logged * @param transactionHash The transaction hash * @returns an array of {@link BridgeMessage} objects * @throws if any message cannot be parsed as a bridge message, or if there is * not EXACTLY one such message */ static singleFromTransactionHash(context: OpticsContext, nameOrDomain: string | number, transactionHash: string): Promise; /** * Resolves the asset that is being transfered * * WARNING: do not hold references to these contract, as they will not be * reconnected in the event the chain connection changes. * * @returns The resolved token information. */ asset(): Promise; /** * Resolves an interface for the asset that is being transfered on the chain * FROM WHICH it is being transferred * * WARNING: do not hold references to this contract, as it will not be * reconnected in the event the chain connection changes. * * @returns The resolved token interface. */ assetAtOrigin(): Promise; /** * Resolves an interface for the asset that is being transfered on the chain * TO WHICH it is being transferred * * WARNING: do not hold references to this contract, as it will not be * reconnected in the event the chain connection changes. * * @returns The resolved token interface. */ assetAtDestination(): Promise; } /** * A TransferMessage extends the {@link BridgeMessage} with transfer-specific * functionality. */ export declare class TransferMessage extends BridgeMessage { action: Transfer; constructor(context: OpticsContext, event: AnnotatedDispatch, parsed: ParsedTransferMessage); /** * Check if the transfer has been prefilled using the fast liquidity system. * * @returns true if the transfer has been prefilled. Else false. */ currentlyPrefilled(): Promise; /** * The amount of tokens being transferred (in the smallest unit) */ get amount(): BigNumber; /** * The identifier for the recipient of the tokens */ get to(): string; /** * The ID used for prefilling this transfer message. */ get prefillId(): string; } /** * A DetailsMessage extends the {@link BridgeMessage} with details-specific * functionality. */ export declare class DetailsMessage extends BridgeMessage { action: Details; constructor(context: OpticsContext, event: AnnotatedDispatch, parsed: ParsedDetailsMessage); /** * Get the token name being sent */ get name(): string; /** * Get the token symbol being sent */ get symbol(): string; /** * Get the token decimals being sent */ get decimals(): number; } /** * A RequestDetailsMessage extends the {@link BridgeMessage} with * details-specific functionality. */ export declare class RequestDetailsMessage extends BridgeMessage { action: RequestDetails; constructor(context: OpticsContext, event: AnnotatedDispatch, parsed: ParsedRequestDetailsMesasage); } export {}; //# sourceMappingURL=BridgeMessage.d.ts.map