mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 15:04:50 +01:00
Merge branch 'master' into passcodeexp
This commit is contained in:
commit
11ac96d672
10 changed files with 23 additions and 45 deletions
|
@ -7,7 +7,6 @@ import WidgetCommunication from './WidgetCommunication';
|
||||||
import presentAlert from '../components/Alert';
|
import presentAlert from '../components/Alert';
|
||||||
const bitcoin = require('bitcoinjs-lib');
|
const bitcoin = require('bitcoinjs-lib');
|
||||||
const ElectrumClient = require('electrum-client');
|
const ElectrumClient = require('electrum-client');
|
||||||
const reverse = require('buffer-reverse');
|
|
||||||
const BigNumber = require('bignumber.js');
|
const BigNumber = require('bignumber.js');
|
||||||
|
|
||||||
const net = require('net');
|
const net = require('net');
|
||||||
|
@ -333,7 +332,7 @@ module.exports.getBalanceByAddress = async function (address) {
|
||||||
if (!mainClient) throw new Error('Electrum client is not connected');
|
if (!mainClient) throw new Error('Electrum client is not connected');
|
||||||
const script = bitcoin.address.toOutputScript(address);
|
const script = bitcoin.address.toOutputScript(address);
|
||||||
const hash = bitcoin.crypto.sha256(script);
|
const hash = bitcoin.crypto.sha256(script);
|
||||||
const reversedHash = Buffer.from(reverse(hash));
|
const reversedHash = Buffer.from(hash).reverse();
|
||||||
const balance = await mainClient.blockchainScripthash_getBalance(reversedHash.toString('hex'));
|
const balance = await mainClient.blockchainScripthash_getBalance(reversedHash.toString('hex'));
|
||||||
balance.addr = address;
|
balance.addr = address;
|
||||||
return balance;
|
return balance;
|
||||||
|
@ -362,7 +361,7 @@ module.exports.getTransactionsByAddress = async function (address) {
|
||||||
if (!mainClient) throw new Error('Electrum client is not connected');
|
if (!mainClient) throw new Error('Electrum client is not connected');
|
||||||
const script = bitcoin.address.toOutputScript(address);
|
const script = bitcoin.address.toOutputScript(address);
|
||||||
const hash = bitcoin.crypto.sha256(script);
|
const hash = bitcoin.crypto.sha256(script);
|
||||||
const reversedHash = Buffer.from(reverse(hash));
|
const reversedHash = Buffer.from(hash).reverse();
|
||||||
const history = await mainClient.blockchainScripthash_getHistory(reversedHash.toString('hex'));
|
const history = await mainClient.blockchainScripthash_getHistory(reversedHash.toString('hex'));
|
||||||
for (const h of history || []) {
|
for (const h of history || []) {
|
||||||
if (h.tx_hash) txhashHeightCache[h.tx_hash] = h.height; // cache tx height
|
if (h.tx_hash) txhashHeightCache[h.tx_hash] = h.height; // cache tx height
|
||||||
|
@ -380,7 +379,7 @@ module.exports.getMempoolTransactionsByAddress = async function (address) {
|
||||||
if (!mainClient) throw new Error('Electrum client is not connected');
|
if (!mainClient) throw new Error('Electrum client is not connected');
|
||||||
const script = bitcoin.address.toOutputScript(address);
|
const script = bitcoin.address.toOutputScript(address);
|
||||||
const hash = bitcoin.crypto.sha256(script);
|
const hash = bitcoin.crypto.sha256(script);
|
||||||
const reversedHash = Buffer.from(reverse(hash));
|
const reversedHash = Buffer.from(hash).reverse();
|
||||||
return mainClient.blockchainScripthash_getMempool(reversedHash.toString('hex'));
|
return mainClient.blockchainScripthash_getMempool(reversedHash.toString('hex'));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -477,7 +476,7 @@ module.exports.multiGetBalanceByAddress = async function (addresses, batchsize)
|
||||||
for (const addr of chunk) {
|
for (const addr of chunk) {
|
||||||
const script = bitcoin.address.toOutputScript(addr);
|
const script = bitcoin.address.toOutputScript(addr);
|
||||||
const hash = bitcoin.crypto.sha256(script);
|
const hash = bitcoin.crypto.sha256(script);
|
||||||
let reversedHash = Buffer.from(reverse(hash));
|
let reversedHash = Buffer.from(hash).reverse();
|
||||||
reversedHash = reversedHash.toString('hex');
|
reversedHash = reversedHash.toString('hex');
|
||||||
scripthashes.push(reversedHash);
|
scripthashes.push(reversedHash);
|
||||||
scripthash2addr[reversedHash] = addr;
|
scripthash2addr[reversedHash] = addr;
|
||||||
|
@ -523,7 +522,7 @@ module.exports.multiGetUtxoByAddress = async function (addresses, batchsize) {
|
||||||
for (const addr of chunk) {
|
for (const addr of chunk) {
|
||||||
const script = bitcoin.address.toOutputScript(addr);
|
const script = bitcoin.address.toOutputScript(addr);
|
||||||
const hash = bitcoin.crypto.sha256(script);
|
const hash = bitcoin.crypto.sha256(script);
|
||||||
let reversedHash = Buffer.from(reverse(hash));
|
let reversedHash = Buffer.from(hash).reverse();
|
||||||
reversedHash = reversedHash.toString('hex');
|
reversedHash = reversedHash.toString('hex');
|
||||||
scripthashes.push(reversedHash);
|
scripthashes.push(reversedHash);
|
||||||
scripthash2addr[reversedHash] = addr;
|
scripthash2addr[reversedHash] = addr;
|
||||||
|
@ -566,7 +565,7 @@ module.exports.multiGetHistoryByAddress = async function (addresses, batchsize)
|
||||||
for (const addr of chunk) {
|
for (const addr of chunk) {
|
||||||
const script = bitcoin.address.toOutputScript(addr);
|
const script = bitcoin.address.toOutputScript(addr);
|
||||||
const hash = bitcoin.crypto.sha256(script);
|
const hash = bitcoin.crypto.sha256(script);
|
||||||
let reversedHash = Buffer.from(reverse(hash));
|
let reversedHash = Buffer.from(hash).reverse();
|
||||||
reversedHash = reversedHash.toString('hex');
|
reversedHash = reversedHash.toString('hex');
|
||||||
scripthashes.push(reversedHash);
|
scripthashes.push(reversedHash);
|
||||||
scripthash2addr[reversedHash] = addr;
|
scripthash2addr[reversedHash] = addr;
|
||||||
|
@ -1039,7 +1038,7 @@ function txhexToElectrumTransaction(txhex) {
|
||||||
if (inn.witness[1]) txinwitness.push(inn.witness[1].toString('hex'));
|
if (inn.witness[1]) txinwitness.push(inn.witness[1].toString('hex'));
|
||||||
|
|
||||||
ret.vin.push({
|
ret.vin.push({
|
||||||
txid: reverse(inn.hash).toString('hex'),
|
txid: Buffer.from(inn.hash).reverse().toString('hex'),
|
||||||
vout: inn.index,
|
vout: inn.index,
|
||||||
scriptSig: { hex: inn.script.toString('hex'), asm: '' },
|
scriptSig: { hex: inn.script.toString('hex'), asm: '' },
|
||||||
txinwitness,
|
txinwitness,
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { HDSegwitBech32Wallet } from './wallets/hd-segwit-bech32-wallet';
|
||||||
import { SegwitBech32Wallet } from './wallets/segwit-bech32-wallet';
|
import { SegwitBech32Wallet } from './wallets/segwit-bech32-wallet';
|
||||||
const bitcoin = require('bitcoinjs-lib');
|
const bitcoin = require('bitcoinjs-lib');
|
||||||
const BlueElectrum = require('../blue_modules/BlueElectrum');
|
const BlueElectrum = require('../blue_modules/BlueElectrum');
|
||||||
const reverse = require('buffer-reverse');
|
|
||||||
const BigNumber = require('bignumber.js');
|
const BigNumber = require('bignumber.js');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -150,7 +149,7 @@ export class HDSegwitBech32Transaction {
|
||||||
|
|
||||||
const prevInputs = [];
|
const prevInputs = [];
|
||||||
for (const inp of this._txDecoded.ins) {
|
for (const inp of this._txDecoded.ins) {
|
||||||
let reversedHash = Buffer.from(reverse(inp.hash));
|
let reversedHash = Buffer.from(inp.hash).reverse();
|
||||||
reversedHash = reversedHash.toString('hex');
|
reversedHash = reversedHash.toString('hex');
|
||||||
prevInputs.push(reversedHash);
|
prevInputs.push(reversedHash);
|
||||||
}
|
}
|
||||||
|
@ -161,7 +160,7 @@ export class HDSegwitBech32Transaction {
|
||||||
let wentIn = 0;
|
let wentIn = 0;
|
||||||
const utxos = [];
|
const utxos = [];
|
||||||
for (const inp of this._txDecoded.ins) {
|
for (const inp of this._txDecoded.ins) {
|
||||||
let reversedHash = Buffer.from(reverse(inp.hash));
|
let reversedHash = Buffer.from(inp.hash).reverse();
|
||||||
reversedHash = reversedHash.toString('hex');
|
reversedHash = reversedHash.toString('hex');
|
||||||
if (prevTransactions[reversedHash] && prevTransactions[reversedHash].vout && prevTransactions[reversedHash].vout[inp.index]) {
|
if (prevTransactions[reversedHash] && prevTransactions[reversedHash].vout && prevTransactions[reversedHash].vout[inp.index]) {
|
||||||
let value = prevTransactions[reversedHash].vout[inp.index].value;
|
let value = prevTransactions[reversedHash].vout[inp.index].value;
|
||||||
|
@ -228,7 +227,7 @@ export class HDSegwitBech32Transaction {
|
||||||
|
|
||||||
const spentUtxos = this._wallet.getDerivedUtxoFromOurTransaction(true);
|
const spentUtxos = this._wallet.getDerivedUtxoFromOurTransaction(true);
|
||||||
for (const inp of this._txDecoded.ins) {
|
for (const inp of this._txDecoded.ins) {
|
||||||
const txidInUtxo = reverse(inp.hash).toString('hex');
|
const txidInUtxo = Buffer.from(inp.hash).reverse().toString('hex');
|
||||||
|
|
||||||
let found = false;
|
let found = false;
|
||||||
for (const spentU of spentUtxos) {
|
for (const spentU of spentUtxos) {
|
||||||
|
|
|
@ -19,7 +19,6 @@ import { CreateTransactionResult, CreateTransactionUtxo, Transaction, Utxo } fro
|
||||||
|
|
||||||
const ECPair = ECPairFactory(ecc);
|
const ECPair = ECPairFactory(ecc);
|
||||||
const BlueElectrum: typeof BlueElectrumNs = require('../../blue_modules/BlueElectrum');
|
const BlueElectrum: typeof BlueElectrumNs = require('../../blue_modules/BlueElectrum');
|
||||||
const reverse = require('buffer-reverse');
|
|
||||||
const bip32 = BIP32Factory(ecc);
|
const bip32 = BIP32Factory(ecc);
|
||||||
const bip47 = BIP47Factory(ecc);
|
const bip47 = BIP47Factory(ecc);
|
||||||
|
|
||||||
|
@ -1165,7 +1164,7 @@ export class AbstractHDElectrumWallet extends AbstractHDWallet {
|
||||||
let masterFingerprintHex = Number(masterFingerprint).toString(16);
|
let masterFingerprintHex = Number(masterFingerprint).toString(16);
|
||||||
if (masterFingerprintHex.length < 8) masterFingerprintHex = '0' + masterFingerprintHex; // conversion without explicit zero might result in lost byte
|
if (masterFingerprintHex.length < 8) masterFingerprintHex = '0' + masterFingerprintHex; // conversion without explicit zero might result in lost byte
|
||||||
const hexBuffer = Buffer.from(masterFingerprintHex, 'hex');
|
const hexBuffer = Buffer.from(masterFingerprintHex, 'hex');
|
||||||
masterFingerprintBuffer = Buffer.from(reverse(hexBuffer));
|
masterFingerprintBuffer = Buffer.from(hexBuffer).reverse();
|
||||||
} else {
|
} else {
|
||||||
masterFingerprintBuffer = Buffer.from([0x00, 0x00, 0x00, 0x00]);
|
masterFingerprintBuffer = Buffer.from([0x00, 0x00, 0x00, 0x00]);
|
||||||
}
|
}
|
||||||
|
@ -1191,7 +1190,7 @@ export class AbstractHDElectrumWallet extends AbstractHDWallet {
|
||||||
let masterFingerprintHex = Number(masterFingerprint).toString(16);
|
let masterFingerprintHex = Number(masterFingerprint).toString(16);
|
||||||
if (masterFingerprintHex.length < 8) masterFingerprintHex = '0' + masterFingerprintHex; // conversion without explicit zero might result in lost byte
|
if (masterFingerprintHex.length < 8) masterFingerprintHex = '0' + masterFingerprintHex; // conversion without explicit zero might result in lost byte
|
||||||
const hexBuffer = Buffer.from(masterFingerprintHex, 'hex');
|
const hexBuffer = Buffer.from(masterFingerprintHex, 'hex');
|
||||||
masterFingerprintBuffer = Buffer.from(reverse(hexBuffer));
|
masterFingerprintBuffer = Buffer.from(hexBuffer).reverse();
|
||||||
} else {
|
} else {
|
||||||
masterFingerprintBuffer = Buffer.from([0x00, 0x00, 0x00, 0x00]);
|
masterFingerprintBuffer = Buffer.from([0x00, 0x00, 0x00, 0x00]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ import * as bip39 from 'bip39';
|
||||||
import * as bitcoin from 'bitcoinjs-lib';
|
import * as bitcoin from 'bitcoinjs-lib';
|
||||||
import { Psbt, Transaction } from 'bitcoinjs-lib';
|
import { Psbt, Transaction } from 'bitcoinjs-lib';
|
||||||
import b58 from 'bs58check';
|
import b58 from 'bs58check';
|
||||||
import reverse from 'buffer-reverse';
|
|
||||||
import createHash from 'create-hash';
|
import createHash from 'create-hash';
|
||||||
import { ECPairFactory } from 'ecpair';
|
import { ECPairFactory } from 'ecpair';
|
||||||
import * as mn from 'electrum-mnemonic';
|
import * as mn from 'electrum-mnemonic';
|
||||||
|
@ -1111,7 +1110,7 @@ export class MultisigHDWallet extends AbstractHDElectrumWallet {
|
||||||
// means we failed to get amounts that go in previously, so lets use utxo amounts cache we've build
|
// means we failed to get amounts that go in previously, so lets use utxo amounts cache we've build
|
||||||
// from non-segwit inputs
|
// from non-segwit inputs
|
||||||
for (const inp of psbt.txInputs) {
|
for (const inp of psbt.txInputs) {
|
||||||
const cacheKey = reverse(inp.hash).toString('hex') + ':' + inp.index;
|
const cacheKey = Buffer.from(inp.hash).reverse().toString('hex') + ':' + inp.index;
|
||||||
if (cacheUtxoAmounts[cacheKey]) goesIn += cacheUtxoAmounts[cacheKey];
|
if (cacheUtxoAmounts[cacheKey]) goesIn += cacheUtxoAmounts[cacheKey];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,6 +281,7 @@
|
||||||
"language": "Język",
|
"language": "Język",
|
||||||
"last_updated": "Ostatnia aktualizacja",
|
"last_updated": "Ostatnia aktualizacja",
|
||||||
"language_isRTL": "Aby ustawienia dotyczące kierunku pisma wybranego języka zaczęły obowiązywać, BlueWallet musi być zrestartowany.",
|
"language_isRTL": "Aby ustawienia dotyczące kierunku pisma wybranego języka zaczęły obowiązywać, BlueWallet musi być zrestartowany.",
|
||||||
|
"license": "Licencja",
|
||||||
"lightning_error_lndhub_uri": "Nieprawidłowy adres LNDHub",
|
"lightning_error_lndhub_uri": "Nieprawidłowy adres LNDHub",
|
||||||
"lightning_saved": "Wprowadzone przez ciebie zmiany zostały pomyślnie zachowane.",
|
"lightning_saved": "Wprowadzone przez ciebie zmiany zostały pomyślnie zachowane.",
|
||||||
"lightning_settings": "Ustawienia Lightning",
|
"lightning_settings": "Ustawienia Lightning",
|
||||||
|
@ -452,7 +453,6 @@
|
||||||
"no_ln_wallet_error": "Musisz najpierw dodać portfel Lightning, zanim zapłacisz fakturę.",
|
"no_ln_wallet_error": "Musisz najpierw dodać portfel Lightning, zanim zapłacisz fakturę.",
|
||||||
"looks_like_bip38": "To wygląda na klucz prywatny chroniony hasłem (BIP38).",
|
"looks_like_bip38": "To wygląda na klucz prywatny chroniony hasłem (BIP38).",
|
||||||
"reorder_title": "Zmień kolejność portfeli",
|
"reorder_title": "Zmień kolejność portfeli",
|
||||||
"reorder_instructions": "Stuknij i przytrzmaj portfel aby go przeciągnąć na liście.",
|
|
||||||
"please_continue_scanning": "Proszę skanuj dalej.",
|
"please_continue_scanning": "Proszę skanuj dalej.",
|
||||||
"select_no_bitcoin": "Nie ma dostępnych portfeli Bitcoin.",
|
"select_no_bitcoin": "Nie ma dostępnych portfeli Bitcoin.",
|
||||||
"select_no_bitcoin_exp": "Portfel Bitcoin jest wymagany by uzupełnić portfel Lightning. Proszę utwórz lub zaimportuj.",
|
"select_no_bitcoin_exp": "Portfel Bitcoin jest wymagany by uzupełnić portfel Lightning. Proszę utwórz lub zaimportuj.",
|
||||||
|
@ -462,7 +462,8 @@
|
||||||
"warning_do_not_disclose": "Uwaga! Nie ujawniać.",
|
"warning_do_not_disclose": "Uwaga! Nie ujawniać.",
|
||||||
"add_ln_wallet_first": "Najpierw musisz dodać portfel Lightning.",
|
"add_ln_wallet_first": "Najpierw musisz dodać portfel Lightning.",
|
||||||
"identity_pubkey": "Klucz publiczny tożsamości",
|
"identity_pubkey": "Klucz publiczny tożsamości",
|
||||||
"xpub_title": "XPUB portfela"
|
"xpub_title": "XPUB portfela",
|
||||||
|
"search_wallets": "Szukaj portfeli"
|
||||||
},
|
},
|
||||||
"multisig": {
|
"multisig": {
|
||||||
"multisig_vault": "Skarbiec",
|
"multisig_vault": "Skarbiec",
|
||||||
|
@ -571,6 +572,8 @@
|
||||||
"sats": "satoshi"
|
"sats": "satoshi"
|
||||||
},
|
},
|
||||||
"addresses": {
|
"addresses": {
|
||||||
|
"copy_private_key": "Skopiuj klucz prywatny",
|
||||||
|
"sensitive_private_key": "Uwaga: klucz prywatne są skrajnie poufne. Kontynuować?",
|
||||||
"sign_title": "Podpisz/Weryfikuj wiadomość",
|
"sign_title": "Podpisz/Weryfikuj wiadomość",
|
||||||
"sign_help": "Tutaj możesz stworzyć lub zweryfikować podpis kryptograficzny oparty o adres Bitcoin.",
|
"sign_help": "Tutaj możesz stworzyć lub zweryfikować podpis kryptograficzny oparty o adres Bitcoin.",
|
||||||
"sign_sign": "Podpisz",
|
"sign_sign": "Podpisz",
|
||||||
|
|
11
package-lock.json
generated
11
package-lock.json
generated
|
@ -38,7 +38,6 @@
|
||||||
"bitcoinjs-message": "2.2.0",
|
"bitcoinjs-message": "2.2.0",
|
||||||
"bolt11": "1.4.1",
|
"bolt11": "1.4.1",
|
||||||
"buffer": "6.0.3",
|
"buffer": "6.0.3",
|
||||||
"buffer-reverse": "1.0.1",
|
|
||||||
"coinselect": "3.1.13",
|
"coinselect": "3.1.13",
|
||||||
"crypto-js": "4.2.0",
|
"crypto-js": "4.2.0",
|
||||||
"dayjs": "1.11.10",
|
"dayjs": "1.11.10",
|
||||||
|
@ -8402,11 +8401,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
||||||
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="
|
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="
|
||||||
},
|
},
|
||||||
"node_modules/buffer-reverse": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/buffer-reverse/-/buffer-reverse-1.0.1.tgz",
|
|
||||||
"integrity": "sha512-M87YIUBsZ6N924W57vDwT/aOu8hw7ZgdByz6ijksLjmHJELBASmYTTlNHRgjE+pTsT9oJXGaDSgqqwfdHotDUg=="
|
|
||||||
},
|
|
||||||
"node_modules/buffer-xor": {
|
"node_modules/buffer-xor": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz",
|
||||||
|
@ -28971,11 +28965,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
||||||
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="
|
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="
|
||||||
},
|
},
|
||||||
"buffer-reverse": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/buffer-reverse/-/buffer-reverse-1.0.1.tgz",
|
|
||||||
"integrity": "sha512-M87YIUBsZ6N924W57vDwT/aOu8hw7ZgdByz6ijksLjmHJELBASmYTTlNHRgjE+pTsT9oJXGaDSgqqwfdHotDUg=="
|
|
||||||
},
|
|
||||||
"buffer-xor": {
|
"buffer-xor": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz",
|
||||||
|
|
|
@ -124,7 +124,6 @@
|
||||||
"bitcoinjs-message": "2.2.0",
|
"bitcoinjs-message": "2.2.0",
|
||||||
"bolt11": "1.4.1",
|
"bolt11": "1.4.1",
|
||||||
"buffer": "6.0.3",
|
"buffer": "6.0.3",
|
||||||
"buffer-reverse": "1.0.1",
|
|
||||||
"coinselect": "3.1.13",
|
"coinselect": "3.1.13",
|
||||||
"crypto-js": "4.2.0",
|
"crypto-js": "4.2.0",
|
||||||
"dayjs": "1.11.10",
|
"dayjs": "1.11.10",
|
||||||
|
|
|
@ -271,6 +271,10 @@ export default class Selftest extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
|
assertStrictEqual(Buffer.from('00ff0f', 'hex').reverse().toString('hex'), '0fff00');
|
||||||
|
|
||||||
|
//
|
||||||
} catch (Err) {
|
} catch (Err) {
|
||||||
errorMessage += Err;
|
errorMessage += Err;
|
||||||
isOk = false;
|
isOk = false;
|
||||||
|
|
|
@ -18,8 +18,6 @@ import loc from '../../loc';
|
||||||
import { FiatUnit, FiatUnitSource, FiatUnitType, getFiatRate } from '../../models/fiatUnit';
|
import { FiatUnit, FiatUnitSource, FiatUnitType, getFiatRate } from '../../models/fiatUnit';
|
||||||
dayjs.extend(require('dayjs/plugin/calendar'));
|
dayjs.extend(require('dayjs/plugin/calendar'));
|
||||||
|
|
||||||
const ITEM_HEIGHT = 50;
|
|
||||||
|
|
||||||
const Currency = () => {
|
const Currency = () => {
|
||||||
const { setPreferredFiatCurrency } = useContext(BlueStorageContext);
|
const { setPreferredFiatCurrency } = useContext(BlueStorageContext);
|
||||||
const [isSavingNewPreferredCurrency, setIsSavingNewPreferredCurrency] = useState(false);
|
const [isSavingNewPreferredCurrency, setIsSavingNewPreferredCurrency] = useState(false);
|
||||||
|
@ -62,17 +60,11 @@ const Currency = () => {
|
||||||
fetchCurrency();
|
fetchCurrency();
|
||||||
}, [setOptions]);
|
}, [setOptions]);
|
||||||
|
|
||||||
const getItemLayout = (_data: any, index: number) => ({
|
|
||||||
length: ITEM_HEIGHT,
|
|
||||||
offset: ITEM_HEIGHT * index,
|
|
||||||
index,
|
|
||||||
});
|
|
||||||
|
|
||||||
const renderItem = ({ item }: { item: FiatUnitType }) => (
|
const renderItem = ({ item }: { item: FiatUnitType }) => (
|
||||||
<ListItem
|
<ListItem
|
||||||
disabled={isSavingNewPreferredCurrency || selectedCurrency.endPointKey === item.endPointKey}
|
disabled={isSavingNewPreferredCurrency || selectedCurrency.endPointKey === item.endPointKey}
|
||||||
title={`${item.endPointKey} (${item.symbol})`}
|
title={`${item.endPointKey} (${item.symbol})`}
|
||||||
containerStyle={StyleSheet.flatten([styles.flex, { height: ITEM_HEIGHT }])}
|
containerStyle={StyleSheet.flatten([styles.flex, { minHeight: 60 }])}
|
||||||
checkmark={selectedCurrency.endPointKey === item.endPointKey}
|
checkmark={selectedCurrency.endPointKey === item.endPointKey}
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
setIsSavingNewPreferredCurrency(true);
|
setIsSavingNewPreferredCurrency(true);
|
||||||
|
@ -104,7 +96,6 @@ const Currency = () => {
|
||||||
data={data}
|
data={data}
|
||||||
initialNumToRender={30}
|
initialNumToRender={30}
|
||||||
extraData={data}
|
extraData={data}
|
||||||
getItemLayout={getItemLayout}
|
|
||||||
renderItem={renderItem}
|
renderItem={renderItem}
|
||||||
/>
|
/>
|
||||||
<BlueCard>
|
<BlueCard>
|
||||||
|
|
4
typings/buffer-reverse.d.ts
vendored
4
typings/buffer-reverse.d.ts
vendored
|
@ -1,4 +0,0 @@
|
||||||
declare module 'buffer-reverse' {
|
|
||||||
declare function reverse(buffer: Buffer): Buffer;
|
|
||||||
export default reverse;
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue