import { AccountState, Address, ContractAddress, Fee, IncomingTxFeeType, PriorityOperationReceipt, TokenLike, Tokens, TransactionReceipt, TxEthSignature, TxEthSignatureVariant, NFTInfo, Toggle2FARequest, Network } from './types'; import { BigNumber } from 'ethers'; import { TokenSet, isNFT } from './utils'; export abstract class SyncProvider { contractAddress: ContractAddress; public tokenSet: TokenSet; public providerType: 'RPC' | 'Rest'; // For HTTP provider public pollIntervalMilliSecs = 1000; public network?: Network; abstract submitTx(tx: any, signature?: TxEthSignatureVariant, fastProcessing?: boolean): Promise; abstract submitTxsBatch( transactions: { tx: any; signature?: TxEthSignatureVariant }[], ethSignatures?: TxEthSignature | TxEthSignature[] ): Promise; abstract getContractAddress(): Promise; abstract getTokens(): Promise; abstract getState(address: Address): Promise; abstract getTxReceipt(txHash: string): Promise; abstract getPriorityOpStatus(hashOrSerialId: string | number): Promise; abstract getConfirmationsForEthOpAmount(): Promise; abstract notifyPriorityOp( hashOrSerialId: string | number, action: 'COMMIT' | 'VERIFY' ): Promise; abstract notifyTransaction(hash: string, action: 'COMMIT' | 'VERIFY'): Promise; abstract getTransactionFee(txType: IncomingTxFeeType, address: Address, tokenLike: TokenLike): Promise; abstract getTransactionsBatchFee( txTypes: IncomingTxFeeType[], addresses: Address[], tokenLike: TokenLike ): Promise; abstract getTokenPrice(tokenLike: TokenLike): Promise; abstract getEthTxForWithdrawal(withdrawalHash: string): Promise; abstract getNFT(id: number): Promise; abstract getNFTOwner(id: number): Promise; abstract toggle2FA(data: Toggle2FARequest): Promise; abstract getNFTIdByTxHash(txHash: string): Promise; async updateTokenSet(): Promise { const updatedTokenSet = new TokenSet(await this.getTokens()); this.tokenSet = updatedTokenSet; } async getTokenSymbol(token: TokenLike): Promise { if (isNFT(token)) { const nft = await this.getNFT(token as number); return nft.symbol || `NFT-${token}`; } return this.tokenSet.resolveTokenSymbol(token); } async disconnect() {} }