UNPKG

@daimo/pay

Version:

Seamless crypto payments. Onboard users from any chain, any coin into your app with one click.

62 lines (59 loc) 2.01 kB
import { ExternalPaymentOptions } from '@daimo/pay-common'; const TOP_LEVEL_PAYMENT_OPTIONS = [ ExternalPaymentOptions.AllWallets, ExternalPaymentOptions.AllExchanges, ExternalPaymentOptions.AllAddresses, ExternalPaymentOptions.AllPaymentApps, ExternalPaymentOptions.Tron ]; const DEFAULT_TOP_OPTIONS_ORDER = [ ExternalPaymentOptions.AllWallets, ExternalPaymentOptions.AllExchanges, ExternalPaymentOptions.AllAddresses ]; const WALLET_OPTION_IDS = [ ExternalPaymentOptions.Metamask, ExternalPaymentOptions.Trust, ExternalPaymentOptions.Rainbow, ExternalPaymentOptions.BaseApp, ExternalPaymentOptions.Backpack, ExternalPaymentOptions.Bitget, ExternalPaymentOptions.Family, ExternalPaymentOptions.Farcaster, ExternalPaymentOptions.Phantom, ExternalPaymentOptions.MiniPay, ExternalPaymentOptions.OKX, ExternalPaymentOptions.Solflare, ExternalPaymentOptions.World, ExternalPaymentOptions.Zerion ]; const EXCHANGE_OPTION_IDS = [ ExternalPaymentOptions.Coinbase, ExternalPaymentOptions.Binance, ExternalPaymentOptions.Lemon ]; const ADDRESS_OPTION_IDS = [ ExternalPaymentOptions.Tron, ExternalPaymentOptions.Base, ExternalPaymentOptions.Arbitrum, ExternalPaymentOptions.Optimism, ExternalPaymentOptions.Polygon, ExternalPaymentOptions.Ethereum ]; function inferTopLevelFromArray(items) { const areAllWallets = items.every( (i) => WALLET_OPTION_IDS.includes(i) ); if (areAllWallets) return ExternalPaymentOptions.AllWallets; const areAllExchanges = items.every( (i) => EXCHANGE_OPTION_IDS.includes(i) ); if (areAllExchanges) return ExternalPaymentOptions.AllExchanges; const areAllAddresses = items.every( (i) => ADDRESS_OPTION_IDS.includes(i) ); if (areAllAddresses) return ExternalPaymentOptions.AllAddresses; return void 0; } export { ADDRESS_OPTION_IDS, DEFAULT_TOP_OPTIONS_ORDER, EXCHANGE_OPTION_IDS, TOP_LEVEL_PAYMENT_OPTIONS, WALLET_OPTION_IDS, inferTopLevelFromArray }; //# sourceMappingURL=paymentOptions.js.map