From 9944283d52278045a9c7a95e47fcca0e468a4bfa Mon Sep 17 00:00:00 2001 From: tadeubas Date: Thu, 31 Aug 2023 18:48:09 -0300 Subject: [PATCH 1/2] Changed remaining singlekey to singlesig --- .../using-a-single-sig-wallet.en.md | 20 +-- tests/pages/test_addresses.py | 68 +++++----- tests/pages/test_home.py | 116 ++++++++--------- tests/pages/test_stackbit.py | 4 +- tests/pages/test_tiny_seed.py | 6 +- tests/test_psbt.py | 8 +- tests/test_wallet.py | 120 +++++++++--------- 7 files changed, 171 insertions(+), 171 deletions(-) diff --git a/docs/getting-started/using-a-single-sig-wallet.en.md b/docs/getting-started/using-a-single-sig-wallet.en.md index b4cf38582..160245d56 100644 --- a/docs/getting-started/using-a-single-sig-wallet.en.md +++ b/docs/getting-started/using-a-single-sig-wallet.en.md @@ -42,15 +42,15 @@ Selecting `single-sig` will derive an xpub using the derivation path `m/84'/0'/0 Choose to create a *Single key wallet* when it asks which type of wallet you want on the following screen. - + Select the device you just added. - + Give your wallet a name and make sure to select *Segwit* for the wallet type, then press *Create wallet*. - + Congrats, you just created a single-sig wallet with your key! @@ -58,11 +58,11 @@ Selecting `single-sig` will derive an xpub using the derivation path `m/84'/0'/0 In Sparrow, create a new wallet by going to *File > New Wallet* and give it a name. - + On the wallet screen, make sure to select a *Single Signature* policy type with the *Native Segwit (P2WPKH)* script type. - + Now, you will need to import your public key. To do so, press the *Airgapped Hardware Wallet* button under *Keystores*. On the screen that pops up, Krux is not listed as one of the available device types, so look for the *Specter DIY* option and click its *Scan...* button. @@ -75,7 +75,7 @@ Selecting `single-sig` will derive an xpub using the derivation path `m/84'/0'/0 It should import the xpub and show a key under *Keystores* like the following: - + If everything looks right, click the blue *Apply* button to create your wallet. @@ -102,7 +102,7 @@ Selecting `single-sig` will derive an xpub using the derivation path `m/84'/0'/0 It should import the key and create a watch-only wallet. From here, you can send or receive. - + Congrats, you just created a single-sig wallet with your key! @@ -146,11 +146,11 @@ Selecting `single-sig` will derive an xpub using the derivation path `m/84'/0'/0 Load the wallet into Krux by tapping the ellipsis in the top-right to see the wallet settings. - + From here, tap *Export/Backup* in order to display a QR code of your wallet. - + In Krux, select the *Wallet* menu item option and scan the QR code. @@ -174,7 +174,7 @@ Selecting `single-sig` will derive an xpub using the derivation path `m/84'/0'/0 Navigate to the *Receive* screen where you should see a receive address that you can send funds to. - + === "BlueWallet" diff --git a/tests/pages/test_addresses.py b/tests/pages/test_addresses.py index f98d55973..134fa90a7 100644 --- a/tests/pages/test_addresses.py +++ b/tests/pages/test_addresses.py @@ -11,8 +11,8 @@ def test_scan_address(mocker, m5stickv, tdata): cases = [ # Single-sig, loaded, owned address, No print prompt, search successful ( - tdata.SINGLEKEY_12_WORD_KEY, - tdata.SPECTER_SINGLEKEY_WALLET_DATA, + tdata.SINGLESIG_12_WORD_KEY, + tdata.SPECTER_SINGLESIG_WALLET_DATA, True, "bc1qrhjqrz2d9tdym3p2r9m2vwzn2sn2yl6k5m357y", None, @@ -21,8 +21,8 @@ def test_scan_address(mocker, m5stickv, tdata): ), # Single-sig, not loaded, owned address, No print prompt, search successful ( - tdata.SINGLEKEY_12_WORD_KEY, - tdata.SPECTER_SINGLEKEY_WALLET_DATA, + tdata.SINGLESIG_12_WORD_KEY, + tdata.SPECTER_SINGLESIG_WALLET_DATA, False, "bc1qrhjqrz2d9tdym3p2r9m2vwzn2sn2yl6k5m357y", None, @@ -31,8 +31,8 @@ def test_scan_address(mocker, m5stickv, tdata): ), # Single-sig, loaded, owned address, Print, search successful ( - tdata.SINGLEKEY_12_WORD_KEY, - tdata.SPECTER_SINGLEKEY_WALLET_DATA, + tdata.SINGLESIG_12_WORD_KEY, + tdata.SPECTER_SINGLESIG_WALLET_DATA, True, "bc1qrhjqrz2d9tdym3p2r9m2vwzn2sn2yl6k5m357y", MockPrinter(), @@ -41,8 +41,8 @@ def test_scan_address(mocker, m5stickv, tdata): ), # Single-sig, loaded, owned address, Decline to print, search successful ( - tdata.SINGLEKEY_12_WORD_KEY, - tdata.SPECTER_SINGLEKEY_WALLET_DATA, + tdata.SINGLESIG_12_WORD_KEY, + tdata.SPECTER_SINGLESIG_WALLET_DATA, True, "bc1qrhjqrz2d9tdym3p2r9m2vwzn2sn2yl6k5m357y", MockPrinter(), @@ -91,8 +91,8 @@ def test_scan_address(mocker, m5stickv, tdata): ), # Single-sig, loaded, unowned address, No print prompt, search unsuccessful ( - tdata.SINGLEKEY_12_WORD_KEY, - tdata.SPECTER_SINGLEKEY_WALLET_DATA, + tdata.SINGLESIG_12_WORD_KEY, + tdata.SPECTER_SINGLESIG_WALLET_DATA, True, "bc1q6y95p2qkcmsr7kp5zpnt04qx5l2slq73d9um62ka3s5nr83mlcfsywsn65", None, @@ -111,8 +111,8 @@ def test_scan_address(mocker, m5stickv, tdata): ), # Single-sig, loaded, unowned m/44 address, No print prompt, skip search ( - tdata.SINGLEKEY_12_WORD_KEY, - tdata.SPECTER_SINGLEKEY_WALLET_DATA, + tdata.SINGLESIG_12_WORD_KEY, + tdata.SPECTER_SINGLESIG_WALLET_DATA, True, "14ihRbmxbgZ6JN9HdDDo6u6nGradHDy4GJ", None, @@ -121,8 +121,8 @@ def test_scan_address(mocker, m5stickv, tdata): ), # Single-sig, loaded, unowned m/44 address, No print prompt, search unsuccessful ( - tdata.SINGLEKEY_12_WORD_KEY, - tdata.SPECTER_SINGLEKEY_WALLET_DATA, + tdata.SINGLESIG_12_WORD_KEY, + tdata.SPECTER_SINGLESIG_WALLET_DATA, True, "14ihRbmxbgZ6JN9HdDDo6u6nGradHDy4GJ", None, @@ -131,8 +131,8 @@ def test_scan_address(mocker, m5stickv, tdata): ), # Single-sig, loaded, unowned m/44 address, No print prompt, 2x search unsuccessful ( - tdata.SINGLEKEY_12_WORD_KEY, - tdata.SPECTER_SINGLEKEY_WALLET_DATA, + tdata.SINGLESIG_12_WORD_KEY, + tdata.SPECTER_SINGLESIG_WALLET_DATA, True, "14ihRbmxbgZ6JN9HdDDo6u6nGradHDy4GJ", None, @@ -141,8 +141,8 @@ def test_scan_address(mocker, m5stickv, tdata): ), # Single-sig, loaded, unowned m/48/0/0/2 address, No print prompt, search unsuccessful ( - tdata.SINGLEKEY_12_WORD_KEY, - tdata.SPECTER_SINGLEKEY_WALLET_DATA, + tdata.SINGLESIG_12_WORD_KEY, + tdata.SPECTER_SINGLESIG_WALLET_DATA, True, "1BRwWQ3GHabCV5DP6MfnCpr6dF6GBAwQ7k", None, @@ -151,8 +151,8 @@ def test_scan_address(mocker, m5stickv, tdata): ), # Single-sig, loaded, unowned m/84 address, No print prompt, search unsuccessful ( - tdata.SINGLEKEY_12_WORD_KEY, - tdata.SPECTER_SINGLEKEY_WALLET_DATA, + tdata.SINGLESIG_12_WORD_KEY, + tdata.SPECTER_SINGLESIG_WALLET_DATA, True, "bc1qx2zuday8d6j4ufh4df6e9ttd06lnfmn2cuz0vn", None, @@ -161,8 +161,8 @@ def test_scan_address(mocker, m5stickv, tdata): ), # Single-sig, loaded, unowned m/49 address, No print prompt, search unsuccessful ( - tdata.SINGLEKEY_12_WORD_KEY, - tdata.SPECTER_SINGLEKEY_WALLET_DATA, + tdata.SINGLESIG_12_WORD_KEY, + tdata.SPECTER_SINGLESIG_WALLET_DATA, True, "32iCX1pY1iztdgM5qzurGLPMu5xhNfAUtg", None, @@ -171,8 +171,8 @@ def test_scan_address(mocker, m5stickv, tdata): ), # Single-sig, loaded, unowned m/0 address, No print prompt, search unsuccessful ( - tdata.SINGLEKEY_12_WORD_KEY, - tdata.SPECTER_SINGLEKEY_WALLET_DATA, + tdata.SINGLESIG_12_WORD_KEY, + tdata.SPECTER_SINGLESIG_WALLET_DATA, True, "3KLoUhwLihgC5aPQPFHakWUtJ4QoBkT7Aw", None, @@ -181,8 +181,8 @@ def test_scan_address(mocker, m5stickv, tdata): ), # Single-sig, loaded, unowned m/0 address, Print, search unsuccessful ( - tdata.SINGLEKEY_12_WORD_KEY, - tdata.SPECTER_SINGLEKEY_WALLET_DATA, + tdata.SINGLESIG_12_WORD_KEY, + tdata.SPECTER_SINGLESIG_WALLET_DATA, True, "3KLoUhwLihgC5aPQPFHakWUtJ4QoBkT7Aw", MockPrinter(), @@ -191,8 +191,8 @@ def test_scan_address(mocker, m5stickv, tdata): ), # Single-sig, loaded, unowned m/0 address, Decline to print, search unsuccessful ( - tdata.SINGLEKEY_12_WORD_KEY, - tdata.SPECTER_SINGLEKEY_WALLET_DATA, + tdata.SINGLESIG_12_WORD_KEY, + tdata.SPECTER_SINGLESIG_WALLET_DATA, True, "3KLoUhwLihgC5aPQPFHakWUtJ4QoBkT7Aw", MockPrinter(), @@ -201,8 +201,8 @@ def test_scan_address(mocker, m5stickv, tdata): ), # Single-sig, loaded, fail to capture QR of address, No print prompt, can't search ( - tdata.SINGLEKEY_12_WORD_KEY, - tdata.SPECTER_SINGLEKEY_WALLET_DATA, + tdata.SINGLESIG_12_WORD_KEY, + tdata.SPECTER_SINGLESIG_WALLET_DATA, True, None, None, @@ -211,8 +211,8 @@ def test_scan_address(mocker, m5stickv, tdata): ), # Single-sig, loaded, invalid address, No print prompt, can't search ( - tdata.SINGLEKEY_12_WORD_KEY, - tdata.SPECTER_SINGLEKEY_WALLET_DATA, + tdata.SINGLESIG_12_WORD_KEY, + tdata.SPECTER_SINGLESIG_WALLET_DATA, True, "invalidaddress", None, @@ -258,8 +258,8 @@ def test_list_receive_addresses(mocker, m5stickv, tdata): cases = [ # Single-sig, loaded, No print prompt, show address nÂș1 ( - tdata.SINGLEKEY_12_WORD_KEY, - tdata.SPECTER_SINGLEKEY_WALLET_DATA, + tdata.SINGLESIG_12_WORD_KEY, + tdata.SPECTER_SINGLESIG_WALLET_DATA, False, "bc1qrhjqrz2d9tdym3p2r9m2vwzn2sn2yl6k5m357y", None, diff --git a/tests/pages/test_home.py b/tests/pages/test_home.py index 001d52d2a..4ba34ae9d 100644 --- a/tests/pages/test_home.py +++ b/tests/pages/test_home.py @@ -14,13 +14,13 @@ def tdata(mocker): TEST_24_WORD_MNEMONIC = "brush badge sing still venue panther kitchen please help panel bundle excess sign couch stove increase human once effort candy goat top tiny major" SIGNING_MNEMONIC = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about" - SINGLEKEY_12_WORD_KEY = Key(TEST_12_WORD_MNEMONIC, False, NETWORKS["main"]) - SINGLEKEY_24_WORD_KEY = Key(TEST_24_WORD_MNEMONIC, False, NETWORKS["main"]) + SINGLESIG_12_WORD_KEY = Key(TEST_12_WORD_MNEMONIC, False, NETWORKS["main"]) + SINGLESIG_24_WORD_KEY = Key(TEST_24_WORD_MNEMONIC, False, NETWORKS["main"]) MULTISIG_12_WORD_KEY = Key(TEST_12_WORD_MNEMONIC, True, NETWORKS["main"]) - SINGLEKEY_SIGNING_KEY = Key(SIGNING_MNEMONIC, False, NETWORKS["main"]) + SINGLESIG_SIGNING_KEY = Key(SIGNING_MNEMONIC, False, NETWORKS["main"]) MULTISIG_SIGNING_KEY = Key(SIGNING_MNEMONIC, True, NETWORKS["main"]) - SPECTER_SINGLEKEY_WALLET_DATA = '{"label": "Specter Singlekey Wallet", "blockheight": 0, "descriptor": "wpkh([55f8fc5d/84h/0h/0h]xpub6DPMTPxGMqdtzMwpqT1dDQaVdyaEppEm2qYSaJ7ANsuES7HkNzrXJst1Ed8D7NAnijUdgSDUFgph1oj5LKKAD5gyxWNhNP2AuDqaKYqzphA/0/*)#9qx3vqss", "devices": [{"type": "other", "label": "Key1"}]}' + SPECTER_SINGLESIG_WALLET_DATA = '{"label": "Specter Singlesig Wallet", "blockheight": 0, "descriptor": "wpkh([55f8fc5d/84h/0h/0h]xpub6DPMTPxGMqdtzMwpqT1dDQaVdyaEppEm2qYSaJ7ANsuES7HkNzrXJst1Ed8D7NAnijUdgSDUFgph1oj5LKKAD5gyxWNhNP2AuDqaKYqzphA/0/*)#9qx3vqss", "devices": [{"type": "other", "label": "Key1"}]}' SPECTER_MULTISIG_WALLET_DATA = '{"label": "Specter Multisig Wallet", "blockheight": 0, "descriptor": "wsh(sortedmulti(2,[55f8fc5d/48h/0h/0h/2h]xpub6EKmKYGYc1WY6t9d3d9SksR8keSaPZbFa6tqsGiH4xVxx8d2YyxSX7WG6yXEX3CmG54dPCxaapDw1XsjwCmfoqP7tbsAeqMVfKvqSAu4ndy/0/*,[3e15470d/48h/0h/0h/2h]xpub6F2P6Pz5KLPgCc6pTBd2xxCunaSYWc8CdkL28W5z15pJrN3aCYY7mCUAkCMtqrgT2wdhAGgRnJxAkCCUpGKoXKxQ57yffEGmPwtYA3DEXwu/0/*,[d3a80c8b/48h/0h/0h/2h]xpub6FKYY6y3oVi7ihSCszFKRSeZj5SzrfSsUFXhKqjMV4iigrLhxwMX3mrjioNyLTZ5iD3u4wU9S3tyzpJGxhd5geaXoQ68jGz2M6dfh2zJrUv/0/*))#3nfc6jdy", "devices": [{"type": "other", "label": "Key1"}, {"type": "other", "label": "Key2"}, {"type": "other", "label": "Key3"}]}' P2WPKH_PSBT = b'psbt\xff\x01\x00q\x02\x00\x00\x00\x01\xcf pmofn, sign, No print prompt ( # Case 0 - tdata.SINGLEKEY_SIGNING_KEY, # 0 wallet + tdata.SINGLESIG_SIGNING_KEY, # 0 wallet None, # 1 wallet False, # 2 if True: wallet will be #1 instead tdata.P2WPKH_PSBT_B64, # 3 capture_qr_code return 1 @@ -740,7 +740,7 @@ def test_sign_psbt(mocker, m5stickv, tdata): # Single-sig, not loaded, pmofn, sign, No print prompt ( # Case 1 - tdata.SINGLEKEY_SIGNING_KEY, + tdata.SINGLESIG_SIGNING_KEY, None, False, tdata.P2WPKH_PSBT_B64, @@ -762,7 +762,7 @@ def test_sign_psbt(mocker, m5stickv, tdata): # Single-sig, not loaded, pmofn, sign, Print ( # Case 2 - tdata.SINGLEKEY_SIGNING_KEY, + tdata.SINGLESIG_SIGNING_KEY, None, False, tdata.P2WPKH_PSBT_B64, @@ -785,7 +785,7 @@ def test_sign_psbt(mocker, m5stickv, tdata): # Single-sig, not loaded, pmofn, sign, Decline to print ( # Case 3 - tdata.SINGLEKEY_SIGNING_KEY, + tdata.SINGLESIG_SIGNING_KEY, None, False, tdata.P2WPKH_PSBT_B64, @@ -808,7 +808,7 @@ def test_sign_psbt(mocker, m5stickv, tdata): # Single-sig, not loaded, pmofn, decline to sign ( # Case 4 - tdata.SINGLEKEY_SIGNING_KEY, + tdata.SINGLESIG_SIGNING_KEY, None, False, tdata.P2WPKH_PSBT_B64, @@ -829,7 +829,7 @@ def test_sign_psbt(mocker, m5stickv, tdata): # Single-sig, not loaded, failed to capture PSBT QR ( # Case 5 - tdata.SINGLEKEY_SIGNING_KEY, + tdata.SINGLESIG_SIGNING_KEY, None, False, None, @@ -927,7 +927,7 @@ def test_sign_psbt(mocker, m5stickv, tdata): # Single-sig, not loaded, load from microSD, sign, save to microSD, No print prompt ( # Case 10 - tdata.SINGLEKEY_SIGNING_KEY, # 0 wallet + tdata.SINGLESIG_SIGNING_KEY, # 0 wallet None, False, tdata.P2WPKH_PSBT, # 3 capture_qr_code return 1 @@ -1162,7 +1162,7 @@ def test_sign_message(mocker, m5stickv, tdata): for case in cases: print("test_sign_message case: ", num) num += 1 - wallet = Wallet(tdata.SINGLEKEY_SIGNING_KEY) + wallet = Wallet(tdata.SINGLESIG_SIGNING_KEY) ctx = create_ctx(mocker, case[3], wallet, case[2]) home = Home(ctx) diff --git a/tests/pages/test_stackbit.py b/tests/pages/test_stackbit.py index 023b6c5c0..03c51bd34 100644 --- a/tests/pages/test_stackbit.py +++ b/tests/pages/test_stackbit.py @@ -7,7 +7,7 @@ def test_export_mnemonic_stackbit(mocker, m5stickv, tdata): from krux.input import BUTTON_ENTER, BUTTON_PAGE case = [ - Wallet(tdata.SINGLEKEY_24_WORD_KEY), + Wallet(tdata.SINGLESIG_24_WORD_KEY), None, [ BUTTON_PAGE, @@ -38,7 +38,7 @@ def test_export_mnemonic_stackbit_amigo(mocker, amigo_tft, tdata): from krux.input import BUTTON_ENTER, BUTTON_PAGE case = [ - Wallet(tdata.SINGLEKEY_24_WORD_KEY), + Wallet(tdata.SINGLESIG_24_WORD_KEY), None, [ BUTTON_PAGE, diff --git a/tests/pages/test_tiny_seed.py b/tests/pages/test_tiny_seed.py index e527f8730..60d9f226a 100644 --- a/tests/pages/test_tiny_seed.py +++ b/tests/pages/test_tiny_seed.py @@ -10,7 +10,7 @@ def test_export_mnemonic_tiny_seed_menu(mocker, m5stickv, tdata): PRINT_LINES_24W = 312 case = [ - Wallet(tdata.SINGLEKEY_24_WORD_KEY), + Wallet(tdata.SINGLESIG_24_WORD_KEY), MockPrinter(), [ BUTTON_PAGE, @@ -49,8 +49,8 @@ def test_export_tiny_seed(m5stickv, mocker): TEST_24_WORD_MNEMONIC = "brush badge sing still venue panther kitchen please help panel bundle excess sign couch stove increase human once effort candy goat top tiny major" # Amount of rectangles filled for this mnemonic + menus FILLED_RECTANGLES = 189 - SINGLEKEY_24_WORD_KEY = Key(TEST_24_WORD_MNEMONIC, False, NETWORKS["main"]) - ctx = create_ctx(mocker, BTN_SEQUENCE, Wallet(SINGLEKEY_24_WORD_KEY), MockPrinter()) + SINGLESIG_24_WORD_KEY = Key(TEST_24_WORD_MNEMONIC, False, NETWORKS["main"]) + ctx = create_ctx(mocker, BTN_SEQUENCE, Wallet(SINGLESIG_24_WORD_KEY), MockPrinter()) tiny_seed = TinySeed(ctx) tiny_seed.export() diff --git a/tests/test_psbt.py b/tests/test_psbt.py index ab262ecd6..54f96cac2 100644 --- a/tests/test_psbt.py +++ b/tests/test_psbt.py @@ -156,7 +156,7 @@ def tdata(mocker): ) -def test_init_singlekey(mocker, m5stickv, tdata): +def test_init_singlesig(mocker, m5stickv, tdata): from embit.networks import NETWORKS from krux.psbt import PSBTSigner from krux.key import Key @@ -227,7 +227,7 @@ def test_init_fails_on_invalid_psbt(mocker, m5stickv, tdata): PSBTSigner(wallet, case[0], case[1]) -def test_sign_singlekey(mocker, m5stickv, tdata): +def test_sign_singlesig(mocker, m5stickv, tdata): from embit.networks import NETWORKS from krux.psbt import PSBTSigner from krux.key import Key @@ -256,7 +256,7 @@ def test_sign_singlekey(mocker, m5stickv, tdata): num = 0 for case in cases: - print("test_sign_singlekey case: ", num) + print("test_sign_singlesig case: ", num) num += 1 signer = PSBTSigner(wallet, case[0], case[1]) signer.sign() @@ -312,7 +312,7 @@ def test_sign_fails_with_0_sigs_added(mocker, m5stickv, tdata): signer.psbt.sign_with.assert_called_with(wallet.key.root) -def test_outputs_singlekey(mocker, m5stickv, tdata): +def test_outputs_singlesig(mocker, m5stickv, tdata): from embit.networks import NETWORKS from krux.psbt import PSBTSigner from krux.key import Key diff --git a/tests/test_wallet.py b/tests/test_wallet.py index 8e4430d77..a97d3e589 100644 --- a/tests/test_wallet.py +++ b/tests/test_wallet.py @@ -15,24 +15,24 @@ def tdata(mocker): TEST_MNEMONIC2 = "brush badge sing still venue panther kitchen please help panel bundle excess sign couch stove increase human once effort candy goat top tiny major" TEST_MNEMONIC3 = "range fatigue into stadium endless kitchen royal present rally welcome scatter twice" - SINGLEKEY_KEY = Key(TEST_MNEMONIC1, False, NETWORKS["main"]) + SINGLESIG_KEY = Key(TEST_MNEMONIC1, False, NETWORKS["main"]) MULTISIG_KEY1 = Key(TEST_MNEMONIC1, True, NETWORKS["main"]) MULTISIG_KEY2 = Key(TEST_MNEMONIC2, True, NETWORKS["main"]) MULTISIG_KEY3 = Key(TEST_MNEMONIC3, True, NETWORKS["main"]) - # SINGLEKEY_KEY [55f8fc5d/84h/0h/0h]xpub6DPMTPxGMqdtzMwpqT1dDQaVdyaEppEm2qYSaJ7ANsuES7HkNzrXJst1Ed8D7NAnijUdgSDUFgph1oj5LKKAD5gyxWNhNP2AuDqaKYqzphA + # SINGLESIG_KEY [55f8fc5d/84h/0h/0h]xpub6DPMTPxGMqdtzMwpqT1dDQaVdyaEppEm2qYSaJ7ANsuES7HkNzrXJst1Ed8D7NAnijUdgSDUFgph1oj5LKKAD5gyxWNhNP2AuDqaKYqzphA # MULTISIG_KEY1 [55f8fc5d/48h/0h/0h/2h]xpub6EKmKYGYc1WY6t9d3d9SksR8keSaPZbFa6tqsGiH4xVxx8d2YyxSX7WG6yXEX3CmG54dPCxaapDw1XsjwCmfoqP7tbsAeqMVfKvqSAu4ndy # MULTISIG_KEY2 [3e15470d/48h/0h/0h/2h]xpub6F2P6Pz5KLPgCc6pTBd2xxCunaSYWc8CdkL28W5z15pJrN3aCYY7mCUAkCMtqrgT2wdhAGgRnJxAkCCUpGKoXKxQ57yffEGmPwtYA3DEXwu # MULTISIG_KEY3 [d3a80c8b/48h/0h/0h/2h]xpub6FKYY6y3oVi7ihSCszFKRSeZj5SzrfSsUFXhKqjMV4iigrLhxwMX3mrjioNyLTZ5iD3u4wU9S3tyzpJGxhd5geaXoQ68jGz2M6dfh2zJrUv - SPECTER_SINGLEKEY_DESCRIPTOR = "wpkh([55f8fc5d/84h/0h/0h]xpub6DPMTPxGMqdtzMwpqT1dDQaVdyaEppEm2qYSaJ7ANsuES7HkNzrXJst1Ed8D7NAnijUdgSDUFgph1oj5LKKAD5gyxWNhNP2AuDqaKYqzphA/0/*)" - SPECTER_SINGLEKEY_WALLET_DATA = '{"label": "Specter Singlekey Wallet", "blockheight": 0, "descriptor": "wpkh([55f8fc5d/84h/0h/0h]xpub6DPMTPxGMqdtzMwpqT1dDQaVdyaEppEm2qYSaJ7ANsuES7HkNzrXJst1Ed8D7NAnijUdgSDUFgph1oj5LKKAD5gyxWNhNP2AuDqaKYqzphA/0/*)#9qx3vqss", "devices": [{"type": "other", "label": "Key1"}]}' + SPECTER_SINGLESIG_DESCRIPTOR = "wpkh([55f8fc5d/84h/0h/0h]xpub6DPMTPxGMqdtzMwpqT1dDQaVdyaEppEm2qYSaJ7ANsuES7HkNzrXJst1Ed8D7NAnijUdgSDUFgph1oj5LKKAD5gyxWNhNP2AuDqaKYqzphA/0/*)" + SPECTER_SINGLESIG_WALLET_DATA = '{"label": "Specter Singlesig Wallet", "blockheight": 0, "descriptor": "wpkh([55f8fc5d/84h/0h/0h]xpub6DPMTPxGMqdtzMwpqT1dDQaVdyaEppEm2qYSaJ7ANsuES7HkNzrXJst1Ed8D7NAnijUdgSDUFgph1oj5LKKAD5gyxWNhNP2AuDqaKYqzphA/0/*)#9qx3vqss", "devices": [{"type": "other", "label": "Key1"}]}' SPECTER_MULTISIG_DESCRIPTOR = "wsh(sortedmulti(2,[55f8fc5d/48h/0h/0h/2h]xpub6EKmKYGYc1WY6t9d3d9SksR8keSaPZbFa6tqsGiH4xVxx8d2YyxSX7WG6yXEX3CmG54dPCxaapDw1XsjwCmfoqP7tbsAeqMVfKvqSAu4ndy/0/*,[3e15470d/48h/0h/0h/2h]xpub6F2P6Pz5KLPgCc6pTBd2xxCunaSYWc8CdkL28W5z15pJrN3aCYY7mCUAkCMtqrgT2wdhAGgRnJxAkCCUpGKoXKxQ57yffEGmPwtYA3DEXwu/0/*,[d3a80c8b/48h/0h/0h/2h]xpub6FKYY6y3oVi7ihSCszFKRSeZj5SzrfSsUFXhKqjMV4iigrLhxwMX3mrjioNyLTZ5iD3u4wU9S3tyzpJGxhd5geaXoQ68jGz2M6dfh2zJrUv/0/*))" SPECTER_MULTISIG_WALLET_DATA = '{"label": "Specter Multisig Wallet", "blockheight": 0, "descriptor": "wsh(sortedmulti(2,[55f8fc5d/48h/0h/0h/2h]xpub6EKmKYGYc1WY6t9d3d9SksR8keSaPZbFa6tqsGiH4xVxx8d2YyxSX7WG6yXEX3CmG54dPCxaapDw1XsjwCmfoqP7tbsAeqMVfKvqSAu4ndy/0/*,[3e15470d/48h/0h/0h/2h]xpub6F2P6Pz5KLPgCc6pTBd2xxCunaSYWc8CdkL28W5z15pJrN3aCYY7mCUAkCMtqrgT2wdhAGgRnJxAkCCUpGKoXKxQ57yffEGmPwtYA3DEXwu/0/*,[d3a80c8b/48h/0h/0h/2h]xpub6FKYY6y3oVi7ihSCszFKRSeZj5SzrfSsUFXhKqjMV4iigrLhxwMX3mrjioNyLTZ5iD3u4wU9S3tyzpJGxhd5geaXoQ68jGz2M6dfh2zJrUv/0/*))#3nfc6jdy", "devices": [{"type": "other", "label": "Key1"}, {"type": "other", "label": "Key2"}, {"type": "other", "label": "Key3"}]}' - BLUEWALLET_SINGLEKEY_DESCRIPTOR = "wpkh(xpub6DPMTPxGMqdtzMwpqT1dDQaVdyaEppEm2qYSaJ7ANsuES7HkNzrXJst1Ed8D7NAnijUdgSDUFgph1oj5LKKAD5gyxWNhNP2AuDqaKYqzphA)" - BLUEWALLET_SINGLEKEY_WALLET_DATA = "zpub6s3t4jJ6fCirgxL4WAasdamVyus8i4Dks4at95tw8tezYJvCtKBeZ1CHH33P7BUdY1iFBPQbB1XnnNxCmi9BoZ4BhBmYYCf9Sfxs6jY8Ycw" + BLUEWALLET_SINGLESIG_DESCRIPTOR = "wpkh(xpub6DPMTPxGMqdtzMwpqT1dDQaVdyaEppEm2qYSaJ7ANsuES7HkNzrXJst1Ed8D7NAnijUdgSDUFgph1oj5LKKAD5gyxWNhNP2AuDqaKYqzphA)" + BLUEWALLET_SINGLESIG_WALLET_DATA = "zpub6s3t4jJ6fCirgxL4WAasdamVyus8i4Dks4at95tw8tezYJvCtKBeZ1CHH33P7BUdY1iFBPQbB1XnnNxCmi9BoZ4BhBmYYCf9Sfxs6jY8Ycw" BLUEWALLET_MULTISIG_DESCRIPTOR = "wsh(sortedmulti(2,[55f8fc5d/48h/0h/0h/2h]xpub6EKmKYGYc1WY6t9d3d9SksR8keSaPZbFa6tqsGiH4xVxx8d2YyxSX7WG6yXEX3CmG54dPCxaapDw1XsjwCmfoqP7tbsAeqMVfKvqSAu4ndy,[3e15470d/48h/0h/0h/2h]xpub6F2P6Pz5KLPgCc6pTBd2xxCunaSYWc8CdkL28W5z15pJrN3aCYY7mCUAkCMtqrgT2wdhAGgRnJxAkCCUpGKoXKxQ57yffEGmPwtYA3DEXwu,[d3a80c8b/48h/0h/0h/2h]xpub6FKYY6y3oVi7ihSCszFKRSeZj5SzrfSsUFXhKqjMV4iigrLhxwMX3mrjioNyLTZ5iD3u4wU9S3tyzpJGxhd5geaXoQ68jGz2M6dfh2zJrUv))" BLUEWALLET_MULTISIG_WALLET_DATA = """ @@ -118,13 +118,13 @@ def tdata(mocker): ), ) - UNAMBIGUOUS_SINGLEKEY_DESCRIPTOR = "wpkh([55f8fc5d/84h/0h/0h]xpub6DPMTPxGMqdtzMwpqT1dDQaVdyaEppEm2qYSaJ7ANsuES7HkNzrXJst1Ed8D7NAnijUdgSDUFgph1oj5LKKAD5gyxWNhNP2AuDqaKYqzphA/{0,1}/*)" - AMBIGUOUS_SINGLEKEY_DESCRIPTOR = "wpkh([55f8fc5d/84h/0h/0h]xpub6DPMTPxGMqdtzMwpqT1dDQaVdyaEppEm2qYSaJ7ANsuES7HkNzrXJst1Ed8D7NAnijUdgSDUFgph1oj5LKKAD5gyxWNhNP2AuDqaKYqzphA)" + UNAMBIGUOUS_SINGLESIG_DESCRIPTOR = "wpkh([55f8fc5d/84h/0h/0h]xpub6DPMTPxGMqdtzMwpqT1dDQaVdyaEppEm2qYSaJ7ANsuES7HkNzrXJst1Ed8D7NAnijUdgSDUFgph1oj5LKKAD5gyxWNhNP2AuDqaKYqzphA/{0,1}/*)" + AMBIGUOUS_SINGLESIG_DESCRIPTOR = "wpkh([55f8fc5d/84h/0h/0h]xpub6DPMTPxGMqdtzMwpqT1dDQaVdyaEppEm2qYSaJ7ANsuES7HkNzrXJst1Ed8D7NAnijUdgSDUFgph1oj5LKKAD5gyxWNhNP2AuDqaKYqzphA)" UNAMBIGUOUS_MULTISIG_DESCRIPTOR = "wsh(sortedmulti(2,[55f8fc5d/48h/0h/0h/2h]xpub6EKmKYGYc1WY6t9d3d9SksR8keSaPZbFa6tqsGiH4xVxx8d2YyxSX7WG6yXEX3CmG54dPCxaapDw1XsjwCmfoqP7tbsAeqMVfKvqSAu4ndy/{0,1}/*,[3e15470d/48h/0h/0h/2h]xpub6F2P6Pz5KLPgCc6pTBd2xxCunaSYWc8CdkL28W5z15pJrN3aCYY7mCUAkCMtqrgT2wdhAGgRnJxAkCCUpGKoXKxQ57yffEGmPwtYA3DEXwu/{0,1}/*,[d3a80c8b/48h/0h/0h/2h]xpub6FKYY6y3oVi7ihSCszFKRSeZj5SzrfSsUFXhKqjMV4iigrLhxwMX3mrjioNyLTZ5iD3u4wU9S3tyzpJGxhd5geaXoQ68jGz2M6dfh2zJrUv/{0,1}/*))" AMBIGUOUS_MULTISIG_DESCRIPTOR = "wsh(sortedmulti(2,[55f8fc5d/48h/0h/0h/2h]xpub6EKmKYGYc1WY6t9d3d9SksR8keSaPZbFa6tqsGiH4xVxx8d2YyxSX7WG6yXEX3CmG54dPCxaapDw1XsjwCmfoqP7tbsAeqMVfKvqSAu4ndy,[3e15470d/48h/0h/0h/2h]xpub6F2P6Pz5KLPgCc6pTBd2xxCunaSYWc8CdkL28W5z15pJrN3aCYY7mCUAkCMtqrgT2wdhAGgRnJxAkCCUpGKoXKxQ57yffEGmPwtYA3DEXwu,[d3a80c8b/48h/0h/0h/2h]xpub6FKYY6y3oVi7ihSCszFKRSeZj5SzrfSsUFXhKqjMV4iigrLhxwMX3mrjioNyLTZ5iD3u4wU9S3tyzpJGxhd5geaXoQ68jGz2M6dfh2zJrUv))" - UNRELATED_SINGLEKEY_DESCRIPTOR = "wpkh([55f8fc5d/84h/0h/0h]xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB)" + UNRELATED_SINGLESIG_DESCRIPTOR = "wpkh([55f8fc5d/84h/0h/0h]xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB)" UNRELATED_MULTISIG_DESCRIPTOR = "wsh(sortedmulti(2,[55f8fc5d/48h/0h/0h/2h]xpub661MyMwAqRbcFW31YEwpkMuc5THy2PSt5bDMsktWQcFF8syAmRUapSCGu8ED9W6oDMSgv6Zz8idoc4a6mr8BDzTJY47LJhkJ8UB7WEGuduB,[3e15470d/48h/0h/0h/2h]xpub6F2P6Pz5KLPgCc6pTBd2xxCunaSYWc8CdkL28W5z15pJrN3aCYY7mCUAkCMtqrgT2wdhAGgRnJxAkCCUpGKoXKxQ57yffEGmPwtYA3DEXwu,[d3a80c8b/48h/0h/0h/2h]xpub6FKYY6y3oVi7ihSCszFKRSeZj5SzrfSsUFXhKqjMV4iigrLhxwMX3mrjioNyLTZ5iD3u4wU9S3tyzpJGxhd5geaXoQ68jGz2M6dfh2zJrUv))" UNSORTED_MULTISIG_DESCRIPTOR = "wsh(multi(2,[3e15470d/48h/0h/0h/2h]xpub6F2P6Pz5KLPgCc6pTBd2xxCunaSYWc8CdkL28W5z15pJrN3aCYY7mCUAkCMtqrgT2wdhAGgRnJxAkCCUpGKoXKxQ57yffEGmPwtYA3DEXwu/{0,1}/*,[55f8fc5d/48h/0h/0h/2h]xpub6EKmKYGYc1WY6t9d3d9SksR8keSaPZbFa6tqsGiH4xVxx8d2YyxSX7WG6yXEX3CmG54dPCxaapDw1XsjwCmfoqP7tbsAeqMVfKvqSAu4ndy/{0,1}/*,[d3a80c8b/48h/0h/0h/2h]xpub6FKYY6y3oVi7ihSCszFKRSeZj5SzrfSsUFXhKqjMV4iigrLhxwMX3mrjioNyLTZ5iD3u4wU9S3tyzpJGxhd5geaXoQ68jGz2M6dfh2zJrUv/{0,1}/*))" @@ -135,16 +135,16 @@ def tdata(mocker): "TEST_MNEMONIC1", "TEST_MNEMONIC2", "TEST_MNEMONIC3", - "SINGLEKEY_KEY", + "SINGLESIG_KEY", "MULTISIG_KEY1", "MULTISIG_KEY2", "MULTISIG_KEY3", - "SPECTER_SINGLEKEY_DESCRIPTOR", - "SPECTER_SINGLEKEY_WALLET_DATA", + "SPECTER_SINGLESIG_DESCRIPTOR", + "SPECTER_SINGLESIG_WALLET_DATA", "SPECTER_MULTISIG_DESCRIPTOR", "SPECTER_MULTISIG_WALLET_DATA", - "BLUEWALLET_SINGLEKEY_DESCRIPTOR", - "BLUEWALLET_SINGLEKEY_WALLET_DATA", + "BLUEWALLET_SINGLESIG_DESCRIPTOR", + "BLUEWALLET_SINGLESIG_WALLET_DATA", "BLUEWALLET_MULTISIG_DESCRIPTOR", "BLUEWALLET_MULTISIG_WALLET_DATA", "BLUEWALLET_MULTISIG_WALLET_DATA_INVALID_SCRIPT", @@ -154,11 +154,11 @@ def tdata(mocker): "UR_OUTPUT_MULTISIG_WALLET_DATA", "UR_BYTES_MULTISIG_DESCRIPTOR", "UR_BYTES_MULTISIG_WALLET_DATA", - "UNAMBIGUOUS_SINGLEKEY_DESCRIPTOR", - "AMBIGUOUS_SINGLEKEY_DESCRIPTOR", + "UNAMBIGUOUS_SINGLESIG_DESCRIPTOR", + "AMBIGUOUS_SINGLESIG_DESCRIPTOR", "UNAMBIGUOUS_MULTISIG_DESCRIPTOR", "AMBIGUOUS_MULTISIG_DESCRIPTOR", - "UNRELATED_SINGLEKEY_DESCRIPTOR", + "UNRELATED_SINGLESIG_DESCRIPTOR", "UNRELATED_MULTISIG_DESCRIPTOR", "UNSORTED_MULTISIG_DESCRIPTOR", ], @@ -166,16 +166,16 @@ def tdata(mocker): TEST_MNEMONIC1, TEST_MNEMONIC2, TEST_MNEMONIC3, - SINGLEKEY_KEY, + SINGLESIG_KEY, MULTISIG_KEY1, MULTISIG_KEY2, MULTISIG_KEY3, - SPECTER_SINGLEKEY_DESCRIPTOR, - SPECTER_SINGLEKEY_WALLET_DATA, + SPECTER_SINGLESIG_DESCRIPTOR, + SPECTER_SINGLESIG_WALLET_DATA, SPECTER_MULTISIG_DESCRIPTOR, SPECTER_MULTISIG_WALLET_DATA, - BLUEWALLET_SINGLEKEY_DESCRIPTOR, - BLUEWALLET_SINGLEKEY_WALLET_DATA, + BLUEWALLET_SINGLESIG_DESCRIPTOR, + BLUEWALLET_SINGLESIG_WALLET_DATA, BLUEWALLET_MULTISIG_DESCRIPTOR, BLUEWALLET_MULTISIG_WALLET_DATA, BLUEWALLET_MULTISIG_WALLET_DATA_INVALID_SCRIPT, @@ -185,23 +185,23 @@ def tdata(mocker): UR_OUTPUT_MULTISIG_WALLET_DATA, UR_BYTES_MULTISIG_DESCRIPTOR, UR_BYTES_MULTISIG_WALLET_DATA, - UNAMBIGUOUS_SINGLEKEY_DESCRIPTOR, - AMBIGUOUS_SINGLEKEY_DESCRIPTOR, + UNAMBIGUOUS_SINGLESIG_DESCRIPTOR, + AMBIGUOUS_SINGLESIG_DESCRIPTOR, UNAMBIGUOUS_MULTISIG_DESCRIPTOR, AMBIGUOUS_MULTISIG_DESCRIPTOR, - UNRELATED_SINGLEKEY_DESCRIPTOR, + UNRELATED_SINGLESIG_DESCRIPTOR, UNRELATED_MULTISIG_DESCRIPTOR, UNSORTED_MULTISIG_DESCRIPTOR, ) -def test_init_singlekey(mocker, m5stickv, tdata): +def test_init_singlesig(mocker, m5stickv, tdata): from krux.wallet import Wallet - wallet = Wallet(tdata.SINGLEKEY_KEY) + wallet = Wallet(tdata.SINGLESIG_KEY) assert isinstance(wallet, Wallet) - assert wallet.descriptor.to_string() == tdata.UNAMBIGUOUS_SINGLEKEY_DESCRIPTOR + assert wallet.descriptor.to_string() == tdata.UNAMBIGUOUS_SINGLESIG_DESCRIPTOR assert wallet.label == "Single-sig" assert wallet.policy == {"type": "p2wpkh"} @@ -220,7 +220,7 @@ def test_init_multisig(mocker, m5stickv, tdata): def test_is_multisig(mocker, m5stickv, tdata): from krux.wallet import Wallet - wallet = Wallet(tdata.SINGLEKEY_KEY) + wallet = Wallet(tdata.SINGLESIG_KEY) assert not wallet.is_multisig() @@ -232,7 +232,7 @@ def test_is_multisig(mocker, m5stickv, tdata): def test_is_loaded(mocker, m5stickv, tdata): from krux.wallet import Wallet - wallet = Wallet(tdata.SINGLEKEY_KEY) + wallet = Wallet(tdata.SINGLESIG_KEY) assert not wallet.is_loaded() @@ -265,8 +265,8 @@ def test_receive_addresses(mocker, m5stickv, tdata): cases = [ ( - tdata.SINGLEKEY_KEY, - tdata.SPECTER_SINGLEKEY_WALLET_DATA, + tdata.SINGLESIG_KEY, + tdata.SPECTER_SINGLESIG_WALLET_DATA, FORMAT_PMOFN, [ "bc1qrhjqrz2d9tdym3p2r9m2vwzn2sn2yl6k5m357y", @@ -396,24 +396,24 @@ def test_load_multisig(mocker, m5stickv, tdata): assert wallet.policy == case[4] -def test_load_singlekey(mocker, m5stickv, tdata): +def test_load_singlesig(mocker, m5stickv, tdata): from krux.wallet import Wallet from krux.qr import FORMAT_NONE, FORMAT_PMOFN - wallet = Wallet(tdata.SINGLEKEY_KEY) + wallet = Wallet(tdata.SINGLESIG_KEY) cases = [ ( - tdata.SPECTER_SINGLEKEY_WALLET_DATA, + tdata.SPECTER_SINGLESIG_WALLET_DATA, FORMAT_PMOFN, - tdata.SPECTER_SINGLEKEY_DESCRIPTOR, - "Specter Singlekey Wallet", + tdata.SPECTER_SINGLESIG_DESCRIPTOR, + "Specter Singlesig Wallet", {"type": "p2wpkh"}, ), ( - tdata.UNAMBIGUOUS_SINGLEKEY_DESCRIPTOR, + tdata.UNAMBIGUOUS_SINGLESIG_DESCRIPTOR, FORMAT_NONE, - tdata.UNAMBIGUOUS_SINGLEKEY_DESCRIPTOR, + tdata.UNAMBIGUOUS_SINGLESIG_DESCRIPTOR, "Single-sig", {"type": "p2wpkh"}, ), @@ -427,11 +427,11 @@ def test_load_singlekey(mocker, m5stickv, tdata): assert wallet.policy == case[4] -def test_load_singlekey_fails_with_multisig_descriptor(mocker, m5stickv, tdata): +def test_load_singlesig_fails_with_multisig_descriptor(mocker, m5stickv, tdata): from krux.wallet import Wallet from krux.qr import FORMAT_NONE, FORMAT_PMOFN, FORMAT_UR - wallet = Wallet(tdata.SINGLEKEY_KEY) + wallet = Wallet(tdata.SINGLESIG_KEY) cases = [ (tdata.SPECTER_MULTISIG_WALLET_DATA, FORMAT_PMOFN), @@ -445,29 +445,29 @@ def test_load_singlekey_fails_with_multisig_descriptor(mocker, m5stickv, tdata): wallet.load(case[0], case[1]) -def test_load_multisig_fails_with_singlekey_descriptor(mocker, m5stickv, tdata): +def test_load_multisig_fails_with_singlesig_descriptor(mocker, m5stickv, tdata): from krux.wallet import Wallet from krux.qr import FORMAT_NONE, FORMAT_PMOFN wallet = Wallet(tdata.MULTISIG_KEY1) cases = [ - (tdata.SPECTER_SINGLEKEY_WALLET_DATA, FORMAT_PMOFN), - (tdata.UNAMBIGUOUS_SINGLEKEY_DESCRIPTOR, FORMAT_NONE), + (tdata.SPECTER_SINGLESIG_WALLET_DATA, FORMAT_PMOFN), + (tdata.UNAMBIGUOUS_SINGLESIG_DESCRIPTOR, FORMAT_NONE), ] for case in cases: with pytest.raises(ValueError): wallet.load(case[0], case[1]) -def test_load_singlekey_fails_when_key_not_in_descriptor(mocker, m5stickv, tdata): +def test_load_singlesig_fails_when_key_not_in_descriptor(mocker, m5stickv, tdata): from krux.wallet import Wallet from krux.qr import FORMAT_NONE - wallet = Wallet(tdata.SINGLEKEY_KEY) + wallet = Wallet(tdata.SINGLESIG_KEY) with pytest.raises(ValueError): - wallet.load(tdata.UNRELATED_SINGLEKEY_DESCRIPTOR, FORMAT_NONE) + wallet.load(tdata.UNRELATED_SINGLESIG_DESCRIPTOR, FORMAT_NONE) def test_load_multisig_fails_when_key_not_in_descriptor(mocker, m5stickv, tdata): @@ -486,9 +486,9 @@ def test_parse_wallet(mocker, m5stickv, tdata): cases = [ ( - tdata.SPECTER_SINGLEKEY_WALLET_DATA, - tdata.SPECTER_SINGLEKEY_DESCRIPTOR, - "Specter Singlekey Wallet", + tdata.SPECTER_SINGLESIG_WALLET_DATA, + tdata.SPECTER_SINGLESIG_DESCRIPTOR, + "Specter Singlesig Wallet", ), ( tdata.SPECTER_MULTISIG_WALLET_DATA, @@ -496,8 +496,8 @@ def test_parse_wallet(mocker, m5stickv, tdata): "Specter Multisig Wallet", ), ( - tdata.BLUEWALLET_SINGLEKEY_WALLET_DATA, - tdata.BLUEWALLET_SINGLEKEY_DESCRIPTOR, + tdata.BLUEWALLET_SINGLESIG_WALLET_DATA, + tdata.BLUEWALLET_SINGLESIG_DESCRIPTOR, None, ), ( @@ -526,13 +526,13 @@ def test_parse_wallet(mocker, m5stickv, tdata): None, ), ( - tdata.AMBIGUOUS_SINGLEKEY_DESCRIPTOR, - tdata.AMBIGUOUS_SINGLEKEY_DESCRIPTOR, + tdata.AMBIGUOUS_SINGLESIG_DESCRIPTOR, + tdata.AMBIGUOUS_SINGLESIG_DESCRIPTOR, None, ), ( - tdata.UNAMBIGUOUS_SINGLEKEY_DESCRIPTOR, - tdata.UNAMBIGUOUS_SINGLEKEY_DESCRIPTOR, + tdata.UNAMBIGUOUS_SINGLESIG_DESCRIPTOR, + tdata.UNAMBIGUOUS_SINGLESIG_DESCRIPTOR, None, ), ] @@ -643,16 +643,16 @@ def test_to_unambiguous_descriptor(mocker, m5stickv, tdata): cases = [ ( - tdata.AMBIGUOUS_SINGLEKEY_DESCRIPTOR, - tdata.UNAMBIGUOUS_SINGLEKEY_DESCRIPTOR, + tdata.AMBIGUOUS_SINGLESIG_DESCRIPTOR, + tdata.UNAMBIGUOUS_SINGLESIG_DESCRIPTOR, ), ( tdata.AMBIGUOUS_MULTISIG_DESCRIPTOR, tdata.UNAMBIGUOUS_MULTISIG_DESCRIPTOR, ), ( - tdata.UNAMBIGUOUS_SINGLEKEY_DESCRIPTOR, - tdata.UNAMBIGUOUS_SINGLEKEY_DESCRIPTOR, + tdata.UNAMBIGUOUS_SINGLESIG_DESCRIPTOR, + tdata.UNAMBIGUOUS_SINGLESIG_DESCRIPTOR, ), ( tdata.UNAMBIGUOUS_MULTISIG_DESCRIPTOR, From 75485e3bfc5b0e5f2b9655057c63724ade166c28 Mon Sep 17 00:00:00 2001 From: tadeubas Date: Thu, 31 Aug 2023 19:07:58 -0300 Subject: [PATCH 2/2] bugfix plaintext_QR starting with letter p --- src/krux/qr.py | 11 +++++++---- tests/test_qr.py | 10 ++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/krux/qr.py b/src/krux/qr.py index 8d422fd2d..5e9934bd8 100644 --- a/src/krux/qr.py +++ b/src/krux/qr.py @@ -195,8 +195,11 @@ def parse_pmofn_qr_part(data): def detect_format(data): """Detects the QR format of the given data""" qr_format = FORMAT_NONE - if data.startswith("p") and data.index("of") <= 5: - qr_format = FORMAT_PMOFN - elif data.lower().startswith("ur:"): - qr_format = FORMAT_UR + try: + if data.startswith("p") and data.index("of") <= 5: + qr_format = FORMAT_PMOFN + elif data.lower().startswith("ur:"): + qr_format = FORMAT_UR + except: + pass return qr_format diff --git a/tests/test_qr.py b/tests/test_qr.py index b59eb592f..212aa4961 100644 --- a/tests/test_qr.py +++ b/tests/test_qr.py @@ -145,3 +145,13 @@ def test_to_qr_codes(mocker, m5stickv, tdata): break i += 1 assert len(codes) == expected_parts + + +def test_detect_plaintext_qr(mocker, m5stickv): + from krux.qr import detect_format + + PLAINTEXT_QR_DATA = ( + "process swim repair fit artist rebuild remove vanish city opinion hawk coconut" + ) + + detect_format(PLAINTEXT_QR_DATA)