Skip to content

Commit 9e91b50

Browse files
authored
CP-13092: Basic Fusion UI (#3552)
1 parent 3c01a37 commit 9e91b50

36 files changed

+2879
-6
lines changed

.claude/settings.local.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
"Bash(yarn lint:*)",
77
"Bash(yarn core test:*)",
88
"Bash(yarn core tsc:*)",
9-
"Bash(yarn core lint:*)"
9+
"Bash(yarn core lint:*)",
10+
"Bash(ls:*)",
11+
"Bash(find:*)",
12+
"Bash(./node_modules/.bin/tsc:*)"
1013
]
1114
}
12-
}
15+
}

packages/core-mobile/app/new/features/portfolio/assets/consts.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export enum ActionButtonTitle {
22
Send = 'Send',
33
Swap = 'Swap',
4+
SwapV2 = 'Fusion',
45
Buy = 'Buy',
56
Stake = 'Stake',
67
Bridge = 'Bridge',

packages/core-mobile/app/new/features/portfolio/screens/PortfolioScreen.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { useAccountPerformanceSummary } from 'features/portfolio/hooks/useAccoun
3737
import { useBalanceTotalPriceChangeForAccount } from 'features/portfolio/hooks/useBalanceTotalPriceChangeForAccount'
3838
import { useSendSelectedToken } from 'features/send/store'
3939
import { useNavigateToSwap } from 'features/swap/hooks/useNavigateToSwap'
40+
import { useNavigateToSwap as useNavigateToSwapV2 } from 'features/swapV2/hooks/useNavigateToSwap'
4041
import { useFormatCurrency } from 'new/common/hooks/useFormatCurrency'
4142
import React, { useCallback, useMemo, useRef, useState } from 'react'
4243
import {
@@ -56,7 +57,8 @@ import { LocalTokenWithBalance } from 'store/balance/types'
5657
import {
5758
selectIsBridgeBlocked,
5859
selectIsMeldOfframpBlocked,
59-
selectIsInAppDefiBorrowBlocked
60+
selectIsInAppDefiBorrowBlocked,
61+
selectIsFusionEnabled
6062
} from 'store/posthog'
6163
import { selectIsDeveloperMode } from 'store/settings/advanced'
6264
import { selectSelectedCurrency } from 'store/settings/currency'
@@ -90,6 +92,7 @@ const PortfolioHomeScreen = (): JSX.Element => {
9092
const isMeldOfframpBlocked = useSelector(selectIsMeldOfframpBlocked)
9193
const isBridgeBlocked = useSelector(selectIsBridgeBlocked)
9294
const isInAppDefiBorrowBlocked = useSelector(selectIsInAppDefiBorrowBlocked)
95+
const isFusionEnabled = useSelector(selectIsFusionEnabled)
9396

9497
// When borrow feature is enabled, Activity moves to Portfolio sub-tab
9598
const segmentItems = isInAppDefiBorrowBlocked
@@ -103,6 +106,7 @@ const PortfolioHomeScreen = (): JSX.Element => {
103106
const { theme } = useTheme()
104107
const { navigate, push } = useRouter()
105108
const { navigateToSwap } = useNavigateToSwap()
109+
const { navigateToSwap: navigateToSwapV2 } = useNavigateToSwapV2()
106110

107111
const [stickyHeaderLayout, setStickyHeaderLayout] = useState<
108112
LayoutRectangle | undefined
@@ -245,6 +249,13 @@ const PortfolioHomeScreen = (): JSX.Element => {
245249
onPress: () => navigateToSwap()
246250
})
247251
}
252+
if (isFusionEnabled) {
253+
buttons.push({
254+
title: ActionButtonTitle.SwapV2,
255+
icon: 'swap',
256+
onPress: () => navigateToSwapV2()
257+
})
258+
}
248259
buttons.push({
249260
title: ActionButtonTitle.Buy,
250261
icon: 'buy',
@@ -278,8 +289,10 @@ const PortfolioHomeScreen = (): JSX.Element => {
278289
handleReceive,
279290
handleBridge,
280291
navigateToSwap,
292+
navigateToSwapV2,
281293
isMeldOfframpBlocked,
282-
isBridgeBlocked
294+
isBridgeBlocked,
295+
isFusionEnabled
283296
])
284297

285298
const renderMaskView = useCallback((): JSX.Element => {
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import { BuildTxParams } from "features/swap/services/ParaswapService"
2+
3+
/**
4+
* The address where ParaSwap will send collected partner fees.
5+
*/
6+
const PARASWAP_PARTNER_ADDRESS = '0xcEA3b9415F269B5686403909d781959570f32CF0'
7+
8+
/**
9+
* The fee percentage that Core gathers on ParaSwap swaps.
10+
*
11+
* An integer representing the basis points (BPS) of the fee percentage.
12+
*
13+
* @example 85 -> 0.85%
14+
*/
15+
export const PARASWAP_PARTNER_FEE_BPS = 85
16+
17+
/**
18+
* The fee percentage that Core gathers on Markr swaps.
19+
*
20+
* An integer representing the basis points (BPS) of the fee percentage.
21+
*
22+
* @example 85 -> 0.85%
23+
*/
24+
export const MARKR_PARTNER_FEE_BPS = 85
25+
26+
/**
27+
* The address ParaSwap uses for EVM native tokens.
28+
*/
29+
export const EVM_NATIVE_TOKEN_ADDRESS =
30+
'0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'
31+
32+
/**
33+
* The address Markr uses for EVM native tokens.
34+
*/
35+
export const MARKR_EVM_NATIVE_TOKEN_ADDRESS =
36+
'0x0000000000000000000000000000000000000000'
37+
38+
/**
39+
* The partner ID Markr uses for EVM swaps.
40+
*/
41+
export const MARKR_EVM_PARTNER_ID =
42+
'0x655812b0b38b7733f8b36ec2bf870fd23be54cde979bcb722861de8ab6861fc4'
43+
44+
/**
45+
* The interval in milliseconds at which to refresh quotes.
46+
*/
47+
export const SWAP_REFRESH_INTERVAL = 30000
48+
49+
/**
50+
* The necessary parameters for Core to gather fees from the swap.
51+
*/
52+
export const PARTNER_FEE_PARAMS = {
53+
partnerAddress: PARASWAP_PARTNER_ADDRESS,
54+
partnerFeeBps: PARASWAP_PARTNER_FEE_BPS,
55+
isDirectFeeTransfer: true
56+
// TODO: upgrade prettier to latest version to fix this
57+
// eslint-disable-next-line prettier/prettier
58+
} satisfies Partial<BuildTxParams>
59+
60+
/**
61+
* The address Jupiter uses for Solana native tokens.
62+
*/
63+
export const SOL_MINT = 'So11111111111111111111111111111111111111112';
64+
65+
/**
66+
* The address where Jupiter will send collected partner fees.
67+
*/
68+
export const JUPITER_PARTNER_ADDRESS =
69+
'CjKCcretczioDRkSSfu6qogF6aTkSeKMNVFB1UWXkR4U';
70+
71+
/**
72+
* The fee percentage that Core gathers on Jupiter swaps.
73+
* An integer representing the basis points (BPS) of the fee percentage.
74+
*
75+
* @example 85 -> 0.85%
76+
*/
77+
export const JUPITER_PARTNER_FEE_BPS = 85 as const satisfies number;
78+
79+
80+
export const WAVAX_ADDRESS = '0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7'
81+
export const WETH_ADDRESS = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
82+
83+
export const WRAPPABLE_TOKENS = [WAVAX_ADDRESS, WETH_ADDRESS]
84+
85+
/**
86+
* Minimum allowed slippage percentage for swaps.
87+
* @example 0.1 -> 0.1%
88+
*/
89+
export const MIN_SLIPPAGE_PERCENT = 0.1
90+
91+
/**
92+
* Maximum allowed slippage percentage for swaps.
93+
* @example 50 -> 50%
94+
*/
95+
export const MAX_SLIPPAGE_PERCENT = 50

0 commit comments

Comments
 (0)