Skip to content

Commit

Permalink
Merge branch 'develop' into us-1824
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigoncalves committed Aug 28, 2023
2 parents ded2291 + 1fddc7a commit 0bcee17
Show file tree
Hide file tree
Showing 35 changed files with 1,176 additions and 524 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ RIF_WALLET_SERVICE_URL=https://rif-wallet-services.testnet.rifcomputing.net
DEFAULT_CHAIN_TYPE=TESTNET

RIF_WALLET_KEY=RIF_WALLET
WALLETCONNECT2_PROJECT_ID=d9224e919473fd749ba8298879ce7569
1 change: 1 addition & 0 deletions .env.local
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ RIF_WALLET_SERVICE_URL=http://localhost:3000
DEFAULT_CHAIN_TYPE=TESTNET

RIF_WALLET_KEY=RIF_WALLET
WALLETCONNECT2_PROJECT_ID=d9224e919473fd749ba8298879ce7569
1 change: 1 addition & 0 deletions .env.local.android
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ RIF_WALLET_SERVICE_URL=http://10.0.2.2:3000
DEFAULT_CHAIN_TYPE=TESTNET

RIF_WALLET_KEY=RIF_WALLET
WALLETCONNECT2_PROJECT_ID=d9224e919473fd749ba8298879ce7569
1 change: 1 addition & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ RIF_WALLET_SERVICE_URL=https://rif-wallet-services.testnet.rifcomputing.net
DEFAULT_CHAIN_TYPE=TESTNET

RIF_WALLET_KEY=RIF_WALLET
WALLETCONNECT2_PROJECT_ID=d9224e919473fd749ba8298879ce7569
10 changes: 8 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ PODS:
- React-Core
- react-native-flipper (0.163.0):
- React-Core
- react-native-get-random-values (1.8.0):
- react-native-get-random-values (1.9.0):
- React-Core
- react-native-mmkv (2.5.1):
- MMKV (>= 1.2.13)
Expand Down Expand Up @@ -458,6 +458,8 @@ PODS:
- React-jsi (= 0.70.6)
- React-logger (= 0.70.6)
- React-perflogger (= 0.70.6)
- RNCAsyncStorage (1.19.0):
- React-Core
- RNCClipboard (1.5.1):
- React-Core
- RNDeviceInfo (10.3.0):
Expand Down Expand Up @@ -589,6 +591,7 @@ DEPENDENCIES:
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
- React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)"
- "RNCClipboard (from `../node_modules/@react-native-community/clipboard`)"
- RNDeviceInfo (from `../node_modules/react-native-device-info`)
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
Expand Down Expand Up @@ -728,6 +731,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/runtimeexecutor"
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
RNCAsyncStorage:
:path: "../node_modules/@react-native-async-storage/async-storage"
RNCClipboard:
:path: "../node_modules/@react-native-community/clipboard"
RNDeviceInfo:
Expand Down Expand Up @@ -815,7 +820,7 @@ SPEC CHECKSUMS:
react-native-background-timer: 17ea5e06803401a379ebf1f20505b793ac44d0fe
react-native-config: bcafda5b4c51491ee1b0e1d0c4e3905bc7b56c1b
react-native-flipper: 2d552a8178d839ef378220101fb7f0cd5b2a8003
react-native-get-random-values: a6ea6a8a65dc93e96e24a11105b1a9c8cfe1d72a
react-native-get-random-values: dee677497c6a740b71e5612e8dbd83e7539ed5bb
react-native-mmkv: 69b9c003f10afdd01addf7c6ee784ce42ee2eff3
react-native-netinfo: fefd4e98d75cbdd6e85fc530f7111a8afdf2b0c5
react-native-randombytes: 421f1c7d48c0af8dbcd471b0324393ebf8fe7846
Expand All @@ -832,6 +837,7 @@ SPEC CHECKSUMS:
React-RCTVibration: c75ceef7aa60a33b2d5731ebe5800ddde40cefc4
React-runtimeexecutor: 15437b576139df27635400de0599d9844f1ab817
ReactCommon: 349be31adeecffc7986a0de875d7fb0dcf4e251c
RNCAsyncStorage: 4b98ac3c64efa4e35c1197cb0c5ca5e9f5d4c666
RNCClipboard: 41d8d918092ae8e676f18adada19104fa3e68495
RNDeviceInfo: 4701f0bf2a06b34654745053db0ce4cb0c53ada7
RNGestureHandler: 62232ba8f562f7dea5ba1b3383494eb5bf97a4d3
Expand Down
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
"clean:ios": "cd ios && xcodebuild clean && rm -rf ~/Library/Caches/CocoaPods && rm -rf Pods && rm -rf ~/Library/Developer/Xcode/DerivedData/* && pod cache clean --all && pod deintegrate && pod setup && pod install && cd .."
},
"dependencies": {
"@ethersproject/shims": "^5.4.0",
"@ethersproject/shims": "^5.7.0",
"@hookform/resolvers": "^2.9.11",
"@json-rpc-tools/utils": "^1.7.6",
"@ramp-network/react-native-sdk": "^1.0.1",
"@react-native-async-storage/async-storage": "^1.19.0",
"@react-native-community/clipboard": "^1.5.1",
"@react-native-community/hooks": "^2.8.1",
"@react-native-community/netinfo": "^9.4.1",
Expand All @@ -46,13 +48,17 @@
"@rsksmart/rsk-contract-metadata": "^1.0.17",
"@rsksmart/rsk-testnet-contract-metadata": "^1.0.15",
"@rsksmart/rsk-utils": "^1.1.0",
"@walletconnect/client": "^1.6.6",
"@walletconnect/jsonrpc-types": "^1.0.3",
"@walletconnect/react-native-compat": "^2.9.0",
"@walletconnect/utils": "^2.9.0",
"@walletconnect/web3wallet": "^1.8.6",
"axios": "^0.27.2",
"buffer": "^4.9.2",
"deprecated-react-native-prop-types": "^2.3.0",
"ethers": "^5.4.7",
"ethers": "5.7.2",
"eventemitter3": "^5.0.0",
"events": "^1.1.1",
"fast-text-encoding": "^1.0.6",
"i18next": "^21.4.1",
"jail-monkey": "^2.7.0",
"moment": "^2.29.4",
Expand All @@ -68,7 +74,7 @@
"react-native-crypto": "^2.1.0",
"react-native-device-info": "^10.3.0",
"react-native-gesture-handler": "^2.8.0",
"react-native-get-random-values": "^1.7.0",
"react-native-get-random-values": "^1.9.0",
"react-native-jdenticon": "^0.0.3",
"react-native-keychain": "^8.1.1",
"react-native-linear-gradient": "^2.5.6",
Expand Down
1 change: 1 addition & 0 deletions src/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'react-native-reanimated'
import '@ethersproject/shims' // ref: https://docs.ethers.io/v5/cookbook/react-native/#cookbook-reactnative
import 'react-native-gesture-handler'
import 'react-native-get-random-values'
import 'fast-text-encoding'

import '../shim'
import { CoreGlobalErrorHandler } from './core'
Expand Down
4 changes: 3 additions & 1 deletion src/components/BasicRow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export const BasicRow = ({
type="body2"
style={styles.bold}
numberOfLines={1}
ellipsizeMode="tail">
ellipsizeMode="tail"
adjustsFontSizeToFit>
{label}
</Typography>
<Typography type="labelLight">
Expand Down Expand Up @@ -156,6 +157,7 @@ const styles = StyleSheet.create({
flex: 3,
flexDirection: 'column',
flexGrow: 1,
paddingRight: 5,
},
thirdView: {
flexBasis: '27%',
Expand Down
2 changes: 2 additions & 0 deletions src/components/Porfolio/PortfolioCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ const NonSelectedCard = ({
<Typography
type={'body1'}
style={nonSelectedCardStyles.secondaryText}
numberOfLines={1}
adjustsFontSizeToFit
accessibilityLabel="balance">
{hideBalance ? '\u002A\u002A\u002A\u002A' : secondaryText}
</Typography>
Expand Down
2 changes: 1 addition & 1 deletion src/components/address/AddressInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export const AddressInput = ({
return (
<>
<Input
testID={testID}
accessibilityLabel={testID}
label={status.value ? status.value : label}
labelStyle={labelColor}
value={!value.displayAddress ? value.address : value.displayAddress}
Expand Down
6 changes: 5 additions & 1 deletion src/components/feedbackModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ export const FeedbackModal = ({
{title}
</Typography>
{texts.map((text, i) => (
<Typography style={styles.subtitle} type={'h4'} key={i}>
<Typography
style={styles.subtitle}
type={'h4'}
key={i}
accessibilityLabel={`text-${i}`}>
{text}
</Typography>
))}
Expand Down
2 changes: 1 addition & 1 deletion src/components/token/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const TokenBalance = ({
onChangeText={handleAmountChange}
value={hide ? '\u002A\u002A\u002A\u002A' : firstValue.balance}
keyboardType="numeric"
testID={'Amount.Input'}
accessibilityLabel={'Amount.Input'}
placeholder="0"
placeholderTextColor={sharedColors.inputLabelColor}
style={[styles.input, sharedStyles.flex]}
Expand Down
7 changes: 7 additions & 0 deletions src/core/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { ChainTypeEnum } from 'shared/constants/chainConstants'
import { SETTINGS } from 'core/types'

/**
* This function will get the environment settings from the config.json
* It requires the chainType because config.json will return a value that depends on the chainId
* RSK Mainnet: 30
* RSK Testnet: 31
*/
Expand All @@ -25,6 +27,11 @@ export const getWalletSetting = (

return ReactNativeConfig[setting] || ''
}
/**
* This function will get the environment variable from .env
* @param setting
*/
export const getEnvSetting = (setting: SETTINGS) => ReactNativeConfig[setting]

export const getTokenAddress = (symbol: string, chainType: ChainTypeEnum) => {
const contracts =
Expand Down
2 changes: 1 addition & 1 deletion src/core/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const getRnsResolver = (chainId: ChainTypesByIdType) =>

export const createRIFWalletFactory =
(onRequest: OnRequest, chainId: ChainTypesByIdType) => (wallet: Wallet) => {
const jsonRpcProvider = new providers.JsonRpcProvider(
const jsonRpcProvider = new providers.StaticJsonRpcProvider(
getWalletSetting(SETTINGS.RPC_URL, chainTypesById[chainId]),
)
const rifRelayConfig: RifRelayConfig = {
Expand Down
1 change: 1 addition & 0 deletions src/core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ export enum SETTINGS {
QR_READER_BITCOIN_DEFAULT_NETWORK = 'QR_READER_BITCOIN_DEFAULT_NETWORK',
AUTH_CLIENT = 'AUTH_CLIENT',
RIF_WALLET_KEY = 'RIF_WALLET_KEY',
WALLETCONNECT2_PROJECT_ID = 'WALLETCONNECT2_PROJECT_ID',
}
5 changes: 5 additions & 0 deletions src/lib/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,11 @@ const resources = {
'RIF Wallet needs an internet connection to work properly.',
offline_screen_description_2:
'Please check your connection and try again.',
dapps_requirements_not_met:
'The Dapp you tried to connect does not meet our requirements.',
dapps_session_rejected: 'Session rejected',
dapps_error_pairing_title: 'Error when trying to connect to Dapp',
dapps_error_pairing_message: 'Please refresh the QR and try again.',
},
},
es: {
Expand Down
4 changes: 2 additions & 2 deletions src/navigation/rootNavigator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { sharedStyles } from 'shared/constants'
import {
ActivityScreen,
ScanQRScreen,
WalletConnectScreen,
PinScreen,
WalletConnectScreenWithProvider,
} from 'screens/index'
import { OfflineScreen } from 'core/components/OfflineScreen'

Expand Down Expand Up @@ -92,7 +92,7 @@ export const RootNavigationComponent = () => {
/>
<RootTabs.Screen
name={rootTabsRouteNames.WalletConnect}
component={WalletConnectScreen}
component={WalletConnectScreenWithProvider}
/>
<RootTabs.Screen
name={rootTabsRouteNames.Settings}
Expand Down
2 changes: 1 addition & 1 deletion src/navigation/rootNavigator/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export type RootTabsParamsList = {
[rootTabsRouteNames.Contacts]:
| NavigatorScreenParams<ContactStackParamsList>
| undefined
[rootTabsRouteNames.WalletConnect]: undefined | { wcKey: string }
[rootTabsRouteNames.WalletConnect]: undefined | { data: string }
[rootTabsRouteNames.Settings]:
| undefined
| NavigatorScreenParams<SettingsStackParamsList>
Expand Down
25 changes: 15 additions & 10 deletions src/redux/slices/balancesSlice/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,22 @@ export const getBalance = (
token: ITokenWithBalance | BitcoinNetworkWithBIPRequest,
price: number,
) => {
let tokenBalance = token.balance.toString()
if ('satoshis' in token) {
const balanceBigNumber = convertBtcToSatoshi(token.balance.toString())
return {
balance: balanceToDisplay(balanceBigNumber.toString(), 8, 4),
usdBalance: convertBalance(balanceBigNumber, 8, price),
}
} else {
return {
balance: balanceToDisplay(token.balance, token.decimals, 4),
usdBalance: convertBalance(token.balance, token.decimals, price),
}
tokenBalance = convertBtcToSatoshi(tokenBalance).toString()
}

let balance = balanceToDisplay(tokenBalance, token.decimals, 4)
if (Number(balance) === 0) {
balance = balanceToDisplay(tokenBalance, token.decimals, 6)
}
if (Number(balance) === 0) {
balance = balanceToDisplay(tokenBalance, token.decimals, 8)
}

return {
balance,
usdBalance: convertBalance(tokenBalance, token.decimals, price),
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/screens/createKeys/import/ImportMasterKeyScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export const ImportMasterKeyScreen = (
return (
<View style={styles.inputMarginView}>
<Input
accessibilityLabel={`word-${firstItemId}`}
label={`Word ${firstItemId}`}
inputName={`${firstItemId}`}
placeholder={`Word ${firstItemId}`}
Expand All @@ -139,6 +140,7 @@ export const ImportMasterKeyScreen = (
blurOnSubmit={false}
/>
<Input
accessibilityLabel={`word-${secondItemId}`}
label={`Word ${secondItemId}`}
inputName={`${secondItemId}`}
placeholder={`Word ${secondItemId}`}
Expand All @@ -150,6 +152,7 @@ export const ImportMasterKeyScreen = (
blurOnSubmit={false}
/>
<Input
accessibilityLabel={`word-${thirdItemId}`}
label={`Word ${thirdItemId}`}
inputName={`${thirdItemId}`}
placeholder={`Word ${thirdItemId}`}
Expand Down Expand Up @@ -209,6 +212,7 @@ export const ImportMasterKeyScreen = (
inactiveDotScale={0.6}
/>
<AppButton
accessibilityLabel={'OK'}
title="OK"
color="white"
textColor="black"
Expand Down
5 changes: 4 additions & 1 deletion src/screens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ export { ReceiveScreen } from './receive/ReceiveScreen'
export { ActivityScreen } from './activity/ActivityScreen'
export { ShowMnemonicScreen } from './info/ShowMnemonicScreen'
export { RelayDeployScreen } from './settings/RelayDeployScreen'
export { WalletConnectScreen } from './walletConnect'
export {
WalletConnectScreen,
WalletConnectScreenWithProvider,
} from './walletConnect'
export { ScanQRScreen } from './walletConnect/ScanQRScreen'
export { ChangeLanguageScreen } from './settings/ChangeLanguageScreen'
export { SearchDomainScreen } from './rnsManager/SearchDomainScreen'
Expand Down
1 change: 1 addition & 0 deletions src/screens/send/SendScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export const SendScreen = ({
onPress: onGoToHome,
color: sharedColors.white,
textColor: sharedColors.black,
accessibilityLabel: 'return',
},
]}
/>
Expand Down
3 changes: 3 additions & 0 deletions src/screens/send/TransactionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ export const TransactionForm = ({
<AppTouchable
width={'100%'}
onPress={toggleShowTx}
accessibilityLabel={'ChangeTxAsset'}
style={styles.assetToggleRow}>
<>
<Typography type={'h3'}>
Expand Down Expand Up @@ -399,6 +400,7 @@ export const TransactionForm = ({
selectedToken.symbol
}`}
onPress={handleSubmit(handleConfirmClick)}
accessibilityLabel={'Send'}
disabled={
!selectedTokenAddress ||
!isWalletDeployed ||
Expand All @@ -414,6 +416,7 @@ export const TransactionForm = ({
style={styles.buttonCancel}
title={t('transaction_form_button_cancel')}
onPress={onCancel}
accessibilityLabel={'Cancel'}
backgroundVariety={AppButtonBackgroundVarietyEnum.OUTLINED}
/>
</View>
Expand Down
13 changes: 3 additions & 10 deletions src/screens/transactionSummary/TransactionSummaryComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ export const TransactionSummaryComponent = ({
<Typography type={'body2'} style={[sharedStyles.textCenter]}>
{displayRoundBalance(totalToken)} {tokenValue.symbol}{' '}
{tokenValue.symbol !== fee.symbol &&
!amIReceiver &&
t('transaction_summary_plus_fees')}
</Typography>
</View>
Expand Down Expand Up @@ -264,22 +265,14 @@ export const TransactionSummaryComponent = ({
</ScrollView>
<View style={styles.buttons}>
{buttons ? (
buttons.map(b => (
<AppButton
key={b.title}
onPress={b.onPress}
title={b.title}
color={b.color}
textColor={b.textColor}
backgroundVariety={b.backgroundVariety}
/>
))
buttons.map(b => <AppButton {...b} key={b.title} />)
) : (
<AppButton
onPress={goBack}
title={t('transaction_summary_default_button_text')}
color={sharedColors.white}
textColor={sharedColors.black}
accessibilityLabel="Close"
/>
)}
</View>
Expand Down
Loading

0 comments on commit 0bcee17

Please sign in to comment.