mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-01-19 05:45:15 +01:00
ADD: HD wallet
This commit is contained in:
parent
15f3a495bd
commit
d07082f4dd
2
app.json
2
app.json
@ -7,7 +7,7 @@
|
||||
"ios"
|
||||
],
|
||||
"ios": {
|
||||
"buildNumber": "56",
|
||||
"buildNumber": "57",
|
||||
"supportsTablet": true,
|
||||
"isRemoteJSEnabled": false,
|
||||
"bundleIdentifier": "io.bluewallet.bluewallet",
|
||||
|
@ -13,7 +13,7 @@ export class HDLegacyBreadwalletWallet extends AbstractHDWallet {
|
||||
}
|
||||
|
||||
getTypeReadable() {
|
||||
return 'HD Legacy Breadwallet-compatible (P2PKH)';
|
||||
return 'HD Legacy Breadwallet (P2PKH)';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,6 +61,7 @@
|
||||
"react-native": "https://github.com/expo/react-native/archive/sdk-23.0.0.tar.gz",
|
||||
"react-native-camera": "^0.12.0",
|
||||
"react-native-elements": "^0.18.5",
|
||||
"react-native-flexi-radio-button": "^0.2.2",
|
||||
"react-native-level-fs": "^3.0.0",
|
||||
"react-native-qrcode": "^0.2.6",
|
||||
"react-native-snap-carousel": "^3.7.2",
|
||||
|
@ -4,6 +4,7 @@ import React, { Component } from 'react';
|
||||
import { ActivityIndicator, Dimensions, View } from 'react-native';
|
||||
import {
|
||||
BlueTextCentered,
|
||||
BlueText,
|
||||
LightningButton,
|
||||
BitcoinButton,
|
||||
BlueButtonLink,
|
||||
@ -15,7 +16,10 @@ import {
|
||||
BlueCard,
|
||||
BlueHeaderDefaultSub,
|
||||
} from '../../BlueComponents';
|
||||
import { RadioGroup, RadioButton } from 'react-native-flexi-radio-button';
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import { HDSegwitP2SHWallet } from '../../class/hd-segwit-p2sh-wallet';
|
||||
let EV = require('../../events');
|
||||
let A = require('../../analytics');
|
||||
/** @type {AppStorage} */
|
||||
@ -49,6 +53,13 @@ export default class WalletsAdd extends Component {
|
||||
}); /* also, a hack to make screen update new typed text */
|
||||
}
|
||||
|
||||
onSelect(index, value) {
|
||||
this.setState({
|
||||
selectedIndex: index,
|
||||
selectedValue: value,
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.state.isLoading) {
|
||||
return (
|
||||
@ -113,6 +124,31 @@ export default class WalletsAdd extends Component {
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View>
|
||||
{(() => {
|
||||
if (this.state.activeBitcoin) {
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
width: 200,
|
||||
height: 100,
|
||||
left: 10,
|
||||
}}
|
||||
>
|
||||
<RadioGroup onSelect={(index, value) => this.onSelect(index, value)} selectedIndex={0}>
|
||||
<RadioButton value={new HDSegwitP2SHWallet().type}>
|
||||
<BlueText>{new HDSegwitP2SHWallet().getTypeReadable()}</BlueText>
|
||||
</RadioButton>
|
||||
<RadioButton value={new SegwitP2SHWallet().type}>
|
||||
<BlueText>{new SegwitP2SHWallet().getTypeReadable()}</BlueText>
|
||||
</RadioButton>
|
||||
</RadioGroup>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
})()}
|
||||
</View>
|
||||
|
||||
<View
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
@ -130,8 +166,16 @@ export default class WalletsAdd extends Component {
|
||||
|
||||
this.props.navigation.goBack();
|
||||
setTimeout(async () => {
|
||||
let w = new SegwitP2SHWallet();
|
||||
w.setLabel(this.state.label || loc.wallets.add.label_new_segwit);
|
||||
let w;
|
||||
if (this.state.selectedIndex === 1) {
|
||||
// index 1 radio - segwit single address
|
||||
w = new SegwitP2SHWallet();
|
||||
w.setLabel(this.state.label || loc.wallets.add.label_new_segwit);
|
||||
} else {
|
||||
// zero index radio - HD segwit
|
||||
w = new HDSegwitP2SHWallet();
|
||||
w.setLabel((this.state.label || loc.wallets.add.label_new_segwit) + ' HD');
|
||||
}
|
||||
w.generate();
|
||||
BlueApp.wallets.push(w);
|
||||
await BlueApp.saveToDisk();
|
||||
|
Loading…
Reference in New Issue
Block a user