mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 15:04:50 +01:00
Merge remote-tracking branch 'origin/master' into snyk-upgrade-b1100653bd03b2f06bd39f36add6adf7
This commit is contained in:
commit
a850ee2ed5
10 changed files with 109 additions and 44 deletions
|
@ -190,7 +190,7 @@ export const BitcoinButton = props => {
|
|||
flex: 1,
|
||||
}}
|
||||
>
|
||||
<View style={{ marginTop: 16, marginLeft: 16, marginBottom: 16 }}>
|
||||
<View style={{ margin: 16 }}>
|
||||
<Text style={{ color: colors.hdborderColor, fontWeight: 'bold' }}>{loc.wallets.add_bitcoin}</Text>
|
||||
</View>
|
||||
<Image
|
||||
|
@ -218,7 +218,7 @@ export const LightningButton = props => {
|
|||
flex: 1,
|
||||
}}
|
||||
>
|
||||
<View style={{ marginTop: 16, marginLeft: 16, marginBottom: 16 }}>
|
||||
<View style={{ margin: 16 }}>
|
||||
<Text style={{ color: colors.lnborderColor, fontWeight: 'bold' }}>{loc.wallets.add_lightning}</Text>
|
||||
</View>
|
||||
<Image
|
||||
|
@ -752,7 +752,7 @@ export const BlueListItemHooks = props => {
|
|||
export const BlueFormLabel = props => {
|
||||
const { colors } = useTheme();
|
||||
|
||||
return <Text {...props} style={{ color: colors.foregroundColor, fontWeight: '400', marginLeft: 20 }} />;
|
||||
return <Text {...props} style={{ color: colors.foregroundColor, fontWeight: '400', marginHorizontal: 20 }} />;
|
||||
};
|
||||
|
||||
export class BlueFormInput extends Component {
|
||||
|
|
|
@ -132,7 +132,7 @@ android {
|
|||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "5.6.0"
|
||||
versionName "5.6.1"
|
||||
multiDexEnabled true
|
||||
missingDimensionStrategy 'react-native-camera', 'general'
|
||||
testBuildType System.getProperty('testBuildType', 'debug') // This will later be used to control the test apk build type
|
||||
|
|
|
@ -553,27 +553,33 @@ export class AbstractHDElectrumWallet extends AbstractHDWallet {
|
|||
async _fetchBalance() {
|
||||
// probing future addressess in hierarchy whether they have any transactions, in case
|
||||
// our 'next free addr' pointers are lagging behind
|
||||
let tryAgain = false;
|
||||
let txs = await BlueElectrum.getTransactionsByAddress(
|
||||
this._getExternalAddressByIndex(this.next_free_address_index + this.gap_limit - 1),
|
||||
);
|
||||
if (txs.length > 0) {
|
||||
// whoa, someone uses our wallet outside! better catch up
|
||||
this.next_free_address_index += this.gap_limit;
|
||||
tryAgain = true;
|
||||
// for that we are gona batch fetch history for all addresses between last used and last used + gap_limit
|
||||
|
||||
const lagAddressesToFetch = [];
|
||||
for (let c = this.next_free_address_index; c < this.next_free_address_index + this.gap_limit; c++) {
|
||||
lagAddressesToFetch.push(this._getExternalAddressByIndex(c));
|
||||
}
|
||||
for (let c = this.next_free_change_address_index; c < this.next_free_change_address_index + this.gap_limit; c++) {
|
||||
lagAddressesToFetch.push(this._getInternalAddressByIndex(c));
|
||||
}
|
||||
|
||||
txs = await BlueElectrum.getTransactionsByAddress(
|
||||
this._getInternalAddressByIndex(this.next_free_change_address_index + this.gap_limit - 1),
|
||||
);
|
||||
if (txs.length > 0) {
|
||||
this.next_free_change_address_index += this.gap_limit;
|
||||
tryAgain = true;
|
||||
const txs = await BlueElectrum.multiGetHistoryByAddress(lagAddressesToFetch); // <------ electrum call
|
||||
|
||||
for (let c = this.next_free_address_index; c < this.next_free_address_index + this.gap_limit; c++) {
|
||||
const address = this._getExternalAddressByIndex(c);
|
||||
if (txs[address] && Array.isArray(txs[address]) && txs[address].length > 0) {
|
||||
// whoa, someone uses our wallet outside! better catch up
|
||||
this.next_free_address_index = c + 1;
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: refactor me ^^^ can be batched in single call. plus not just couple of addresses, but all between [ next_free .. (next_free + gap_limit) ]
|
||||
|
||||
if (tryAgain) return this._fetchBalance();
|
||||
for (let c = this.next_free_change_address_index; c < this.next_free_change_address_index + this.gap_limit; c++) {
|
||||
const address = this._getInternalAddressByIndex(c);
|
||||
if (txs[address] && Array.isArray(txs[address]) && txs[address].length > 0) {
|
||||
// whoa, someone uses our wallet outside! better catch up
|
||||
this.next_free_change_address_index = c + 1;
|
||||
}
|
||||
}
|
||||
|
||||
// next, business as usuall. fetch balances
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.6.0</string>
|
||||
<string>5.6.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>239</string>
|
||||
<key>CLKComplicationPrincipalClass</key>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.6.0</string>
|
||||
<string>5.6.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>239</string>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<key>CFBundlePackageType</key>
|
||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.6.0</string>
|
||||
<string>5.6.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSExtension</key>
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
v.5.6.0
|
||||
=======
|
||||
|
||||
* FIX: some transactions displayed with 0 value
|
||||
* FIX: PSBT with HW wallets flow
|
||||
* FIX: rare crash on watch-only receive button
|
||||
* FIX: RBF cancel style
|
||||
* REF: updated languages sl_SI, de_DE, fi_FI, es_ES
|
||||
|
||||
v5.5.9
|
||||
=======
|
||||
|
||||
|
@ -80,20 +89,3 @@ v5.5.5
|
|||
======
|
||||
|
||||
* FIX: scan Cobo vault signed transaction QR
|
||||
|
||||
v5.5.4
|
||||
======
|
||||
|
||||
* ADD: handling push notification open
|
||||
* ADD: View Wallet xPub (Apple Watch)
|
||||
* ADD: COP Fiat
|
||||
* FIX: Invoice were not being sent (Apple Watch)
|
||||
* FIX: Disable some Watch app elements when app is not reachable
|
||||
* FIX: Show loading indicator when processing file or qrcode image
|
||||
* FIX: Button size for large devices
|
||||
* FIX: better handling of electrum disconnect
|
||||
* FIX: disable push notifications in settings
|
||||
* FIX: Font-Color in Bump-Fee Input Field "Custom" is not adapted for dark mode
|
||||
* FIX: QRCode border in LND Backup screen
|
||||
* FIX: Animated QRCode border. Change save path to Downloads folder
|
||||
* FIX: sk_SK language updates
|
||||
|
|
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "bluewallet",
|
||||
"version": "5.6.0",
|
||||
"version": "5.6.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "bluewallet",
|
||||
"version": "5.6.0",
|
||||
"version": "5.6.1",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.9.6",
|
||||
|
|
|
@ -14,6 +14,7 @@ import {
|
|||
Linking,
|
||||
StyleSheet,
|
||||
StatusBar,
|
||||
PermissionsAndroid,
|
||||
} from 'react-native';
|
||||
import { SecondButton, SafeBlueArea, BlueCard, BlueSpacing20, BlueNavigationStyle, BlueText, BlueLoadingHook } from '../../BlueComponents';
|
||||
import { LightningCustodianWallet } from '../../class/wallets/lightning-custodian-wallet';
|
||||
|
@ -26,10 +27,14 @@ import { HDSegwitBech32Wallet, SegwitP2SHWallet, LegacyWallet, SegwitBech32Walle
|
|||
import { ScrollView } from 'react-native-gesture-handler';
|
||||
import loc from '../../loc';
|
||||
import { useTheme, useRoute, useNavigation } from '@react-navigation/native';
|
||||
import RNFS from 'react-native-fs';
|
||||
import Share from 'react-native-share';
|
||||
import { getSystemName } from 'react-native-device-info';
|
||||
const EV = require('../../blue_modules/events');
|
||||
const prompt = require('../../blue_modules/prompt');
|
||||
const BlueApp = require('../../BlueApp');
|
||||
const notifications = require('../../blue_modules/notifications');
|
||||
const isDesktop = getSystemName() === 'Mac OS X';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
root: {
|
||||
|
@ -94,6 +99,7 @@ const styles = StyleSheet.create({
|
|||
const WalletDetails = () => {
|
||||
const { wallet } = useRoute().params;
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [backdoorPressed, setBackdoorPressed] = useState(0);
|
||||
const [walletName, setWalletName] = useState(wallet.getLabel());
|
||||
const [useWithHardwareWallet, setUseWithHardwareWallet] = useState(wallet.useWithHardwareWalletEnabled());
|
||||
const [hideTransactionsInWalletsList, setHideTransactionsInWalletsList] = useState(!wallet.getHideTransactionsInWalletsList());
|
||||
|
@ -204,6 +210,65 @@ const WalletDetails = () => {
|
|||
});
|
||||
};
|
||||
|
||||
const exportInternals = async () => {
|
||||
if (backdoorPressed < 10) return setBackdoorPressed(backdoorPressed + 1);
|
||||
setBackdoorPressed(0);
|
||||
if (wallet.type !== HDSegwitBech32Wallet.type) return;
|
||||
const fileName = 'wallet-externals.json';
|
||||
const contents = JSON.stringify(
|
||||
{
|
||||
_balances_by_external_index: wallet._balances_by_external_index,
|
||||
_balances_by_internal_index: wallet._balances_by_internal_index,
|
||||
_txs_by_external_index: wallet._txs_by_external_index,
|
||||
_txs_by_internal_index: wallet._txs_by_internal_index,
|
||||
_utxo: wallet._utxo,
|
||||
next_free_address_index: wallet.next_free_address_index,
|
||||
next_free_change_address_index: wallet.next_free_change_address_index,
|
||||
internal_addresses_cache: wallet.internal_addresses_cache,
|
||||
external_addresses_cache: wallet.external_addresses_cache,
|
||||
_xpub: wallet._xpub,
|
||||
gap_limit: wallet.gap_limit,
|
||||
label: wallet.label,
|
||||
_lastTxFetch: wallet._lastTxFetch,
|
||||
_lastBalanceFetch: wallet._lastBalanceFetch,
|
||||
},
|
||||
null,
|
||||
2,
|
||||
);
|
||||
if (Platform.OS === 'ios') {
|
||||
const filePath = RNFS.TemporaryDirectoryPath + `/${fileName}`;
|
||||
await RNFS.writeFile(filePath, contents);
|
||||
Share.open({
|
||||
url: 'file://' + filePath,
|
||||
saveToFiles: isDesktop,
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
alert(error.message);
|
||||
})
|
||||
.finally(() => {
|
||||
RNFS.unlink(filePath);
|
||||
});
|
||||
} else if (Platform.OS === 'android') {
|
||||
const granted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE, {
|
||||
title: loc.send.permission_storage_title,
|
||||
message: loc.send.permission_storage_message,
|
||||
buttonNeutral: loc.send.permission_storage_later,
|
||||
buttonNegative: loc._.cancel,
|
||||
buttonPositive: loc._.ok,
|
||||
});
|
||||
|
||||
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
|
||||
console.log('Storage Permission: Granted');
|
||||
const filePath = RNFS.DownloadDirectoryPath + `/${fileName}`;
|
||||
await RNFS.writeFile(filePath, contents);
|
||||
alert(loc.formatString(loc.send.txSaved, { filePath: fileName }));
|
||||
} else {
|
||||
console.log('Storage Permission: Denied');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const navigateToBroadcast = () => {
|
||||
navigate('Broadcast');
|
||||
};
|
||||
|
@ -302,7 +367,9 @@ const WalletDetails = () => {
|
|||
</>
|
||||
)}
|
||||
<>
|
||||
<Text style={[styles.textLabel2, stylesHook.textLabel2]}>{loc.transactions.list_title.toLowerCase()}</Text>
|
||||
<Text onPress={exportInternals} style={[styles.textLabel2, stylesHook.textLabel2]}>
|
||||
{loc.transactions.list_title.toLowerCase()}
|
||||
</Text>
|
||||
<View style={styles.hardware}>
|
||||
<BlueText>{loc.wallets.details_display}</BlueText>
|
||||
<Switch value={hideTransactionsInWalletsList} onValueChange={setHideTransactionsInWalletsList} />
|
||||
|
|
Loading…
Add table
Reference in a new issue