From a6a57f0fec5cb4b2f3b238130de68b189730bc45 Mon Sep 17 00:00:00 2001 From: f321x Date: Wed, 28 Jan 2026 12:46:52 +0100 Subject: [PATCH] tests: add unittest for Abstract_Wallet.export_history_to_file Adds unittest for Abstract_Wallet.export_history_to_file that compares the output against reference files. This should help to prevent regressions and ensure the layout of the export stays static over time. --- tests/__init__.py | 6 +- tests/test_commands.py | 3 +- ...history_no_fx_client_4_5_2_9dk_with_ln.csv | 37 + ...istory_no_fx_client_4_5_2_9dk_with_ln.json | 794 +++++++++++++ ...story_with_fx_client_4_5_2_9dk_with_ln.csv | 37 + ...tory_with_fx_client_4_5_2_9dk_with_ln.json | 1019 +++++++++++++++++ tests/test_storage_upgrade.py | 3 +- tests/test_wallet.py | 62 +- 8 files changed, 1955 insertions(+), 6 deletions(-) create mode 100644 tests/test_history_export/history_no_fx_client_4_5_2_9dk_with_ln.csv create mode 100644 tests/test_history_export/history_no_fx_client_4_5_2_9dk_with_ln.json create mode 100644 tests/test_history_export/history_with_fx_client_4_5_2_9dk_with_ln.csv create mode 100644 tests/test_history_export/history_with_fx_client_4_5_2_9dk_with_ln.json diff --git a/tests/__init__.py b/tests/__init__.py index fec824018..0890fd0c5 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -35,9 +35,10 @@ electrum.util.AS_LIB_USER_I_WANT_TO_MANAGE_MY_OWN_ASYNCIO_LOOP = True class ElectrumTestCase(unittest.IsolatedAsyncioTestCase, Logger): """Base class for our unit tests.""" - TESTNET = False + TESTNET = False # there is also an @as_testnet decorator to run single tests in testnet mode REGTEST = False TEST_ANCHOR_CHANNELS = False + WALLET_FILES_DIR = os.path.join(os.path.dirname(__file__), "test_storage_upgrade") # maxDiff = None # for debugging # some unit tests are modifying globals... so we run sequentially: @@ -110,6 +111,9 @@ class ElectrumTestCase(unittest.IsolatedAsyncioTestCase, Logger): self._lnworkers_created.append(lnwallet) return lnwallet + def get_wallet_file_path(self, wallet_name: str) -> str: + return os.path.join(self.WALLET_FILES_DIR, wallet_name) + def as_testnet(func): """Function decorator to run a single unit test in testnet mode. diff --git a/tests/test_commands.py b/tests/test_commands.py index 1acf4c68d..eb6d634da 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -591,8 +591,7 @@ class TestCommandsTestnet(ElectrumTestCase): @mock.patch.object(storage.WalletStorage, 'append') async def test_onchain_history(self, *mock_args): cmds = Commands(config=self.config, daemon=self.daemon) - WALLET_FILES_DIR = os.path.join(os.path.dirname(__file__), "test_storage_upgrade") - wallet_path = os.path.join(WALLET_FILES_DIR, "client_3_3_8_xpub_with_realistic_history") + wallet_path = self.get_wallet_file_path("client_3_3_8_xpub_with_realistic_history") await cmds.load_wallet(wallet_path=wallet_path) expected_last_history_item = { diff --git a/tests/test_history_export/history_no_fx_client_4_5_2_9dk_with_ln.csv b/tests/test_history_export/history_no_fx_client_4_5_2_9dk_with_ln.csv new file mode 100644 index 000000000..def9bba05 --- /dev/null +++ b/tests/test_history_export/history_no_fx_client_4_5_2_9dk_with_ln.csv @@ -0,0 +1,37 @@ +oc_transaction_hash,ln_payment_hash,label,confirmations,amount_chain_bc,amount_lightning_bc,fiat_value,network_fee_bc,fiat_fee,timestamp +024464eae9858f079d2f49bc3db28f92237c63fe950c8ddc6c9b18d1855fa32c,,trans 3,1232719,0.1,0.,,0.,,2018-06-29 13:29:07 +0ef1c91636d20331acc2759d0f0335925cd899e270efdd2598e9449c66649d39,,dsadsa,1232632,-0.00201,0.,,0.00001,,2018-06-29 15:52:26 +03eb4932abf231999f5a698a28f70cfe6b1a2975be0310e348a9898434efb8d3,,Dsdhahuisad,1232611,-0.00201,0.,,0.00001,,2018-06-29 16:20:40 +7726939a1246c0b99c2f30cfa21504af5b458755231b2cdc1fa1e9af2d9d70ba,,,1165279,-0.01000705,0.,,0.00000705,,2018-09-25 19:51:12 +972d16040c71b6660b52a0ad06ddb17aa7097921643bab526ad2e00780004535,,,1165278,-0.01000705,0.,,0.00000705,,2018-09-25 20:01:37 +737857196825fa2e600bac822c866f10e5f484b0f193cff1fc3d38b91884c7a6,,,1165278,-0.01000705,0.,,0.00000705,,2018-09-25 20:01:37 +41284afa51eccc94d10fac25eaa59d1fa1afdc3e27bae2b16a64399fe0f1be3c,,some description here. much creativity,1165027,-0.00201,0.,,0.00001,,2018-09-28 18:00:40 +4dbdf2810f130653d1eb17ce3645d0362e4ef41ffbd521aad1f9294c95baf76e,,,1125041,-0.03190141,0.,,0.00000141,,2019-01-31 01:12:16 +30bc3855a6837562eb6dffbb3190e71279e2df2a04f2598780c9df7f290706e0,,,1124381,-0.00000141,0.,,0.00000141,,2019-02-02 18:37:00 +4029e471c030066ecca20621cc2917cade0fd44c5cbcb6f5299c086f25ec4b6c,,,1123808,0.14695224,0.,,0.,,2019-02-05 16:06:18 +b424362ec4eb39eb84f0bea8e00ffd8382d5dde29092bd1e268b9a027dc5225c,,,1122455,-0.00001202,0.,,0.00000202,,2019-02-14 18:27:57 +3407144b10e0c7f60a88e9f3adcc7e732c83e92fa17a923f523b8acc50718c2f,,,1011325,-0.17898625,0.,,0.00000246,,2019-07-09 18:53:36 +ba48bce5cde8a4eacb4f1273c462101c06305e82d6ee89a113cd6b068178651f,,old address 95645,996545,0.03099663,0.,,0.,,2019-10-15 16:02:48 +2042e1e197e0b21e83de0ee8a92abf5e1fea617cf143dc584a743df075bc6269,,,996545,0.00099811,0.,,0.,,2019-10-15 16:02:48 +b234c4f252cd193377bc6cf931ff1ef6a398e3a434e43b22cdb457a8213d749b,,,996545,-0.03199474,0.,,0.00000181,,2019-10-15 16:02:48 +25ddebe4b7e7caf7b175762ddc4cbb5d704f27520a997b7672057f2455b2fcea,,,803764,0.001,0.,,0.,,2020-07-07 17:45:49 +10a2a7695a5b6ba857b10d04ad047b968656c6d84b58ea226dc92c150cb73b2f,,,687142,-0.001,0.,,0.00000111,,2020-11-18 01:22:40 +efca2a86e0584d7e359e5bc9ac954c6ed7e5c136ad6d561cba662001221df23c,,,230215,0.0011,0.,,0.,,2022-10-04 21:28:03 +8c09f8984e231fcaebdda00b2597cfde3d825a26dad2c5478c78ccabbac1f28b,,,230212,0.0016,0.,,0.,,2022-10-04 22:15:06 +23b5490a6b9723a96f8d1170cf0ab8d2e961d775cff0151540400f2964ccbd7f,,,175482,0.00135,0.,,0.,,2022-11-04 16:27:49 +94fce9de7e82741cc982936ad9f7900372b80be8100cb80e49f5d78c2954fb69,,Open channel,173292,-0.00405,0.,,0.00000289,,2022-11-14 22:34:14 +d57bb7a379c7eb8c86e34d595722ca4f389394b4497c1f0028971e0a8e75c8e1,,,164304,0.00404573,0.,,0.00000138,,2023-01-08 11:32:47 +6ff55c62470cf51cbc577e8efac5028e06e41912a39356ba576ab7b4d7f708ce,,,164304,-0.00001097,0.,,0.00001097,,2023-01-08 11:32:47 +87dbf5a7a089f1e071559cdfd3e4bddb841cdd0032ffeec328952abf76fe3661,,asd,160828,-0.00100776,0.,,0.00000776,,2023-02-03 15:18:45 +97767fdefef3152319363b772914d71e5eb70e793b835c13dce20037d3ac13fe,,Open channel 2425096x21x1,154493,-0.003027,0.00302547,,0.00000153,,2023-03-19 20:01:43 +66f846809c2d45842f17e40fb6a696288c3274a66b0bf71107940f250978832e,,Close channel 2425096x21x1,51197,0.00302364,-0.00302547,,0.00000183,,2023-10-03 17:15:38 +03bec7a53ce7c856046f306738a14a976acff34f12a1e3f61f31fa4284486f7d,,fund me pls,7,0.005,0.,,0.,,2024-02-26 18:02:39 +c96b3ed60c8531e1370051662390defa07152cbc028855ea591fc444d8db4e38,,Open channel 2579583x479x2,6,-0.0040019,0.004,,0.0000019,,2024-02-26 18:11:55 +778b01899d5ed48df03e406bc5babd1fdc8f1be4b7e5b9d20dd8caf24dd66ff4,,Payment request for BitPay invoice W6ic1rU1XThEmLAEvwkjdX for merchant SomberNight_testing,5,-0.0000531,0.,,0.0000021,,2024-02-26 18:26:49 +59a9ff5fa62586f102b92504584f52e47f4ca0d5af061e99a0a3023fa70a70e2,,moar money,5,0.00654165,0.,,0.,,2024-02-26 18:26:49 +,9d166fea25720d207108cce24247f6c553ff5ed9ef83746b9400621456d84921,1 Blokaccino,,0.,-0.00001003,,0.00000003,,2024-02-26 18:59:55 +,a45b23f05e51f0ac22763ce1a3f028f30a5519f6779839fdd1df8fd037ffe75f,1 Blokaccino,,0.,-0.00001003,,0.00000003,,2024-02-26 19:00:18 +,0834354bb383e3fefba08314b62f1ec4b0bead90a2ea977652e12f8ae930efda,obiwan9847,,0.,-0.0005003,,0.0000003,,2024-02-26 19:34:02 +,720848b95f41736e6bdc838f4587e6205c417702353f3fd7d9b6b1ceb632e65b,hello there,,0.,-0.0001001,,0.0000001,,2024-02-26 19:34:33 +,cb869e44bcfe4f770fcba707788bd626956669989e7ea31981aef4674f78bff3,general kenobi,,0.,0.000001,,0.,,2024-02-26 19:35:15 +,6fe5489ea2303c6b5164590266df359130c4390e9bbeba73854a6a57e52f8b34,general kenobi 3,,0.,0.00000125,,0.,,2024-02-26 19:35:48 diff --git a/tests/test_history_export/history_no_fx_client_4_5_2_9dk_with_ln.json b/tests/test_history_export/history_no_fx_client_4_5_2_9dk_with_ln.json new file mode 100644 index 000000000..80fbed494 --- /dev/null +++ b/tests/test_history_export/history_no_fx_client_4_5_2_9dk_with_ln.json @@ -0,0 +1,794 @@ +{ + "024464eae9858f079d2f49bc3db28f92237c63fe950c8ddc6c9b18d1855fa32c": { + "amount_sat": 10000000, + "bc_balance": "0.1", + "bc_value": "0.1", + "confirmations": 1232719, + "date": "2018-06-29 13:29", + "fee_sat": null, + "group_id": null, + "height": 1346870, + "incoming": true, + "label": "trans 3", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1530271747, + "timestamp": 1530271747, + "txid": "024464eae9858f079d2f49bc3db28f92237c63fe950c8ddc6c9b18d1855fa32c", + "txpos_in_block": 11, + "value": "0.1", + "wanted_height": null + }, + "03bec7a53ce7c856046f306738a14a976acff34f12a1e3f61f31fa4284486f7d": { + "amount_sat": 500000, + "bc_balance": "0.00802364", + "bc_value": "0.005", + "confirmations": 7, + "date": "2024-02-26 18:02", + "fee_sat": null, + "group_id": null, + "height": 2579582, + "incoming": true, + "label": "fund me pls", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1708966959, + "timestamp": 1708966959, + "txid": "03bec7a53ce7c856046f306738a14a976acff34f12a1e3f61f31fa4284486f7d", + "txpos_in_block": 675, + "value": "0.005", + "wanted_height": null + }, + "03eb4932abf231999f5a698a28f70cfe6b1a2975be0310e348a9898434efb8d3": { + "amount_sat": -201000, + "bc_balance": "0.09598", + "bc_value": "-0.00201", + "confirmations": 1232611, + "date": "2018-06-29 16:20", + "fee_sat": 1000, + "group_id": null, + "height": 1346978, + "incoming": false, + "label": "Dsdhahuisad", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1530282040, + "timestamp": 1530282040, + "txid": "03eb4932abf231999f5a698a28f70cfe6b1a2975be0310e348a9898434efb8d3", + "txpos_in_block": 3, + "value": "-0.00201", + "wanted_height": null + }, + "0834354bb383e3fefba08314b62f1ec4b0bead90a2ea977652e12f8ae930efda": { + "amount_msat": -50030000, + "bc_value": "0.", + "date": "2024-02-26 19:34", + "direction": 0, + "fee_msat": 30000, + "group_id": null, + "label": "obiwan9847", + "lightning": true, + "ln_value": "-0.0005003", + "payment_hash": "0834354bb383e3fefba08314b62f1ec4b0bead90a2ea977652e12f8ae930efda", + "preimage": "1b16da388f5d62648825a5022e72a27ec6e5b2242fb37adf8260306c5e544f3c", + "timestamp": 1708972442, + "type": "payment", + "value": "-0.0005003" + }, + "0ef1c91636d20331acc2759d0f0335925cd899e270efdd2598e9449c66649d39": { + "amount_sat": -201000, + "bc_balance": "0.09799", + "bc_value": "-0.00201", + "confirmations": 1232632, + "date": "2018-06-29 15:52", + "fee_sat": 1000, + "group_id": null, + "height": 1346957, + "incoming": false, + "label": "dsadsa", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1530280346, + "timestamp": 1530280346, + "txid": "0ef1c91636d20331acc2759d0f0335925cd899e270efdd2598e9449c66649d39", + "txpos_in_block": 10, + "value": "-0.00201", + "wanted_height": null + }, + "10a2a7695a5b6ba857b10d04ad047b968656c6d84b58ea226dc92c150cb73b2f": { + "amount_sat": -100000, + "bc_balance": "0.", + "bc_value": "-0.001", + "confirmations": 687142, + "date": "2020-11-18 01:22", + "fee_sat": 111, + "group_id": null, + "height": 1892447, + "incoming": false, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1605658960, + "timestamp": 1605658960, + "txid": "10a2a7695a5b6ba857b10d04ad047b968656c6d84b58ea226dc92c150cb73b2f", + "txpos_in_block": 42, + "value": "-0.001", + "wanted_height": null + }, + "2042e1e197e0b21e83de0ee8a92abf5e1fea617cf143dc584a743df075bc6269": { + "amount_sat": 99811, + "bc_balance": "0.03199474", + "bc_value": "0.00099811", + "confirmations": 996545, + "date": "2019-10-15 16:02", + "fee_sat": null, + "group_id": null, + "height": 1583044, + "incoming": true, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1571148168, + "timestamp": 1571148168, + "txid": "2042e1e197e0b21e83de0ee8a92abf5e1fea617cf143dc584a743df075bc6269", + "txpos_in_block": 273, + "value": "0.00099811", + "wanted_height": null + }, + "23b5490a6b9723a96f8d1170cf0ab8d2e961d775cff0151540400f2964ccbd7f": { + "amount_sat": 135000, + "bc_balance": "0.00405", + "bc_value": "0.00135", + "confirmations": 175482, + "date": "2022-11-04 16:27", + "fee_sat": null, + "group_id": null, + "height": 2404107, + "incoming": true, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1667575669, + "timestamp": 1667575669, + "txid": "23b5490a6b9723a96f8d1170cf0ab8d2e961d775cff0151540400f2964ccbd7f", + "txpos_in_block": 18, + "value": "0.00135", + "wanted_height": null + }, + "25ddebe4b7e7caf7b175762ddc4cbb5d704f27520a997b7672057f2455b2fcea": { + "amount_sat": 100000, + "bc_balance": "0.001", + "bc_value": "0.001", + "confirmations": 803764, + "date": "2020-07-07 17:45", + "fee_sat": null, + "group_id": null, + "height": 1775825, + "incoming": true, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1594136749, + "timestamp": 1594136749, + "txid": "25ddebe4b7e7caf7b175762ddc4cbb5d704f27520a997b7672057f2455b2fcea", + "txpos_in_block": 81, + "value": "0.001", + "wanted_height": null + }, + "30bc3855a6837562eb6dffbb3190e71279e2df2a04f2598780c9df7f290706e0": { + "amount_sat": -141, + "bc_balance": "0.03204603", + "bc_value": "-0.00000141", + "confirmations": 1124381, + "date": "2019-02-02 18:37", + "fee_sat": 141, + "group_id": null, + "height": 1455208, + "incoming": false, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1549129020, + "timestamp": 1549129020, + "txid": "30bc3855a6837562eb6dffbb3190e71279e2df2a04f2598780c9df7f290706e0", + "txpos_in_block": 23, + "value": "-0.00000141", + "wanted_height": null + }, + "3407144b10e0c7f60a88e9f3adcc7e732c83e92fa17a923f523b8acc50718c2f": { + "amount_sat": -17898625, + "bc_balance": "0.", + "bc_value": "-0.17898625", + "confirmations": 1011325, + "date": "2019-07-09 18:53", + "fee_sat": 246, + "group_id": null, + "height": 1568264, + "incoming": false, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1562691216, + "timestamp": 1562691216, + "txid": "3407144b10e0c7f60a88e9f3adcc7e732c83e92fa17a923f523b8acc50718c2f", + "txpos_in_block": 85, + "value": "-0.17898625", + "wanted_height": null + }, + "4029e471c030066ecca20621cc2917cade0fd44c5cbcb6f5299c086f25ec4b6c": { + "amount_sat": 14695224, + "bc_balance": "0.17899827", + "bc_value": "0.14695224", + "confirmations": 1123808, + "date": "2019-02-05 16:06", + "fee_sat": null, + "group_id": null, + "height": 1455781, + "incoming": true, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1549379178, + "timestamp": 1549379178, + "txid": "4029e471c030066ecca20621cc2917cade0fd44c5cbcb6f5299c086f25ec4b6c", + "txpos_in_block": 61, + "value": "0.14695224", + "wanted_height": null + }, + "41284afa51eccc94d10fac25eaa59d1fa1afdc3e27bae2b16a64399fe0f1be3c": { + "amount_sat": -201000, + "bc_balance": "0.06394885", + "bc_value": "-0.00201", + "confirmations": 1165027, + "date": "2018-09-28 18:00", + "fee_sat": 1000, + "group_id": null, + "height": 1414562, + "incoming": false, + "label": "some description here. much creativity", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1538150440, + "timestamp": 1538150440, + "txid": "41284afa51eccc94d10fac25eaa59d1fa1afdc3e27bae2b16a64399fe0f1be3c", + "txpos_in_block": 81, + "value": "-0.00201", + "wanted_height": null + }, + "4dbdf2810f130653d1eb17ce3645d0362e4ef41ffbd521aad1f9294c95baf76e": { + "amount_sat": -3190141, + "bc_balance": "0.03204744", + "bc_value": "-0.03190141", + "confirmations": 1125041, + "date": "2019-01-31 01:12", + "fee_sat": 141, + "group_id": null, + "height": 1454548, + "incoming": false, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1548893536, + "timestamp": 1548893536, + "txid": "4dbdf2810f130653d1eb17ce3645d0362e4ef41ffbd521aad1f9294c95baf76e", + "txpos_in_block": 44, + "value": "-0.03190141", + "wanted_height": null + }, + "59a9ff5fa62586f102b92504584f52e47f4ca0d5af061e99a0a3023fa70a70e2": { + "amount_sat": 654165, + "bc_balance": "0.01051029", + "bc_value": "0.00654165", + "confirmations": 5, + "date": "2024-02-26 18:26", + "fee_sat": null, + "group_id": null, + "height": 2579584, + "incoming": true, + "label": "moar money", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1708968409, + "timestamp": 1708968409, + "txid": "59a9ff5fa62586f102b92504584f52e47f4ca0d5af061e99a0a3023fa70a70e2", + "txpos_in_block": 1814, + "value": "0.00654165", + "wanted_height": null + }, + "6fe5489ea2303c6b5164590266df359130c4390e9bbeba73854a6a57e52f8b34": { + "amount_msat": 125000, + "bc_value": "0.", + "date": "2024-02-26 19:35", + "direction": 1, + "fee_msat": null, + "group_id": null, + "label": "general kenobi 3", + "lightning": true, + "ln_value": "0.00000125", + "payment_hash": "6fe5489ea2303c6b5164590266df359130c4390e9bbeba73854a6a57e52f8b34", + "preimage": "d6e4067da77dd810c6b0465a54e0557238b1b317c7b2a6ac679429780ad56f43", + "timestamp": 1708972548, + "type": "payment", + "value": "0.00000125" + }, + "6ff55c62470cf51cbc577e8efac5028e06e41912a39356ba576ab7b4d7f708ce": { + "amount_sat": -1097, + "bc_balance": "0.00403476", + "bc_value": "-0.00001097", + "confirmations": 164304, + "date": "2023-01-08 11:32", + "fee_sat": 1097, + "group_id": null, + "height": 2415285, + "incoming": false, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1673173967, + "timestamp": 1673173967, + "txid": "6ff55c62470cf51cbc577e8efac5028e06e41912a39356ba576ab7b4d7f708ce", + "txpos_in_block": 17, + "value": "-0.00001097", + "wanted_height": null + }, + "720848b95f41736e6bdc838f4587e6205c417702353f3fd7d9b6b1ceb632e65b": { + "amount_msat": -10010000, + "bc_value": "0.", + "date": "2024-02-26 19:34", + "direction": 0, + "fee_msat": 10000, + "group_id": null, + "label": "hello there", + "lightning": true, + "ln_value": "-0.0001001", + "payment_hash": "720848b95f41736e6bdc838f4587e6205c417702353f3fd7d9b6b1ceb632e65b", + "preimage": "31a84f775c07316ad0cf3b894cf37bb2420b3f4d69a41794df2a4cf29c91e0a9", + "timestamp": 1708972473, + "type": "payment", + "value": "-0.0001001" + }, + "737857196825fa2e600bac822c866f10e5f484b0f193cff1fc3d38b91884c7a6": { + "amount_sat": -1000705, + "bc_balance": "0.06595885", + "bc_value": "-0.01000705", + "confirmations": 1165278, + "date": "2018-09-25 20:01", + "fee_sat": 705, + "group_id": null, + "height": 1414311, + "incoming": false, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1537898497, + "timestamp": 1537898497, + "txid": "737857196825fa2e600bac822c866f10e5f484b0f193cff1fc3d38b91884c7a6", + "txpos_in_block": 45, + "value": "-0.01000705", + "wanted_height": null + }, + "7726939a1246c0b99c2f30cfa21504af5b458755231b2cdc1fa1e9af2d9d70ba": { + "amount_sat": -1000705, + "bc_balance": "0.08597295", + "bc_value": "-0.01000705", + "confirmations": 1165279, + "date": "2018-09-25 19:51", + "fee_sat": 705, + "group_id": null, + "height": 1414310, + "incoming": false, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1537897872, + "timestamp": 1537897872, + "txid": "7726939a1246c0b99c2f30cfa21504af5b458755231b2cdc1fa1e9af2d9d70ba", + "txpos_in_block": 48, + "value": "-0.01000705", + "wanted_height": null + }, + "778b01899d5ed48df03e406bc5babd1fdc8f1be4b7e5b9d20dd8caf24dd66ff4": { + "amount_sat": -5310, + "bc_balance": "0.00396864", + "bc_value": "-0.0000531", + "confirmations": 5, + "date": "2024-02-26 18:26", + "fee_sat": 210, + "group_id": null, + "height": 2579584, + "incoming": false, + "label": "Payment request for BitPay invoice W6ic1rU1XThEmLAEvwkjdX for merchant SomberNight_testing", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1708968409, + "timestamp": 1708968409, + "txid": "778b01899d5ed48df03e406bc5babd1fdc8f1be4b7e5b9d20dd8caf24dd66ff4", + "txpos_in_block": 284, + "value": "-0.0000531", + "wanted_height": null + }, + "87dbf5a7a089f1e071559cdfd3e4bddb841cdd0032ffeec328952abf76fe3661": { + "amount_sat": -100776, + "bc_balance": "0.003027", + "bc_value": "-0.00100776", + "confirmations": 160828, + "date": "2023-02-03 15:18", + "fee_sat": 776, + "group_id": null, + "height": 2418761, + "incoming": false, + "label": "asd", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1675433925, + "timestamp": 1675433925, + "txid": "87dbf5a7a089f1e071559cdfd3e4bddb841cdd0032ffeec328952abf76fe3661", + "txpos_in_block": 56, + "value": "-0.00100776", + "wanted_height": null + }, + "8c09f8984e231fcaebdda00b2597cfde3d825a26dad2c5478c78ccabbac1f28b": { + "amount_sat": 160000, + "bc_balance": "0.0027", + "bc_value": "0.0016", + "confirmations": 230212, + "date": "2022-10-04 22:15", + "fee_sat": null, + "group_id": null, + "height": 2349377, + "incoming": true, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1664914506, + "timestamp": 1664914506, + "txid": "8c09f8984e231fcaebdda00b2597cfde3d825a26dad2c5478c78ccabbac1f28b", + "txpos_in_block": 58, + "value": "0.0016", + "wanted_height": null + }, + "94fce9de7e82741cc982936ad9f7900372b80be8100cb80e49f5d78c2954fb69": { + "amount_sat": -405000, + "bc_balance": "0.", + "bc_value": "-0.00405", + "confirmations": 173292, + "date": "2022-11-14 22:34", + "fee_sat": 289, + "group_id": null, + "height": 2406297, + "incoming": false, + "label": "Open channel", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1668461654, + "timestamp": 1668461654, + "txid": "94fce9de7e82741cc982936ad9f7900372b80be8100cb80e49f5d78c2954fb69", + "txpos_in_block": 24, + "value": "-0.00405", + "wanted_height": null + }, + "972d16040c71b6660b52a0ad06ddb17aa7097921643bab526ad2e00780004535": { + "amount_sat": -1000705, + "bc_balance": "0.0759659", + "bc_value": "-0.01000705", + "confirmations": 1165278, + "date": "2018-09-25 20:01", + "fee_sat": 705, + "group_id": null, + "height": 1414311, + "incoming": false, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1537898497, + "timestamp": 1537898497, + "txid": "972d16040c71b6660b52a0ad06ddb17aa7097921643bab526ad2e00780004535", + "txpos_in_block": 44, + "value": "-0.01000705", + "wanted_height": null + }, + "9d166fea25720d207108cce24247f6c553ff5ed9ef83746b9400621456d84921": { + "amount_msat": -1003100, + "bc_value": "0.", + "date": "2024-02-26 18:59", + "direction": 0, + "fee_msat": 3100, + "group_id": null, + "label": "1 Blokaccino", + "lightning": true, + "ln_value": "-0.00001003", + "payment_hash": "9d166fea25720d207108cce24247f6c553ff5ed9ef83746b9400621456d84921", + "preimage": "4dd0ddf9605e51998936d101b7741e89be08cb788c1e36b9b1d62cd5e9543af8", + "timestamp": 1708970395, + "type": "payment", + "value": "-0.00001003" + }, + "a45b23f05e51f0ac22763ce1a3f028f30a5519f6779839fdd1df8fd037ffe75f": { + "amount_msat": -1003100, + "bc_value": "0.", + "date": "2024-02-26 19:00", + "direction": 0, + "fee_msat": 3100, + "group_id": null, + "label": "1 Blokaccino", + "lightning": true, + "ln_value": "-0.00001003", + "payment_hash": "a45b23f05e51f0ac22763ce1a3f028f30a5519f6779839fdd1df8fd037ffe75f", + "preimage": "48f81553d41291c78f5a09f21cc95eef11dd798e7abfd23fb1f1cb9eb8bf8359", + "timestamp": 1708970418, + "type": "payment", + "value": "-0.00001003" + }, + "b234c4f252cd193377bc6cf931ff1ef6a398e3a434e43b22cdb457a8213d749b": { + "amount_sat": -3199474, + "bc_balance": "0.", + "bc_value": "-0.03199474", + "confirmations": 996545, + "date": "2019-10-15 16:02", + "fee_sat": 181, + "group_id": null, + "height": 1583044, + "incoming": false, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1571148168, + "timestamp": 1571148168, + "txid": "b234c4f252cd193377bc6cf931ff1ef6a398e3a434e43b22cdb457a8213d749b", + "txpos_in_block": 286, + "value": "-0.03199474", + "wanted_height": null + }, + "b424362ec4eb39eb84f0bea8e00ffd8382d5dde29092bd1e268b9a027dc5225c": { + "amount_sat": -1202, + "bc_balance": "0.17898625", + "bc_value": "-0.00001202", + "confirmations": 1122455, + "date": "2019-02-14 18:27", + "fee_sat": 202, + "group_id": null, + "height": 1457134, + "incoming": false, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1550165277, + "timestamp": 1550165277, + "txid": "b424362ec4eb39eb84f0bea8e00ffd8382d5dde29092bd1e268b9a027dc5225c", + "txpos_in_block": 52, + "value": "-0.00001202", + "wanted_height": null + }, + "ba48bce5cde8a4eacb4f1273c462101c06305e82d6ee89a113cd6b068178651f": { + "amount_sat": 3099663, + "bc_balance": "0.03099663", + "bc_value": "0.03099663", + "confirmations": 996545, + "date": "2019-10-15 16:02", + "fee_sat": null, + "group_id": null, + "height": 1583044, + "incoming": true, + "label": "old address 95645", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1571148168, + "timestamp": 1571148168, + "txid": "ba48bce5cde8a4eacb4f1273c462101c06305e82d6ee89a113cd6b068178651f", + "txpos_in_block": 191, + "value": "0.03099663", + "wanted_height": null + }, + "cb869e44bcfe4f770fcba707788bd626956669989e7ea31981aef4674f78bff3": { + "amount_msat": 100000, + "bc_value": "0.", + "date": "2024-02-26 19:35", + "direction": 1, + "fee_msat": null, + "group_id": null, + "label": "general kenobi", + "lightning": true, + "ln_value": "0.000001", + "payment_hash": "cb869e44bcfe4f770fcba707788bd626956669989e7ea31981aef4674f78bff3", + "preimage": "ee4f549b3844282ae596dfef14fc75e64067517fa92e9735fe792415bced3db9", + "timestamp": 1708972515, + "type": "payment", + "value": "0.000001" + }, + "d57bb7a379c7eb8c86e34d595722ca4f389394b4497c1f0028971e0a8e75c8e1": { + "amount_sat": 404573, + "bc_balance": "0.00404573", + "bc_value": "0.00404573", + "confirmations": 164304, + "date": "2023-01-08 11:32", + "fee_sat": 138, + "group_id": null, + "height": 2415285, + "incoming": true, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1673173967, + "timestamp": 1673173967, + "txid": "d57bb7a379c7eb8c86e34d595722ca4f389394b4497c1f0028971e0a8e75c8e1", + "txpos_in_block": 16, + "value": "0.00404573", + "wanted_height": null + }, + "efca2a86e0584d7e359e5bc9ac954c6ed7e5c136ad6d561cba662001221df23c": { + "amount_sat": 110000, + "bc_balance": "0.0011", + "bc_value": "0.0011", + "confirmations": 230215, + "date": "2022-10-04 21:28", + "fee_sat": null, + "group_id": null, + "height": 2349374, + "incoming": true, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1664911683, + "timestamp": 1664911683, + "txid": "efca2a86e0584d7e359e5bc9ac954c6ed7e5c136ad6d561cba662001221df23c", + "txpos_in_block": 13, + "value": "0.0011", + "wanted_height": null + }, + "group:66f846809c2d45842f17e40fb6a696288c3274a66b0bf71107940f250978832e": { + "bc_value": "0.00302364", + "children": [ + { + "amount_sat": 302364, + "bc_balance": "0.00302364", + "bc_value": "0.00302364", + "confirmations": 51197, + "date": "2023-10-03 17:15", + "fee_sat": 183, + "group_id": "66f846809c2d45842f17e40fb6a696288c3274a66b0bf71107940f250978832e", + "height": 2528392, + "incoming": true, + "label": "Close channel 2425096x21x1", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1696346138, + "timestamp": 1696346138, + "txid": "66f846809c2d45842f17e40fb6a696288c3274a66b0bf71107940f250978832e", + "txpos_in_block": 155, + "value": "0.00302364", + "wanted_height": null + }, + { + "amount_msat": -302547000, + "bc_value": "0.", + "date": "2023-10-03 17:15", + "direction": null, + "fee_msat": null, + "group_id": "66f846809c2d45842f17e40fb6a696288c3274a66b0bf71107940f250978832e", + "label": "Close channel 2425096x21x1", + "lightning": true, + "ln_value": "-0.00302547", + "payment_hash": null, + "preimage": null, + "timestamp": 1696346138, + "type": "channel_closing", + "value": "-0.00302547" + } + ], + "confirmations": 51197, + "date": "2023-10-03 17:15", + "fee_sat": 0, + "height": 2528392, + "label": "Close channel 2425096x21x1", + "lightning": false, + "ln_value": "-0.00302547", + "timestamp": 1696346138, + "txid": "66f846809c2d45842f17e40fb6a696288c3274a66b0bf71107940f250978832e", + "value": "-0.00000183", + "wanted_height": null + }, + "group:97767fdefef3152319363b772914d71e5eb70e793b835c13dce20037d3ac13fe": { + "bc_value": "-0.003027", + "children": [ + { + "amount_sat": -302700, + "bc_balance": "0.", + "bc_value": "-0.003027", + "confirmations": 154493, + "date": "2023-03-19 20:01", + "fee_sat": 153, + "group_id": "97767fdefef3152319363b772914d71e5eb70e793b835c13dce20037d3ac13fe", + "height": 2425096, + "incoming": false, + "label": "Open channel", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1679252503, + "timestamp": 1679252503, + "txid": "97767fdefef3152319363b772914d71e5eb70e793b835c13dce20037d3ac13fe", + "txpos_in_block": 21, + "value": "-0.003027", + "wanted_height": null + }, + { + "amount_msat": 302547000, + "bc_value": "0.", + "date": "2023-03-19 20:01", + "direction": null, + "fee_msat": null, + "group_id": "97767fdefef3152319363b772914d71e5eb70e793b835c13dce20037d3ac13fe", + "label": "Open channel 2425096x21x1", + "lightning": true, + "ln_value": "0.00302547", + "payment_hash": null, + "preimage": null, + "timestamp": 1679252503, + "type": "channel_opening", + "value": "0.00302547" + } + ], + "confirmations": 154493, + "date": "2023-03-19 20:01", + "fee_sat": 0, + "height": 2425096, + "label": "Open channel 2425096x21x1", + "lightning": false, + "ln_value": "0.00302547", + "timestamp": 1679252503, + "txid": "97767fdefef3152319363b772914d71e5eb70e793b835c13dce20037d3ac13fe", + "value": "-0.00000153", + "wanted_height": null + }, + "group:c96b3ed60c8531e1370051662390defa07152cbc028855ea591fc444d8db4e38": { + "bc_value": "-0.0040019", + "children": [ + { + "amount_sat": -400190, + "bc_balance": "0.00402174", + "bc_value": "-0.0040019", + "confirmations": 6, + "date": "2024-02-26 18:11", + "fee_sat": 190, + "group_id": "c96b3ed60c8531e1370051662390defa07152cbc028855ea591fc444d8db4e38", + "height": 2579583, + "incoming": false, + "label": "Open channel", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1708967515, + "timestamp": 1708967515, + "txid": "c96b3ed60c8531e1370051662390defa07152cbc028855ea591fc444d8db4e38", + "txpos_in_block": 479, + "value": "-0.0040019", + "wanted_height": null + }, + { + "amount_msat": 400000000, + "bc_value": "0.", + "date": "2024-02-26 18:11", + "direction": null, + "fee_msat": null, + "group_id": "c96b3ed60c8531e1370051662390defa07152cbc028855ea591fc444d8db4e38", + "label": "Open channel 2579583x479x2", + "lightning": true, + "ln_value": "0.004", + "payment_hash": null, + "preimage": null, + "timestamp": 1708967515, + "type": "channel_opening", + "value": "0.004" + } + ], + "confirmations": 6, + "date": "2024-02-26 18:11", + "fee_sat": 0, + "height": 2579583, + "label": "Open channel 2579583x479x2", + "lightning": false, + "ln_value": "0.004", + "timestamp": 1708967515, + "txid": "c96b3ed60c8531e1370051662390defa07152cbc028855ea591fc444d8db4e38", + "value": "-0.0000019", + "wanted_height": null + } +} \ No newline at end of file diff --git a/tests/test_history_export/history_with_fx_client_4_5_2_9dk_with_ln.csv b/tests/test_history_export/history_with_fx_client_4_5_2_9dk_with_ln.csv new file mode 100644 index 000000000..8ce9564af --- /dev/null +++ b/tests/test_history_export/history_with_fx_client_4_5_2_9dk_with_ln.csv @@ -0,0 +1,37 @@ +oc_transaction_hash,ln_payment_hash,label,confirmations,amount_chain_bc,amount_lightning_bc,fiat_value,network_fee_bc,fiat_fee,timestamp +024464eae9858f079d2f49bc3db28f92237c63fe950c8ddc6c9b18d1855fa32c,,trans 3,1232719,0.1,0.,531.46,0.,0.00,2018-06-29 13:29:07 +0ef1c91636d20331acc2759d0f0335925cd899e270efdd2598e9449c66649d39,,dsadsa,1232632,-0.00201,0.,-10.68,0.00001,0.05,2018-06-29 15:52:26 +03eb4932abf231999f5a698a28f70cfe6b1a2975be0310e348a9898434efb8d3,,Dsdhahuisad,1232611,-0.00201,0.,-10.68,0.00001,0.05,2018-06-29 16:20:40 +7726939a1246c0b99c2f30cfa21504af5b458755231b2cdc1fa1e9af2d9d70ba,,,1165279,-0.01000705,0.,-54.80,0.00000705,0.04,2018-09-25 19:51:12 +972d16040c71b6660b52a0ad06ddb17aa7097921643bab526ad2e00780004535,,,1165278,-0.01000705,0.,-54.80,0.00000705,0.04,2018-09-25 20:01:37 +737857196825fa2e600bac822c866f10e5f484b0f193cff1fc3d38b91884c7a6,,,1165278,-0.01000705,0.,-54.80,0.00000705,0.04,2018-09-25 20:01:37 +41284afa51eccc94d10fac25eaa59d1fa1afdc3e27bae2b16a64399fe0f1be3c,,some description here. much creativity,1165027,-0.00201,0.,-11.48,0.00001,0.06,2018-09-28 18:00:40 +4dbdf2810f130653d1eb17ce3645d0362e4ef41ffbd521aad1f9294c95baf76e,,,1125041,-0.03190141,0.,-97.59,0.00000141,0.00,2019-01-31 01:12:16 +30bc3855a6837562eb6dffbb3190e71279e2df2a04f2598780c9df7f290706e0,,,1124381,-0.00000141,0.,-0.00,0.00000141,0.00,2019-02-02 18:37:00 +4029e471c030066ecca20621cc2917cade0fd44c5cbcb6f5299c086f25ec4b6c,,,1123808,0.14695224,0.,452.27,0.,0.00,2019-02-05 16:06:18 +b424362ec4eb39eb84f0bea8e00ffd8382d5dde29092bd1e268b9a027dc5225c,,,1122455,-0.00001202,0.,-0.04,0.00000202,0.01,2019-02-14 18:27:57 +3407144b10e0c7f60a88e9f3adcc7e732c83e92fa17a923f523b8acc50718c2f,,,1011325,-0.17898625,0.,-2006.08,0.00000246,0.03,2019-07-09 18:53:36 +ba48bce5cde8a4eacb4f1273c462101c06305e82d6ee89a113cd6b068178651f,,old address 95645,996545,0.03099663,0.,230.19,0.,0.00,2019-10-15 16:02:48 +2042e1e197e0b21e83de0ee8a92abf5e1fea617cf143dc584a743df075bc6269,,,996545,0.00099811,0.,7.41,0.,0.00,2019-10-15 16:02:48 +b234c4f252cd193377bc6cf931ff1ef6a398e3a434e43b22cdb457a8213d749b,,,996545,-0.03199474,0.,-237.60,0.00000181,0.01,2019-10-15 16:02:48 +25ddebe4b7e7caf7b175762ddc4cbb5d704f27520a997b7672057f2455b2fcea,,,803764,0.001,0.,8.22,0.,0.00,2020-07-07 17:45:49 +10a2a7695a5b6ba857b10d04ad047b968656c6d84b58ea226dc92c150cb73b2f,,,687142,-0.001,0.,-15.00,0.00000111,0.02,2020-11-18 01:22:40 +efca2a86e0584d7e359e5bc9ac954c6ed7e5c136ad6d561cba662001221df23c,,,230215,0.0011,0.,22.42,0.,0.00,2022-10-04 21:28:03 +8c09f8984e231fcaebdda00b2597cfde3d825a26dad2c5478c78ccabbac1f28b,,,230212,0.0016,0.,32.61,0.,0.00,2022-10-04 22:15:06 +23b5490a6b9723a96f8d1170cf0ab8d2e961d775cff0151540400f2964ccbd7f,,,175482,0.00135,0.,28.65,0.,0.00,2022-11-04 16:27:49 +94fce9de7e82741cc982936ad9f7900372b80be8100cb80e49f5d78c2954fb69,,Open channel,173292,-0.00405,0.,-65.11,0.00000289,0.05,2022-11-14 22:34:14 +d57bb7a379c7eb8c86e34d595722ca4f389394b4497c1f0028971e0a8e75c8e1,,,164304,0.00404573,0.,65.01,0.00000138,0.02,2023-01-08 11:32:47 +6ff55c62470cf51cbc577e8efac5028e06e41912a39356ba576ab7b4d7f708ce,,,164304,-0.00001097,0.,-0.18,0.00001097,0.18,2023-01-08 11:32:47 +87dbf5a7a089f1e071559cdfd3e4bddb841cdd0032ffeec328952abf76fe3661,,asd,160828,-0.00100776,0.,-21.87,0.00000776,0.17,2023-02-03 15:18:45 +97767fdefef3152319363b772914d71e5eb70e793b835c13dce20037d3ac13fe,,Open channel 2425096x21x1,154493,-0.003027,0.00302547,-0.04,0.00000153,0.04,2023-03-19 20:01:43 +66f846809c2d45842f17e40fb6a696288c3274a66b0bf71107940f250978832e,,Close channel 2425096x21x1,51197,0.00302364,-0.00302547,-0.05,0.00000183,0.05,2023-10-03 17:15:38 +03bec7a53ce7c856046f306738a14a976acff34f12a1e3f61f31fa4284486f7d,,fund me pls,7,0.005,0.,251.36,0.,0.00,2024-02-26 18:02:39 +c96b3ed60c8531e1370051662390defa07152cbc028855ea591fc444d8db4e38,,Open channel 2579583x479x2,6,-0.0040019,0.004,-0.10,0.0000019,0.10,2024-02-26 18:11:55 +778b01899d5ed48df03e406bc5babd1fdc8f1be4b7e5b9d20dd8caf24dd66ff4,,Payment request for BitPay invoice W6ic1rU1XThEmLAEvwkjdX for merchant SomberNight_testing,5,-0.0000531,0.,-2.67,0.0000021,0.11,2024-02-26 18:26:49 +59a9ff5fa62586f102b92504584f52e47f4ca0d5af061e99a0a3023fa70a70e2,,moar money,5,0.00654165,0.,328.87,0.,0.00,2024-02-26 18:26:49 +,9d166fea25720d207108cce24247f6c553ff5ed9ef83746b9400621456d84921,1 Blokaccino,,0.,-0.00001003,-0.50,0.00000003,0.00,2024-02-26 18:59:55 +,a45b23f05e51f0ac22763ce1a3f028f30a5519f6779839fdd1df8fd037ffe75f,1 Blokaccino,,0.,-0.00001003,-0.50,0.00000003,0.00,2024-02-26 19:00:18 +,0834354bb383e3fefba08314b62f1ec4b0bead90a2ea977652e12f8ae930efda,obiwan9847,,0.,-0.0005003,-25.15,0.0000003,0.00,2024-02-26 19:34:02 +,720848b95f41736e6bdc838f4587e6205c417702353f3fd7d9b6b1ceb632e65b,hello there,,0.,-0.0001001,-5.03,0.0000001,0.00,2024-02-26 19:34:33 +,cb869e44bcfe4f770fcba707788bd626956669989e7ea31981aef4674f78bff3,general kenobi,,0.,0.000001,0.05,0.,0.00,2024-02-26 19:35:15 +,6fe5489ea2303c6b5164590266df359130c4390e9bbeba73854a6a57e52f8b34,general kenobi 3,,0.,0.00000125,0.06,0.,0.00,2024-02-26 19:35:48 diff --git a/tests/test_history_export/history_with_fx_client_4_5_2_9dk_with_ln.json b/tests/test_history_export/history_with_fx_client_4_5_2_9dk_with_ln.json new file mode 100644 index 000000000..0e07eebcd --- /dev/null +++ b/tests/test_history_export/history_with_fx_client_4_5_2_9dk_with_ln.json @@ -0,0 +1,1019 @@ +{ + "024464eae9858f079d2f49bc3db28f92237c63fe950c8ddc6c9b18d1855fa32c": { + "amount_sat": 10000000, + "bc_balance": "0.1", + "bc_value": "0.1", + "confirmations": 1232719, + "date": "2018-06-29 13:29", + "fee_sat": null, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": null, + "fiat_rate": "5314.60", + "fiat_value": "531.46", + "group_id": null, + "height": 1346870, + "incoming": true, + "label": "trans 3", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1530271747, + "timestamp": 1530271747, + "txid": "024464eae9858f079d2f49bc3db28f92237c63fe950c8ddc6c9b18d1855fa32c", + "txpos_in_block": 11, + "value": "0.1", + "wanted_height": null + }, + "03bec7a53ce7c856046f306738a14a976acff34f12a1e3f61f31fa4284486f7d": { + "amount_sat": 500000, + "bc_balance": "0.00802364", + "bc_value": "0.005", + "confirmations": 7, + "date": "2024-02-26 18:02", + "fee_sat": null, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": null, + "fiat_rate": "50273.00", + "fiat_value": "251.36", + "group_id": null, + "height": 2579582, + "incoming": true, + "label": "fund me pls", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1708966959, + "timestamp": 1708966959, + "txid": "03bec7a53ce7c856046f306738a14a976acff34f12a1e3f61f31fa4284486f7d", + "txpos_in_block": 675, + "value": "0.005", + "wanted_height": null + }, + "03eb4932abf231999f5a698a28f70cfe6b1a2975be0310e348a9898434efb8d3": { + "acquisition_price": "10.68", + "amount_sat": -201000, + "bc_balance": "0.09598", + "bc_value": "-0.00201", + "capital_gain": "0.00", + "confirmations": 1232611, + "date": "2018-06-29 16:20", + "fee_sat": 1000, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.05", + "fiat_rate": "5314.60", + "fiat_value": "-10.68", + "group_id": null, + "height": 1346978, + "incoming": false, + "label": "Dsdhahuisad", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1530282040, + "timestamp": 1530282040, + "txid": "03eb4932abf231999f5a698a28f70cfe6b1a2975be0310e348a9898434efb8d3", + "txpos_in_block": 3, + "value": "-0.00201", + "wanted_height": null + }, + "0834354bb383e3fefba08314b62f1ec4b0bead90a2ea977652e12f8ae930efda": { + "amount_msat": -50030000, + "bc_value": "0.", + "date": "2024-02-26 19:34", + "direction": 0, + "fee_msat": 30000, + "fiat_default": true, + "fiat_value": "-25.15", + "group_id": null, + "label": "obiwan9847", + "lightning": true, + "ln_value": "-0.0005003", + "payment_hash": "0834354bb383e3fefba08314b62f1ec4b0bead90a2ea977652e12f8ae930efda", + "preimage": "1b16da388f5d62648825a5022e72a27ec6e5b2242fb37adf8260306c5e544f3c", + "timestamp": 1708972442, + "type": "payment", + "value": "-0.0005003" + }, + "0ef1c91636d20331acc2759d0f0335925cd899e270efdd2598e9449c66649d39": { + "acquisition_price": "10.68", + "amount_sat": -201000, + "bc_balance": "0.09799", + "bc_value": "-0.00201", + "capital_gain": "0.00", + "confirmations": 1232632, + "date": "2018-06-29 15:52", + "fee_sat": 1000, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.05", + "fiat_rate": "5314.60", + "fiat_value": "-10.68", + "group_id": null, + "height": 1346957, + "incoming": false, + "label": "dsadsa", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1530280346, + "timestamp": 1530280346, + "txid": "0ef1c91636d20331acc2759d0f0335925cd899e270efdd2598e9449c66649d39", + "txpos_in_block": 10, + "value": "-0.00201", + "wanted_height": null + }, + "10a2a7695a5b6ba857b10d04ad047b968656c6d84b58ea226dc92c150cb73b2f": { + "acquisition_price": "8.22", + "amount_sat": -100000, + "bc_balance": "0.", + "bc_value": "-0.001", + "capital_gain": "6.78", + "confirmations": 687142, + "date": "2020-11-18 01:22", + "fee_sat": 111, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.02", + "fiat_rate": "14997.00", + "fiat_value": "-15.00", + "group_id": null, + "height": 1892447, + "incoming": false, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1605658960, + "timestamp": 1605658960, + "txid": "10a2a7695a5b6ba857b10d04ad047b968656c6d84b58ea226dc92c150cb73b2f", + "txpos_in_block": 42, + "value": "-0.001", + "wanted_height": null + }, + "2042e1e197e0b21e83de0ee8a92abf5e1fea617cf143dc584a743df075bc6269": { + "amount_sat": 99811, + "bc_balance": "0.03199474", + "bc_value": "0.00099811", + "confirmations": 996545, + "date": "2019-10-15 16:02", + "fee_sat": null, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": null, + "fiat_rate": "7426.20", + "fiat_value": "7.41", + "group_id": null, + "height": 1583044, + "incoming": true, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1571148168, + "timestamp": 1571148168, + "txid": "2042e1e197e0b21e83de0ee8a92abf5e1fea617cf143dc584a743df075bc6269", + "txpos_in_block": 273, + "value": "0.00099811", + "wanted_height": null + }, + "23b5490a6b9723a96f8d1170cf0ab8d2e961d775cff0151540400f2964ccbd7f": { + "amount_sat": 135000, + "bc_balance": "0.00405", + "bc_value": "0.00135", + "confirmations": 175482, + "date": "2022-11-04 16:27", + "fee_sat": null, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": null, + "fiat_rate": "21224.00", + "fiat_value": "28.65", + "group_id": null, + "height": 2404107, + "incoming": true, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1667575669, + "timestamp": 1667575669, + "txid": "23b5490a6b9723a96f8d1170cf0ab8d2e961d775cff0151540400f2964ccbd7f", + "txpos_in_block": 18, + "value": "0.00135", + "wanted_height": null + }, + "25ddebe4b7e7caf7b175762ddc4cbb5d704f27520a997b7672057f2455b2fcea": { + "amount_sat": 100000, + "bc_balance": "0.001", + "bc_value": "0.001", + "confirmations": 803764, + "date": "2020-07-07 17:45", + "fee_sat": null, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": null, + "fiat_rate": "8219.70", + "fiat_value": "8.22", + "group_id": null, + "height": 1775825, + "incoming": true, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1594136749, + "timestamp": 1594136749, + "txid": "25ddebe4b7e7caf7b175762ddc4cbb5d704f27520a997b7672057f2455b2fcea", + "txpos_in_block": 81, + "value": "0.001", + "wanted_height": null + }, + "30bc3855a6837562eb6dffbb3190e71279e2df2a04f2598780c9df7f290706e0": { + "acquisition_price": "0.01", + "amount_sat": -141, + "bc_balance": "0.03204603", + "bc_value": "-0.00000141", + "capital_gain": "-0.00", + "confirmations": 1124381, + "date": "2019-02-02 18:37", + "fee_sat": 141, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.00", + "fiat_rate": "3110.90", + "fiat_value": "-0.00", + "group_id": null, + "height": 1455208, + "incoming": false, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1549129020, + "timestamp": 1549129020, + "txid": "30bc3855a6837562eb6dffbb3190e71279e2df2a04f2598780c9df7f290706e0", + "txpos_in_block": 23, + "value": "-0.00000141", + "wanted_height": null + }, + "3407144b10e0c7f60a88e9f3adcc7e732c83e92fa17a923f523b8acc50718c2f": { + "acquisition_price": "622.52", + "amount_sat": -17898625, + "bc_balance": "0.", + "bc_value": "-0.17898625", + "capital_gain": "1383.56", + "confirmations": 1011325, + "date": "2019-07-09 18:53", + "fee_sat": 246, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.03", + "fiat_rate": "11208.00", + "fiat_value": "-2006.08", + "group_id": null, + "height": 1568264, + "incoming": false, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1562691216, + "timestamp": 1562691216, + "txid": "3407144b10e0c7f60a88e9f3adcc7e732c83e92fa17a923f523b8acc50718c2f", + "txpos_in_block": 85, + "value": "-0.17898625", + "wanted_height": null + }, + "4029e471c030066ecca20621cc2917cade0fd44c5cbcb6f5299c086f25ec4b6c": { + "amount_sat": 14695224, + "bc_balance": "0.17899827", + "bc_value": "0.14695224", + "confirmations": 1123808, + "date": "2019-02-05 16:06", + "fee_sat": null, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": null, + "fiat_rate": "3077.70", + "fiat_value": "452.27", + "group_id": null, + "height": 1455781, + "incoming": true, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1549379178, + "timestamp": 1549379178, + "txid": "4029e471c030066ecca20621cc2917cade0fd44c5cbcb6f5299c086f25ec4b6c", + "txpos_in_block": 61, + "value": "0.14695224", + "wanted_height": null + }, + "41284afa51eccc94d10fac25eaa59d1fa1afdc3e27bae2b16a64399fe0f1be3c": { + "acquisition_price": "10.68", + "amount_sat": -201000, + "bc_balance": "0.06394885", + "bc_value": "-0.00201", + "capital_gain": "0.80", + "confirmations": 1165027, + "date": "2018-09-28 18:00", + "fee_sat": 1000, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.06", + "fiat_rate": "5710.90", + "fiat_value": "-11.48", + "group_id": null, + "height": 1414562, + "incoming": false, + "label": "some description here. much creativity", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1538150440, + "timestamp": 1538150440, + "txid": "41284afa51eccc94d10fac25eaa59d1fa1afdc3e27bae2b16a64399fe0f1be3c", + "txpos_in_block": 81, + "value": "-0.00201", + "wanted_height": null + }, + "4dbdf2810f130653d1eb17ce3645d0362e4ef41ffbd521aad1f9294c95baf76e": { + "acquisition_price": "169.54", + "amount_sat": -3190141, + "bc_balance": "0.03204744", + "bc_value": "-0.03190141", + "capital_gain": "-71.95", + "confirmations": 1125041, + "date": "2019-01-31 01:12", + "fee_sat": 141, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.00", + "fiat_rate": "3059.10", + "fiat_value": "-97.59", + "group_id": null, + "height": 1454548, + "incoming": false, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1548893536, + "timestamp": 1548893536, + "txid": "4dbdf2810f130653d1eb17ce3645d0362e4ef41ffbd521aad1f9294c95baf76e", + "txpos_in_block": 44, + "value": "-0.03190141", + "wanted_height": null + }, + "59a9ff5fa62586f102b92504584f52e47f4ca0d5af061e99a0a3023fa70a70e2": { + "amount_sat": 654165, + "bc_balance": "0.01051029", + "bc_value": "0.00654165", + "confirmations": 5, + "date": "2024-02-26 18:26", + "fee_sat": null, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": null, + "fiat_rate": "50273.00", + "fiat_value": "328.87", + "group_id": null, + "height": 2579584, + "incoming": true, + "label": "moar money", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1708968409, + "timestamp": 1708968409, + "txid": "59a9ff5fa62586f102b92504584f52e47f4ca0d5af061e99a0a3023fa70a70e2", + "txpos_in_block": 1814, + "value": "0.00654165", + "wanted_height": null + }, + "6fe5489ea2303c6b5164590266df359130c4390e9bbeba73854a6a57e52f8b34": { + "amount_msat": 125000, + "bc_value": "0.", + "date": "2024-02-26 19:35", + "direction": 1, + "fee_msat": null, + "fiat_default": true, + "fiat_value": "0.06", + "group_id": null, + "label": "general kenobi 3", + "lightning": true, + "ln_value": "0.00000125", + "payment_hash": "6fe5489ea2303c6b5164590266df359130c4390e9bbeba73854a6a57e52f8b34", + "preimage": "d6e4067da77dd810c6b0465a54e0557238b1b317c7b2a6ac679429780ad56f43", + "timestamp": 1708972548, + "type": "payment", + "value": "0.00000125" + }, + "6ff55c62470cf51cbc577e8efac5028e06e41912a39356ba576ab7b4d7f708ce": { + "acquisition_price": "0.23", + "amount_sat": -1097, + "bc_balance": "0.00403476", + "bc_value": "-0.00001097", + "capital_gain": "-0.05", + "confirmations": 164304, + "date": "2023-01-08 11:32", + "fee_sat": 1097, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.18", + "fiat_rate": "16069.00", + "fiat_value": "-0.18", + "group_id": null, + "height": 2415285, + "incoming": false, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1673173967, + "timestamp": 1673173967, + "txid": "6ff55c62470cf51cbc577e8efac5028e06e41912a39356ba576ab7b4d7f708ce", + "txpos_in_block": 17, + "value": "-0.00001097", + "wanted_height": null + }, + "720848b95f41736e6bdc838f4587e6205c417702353f3fd7d9b6b1ceb632e65b": { + "amount_msat": -10010000, + "bc_value": "0.", + "date": "2024-02-26 19:34", + "direction": 0, + "fee_msat": 10000, + "fiat_default": true, + "fiat_value": "-5.03", + "group_id": null, + "label": "hello there", + "lightning": true, + "ln_value": "-0.0001001", + "payment_hash": "720848b95f41736e6bdc838f4587e6205c417702353f3fd7d9b6b1ceb632e65b", + "preimage": "31a84f775c07316ad0cf3b894cf37bb2420b3f4d69a41794df2a4cf29c91e0a9", + "timestamp": 1708972473, + "type": "payment", + "value": "-0.0001001" + }, + "737857196825fa2e600bac822c866f10e5f484b0f193cff1fc3d38b91884c7a6": { + "acquisition_price": "53.18", + "amount_sat": -1000705, + "bc_balance": "0.06595885", + "bc_value": "-0.01000705", + "capital_gain": "1.62", + "confirmations": 1165278, + "date": "2018-09-25 20:01", + "fee_sat": 705, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.04", + "fiat_rate": "5476.40", + "fiat_value": "-54.80", + "group_id": null, + "height": 1414311, + "incoming": false, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1537898497, + "timestamp": 1537898497, + "txid": "737857196825fa2e600bac822c866f10e5f484b0f193cff1fc3d38b91884c7a6", + "txpos_in_block": 45, + "value": "-0.01000705", + "wanted_height": null + }, + "7726939a1246c0b99c2f30cfa21504af5b458755231b2cdc1fa1e9af2d9d70ba": { + "acquisition_price": "53.18", + "amount_sat": -1000705, + "bc_balance": "0.08597295", + "bc_value": "-0.01000705", + "capital_gain": "1.62", + "confirmations": 1165279, + "date": "2018-09-25 19:51", + "fee_sat": 705, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.04", + "fiat_rate": "5476.40", + "fiat_value": "-54.80", + "group_id": null, + "height": 1414310, + "incoming": false, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1537897872, + "timestamp": 1537897872, + "txid": "7726939a1246c0b99c2f30cfa21504af5b458755231b2cdc1fa1e9af2d9d70ba", + "txpos_in_block": 48, + "value": "-0.01000705", + "wanted_height": null + }, + "778b01899d5ed48df03e406bc5babd1fdc8f1be4b7e5b9d20dd8caf24dd66ff4": { + "acquisition_price": "2.67", + "amount_sat": -5310, + "bc_balance": "0.00396864", + "bc_value": "-0.0000531", + "capital_gain": "0.00", + "confirmations": 5, + "date": "2024-02-26 18:26", + "fee_sat": 210, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.11", + "fiat_rate": "50273.00", + "fiat_value": "-2.67", + "group_id": null, + "height": 2579584, + "incoming": false, + "label": "Payment request for BitPay invoice W6ic1rU1XThEmLAEvwkjdX for merchant SomberNight_testing", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1708968409, + "timestamp": 1708968409, + "txid": "778b01899d5ed48df03e406bc5babd1fdc8f1be4b7e5b9d20dd8caf24dd66ff4", + "txpos_in_block": 284, + "value": "-0.0000531", + "wanted_height": null + }, + "87dbf5a7a089f1e071559cdfd3e4bddb841cdd0032ffeec328952abf76fe3661": { + "acquisition_price": "20.82", + "amount_sat": -100776, + "bc_balance": "0.003027", + "bc_value": "-0.00100776", + "capital_gain": "1.05", + "confirmations": 160828, + "date": "2023-02-03 15:18", + "fee_sat": 776, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.17", + "fiat_rate": "21698.00", + "fiat_value": "-21.87", + "group_id": null, + "height": 2418761, + "incoming": false, + "label": "asd", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1675433925, + "timestamp": 1675433925, + "txid": "87dbf5a7a089f1e071559cdfd3e4bddb841cdd0032ffeec328952abf76fe3661", + "txpos_in_block": 56, + "value": "-0.00100776", + "wanted_height": null + }, + "8c09f8984e231fcaebdda00b2597cfde3d825a26dad2c5478c78ccabbac1f28b": { + "amount_sat": 160000, + "bc_balance": "0.0027", + "bc_value": "0.0016", + "confirmations": 230212, + "date": "2022-10-04 22:15", + "fee_sat": null, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": null, + "fiat_rate": "20379.27", + "fiat_value": "32.61", + "group_id": null, + "height": 2349377, + "incoming": true, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1664914506, + "timestamp": 1664914506, + "txid": "8c09f8984e231fcaebdda00b2597cfde3d825a26dad2c5478c78ccabbac1f28b", + "txpos_in_block": 58, + "value": "0.0016", + "wanted_height": null + }, + "94fce9de7e82741cc982936ad9f7900372b80be8100cb80e49f5d78c2954fb69": { + "acquisition_price": "83.68", + "amount_sat": -405000, + "bc_balance": "0.", + "bc_value": "-0.00405", + "capital_gain": "-18.56", + "confirmations": 173292, + "date": "2022-11-14 22:34", + "fee_sat": 289, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.05", + "fiat_rate": "16077.00", + "fiat_value": "-65.11", + "group_id": null, + "height": 2406297, + "incoming": false, + "label": "Open channel", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1668461654, + "timestamp": 1668461654, + "txid": "94fce9de7e82741cc982936ad9f7900372b80be8100cb80e49f5d78c2954fb69", + "txpos_in_block": 24, + "value": "-0.00405", + "wanted_height": null + }, + "972d16040c71b6660b52a0ad06ddb17aa7097921643bab526ad2e00780004535": { + "acquisition_price": "53.18", + "amount_sat": -1000705, + "bc_balance": "0.0759659", + "bc_value": "-0.01000705", + "capital_gain": "1.62", + "confirmations": 1165278, + "date": "2018-09-25 20:01", + "fee_sat": 705, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.04", + "fiat_rate": "5476.40", + "fiat_value": "-54.80", + "group_id": null, + "height": 1414311, + "incoming": false, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1537898497, + "timestamp": 1537898497, + "txid": "972d16040c71b6660b52a0ad06ddb17aa7097921643bab526ad2e00780004535", + "txpos_in_block": 44, + "value": "-0.01000705", + "wanted_height": null + }, + "9d166fea25720d207108cce24247f6c553ff5ed9ef83746b9400621456d84921": { + "amount_msat": -1003100, + "bc_value": "0.", + "date": "2024-02-26 18:59", + "direction": 0, + "fee_msat": 3100, + "fiat_default": true, + "fiat_value": "-0.50", + "group_id": null, + "label": "1 Blokaccino", + "lightning": true, + "ln_value": "-0.00001003", + "payment_hash": "9d166fea25720d207108cce24247f6c553ff5ed9ef83746b9400621456d84921", + "preimage": "4dd0ddf9605e51998936d101b7741e89be08cb788c1e36b9b1d62cd5e9543af8", + "timestamp": 1708970395, + "type": "payment", + "value": "-0.00001003" + }, + "a45b23f05e51f0ac22763ce1a3f028f30a5519f6779839fdd1df8fd037ffe75f": { + "amount_msat": -1003100, + "bc_value": "0.", + "date": "2024-02-26 19:00", + "direction": 0, + "fee_msat": 3100, + "fiat_default": true, + "fiat_value": "-0.50", + "group_id": null, + "label": "1 Blokaccino", + "lightning": true, + "ln_value": "-0.00001003", + "payment_hash": "a45b23f05e51f0ac22763ce1a3f028f30a5519f6779839fdd1df8fd037ffe75f", + "preimage": "48f81553d41291c78f5a09f21cc95eef11dd798e7abfd23fb1f1cb9eb8bf8359", + "timestamp": 1708970418, + "type": "payment", + "value": "-0.00001003" + }, + "b234c4f252cd193377bc6cf931ff1ef6a398e3a434e43b22cdb457a8213d749b": { + "acquisition_price": "237.60", + "amount_sat": -3199474, + "bc_balance": "0.", + "bc_value": "-0.03199474", + "capital_gain": "0.00", + "confirmations": 996545, + "date": "2019-10-15 16:02", + "fee_sat": 181, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.01", + "fiat_rate": "7426.20", + "fiat_value": "-237.60", + "group_id": null, + "height": 1583044, + "incoming": false, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1571148168, + "timestamp": 1571148168, + "txid": "b234c4f252cd193377bc6cf931ff1ef6a398e3a434e43b22cdb457a8213d749b", + "txpos_in_block": 286, + "value": "-0.03199474", + "wanted_height": null + }, + "b424362ec4eb39eb84f0bea8e00ffd8382d5dde29092bd1e268b9a027dc5225c": { + "acquisition_price": "0.06", + "amount_sat": -1202, + "bc_balance": "0.17898625", + "bc_value": "-0.00001202", + "capital_gain": "-0.02", + "confirmations": 1122455, + "date": "2019-02-14 18:27", + "fee_sat": 202, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.01", + "fiat_rate": "3238.30", + "fiat_value": "-0.04", + "group_id": null, + "height": 1457134, + "incoming": false, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1550165277, + "timestamp": 1550165277, + "txid": "b424362ec4eb39eb84f0bea8e00ffd8382d5dde29092bd1e268b9a027dc5225c", + "txpos_in_block": 52, + "value": "-0.00001202", + "wanted_height": null + }, + "ba48bce5cde8a4eacb4f1273c462101c06305e82d6ee89a113cd6b068178651f": { + "amount_sat": 3099663, + "bc_balance": "0.03099663", + "bc_value": "0.03099663", + "confirmations": 996545, + "date": "2019-10-15 16:02", + "fee_sat": null, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": null, + "fiat_rate": "7426.20", + "fiat_value": "230.19", + "group_id": null, + "height": 1583044, + "incoming": true, + "label": "old address 95645", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1571148168, + "timestamp": 1571148168, + "txid": "ba48bce5cde8a4eacb4f1273c462101c06305e82d6ee89a113cd6b068178651f", + "txpos_in_block": 191, + "value": "0.03099663", + "wanted_height": null + }, + "cb869e44bcfe4f770fcba707788bd626956669989e7ea31981aef4674f78bff3": { + "amount_msat": 100000, + "bc_value": "0.", + "date": "2024-02-26 19:35", + "direction": 1, + "fee_msat": null, + "fiat_default": true, + "fiat_value": "0.05", + "group_id": null, + "label": "general kenobi", + "lightning": true, + "ln_value": "0.000001", + "payment_hash": "cb869e44bcfe4f770fcba707788bd626956669989e7ea31981aef4674f78bff3", + "preimage": "ee4f549b3844282ae596dfef14fc75e64067517fa92e9735fe792415bced3db9", + "timestamp": 1708972515, + "type": "payment", + "value": "0.000001" + }, + "d57bb7a379c7eb8c86e34d595722ca4f389394b4497c1f0028971e0a8e75c8e1": { + "amount_sat": 404573, + "bc_balance": "0.00404573", + "bc_value": "0.00404573", + "confirmations": 164304, + "date": "2023-01-08 11:32", + "fee_sat": 138, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.02", + "fiat_rate": "16069.00", + "fiat_value": "65.01", + "group_id": null, + "height": 2415285, + "incoming": true, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1673173967, + "timestamp": 1673173967, + "txid": "d57bb7a379c7eb8c86e34d595722ca4f389394b4497c1f0028971e0a8e75c8e1", + "txpos_in_block": 16, + "value": "0.00404573", + "wanted_height": null + }, + "efca2a86e0584d7e359e5bc9ac954c6ed7e5c136ad6d561cba662001221df23c": { + "amount_sat": 110000, + "bc_balance": "0.0011", + "bc_value": "0.0011", + "confirmations": 230215, + "date": "2022-10-04 21:28", + "fee_sat": null, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": null, + "fiat_rate": "20379.27", + "fiat_value": "22.42", + "group_id": null, + "height": 2349374, + "incoming": true, + "label": "", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1664911683, + "timestamp": 1664911683, + "txid": "efca2a86e0584d7e359e5bc9ac954c6ed7e5c136ad6d561cba662001221df23c", + "txpos_in_block": 13, + "value": "0.0011", + "wanted_height": null + }, + "group:66f846809c2d45842f17e40fb6a696288c3274a66b0bf71107940f250978832e": { + "acquisition_price": "0.04", + "bc_value": "0.00302364", + "capital_gain": "0.01", + "children": [ + { + "amount_sat": 302364, + "bc_balance": "0.00302364", + "bc_value": "0.00302364", + "confirmations": 51197, + "date": "2023-10-03 17:15", + "fee_sat": 183, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.05", + "fiat_rate": "26224.00", + "fiat_value": "79.29", + "group_id": "66f846809c2d45842f17e40fb6a696288c3274a66b0bf71107940f250978832e", + "height": 2528392, + "incoming": true, + "label": "Close channel 2425096x21x1", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1696346138, + "timestamp": 1696346138, + "txid": "66f846809c2d45842f17e40fb6a696288c3274a66b0bf71107940f250978832e", + "txpos_in_block": 155, + "value": "0.00302364", + "wanted_height": null + }, + { + "amount_msat": -302547000, + "bc_value": "0.", + "date": "2023-10-03 17:15", + "direction": null, + "fee_msat": null, + "fiat_default": true, + "fiat_value": "-79.34", + "group_id": "66f846809c2d45842f17e40fb6a696288c3274a66b0bf71107940f250978832e", + "label": "Close channel 2425096x21x1", + "lightning": true, + "ln_value": "-0.00302547", + "payment_hash": null, + "preimage": null, + "timestamp": 1696346138, + "type": "channel_closing", + "value": "-0.00302547" + } + ], + "confirmations": 51197, + "date": "2023-10-03 17:15", + "fee_sat": 0, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.00", + "fiat_rate": "26224.00", + "fiat_value": "-0.05", + "height": 2528392, + "label": "Close channel 2425096x21x1", + "lightning": false, + "ln_value": "-0.00302547", + "timestamp": 1696346138, + "txid": "66f846809c2d45842f17e40fb6a696288c3274a66b0bf71107940f250978832e", + "value": "-0.00000183", + "wanted_height": null + }, + "group:97767fdefef3152319363b772914d71e5eb70e793b835c13dce20037d3ac13fe": { + "acquisition_price": "0.03", + "bc_value": "-0.003027", + "capital_gain": "0.01", + "children": [ + { + "acquisition_price": "62.54", + "amount_sat": -302700, + "bc_balance": "0.", + "bc_value": "-0.003027", + "capital_gain": "16.89", + "confirmations": 154493, + "date": "2023-03-19 20:01", + "fee_sat": 153, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.04", + "fiat_rate": "26241.00", + "fiat_value": "-79.43", + "group_id": "97767fdefef3152319363b772914d71e5eb70e793b835c13dce20037d3ac13fe", + "height": 2425096, + "incoming": false, + "label": "Open channel", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1679252503, + "timestamp": 1679252503, + "txid": "97767fdefef3152319363b772914d71e5eb70e793b835c13dce20037d3ac13fe", + "txpos_in_block": 21, + "value": "-0.003027", + "wanted_height": null + }, + { + "amount_msat": 302547000, + "bc_value": "0.", + "date": "2023-03-19 20:01", + "direction": null, + "fee_msat": null, + "fiat_default": true, + "fiat_value": "79.39", + "group_id": "97767fdefef3152319363b772914d71e5eb70e793b835c13dce20037d3ac13fe", + "label": "Open channel 2425096x21x1", + "lightning": true, + "ln_value": "0.00302547", + "payment_hash": null, + "preimage": null, + "timestamp": 1679252503, + "type": "channel_opening", + "value": "0.00302547" + } + ], + "confirmations": 154493, + "date": "2023-03-19 20:01", + "fee_sat": 0, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.00", + "fiat_rate": "26241.00", + "fiat_value": "-0.04", + "height": 2425096, + "label": "Open channel 2425096x21x1", + "lightning": false, + "ln_value": "0.00302547", + "timestamp": 1679252503, + "txid": "97767fdefef3152319363b772914d71e5eb70e793b835c13dce20037d3ac13fe", + "value": "-0.00000153", + "wanted_height": null + }, + "group:c96b3ed60c8531e1370051662390defa07152cbc028855ea591fc444d8db4e38": { + "acquisition_price": "0.10", + "bc_value": "-0.0040019", + "capital_gain": "0.00", + "children": [ + { + "acquisition_price": "201.19", + "amount_sat": -400190, + "bc_balance": "0.00402174", + "bc_value": "-0.0040019", + "capital_gain": "0.00", + "confirmations": 6, + "date": "2024-02-26 18:11", + "fee_sat": 190, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.10", + "fiat_rate": "50273.00", + "fiat_value": "-201.19", + "group_id": "c96b3ed60c8531e1370051662390defa07152cbc028855ea591fc444d8db4e38", + "height": 2579583, + "incoming": false, + "label": "Open channel", + "lightning": false, + "ln_value": "0.", + "monotonic_timestamp": 1708967515, + "timestamp": 1708967515, + "txid": "c96b3ed60c8531e1370051662390defa07152cbc028855ea591fc444d8db4e38", + "txpos_in_block": 479, + "value": "-0.0040019", + "wanted_height": null + }, + { + "amount_msat": 400000000, + "bc_value": "0.", + "date": "2024-02-26 18:11", + "direction": null, + "fee_msat": null, + "fiat_default": true, + "fiat_value": "201.09", + "group_id": "c96b3ed60c8531e1370051662390defa07152cbc028855ea591fc444d8db4e38", + "label": "Open channel 2579583x479x2", + "lightning": true, + "ln_value": "0.004", + "payment_hash": null, + "preimage": null, + "timestamp": 1708967515, + "type": "channel_opening", + "value": "0.004" + } + ], + "confirmations": 6, + "date": "2024-02-26 18:11", + "fee_sat": 0, + "fiat_currency": "EUR", + "fiat_default": true, + "fiat_fee": "0.00", + "fiat_rate": "50273.00", + "fiat_value": "-0.10", + "height": 2579583, + "label": "Open channel 2579583x479x2", + "lightning": false, + "ln_value": "0.004", + "timestamp": 1708967515, + "txid": "c96b3ed60c8531e1370051662390defa07152cbc028855ea591fc444d8db4e38", + "value": "-0.0000019", + "wanted_height": null + } +} \ No newline at end of file diff --git a/tests/test_storage_upgrade.py b/tests/test_storage_upgrade.py index 05dcf6f0a..4be5cbe66 100644 --- a/tests/test_storage_upgrade.py +++ b/tests/test_storage_upgrade.py @@ -18,7 +18,6 @@ from . import as_testnet from .test_wallet import WalletTestCase -WALLET_FILES_DIR = os.path.join(os.path.dirname(__file__), "test_storage_upgrade") # TODO add other wallet types: 2fa, xpub-only @@ -30,7 +29,7 @@ class TestStorageUpgrade(WalletTestCase): assert isinstance(test_method_name, str) assert test_method_name.startswith("test_upgrade_from_") fname = test_method_name[len("test_upgrade_from_"):] - test_vector_file = os.path.join(WALLET_FILES_DIR, fname) + test_vector_file = self.get_wallet_file_path(fname) with open(test_vector_file, "r") as f: wallet_str = f.read() return wallet_str diff --git a/tests/test_wallet.py b/tests/test_wallet.py index b122506fb..de1a278a6 100644 --- a/tests/test_wallet.py +++ b/tests/test_wallet.py @@ -7,6 +7,8 @@ from decimal import Decimal import time from io import StringIO import asyncio +from unittest import mock +from pathlib import Path from electrum.storage import WalletStorage from electrum.wallet_db import FINAL_SEED_VERSION @@ -17,7 +19,7 @@ from electrum.util import TxMinedInfo, InvalidPassword from electrum.bitcoin import COIN from electrum.wallet_db import WalletDB, JsonDB from electrum.simple_config import SimpleConfig -from electrum import util +from electrum import util, storage from electrum.daemon import Daemon from electrum.invoices import PR_UNPAID, PR_PAID, PR_UNCONFIRMED from electrum.transaction import tx_from_any @@ -214,6 +216,64 @@ class TestFiat(ElectrumTestCase): self.assertNotIn(ccy, self.fiat_value) +class TestHistoryExport(ElectrumTestCase): + TESTNET = True + + def setUp(self): + # mock timezone, explicitly define timezone as the CI seems to miss a timezone db and cant resolve just 'CET' + self.patch_timezone = mock.patch.dict(os.environ, {'TZ': 'CET-1CEST,M3.5.0,M10.5.0/3'}) + self.patch_timezone.start() + time.tzset() + super(TestHistoryExport, self).setUp() + shutil.copytree(Path(__file__).parent / "fiat_fx_data", Path(self.electrum_path) / "cache") + self.config = SimpleConfig({'electrum_path': self.electrum_path}) + + def tearDown(self): + super(TestHistoryExport, self).tearDown() + self.patch_timezone.stop() + time.tzset() + + @mock.patch('electrum.wallet.run_hook') + @mock.patch.object(storage.WalletStorage, 'write') + @mock.patch.object(storage.WalletStorage, 'append') + async def test_export_history_to_file(self, _mock_append, _mock_write, mock_run_hook): + # prepare wallet with realistic history + c = self.config + c.NETWORK_OFFLINE = True + c.FX_EXCHANGE, c.FX_CURRENCY, c.FX_USE_EXCHANGE_RATE, c.FX_HISTORY_RATES = "BitFinex", "EUR", True, True + daemon = Daemon(config=c, listen_jsonrpc=False) + test_wallet_name = "client_4_5_2_9dk_with_ln" # has labels, local tx, ln tx + wallet_path = self.get_wallet_file_path(test_wallet_name) + test_wallet = daemon.load_wallet(wallet_path, None, upgrade=True) + self.assertTrue(daemon.fx.has_history()) + mock_run_hook.return_value = False + + testcases = ( + f'history_no_fx_{test_wallet_name}.csv', + f'history_with_fx_{test_wallet_name}.csv', + f'history_no_fx_{test_wallet_name}.json', + f'history_with_fx_{test_wallet_name}.json', + ) + for filename in testcases: + test_export_path = (Path(self.electrum_path) / filename).as_posix() + is_csv = filename.endswith('.csv') + fx = daemon.fx if 'with_fx' in filename else None + test_wallet.export_history_to_file( + file_path=test_export_path, + is_csv=is_csv, + fx=fx, + ) + mock_run_hook.assert_called_with('export_history_to_file', test_wallet, fx, test_export_path, is_csv) + reference_path = Path(__file__).parent / "test_history_export" / filename + with open(reference_path, 'r', encoding='utf-8') as reference: + reference_text = reference.readlines() + with open(test_export_path, 'r', encoding='utf-8') as test_export: + test_export_text = test_export.readlines() + # compare line by line for more readable traceback on difference + for reference, test in zip(reference_text, test_export_text): + self.assertEqual(reference, test) + + class TestCreateRestoreWallet(WalletTestCase): async def test_create_new_wallet(self):