import { unreachable } from '@dimensiondev/kit' ; import { ChainId , createLookupTableResolver , FilterTransactionType , NetworkType , FungibleAssetProvider , getChainIdFromNetworkType , getZerionConstants , } from '@masknet/web3-shared-evm' ; import type { SocketRequestAssetScope } from '../types' ; export function resolvePortfolioDataProviderName ( provider ) { switch ( provider ) { case FungibleAssetProvider . ZERION : return 'Zerion' ; case FungibleAssetProvider . DEBANK : return 'Debank' ; default : unreachable ( provider ) ; } } export function resolveDebankTransactionType ( category ) { switch ( category ) { case 'send' : return FilterTransactionType . SEND ; case 'receive' : return FilterTransactionType . RECEIVE ; default : return FilterTransactionType . ALL ; } } export function resolveZerionAssetsScopeName ( networkType ) { return getZerionConstants ( getChainIdFromNetworkType ( networkType ) ) . ASSETS_SCOPE_NAME ?? '' ; } export function resolveZerionTransactionsScopeName ( networkType ) { return getZerionConstants ( getChainIdFromNetworkType ( networkType ) ) . TRANSACTIONS_SCOPE_NAME ?? '' ; } export const resolveChainByScope = createLookupTableResolver < SocketRequestAssetScope , { chain : string ; chainId ? : ChainId ; } > ( { assets : { chain : 'eth' , chainId : ChainId . Mainnet , } , 'bsc-assets' : { chain : 'bsc' , chainId : ChainId . BSC , } , 'polygon-assets' : { chain : 'matic' , chainId : ChainId . Matic , } , } , { chain : 'unknown' , } ) ;