UNPKG

fsl-js-sdk

Version:
78 lines (77 loc) 5.57 kB
import { ethers, Wallet, Signature } from 'ethers'; import { Chains, TOKEN_NAME } from '../../constants'; import { IEvmContractParams, ITransferToken, INativeTokenTransferFee, IEvmContractMethodFee, IFSLWeb3Params, IEvmSignParams, IEvmCallDataParams, IDomain, ITypes, IMessage } from '../../../type/web3'; import { SignatureLike } from '@ethersproject/bytes'; declare class FSLWeb3 { private gasPriorityPolygon; private gasPriorityExtraPolygon; private gasPriorityExtraEvm; wallet?: Wallet; DOMAIN_PERMISSIONS: string[]; permission: boolean; constructor({ mnemonic, gasPriorityPolygon, gasPriorityExtraPolygon, gasPriorityExtraEvm, }: IFSLWeb3Params); static BigNumberFrom: typeof ethers.BigNumber.from; static EtherUtils: typeof ethers.utils; generateWallet(mnemonic: string): string; createAccount(): string; static isMnemonic(mnemonic: string): boolean; static isPrivateKey(privateKey: string): string | null; static toBigInt(value: string): ethers.BigNumber; static getEnsAddress(ensName: string, rpc?: string): Promise<string | null>; static lookupEnsName(address: string, rpc?: string): Promise<string | null>; exportWallet(): Wallet; exportPrivateKey(): string; exportMnemonic(): "" | ethers.utils.Mnemonic; transferEvmNativeToken({ to, amount, rpc, chainId, nonce, maxPriorityFeePerGasValue, maxFeePerGasValue, }: ITransferToken): Promise<string>; callEvmContractReadMethod(rpc: string, address: string, contractAddresses: string, abi: any, method: string): Promise<any>; callEvmContractMethod({ contractAddress, abi, methodName, params, rpc, chainId, gasLimit, amount, nonce, maxPriorityFeePerGasValue, maxFeePerGasValue, }: IEvmContractParams): Promise<string>; callEvmContractByCallData({ contractAddress, callData, rpc, chainId, gasLimit, maxPriorityFeePerGasValue, maxFeePerGasValue, value, nonce, }: IEvmCallDataParams): Promise<string>; evmSignMessage(msg: ArrayLike<number> | string | Record<string, number>, type?: string): Promise<string>; signDigest(hexInput: string): Signature; static evmVerifyMessage(msg: string, signature: SignatureLike): string; evmSignTypedData(domain: IDomain, types: ITypes, message: IMessage): Promise<string>; static evmVerifyTypedData(domain: IDomain, types: ITypes, message: IMessage, signature: SignatureLike): string; getTransactionNonceCount(rpc: string): Promise<number>; callEvmSignMethod({ contractAddress, data, rpc, chainId, gasLimit, amount, nonce, maxPriorityFeePerGasValue, maxFeePerGasValue, }: IEvmSignParams): Promise<string>; sendEvmTransaction(signedTx: string, rpc: string, confirmed?: boolean): Promise<string>; checkEvmTransactionHashStatus(txHash: string, rpc: string): Promise<ethers.providers.TransactionReceipt>; getEvmTransactionBlock(blockNum: number, rpc: string): Promise<ethers.providers.Block>; tokenMintAddress(tokenSymbol: TOKEN_NAME): string; getEvmErc20TokenBalance(walletAddress: string, rpc: string, contractAddresses: string[]): Promise<import("ethereum-erc20-token-balances-multicall").BalanceResult>; getEvmNativeTokenBalance(walletAddress: string, rpc: string): Promise<ethers.BigNumber>; calculateEvmNativeTokenTransferGasFee({ rpc, chainId, from, }: INativeTokenTransferFee): Promise<string>; calculateCallEvmContractMethodGasFee({ rpc, chainId, contractAddress, abi, methodName, params, from, amount, }: IEvmContractMethodFee): Promise<string>; getEvmNativeTokenTransactions(rpc: string, chainId: number, from: string, blockNum: number): Promise<import("axios").AxiosResponse<any, any>>; getEvmErcTokenTransactions(rpc: string, contractAddress: string, abi: string[], from: string, blockNum: number): Promise<ethers.Event[]>; queryTransfers(contract: ethers.Contract, filter: ethers.EventFilter, fromBlock: number, toBlock: number): Promise<ethers.Event[]>; getEvmSwapRouterAmountsOut(rpc: string, contractAddress: string, path: string[], amountIn: ethers.BigNumber): Promise<any>; getEvmErc20TokenAllowance(rpc: string, contractAddress: string, from: string, to: string): Promise<any>; getEvmErc20TokenBalanceOf(walletAddress: string, rpc: string, contractAddresses: string): Promise<any>; getEvmBlockTime(rpc: string, blockNum: number): Promise<number>; getEvmFeeFast(rpc: string, chainId: number): Promise<any>; static checkContractType(address: string, rpc: string): Promise<"" | "NFT">; static getTokenTicker(contractAddresses: string, rpc: string): Promise<string>; getOutputSwapQuote(params: { amountOut: string; chains: Chains; tokenIn: string; tokenOut: string; tokenInDecimals: number; step?: number; rpc?: string; }): Promise<any>; getSwapQuote(params: { amount: string; chains: Chains; tokenIn: string; tokenOut: string; tokenInDecimals: number; step?: number; rpc?: string; }): Promise<any>; getSwapGas(quote: any, chains: Chains, fnName: string, bscGas?: string): Promise<string>; swapNativeToGUsd(quote: any, chains: Chains, rpc?: string, bscGas?: string): Promise<ethers.providers.TransactionReceipt>; swapGUsdToNative(quote: any, chains: Chains, allowanceEnough?: boolean, rpc?: string, bscGas?: string): Promise<ethers.providers.TransactionReceipt>; swapTokenToToken(quote: any, chains: Chains, allowanceEnough?: boolean, rpc?: string, bscGas?: string): Promise<ethers.providers.TransactionReceipt>; } export default FSLWeb3;