UNPKG

@yoroi/exchange

Version:

The Exchange package of Yoroi SDK

79 lines 1.93 kB
import { Exchange } from '@yoroi/types'; import { freeze } from 'immer'; import { encryptusApiGetBaseUrl } from './encryptus/api'; import { banxaApiGetBaseUrl } from './banxa/api'; const initialDeps = freeze({ banxaApi: { getBaseUrl: banxaApiGetBaseUrl }, encryptusApi: { getBaseUrl: encryptusApiGetBaseUrl } }, true); export const exchangeApiMaker = function (_ref) { let { isProduction, partner } = _ref; let { banxaApi, encryptusApi } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : initialDeps; const getProviders = async () => Promise.resolve(providers); const getBaseUrl = (providerId, fetcherConfig) => { switch (providerId) { case 'banxa': return banxaApi.getBaseUrl({ isProduction, partner })(); case 'encryptus': return encryptusApi.getBaseUrl({ isProduction })(fetcherConfig); default: return Promise.reject(new Exchange.Errors.ProviderNotFound(`Unknown provider: ${providerId}`)); } }; return freeze({ getBaseUrl, getProviders }, true); }; export const providers = freeze({ banxa: { id: 'banxa', name: 'Banxa', logo: 'banxa', supportedOrders: { buy: { fee: 2, min: 100000000 } }, supportUrl: 'https://support.banxa.com/', appId: '160e2963-e5fa-4d20-b406-4c91c13f1d5c' }, encryptus: { id: 'encryptus', name: 'Encryptus', logo: 'encryptus', supportedOrders: { sell: { fee: 2.5, min: 1000000 } }, supportUrl: 'https://support.encryptus.com/', appId: '18d1545a-a59b-45cb-a180-157b110c77fe' }, nmkr: { id: 'nmkr', name: 'NMKR', logo: 'nmkr', supportUrl: 'https://www.nmkr.io/support', appId: 'fee6bfc1-6934-418a-aa78-5eea5cf1b576', supportedOrders: {} } }, true); //# sourceMappingURL=api.js.map