Skip to content

Commit

Permalink
Merge branch v1.50.8
Browse files Browse the repository at this point in the history
  • Loading branch information
rhrusha committed Sep 9, 2022
2 parents e0cc4ac + d73f04e commit 505fea9
Show file tree
Hide file tree
Showing 33 changed files with 2,983 additions and 2,322 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.50.7"
versionName "1.50.8"

missingDimensionStrategy 'react-native-camera', 'general'
multiDexEnabled true
Expand Down
7 changes: 6 additions & 1 deletion app/appstores/Stores/CreateWallet/CreateWalletActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,13 @@ export async function proceedSaveGeneratedWallet(wallet, source = 'GENERATION')
walletCashback : cashbackToken
}
const hasInternet = await ApiProxyLoad.hasInternet()
let res = false
if (source === 'IMPORT' && hasInternet) {
const res = await ApiProxyLoad.getSaved(storedKey, wallet.walletName)
try {
res = await ApiProxyLoad.getSaved(storedKey, wallet.walletName)
} catch (e) {
// do nothing
}

if (res && typeof res.forWalletsAll !== 'undefined' && typeof res.forWalletsAll[storedKey] !== 'undefined') {
const savedWallet = res.forWalletsAll[storedKey]
Expand Down
3 changes: 2 additions & 1 deletion app/modules/Account/AccountReceive/AccountReceiveScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,8 @@ class AccountReceiveScreen extends React.PureComponent {
type: 'YES_NO_MODAL',
title: strings('account.externalLink.title'),
icon: 'WARNING',
description: strings('account.externalLink.description')
description: strings('account.externalLink.description'),
reverse: true
}, () => {
trusteeAsyncStorage.setExternalAsked(now + '')
CACHE_ASKED = now
Expand Down
3 changes: 2 additions & 1 deletion app/modules/Account/AccountScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ class Account extends React.PureComponent {
currencyCode: selectedCryptoCurrencyData.currencyCode,
currencySymbol: selectedCryptoCurrencyData.currencySymbol,
currencyName: selectedCryptoCurrencyData.currencyName,
currencyExplorerLink: selectedCryptoCurrencyData.currencyExplorerLink
currencyExplorerLink: selectedCryptoCurrencyData.currencyExplorerLink,
decimals: selectedCryptoCurrencyData.decimals
}}
isSegwit={isSegwit}
cacheAsked={CACHE_ASKED}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class SettingsPrivateXMR extends Component {
title={'Address'}
subtitle={this.props.selectedAccountData.address}
iconType='keyMonero'
onPress={this.handlePrivate}
onPress={() => this.handleCopy(this.props.selectedAccountData.address)}
/>
<ListItem
title={'public ViewKey'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,10 @@ class AccountTransactionScreen extends PureComponent {
}

return <TransactionItem
title={'Tx private key'}
title={strings('account.transaction.txPrivateKey')}
subtitle={transaction.transactionJson.secretTxKey}
copyAction={() => this.handleSubContentPress({ plain: transaction.transactionJson.secretTxKey })}
withoutBack
/>
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const TransactionItem = (props) => {
<Text style={[styles.title, { color: colors.common.text2 }]}>{title}</Text>
{!!subtitle ?
<TouchableDebounce onPress={handleLink ? handleLink : copyAction} onLongPress={handleLink ? copyAction : null}>
<Text style={[styles.subtitle, { color: colorLink ? colorLink : colors.common.text1, textDecorationLine: colorLink ? 'underline' : null }]}>{subtitle}</Text>
<Text numberOfLines={2} style={[styles.subtitle, { color: colorLink ? colorLink : colors.common.text1, textDecorationLine: colorLink ? 'underline' : null }]}>{subtitle}</Text>
</TouchableDebounce> : null}
</View>
</View>
Expand Down
11 changes: 10 additions & 1 deletion app/modules/Account/AccountTransaction/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ export function renderReplaceByFeeRemove(array) {
if (transaction.transactionBlockchainStatus !== 'new' && transaction.transactionBlockchainStatus !== 'missing') {
return false
}
if (transaction?.wayType === 'fee') {
return false
}
if (!BlocksoftTransfer.canRBF(account, transaction, 'REMOVE')) {
Log.log('AccountTransactionScreen.helper.renderReplaceByFeeRemove could not remove', { account, transaction })
return false
Expand Down Expand Up @@ -274,6 +277,11 @@ export function renderReplaceByFee(array) {
if (!transaction.addressTo || transaction.addressTo === '') {
transaction.addressTo = transaction.basicAddressTo || account.address
}

if (transaction?.wayType === 'fee') {
return false
}

if (!BlocksoftTransfer.canRBF(account, transaction, 'REPLACE')) {
Log.log('AccountTransactionScreen.helper.renderReplaceByFee could not replace', { account, transaction })
return false
Expand Down Expand Up @@ -415,7 +423,8 @@ export function handleLink(link) {
type: 'YES_NO_MODAL',
title: strings('account.externalLink.title'),
icon: 'WARNING',
description: strings('account.externalLink.description')
description: strings('account.externalLink.description'),
reverse: true
}, () => {
trusteeAsyncStorage.setExternalAsked(now + '')
this.props.cacheAsked = now
Expand Down
29 changes: 20 additions & 9 deletions app/modules/Account/elements/HeaderBlocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ class HeaderBlocks extends React.Component {
type: 'YES_NO_MODAL',
title: strings('account.externalLink.title'),
icon: 'WARNING',
description: strings('account.externalLink.description')
description: strings('account.externalLink.description'),
reverse: true
}, () => {
trusteeAsyncStorage.setExternalAsked(now + '')
this.props.cacheAsked = now
Expand Down Expand Up @@ -155,7 +156,7 @@ class HeaderBlocks extends React.Component {
const { isBalanceVisible, isBalanceVisibleTriggered, originalVisibility, account } = this.props
const finalIsBalanceVisible = isBalanceVisibleTriggered ? isBalanceVisible : originalVisibility

const { currencyCode, currencySymbol } = this.props.cryptoCurrency
const { currencyCode, currencySymbol, decimals } = this.props.cryptoCurrency

const canBeStaked = currencyCode === 'TRX' || currencyCode === 'SOL'
const withoutDescription = currencyCode === 'SOL'
Expand Down Expand Up @@ -189,17 +190,22 @@ class HeaderBlocks extends React.Component {
<TouchableDebounce
onPress={() => this.accountStaking(currencyCode)}
hitSlop={HIT_SLOP}
disabled={withoutDescription || !canBeStaked}
disabled={!canBeStaked}
>
{diffAvailable &&
<Text style={[styles.availableText, { color: colors.common.text3, marginBottom: GRID_SIZE / 3 }]}>
{`${strings('settings.walletList.available')}: ${finalIsBalanceVisible ? balanceTotalPretty + ' ' + currencySymbol : ' ****'}`}
{`${strings('settings.walletList.available')}: ${finalIsBalanceVisible ? BlocksoftPrettyNumbers.makeCut(balanceTotalPretty, decimals).cutted + ' ' + currencySymbol : ' ****'}`}
</Text>}
{!withoutDescription &&
<Text style={styles.availableText}>
{`${strings(balanceStakedTitle)}: ${finalIsBalanceVisible ? balanceStakedPretty + ' ' + currencySymbol : ' ****'}`}
</Text>
}
{!diffAvailable && withoutDescription ?
<Text style={styles.availableText}>
{strings('account.staking')}
</Text>
: null}
</TouchableDebounce>
{
canBeStaked &&
Expand Down Expand Up @@ -410,16 +416,21 @@ class HeaderBlocks extends React.Component {
<View style={styles.stakingValue}>
<Text style={{ ...styles.currencyName, color: colors.common.text1 }}>{currencySymbol}</Text>
{availableStaking &&
<PercentView
value={this.props.stakingCoins[currencyCode]}
staking
/>
<TouchableDebounce
hitSlop={{ top: 15, right: 15, bottom: 7, left: 10 }}
onPress={() => this.accountStaking(currencyCode)}
>
<PercentView
value={this.props.stakingCoins[currencyCode]}
staking
/>
</TouchableDebounce>
}
</View>
<TouchableDebounce
style={styles.topContent__middle}
onPress={() => this.handleBackDropModal(shownAddress, forceLink, currencyCode, currencyName)}
hitSlop={HIT_SLOP}
hitSlop={{ top: 6, right: 15, bottom: 15, left: 15 }}
onLongPress={() => this.handleBtcAddressCopy(shownAddress)}
delayLongPress={500}
>
Expand Down
73 changes: 66 additions & 7 deletions app/modules/Send/elements/InputMemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
* @version 0.41
*/
import React from 'react'
import { View, StyleSheet } from 'react-native'
import { View, StyleSheet, Text } from 'react-native'
import { connect } from 'react-redux'
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'

import MemoInput from '@app/components/elements/NewInput'
import { ThemeContext } from '@app/theme/ThemeProvider'
Expand All @@ -20,9 +21,19 @@ class InputMemo extends React.PureComponent {

constructor(props) {
super(props)
this.state = {
memoError: false
}
this.memoInput = React.createRef()
}

memoName = {
XRP: strings('send.xrp_memo'),
XLM: strings('send.bnb_memo'),
BNB: strings('send.bnb_memo'),
XMR: strings('send.xmr_memo')
}

componentDidMount() {
if (typeof this.memoInput.handleInput !== 'undefined') {
this.memoInput.handleInput(this.props.sendScreenStoreValue, false)
Expand Down Expand Up @@ -55,6 +66,9 @@ class InputMemo extends React.PureComponent {

async disabledGotoWhy() {
if (typeof this.memoInput.handleInput === 'undefined') {
this.setState({
memoError: false
})
return {
status : 'success',
value : ''
Expand All @@ -63,16 +77,47 @@ class InputMemo extends React.PureComponent {
const destinationTagValidation = await this.memoInput.handleValidate()

if (destinationTagValidation.status !== 'success') {
this.setState({
memoError: true
})
return {
status : 'fail'
}
}
this.setState({
memoError: false
})
return {
status : 'success',
value : destinationTagValidation.value
}
}

renderMemoError = () => {
const { memoError } = this.state
const { colors, GRID_SIZE } = this.context
const { currencyCode } = this.props.sendScreenStoreDict

if (!memoError) return
return (
<View style={{ marginVertical: GRID_SIZE }}>
<View style={style.texts}>
<View style={style.texts__icon}>
<Icon
name='information-outline'
size={22}
color='#864DD9'
/>
</View>
<Text style={{ ...style.texts__item, color: colors.common.text3 }}>
{strings('send.memoError', { name: this.memoName[currencyCode] })}
</Text>
</View>
</View>
)

}


render() {
const { GRID_SIZE } = this.context
Expand All @@ -86,7 +131,7 @@ class InputMemo extends React.PureComponent {
<MemoInput
ref={component => this.memoInput = component}
id={memoInput.id}
name={strings('send.xrp_memo')}
name={this.memoName[currencyCode]}
type={'XRP_DESTINATION_TAG'}
onFocus={() => this.onFocus()}
keyboardType={'numeric'}
Expand All @@ -104,7 +149,7 @@ class InputMemo extends React.PureComponent {
<MemoInput
ref={component => this.memoInput = component}
id={memoInput.id}
name={strings('send.bnb_memo')}
name={this.memoName[currencyCode]}
type={'XLM_DESTINATION_TAG'}
onFocus={() => this.onFocus()}
keyboardType={'default'}
Expand All @@ -120,7 +165,7 @@ class InputMemo extends React.PureComponent {
<MemoInput
ref={component => this.memoInput = component}
id={memoInput.id}
name={strings('send.bnb_memo')}
name={this.memoName[currencyCode]}
type={'BNB_DESTINATION_TAG'}
onFocus={() => this.onFocus()}
keyboardType={'default'}
Expand All @@ -132,11 +177,11 @@ class InputMemo extends React.PureComponent {

{
currencyCode === 'XMR' ?
<View style={{ ...style.inputWrapper, marginVertical: GRID_SIZE }}>
<View style={{ ...style.inputWrapper, marginTop: GRID_SIZE }}>
<MemoInput
ref={component => this.memoInput = component}
id={memoInput.id}
name={strings('send.xmr_memo')}
name={this.memoName[currencyCode]}
type={'XMR_DESTINATION_TAG'}
onFocus={() => this.onFocus()}
keyboardType={'default'}
Expand All @@ -145,7 +190,7 @@ class InputMemo extends React.PureComponent {
/>
</View> : null
}

{this.renderMemoError()}
</View>

}
Expand All @@ -170,5 +215,19 @@ const style = StyleSheet.create({
width: 0,
height: 0
}
},
texts: {
flexDirection: 'row',
alignItems: 'center',
marginRight: 30
},
texts__item: {
fontSize: 14,
fontFamily: 'SFUIDisplay-Semibold',
letterSpacing: 1
},
texts__icon: {
marginRight: 10,
transform: [{ rotate: '180deg' }]
}
})
2 changes: 1 addition & 1 deletion app/services/Back/AppWalletConnect/AppWalletConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export namespace AppWalletConnect {
}
const account = accountList[walletHash][MAIN_CURRENCY_CODE] || accountList[walletHash]['ETH']
let res = []
if (peerMeta.description === "TrusteeConnect4Tron") {
if (peerMeta && typeof peerMeta !== 'undefined' && typeof peerMeta.description !== 'undefined' && peerMeta.description === "TrusteeConnect4Tron") {
res = [accountList[walletHash]['TRX'], account]
setWalletConnectAccount(res[0].address, 'TRX', walletName)
} else {
Expand Down
7 changes: 6 additions & 1 deletion crypto/actions/BlocksoftTransfer/BlocksoftTransfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,12 @@ export namespace BlocksoftTransfer {
// noinspection ES6MissingAwait
BlocksoftCryptoLog.err(`${data.currencyCode} BlocksoftTransfer.sendTx ` + e.message)
}
throw e

if (e.message.indexOf('SERVER_RESPONSE_NOT_CONNECTED') !== -1 && (data.currencyCode === 'TRX' || data.currencyCode.indexOf('TRX_') !== -1)) {
BlocksoftCryptoLog.err(`${data.currencyCode} BlocksoftTransfer.sendTx ` + e.message)
} else {
throw e
}
}
return txResult
}
Expand Down
2 changes: 1 addition & 1 deletion crypto/assets/dappsBlocksoftDict.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
},
"EXON" : {
"dappCode" : "EXON",
"dappName" : "Exon center",
"dappName" : "Exon Center",
"dappUrl" : "https://app.exoncenter.com/430",
"dappNetworks" : ["TRX"],
"dappCoins" : ["TRX_EXON"],
Expand Down
17 changes: 16 additions & 1 deletion crypto/blockchains/eth/stores/EthTmpDS.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,28 @@ class EthTmpDS {
if (txCurrencyCode !== '') {
for (const tmp of tmps.array) {
if (tmp.currencyCode !== txCurrencyCode) continue

let recheckRBFStatus = 'none'
if (tmp.transactionStatus === 'new' || tmp.transactionStatus === 'confirming') {
const recheckTmp = await Database.query(`SELECT transaction_status as transactionStatus FROM transactions WHERE transactions_other_hashes LIKE '%${txHash}%'`)
if (recheckTmp && recheckTmp.array && typeof recheckTmp.array[0] !== 'undefined') {
recheckRBFStatus = recheckTmp.array[0].transactionStatus
if (recheckRBFStatus !== 'new') {
await Database.query(`UPDATE transactions SET transaction_status='${recheckRBFStatus}'
WHERE transaction_hash='${txHash}'
AND (currency_code LIKE '%ETH%' OR currency_code LIKE 'CUSTOM_%')
`)
}
tmp.transactionStatus = recheckRBFStatus
}
}
if (tmp.transactionStatus === 'new') {
const amount = tmp.addressAmount
if (typeof amountBN[tmp.currencyCode] === 'undefined') {
amountBN[tmp.currencyCode] = new BlocksoftBN(0)
}
queryLength++
queryTxs.push({ currencyCode: tmp.currencyCode, txHash })
queryTxs.push({ currencyCode: tmp.currencyCode, txHash, recheckRBFStatus })
amountBN[tmp.currencyCode].add(amount)
} else if (tmp.transactionStatus === 'missing') {
if (maxSuccess > forBalances[txHash]) {
Expand Down
Loading

0 comments on commit 505fea9

Please sign in to comment.