fix: replace require with import for blue_modules

This commit is contained in:
Ivan Vershigora 2024-03-31 20:59:14 +01:00
parent 04d1a239f3
commit 5b223971c5
No known key found for this signature in database
GPG key ID: DCCF7FB5ED2CEBD7
33 changed files with 258 additions and 240 deletions

2
App.js
View file

@ -34,7 +34,7 @@ import triggerHapticFeedback, { HapticFeedbackTypes } from './blue_modules/hapti
import MenuElements from './components/MenuElements';
import { updateExchangeRate } from './blue_modules/currency';
import { NavigationProvider } from './components/NavigationProvider';
const A = require('./blue_modules/analytics');
import A from './blue_modules/analytics';
const eventEmitter = Platform.OS === 'ios' ? new NativeEventEmitter(NativeModules.EventEmitter) : undefined;
const { EventEmitter, SplashScreen } = NativeModules;

View file

@ -8,6 +8,7 @@ import Realm from 'realm';
import BlueElectrum from './blue_modules/BlueElectrum';
import { initCurrencyDaemon } from './blue_modules/currency';
import * as encryption from './blue_modules/encryption';
import {
HDAezeedWallet,
HDLegacyBreadwalletWallet,
@ -31,11 +32,9 @@ import Biometric from './class/biometrics';
import { randomBytes } from './class/rng';
import { TWallet, Transaction } from './class/wallets/types';
import presentAlert from './components/Alert';
import prompt from './helpers/prompt';
import loc from './loc';
const prompt = require('./helpers/prompt');
const encryption = require('./blue_modules/encryption');
let usedBucketNum: boolean | number = false;
let savingInProgress = 0; // its both a flag and a counter of attempts to write to disk
BlueElectrum.connectMain();

View file

@ -1,13 +1,13 @@
import { getUniqueId } from 'react-native-device-info';
import Bugsnag from '@bugsnag/react-native';
const BlueApp = require('../BlueApp');
import BlueApp from '../BlueApp';
/**
* in case Bugsnag was started, but user decided to opt out while using the app, we have this
* flag `userHasOptedOut` and we forbid logging in `onError` handler
* @type {boolean}
*/
let userHasOptedOut = false;
let userHasOptedOut: boolean = false;
if (process.env.NODE_ENV !== 'development') {
(async () => {
@ -20,7 +20,6 @@ if (process.env.NODE_ENV !== 'development') {
}
Bugsnag.start({
collectUserIp: false,
user: {
id: uniqueID,
},
@ -31,7 +30,7 @@ if (process.env.NODE_ENV !== 'development') {
})();
}
const A = async event => {};
const A = async (event: string) => {};
A.ENUM = {
INIT: 'INIT',
@ -42,13 +41,13 @@ A.ENUM = {
APP_UNSUSPENDED: 'APP_UNSUSPENDED',
};
A.setOptOut = value => {
A.setOptOut = (value: boolean) => {
if (value) userHasOptedOut = true;
};
A.logError = errorString => {
A.logError = (errorString: string) => {
console.error(errorString);
Bugsnag.notify(new Error(String(errorString)));
};
module.exports = A;
export default A;

View file

@ -1,14 +0,0 @@
const base = require('base-x');
const Base43 = {
encode: function () {
throw new Error('not implemented');
},
decode: function (input) {
const x = base('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$*+-./:');
return x.decode(input).toString('hex');
},
};
module.exports = Base43;

15
blue_modules/base43.ts Normal file
View file

@ -0,0 +1,15 @@
import base from 'base-x';
const Base43 = {
encode: function () {
throw new Error('not implemented');
},
decode: function (input: string): string {
const x = base('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ$*+-./:');
const uint8 = x.decode(input);
return Buffer.from(uint8).toString('hex');
},
};
export default Base43;

View file

@ -10,9 +10,9 @@ import loc, { STORAGE_KEY as LOC_STORAGE_KEY } from '../loc';
import { FiatUnit, TFiatUnit } from '../models/fiatUnit';
import { PREFERRED_CURRENCY_STORAGE_KEY } from './currency';
import triggerHapticFeedback, { HapticFeedbackTypes } from './hapticFeedback';
import A from '../blue_modules/analytics';
const BlueElectrum = require('./BlueElectrum');
const A = require('../blue_modules/analytics');
// hashmap of timestamps we _started_ refetching some wallet
const _lastTimeTriedToRefetchWallet: { [walletID: string]: number } = {};

View file

@ -15,7 +15,7 @@ import Biometric from '../../class/biometrics';
import presentAlert from '../Alert';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
import QRCodeComponent from '../QRCodeComponent';
const confirm = require('../../helpers/confirm');
import confirm from '../../helpers/confirm';
interface AddressItemProps {
// todo: fix `any` after addresses.js is converted to the church of holy typescript

View file

@ -10,7 +10,7 @@ import loc from '../loc';
*
* @return {Promise<boolean>}
*/
module.exports = function (title = 'Are you sure?', text = ''): Promise<boolean> {
export default function (title = 'Are you sure?', text = ''): Promise<boolean> {
return new Promise(resolve => {
Alert.alert(
title,
@ -30,4 +30,4 @@ module.exports = function (title = 'Are you sure?', text = ''): Promise<boolean>
{ cancelable: false },
);
});
};
}

View file

@ -2,7 +2,7 @@ import { Platform } from 'react-native';
import prompt from 'react-native-prompt-android';
import loc from '../loc';
module.exports = (
export default (
title: string,
text: string,
isCancelable = true,

View file

@ -8,34 +8,34 @@
* @param availableWallets {array} Wallets to be present in selector. If set, overrides `chainType`
* @param noWalletExplanationText {string} Text that is displayed when there are no wallets to select from
*
* @returns {Promise<AbstractWallet>}
* @returns {Promise<TWallet>}
*/
import { AbstractWallet } from '../class';
import { TWallet } from '../class/wallets/types';
module.exports = function (
export default function (
navigateFunc: (scr: string | any, params?: any) => void,
currentScreenName: string,
chainType: string | null,
availableWallets?: AbstractWallet[],
availableWallets?: TWallet[],
noWalletExplanationText = '',
): Promise<AbstractWallet> {
): Promise<TWallet> {
return new Promise((resolve, reject) => {
if (!currentScreenName) return reject(new Error('currentScreenName is not provided'));
const params: {
chainType: string | null;
availableWallets?: AbstractWallet[];
availableWallets?: TWallet[];
noWalletExplanationText?: string;
onWalletSelect: (selectedWallet: AbstractWallet) => void;
onWalletSelect: (selectedWallet: TWallet) => void;
} = {
chainType: null,
onWalletSelect: (selectedWallet: AbstractWallet) => {},
onWalletSelect: (selectedWallet: TWallet) => {},
};
if (chainType) params.chainType = chainType;
if (availableWallets) params.availableWallets = availableWallets;
if (noWalletExplanationText) params.noWalletExplanationText = noWalletExplanationText;
params.onWalletSelect = function (selectedWallet: AbstractWallet) {
params.onWalletSelect = function (selectedWallet: TWallet) {
if (!selectedWallet) return;
setTimeout(() => resolve(selectedWallet), 1);
@ -45,4 +45,4 @@ module.exports = function (
navigateFunc('SelectWallet', params);
});
};
}

View file

@ -1,10 +1,12 @@
import React, { useEffect } from 'react';
import './shim.js';
import React, { useEffect } from 'react';
import { AppRegistry } from 'react-native';
import App from './App';
import { BlueStorageProvider } from './blue_modules/storage-context';
import A from './blue_modules/analytics';
const A = require('./blue_modules/analytics');
if (!Error.captureStackTrace) {
// captureStackTrace is only available when debugging
Error.captureStackTrace = () => {};

48
package-lock.json generated
View file

@ -26,7 +26,7 @@
"@spsina/bip47": "github:BlueWallet/bip47#0a2f02c90350802f2ec93afa4e6c8843be2d687c",
"aezeed": "0.0.5",
"assert": "2.1.0",
"base-x": "3.0.9",
"base-x": "4.0.0",
"bc-bech32": "file:blue_modules/bc-bech32",
"bech32": "2.0.0",
"bignumber.js": "9.1.1",
@ -7639,12 +7639,9 @@
"integrity": "sha512-Y5gU45svrR5tI2Vt/X9GPd3L0HNIKzGu202EjxrXMpuc2V2CiKgemAbUUsqYmZJvPtCXoUKjNZwBJzsNScUbXA=="
},
"node_modules/base-x": {
"version": "3.0.9",
"resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz",
"integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==",
"dependencies": {
"safe-buffer": "^5.0.1"
}
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz",
"integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw=="
},
"node_modules/base64-js": {
"version": "1.5.1",
@ -7791,11 +7788,6 @@
"node": ">=8.0.0"
}
},
"node_modules/bitcoinjs-lib/node_modules/base-x": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz",
"integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw=="
},
"node_modules/bitcoinjs-lib/node_modules/bs58": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz",
@ -8078,6 +8070,14 @@
"base-x": "^3.0.2"
}
},
"node_modules/bs58/node_modules/base-x": {
"version": "3.0.9",
"resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz",
"integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==",
"dependencies": {
"safe-buffer": "^5.0.1"
}
},
"node_modules/bs58check": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz",
@ -28158,12 +28158,9 @@
"integrity": "sha512-Y5gU45svrR5tI2Vt/X9GPd3L0HNIKzGu202EjxrXMpuc2V2CiKgemAbUUsqYmZJvPtCXoUKjNZwBJzsNScUbXA=="
},
"base-x": {
"version": "3.0.9",
"resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz",
"integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==",
"requires": {
"safe-buffer": "^5.0.1"
}
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz",
"integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw=="
},
"base64-js": {
"version": "1.5.1",
@ -28284,11 +28281,6 @@
"varuint-bitcoin": "^1.1.2"
},
"dependencies": {
"base-x": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz",
"integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw=="
},
"bs58": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz",
@ -28531,6 +28523,16 @@
"integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==",
"requires": {
"base-x": "^3.0.2"
},
"dependencies": {
"base-x": {
"version": "3.0.9",
"resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz",
"integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==",
"requires": {
"safe-buffer": "^5.0.1"
}
}
}
},
"bs58check": {

View file

@ -112,7 +112,7 @@
"@spsina/bip47": "github:BlueWallet/bip47#0a2f02c90350802f2ec93afa4e6c8843be2d687c",
"aezeed": "0.0.5",
"assert": "2.1.0",
"base-x": "3.0.9",
"base-x": "4.0.0",
"bc-bech32": "file:blue_modules/bc-bech32",
"bech32": "2.0.0",
"bignumber.js": "9.1.1",

View file

@ -8,8 +8,8 @@ import triggerHapticFeedback, { HapticFeedbackTypes } from '../blue_modules/hapt
import { BlueStorageContext } from '../blue_modules/storage-context';
import presentAlert from '../components/Alert';
import Button from '../components/Button';
import prompt from '../helpers/prompt';
import loc from '../loc';
const prompt = require('../helpers/prompt');
// Action Types
const SET_LOADING = 'SET_LOADING';
@ -56,7 +56,7 @@ const PlausibleDeniability: React.FC = () => {
dispatch({ type: SET_LOADING, payload: false });
return;
}
const p2 = await prompt(loc.plausibledeniability.retype_password);
const p2 = await prompt(loc.plausibledeniability.create_password, loc.plausibledeniability.retype_password);
if (p1 !== p2) {
dispatch({ type: SET_LOADING, payload: false });
triggerHapticFeedback(HapticFeedbackTypes.NotificationError);
@ -64,7 +64,7 @@ const PlausibleDeniability: React.FC = () => {
}
await createFakeStorage(p1);
await resetWallets();
resetWallets();
triggerHapticFeedback(HapticFeedbackTypes.NotificationSuccess);
presentAlert({ message: loc.plausibledeniability.success });
navigation.popToTop();

View file

@ -1,6 +1,8 @@
import React, { useContext, useEffect, useRef, useState } from 'react';
import { View, StyleSheet, Text, Keyboard, TouchableOpacity, SectionList } from 'react-native';
import { RouteProp, useNavigation, useRoute } from '@react-navigation/native';
import { Psbt } from 'bitcoinjs-lib';
import { BlueSpacing20, BlueSpacing10, BlueLoading, BlueTextCentered } from '../../BlueComponents';
import navigationStyle from '../../components/navigationStyle';
import { BlueStorageContext } from '../../blue_modules/storage-context';
@ -9,14 +11,15 @@ import loc, { formatBalance } from '../../loc';
import LNNodeBar from '../../components/LNNodeBar';
import BottomModal from '../../components/BottomModal';
import Button from '../../components/Button';
import { Psbt } from 'bitcoinjs-lib';
import { AbstractWallet, LightningLdkWallet } from '../../class';
import { LightningLdkWallet } from '../../class';
import presentAlert from '../../components/Alert';
import { useTheme } from '../../components/themes';
import StyledButton, { StyledButtonType } from '../../components/StyledButton';
import SafeArea from '../../components/SafeArea';
const selectWallet = require('../../helpers/select-wallet');
const confirm = require('../../helpers/confirm');
import confirm from '../../helpers/confirm';
import selectWallet from '../../helpers/select-wallet';
import { TWallet } from '../../class/wallets/types';
const LdkNodeInfoChannelStatus = { ACTIVE: 'Active', INACTIVE: 'Inactive', PENDING: 'PENDING', STATUS: 'status' };
type LdkInfoRouteProps = RouteProp<
@ -314,9 +317,15 @@ const LdkInfo = () => {
params: {
availableWallets,
chainType: Chain.ONCHAIN,
onWalletSelect: (selectedWallet: AbstractWallet) => {
onWalletSelect: (selectedWallet: TWallet) => {
const selectedWalletID = selectedWallet.getID();
selectedWallet.getAddressAsync().then(selectWallet.setRefundAddress);
selectedWallet.getAddressAsync().then((address): void => {
if (!address) {
presentAlert({ message: 'Error: could not get address for channel withdrawal' });
return;
}
wallet.setRefundAddress(address);
});
// @ts-ignore: Address types later
navigate('LDKOpenChannelRoot', {
screen: 'LDKOpenChannelSetAmount',

View file

@ -18,7 +18,7 @@ import Button from '../../components/Button';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
import SafeArea from '../../components/SafeArea';
import { btcToSatoshi, fiatToBTC, satoshiToBTC, satoshiToLocalCurrency } from '../../blue_modules/currency';
const prompt = require('../../helpers/prompt');
import prompt from '../../helpers/prompt';
/**
* if user has default currency - fiat, attempting to pay will trigger conversion from entered in input field fiat value

View file

@ -4,6 +4,7 @@ import { ScrollView, View, StyleSheet, Linking } from 'react-native';
import wif from 'wif';
import bip38 from 'bip38';
import BIP32Factory from 'bip32';
import * as bitcoin from 'bitcoinjs-lib';
import loc from '../loc';
import { BlueSpacing20, BlueCard, BlueText, BlueLoading } from '../BlueComponents';
@ -20,12 +21,12 @@ import ecc from '../blue_modules/noble_ecc';
import Button from '../components/Button';
import SafeArea from '../components/SafeArea';
import presentAlert from '../components/Alert';
const bitcoin = require('bitcoinjs-lib');
import * as encryption from '../blue_modules/encryption';
import * as fs from '../blue_modules/fs';
const BlueCrypto = require('react-native-blue-crypto');
const encryption = require('../blue_modules/encryption');
const BlueElectrum = require('../blue_modules/BlueElectrum');
const bip32 = BIP32Factory(ecc);
const fs = require('../blue_modules/fs');
const styles = StyleSheet.create({
center: {

View file

@ -1,23 +1,25 @@
import React, { useEffect, useState } from 'react';
import { Image, View, TouchableOpacity, Platform, StyleSheet, TextInput, Alert } from 'react-native';
import { useIsFocused, useNavigation, useRoute } from '@react-navigation/native';
import * as bitcoin from 'bitcoinjs-lib';
import createHash from 'create-hash';
import { Alert, Image, Platform, StyleSheet, TextInput, TouchableOpacity, View } from 'react-native';
import { CameraScreen } from 'react-native-camera-kit';
import { Icon } from 'react-native-elements';
import { launchImageLibrary } from 'react-native-image-picker';
import { decodeUR, extractSingleWorkload, BlueURDecoder } from '../../blue_modules/ur';
import { useNavigation, useRoute, useIsFocused } from '@react-navigation/native';
import loc from '../../loc';
import { BlueLoading, BlueText, BlueSpacing40 } from '../../BlueComponents';
import presentAlert from '../../components/Alert';
import { BlueLoading, BlueSpacing40, BlueText } from '../../BlueComponents';
import * as fs from '../../blue_modules/fs';
import { BlueURDecoder, decodeUR, extractSingleWorkload } from '../../blue_modules/ur';
import { openPrivacyDesktopSettings } from '../../class/camera';
import { isCameraAuthorizationStatusGranted } from '../../helpers/scan-qr';
import { useTheme } from '../../components/themes';
import presentAlert from '../../components/Alert';
import Button from '../../components/Button';
import { useTheme } from '../../components/themes';
import { isCameraAuthorizationStatusGranted } from '../../helpers/scan-qr';
import loc from '../../loc';
const LocalQRCode = require('@remobile/react-native-qrcode-local-image');
const createHash = require('create-hash');
const fs = require('../../blue_modules/fs');
const Base43 = require('../../blue_modules/base43');
const bitcoin = require('bitcoinjs-lib');
let decoder = false;
const styles = StyleSheet.create({

View file

@ -1,4 +1,8 @@
import React, { useState, useRef, useEffect, useCallback, useContext, useMemo, useLayoutEffect } from 'react';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { useFocusEffect, useNavigation, useRoute } from '@react-navigation/native';
import BigNumber from 'bignumber.js';
import * as bitcoin from 'bitcoinjs-lib';
import React, { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
import {
ActivityIndicator,
Alert,
@ -16,38 +20,35 @@ import {
TouchableWithoutFeedback,
View,
} from 'react-native';
import { useNavigation, useRoute, useFocusEffect } from '@react-navigation/native';
import DocumentPicker from 'react-native-document-picker';
import { Icon } from 'react-native-elements';
import AsyncStorage from '@react-native-async-storage/async-storage';
import RNFS from 'react-native-fs';
import BigNumber from 'bignumber.js';
import * as bitcoin from 'bitcoinjs-lib';
import { BlueDismissKeyboardInputAccessory, BlueLoading, BlueText } from '../../BlueComponents';
import { navigationStyleTx } from '../../components/navigationStyle';
import NetworkTransactionFees, { NetworkTransactionFee } from '../../models/networkTransactionFees';
import { BitcoinUnit, Chain } from '../../models/bitcoinUnits';
import { HDSegwitBech32Wallet, MultisigHDWallet, WatchOnlyWallet } from '../../class';
import DocumentPicker from 'react-native-document-picker';
import DeeplinkSchemaMatch from '../../class/deeplink-schema-match';
import loc, { formatBalance, formatBalanceWithoutSuffix } from '../../loc';
import CoinsSelected from '../../components/CoinsSelected';
import BottomModal from '../../components/BottomModal';
import AddressInput from '../../components/AddressInput';
import AmountInput from '../../components/AmountInput';
import InputAccessoryAllFunds from '../../components/InputAccessoryAllFunds';
import { AbstractHDElectrumWallet } from '../../class/wallets/abstract-hd-electrum-wallet';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import ToolTipMenu from '../../components/TooltipMenu';
import { requestCameraAuthorization, scanQrHelper } from '../../helpers/scan-qr';
import { useTheme } from '../../components/themes';
import Button from '../../components/Button';
import ListItem from '../../components/ListItem';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
import { btcToSatoshi, fiatToBTC } from '../../blue_modules/currency';
import * as fs from '../../blue_modules/fs';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import { HDSegwitBech32Wallet, MultisigHDWallet, WatchOnlyWallet } from '../../class';
import DeeplinkSchemaMatch from '../../class/deeplink-schema-match';
import { AbstractHDElectrumWallet } from '../../class/wallets/abstract-hd-electrum-wallet';
import AddressInput from '../../components/AddressInput';
import presentAlert from '../../components/Alert';
const prompt = require('../../helpers/prompt');
const fs = require('../../blue_modules/fs');
import AmountInput from '../../components/AmountInput';
import BottomModal from '../../components/BottomModal';
import Button from '../../components/Button';
import CoinsSelected from '../../components/CoinsSelected';
import InputAccessoryAllFunds from '../../components/InputAccessoryAllFunds';
import ListItem from '../../components/ListItem';
import ToolTipMenu from '../../components/TooltipMenu';
import { navigationStyleTx } from '../../components/navigationStyle';
import { useTheme } from '../../components/themes';
import prompt from '../../helpers/prompt';
import { requestCameraAuthorization, scanQrHelper } from '../../helpers/scan-qr';
import loc, { formatBalance, formatBalanceWithoutSuffix } from '../../loc';
import { BitcoinUnit, Chain } from '../../models/bitcoinUnits';
import NetworkTransactionFees, { NetworkTransactionFee } from '../../models/networkTransactionFees';
const btcAddressRx = /^[a-zA-Z0-9]{26,35}$/;
const SendDetails = () => {

View file

@ -1,19 +1,18 @@
import { useIsFocused, useNavigation, useRoute } from '@react-navigation/native';
import * as bitcoin from 'bitcoinjs-lib';
import React, { useEffect, useRef, useState } from 'react';
import { ActivityIndicator, ScrollView, StyleSheet, View } from 'react-native';
import { useNavigation, useRoute, useIsFocused } from '@react-navigation/native';
import { BlueSpacing20 } from '../../BlueComponents';
import navigationStyle from '../../components/navigationStyle';
import { DynamicQRCode } from '../../components/DynamicQRCode';
import { SquareButton } from '../../components/SquareButton';
import loc from '../../loc';
import * as fs from '../../blue_modules/fs';
import presentAlert from '../../components/Alert';
import { scanQrHelper } from '../../helpers/scan-qr';
import { useTheme } from '../../components/themes';
import { DynamicQRCode } from '../../components/DynamicQRCode';
import SafeArea from '../../components/SafeArea';
const bitcoin = require('bitcoinjs-lib');
const fs = require('../../blue_modules/fs');
import { SquareButton } from '../../components/SquareButton';
import navigationStyle from '../../components/navigationStyle';
import { useTheme } from '../../components/themes';
import { scanQrHelper } from '../../helpers/scan-qr';
import loc from '../../loc';
const PsbtMultisigQRCode = () => {
const { navigate } = useNavigation();

View file

@ -1,27 +1,28 @@
import React, { useContext, useEffect, useRef, useState } from 'react';
import { ActivityIndicator, TouchableOpacity, ScrollView, View, TextInput, Linking, Platform, Text, StyleSheet } from 'react-native';
import Clipboard from '@react-native-clipboard/clipboard';
import { useIsFocused, useNavigation, useRoute } from '@react-navigation/native';
import * as bitcoin from 'bitcoinjs-lib';
import React, { useContext, useEffect, useRef, useState } from 'react';
import { ActivityIndicator, Linking, Platform, ScrollView, StyleSheet, Text, TextInput, TouchableOpacity, View } from 'react-native';
import DocumentPicker from 'react-native-document-picker';
import { useNavigation, useRoute, useIsFocused } from '@react-navigation/native';
import RNFS from 'react-native-fs';
import Biometric from '../../class/biometrics';
import { BlueText, BlueCard, BlueSpacing20 } from '../../BlueComponents';
import navigationStyle from '../../components/navigationStyle';
import loc from '../../loc';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import Notifications from '../../blue_modules/notifications';
import { DynamicQRCode } from '../../components/DynamicQRCode';
import presentAlert from '../../components/Alert';
import { requestCameraAuthorization } from '../../helpers/scan-qr';
import { useTheme } from '../../components/themes';
import { BlueCard, BlueSpacing20, BlueText } from '../../BlueComponents';
import * as fs from '../../blue_modules/fs';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
import Notifications from '../../blue_modules/notifications';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import Biometric from '../../class/biometrics';
import presentAlert from '../../components/Alert';
import CopyToClipboardButton from '../../components/CopyToClipboardButton';
import { DynamicQRCode } from '../../components/DynamicQRCode';
import SafeArea from '../../components/SafeArea';
import { SecondButton } from '../../components/SecondButton';
import CopyToClipboardButton from '../../components/CopyToClipboardButton';
import navigationStyle from '../../components/navigationStyle';
import { useTheme } from '../../components/themes';
import { requestCameraAuthorization } from '../../helpers/scan-qr';
import loc from '../../loc';
const BlueElectrum = require('../../blue_modules/BlueElectrum');
const bitcoin = require('bitcoinjs-lib');
const fs = require('../../blue_modules/fs');
const PsbtWithHardwareWallet = () => {
const { txMetadata, fetchAndSaveWalletTransactions, isElectrumDisabled } = useContext(BlueStorageContext);

View file

@ -11,8 +11,7 @@ import { BlueStorageContext } from '../../blue_modules/storage-context';
import WidgetCommunication from '../../blue_modules/WidgetCommunication';
import { useTheme } from '../../components/themes';
import ListItem from '../../components/ListItem';
const A = require('../../blue_modules/analytics');
import A from '../../blue_modules/analytics';
const SettingsPrivacy = () => {
const { colors } = useTheme();

View file

@ -1,21 +1,22 @@
import React, { useContext } from 'react';
import { TouchableOpacity, ScrollView, Linking, Image, View, Text, StyleSheet, useWindowDimensions, Platform, Alert } from 'react-native';
import { useNavigation } from '@react-navigation/native';
import { Icon } from 'react-native-elements';
import { getApplicationName, getVersion, getBundleId, getBuildNumber, getUniqueIdSync, hasGmsSync } from 'react-native-device-info';
import Rate, { AndroidMarket } from 'react-native-rate';
import { BlueCard, BlueSpacing20, BlueTextCentered } from '../../BlueComponents';
import navigationStyle from '../../components/navigationStyle';
import loc, { formatStringAddTwoWhiteSpaces } from '../../loc';
import Clipboard from '@react-native-clipboard/clipboard';
import { useNavigation } from '@react-navigation/native';
import { Alert, Image, Linking, Platform, ScrollView, StyleSheet, Text, TouchableOpacity, View, useWindowDimensions } from 'react-native';
import { getApplicationName, getBuildNumber, getBundleId, getUniqueIdSync, getVersion, hasGmsSync } from 'react-native-device-info';
import { Icon } from 'react-native-elements';
import Rate, { AndroidMarket } from 'react-native-rate';
import { BlueCard, BlueSpacing20, BlueTextCentered } from '../../BlueComponents';
import A from '../../blue_modules/analytics';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import presentAlert from '../../components/Alert';
import { HDSegwitBech32Wallet } from '../../class';
import { useTheme } from '../../components/themes';
import presentAlert from '../../components/Alert';
import Button from '../../components/Button';
import ListItem from '../../components/ListItem';
import navigationStyle from '../../components/navigationStyle';
import { useTheme } from '../../components/themes';
import loc, { formatStringAddTwoWhiteSpaces } from '../../loc';
const A = require('../../blue_modules/analytics');
const branch = require('../../current-branch.json');
const About = () => {

View file

@ -10,7 +10,7 @@ import presentAlert from '../../components/Alert';
import ListItem from '../../components/ListItem';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
import { useTheme } from '../../components/themes';
const prompt = require('../../helpers/prompt');
import prompt from '../../helpers/prompt';
const EncryptStorage = () => {
const { isStorageEncrypted, encryptStorage, decryptStorage, saveToDisk } = useContext(BlueStorageContext);

View file

@ -36,7 +36,7 @@ import useAsyncPromise from '../../hooks/useAsyncPromise';
import loc from '../../loc';
import { Chain } from '../../models/bitcoinUnits';
import { AppStorage } from '../../BlueApp';
const A = require('../../blue_modules/analytics');
import A from '../../blue_modules/analytics';
enum ButtonSelected {
// @ts-ignore: Return later to update

View file

@ -36,10 +36,10 @@ import { useTheme } from '../../components/themes';
import Button from '../../components/Button';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
import usePrivacy from '../../hooks/usePrivacy';
import prompt from '../../helpers/prompt';
import * as fs from '../../blue_modules/fs';
import A from '../../blue_modules/analytics';
const prompt = require('../../helpers/prompt');
const A = require('../../blue_modules/analytics');
const fs = require('../../blue_modules/fs');
const staticCache = {};
const WalletsAddMultisigStep2 = () => {

View file

@ -1,56 +1,56 @@
import React, { useEffect, useState, useCallback, useContext, useRef, useMemo, useLayoutEffect } from 'react';
import { useRoute } from '@react-navigation/native';
import React, { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
import {
View,
ActivityIndicator,
Alert,
I18nManager,
InteractionManager,
Keyboard,
KeyboardAvoidingView,
Linking,
Platform,
ScrollView,
StyleSheet,
Switch,
Text,
TextInput,
Alert,
KeyboardAvoidingView,
TouchableOpacity,
Keyboard,
TouchableWithoutFeedback,
Switch,
Platform,
Linking,
StyleSheet,
ScrollView,
InteractionManager,
ActivityIndicator,
I18nManager,
View,
} from 'react-native';
import { BlueCard, BlueLoading, BlueSpacing10, BlueSpacing20, BlueText } from '../../BlueComponents';
import navigationStyle from '../../components/navigationStyle';
import { LightningCustodianWallet } from '../../class/wallets/lightning-custodian-wallet';
import Biometric from '../../class/biometrics';
import {
HDSegwitBech32Wallet,
SegwitP2SHWallet,
LegacyWallet,
SegwitBech32Wallet,
WatchOnlyWallet,
MultisigHDWallet,
HDAezeedWallet,
LightningLdkWallet,
} from '../../class';
import loc, { formatBalanceWithoutSuffix } from '../../loc';
import { useRoute } from '@react-navigation/native';
import RNFS from 'react-native-fs';
import Share from 'react-native-share';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import Notifications from '../../blue_modules/notifications';
import { isDesktop } from '../../blue_modules/environment';
import { AbstractHDElectrumWallet } from '../../class/wallets/abstract-hd-electrum-wallet';
import presentAlert from '../../components/Alert';
import { BitcoinUnit, Chain } from '../../models/bitcoinUnits';
import { writeFileAndExport } from '../../blue_modules/fs';
import { PERMISSIONS, RESULTS, request } from 'react-native-permissions';
import { useTheme } from '../../components/themes';
import ListItem from '../../components/ListItem';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
import Button from '../../components/Button';
import { SecondButton } from '../../components/SecondButton';
import { useExtendedNavigation } from '../../hooks/useExtendedNavigation';
import Share from 'react-native-share';
const prompt = require('../../helpers/prompt');
import { BlueCard, BlueLoading, BlueSpacing10, BlueSpacing20, BlueText } from '../../BlueComponents';
import { isDesktop } from '../../blue_modules/environment';
import { writeFileAndExport } from '../../blue_modules/fs';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
import Notifications from '../../blue_modules/notifications';
import { BlueStorageContext } from '../../blue_modules/storage-context';
import {
HDAezeedWallet,
HDSegwitBech32Wallet,
LegacyWallet,
LightningLdkWallet,
MultisigHDWallet,
SegwitBech32Wallet,
SegwitP2SHWallet,
WatchOnlyWallet,
} from '../../class';
import Biometric from '../../class/biometrics';
import { AbstractHDElectrumWallet } from '../../class/wallets/abstract-hd-electrum-wallet';
import { LightningCustodianWallet } from '../../class/wallets/lightning-custodian-wallet';
import presentAlert from '../../components/Alert';
import Button from '../../components/Button';
import ListItem from '../../components/ListItem';
import { SecondButton } from '../../components/SecondButton';
import navigationStyle from '../../components/navigationStyle';
import { useTheme } from '../../components/themes';
import prompt from '../../helpers/prompt';
import { useExtendedNavigation } from '../../hooks/useExtendedNavigation';
import loc, { formatBalanceWithoutSuffix } from '../../loc';
import { BitcoinUnit, Chain } from '../../models/bitcoinUnits';
const styles = StyleSheet.create({
scrollViewContent: {

View file

@ -10,7 +10,7 @@ import { BlueStorageContext } from '../../blue_modules/storage-context';
import { useTheme } from '../../components/themes';
import SafeArea from '../../components/SafeArea';
import usePrivacy from '../../hooks/usePrivacy';
const fs = require('../../blue_modules/fs');
import * as fs from '../../blue_modules/fs';
const ExportMultisigCoordinationSetup = () => {
const walletId = useRoute().params.walletId;

View file

@ -11,7 +11,7 @@ import { LightningLdkWallet } from '../../class';
import presentAlert from '../../components/Alert';
import { useTheme } from '../../components/themes';
import SafeArea from '../../components/SafeArea';
const fs = require('../../blue_modules/fs');
import * as fs from '../../blue_modules/fs';
const LdkViewLogs = () => {
const { colors } = useTheme();

View file

@ -13,9 +13,10 @@ import {
I18nManager,
InteractionManager,
} from 'react-native';
import { Icon } from 'react-native-elements';
import { BlueHeaderDefaultMain } from '../../BlueComponents';
import WalletsCarousel from '../../components/WalletsCarousel';
import { Icon } from 'react-native-elements';
import DeeplinkSchemaMatch from '../../class/deeplink-schema-match';
import ActionSheet from '../ActionSheet';
import loc from '../../loc';
@ -31,9 +32,9 @@ import { useTheme } from '../../components/themes';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
import presentAlert from '../../components/Alert';
import { useExtendedNavigation } from '../../hooks/useExtendedNavigation';
import A from '../../blue_modules/analytics';
import * as fs from '../../blue_modules/fs';
const A = require('../../blue_modules/analytics');
const fs = require('../../blue_modules/fs');
const WalletsListSections = { CAROUSEL: 'CAROUSEL', TRANSACTIONS: 'TRANSACTIONS' };
const WalletsList = () => {

View file

@ -1,9 +1,12 @@
import React, { useEffect, useState, useCallback, useContext, useRef } from 'react';
import { useFocusEffect, useRoute } from '@react-navigation/native';
import PropTypes from 'prop-types';
import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
import {
ActivityIndicator,
Alert,
Dimensions,
FlatList,
I18nManager,
InteractionManager,
PixelRatio,
ScrollView,
@ -11,33 +14,31 @@ import {
Text,
TouchableOpacity,
View,
I18nManager,
findNodeHandle,
} from 'react-native';
import { Icon } from 'react-native-elements';
import { useRoute, useFocusEffect } from '@react-navigation/native';
import { Chain } from '../../models/bitcoinUnits';
import WalletGradient from '../../class/wallet-gradient';
import navigationStyle from '../../components/navigationStyle';
import { LightningCustodianWallet, LightningLdkWallet, MultisigHDWallet, WatchOnlyWallet } from '../../class';
import ActionSheet from '../ActionSheet';
import loc from '../../loc';
import { FContainer, FButton } from '../../components/FloatButtons';
import { BlueStorageContext, WalletTransactionsStatus } from '../../blue_modules/storage-context';
import { isDesktop } from '../../blue_modules/environment';
import BlueClipboard from '../../blue_modules/clipboard';
import LNNodeBar from '../../components/LNNodeBar';
import TransactionsNavigationHeader, { actionKeys } from '../../components/TransactionsNavigationHeader';
import { TransactionListItem } from '../../components/TransactionListItem';
import presentAlert from '../../components/Alert';
import PropTypes from 'prop-types';
import { scanQrHelper } from '../../helpers/scan-qr';
import { useTheme } from '../../components/themes';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
import { useExtendedNavigation } from '../../hooks/useExtendedNavigation';
import { presentWalletExportReminder } from '../../helpers/presentWalletExportReminder';
const fs = require('../../blue_modules/fs');
import BlueClipboard from '../../blue_modules/clipboard';
import { isDesktop } from '../../blue_modules/environment';
import * as fs from '../../blue_modules/fs';
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
import { BlueStorageContext, WalletTransactionsStatus } from '../../blue_modules/storage-context';
import { LightningCustodianWallet, LightningLdkWallet, MultisigHDWallet, WatchOnlyWallet } from '../../class';
import WalletGradient from '../../class/wallet-gradient';
import presentAlert from '../../components/Alert';
import { FButton, FContainer } from '../../components/FloatButtons';
import LNNodeBar from '../../components/LNNodeBar';
import { TransactionListItem } from '../../components/TransactionListItem';
import TransactionsNavigationHeader, { actionKeys } from '../../components/TransactionsNavigationHeader';
import navigationStyle from '../../components/navigationStyle';
import { useTheme } from '../../components/themes';
import { presentWalletExportReminder } from '../../helpers/presentWalletExportReminder';
import { scanQrHelper } from '../../helpers/scan-qr';
import { useExtendedNavigation } from '../../hooks/useExtendedNavigation';
import loc from '../../loc';
import { Chain } from '../../models/bitcoinUnits';
import ActionSheet from '../ActionSheet';
const BlueElectrum = require('../../blue_modules/BlueElectrum');
const buttonFontSize =

View file

@ -53,8 +53,8 @@ import loc from '../../loc';
import { isDesktop } from '../../blue_modules/environment';
import ActionSheet from '../ActionSheet';
import { useExtendedNavigation } from '../../hooks/useExtendedNavigation';
const fs = require('../../blue_modules/fs');
const prompt = require('../../helpers/prompt');
import prompt from '../../helpers/prompt';
import * as fs from '../../blue_modules/fs';
type Props = NativeStackScreenProps<ViewEditMultisigCosignersStackParamsList, 'ViewEditMultisigCosigners'>;
@ -472,7 +472,7 @@ const ViewEditMultisigCosigners = ({ route }: Props) => {
return _handleUseMnemonicPhrase(importText, passphrase);
};
const _handleUseMnemonicPhrase = (mnemonic: string, passphrase: string) => {
const _handleUseMnemonicPhrase = (mnemonic: string, passphrase?: string) => {
if (!wallet || !currentlyEditingCosignerNum) {
// failsafe
return;

View file

@ -1,9 +1,9 @@
import assert from 'assert';
import { MultisigHDWallet } from '../../class/';
import * as bitcoin from 'bitcoinjs-lib';
import Base43 from '../../blue_modules/base43';
import { BlueURDecoder, decodeUR, encodeUR } from '../../blue_modules/ur';
import { MultisigHDWallet } from '../../class/';
import { MultisigCosigner } from '../../class/multisig-cosigner';
const bitcoin = require('bitcoinjs-lib');
const Base43 = require('../../blue_modules/base43');
const fp1cobo = 'D37EAD88';
const Zpub1 = 'Zpub74ijpfhERJNjhCKXRspTdLJV5eoEmSRZdHqDvp9kVtdVEyiXk7pXxRbfZzQvsDFpfDHEHVtVpx4Dz9DGUWGn2Xk5zG5u45QTMsYS2vjohNQ';