mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 18:00:17 +01:00
ADD: The selected balance unit per wallet is now saved.
This commit is contained in:
commit
3b4844490c
@ -86,12 +86,10 @@ export class AbstractHDWallet extends LegacyWallet {
|
||||
return this.preferredBalanceUnit;
|
||||
}
|
||||
|
||||
getPreferredBalanceUnitIndex() {
|
||||
return Object.entries(BitcoinUnit).indexOf(this.getPreferredBalanceUnit);
|
||||
}
|
||||
|
||||
setPreferredBalanceUnit(unit) {
|
||||
this.preferredBalanceUnit = unit;
|
||||
const indexOf = Object.values(BitcoinUnit).indexOf(unit);
|
||||
const currentPreferredUnit = Object.entries(BitcoinUnit)[indexOf][0];
|
||||
this.preferredBalanceUnit = currentPreferredUnit;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -39,12 +39,10 @@ export class AbstractWallet {
|
||||
return this.preferredBalanceUnit;
|
||||
}
|
||||
|
||||
getPreferredBalanceUnitIndex() {
|
||||
return Object.entries(BitcoinUnit).indexOf(this.getPreferredBalanceUnit);
|
||||
}
|
||||
|
||||
setPreferredBalanceUnit(unit) {
|
||||
this.preferredBalanceUnit = unit;
|
||||
const indexOf = Object.values(BitcoinUnit).indexOf(unit);
|
||||
const currentPreferredUnit = Object.entries(BitcoinUnit)[indexOf][0];
|
||||
this.preferredBalanceUnit = currentPreferredUnit;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { LegacyWallet } from './legacy-wallet';
|
||||
import Frisbee from 'frisbee';
|
||||
import { BitcoinUnit } from '../models/bitcoinUnits';
|
||||
let BigNumber = require('bignumber.js');
|
||||
|
||||
export class LightningCustodianWallet extends LegacyWallet {
|
||||
@ -15,6 +16,7 @@ export class LightningCustodianWallet extends LegacyWallet {
|
||||
this.refill_addressess = [];
|
||||
this.pending_transactions_raw = [];
|
||||
this.info_raw = false;
|
||||
this.preferredBalanceUnit = BitcoinUnit.SATOSHIS;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -499,6 +501,17 @@ export class LightningCustodianWallet extends LegacyWallet {
|
||||
allowReceive() {
|
||||
return false;
|
||||
}
|
||||
|
||||
getPreferredBalanceUnit() {
|
||||
return this.preferredBalanceUnit;
|
||||
}
|
||||
|
||||
setPreferredBalanceUnit(unit) {
|
||||
const indexOf = Object.values(BitcoinUnit).indexOf(unit);
|
||||
const currentPreferredUnit = Object.entries(BitcoinUnit)[indexOf][0];
|
||||
this.preferredBalanceUnit = currentPreferredUnit;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -17,15 +17,11 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<<<<<<< HEAD
|
||||
<string>3.2.1</string>
|
||||
=======
|
||||
<string>3.3.0</string>
|
||||
>>>>>>> a4fe0c201c07e0b879076d4391705fe29b04a7d2
|
||||
<string>3.3.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>147</string>
|
||||
<string>149</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
|
270
package-lock.json
generated
270
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "BlueWallet",
|
||||
"version": "3.2.3",
|
||||
"version": "3.3.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@ -2839,6 +2839,37 @@
|
||||
"wif": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"bl": {
|
||||
"version": "0.8.2",
|
||||
"resolved": "http://registry.npmjs.org/bl/-/bl-0.8.2.tgz",
|
||||
"integrity": "sha1-yba8oI0bwuoA/Ir7Txpf0eHGbk4=",
|
||||
"requires": {
|
||||
"readable-stream": "~1.0.26"
|
||||
},
|
||||
"dependencies": {
|
||||
"isarray": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
|
||||
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "1.0.34",
|
||||
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
|
||||
"integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
|
||||
"requires": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.1",
|
||||
"isarray": "0.0.1",
|
||||
"string_decoder": "~0.10.x"
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "0.10.31",
|
||||
"resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
|
||||
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
|
||||
}
|
||||
}
|
||||
},
|
||||
"bn.js": {
|
||||
"version": "4.11.8",
|
||||
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz",
|
||||
@ -3246,6 +3277,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"clone": {
|
||||
"version": "0.1.19",
|
||||
"resolved": "https://registry.npmjs.org/clone/-/clone-0.1.19.tgz",
|
||||
"integrity": "sha1-YT+2hjmyaklKxTJT4Vsaa9iK2oU="
|
||||
},
|
||||
"co": {
|
||||
"version": "4.6.0",
|
||||
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
|
||||
@ -3711,6 +3747,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"deferred-leveldown": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-0.2.0.tgz",
|
||||
"integrity": "sha1-LO8fER4cV4cNi7uK8mUOWHzS9bQ=",
|
||||
"requires": {
|
||||
"abstract-leveldown": "~0.12.1"
|
||||
}
|
||||
},
|
||||
"define-properties": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
|
||||
@ -3934,6 +3978,14 @@
|
||||
"resolved": "https://registry.npmjs.org/envinfo/-/envinfo-5.12.1.tgz",
|
||||
"integrity": "sha512-pwdo0/G3CIkQ0y6PCXq4RdkvId2elvtPCJMG0konqlrfkWQbf1DWeH9K2b/cvu2YgGvPPTOnonZxXM1gikFu1w=="
|
||||
},
|
||||
"errno": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz",
|
||||
"integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==",
|
||||
"requires": {
|
||||
"prr": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"error-ex": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
|
||||
@ -4683,6 +4735,11 @@
|
||||
"for-in": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"foreach": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz",
|
||||
"integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k="
|
||||
},
|
||||
"forever-agent": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
|
||||
@ -5232,6 +5289,37 @@
|
||||
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
|
||||
"dev": true
|
||||
},
|
||||
"fwd-stream": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/fwd-stream/-/fwd-stream-1.0.4.tgz",
|
||||
"integrity": "sha1-7Sgcq+1G/uz5Ie4y3ExQs3KsfPo=",
|
||||
"requires": {
|
||||
"readable-stream": "~1.0.26-4"
|
||||
},
|
||||
"dependencies": {
|
||||
"isarray": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
|
||||
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "1.0.34",
|
||||
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
|
||||
"integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
|
||||
"requires": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.1",
|
||||
"isarray": "0.0.1",
|
||||
"string_decoder": "~0.10.x"
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "0.10.31",
|
||||
"resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
|
||||
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
|
||||
}
|
||||
}
|
||||
},
|
||||
"gauge": {
|
||||
"version": "1.2.7",
|
||||
"resolved": "https://registry.npmjs.org/gauge/-/gauge-1.2.7.tgz",
|
||||
@ -5675,6 +5763,11 @@
|
||||
"integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=",
|
||||
"dev": true
|
||||
},
|
||||
"indexof": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz",
|
||||
"integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10="
|
||||
},
|
||||
"inflight": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||
@ -5738,6 +5831,11 @@
|
||||
"resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz",
|
||||
"integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY="
|
||||
},
|
||||
"is": {
|
||||
"version": "0.2.7",
|
||||
"resolved": "http://registry.npmjs.org/is/-/is-0.2.7.tgz",
|
||||
"integrity": "sha1-OzSixI81mXLzUEKEkZOucmS2NWI="
|
||||
},
|
||||
"is-accessor-descriptor": {
|
||||
"version": "0.1.6",
|
||||
"resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz",
|
||||
@ -5904,6 +6002,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"is-object": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/is-object/-/is-object-0.1.2.tgz",
|
||||
"integrity": "sha1-AO+8CIFsM8/ErIJR0TLhDcZQmNc="
|
||||
},
|
||||
"is-plain-object": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
|
||||
@ -8115,6 +8218,137 @@
|
||||
"integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA==",
|
||||
"dev": true
|
||||
},
|
||||
"level-blobs": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/level-blobs/-/level-blobs-0.1.7.tgz",
|
||||
"integrity": "sha1-mrm5e7mfHtv594o0M+Ie1WOGva8=",
|
||||
"requires": {
|
||||
"level-peek": "1.0.6",
|
||||
"once": "^1.3.0",
|
||||
"readable-stream": "^1.0.26-4"
|
||||
}
|
||||
},
|
||||
"level-filesystem": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/level-filesystem/-/level-filesystem-1.2.0.tgz",
|
||||
"integrity": "sha1-oArKmRnEpN+v3KaoEI0iWq3/Y7M=",
|
||||
"requires": {
|
||||
"concat-stream": "^1.4.4",
|
||||
"errno": "^0.1.1",
|
||||
"fwd-stream": "^1.0.4",
|
||||
"level-blobs": "^0.1.7",
|
||||
"level-peek": "^1.0.6",
|
||||
"level-sublevel": "^5.2.0",
|
||||
"octal": "^1.0.0",
|
||||
"once": "^1.3.0",
|
||||
"xtend": "^2.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"xtend": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-2.2.0.tgz",
|
||||
"integrity": "sha1-7vax8ZjByN6vrYsXZaBNrUoBxak="
|
||||
}
|
||||
}
|
||||
},
|
||||
"level-fix-range": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "http://registry.npmjs.org/level-fix-range/-/level-fix-range-1.0.2.tgz",
|
||||
"integrity": "sha1-vxW5Fa422EcMgh6IPd95zRZCCCg="
|
||||
},
|
||||
"level-hooks": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "http://registry.npmjs.org/level-hooks/-/level-hooks-4.5.0.tgz",
|
||||
"integrity": "sha1-G5rmGSKTDzMF0aYfxNg8gQLA3ZM=",
|
||||
"requires": {
|
||||
"string-range": "~1.2"
|
||||
}
|
||||
},
|
||||
"level-peek": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "http://registry.npmjs.org/level-peek/-/level-peek-1.0.6.tgz",
|
||||
"integrity": "sha1-vsUccqgu5GTTNkNMfIdsP8vM538=",
|
||||
"requires": {
|
||||
"level-fix-range": "~1.0.2"
|
||||
}
|
||||
},
|
||||
"level-sublevel": {
|
||||
"version": "5.2.3",
|
||||
"resolved": "http://registry.npmjs.org/level-sublevel/-/level-sublevel-5.2.3.tgz",
|
||||
"integrity": "sha1-dEwSxy0ucr543eO5tc2E1iGRQTo=",
|
||||
"requires": {
|
||||
"level-fix-range": "2.0",
|
||||
"level-hooks": ">=4.4.0 <5",
|
||||
"string-range": "~1.2.1",
|
||||
"xtend": "~2.0.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"level-fix-range": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "http://registry.npmjs.org/level-fix-range/-/level-fix-range-2.0.0.tgz",
|
||||
"integrity": "sha1-xBfWIVlEIVGhnZojZ4aPFyTC1Ug=",
|
||||
"requires": {
|
||||
"clone": "~0.1.9"
|
||||
}
|
||||
},
|
||||
"xtend": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-2.0.6.tgz",
|
||||
"integrity": "sha1-XqZXptukRwacLlnFihE4ywxebO4=",
|
||||
"requires": {
|
||||
"is-object": "~0.1.2",
|
||||
"object-keys": "~0.2.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"levelup": {
|
||||
"version": "0.18.6",
|
||||
"resolved": "https://registry.npmjs.org/levelup/-/levelup-0.18.6.tgz",
|
||||
"integrity": "sha1-5qAcsIlhbI7MApHCqb0/DETj5es=",
|
||||
"requires": {
|
||||
"bl": "~0.8.1",
|
||||
"deferred-leveldown": "~0.2.0",
|
||||
"errno": "~0.1.1",
|
||||
"prr": "~0.0.0",
|
||||
"readable-stream": "~1.0.26",
|
||||
"semver": "~2.3.1",
|
||||
"xtend": "~3.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"isarray": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
|
||||
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
|
||||
},
|
||||
"prr": {
|
||||
"version": "0.0.0",
|
||||
"resolved": "https://registry.npmjs.org/prr/-/prr-0.0.0.tgz",
|
||||
"integrity": "sha1-GoS4WQgyVQFBGFPQCB7j+obikmo="
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "1.0.34",
|
||||
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
|
||||
"integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
|
||||
"requires": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.1",
|
||||
"isarray": "0.0.1",
|
||||
"string_decoder": "~0.10.x"
|
||||
}
|
||||
},
|
||||
"semver": {
|
||||
"version": "2.3.2",
|
||||
"resolved": "http://registry.npmjs.org/semver/-/semver-2.3.2.tgz",
|
||||
"integrity": "sha1-uYSPJdbPNjMwc+ye+IVtQvEjPlI="
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "0.10.31",
|
||||
"resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
|
||||
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
|
||||
}
|
||||
}
|
||||
},
|
||||
"leven": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz",
|
||||
@ -9248,6 +9482,16 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"object-keys": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.2.0.tgz",
|
||||
"integrity": "sha1-zd7AKZiwkb5CvxA1rjLknxy26mc=",
|
||||
"requires": {
|
||||
"foreach": "~2.0.1",
|
||||
"indexof": "~0.0.1",
|
||||
"is": "~0.2.6"
|
||||
}
|
||||
},
|
||||
"object-visit": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz",
|
||||
@ -9297,6 +9541,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"octal": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/octal/-/octal-1.0.0.tgz",
|
||||
"integrity": "sha1-Y+cWKmjvvrniE1iNWOmJ0eXEUws="
|
||||
},
|
||||
"on-finished": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
|
||||
@ -9949,6 +10198,11 @@
|
||||
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz",
|
||||
"integrity": "sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4="
|
||||
},
|
||||
"prr": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
|
||||
"integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY="
|
||||
},
|
||||
"pseudomap": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
|
||||
@ -10385,6 +10639,15 @@
|
||||
"resolved": "https://registry.npmjs.org/react-native-haptic-feedback/-/react-native-haptic-feedback-1.4.2.tgz",
|
||||
"integrity": "sha512-uLtdxKL4nul5QQUczctCdAr2b6P7/KPLyfQVP8lfcVaNANHpL1WFhCnrWPNCkh2LHSduA88MNgPcTsN9CHbwlw=="
|
||||
},
|
||||
"react-native-level-fs": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/react-native-level-fs/-/react-native-level-fs-3.0.1.tgz",
|
||||
"integrity": "sha1-8wVGFMK8Gjedyz0+5RtqG2YSMoM=",
|
||||
"requires": {
|
||||
"level-filesystem": "^1.0.1",
|
||||
"levelup": "^0.18.2"
|
||||
}
|
||||
},
|
||||
"react-native-linear-gradient": {
|
||||
"version": "2.5.3",
|
||||
"resolved": "https://registry.npmjs.org/react-native-linear-gradient/-/react-native-linear-gradient-2.5.3.tgz",
|
||||
@ -12065,6 +12328,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"string-range": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "http://registry.npmjs.org/string-range/-/string-range-1.2.2.tgz",
|
||||
"integrity": "sha1-qJPtNH5yKZvIO++78qaSqNI51d0="
|
||||
},
|
||||
"string-width": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
|
||||
|
@ -71,6 +71,7 @@
|
||||
"react-native-gesture-handler": "^1.0.11",
|
||||
"react-native-google-analytics-bridge": "^6.1.2",
|
||||
"react-native-haptic-feedback": "^1.4.2",
|
||||
"react-native-level-fs": "^3.0.1",
|
||||
"react-native-linear-gradient": "^2.5.3",
|
||||
"react-native-material-dropdown": "^0.11.1",
|
||||
"react-native-modal": "^7.0.2",
|
||||
|
@ -3,10 +3,8 @@ import React, { Component } from 'react';
|
||||
import { ActivityIndicator, View, Text, TextInput, Alert, TouchableOpacity, Keyboard, TouchableWithoutFeedback } from 'react-native';
|
||||
import { BlueButton, SafeBlueArea, BlueCard, BlueSpacing20, BlueNavigationStyle } from '../../BlueComponents';
|
||||
import PropTypes from 'prop-types';
|
||||
import { ButtonGroup } from 'react-native-elements';
|
||||
import { LightningCustodianWallet } from '../../class/lightning-custodian-wallet';
|
||||
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
|
||||
import { BitcoinUnit } from '../../models/bitcoinUnits';
|
||||
let EV = require('../../events');
|
||||
/** @type {AppStorage} */
|
||||
let BlueApp = require('../../BlueApp');
|
||||
@ -67,10 +65,6 @@ export default class WalletDetails extends Component {
|
||||
this.props.navigation.goBack(null);
|
||||
}
|
||||
|
||||
updatePreferredBalanceUnit = selectedIndex => {
|
||||
this.state.wallet.setPreferredBalanceUnit(Object.entries(BitcoinUnit)[selectedIndex][0]);
|
||||
};
|
||||
|
||||
render() {
|
||||
if (this.state.isLoading) {
|
||||
return (
|
||||
@ -129,15 +123,6 @@ export default class WalletDetails extends Component {
|
||||
{loc.wallets.details.type.toLowerCase()}
|
||||
</Text>
|
||||
<Text style={{ color: '#81868e', fontWeight: '500', fontSize: 14 }}>{this.state.wallet.getTypeReadable()}</Text>
|
||||
|
||||
<Text style={{ color: '#0c2550', fontWeight: '500', fontSize: 14, marginVertical: 12 }}>
|
||||
{loc.wallets.details.displayBalanceUsing.toLowerCase()}
|
||||
</Text>
|
||||
<ButtonGroup
|
||||
onPress={this.updatePreferredBalanceUnit}
|
||||
selectedIndex={Number(this.state.wallet.getPreferredBalanceUnitIndex)}
|
||||
buttons={[BitcoinUnit.BTC, BitcoinUnit.MBTC, BitcoinUnit.BITS, BitcoinUnit.SATOSHIS, BitcoinUnit.LOCAL_CURRENCY]}
|
||||
/>
|
||||
</BlueCard>
|
||||
<View>
|
||||
<BlueSpacing20 />
|
||||
|
@ -64,7 +64,6 @@ export default class WalletTransactions extends Component {
|
||||
isTransactionsLoading: false,
|
||||
wallet: wallet,
|
||||
dataSource: wallet.getTransactions(),
|
||||
walletBalanceUnit: wallet.getPreferredBalanceUnit(),
|
||||
};
|
||||
}
|
||||
|
||||
@ -122,7 +121,6 @@ export default class WalletTransactions extends Component {
|
||||
showManageFundsBigButton,
|
||||
showManageFundsSmallButton,
|
||||
dataSource: txs,
|
||||
walletBalanceUnit: wallet.getPreferredBalanceUnit(),
|
||||
});
|
||||
}, 1);
|
||||
}
|
||||
@ -176,17 +174,22 @@ export default class WalletTransactions extends Component {
|
||||
}
|
||||
|
||||
changeWalletBalanceUnit() {
|
||||
if (BitcoinUnit[this.state.walletBalanceUnit] === undefined || BitcoinUnit[this.state.walletBalanceUnit] === BitcoinUnit.BTC) {
|
||||
this.setState({ walletBalanceUnit: BitcoinUnit.LOCAL_CURRENCY });
|
||||
} else if (BitcoinUnit[this.state.walletBalanceUnit] === BitcoinUnit.MBTC) {
|
||||
this.setState({ walletBalanceUnit: BitcoinUnit.BITS });
|
||||
} else if (BitcoinUnit[this.state.walletBalanceUnit] === BitcoinUnit.BITS) {
|
||||
this.setState({ walletBalanceUnit: BitcoinUnit.SATOSHIS });
|
||||
} else if (BitcoinUnit[this.state.walletBalanceUnit] === BitcoinUnit.SATOSHIS) {
|
||||
this.setState({ walletBalanceUnit: BitcoinUnit.BTC });
|
||||
} else if (BitcoinUnit[this.state.walletBalanceUnit] === BitcoinUnit.LOCAL_CURRENCY) {
|
||||
this.setState({ walletBalanceUnit: BitcoinUnit.MBTC });
|
||||
const indexOf = Object.keys(BitcoinUnit).indexOf(this.state.wallet.getPreferredBalanceUnit());
|
||||
const currentPreferredUnit = Object.entries(BitcoinUnit)[indexOf][0];
|
||||
const { wallet } = this.state;
|
||||
|
||||
if (BitcoinUnit[currentPreferredUnit] === undefined || BitcoinUnit[currentPreferredUnit] === BitcoinUnit.BTC) {
|
||||
wallet.setPreferredBalanceUnit(BitcoinUnit.LOCAL_CURRENCY);
|
||||
} else if (BitcoinUnit[currentPreferredUnit] === BitcoinUnit.MBTC) {
|
||||
wallet.setPreferredBalanceUnit(BitcoinUnit.BITS);
|
||||
} else if (BitcoinUnit[currentPreferredUnit] === BitcoinUnit.BITS) {
|
||||
wallet.setPreferredBalanceUnit(BitcoinUnit.SATOSHIS);
|
||||
} else if (BitcoinUnit[currentPreferredUnit] === BitcoinUnit.SATOSHIS) {
|
||||
wallet.setPreferredBalanceUnit(BitcoinUnit.BTC);
|
||||
} else if (BitcoinUnit[currentPreferredUnit] === BitcoinUnit.LOCAL_CURRENCY) {
|
||||
wallet.setPreferredBalanceUnit(BitcoinUnit.MBTC);
|
||||
}
|
||||
this.setState({ wallet: wallet }, () => BlueApp.saveToDisk());
|
||||
}
|
||||
|
||||
renderWalletHeader = () => {
|
||||
@ -229,7 +232,7 @@ export default class WalletTransactions extends Component {
|
||||
color: '#fff',
|
||||
}}
|
||||
>
|
||||
{loc.formatBalance(this.state.wallet.getBalance(), this.state.walletBalanceUnit)}
|
||||
{loc.formatBalance(this.state.wallet.getBalance(), this.state.wallet.getPreferredBalanceUnit())}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
<Text style={{ backgroundColor: 'transparent' }} />
|
||||
@ -440,7 +443,10 @@ export default class WalletTransactions extends Component {
|
||||
containerStyle: { marginTop: 0 },
|
||||
}}
|
||||
hideChevron
|
||||
rightTitle={new BigNumber((rowData.item.value && rowData.item.value) || 0).dividedBy(100000000).toString()}
|
||||
rightTitle={loc.formatBalance(
|
||||
new BigNumber((rowData.item.value && rowData.item.value) || 0).dividedBy(100000000),
|
||||
this.state.wallet.getPreferredBalanceUnit(),
|
||||
)}
|
||||
rightTitleStyle={{
|
||||
fontWeight: '600',
|
||||
fontSize: 16,
|
||||
|
Loading…
Reference in New Issue
Block a user