UNPKG

@lifi/widget

Version:

LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.

27 lines (22 loc) 638 B
import type { WidgetConfig } from '../../types/widget.js' import { getChainTypeFromAddress } from '../../utils/chainType.js' export const attemptToFindMatchingToAddressInConfig = ( address: string, config: WidgetConfig ) => { if (config.toAddress && config.toAddress.address === address) { return config.toAddress } if (config.toAddresses?.length) { const matchingToAddress = config.toAddresses.find( (toAddress) => toAddress.address === address ) if (matchingToAddress) { return matchingToAddress } } return { address: address, chainType: getChainTypeFromAddress(address), } }