UNPKG

@skalenetwork/metaport

Version:

SKALE Metaport Widget

54 lines (53 loc) 2.46 kB
/** * @license * SKALE Metaport * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. */ /// <reference types="react" /> import { Chain } from '@wagmi/core'; import { WalletClient } from 'viem'; import { Contract, Provider } from 'ethers'; import { MainnetChain, SChain } from '@skalenetwork/ima-js'; import { TokenData, CustomAbiTokenType } from '../dataclasses'; import * as interfaces from '../interfaces'; import MetaportCore from '../metaport'; export type ActionType = typeof Action; export declare class Action { execute(): void; preAction(): void; mpc: MetaportCore; mainnet: MainnetChain; sChain1: SChain; sChain2: SChain; chainName1: string; chainName2: string; address: string; amount: string; tokenId: number; token: TokenData; walletClient: WalletClient; sourceToken: Contract; destToken: Contract; unwrappedToken: Contract | undefined; originAddress: string; activeStep: number; setActiveStep: React.Dispatch<React.SetStateAction<number>>; setAmountErrorMessage: React.Dispatch<React.SetStateAction<string>>; setBtnText: (btnText: string) => void; _switchNetwork: (chainId: number | bigint) => Promise<Chain | undefined>; constructor(mpc: MetaportCore, chainName1: string, chainName2: string, address: string, amount: string, tokenId: number, token: TokenData, setAmountErrorMessage: (amountErrorMessage: string) => void, setBtnText: (btnText: string) => void, switchNetwork: (chainId: number | bigint) => Promise<Chain | undefined>, walletClient: WalletClient); updateState(currentState: interfaces.ActionState, transactionHash?: string, timestamp?: number): void; getConnectedChain(provider: Provider, customAbiTokenType?: CustomAbiTokenType, destChainName?: string, chainName?: string): Promise<MainnetChain | SChain>; }