UNPKG

@swapper-finance/sdk

Version:
52 lines (47 loc) 1.47 kB
import { TransactionResponse } from "@ethersproject/providers"; import { EvmHandlers } from "@src/context"; import { Ecosystem } from "@src/models"; import { Dispatch, SetStateAction } from "react"; export type EnqueueTxProps = { // eslint-disable-next-line @typescript-eslint/no-explicit-any executeTransaction: () => Promise<TransactionResponse> | undefined; txStatus: TxStatus; txMsg?: string; handlers?: EvmHandlers; network?: Ecosystem; showDefaultSuccessMessage?: boolean; }; export type TxUIWrapperState = { enqueueTransaction: (props: EnqueueTxProps) => number; closeTransactionModal: (nonce: number) => void; isTxModalOpen: boolean; setTxModalOpen: Dispatch<SetStateAction<boolean>>; loading: boolean; txStatus: TxStatus; setTxStatus: Dispatch<SetStateAction<TxStatus>>; txExplorerUrl: string; txHash: string; txError: string; txMsg: string; setTxMsg: Dispatch<SetStateAction<string>>; setTxError: Dispatch<SetStateAction<string>>; txNeedsApproval: boolean; setTxNeedsApproval: Dispatch<SetStateAction<boolean>>; }; /** * make sure there's always appropriate CONFIRMATION status following the SIGNING one * see setTxStatus((prevStatus) => prevStatus + 1) at TxUIWrapper.tsx -> addUILogicToHandlersEVM */ export enum TxStatus { SWAP_INIT, SIGNING_APPROVAL, CONFIRMING_APPROVAL, SIGNING_TX, CONFIRMING_TX, COMPLETED, } export type TxStats = { points?: string; rank?: string; cashback?: string; };