Browse Source

PASS1-89: Show exported filename when exporting wallet to microSD (#43)

* PASS1-89: Show exported filename when exporting wallet to microSD

* Deleted/commented unnecessary lines
PASS1-112
Corey Lakey 3 years ago
committed by GitHub
parent
commit
145dfe4457
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      ports/stm32/boards/Passport/modules/new_wallet.py
  2. 4
      ports/stm32/boards/Passport/modules/wallets/bitcoin_core.py
  3. 2
      ports/stm32/boards/Passport/modules/wallets/bluewallet.py
  4. 2
      ports/stm32/boards/Passport/modules/wallets/btcpay.py
  5. 2
      ports/stm32/boards/Passport/modules/wallets/caravan.py
  6. 4
      ports/stm32/boards/Passport/modules/wallets/casa.py
  7. 2
      ports/stm32/boards/Passport/modules/wallets/dux_reserve.py
  8. 2
      ports/stm32/boards/Passport/modules/wallets/electrum.py
  9. 2
      ports/stm32/boards/Passport/modules/wallets/fullynoded.py
  10. 2
      ports/stm32/boards/Passport/modules/wallets/gordian.py
  11. 2
      ports/stm32/boards/Passport/modules/wallets/lily.py
  12. 2
      ports/stm32/boards/Passport/modules/wallets/sparrow.py
  13. 2
      ports/stm32/boards/Passport/modules/wallets/specter.py
  14. 2
      ports/stm32/boards/Passport/modules/wallets/wasabi.py

15
ports/stm32/boards/Passport/modules/new_wallet.py

@ -547,17 +547,23 @@ class NewWalletUX(UXStateMachine):
elif self.state == self.EXPORT_TO_MICROSD:
from files import CardSlot
from utils import xfp2str
data = self.prepare_to_export()
data_hash = bytearray(32)
system.sha256(data, data_hash)
fname = ''
# Write the data to SD with the filename the wallet prefers
filename_pattern = self.export_mode['filename_pattern_multisig'] if self.is_multisig() else self.export_mode['filename_pattern']
try:
with CardSlot() as card:
# Make a filename with the option of injecting the sd path, hash of the data, acct num, random number
fname = filename_pattern.format(sd=card.get_sd_root(), hash=data_hash, acct=self.acct_num, random=random_hex(8))
fname = filename_pattern.format(sd=card.get_sd_root(),
hash=data_hash,
acct=self.acct_num,
random=random_hex(8),
xfp=xfp2str(settings.get('xfp')).lower())
# print('Saving to fname={}'.format(fname))
# Write the data
@ -581,7 +587,12 @@ class NewWalletUX(UXStateMachine):
self.exported = True
self.save_new_wallet_progress()
dis.fullscreen('Saved to microSD')
base_filename = fname.split(card.get_sd_root() + '/', 1)[1]
result = await ux_show_story('Saved file to your microSD card.\n{}'.format(base_filename),
title='Success',
left_btn='NEXT',
center=True,
center_vertically=True)
await sleep_ms(1000)
# If multisig, we need to import the quorum/config info first, else go right to validating the first

4
ports/stm32/boards/Passport/modules/wallets/bitcoin_core.py

@ -102,7 +102,7 @@ BitcoinCoreWallet = {
{'id':'single-sig', 'label':'Single-sig', 'addr_type': None, 'create_wallet': create_bitcoin_core_export},
],
'export_modes': [
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/passport-bitcoin-core.txt', 'ext': '.txt',
'filename_pattern_multisig': '{sd}/passport-bitcoin-core-multisig.json'}
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/{xfp}-bitcoin-core.txt', 'ext': '.txt',
'filename_pattern_multisig': '{sd}/{xfp}-bitcoin-core-multisig.json'}
]
}

2
ports/stm32/boards/Passport/modules/wallets/bluewallet.py

@ -19,6 +19,6 @@ BlueWallet = {
],
'export_modes': [
{'id': 'qr', 'label': 'QR Code', 'qr_type': QRType.UR1},
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/passport-bluewallet.json', 'filename_pattern_multisig': '{sd}/passport-bluewallet-multisig.json'}
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/{xfp}-bluewallet.json', 'filename_pattern_multisig': '{sd}/{xfp}-bluewallet-multisig.json'}
]
}

2
ports/stm32/boards/Passport/modules/wallets/btcpay.py

@ -18,6 +18,6 @@ BtcPayWallet = {
'address_validation_method': 'show_addresses',
'export_modes': [
{'id': 'qr', 'label': 'QR Code', 'qr_type': QRType.QR},
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/passport-btcpay.json', 'filename_pattern_multisig': '{sd}/passport-btcpay-multisig.json'}
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/{xfp}-btcpay.json', 'filename_pattern_multisig': '{sd}/{xfp}-btcpay-multisig.json'}
]
}

2
ports/stm32/boards/Passport/modules/wallets/caravan.py

@ -14,6 +14,6 @@ CaravanWallet = {
'import_microsd': read_multisig_config_from_microsd}
],
'export_modes': [
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/passport-caravan.json', 'filename_pattern_multisig': '{sd}/passport-caravan-multisig.json'}
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/{xfp}-caravan.json', 'filename_pattern_multisig': '{sd}/{xfp}-caravan-multisig.json'}
]
}

4
ports/stm32/boards/Passport/modules/wallets/casa.py

@ -54,7 +54,7 @@ CasaWallet = {
'import_microsd': read_multisig_config_from_microsd}
],
'export_modes': [
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/passport-casa.txt', 'ext': '.txt',
'filename_pattern_multisig': '{sd}/passport-casa-multisig.json', 'ext_multisig': '.txt',}
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/{xfp}-casa.txt', 'ext': '.txt',
'filename_pattern_multisig': '{sd}/{xfp}-casa-multisig.json', 'ext_multisig': '.txt',}
]
}

2
ports/stm32/boards/Passport/modules/wallets/dux_reserve.py

@ -18,6 +18,6 @@ DuxReserveWallet = {
'import_microsd': read_multisig_config_from_microsd}
],
'export_modes': [
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/passport-dux.json', 'filename_pattern_multisig': '{sd}/passport-dux-multisig.json'}
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/{xfp}-dux.json', 'filename_pattern_multisig': '{sd}/{xfp}-dux-multisig.json'}
]
}

2
ports/stm32/boards/Passport/modules/wallets/electrum.py

@ -136,6 +136,6 @@ ElectrumWallet = {
# 'import_microsd': read_multisig_config_from_microsd}
],
'export_modes': [
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/passport-electrum.json', 'filename_pattern_multisig': '{sd}/passport-electrum-multisig.json'}
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/{xfp}-electrum.json', 'filename_pattern_multisig': '{sd}/{xfp}-electrum-multisig.json'}
]
}

2
ports/stm32/boards/Passport/modules/wallets/fullynoded.py

@ -19,6 +19,6 @@ FullyNodedWallet = {
],
'export_modes': [
{'id': 'qr', 'label': 'QR Code', 'qr_type': QRType.UR2},
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/passport-fullynoded.json', 'filename_pattern_multisig': '{sd}/passport-fullynoded-multisig.json'}
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/{xfp}-fullynoded.json', 'filename_pattern_multisig': '{sd}/{xfp}-fullynoded-multisig.json'}
]
}

2
ports/stm32/boards/Passport/modules/wallets/gordian.py

@ -19,6 +19,6 @@ GordianWallet = {
],
'export_modes': [
{'id': 'qr', 'label': 'QR Code', 'qr_type': QRType.UR2},
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/passport-gordian.json', 'filename_pattern_multisig': '{sd}/passport-gordian-multisig.json'}
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/{xfp}-gordian.json', 'filename_pattern_multisig': '{sd}/{xfp}-gordian-multisig.json'}
]
}

2
ports/stm32/boards/Passport/modules/wallets/lily.py

@ -20,6 +20,6 @@ LilyWallet = {
],
'export_modes': [
# {'id': 'qr', 'label': 'QR Code', 'qr_type': QRType.UR1},
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/passport-lily.json', 'filename_pattern_multisig': '{sd}/passport-lily-multisig.json'}
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/{xfp}-lily.json', 'filename_pattern_multisig': '{sd}/{xfp}-lily-multisig.json'}
]
}

2
ports/stm32/boards/Passport/modules/wallets/sparrow.py

@ -18,6 +18,6 @@ SparrowWallet = {
],
'export_modes': [
{'id': 'qr', 'label': 'QR Code', 'qr_type': QRType.UR2},
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/passport-sparrow.json', 'filename_pattern_multisig': '{sd}/passport-sparrow-multisig.json'}
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/{xfp}-sparrow.json', 'filename_pattern_multisig': '{sd}/{xfp}-sparrow-multisig.json'}
]
}

2
ports/stm32/boards/Passport/modules/wallets/specter.py

@ -19,6 +19,6 @@ SpecterWallet = {
],
'export_modes': [
# {'id': 'qr', 'label': 'QR Code', 'qr_type': QRType.UR1},
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/passport-specter.json', 'filename_pattern_multisig': '{sd}/passport-specter-multisig.json'}
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/{xfp}-specter.json', 'filename_pattern_multisig': '{sd}/{xfp}-specter-multisig.json'}
]
}

2
ports/stm32/boards/Passport/modules/wallets/wasabi.py

@ -48,6 +48,6 @@ WasabiWallet = {
{'id':'single-sig', 'label':'Single-sig', 'addr_type': AF_P2WPKH, 'create_wallet': create_wasabi_export},
],
'export_modes': [
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/passport-wasabi.json', 'filename_pattern_multisig': '{sd}/passport-wasabi-multisig.json'}
{'id': 'microsd', 'label': 'microSD', 'filename_pattern': '{sd}/{xfp}-wasabi.json', 'filename_pattern_multisig': '{sd}/{xfp}-wasabi-multisig.json'}
]
}

Loading…
Cancel
Save