Skip to content

Commit c9dd45d

Browse files
committed
Implement new ramp plugins
1 parent ff55c17 commit c9dd45d

File tree

94 files changed

+11554
-444
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+11554
-444
lines changed

eslint.config.mjs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export default [
9494
'src/components/buttons/ReturnKeyTypeButton.tsx',
9595
'src/components/buttons/SceneButtons.tsx',
9696
'src/components/cards/AdvancedDetailsCard.tsx',
97-
'src/components/cards/AlertCard.tsx',
97+
9898
'src/components/cards/BalanceCard.tsx',
9999
'src/components/cards/EarnOptionCard.tsx',
100100
'src/components/cards/EdgeCard.tsx',
@@ -238,7 +238,7 @@ export default [
238238
'src/components/scenes/EdgeLoginScene.tsx',
239239
'src/components/scenes/EditTokenScene.tsx',
240240
'src/components/scenes/ExtraTabScene.tsx',
241-
'src/components/scenes/Fio/FioAddressDetailsScene.tsx',
241+
242242
'src/components/scenes/Fio/FioAddressListScene.tsx',
243243
'src/components/scenes/Fio/FioAddressRegisteredScene.tsx',
244244
'src/components/scenes/Fio/FioAddressRegisterScene.tsx',
@@ -256,7 +256,6 @@ export default [
256256
'src/components/scenes/Fio/FioStakingChangeScene.tsx',
257257
'src/components/scenes/Fio/FioStakingOverviewScene.tsx',
258258
'src/components/scenes/FormScene.tsx',
259-
'src/components/scenes/GuiPluginListScene.tsx',
260259
'src/components/scenes/inputs/DigitInput.tsx',
261260
'src/components/scenes/inputs/DigitInput/PinDots.tsx',
262261
'src/components/scenes/LoadingScene.tsx',
@@ -286,7 +285,7 @@ export default [
286285
'src/components/scenes/Staking/EarnScene.tsx',
287286
'src/components/scenes/Staking/StakeModifyScene.tsx',
288287
'src/components/scenes/Staking/StakeOptionsScene.tsx',
289-
'src/components/scenes/SwapConfirmationScene.tsx',
288+
290289
'src/components/scenes/SwapCreateScene.tsx',
291290
'src/components/scenes/SwapProcessingScene.tsx',
292291
'src/components/scenes/SwapSettingsScene.tsx',
@@ -365,7 +364,7 @@ export default [
365364
'src/components/themed/SendFromFioRows.tsx',
366365
'src/components/themed/ShareButtons.tsx',
367366
'src/components/themed/SideMenu.tsx',
368-
'src/components/themed/SimpleTextInput.tsx',
367+
369368
'src/components/themed/Slider.tsx',
370369

371370
'src/components/themed/SwipeableRow.tsx',

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"theme": "node -r sucrase/register ./scripts/themeServer.ts",
5757
"updateVersion": "node -r sucrase/register scripts/updateVersion.ts",
5858
"updot": "EDGE_MODE=development updot",
59-
"verify": "npm run lint && npm run typechain && npm run tsc && npm run test",
59+
"verify": "npm run lint && npm run typechain && tsc && npm run test",
6060
"watch": "npm test -- --watch",
6161
"update-eslint-warnings": "node -r sucrase/register ./scripts/updateEslintWarnings.ts"
6262
},
@@ -82,6 +82,7 @@
8282
"@react-navigation/native": "^6.1.3",
8383
"@react-navigation/stack": "^6.3.12",
8484
"@sentry/react-native": "^6.14.0",
85+
"@tanstack/react-query": "^5.84.2",
8586
"@types/jsrsasign": "^10.5.13",
8687
"@unstoppabledomains/resolution": "^9.3.0",
8788
"@walletconnect/react-native-compat": "^2.21.6",

src/__tests__/DeepLink.test.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,43 @@ describe('parseDeepLink', function () {
263263
})
264264
})
265265

266+
describe('ramp', function () {
267+
makeLinkTests({
268+
'edge://ramp/buy/paybis?transactionStatus=success': {
269+
type: 'ramp',
270+
providerId: 'paybis',
271+
direction: 'buy',
272+
path: '',
273+
query: { transactionStatus: 'success' },
274+
uri: 'edge://ramp/buy/paybis?transactionStatus=success'
275+
},
276+
'https://deep.edge.app/ramp/buy/paybis?transactionStatus=success': {
277+
type: 'ramp',
278+
providerId: 'paybis',
279+
direction: 'buy',
280+
path: '',
281+
query: { transactionStatus: 'success' },
282+
uri: 'edge://ramp/buy/paybis?transactionStatus=success'
283+
},
284+
'https://return.edge.app/ramp/buy/paybis?transactionStatus=success': {
285+
type: 'ramp',
286+
providerId: 'paybis',
287+
direction: 'buy',
288+
path: '',
289+
query: { transactionStatus: 'success' },
290+
uri: 'edge://ramp/buy/paybis?transactionStatus=success'
291+
},
292+
'edge://ramp/sell/paybis?transactionStatus=fail': {
293+
type: 'ramp',
294+
providerId: 'paybis',
295+
direction: 'sell',
296+
path: '',
297+
query: { transactionStatus: 'fail' },
298+
uri: 'edge://ramp/sell/paybis?transactionStatus=fail'
299+
}
300+
})
301+
})
302+
266303
describe('promotion', function () {
267304
makeLinkTests({
268305
'edge://promotion/bob': {
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// This test file intentionally tests deprecated functionality for backward compatibility
2+
import {
3+
getRampPluginStoreId,
4+
RAMP_PLUGIN_STORE_ID_OVERRIDE
5+
} from '../../../../plugins/ramps/utils/rampStoreIds'
6+
7+
describe('getRampPluginStoreId', () => {
8+
describe('legacy plugins', () => {
9+
it('should return legacy store IDs for migrated fiat providers', () => {
10+
// Providers with matching providerId and storeId
11+
expect(getRampPluginStoreId('banxa')).toBe('banxa')
12+
expect(getRampPluginStoreId('paybis')).toBe('paybis')
13+
expect(getRampPluginStoreId('ionia')).toBe('ionia')
14+
expect(getRampPluginStoreId('revolut')).toBe('revolut')
15+
16+
// Providers with domain-prefixed storeIds
17+
expect(getRampPluginStoreId('bity')).toBe('com.bity')
18+
expect(getRampPluginStoreId('kado')).toBe('money.kado')
19+
expect(getRampPluginStoreId('moonpay')).toBe('com.moonpay')
20+
expect(getRampPluginStoreId('mtpelerin')).toBe('com.mtpelerin')
21+
expect(getRampPluginStoreId('simplex')).toBe('co.edgesecure.simplex')
22+
})
23+
24+
it('should handle kadoOtc sharing store with kado', () => {
25+
expect(getRampPluginStoreId('kadoOtc')).toBe('money.kado')
26+
expect(getRampPluginStoreId('kado')).toBe('money.kado')
27+
// Both should resolve to the same store ID
28+
expect(getRampPluginStoreId('kadoOtc')).toBe(getRampPluginStoreId('kado'))
29+
})
30+
})
31+
32+
describe('new plugins', () => {
33+
it('should use ramp: prefix for plugins not in override map', () => {
34+
expect(getRampPluginStoreId('newexchange')).toBe('ramp:newexchange')
35+
expect(getRampPluginStoreId('cryptopay')).toBe('ramp:cryptopay')
36+
expect(getRampPluginStoreId('onramp2024')).toBe('ramp:onramp2024')
37+
expect(getRampPluginStoreId('futurePlugin')).toBe('ramp:futurePlugin')
38+
})
39+
})
40+
41+
describe('override map integrity', () => {
42+
it('should contain all expected legacy providers', () => {
43+
const expectedLegacyProviders = [
44+
'banxa',
45+
'paybis',
46+
'ionia',
47+
'revolut',
48+
'bity',
49+
'kado',
50+
'kadoOtc',
51+
'moonpay',
52+
'mtpelerin',
53+
'simplex'
54+
]
55+
56+
expectedLegacyProviders.forEach(provider => {
57+
expect(RAMP_PLUGIN_STORE_ID_OVERRIDE).toHaveProperty(provider)
58+
})
59+
})
60+
61+
it('should have exactly 10 legacy providers', () => {
62+
// This ensures no new providers are accidentally added
63+
expect(Object.keys(RAMP_PLUGIN_STORE_ID_OVERRIDE)).toHaveLength(10)
64+
})
65+
})
66+
})

src/__tests__/reducers/__snapshots__/RootReducer.test.ts.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ exports[`initialState 1`] = `
137137
"pinLoginEnabled": false,
138138
"preferredSwapPluginId": undefined,
139139
"preferredSwapPluginType": undefined,
140+
"rampLastCryptoSelection": undefined,
141+
"rampLastFiatCurrencyCode": undefined,
140142
"reviewTrigger": undefined,
141143
"securityCheckedWallets": {},
142144
"settingsLoaded": null,

src/__tests__/scenes/__snapshots__/SwapConfirmationScene.test.tsx.snap

Lines changed: 129 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,47 +1735,26 @@ exports[`SwapConfirmationScene should render with loading props 1`] = `
17351735
nativeID="7"
17361736
>
17371737
<View
1738-
accessibilityState={
1739-
{
1740-
"busy": undefined,
1741-
"checked": undefined,
1742-
"disabled": false,
1743-
"expanded": undefined,
1744-
"selected": undefined,
1745-
}
1746-
}
1747-
accessibilityValue={
1748-
{
1749-
"max": undefined,
1750-
"min": undefined,
1751-
"now": undefined,
1752-
"text": undefined,
1753-
}
1754-
}
1755-
accessible={false}
1756-
collapsable={false}
1757-
focusable={true}
1758-
onClick={[Function]}
1759-
onResponderGrant={[Function]}
1760-
onResponderMove={[Function]}
1761-
onResponderRelease={[Function]}
1762-
onResponderTerminate={[Function]}
1763-
onResponderTerminationRequest={[Function]}
1764-
onStartShouldSetResponder={[Function]}
17651738
style={
1766-
{
1767-
"alignSelf": "stretch",
1768-
"borderRadius": 16,
1769-
"marginBottom": 11,
1770-
"marginLeft": 11,
1771-
"marginRight": 11,
1772-
"marginTop": 11,
1773-
"opacity": 1,
1774-
"paddingBottom": 11,
1775-
"paddingLeft": 11,
1776-
"paddingRight": 11,
1777-
"paddingTop": 11,
1778-
}
1739+
[
1740+
{
1741+
"alignSelf": "stretch",
1742+
"borderRadius": 16,
1743+
},
1744+
{
1745+
"marginBottom": 11,
1746+
"marginLeft": 11,
1747+
"marginRight": 11,
1748+
"marginTop": 11,
1749+
},
1750+
{
1751+
"paddingBottom": 11,
1752+
"paddingLeft": 11,
1753+
"paddingRight": 11,
1754+
"paddingTop": 11,
1755+
},
1756+
undefined,
1757+
]
17791758
}
17801759
>
17811760
<View
@@ -1795,10 +1774,10 @@ exports[`SwapConfirmationScene should render with loading props 1`] = `
17951774
<BVLinearGradient
17961775
colors={
17971776
[
1798-
1886857999,
1799-
1887591201,
1800-
1887591201,
1801-
1886857999,
1777+
1888765742,
1778+
1888889905,
1779+
1888889905,
1780+
1888765742,
18021781
]
18031782
}
18041783
endPoint={
@@ -1913,6 +1892,112 @@ exports[`SwapConfirmationScene should render with loading props 1`] = `
19131892
The amount above is an estimate. This exchange may result in less funds received than quoted.
19141893
</Text>
19151894
</View>
1895+
<View
1896+
accessibilityState={
1897+
{
1898+
"busy": undefined,
1899+
"checked": undefined,
1900+
"disabled": false,
1901+
"expanded": undefined,
1902+
"selected": undefined,
1903+
}
1904+
}
1905+
accessibilityValue={
1906+
{
1907+
"max": undefined,
1908+
"min": undefined,
1909+
"now": undefined,
1910+
"text": undefined,
1911+
}
1912+
}
1913+
accessible={true}
1914+
collapsable={false}
1915+
focusable={true}
1916+
hitSlop={11}
1917+
onClick={[Function]}
1918+
onResponderGrant={[Function]}
1919+
onResponderMove={[Function]}
1920+
onResponderRelease={[Function]}
1921+
onResponderTerminate={[Function]}
1922+
onResponderTerminationRequest={[Function]}
1923+
onStartShouldSetResponder={[Function]}
1924+
style={
1925+
{
1926+
"alignItems": "center",
1927+
"alignSelf": "center",
1928+
"flexDirection": "row",
1929+
"flexShrink": 1,
1930+
"gap": 11,
1931+
"margin": 11,
1932+
"marginBottom": 11,
1933+
"marginLeft": 11,
1934+
"marginRight": 11,
1935+
"marginTop": 11,
1936+
"minWidth": 0,
1937+
"opacity": 1,
1938+
"paddingHorizontal": 17,
1939+
"paddingVertical": 6,
1940+
}
1941+
}
1942+
>
1943+
<BVLinearGradient
1944+
colors={
1945+
[
1946+
872415231,
1947+
872415231,
1948+
]
1949+
}
1950+
endPoint={
1951+
{
1952+
"x": 1,
1953+
"y": 1,
1954+
}
1955+
}
1956+
locations={null}
1957+
startPoint={
1958+
{
1959+
"x": 0,
1960+
"y": 0,
1961+
}
1962+
}
1963+
style={
1964+
{
1965+
"borderRadius": 67,
1966+
"bottom": 0,
1967+
"left": 0,
1968+
"position": "absolute",
1969+
"right": 0,
1970+
"top": 0,
1971+
}
1972+
}
1973+
/>
1974+
<Text
1975+
adjustsFontSizeToFit={false}
1976+
allowFontScaling={false}
1977+
ellipsizeMode="tail"
1978+
minimumFontScale={0.65}
1979+
numberOfLines={1}
1980+
style={
1981+
[
1982+
{
1983+
"color": "#FFFFFF",
1984+
"fontFamily": "Quicksand-Regular",
1985+
"fontSize": 22,
1986+
"includeFontPadding": false,
1987+
},
1988+
{
1989+
"flexShrink": 1,
1990+
"fontSize": 17,
1991+
"lineHeight": 34,
1992+
"minWidth": 0,
1993+
},
1994+
null,
1995+
]
1996+
}
1997+
>
1998+
Learn More
1999+
</Text>
2000+
</View>
19162001
</View>
19172002
</View>
19182003
<View

0 commit comments

Comments
 (0)