mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 06:52:41 +01:00
Added preferredBalanceUnit to other wallets
This commit is contained in:
parent
d7b74e4524
commit
90c56dde8e
11 changed files with 73 additions and 63 deletions
|
@ -283,7 +283,6 @@ export class BlueFormMultiInput extends Component {
|
|||
render() {
|
||||
return (
|
||||
<FormInput
|
||||
{...this.props}
|
||||
multiline
|
||||
underlineColorAndroid="transparent"
|
||||
numberOfLines={4}
|
||||
|
@ -301,6 +300,7 @@ export class BlueFormMultiInput extends Component {
|
|||
borderBottomWidth: 0.5,
|
||||
backgroundColor: '#f5f5f5',
|
||||
}}
|
||||
{...this.props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { AbstractHDWallet } from './abstract-hd-wallet';
|
||||
import { BitcoinUnit } from '../models/bitcoinUnits';
|
||||
import Frisbee from 'frisbee';
|
||||
const bitcoin = require('bitcoinjs-lib');
|
||||
const bip39 = require('bip39');
|
||||
|
@ -11,12 +12,17 @@ export class HDLegacyBreadwalletWallet extends AbstractHDWallet {
|
|||
constructor() {
|
||||
super();
|
||||
this.type = 'HDLegacyBreadwallet';
|
||||
this.preferredBalanceUnit = BitcoinUnit.BTC;
|
||||
}
|
||||
|
||||
getTypeReadable() {
|
||||
return 'HD Legacy Breadwallet (P2PKH)';
|
||||
}
|
||||
|
||||
getPreferredBalanceUnit() {
|
||||
return this.preferredBalanceUnit || BitcoinUnit.BTC;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://github.com/bitcoinjs/bitcoinjs-lib/issues/584
|
||||
* @see https://github.com/bitcoinjs/bitcoinjs-lib/issues/914
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { AbstractHDWallet } from './abstract-hd-wallet';
|
||||
import Frisbee from 'frisbee';
|
||||
import { NativeModules } from 'react-native';
|
||||
import { BitcoinUnit } from '../models/bitcoinUnits';
|
||||
const { RNRandomBytes } = NativeModules;
|
||||
const bitcoin = require('bitcoinjs-lib');
|
||||
const bip39 = require('bip39');
|
||||
|
@ -17,6 +18,11 @@ export class HDSegwitP2SHWallet extends AbstractHDWallet {
|
|||
constructor() {
|
||||
super();
|
||||
this.type = 'HDsegwitP2SH';
|
||||
this.preferredBalanceUnit = BitcoinUnit.BTC;
|
||||
}
|
||||
|
||||
getPreferredBalanceUnit() {
|
||||
return this.preferredBalanceUnit || BitcoinUnit.BTC;
|
||||
}
|
||||
|
||||
getTypeReadable() {
|
||||
|
|
|
@ -3,19 +3,21 @@ import { SegwitBech32Wallet } from './';
|
|||
import { useBlockcypherTokens } from './constants';
|
||||
import Frisbee from 'frisbee';
|
||||
import { NativeModules } from 'react-native';
|
||||
import { BitcoinUnit } from '../models/bitcoinUnits';
|
||||
const { RNRandomBytes } = NativeModules;
|
||||
const BigNumber = require('bignumber.js');
|
||||
const bitcoin = require('bitcoinjs-lib');
|
||||
const signer = require('../models/signer');
|
||||
|
||||
/**
|
||||
* Has private key and address signle like "1ABCD....."
|
||||
* Has private key and single address like "1ABCD....."
|
||||
* (legacy P2PKH compressed)
|
||||
*/
|
||||
export class LegacyWallet extends AbstractWallet {
|
||||
constructor() {
|
||||
super();
|
||||
this.type = 'legacy';
|
||||
this.preferredBalanceUnit = BitcoinUnit.BTC;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -81,6 +83,10 @@ export class LegacyWallet extends AbstractWallet {
|
|||
return 'Legacy (P2PKH)';
|
||||
}
|
||||
|
||||
getPreferredBalanceUnit() {
|
||||
return this.preferredBalanceUnit || BitcoinUnit.BTC;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {string}
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
import { LegacyWallet } from './legacy-wallet';
|
||||
import { BitcoinUnit } from '../models/bitcoinUnits';
|
||||
const bitcoin = require('bitcoinjs-lib');
|
||||
|
||||
export class SegwitBech32Wallet extends LegacyWallet {
|
||||
constructor() {
|
||||
super();
|
||||
this.type = 'segwitBech32';
|
||||
this.preferredBalanceUnit = BitcoinUnit.BTC;
|
||||
}
|
||||
|
||||
getPreferredBalanceUnit() {
|
||||
return this.preferredBalanceUnit || BitcoinUnit.BTC;
|
||||
}
|
||||
|
||||
getTypeReadable() {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { LegacyWallet } from './legacy-wallet';
|
||||
import { BitcoinUnit } from '../models/bitcoinUnits';
|
||||
const bitcoin = require('bitcoinjs-lib');
|
||||
const signer = require('../models/signer');
|
||||
const BigNumber = require('bignumber.js');
|
||||
|
@ -7,6 +8,7 @@ export class SegwitP2SHWallet extends LegacyWallet {
|
|||
constructor() {
|
||||
super();
|
||||
this.type = 'segwitP2SH';
|
||||
this.preferredBalanceUnit = BitcoinUnit.BTC;
|
||||
}
|
||||
|
||||
allowRBF() {
|
||||
|
@ -43,6 +45,10 @@ export class SegwitP2SHWallet extends LegacyWallet {
|
|||
return this._address;
|
||||
}
|
||||
|
||||
getPreferredBalanceUnit() {
|
||||
return this.preferredBalanceUnit || BitcoinUnit.BTC;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes UTXOs (as presented by blockcypher api), transforms them into
|
||||
* format expected by signer module, creates tx and returns signed string txhex.
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
import { LegacyWallet } from './legacy-wallet';
|
||||
import { BitcoinUnit } from '../models/bitcoinUnits';
|
||||
const bitcoin = require('bitcoinjs-lib');
|
||||
|
||||
export class WatchOnlyWallet extends LegacyWallet {
|
||||
constructor() {
|
||||
super();
|
||||
this.type = 'watchOnly';
|
||||
this.preferredBalanceUnit = BitcoinUnit.BTC;
|
||||
}
|
||||
|
||||
getPreferredBalanceUnit() {
|
||||
return this.preferredBalanceUnit || BitcoinUnit.BTC;
|
||||
}
|
||||
|
||||
getTypeReadable() {
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>159</string>
|
||||
<string>160</string>
|
||||
<key>ITSAppUsesNonExemptEncryption</key>
|
||||
<false/>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
|
|
87
package-lock.json
generated
87
package-lock.json
generated
|
@ -807,9 +807,9 @@
|
|||
}
|
||||
},
|
||||
"@babel/preset-env": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.2.0.tgz",
|
||||
"integrity": "sha512-haGR38j5vOGVeBatrQPr3l0xHbs14505DcM57cbJy48kgMFvvHHoYEhHuRV+7vi559yyAUAVbTWzbK/B/pzJng==",
|
||||
"version": "7.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.2.3.tgz",
|
||||
"integrity": "sha512-AuHzW7a9rbv5WXmvGaPX7wADxFkZIqKlbBh1dmZUQp4iwiPpkE/Qnrji6SC4UQCQzvWY/cpHET29eUhXS9cLPw==",
|
||||
"requires": {
|
||||
"@babel/helper-module-imports": "^7.0.0",
|
||||
"@babel/helper-plugin-utils": "^7.0.0",
|
||||
|
@ -896,24 +896,6 @@
|
|||
"@babel/helper-plugin-utils": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"@babel/plugin-transform-async-to-generator": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.2.0.tgz",
|
||||
"integrity": "sha512-CEHzg4g5UraReozI9D4fblBYABs7IM6UerAVG7EJVrTLC5keh00aEuLUT+O40+mJCEzaXkYfTCUKIyeDfMOFFQ==",
|
||||
"requires": {
|
||||
"@babel/helper-module-imports": "^7.0.0",
|
||||
"@babel/helper-plugin-utils": "^7.0.0",
|
||||
"@babel/helper-remap-async-to-generator": "^7.1.0"
|
||||
}
|
||||
},
|
||||
"@babel/plugin-transform-block-scoped-functions": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.2.0.tgz",
|
||||
"integrity": "sha512-ntQPR6q1/NKuphly49+QiQiTN0O63uOwjdD6dhIjSWBI5xlrbUFh720TIpzBhpnrLfv2tNH/BXvLIab1+BAI0w==",
|
||||
"requires": {
|
||||
"@babel/helper-plugin-utils": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"@babel/plugin-transform-block-scoping": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.2.0.tgz",
|
||||
|
@ -924,9 +906,9 @@
|
|||
}
|
||||
},
|
||||
"@babel/plugin-transform-classes": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.2.0.tgz",
|
||||
"integrity": "sha512-aPCEkrhJYebDXcGTAP+cdUENkH7zqOlgbKwLbghjjHpJRJBWM/FSlCjMoPGA8oUdiMfOrk3+8EFPLLb5r7zj2w==",
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.2.2.tgz",
|
||||
"integrity": "sha512-gEZvgTy1VtcDOaQty1l10T3jQmJKlNVxLDCs+3rCVPr6nMkODLELxViq5X9l+rfxbie3XrfrMCYYY6eX3aOcOQ==",
|
||||
"requires": {
|
||||
"@babel/helper-annotate-as-pure": "^7.0.0",
|
||||
"@babel/helper-define-map": "^7.1.0",
|
||||
|
@ -998,15 +980,6 @@
|
|||
"@babel/helper-simple-access": "^7.1.0"
|
||||
}
|
||||
},
|
||||
"@babel/plugin-transform-object-super": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.2.0.tgz",
|
||||
"integrity": "sha512-VMyhPYZISFZAqAPVkiYb7dUe2AsVi2/wCT5+wZdsNO31FojQJa9ns40hzZ6U9f50Jlq4w6qwzdBB2uwqZ00ebg==",
|
||||
"requires": {
|
||||
"@babel/helper-plugin-utils": "^7.0.0",
|
||||
"@babel/helper-replace-supers": "^7.1.0"
|
||||
}
|
||||
},
|
||||
"@babel/plugin-transform-parameters": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.2.0.tgz",
|
||||
|
@ -1026,9 +999,9 @@
|
|||
}
|
||||
},
|
||||
"@babel/plugin-transform-spread": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.2.0.tgz",
|
||||
"integrity": "sha512-7TtPIdwjS/i5ZBlNiQePQCovDh9pAhVbp/nGVRBZuUdBiVRThyyLend3OHobc0G+RLCPPAN70+z/MAMhsgJd/A==",
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.2.2.tgz",
|
||||
"integrity": "sha512-KWfky/58vubwtS0hLqEnrWJjsMGaOeSBn90Ezn5Jeg9Z8KKHmELbP1yGylMlm5N6TPKeY9A2+UaSYLdxahg01w==",
|
||||
"requires": {
|
||||
"@babel/helper-plugin-utils": "^7.0.0"
|
||||
}
|
||||
|
@ -3028,13 +3001,13 @@
|
|||
}
|
||||
},
|
||||
"browserslist": {
|
||||
"version": "4.3.5",
|
||||
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.3.5.tgz",
|
||||
"integrity": "sha512-z9ZhGc3d9e/sJ9dIx5NFXkKoaiQTnrvrMsN3R1fGb1tkWWNSz12UewJn9TNxGo1l7J23h0MRaPmk7jfeTZYs1w==",
|
||||
"version": "4.3.6",
|
||||
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.3.6.tgz",
|
||||
"integrity": "sha512-kMGKs4BTzRWviZ8yru18xBpx+CyHG9eqgRbj9XbE3IMgtczf4aiA0Y1YCpVdvUieKGZ03kolSPXqTcscBCb9qw==",
|
||||
"requires": {
|
||||
"caniuse-lite": "^1.0.30000912",
|
||||
"electron-to-chromium": "^1.3.86",
|
||||
"node-releases": "^1.0.5"
|
||||
"caniuse-lite": "^1.0.30000921",
|
||||
"electron-to-chromium": "^1.3.92",
|
||||
"node-releases": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"bs58": {
|
||||
|
@ -3163,9 +3136,9 @@
|
|||
}
|
||||
},
|
||||
"caniuse-lite": {
|
||||
"version": "1.0.30000918",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000918.tgz",
|
||||
"integrity": "sha512-CAZ9QXGViBvhHnmIHhsTPSWFBujDaelKnUj7wwImbyQRxmXynYqKGi3UaZTSz9MoVh+1EVxOS/DFIkrJYgR3aw=="
|
||||
"version": "1.0.30000923",
|
||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000923.tgz",
|
||||
"integrity": "sha512-j5ur7eeluOFjjPUkydtXP4KFAsmH3XaQNch5tvWSO+dLHYt5PE+VgJZLWtbVOodfWij6m6zas28T4gB/cLYq1w=="
|
||||
},
|
||||
"capture-exit": {
|
||||
"version": "1.2.0",
|
||||
|
@ -3955,9 +3928,9 @@
|
|||
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
|
||||
},
|
||||
"electron-to-chromium": {
|
||||
"version": "1.3.90",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.90.tgz",
|
||||
"integrity": "sha512-IjJZKRhFbWSOX1w0sdIXgp4CMRguu6UYcTckyFF/Gjtemsu/25eZ+RXwFlV+UWcIueHyQA1UnRJxocTpH5NdGA=="
|
||||
"version": "1.3.96",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.96.tgz",
|
||||
"integrity": "sha512-ZUXBUyGLeoJxp4Nt6G/GjBRLnyz8IKQGexZ2ndWaoegThgMGFO1tdDYID5gBV32/1S83osjJHyfzvanE/8HY4Q=="
|
||||
},
|
||||
"elliptic": {
|
||||
"version": "6.4.1",
|
||||
|
@ -9387,9 +9360,9 @@
|
|||
}
|
||||
},
|
||||
"node-releases": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.1.tgz",
|
||||
"integrity": "sha512-2UXrBr6gvaebo5TNF84C66qyJJ6r0kxBObgZIDX3D3/mt1ADKiHux3NJPWisq0wxvJJdkjECH+9IIKYViKj71Q==",
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.2.tgz",
|
||||
"integrity": "sha512-j1gEV/zX821yxdWp/1vBMN0pSUjuH9oGUdLCb4PfUko6ZW7KdRs3Z+QGGwDUhYtSpQvdVVyLd2V0YvLsmdg5jQ==",
|
||||
"requires": {
|
||||
"semver": "^5.3.0"
|
||||
}
|
||||
|
@ -10605,9 +10578,9 @@
|
|||
}
|
||||
},
|
||||
"react-native-custom-qr-codes": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/react-native-custom-qr-codes/-/react-native-custom-qr-codes-1.0.2.tgz",
|
||||
"integrity": "sha1-t9EipGMtJSsPdulLQIRnNCGs4EE=",
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/react-native-custom-qr-codes/-/react-native-custom-qr-codes-2.0.0.tgz",
|
||||
"integrity": "sha512-tUQipLzDorDgv/gzuhAISSqCCNOTtM+QveAUTnV1deeEKDAtdfdzY9QJIqLZYmfYvusySpXOK1Sdu9X+6AR2Jg==",
|
||||
"requires": {
|
||||
"prop-types": "^15.5.10"
|
||||
}
|
||||
|
@ -10634,9 +10607,9 @@
|
|||
"integrity": "sha1-oBgDk8UxujR3cixuQqMc6xwRYjs="
|
||||
},
|
||||
"react-native-fs": {
|
||||
"version": "2.13.2",
|
||||
"resolved": "https://registry.npmjs.org/react-native-fs/-/react-native-fs-2.13.2.tgz",
|
||||
"integrity": "sha512-eN2HReoE/T+6r180kiXppshqJ5DsO6AngUmVbz09Qzl5EXU2zN0WfOaizKR2oD5u0XlcDrNJK7/spVH1XyQzEw==",
|
||||
"version": "2.13.3",
|
||||
"resolved": "https://registry.npmjs.org/react-native-fs/-/react-native-fs-2.13.3.tgz",
|
||||
"integrity": "sha512-B62LSSAEYQGItg7KVTzTVVCxezOYFBYp4DMVFbdoZUd1mZVFdqR2sy1HY1mye1VI/Lf3IbxSyZEQ0GmrrdwLjg==",
|
||||
"requires": {
|
||||
"base-64": "^0.1.0",
|
||||
"utf8": "^2.1.1"
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/preset-env": "^7.2.0",
|
||||
"@babel/preset-env": "^7.2.3",
|
||||
"asyncstorage-down": "^3.1.1",
|
||||
"bignumber.js": "^7.0.0",
|
||||
"bip21": "^2.0.2",
|
||||
|
@ -64,11 +64,11 @@
|
|||
"react-localization": "^1.0.10",
|
||||
"react-native": "^0.57.8",
|
||||
"react-native-camera": "^1.6.4",
|
||||
"react-native-custom-qr-codes": "^1.0.2",
|
||||
"react-native-custom-qr-codes": "^2.0.0",
|
||||
"react-native-device-info": "^0.24.3",
|
||||
"react-native-elements": "^0.19.0",
|
||||
"react-native-flexi-radio-button": "^0.2.2",
|
||||
"react-native-fs": "^2.13.2",
|
||||
"react-native-fs": "^2.13.3",
|
||||
"react-native-gesture-handler": "^1.0.12",
|
||||
"react-native-google-analytics-bridge": "^6.1.2",
|
||||
"react-native-haptic-feedback": "^1.4.2",
|
||||
|
|
|
@ -221,6 +221,7 @@ export default class WalletsImport extends Component {
|
|||
onChangeText={text => {
|
||||
this.setLabel(text);
|
||||
}}
|
||||
autoCorrect={false}
|
||||
/>
|
||||
<BlueSpacing20 />
|
||||
<View
|
||||
|
|
Loading…
Add table
Reference in a new issue