import type { Signer } from '@ethersproject/abstract-signer' import { Contract } from '@ethersproject/contracts' import type { Provider } from '@ethersproject/providers' import { bep20Abi } from '../configs/abis' import * as ContractTypes from '../configs/abis/type' import { simpleRpcProvider } from './providers' export const getContract = (abi: any, address: string, signer?: Signer | Provider) => { const signerOrProvider = signer ?? simpleRpcProvider return new Contract(address, abi, signerOrProvider) } // ============== Token ============== export const getBep20Contract = (address: string, signer?: Signer | Provider) => { return getContract(bep20Abi, address, signer) as ContractTypes.Erc20 }