Skip to content

Commit

Permalink
feat: add moonpay fiat onramp
Browse files Browse the repository at this point in the history
closes #2068
  • Loading branch information
beguene authored and fbwoolf committed Mar 25, 2022
1 parent 13000c9 commit dbf0f5f
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 4 deletions.
5 changes: 3 additions & 2 deletions config/wallet-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"global": []
},
"activeFiatProviders": {
"transak": { "name": "transak", "enabled": true },
"okcoin": { "name": "okcoin", "enabled": true }
"moonpay": { "name": "moonpay", "enabled": true },
"okcoin": { "name": "okcoin", "enabled": true },
"transak": { "name": "transak", "enabled": true }
},
"feeEstimations": {
"maxValues": [500000, 750000, 2000000],
Expand Down
3 changes: 2 additions & 1 deletion config/wallet-config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
"additionalProperties": false,
"properties": {
"transak": { "$ref": "#/$defs/provider" },
"okcoin": { "$ref": "#/$defs/provider" }
"okcoin": { "$ref": "#/$defs/provider" },
"moonpay": { "$ref": "#/$defs/provider" }
}
},
"feeEstimations": {
Expand Down
5 changes: 5 additions & 0 deletions src/app/features/fiat-onramp-providers/moonpay-helper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { MOONPAY_API_KEY_PRODUCTION } from '@shared/constants';

export function makeMoonPayUrl(address: string) {
return `https://buy.moonpay.com?apiKey=${MOONPAY_API_KEY_PRODUCTION}&currencyCode=stx&walletAddress=${address}`;
}
6 changes: 6 additions & 0 deletions src/app/pages/buy/components/onramp-provider-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ const providersInfo = {
cta: 'Buy on Okcoin',
test_id: 'BtnOkCoin',
},
moonpay: {
title: 'MoonPay',
body: 'US and Non-US residents can purchase STX with credit card, debit card, bank transfer, Apple pay or Google pay via MoonPay.',
cta: 'Buy on MoonPay',
test_id: 'BtnMoonPay',
},
};

export interface ProvidersUrl {
Expand Down
2 changes: 2 additions & 0 deletions src/app/pages/buy/components/onramp-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { makeMoonPayUrl } from '@app/features/fiat-onramp-providers/moonpay-helper';
import { makeOkcoinUrl } from '@app/features/fiat-onramp-providers/okcoin-helper';
import { makeTransakUrl } from '@app/features/fiat-onramp-providers/transak-helper';
import {
Expand All @@ -18,6 +19,7 @@ export const OnrampProviders = (props: OnrampProvidersProps) => {
const providersUrl = {
transak: makeTransakUrl(address),
okcoin: makeOkcoinUrl(address),
moonpay: makeMoonPayUrl(address),
};

return (
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/home/components/onboarding-steps-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const onboardingSteps = [
title: OnboardingSteps.ExploreApps,
},
{
action: 'Buy an NFT',
action: 'Find NFT',
body: 'Collect and trade NFTs secured by Bitcoin',
event: 'buy_nft',
imageFull: BuyNftFull,
Expand Down
2 changes: 2 additions & 0 deletions src/shared/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,5 @@ export const DEFAULT_LIST_LIMIT = 50;

export const TRANSAK_API_KEY_PRODUCTION = '7300ebf7-c657-46b1-9c72-c0d91bbed0a8';
export const TRANSAK_API_KEY_STAGING = '4055d318-9d41-4b74-9253-e73e3ca13602';

export const MOONPAY_API_KEY_PRODUCTION = 'pk_test_5pHUGMvCG2QR8QiNnDblIoT9U44XWX';
1 change: 1 addition & 0 deletions tests/page-objects/buy-tokens-selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export enum BuyTokensSelectors {
BtnBuyTokens = 'btn-buy-tokens',
BtnTransak = 'btn-transak',
BtnOkCoin = 'btn-okcoin',
BtnMoonPay = 'btn-moonpay',
}

0 comments on commit dbf0f5f

Please sign in to comment.