Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased (develop)

- added: DFX (app.dfx.swiss) as a SEPA fiat buy/sell ramp provider.
- added: Remote enable/disable of gift card providers via the info server's giftCardInfo config, supporting whole-provider disabling for Phaze and Bitrefill and per-brand disabling for Phaze.

## 4.49.0 (staging)
Expand Down
10 changes: 8 additions & 2 deletions src/components/scenes/RampCreateScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,10 @@ export const RampCreateScene: React.FC<Props> = (props: Props) => {
{/* Amount Inputs */}
{/* Top Input (Fiat) */}
<View style={styles.inputRowView}>
<DropdownInputButton onPress={handleFiatDropdown}>
<DropdownInputButton
onPress={handleFiatDropdown}
testID="rampFiatDropdown"
>
{selectedFiatFlagUri !== '' ? (
<ShadowedView style={styles.shadowedIcon}>
<FastImage
Expand Down Expand Up @@ -861,7 +864,10 @@ export const RampCreateScene: React.FC<Props> = (props: Props) => {
/>
) : (
<>
<DropdownInputButton onPress={handleCryptDropdown}>
<DropdownInputButton
onPress={handleCryptDropdown}
testID="rampCryptoDropdown"
>
{isLoadingPersistedCryptoSelection ? (
<ActivityIndicator />
) : selectedCrypto == null || selectedWallet == null ? null : (
Expand Down
7 changes: 7 additions & 0 deletions src/constants/plugins/GuiPlugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ export const guiPlugins: Record<string, GuiPlugin> = {
displayName: 'Bits of Gold',
permissions: ['camera']
},
dfx: {
pluginId: 'dfx',
storeId: 'dfx',
baseUri: 'https://app.dfx.swiss',
displayName: 'DFX',
permissions: ['camera']
},
creditcard: {
pluginId: 'amountquote',
storeId: '',
Expand Down
3 changes: 3 additions & 0 deletions src/envConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {

import { asInitOptions as asBanxaInitOptions } from './plugins/ramps/banxa/banxaRampTypes'
import { asInitOptions as asBitsofgoldInitOptions } from './plugins/ramps/bitsofgold/bitsofgoldRampTypes'
import { asInitOptions as asDfxInitOptions } from './plugins/ramps/dfx/dfxRampTypes'
import { asInitOptions as asInfiniteInitOptions } from './plugins/ramps/infinite/infiniteRampTypes'
import { asInitOptions as asLibertyxInitOptions } from './plugins/ramps/libertyx/libertyxRampTypes'
import { asInitOptions as asMoonpayInitOptions } from './plugins/ramps/moonpay/moonpayRampTypes'
Expand Down Expand Up @@ -186,6 +187,7 @@ export const asEnvConfig = asObject({
asObject<Record<string, unknown>>({
banxa: asOptional(asBanxaInitOptions),
bitsofgold: asOptional(asBitsofgoldInitOptions),
dfx: asOptional(asDfxInitOptions),
libertyx: asOptional(asLibertyxInitOptions),
moonpay: asOptional(asMoonpayInitOptions),
infinite: asOptional(asInfiniteInitOptions),
Expand All @@ -196,6 +198,7 @@ export const asEnvConfig = asObject({
() => ({
banxa: undefined,
bitsofgold: undefined,
dfx: undefined,
libertyx: undefined,
moonpay: undefined,
infinite: undefined,
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/ramps/allRampPlugins.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { banxaRampPlugin } from './banxa/banxaRampPlugin'
import { bitsofgoldRampPlugin } from './bitsofgold/bitsofgoldRampPlugin'
import { dfxRampPlugin } from './dfx/dfxRampPlugin'
import { infiniteRampPlugin } from './infinite/infiniteRampPlugin'
import { libertyxRampPlugin } from './libertyx/libertyxRampPlugin'
import { moonpayRampPlugin } from './moonpay/moonpayRampPlugin'
Expand All @@ -11,6 +12,7 @@ import { simplexRampPlugin } from './simplex/simplexRampPlugin'
export const pluginFactories: Record<string, RampPluginFactory> = {
banxa: banxaRampPlugin,
bitsofgold: bitsofgoldRampPlugin,
dfx: dfxRampPlugin,
infinite: infiniteRampPlugin,
libertyx: libertyxRampPlugin,
moonpay: moonpayRampPlugin,
Expand Down
92 changes: 92 additions & 0 deletions src/plugins/ramps/dfx/dfxRampPlugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { guiPlugins } from '../../../constants/plugins/GuiPlugins'
import type { RampPluginFactory, SettlementRange } from '../rampPluginTypes'
import { createExternalRampPlugin } from '../utils/createExternalRampPlugin'
import { asInitOptions } from './dfxRampTypes'

// DFX settles SEPA bank transfers within a few business days.
const SETTLEMENT_ONE_TO_THREE_DAYS: SettlementRange = {
min: { value: 1, unit: 'days' },
max: { value: 3, unit: 'days' }
}

// SEPA region plus Switzerland and Liechtenstein, where DFX operates.
const DFX_COUNTRIES = [
'AT',
'BE',
'BG',
'CH',
'CY',
'CZ',
'DE',
'DK',
'EE',
'ES',
'FI',
'FR',
'GR',
'HR',
'HU',
'IE',
'IT',
'LI',
'LT',
'LU',
'LV',
'MT',
'NL',
'PL',
'PT',
'RO',
'SE',
'SI',
'SK'
]

const DFX_FIAT_CURRENCY_CODES = ['EUR', 'CHF']

const DFX_CRYPTO_ASSETS = [
{ pluginId: 'bitcoin', tokenId: null },
{ pluginId: 'ethereum', tokenId: null },
{ pluginId: 'arbitrum', tokenId: null },
{ pluginId: 'optimism', tokenId: null },
{ pluginId: 'polygon', tokenId: null },
{ pluginId: 'base', tokenId: null },
{ pluginId: 'binancesmartchain', tokenId: null },
{ pluginId: 'solana', tokenId: null },
{ pluginId: 'monero', tokenId: null }
]

export const dfxRampPlugin: RampPluginFactory = config => {
const initOptions = asInitOptions(config.initOptions)
const deepQuery = {
wallet: initOptions.wallet,
lang: 'en'
}

return createExternalRampPlugin(
'dfx',
{
guiPlugin: guiPlugins.dfx,
partnerIcon: initOptions.partnerIcon,
buy: {
paymentTypes: ['sepa'],
countries: DFX_COUNTRIES,
fiatCurrencyCodes: DFX_FIAT_CURRENCY_CODES,
cryptoAssets: DFX_CRYPTO_ASSETS,
settlementRange: SETTLEMENT_ONE_TO_THREE_DAYS,
deepPath: '/buy',
deepQuery
},
sell: {
paymentTypes: ['sepa'],
countries: DFX_COUNTRIES,
fiatCurrencyCodes: DFX_FIAT_CURRENCY_CODES,
cryptoAssets: DFX_CRYPTO_ASSETS,
settlementRange: SETTLEMENT_ONE_TO_THREE_DAYS,
deepPath: '/sell',
deepQuery
}
},
config
)
}
13 changes: 13 additions & 0 deletions src/plugins/ramps/dfx/dfxRampTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { asObject, asOptional, asString } from 'cleaners'

export interface InitOptions {
readonly partnerIcon: string
// Partner/wallet identifier sent to the DFX widget. Override per build so
// white-label apps do not identify as Edge.
readonly wallet: string
}

export const asInitOptions = asObject<InitOptions>({
partnerIcon: asOptional(asString, `https://content.edge.app/dfx-logo.png`),
wallet: asOptional(asString, 'Edge')
}).withRest
Loading