implement bip39 seed to wallet
fix auto-upgrade wallet
This commit is contained in:
@@ -95,10 +95,6 @@ Pane {
|
||||
Daemon.availableWallets.reload()
|
||||
app.stack.pop()
|
||||
}
|
||||
onRequiresUpgradeChanged: {
|
||||
if (requiresUpgrade)
|
||||
wallet_db.doUpgrade()
|
||||
}
|
||||
onReadyChanged: {
|
||||
if (ready) {
|
||||
Daemon.load_wallet(Daemon.path, password.text)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import QtQuick 2.6
|
||||
import QtQuick.Layouts 1.0
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Controls.Material 2.0
|
||||
|
||||
import org.electrum 1.0
|
||||
|
||||
@@ -25,25 +26,25 @@ Pane {
|
||||
columns: 4
|
||||
|
||||
Label { text: 'Wallet'; Layout.columnSpan: 2 }
|
||||
Label { text: Daemon.walletName; Layout.columnSpan: 2 }
|
||||
Label { text: Daemon.walletName; Layout.columnSpan: 2; color: Material.accentColor }
|
||||
|
||||
Label { text: 'derivation path (BIP32)'; visible: Daemon.currentWallet.isDeterministic; Layout.columnSpan: 2 }
|
||||
Label { text: Daemon.currentWallet.derivationPath; visible: Daemon.currentWallet.isDeterministic; color: Material.accentColor; Layout.columnSpan: 2 }
|
||||
|
||||
Label { text: 'txinType' }
|
||||
Label { text: Daemon.currentWallet.txinType }
|
||||
Label { text: Daemon.currentWallet.txinType; color: Material.accentColor }
|
||||
|
||||
Label { text: 'is deterministic' }
|
||||
Label { text: Daemon.currentWallet.isDeterministic }
|
||||
Label { text: Daemon.currentWallet.isDeterministic; color: Material.accentColor }
|
||||
|
||||
Label { text: 'is watch only' }
|
||||
Label { text: Daemon.currentWallet.isWatchOnly }
|
||||
Label { text: Daemon.currentWallet.isWatchOnly; color: Material.accentColor }
|
||||
|
||||
Label { text: 'is Encrypted' }
|
||||
Label { text: Daemon.currentWallet.isEncrypted }
|
||||
Label { text: Daemon.currentWallet.isEncrypted; color: Material.accentColor }
|
||||
|
||||
Label { text: 'is Hardware' }
|
||||
Label { text: Daemon.currentWallet.isHardware }
|
||||
|
||||
Label { text: 'derivation path (BIP32)'; visible: Daemon.currentWallet.isDeterministic }
|
||||
Label { text: Daemon.currentWallet.derivationPath; visible: Daemon.currentWallet.isDeterministic }
|
||||
Label { text: Daemon.currentWallet.isHardware; color: Material.accentColor }
|
||||
}
|
||||
}
|
||||
// }
|
||||
@@ -75,16 +76,19 @@ Pane {
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
x: 10
|
||||
spacing: 10
|
||||
width: parent.width - 20
|
||||
width: parent.width
|
||||
|
||||
Image {
|
||||
source: "../../kivy/theming/light/wallet.png"
|
||||
id: walleticon
|
||||
source: "../../icons/wallet.png"
|
||||
fillMode: Image.PreserveAspectFit
|
||||
Layout.preferredWidth: 32
|
||||
Layout.preferredHeight: 32
|
||||
}
|
||||
|
||||
Label {
|
||||
font.pointSize: 11
|
||||
font.pixelSize: 18
|
||||
text: model.name
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
@@ -10,24 +10,36 @@ WizardComponent {
|
||||
valid: false
|
||||
|
||||
onAccept: {
|
||||
wizard_data['script_type'] = scripttypegroup.checkedButton.scripttype
|
||||
wizard_data['derivation_path'] = derivationpathtext.text
|
||||
}
|
||||
|
||||
function setDerivationPath() {
|
||||
var addrtype = {
|
||||
function getScriptTypePurposeDict() {
|
||||
return {
|
||||
'p2pkh': 44,
|
||||
'p2wpkh-p2sh': 49,
|
||||
'p2wpkh': 84
|
||||
}
|
||||
var nChain = Network.isTestNet ? 1 : 0
|
||||
}
|
||||
|
||||
function validate() {
|
||||
valid = false
|
||||
if (!scripttypegroup.checkedButton.scripttype in getScriptTypePurposeDict())
|
||||
return
|
||||
if (!bitcoin.verify_derivation_path(derivationpathtext.text))
|
||||
return
|
||||
valid = true
|
||||
}
|
||||
|
||||
function setDerivationPath() {
|
||||
var p = getScriptTypePurposeDict()
|
||||
derivationpathtext.text =
|
||||
"m/" + addrtype[addresstypegroup.checkedButton.addresstype] + "'/"
|
||||
"m/" + p[scripttypegroup.checkedButton.scripttype] + "'/"
|
||||
+ (Network.isTestNet ? 1 : 0) + "'/0'"
|
||||
}
|
||||
|
||||
ButtonGroup {
|
||||
id: addresstypegroup
|
||||
id: scripttypegroup
|
||||
onCheckedButtonChanged: {
|
||||
console.log('button changed: ' + checkedButton.addresstype)
|
||||
setDerivationPath()
|
||||
}
|
||||
}
|
||||
@@ -50,18 +62,18 @@ WizardComponent {
|
||||
}
|
||||
Label { text: qsTr('Choose the type of addresses in your wallet.') }
|
||||
RadioButton {
|
||||
ButtonGroup.group: addresstypegroup
|
||||
property string addresstype: 'p2pkh'
|
||||
ButtonGroup.group: scripttypegroup
|
||||
property string scripttype: 'p2pkh'
|
||||
text: qsTr('legacy (p2pkh)')
|
||||
}
|
||||
RadioButton {
|
||||
ButtonGroup.group: addresstypegroup
|
||||
property string addresstype: 'p2wpkh-p2sh'
|
||||
ButtonGroup.group: scripttypegroup
|
||||
property string scripttype: 'p2wpkh-p2sh'
|
||||
text: qsTr('wrapped segwit (p2wpkh-p2sh)')
|
||||
}
|
||||
RadioButton {
|
||||
ButtonGroup.group: addresstypegroup
|
||||
property string addresstype: 'p2wpkh'
|
||||
ButtonGroup.group: scripttypegroup
|
||||
property string scripttype: 'p2wpkh'
|
||||
checked: true
|
||||
text: qsTr('native segwit (p2wpkh)')
|
||||
}
|
||||
@@ -73,8 +85,14 @@ WizardComponent {
|
||||
id: derivationpathtext
|
||||
Layout.fillWidth: true
|
||||
placeholderText: qsTr('Derivation path')
|
||||
onTextChanged: validate()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Bitcoin {
|
||||
id: bitcoin
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user