mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-12 02:08:22 +01:00
fix: replace require with import
This commit is contained in:
parent
2a95f59201
commit
49f0b1a753
30 changed files with 67 additions and 56 deletions
|
@ -1,17 +1,17 @@
|
||||||
// @ts-ignore: Ignore import errors
|
import AES from 'crypto-js/aes';
|
||||||
import CryptoJS from 'crypto-js';
|
import Utf8 from 'crypto-js/enc-utf8';
|
||||||
|
|
||||||
export function encrypt(data: string, password: string): string {
|
export function encrypt(data: string, password: string): string {
|
||||||
if (data.length < 10) throw new Error('data length cant be < 10');
|
if (data.length < 10) throw new Error('data length cant be < 10');
|
||||||
const ciphertext = CryptoJS.AES.encrypt(data, password);
|
const ciphertext = AES.encrypt(data, password);
|
||||||
return ciphertext.toString();
|
return ciphertext.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function decrypt(data: string, password: string): string | false {
|
export function decrypt(data: string, password: string): string | false {
|
||||||
const bytes = CryptoJS.AES.decrypt(data, password);
|
const bytes = AES.decrypt(data, password);
|
||||||
let str: string | false = false;
|
let str: string | false = false;
|
||||||
try {
|
try {
|
||||||
str = bytes.toString(CryptoJS.enc.Utf8);
|
str = bytes.toString(Utf8);
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
// For some reason, sometimes decrypt would succeed with an incorrect password and return random characters.
|
// For some reason, sometimes decrypt would succeed with an incorrect password and return random characters.
|
||||||
|
|
|
@ -7,14 +7,14 @@ import loc from '../loc';
|
||||||
import { requestNotifications } from 'react-native-permissions';
|
import { requestNotifications } from 'react-native-permissions';
|
||||||
import PushNotification from 'react-native-push-notification';
|
import PushNotification from 'react-native-push-notification';
|
||||||
import ActionSheet from '../screen/ActionSheet';
|
import ActionSheet from '../screen/ActionSheet';
|
||||||
|
import { groundControlUri } from './constants';
|
||||||
|
|
||||||
const constants = require('./constants');
|
|
||||||
const PUSH_TOKEN = 'PUSH_TOKEN';
|
const PUSH_TOKEN = 'PUSH_TOKEN';
|
||||||
const GROUNDCONTROL_BASE_URI = 'GROUNDCONTROL_BASE_URI';
|
const GROUNDCONTROL_BASE_URI = 'GROUNDCONTROL_BASE_URI';
|
||||||
const NOTIFICATIONS_STORAGE = 'NOTIFICATIONS_STORAGE';
|
const NOTIFICATIONS_STORAGE = 'NOTIFICATIONS_STORAGE';
|
||||||
const NOTIFICATIONS_NO_AND_DONT_ASK_FLAG = 'NOTIFICATIONS_NO_AND_DONT_ASK_FLAG';
|
const NOTIFICATIONS_NO_AND_DONT_ASK_FLAG = 'NOTIFICATIONS_NO_AND_DONT_ASK_FLAG';
|
||||||
let alreadyConfigured = false;
|
let alreadyConfigured = false;
|
||||||
let baseURI = constants.groundControlUri;
|
let baseURI = groundControlUri;
|
||||||
|
|
||||||
function Notifications(props) {
|
function Notifications(props) {
|
||||||
async function _setPushToken(token) {
|
async function _setPushToken(token) {
|
||||||
|
@ -254,11 +254,11 @@ function Notifications(props) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Notifications.getDefaultUri = function () {
|
Notifications.getDefaultUri = function () {
|
||||||
return constants.groundControlUri;
|
return groundControlUri;
|
||||||
};
|
};
|
||||||
|
|
||||||
Notifications.saveUri = async function (uri) {
|
Notifications.saveUri = async function (uri) {
|
||||||
baseURI = uri || constants.groundControlUri; // settign the url to use currently. if not set - use default
|
baseURI = uri || groundControlUri; // settign the url to use currently. if not set - use default
|
||||||
return AsyncStorage.setItem(GROUNDCONTROL_BASE_URI, uri);
|
return AsyncStorage.setItem(GROUNDCONTROL_BASE_URI, uri);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,7 @@ import { LightningCustodianWallet, WatchOnlyWallet } from './';
|
||||||
import Azteco from './azteco';
|
import Azteco from './azteco';
|
||||||
import Lnurl from './lnurl';
|
import Lnurl from './lnurl';
|
||||||
import type { TWallet } from './wallets/types';
|
import type { TWallet } from './wallets/types';
|
||||||
|
import { AppStorage } from '../BlueApp';
|
||||||
const BlueApp = require('../BlueApp');
|
|
||||||
const AppStorage = BlueApp.AppStorage;
|
|
||||||
|
|
||||||
type TCompletionHandlerParams = [string, object];
|
type TCompletionHandlerParams = [string, object];
|
||||||
type TContext = {
|
type TContext = {
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
|
import * as bitcoin from 'bitcoinjs-lib';
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
|
||||||
import { HDSegwitBech32Wallet } from './wallets/hd-segwit-bech32-wallet';
|
import { HDSegwitBech32Wallet } from './wallets/hd-segwit-bech32-wallet';
|
||||||
import { SegwitBech32Wallet } from './wallets/segwit-bech32-wallet';
|
import { SegwitBech32Wallet } from './wallets/segwit-bech32-wallet';
|
||||||
import * as BlueElectrum from '../blue_modules/BlueElectrum';
|
import * as BlueElectrum from '../blue_modules/BlueElectrum';
|
||||||
const bitcoin = require('bitcoinjs-lib');
|
|
||||||
const BigNumber = require('bignumber.js');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents transaction of a BIP84 wallet.
|
* Represents transaction of a BIP84 wallet.
|
||||||
|
|
|
@ -3,8 +3,8 @@ import bolt11 from 'bolt11';
|
||||||
import { parse } from 'url'; // eslint-disable-line n/no-deprecated-api
|
import { parse } from 'url'; // eslint-disable-line n/no-deprecated-api
|
||||||
import { createHmac } from 'crypto';
|
import { createHmac } from 'crypto';
|
||||||
import secp256k1 from 'secp256k1';
|
import secp256k1 from 'secp256k1';
|
||||||
const CryptoJS = require('crypto-js');
|
import CryptoJS from 'crypto-js';
|
||||||
const createHash = require('create-hash');
|
import createHash from 'create-hash';
|
||||||
|
|
||||||
const ONION_REGEX = /^(http:\/\/[^/:@]+\.onion(?::\d{1,5})?)(\/.*)?$/; // regex for onion URL
|
const ONION_REGEX = /^(http:\/\/[^/:@]+\.onion(?::\d{1,5})?)(\/.*)?$/; // regex for onion URL
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||||
|
|
||||||
const SHA256 = require('crypto-js/sha256');
|
import SHA256 from 'crypto-js/sha256';
|
||||||
const ENCHEX = require('crypto-js/enc-hex');
|
import ENCHEX from 'crypto-js/enc-hex';
|
||||||
const ENCUTF8 = require('crypto-js/enc-utf8');
|
import ENCUTF8 from 'crypto-js/enc-utf8';
|
||||||
const AES = require('crypto-js/aes');
|
import AES from 'crypto-js/aes';
|
||||||
|
|
||||||
export default class SyncedAsyncStorage {
|
export default class SyncedAsyncStorage {
|
||||||
defaultBaseUrl = 'https://bytes-store.herokuapp.com';
|
defaultBaseUrl = 'https://bytes-store.herokuapp.com';
|
||||||
|
|
13
package-lock.json
generated
13
package-lock.json
generated
|
@ -119,6 +119,7 @@
|
||||||
"@types/bip38": "^3.1.2",
|
"@types/bip38": "^3.1.2",
|
||||||
"@types/bs58check": "^2.1.0",
|
"@types/bs58check": "^2.1.0",
|
||||||
"@types/create-hash": "^1.2.2",
|
"@types/create-hash": "^1.2.2",
|
||||||
|
"@types/crypto-js": "^4.2.2",
|
||||||
"@types/jest": "^29.4.0",
|
"@types/jest": "^29.4.0",
|
||||||
"@types/react": "^18.2.16",
|
"@types/react": "^18.2.16",
|
||||||
"@types/react-native": "^0.72.0",
|
"@types/react-native": "^0.72.0",
|
||||||
|
@ -6359,6 +6360,12 @@
|
||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/crypto-js": {
|
||||||
|
"version": "4.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/crypto-js/-/crypto-js-4.2.2.tgz",
|
||||||
|
"integrity": "sha512-sDOLlVbHhXpAUAL0YHDUUwDZf3iN4Bwi4W6a0W0b+QcAezUbRtH4FVb+9J4h+XFPW7l/gQ9F8qC7P+Ec4k8QVQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/@types/graceful-fs": {
|
"node_modules/@types/graceful-fs": {
|
||||||
"version": "4.1.9",
|
"version": "4.1.9",
|
||||||
"resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz",
|
"resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz",
|
||||||
|
@ -27164,6 +27171,12 @@
|
||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@types/crypto-js": {
|
||||||
|
"version": "4.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/crypto-js/-/crypto-js-4.2.2.tgz",
|
||||||
|
"integrity": "sha512-sDOLlVbHhXpAUAL0YHDUUwDZf3iN4Bwi4W6a0W0b+QcAezUbRtH4FVb+9J4h+XFPW7l/gQ9F8qC7P+Ec4k8QVQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@types/graceful-fs": {
|
"@types/graceful-fs": {
|
||||||
"version": "4.1.9",
|
"version": "4.1.9",
|
||||||
"resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz",
|
"resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz",
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
"@types/bip38": "^3.1.2",
|
"@types/bip38": "^3.1.2",
|
||||||
"@types/bs58check": "^2.1.0",
|
"@types/bs58check": "^2.1.0",
|
||||||
"@types/create-hash": "^1.2.2",
|
"@types/create-hash": "^1.2.2",
|
||||||
|
"@types/crypto-js": "^4.2.2",
|
||||||
"@types/jest": "^29.4.0",
|
"@types/jest": "^29.4.0",
|
||||||
"@types/react": "^18.2.16",
|
"@types/react": "^18.2.16",
|
||||||
"@types/react-native": "^0.72.0",
|
"@types/react-native": "^0.72.0",
|
||||||
|
|
|
@ -2,6 +2,7 @@ import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { ScrollView, View, StyleSheet, Linking } from 'react-native';
|
import { ScrollView, View, StyleSheet, Linking } from 'react-native';
|
||||||
import wif from 'wif';
|
import wif from 'wif';
|
||||||
|
import * as bip39 from 'bip39';
|
||||||
import bip38 from 'bip38';
|
import bip38 from 'bip38';
|
||||||
import BIP32Factory from 'bip32';
|
import BIP32Factory from 'bip32';
|
||||||
import * as bitcoin from 'bitcoinjs-lib';
|
import * as bitcoin from 'bitcoinjs-lib';
|
||||||
|
@ -172,8 +173,6 @@ export default class Selftest extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
const bip39 = require('bip39');
|
|
||||||
const mnemonic =
|
const mnemonic =
|
||||||
'honey risk juice trip orient galaxy win situate shoot anchor bounce remind horse traffic exotic since escape mimic ramp skin judge owner topple erode';
|
'honey risk juice trip orient galaxy win situate shoot anchor bounce remind horse traffic exotic since escape mimic ramp skin judge owner topple erode';
|
||||||
const seed = bip39.mnemonicToSeedSync(mnemonic);
|
const seed = bip39.mnemonicToSeedSync(mnemonic);
|
||||||
|
|
|
@ -16,9 +16,9 @@ import Button from '../../components/Button';
|
||||||
import { useTheme } from '../../components/themes';
|
import { useTheme } from '../../components/themes';
|
||||||
import { isCameraAuthorizationStatusGranted } from '../../helpers/scan-qr';
|
import { isCameraAuthorizationStatusGranted } from '../../helpers/scan-qr';
|
||||||
import loc from '../../loc';
|
import loc from '../../loc';
|
||||||
|
import Base43 from '../../blue_modules/base43';
|
||||||
|
|
||||||
const LocalQRCode = require('@remobile/react-native-qrcode-local-image');
|
const LocalQRCode = require('@remobile/react-native-qrcode-local-image');
|
||||||
const Base43 = require('../../blue_modules/base43');
|
|
||||||
|
|
||||||
let decoder = false;
|
let decoder = false;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,9 @@ import { ActivityIndicator, FlatList, TouchableOpacity, StyleSheet, Switch, View
|
||||||
import { Text } from 'react-native-elements';
|
import { Text } from 'react-native-elements';
|
||||||
import { PayjoinClient } from 'payjoin-client';
|
import { PayjoinClient } from 'payjoin-client';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import * as bitcoin from 'bitcoinjs-lib';
|
||||||
|
|
||||||
import PayjoinTransaction from '../../class/payjoin-transaction';
|
import PayjoinTransaction from '../../class/payjoin-transaction';
|
||||||
import { BlueText, BlueCard } from '../../BlueComponents';
|
import { BlueText, BlueCard } from '../../BlueComponents';
|
||||||
import navigationStyle from '../../components/navigationStyle';
|
import navigationStyle from '../../components/navigationStyle';
|
||||||
|
@ -19,8 +22,6 @@ import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/h
|
||||||
import SafeArea from '../../components/SafeArea';
|
import SafeArea from '../../components/SafeArea';
|
||||||
import { satoshiToBTC, satoshiToLocalCurrency } from '../../blue_modules/currency';
|
import { satoshiToBTC, satoshiToLocalCurrency } from '../../blue_modules/currency';
|
||||||
import * as BlueElectrum from '../../blue_modules/BlueElectrum';
|
import * as BlueElectrum from '../../blue_modules/BlueElectrum';
|
||||||
const Bignumber = require('bignumber.js');
|
|
||||||
const bitcoin = require('bitcoinjs-lib');
|
|
||||||
|
|
||||||
const Confirm = () => {
|
const Confirm = () => {
|
||||||
const { wallets, fetchAndSaveWalletTransactions, isElectrumDisabled } = useContext(BlueStorageContext);
|
const { wallets, fetchAndSaveWalletTransactions, isElectrumDisabled } = useContext(BlueStorageContext);
|
||||||
|
@ -31,7 +32,7 @@ const Confirm = () => {
|
||||||
const [isPayjoinEnabled, setIsPayjoinEnabled] = useState(false);
|
const [isPayjoinEnabled, setIsPayjoinEnabled] = useState(false);
|
||||||
const wallet = wallets.find(w => w.getID() === walletID);
|
const wallet = wallets.find(w => w.getID() === walletID);
|
||||||
const payjoinUrl = wallet.allowPayJoin() ? params.payjoinUrl : false;
|
const payjoinUrl = wallet.allowPayJoin() ? params.payjoinUrl : false;
|
||||||
const feeSatoshi = new Bignumber(fee).multipliedBy(100000000).toNumber();
|
const feeSatoshi = new BigNumber(fee).multipliedBy(100000000).toNumber();
|
||||||
const { navigate, setOptions } = useNavigation();
|
const { navigate, setOptions } = useNavigation();
|
||||||
const { colors } = useTheme();
|
const { colors } = useTheme();
|
||||||
const stylesHook = StyleSheet.create({
|
const stylesHook = StyleSheet.create({
|
||||||
|
|
|
@ -6,6 +6,8 @@ import { Icon } from 'react-native-elements';
|
||||||
import Share from 'react-native-share';
|
import Share from 'react-native-share';
|
||||||
import RNFS from 'react-native-fs';
|
import RNFS from 'react-native-fs';
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
|
import * as bitcoin from 'bitcoinjs-lib';
|
||||||
|
|
||||||
import { BlueText } from '../../BlueComponents';
|
import { BlueText } from '../../BlueComponents';
|
||||||
import navigationStyle from '../../components/navigationStyle';
|
import navigationStyle from '../../components/navigationStyle';
|
||||||
import { BitcoinUnit } from '../../models/bitcoinUnits';
|
import { BitcoinUnit } from '../../models/bitcoinUnits';
|
||||||
|
@ -18,7 +20,6 @@ import { PERMISSIONS, RESULTS, request } from 'react-native-permissions';
|
||||||
import { useTheme } from '../../components/themes';
|
import { useTheme } from '../../components/themes';
|
||||||
import { satoshiToBTC } from '../../blue_modules/currency';
|
import { satoshiToBTC } from '../../blue_modules/currency';
|
||||||
import usePrivacy from '../../hooks/usePrivacy';
|
import usePrivacy from '../../hooks/usePrivacy';
|
||||||
const bitcoin = require('bitcoinjs-lib');
|
|
||||||
|
|
||||||
const SendCreate = () => {
|
const SendCreate = () => {
|
||||||
const { fee, recipients, memo = '', satoshiPerByte, psbt, showAnimatedQr, tx } = useRoute().params;
|
const { fee, recipients, memo = '', satoshiPerByte, psbt, showAnimatedQr, tx } = useRoute().params;
|
||||||
|
|
|
@ -2,6 +2,8 @@ import React, { useContext, useEffect, useState } from 'react';
|
||||||
import { FlatList, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
import { FlatList, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
||||||
import { Icon } from 'react-native-elements';
|
import { Icon } from 'react-native-elements';
|
||||||
import { useNavigation, useRoute } from '@react-navigation/native';
|
import { useNavigation, useRoute } from '@react-navigation/native';
|
||||||
|
import * as bitcoin from 'bitcoinjs-lib';
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
|
||||||
import { BlueCard, BlueText } from '../../BlueComponents';
|
import { BlueCard, BlueText } from '../../BlueComponents';
|
||||||
import navigationStyle from '../../components/navigationStyle';
|
import navigationStyle from '../../components/navigationStyle';
|
||||||
|
@ -13,8 +15,6 @@ import { useTheme } from '../../components/themes';
|
||||||
import Button from '../../components/Button';
|
import Button from '../../components/Button';
|
||||||
import SafeArea from '../../components/SafeArea';
|
import SafeArea from '../../components/SafeArea';
|
||||||
import { satoshiToBTC, satoshiToLocalCurrency } from '../../blue_modules/currency';
|
import { satoshiToBTC, satoshiToLocalCurrency } from '../../blue_modules/currency';
|
||||||
const bitcoin = require('bitcoinjs-lib');
|
|
||||||
const BigNumber = require('bignumber.js');
|
|
||||||
|
|
||||||
const shortenAddress = addr => {
|
const shortenAddress = addr => {
|
||||||
return addr.substr(0, Math.floor(addr.length / 2) - 1) + '\n' + addr.substr(Math.floor(addr.length / 2) - 1, addr.length);
|
return addr.substr(0, Math.floor(addr.length / 2) - 1) + '\n' + addr.substr(Math.floor(addr.length / 2) - 1, addr.length);
|
||||||
|
|
|
@ -12,9 +12,7 @@ import DeeplinkSchemaMatch from '../../class/deeplink-schema-match';
|
||||||
import presentAlert from '../../components/Alert';
|
import presentAlert from '../../components/Alert';
|
||||||
import { requestCameraAuthorization } from '../../helpers/scan-qr';
|
import { requestCameraAuthorization } from '../../helpers/scan-qr';
|
||||||
import { Button } from '../../components/Button';
|
import { Button } from '../../components/Button';
|
||||||
|
import { AppStorage } from '../../BlueApp';
|
||||||
const BlueApp = require('../../BlueApp');
|
|
||||||
const AppStorage = BlueApp.AppStorage;
|
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
uri: {
|
uri: {
|
||||||
|
|
|
@ -2,6 +2,7 @@ import React, { useContext, useEffect, useLayoutEffect, useState } from 'react';
|
||||||
import { View, ScrollView, TouchableOpacity, Text, TextInput, Linking, StyleSheet, Keyboard } from 'react-native';
|
import { View, ScrollView, TouchableOpacity, Text, TextInput, Linking, StyleSheet, Keyboard } from 'react-native';
|
||||||
import { useNavigation, useRoute } from '@react-navigation/native';
|
import { useNavigation, useRoute } from '@react-navigation/native';
|
||||||
import Clipboard from '@react-native-clipboard/clipboard';
|
import Clipboard from '@react-native-clipboard/clipboard';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
import { BlueCard, BlueLoading, BlueSpacing20, BlueText } from '../../BlueComponents';
|
import { BlueCard, BlueLoading, BlueSpacing20, BlueText } from '../../BlueComponents';
|
||||||
import navigationStyle from '../../components/navigationStyle';
|
import navigationStyle from '../../components/navigationStyle';
|
||||||
import HandOffComponent from '../../components/HandOffComponent';
|
import HandOffComponent from '../../components/HandOffComponent';
|
||||||
|
@ -13,7 +14,6 @@ import { useTheme } from '../../components/themes';
|
||||||
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
import triggerHapticFeedback, { HapticFeedbackTypes } from '../../blue_modules/hapticFeedback';
|
||||||
import CopyToClipboardButton from '../../components/CopyToClipboardButton';
|
import CopyToClipboardButton from '../../components/CopyToClipboardButton';
|
||||||
import { BitcoinUnit } from '../../models/bitcoinUnits';
|
import { BitcoinUnit } from '../../models/bitcoinUnits';
|
||||||
const dayjs = require('dayjs');
|
|
||||||
|
|
||||||
function onlyUnique(value, index, self) {
|
function onlyUnique(value, index, self) {
|
||||||
return self.indexOf(value) === index;
|
return self.indexOf(value) === index;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { HDSegwitBech32Wallet } from './hd-segwit-bech32-wallet';
|
||||||
import bolt11 from 'bolt11';
|
import bolt11 from 'bolt11';
|
||||||
import { SegwitBech32Wallet } from './segwit-bech32-wallet';
|
import { SegwitBech32Wallet } from './segwit-bech32-wallet';
|
||||||
import presentAlert from '../../components/Alert';
|
import presentAlert from '../../components/Alert';
|
||||||
const bitcoin = require('bitcoinjs-lib');
|
import * as bitcoin from 'bitcoinjs-lib';
|
||||||
|
|
||||||
export class LightningLdkWallet extends LightningCustodianWallet {
|
export class LightningLdkWallet extends LightningCustodianWallet {
|
||||||
static type = 'lightningLdk';
|
static type = 'lightningLdk';
|
||||||
|
|
|
@ -9,8 +9,8 @@ import {
|
||||||
helperCreateWallet,
|
helperCreateWallet,
|
||||||
helperSwitchAdvancedMode,
|
helperSwitchAdvancedMode,
|
||||||
} from './helperz';
|
} from './helperz';
|
||||||
const bitcoin = require('bitcoinjs-lib');
|
import * as bitcoin from 'bitcoinjs-lib';
|
||||||
const assert = require('assert');
|
import assert from 'assert';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this testsuite is for test cases that require no wallets to be present
|
* this testsuite is for test cases that require no wallets to be present
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { extractTextFromElementById, hashIt, helperImportWallet, sleep, sup, yo } from './helperz';
|
import { extractTextFromElementById, hashIt, helperImportWallet, sleep, sup, yo } from './helperz';
|
||||||
|
|
||||||
const bitcoin = require('bitcoinjs-lib');
|
import * as bitcoin from 'bitcoinjs-lib';
|
||||||
const assert = require('assert');
|
import assert from 'assert';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* in this suite each test requires that there is one specific wallet present, thus, we import it
|
* in this suite each test requires that there is one specific wallet present, thus, we import it
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const createHash = require('create-hash');
|
import createHash from 'create-hash';
|
||||||
|
|
||||||
export function yo(id, timeout = 33000) {
|
export function yo(id, timeout = 33000) {
|
||||||
return waitFor(element(by.id(id)))
|
return waitFor(element(by.id(id)))
|
||||||
|
|
|
@ -6,8 +6,8 @@ import * as BlueElectrum from '../../blue_modules/BlueElectrum';
|
||||||
import BIP47Factory from '@spsina/bip47';
|
import BIP47Factory from '@spsina/bip47';
|
||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
|
|
||||||
const bitcoin = require('bitcoinjs-lib');
|
import * as bitcoin from 'bitcoinjs-lib';
|
||||||
const ecc = require('tiny-secp256k1');
|
import ecc from 'tiny-secp256k1';
|
||||||
const ECPair = ECPairFactory(ecc);
|
const ECPair = ECPairFactory(ecc);
|
||||||
|
|
||||||
jest.setTimeout(90 * 1000);
|
jest.setTimeout(90 * 1000);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { LightningLdkWallet } from '../../class';
|
import { LightningLdkWallet } from '../../class';
|
||||||
import SyncedAsyncStorage from '../../class/synced-async-storage';
|
import SyncedAsyncStorage from '../../class/synced-async-storage';
|
||||||
const assert = require('assert');
|
import assert from 'assert';
|
||||||
|
|
||||||
describe('', () => {
|
describe('', () => {
|
||||||
// eslint-disable-next-line jest/no-disabled-tests
|
// eslint-disable-next-line jest/no-disabled-tests
|
||||||
|
|
|
@ -4,7 +4,7 @@ import assert from 'assert';
|
||||||
|
|
||||||
import { HDSegwitBech32Wallet, WatchOnlyWallet } from '../../class';
|
import { HDSegwitBech32Wallet, WatchOnlyWallet } from '../../class';
|
||||||
import { ECPairFactory } from 'ecpair';
|
import { ECPairFactory } from 'ecpair';
|
||||||
const bitcoin = require('bitcoinjs-lib');
|
import * as bitcoin from 'bitcoinjs-lib';
|
||||||
|
|
||||||
const ECPair = ECPairFactory(ecc);
|
const ECPair = ECPairFactory(ecc);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import assert from 'assert';
|
||||||
import { HDAezeedWallet, WatchOnlyWallet } from '../../class';
|
import { HDAezeedWallet, WatchOnlyWallet } from '../../class';
|
||||||
const assert = require('assert');
|
|
||||||
|
|
||||||
describe('HDAezeedWallet', () => {
|
describe('HDAezeedWallet', () => {
|
||||||
it('can import mnemonics and generate addresses and WIFs', async function () {
|
it('can import mnemonics and generate addresses and WIFs', async function () {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import assert from 'assert';
|
||||||
import { HDLegacyElectrumSeedP2PKHWallet } from '../../class';
|
import { HDLegacyElectrumSeedP2PKHWallet } from '../../class';
|
||||||
const assert = require('assert');
|
|
||||||
|
|
||||||
describe('HDLegacyElectrumSeedP2PKHWallet', () => {
|
describe('HDLegacyElectrumSeedP2PKHWallet', () => {
|
||||||
it('wont accept BIP39 seed', () => {
|
it('wont accept BIP39 seed', () => {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
import * as bitcoin from 'bitcoinjs-lib';
|
||||||
|
import assert from 'assert';
|
||||||
import { LegacyWallet } from '../../class';
|
import { LegacyWallet } from '../../class';
|
||||||
import { ECPairFactory } from 'ecpair';
|
import { ECPairFactory } from 'ecpair';
|
||||||
import ecc from '../../blue_modules/noble_ecc';
|
import ecc from '../../blue_modules/noble_ecc';
|
||||||
const ECPair = ECPairFactory(ecc);
|
const ECPair = ECPairFactory(ecc);
|
||||||
const bitcoin = require('bitcoinjs-lib');
|
|
||||||
const assert = require('assert');
|
|
||||||
|
|
||||||
describe('Legacy wallet', () => {
|
describe('Legacy wallet', () => {
|
||||||
it('can validate addresses', () => {
|
it('can validate addresses', () => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import assert from 'assert';
|
||||||
import Lnurl from '../../class/lnurl';
|
import Lnurl from '../../class/lnurl';
|
||||||
const assert = require('assert');
|
|
||||||
|
|
||||||
describe('LNURL', function () {
|
describe('LNURL', function () {
|
||||||
it('can findlnurl', () => {
|
it('can findlnurl', () => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
import * as bitcoin from 'bitcoinjs-lib';
|
||||||
|
import assert from 'assert';
|
||||||
import { SegwitBech32Wallet } from '../../class';
|
import { SegwitBech32Wallet } from '../../class';
|
||||||
const bitcoin = require('bitcoinjs-lib');
|
|
||||||
const assert = require('assert');
|
|
||||||
|
|
||||||
describe('Segwit P2SH wallet', () => {
|
describe('Segwit P2SH wallet', () => {
|
||||||
it('can create transaction', async () => {
|
it('can create transaction', async () => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
import * as bitcoin from 'bitcoinjs-lib';
|
||||||
|
import assert from 'assert';
|
||||||
import { SegwitP2SHWallet } from '../../class';
|
import { SegwitP2SHWallet } from '../../class';
|
||||||
const bitcoin = require('bitcoinjs-lib');
|
|
||||||
const assert = require('assert');
|
|
||||||
|
|
||||||
describe('Segwit P2SH wallet', () => {
|
describe('Segwit P2SH wallet', () => {
|
||||||
it('can create transaction', async () => {
|
it('can create transaction', async () => {
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
|
import assert from 'assert';
|
||||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||||
import { SegwitP2SHWallet } from '../../class';
|
import { SegwitP2SHWallet } from '../../class';
|
||||||
const BlueApp = require('../../BlueApp');
|
import { AppStorage } from '../../BlueApp';
|
||||||
const AppStorage = BlueApp.AppStorage;
|
|
||||||
const assert = require('assert');
|
|
||||||
|
|
||||||
jest.mock('../../blue_modules/BlueElectrum', () => {
|
jest.mock('../../blue_modules/BlueElectrum', () => {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { WatchOnlyWallet } from '../../class';
|
import { WatchOnlyWallet } from '../../class';
|
||||||
import { decodeUR, encodeUR, setUseURv1, clearUseURv1, extractSingleWorkload, BlueURDecoder } from '../../blue_modules/ur';
|
import { decodeUR, encodeUR, setUseURv1, clearUseURv1, extractSingleWorkload, BlueURDecoder } from '../../blue_modules/ur';
|
||||||
import { Psbt } from 'bitcoinjs-lib';
|
import { Psbt } from 'bitcoinjs-lib';
|
||||||
const assert = require('assert');
|
import assert from 'assert';
|
||||||
|
|
||||||
describe('Watch only wallet', () => {
|
describe('Watch only wallet', () => {
|
||||||
it('can validate address', async () => {
|
it('can validate address', async () => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue