-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: sushi swap beta * fix: sushi swap review * fix(jsonrpcRequest): temp patch for @haqq/shared-react-native * fix: sushi new backend logic * feat: swap screen header * feat: add provider fee * feat: swap settings * fix: sushi swap token select * feat: show route for sushi swap * feat: update locales * feat: hide empty wallets for swap * fix: android swap arrow symbol * fix: estimate swap transaction * chore: update locales * refactor: swap screen * fix: swap rates * feat: add translations for swap * fix: input swap rates * feat: add translations for swap settings * refactor: change swap wallet preview * fix: PR HQM-377 clean * feat: getAllPositiveBalance for wallet storage --------- Co-authored-by: iGroza <[email protected]>
- Loading branch information
Showing
48 changed files
with
2,128 additions
and
372 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
176332800.69399998 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
12 changes: 12 additions & 0 deletions
12
ios/haqq/Images.xcassets/swap_vertical.imageset/Contents.json
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,12 @@ | ||
{ | ||
"images": [ | ||
{ | ||
"filename": "swap_vertical.svg", | ||
"idiom": "universal" | ||
} | ||
], | ||
"info": { | ||
"author": "xcode", | ||
"version": 1 | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
ios/haqq/Images.xcassets/swap_vertical.imageset/swap_vertical.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React, {useMemo} from 'react'; | ||
|
||
import {observer} from 'mobx-react'; | ||
import {View} from 'react-native'; | ||
|
||
import {Color} from '@app/colors'; | ||
import {createTheme} from '@app/helpers'; | ||
import {I18N, getText} from '@app/i18n'; | ||
|
||
import {First, Spacer, Text, TextVariant} from '../ui'; | ||
|
||
export interface EstimatedValueProps { | ||
title: string | I18N; | ||
value: string | number | React.ReactNode; | ||
valueColor?: Color; | ||
} | ||
|
||
export const EstimatedValue = observer( | ||
({title, value, valueColor = Color.textBase1}: EstimatedValueProps) => { | ||
const _title = useMemo(() => { | ||
if (title in I18N) { | ||
return getText(title as I18N); | ||
} | ||
return title; | ||
}, [title]); | ||
|
||
return ( | ||
<View style={styles.estimatedValueContainer}> | ||
<Text variant={TextVariant.t14} color={Color.textBase2}> | ||
{_title} | ||
</Text> | ||
<Spacer /> | ||
<First> | ||
{React.isValidElement(value) && value} | ||
<Text variant={TextVariant.t14} color={valueColor}> | ||
{value} | ||
</Text> | ||
</First> | ||
</View> | ||
); | ||
}, | ||
); | ||
|
||
const styles = createTheme({ | ||
estimatedValueContainer: { | ||
flexDirection: 'row', | ||
justifyContent: 'space-between', | ||
}, | ||
}); |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './swap'; | ||
export * from './swap-preview'; | ||
export * from './swap-finish'; | ||
export * from './swap-settings-bottom-sheet'; |
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,168 @@ | ||
import React from 'react'; | ||
|
||
import {observer} from 'mobx-react'; | ||
import {View} from 'react-native'; | ||
|
||
import {Color} from '@app/colors'; | ||
import {createTheme} from '@app/helpers'; | ||
import {useSumAmount} from '@app/hooks'; | ||
import {I18N} from '@app/i18n'; | ||
import {Balance} from '@app/services/balance'; | ||
import {IContract} from '@app/types'; | ||
|
||
import {ImageWrapper} from '../image-wrapper'; | ||
import { | ||
Button, | ||
ButtonSize, | ||
ButtonVariant, | ||
First, | ||
LabeledBlock, | ||
Spacer, | ||
Text, | ||
TextField, | ||
TextFieldProps, | ||
TextVariant, | ||
} from '../ui'; | ||
import {Placeholder} from '../ui/placeholder'; | ||
|
||
export type SwapInputProps = { | ||
token: IContract; | ||
currentBalance: Balance; | ||
availableBalance: Balance; | ||
amounts: ReturnType<typeof useSumAmount>; | ||
isLoading?: boolean; | ||
showMaxButton?: boolean; | ||
disableTextFieldLoader?: boolean; | ||
onPressMax?(): void; | ||
onPressChangeToken(): void; | ||
} & Pick< | ||
TextFieldProps, | ||
'onBlur' | 'editable' | 'label' | 'placeholder' | 'autoFocus' | ||
>; | ||
|
||
export const SwapInput = observer( | ||
({ | ||
amounts, | ||
availableBalance, | ||
currentBalance, | ||
token, | ||
isLoading, | ||
showMaxButton = false, | ||
disableTextFieldLoader = false, | ||
onPressChangeToken, | ||
onPressMax, | ||
...inputProps | ||
}: SwapInputProps) => { | ||
return ( | ||
<View> | ||
<View style={styles.amountContainer}> | ||
<First> | ||
{isLoading && disableTextFieldLoader === false && ( | ||
<View style={styles.amountInput}> | ||
<Placeholder opacity={0.7}> | ||
<Placeholder.Item width={'100%'} height={58} /> | ||
</Placeholder> | ||
</View> | ||
)} | ||
<TextField | ||
rightAction={ | ||
showMaxButton ? ( | ||
<Button | ||
i18n={I18N.swapScreenMax} | ||
variant={ButtonVariant.text} | ||
textColor={ | ||
isLoading ? Color.textBase2 : Color.graphicGreen1 | ||
} | ||
size={ButtonSize.small} | ||
onPress={onPressMax} | ||
disabled={isLoading} | ||
/> | ||
) : undefined | ||
} | ||
style={styles.amountInput} | ||
error={!!amounts.error} | ||
errorText={amounts.error} | ||
{...inputProps} | ||
value={amounts.amount} | ||
onChangeText={amounts.setAmount} | ||
keyboardType="numeric" | ||
inputMode="decimal" | ||
returnKeyType="done" | ||
/> | ||
</First> | ||
<Spacer width={10} /> | ||
|
||
<LabeledBlock | ||
i18nLabel={I18N.transactionCrypto} | ||
style={styles.cryptoBlock} | ||
onPress={onPressChangeToken}> | ||
<View style={styles.cryptoBlockWrapper}> | ||
{!!token.icon && ( | ||
<ImageWrapper | ||
style={styles.cryptoBlockImage} | ||
source={token.icon} | ||
/> | ||
)} | ||
<Text | ||
style={styles.cryptoBlockTitle} | ||
t11 | ||
color={Color.textBase1} | ||
numberOfLines={1} | ||
ellipsizeMode="middle"> | ||
{token.symbol} | ||
</Text> | ||
</View> | ||
</LabeledBlock> | ||
</View> | ||
|
||
<View> | ||
<Spacer height={4} /> | ||
<Text | ||
variant={TextVariant.t14} | ||
color={Color.textBase2} | ||
i18n={I18N.swapInputAmountData} | ||
i18params={{ | ||
currentFiatAmount: currentBalance.toFiat({ | ||
useDefaultCurrency: true, | ||
}), | ||
availableAmount: availableBalance.toBalanceString('auto'), | ||
}} | ||
/> | ||
</View> | ||
</View> | ||
); | ||
}, | ||
); | ||
|
||
const styles = createTheme({ | ||
amountContainer: { | ||
flexDirection: 'row', | ||
justifyContent: 'space-between', | ||
}, | ||
amountInput: { | ||
flex: 3.8, | ||
}, | ||
cryptoBlockImage: { | ||
maxHeight: 12, | ||
maxWidth: 12, | ||
width: 12, | ||
height: 12, | ||
borderRadius: 5, | ||
overflow: 'hidden', | ||
alignSelf: 'center', | ||
marginRight: 4, | ||
}, | ||
cryptoBlockTitle: { | ||
marginRight: 8, | ||
}, | ||
cryptoBlockWrapper: { | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}, | ||
cryptoBlock: { | ||
flex: 1, | ||
alignItems: 'center', | ||
height: 58, | ||
}, | ||
}); |
Oops, something went wrong.