import { TransactionRequest, TransactionResponse } from '@ethersproject/providers'; import { ArgsProps } from 'antd/lib/notification'; import { TEthersSigner } from 'eth-hooks/models'; import { ContractTransaction } from 'ethers'; import { Deferrable } from 'ethers/lib/utils'; import { IEthComponentsSettings } from "../models/EthComponentsSettings"; export declare class TransactorError extends Error { rawError: TRawTxError; constructor({ message, rawError }: { message?: string; rawError: TRawTxError; }); } export declare type TRawTxError = Error & { data?: { message?: string; }; body?: string; code?: string; reason?: string; transaction?: TransactionRequest; transactionHash?: string; error: Error; }; export declare type TTransactorFunc = (tx: Deferrable | Promise | Promise | undefined, callback?: ((_param: any) => void) | undefined) => Promise | undefined>; /** * The {@link NotificationMessage} type is an alias to the correct {@link ArgsProps}. * * Antd lib have 2 ArgsProps definition (check example below) * That alias avoid the wrong import when using {@link transactor} function * with the filter callback {@link TFilterErrorMessage}. * @example * ``` * import { ArgsProps } from 'antd/lib/notification'; * import { ArgsProps } from 'antd/lib/message'; * ``` */ export declare type NotificationMessage = ArgsProps; /** * A filter callback that act like a middleware to notification messages, * ableing custom the notification errors message and descriptions * messages returning {@link NotificationMessage.message} * and {@link NotificationMessage.description} changed. * * @param settings (IEthComponentsContext) * @param err - {@link TRawTxError} original error was throwed by transaction. * @param notificationMessage - {@link NotificationMessage} * inherits from {@link ArgsProps} contains the default message and description * @returns (NotificationMessage) return {@link NotificationMessage} will be used on notification error. */ export declare type TFilterErrorMessage = (err: TRawTxError, notificationMessage: NotificationMessage) => NotificationMessage; /** * this should probably just be renamed to "notifier" * it is basically just a wrapper around BlockNative's wonderful Notify.js * https://docs.blocknative.com/notify * @param settings * @param provider * @param gasPrice * @param etherscan * @param throwOnError - throwOnError default value its false, if true it will throw errors. * @param filterErrorMessage - receive the {@link TRawTxError} to custom your errors message and description at notification. * @returns (TTransactor) a function to transact which calls a callback method parameter on completion * @throws {@link TransactorError} class */ export declare const transactor: (settings: IEthComponentsSettings, signer: TEthersSigner | undefined, gasPrice?: number, etherscan?: string, throwOnError?: boolean, filterErrorMessage?: TFilterErrorMessage) => TTransactorFunc | undefined; //# sourceMappingURL=transactor.d.ts.map