-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(ramp): amount to buy rename to build quote + hooks (#7227)
<!-- Thanks for your contribution! Please ensure that any applicable requirements below are satisfied before submitting this pull request. This will help ensure a quick and efficient review cycle. --> **Development & PR Process** 1. Follow MetaMask [Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/coding_guidelines/CODING_GUIDELINES.md) 2. Add `release-xx` label to identify the PR slated for a upcoming release (will be used in release discussion) 3. Add `needs-dev-review` label when work is completed 4. Add the appropiate QA label when dev review is completed - `needs-qa`: PR requires manual QA. - `No QA/E2E only`: PR does not require any manual QA effort. Prior to merging, ensure that you have successful end-to-end test runs in Bitrise. - `Spot check on release build`: PR does not require feature QA but needs non-automated verification. In the description section, provide test scenarios. Add screenshots, and or recordings of what was tested. 5. Add `QA Passed` label when QA has signed off (Only required if the PR was labeled with `needs-qa`) 6. Add your team's label, i.e. label starting with `team-` (or `external-contributor` label if your not a MetaMask employee) **Description** This PR renames the "Amount To Buy" View to "Build Quote". It also extracts the logic for crypto currencies, fiat currencies and limits into hooks. These hooks in the future will accept a ramp type value, either buy or sell. **Screenshots/Recordings** ~~_If applicable, add screenshots and/or recordings to visualize the before and after of your change_~~ **Issue** fixes #??? **Checklist** * [ ] There is a related GitHub issue * [ ] Tests are included if applicable * [ ] Any added code is fully documented --------- Co-authored-by: Pedro Pablo Aste Kompen <[email protected]>
- Loading branch information
1 parent
3ddefb7
commit 6f56b2d
Showing
17 changed files
with
12,110 additions
and
293 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
146 changes: 146 additions & 0 deletions
146
app/components/UI/Ramp/buy/Views/BuildQuote/BuildQuote.constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
import { | ||
Country, | ||
CryptoCurrency, | ||
FiatCurrency, | ||
Payment, | ||
} from '@consensys/on-ramp-sdk'; | ||
|
||
export const mockCryptoCurrenciesData = [ | ||
{ | ||
id: '2', | ||
idv2: '3', | ||
network: {}, | ||
symbol: 'ETH', | ||
logo: 'some_random_logo_url', | ||
decimals: 8, | ||
address: '0xabc', | ||
name: 'Ethereum', | ||
limits: ['0.001', '8'], | ||
}, | ||
{ | ||
id: '3', | ||
idv2: '4', | ||
network: {}, | ||
symbol: 'UNI', | ||
logo: 'uni_logo_url', | ||
decimals: 8, | ||
address: '0x1a2b3c', | ||
name: 'Uniswap', | ||
limits: ['0.001', '8'], | ||
}, | ||
] as CryptoCurrency[]; | ||
|
||
export const mockFiatCurrenciesData = [ | ||
{ | ||
id: '2', | ||
symbol: 'USD', | ||
name: 'US Dollar', | ||
decimals: 2, | ||
denomSymbol: '$', | ||
}, | ||
{ | ||
id: '3', | ||
symbol: 'EUR', | ||
name: 'Euro', | ||
decimals: 2, | ||
denomSymbol: '€', | ||
}, | ||
] as FiatCurrency[]; | ||
|
||
export const mockPaymentMethods = [ | ||
{ | ||
id: '/payments/credit-debit-card', | ||
paymentType: 'credit-debit-card', | ||
name: 'Credit or Debit Card', | ||
score: 8, | ||
icons: [ | ||
{ | ||
type: 'materialIcons', | ||
name: 'card', | ||
}, | ||
], | ||
logo: { | ||
light: [ | ||
'https://on-ramp.metafi-dev.codefi.network/assets/[email protected]', | ||
'https://on-ramp.metafi-dev.codefi.network/assets/[email protected]', | ||
], | ||
dark: [ | ||
'https://on-ramp.metafi-dev.codefi.network/assets/[email protected]', | ||
'https://on-ramp.metafi-dev.codefi.network/assets/[email protected]', | ||
], | ||
}, | ||
disclaimer: | ||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua', | ||
delay: [5, 10], | ||
amountTier: [1, 3], | ||
translation: 'debit-credit-card', | ||
}, | ||
{ | ||
id: '/payments/apple-pay', | ||
paymentType: 'apple-pay', | ||
name: 'Apple Pay', | ||
score: 6, | ||
icons: [ | ||
{ | ||
type: 'fontAwesome', | ||
name: 'apple', | ||
}, | ||
], | ||
logo: { | ||
light: [ | ||
'https://on-ramp.metafi-dev.codefi.network/assets/[email protected]', | ||
'https://on-ramp.metafi-dev.codefi.network/assets/[email protected]', | ||
], | ||
dark: [ | ||
'https://on-ramp.metafi-dev.codefi.network/assets/[email protected]', | ||
'https://on-ramp.metafi-dev.codefi.network/assets/[email protected]', | ||
], | ||
}, | ||
disclaimer: 'Apple credit is not supported.', | ||
delay: [0, 0], | ||
amountTier: [1, 3], | ||
isApplePay: true, | ||
translation: 'mobile_wallet', | ||
}, | ||
{ | ||
id: '/payments/bank-transfer', | ||
paymentType: 'bank-transfer', | ||
name: 'Super Instant Bank Transfer', | ||
score: 5, | ||
icons: [ | ||
{ | ||
type: 'materialCommunityIcons', | ||
name: 'bank', | ||
}, | ||
], | ||
logo: { | ||
light: [ | ||
'https://on-ramp.metafi-dev.codefi.network/assets/[email protected]', | ||
], | ||
dark: [ | ||
'https://on-ramp.metafi-dev.codefi.network/assets/[email protected]', | ||
], | ||
}, | ||
delay: [0, 0], | ||
amountTier: [3, 3], | ||
supportedCurrency: ['/currencies/fiat/usd'], | ||
translation: 'ACH', | ||
}, | ||
] as Partial<Payment>[]; | ||
|
||
export const mockRegionsData = [ | ||
{ | ||
currencies: ['/currencies/fiat/clp'], | ||
emoji: 'chile emoji', | ||
id: '/regions/cl', | ||
name: 'Chile', | ||
unsupported: false, | ||
}, | ||
{ | ||
currencies: ['/currencies/fiat/eur'], | ||
emoji: 'albania emoji', | ||
id: '/regions/al', | ||
name: 'Albania', | ||
unsupported: false, | ||
}, | ||
] as Country[]; |
44 changes: 44 additions & 0 deletions
44
app/components/UI/Ramp/buy/Views/BuildQuote/BuildQuote.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Theme } from '../../../../../../util/theme/models'; | ||
import { StyleSheet } from 'react-native'; | ||
|
||
const styleSheet = (params: { theme: Theme }) => { | ||
const { theme } = params; | ||
const { colors } = theme; | ||
|
||
return StyleSheet.create({ | ||
viewContainer: { | ||
flex: 1, | ||
}, | ||
selectors: { | ||
flexDirection: 'row', | ||
justifyContent: 'space-between', | ||
alignItems: 'center', | ||
}, | ||
spacer: { | ||
minWidth: 8, | ||
}, | ||
row: { | ||
marginVertical: 5, | ||
}, | ||
keypadContainer: { | ||
position: 'absolute', | ||
bottom: 0, | ||
left: 0, | ||
right: 0, | ||
paddingBottom: 50, | ||
backgroundColor: colors.background.alternative, | ||
}, | ||
cta: { | ||
paddingTop: 12, | ||
}, | ||
flexRow: { | ||
flexDirection: 'row', | ||
}, | ||
flagText: { | ||
marginVertical: 3, | ||
marginHorizontal: 0, | ||
}, | ||
}); | ||
}; | ||
|
||
export default styleSheet; |
Oops, something went wrong.