From b5a27ca2fa80750aec059e8f8dc11b05fdb90d42 Mon Sep 17 00:00:00 2001 From: farscapian Date: Thu, 30 May 2024 21:06:33 -0400 Subject: [PATCH] pytests, refactors, pay-to-self, payment thresholds (#93) * Rename 'bind_to' in api; replace with offer_id & invoice_label. * Fix documentation error. * Alter bindinglist to accept invoice_label. * Make prism-list return all prism documents by default. * Ensure prism-list structure is consistent with/without arg. * Simplify logging output. * Bug fix: ensure bindings respect payout_threshold. * fix type on readme. * Fix bind_type bug in invoice_payment. * Update example on readme. * Add initial implicit pay-to-self. * Switch to payout_threshold_msat * Create binding_id and update member_outlays format. * Enable BOLT12 explicit PTSD. * jupyter notebook updates to new api * bind to id of prism object, not `prism_id` param passed to `prism-create` When you try to create a prism and do not specify a `prism_id`, then a `None` value was getting passed to `bindprism` causing it to error. I just changed to to bind to `prism.id` instead of `prism_id` * use `Prism.get` for finding all prisms This unifies the getting of one and all prisms into `Prism.get`. Also, when a prism ID was provided to `prism-list`, a dict with the prism was returned rather than an array of prisms. Now, one prism is returned in the same format as many prisms. * Disable pay-to-self-destination by default. * Nitpicks * Prism-list updates for testing conformance. * Update test cases for changes. * Improve run_tests.sh * Revert recent prism-list and Prism.get_all changes. * Update Documentation. * Remove binding_id. * Change "bind_to" to "offer_id" in prism-create. * Fix logging typo. * Fix invoice_payment bug. * return `prism-list ` as array --------- Co-authored-by: gudnuf --- README.md | 201 +-- bolt12-prism.py | 146 ++- .../create-checkpoint.ipynb | 1142 ++++++++++++++++- contrib/jupyter/create.ipynb | 868 ++++++++++--- lib.py | 68 +- run_tests.sh | 6 +- test_bolt12_prism.py | 18 +- 7 files changed, 2115 insertions(+), 334 deletions(-) diff --git a/README.md b/README.md index 25008b8..46c07d5 100644 --- a/README.md +++ b/README.md @@ -48,108 +48,134 @@ The `prism_id` is optional. If left unspecified, a unique prism id will be assig MEMBERS_JSON= ```json -[{"label" : "Lead-Singer", "destination": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2qajx2enpw4k8g93pqtyh3ua3crhn6me89spfupgp40nxkdfkhp0j2zjk63qgsdxp230ss", "split": 1},{"label" : "Drummer", "destination": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2qajx2enpw4k8g93pqw2ugunkxkzckdwkme9wkzfmjf4f2hm3852906gwsk05lxm0s29fu", "split": 1},{"label" : "Guitarist", "destination": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2qajx2enpw4k8g93pqvqlu8pa98q4wqrvdvyg0svtunw8pa5vj0j9r5mnpzcrjyx8tm7jw", "split": 1}] +[{"label" : "Carol", "destination": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2qajx2enpw4k8g93pqtrvcsycd8dqycyzsqp3nf8kjtjw448ad2sxclmsqe4yv2ry885pw", "split": 1, "payout_threshold_msat": "500000"},{"label" : "Dave", "destination": "02ffefcc4240dd5f339e6e451f0eceadd7e1f2d3c3b74ae256f53b6ae8f575d91a", "split": 1, "payout_threshold_msat": "500000"},{"label" : "Erin", "destination": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2qajx2enpw4k8g93pq2a9lj8dwfgefqvnl7yc8jyhtcxxhzdzq5memcz7769ja3c0jzvys", "split": 1, "payout_threshold_msat": "500000"}]' ``` ```bash lightning-cli prism-create -k members="$MEMBERS_JSON" ``` -### Delete a prism - -Need to delete a prism from the database? Use `prism-delete prism_id`. Be sure to remove any bindings first (see below)! - -### List Prism IDs - -Let's say you have three prisms defined, one of which you specified and ID for. `prism-list` might look something like this: - -`lightning-cli prism-list` - -```json -{ - "prism_ids": [ - "1ae57a94-1a57-4d9c-aabe-5da1dd340edd", - "88a743d1-da8c-4cbe-afdc-9db58e154dc5", - "prism1" - ] -} -``` - -## Show a Prism - -Ok cool, you have some prism_ids. Now use `prism-show` to view the prism definition. This document specifies the POLICY of the prism. - -`lightning-cli prism-show -k prism_id="prism1"` - ```json { "prism_id": "prism1", + "timestamp": 1715877268, + "outlay_factor": 0.8, "prism_members": [ { - "member_id": "0922ff11-15fb-428f-9607-fd3ad9096964", + "member_id": "1c00f7de-fd5e-4b21-a869-2a79226e8275", "label": "Carol", - "destination": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2qajx2enpw4k8g93pqdtj0zz3uhtcys42fnkhmvn96spym62l25xa69knd6kp3jncaf3py", + "destination": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2qajx2enpw4k8g93pqvqmtjepktzl0sqz6fhadxphh7mmnrjxc6sjlf0schhjmm86yd57x", "split": 1, "fees_incurred_by": "remote", - "payout_threshold": "0msat" + "payout_threshold_msat": "500000" }, { - "member_id": "394c41d9-a9a6-4c5d-916f-083105ec35b7", + "member_id": "841f869b-1a8b-4153-9a44-1fd50ce53989", "label": "Dave", - "destination": "0258dc215bef8eca15ceb424aea162519cbc40d0b9b0eb107339bc7432de51c0e1", + "destination": "023fe8d7f9fddf9568cc31c1b0cf339d965a522166f9d1e3185186023d311922cf", "split": 1, "fees_incurred_by": "remote", - "payout_threshold": "0msat" + "payout_threshold_msat": "500000" }, { - "member_id": "02eceb88-b64d-4129-b861-cb5c3d231a46", + "member_id": "28c5107d-e18b-4b99-8706-dac6ad8017cb", "label": "Erin", - "destination": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2qajx2enpw4k8g93pq0f0y265urvvj5sp2wqdr0m2w53ec56elpanvd6x5zk6mw0awcl85", + "destination": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2qajx2enpw4k8g93pq0nqkyg3z3hh6mhse7naf8njpdyzuw0067zj35vcelp6u8r3zkc3j", "split": 1, "fees_incurred_by": "remote", - "payout_threshold": "0msat" + "payout_threshold_msat": "500000" } ] } ``` +Setting the `outlay_factor` to `0.8` means that total outlays will be only 80% of the incoming amount. This is an implicit "pay-to-self". This feature allows a Prism member to host a prism. + +### Delete a prism + +Need to delete a prism from the database? Use `prism-delete prism_id`. Be sure to remove any bindings first (see below)! + +### List prisms + +Run the following command to view a prism policy. (Note that you can add a `prism_id` and specific prism will be returned.) + +`lightning-cli prism-list` + +```json +{ + "prisms": { + "prism_id": "prism1", + "timestamp": 1715879764, + "outlay_factor": 0.8, + "prism_members": [ + { + "member_id": "088db12c-5bbc-4ecd-bd9f-66553f6dc277", + "label": "Carol", + "destination": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2qajx2enpw4k8g93pqtrvcsycd8dqycyzsqp3nf8kjtjw448ad2sxclmsqe4yv2ry885pw", + "split": 1, + "fees_incurred_by": "remote", + "payout_threshold_msat": "500000" + }, + { + "member_id": "1cfa8bf2-f251-4891-ae08-b812d214fa07", + "label": "Dave", + "destination": "02ffefcc4240dd5f339e6e451f0eceadd7e1f2d3c3b74ae256f53b6ae8f575d91a", + "split": 1, + "fees_incurred_by": "remote", + "payout_threshold_msat": "500000" + }, + { + "member_id": "fb639dd9-8d07-4ca9-9fbc-5ae08505627a", + "label": "Erin", + "destination": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2qajx2enpw4k8g93pq2a9lj8dwfgefqvnl7yc8jyhtcxxhzdzq5memcz7769ja3c0jzvys", + "split": 1, + "fees_incurred_by": "remote", + "payout_threshold_msat": "500000" + } + ] + } +} +``` + ## Prism-Pay - Executes a Payout `lighting-cli prism-pay -k prism_id=prism1 amount_msat=1000000` When run, this RPC command will execute (i.e., pay-out) a prism. This is useful if you need to interactively execute a prism payout [another CLN plugin](https://github.com/farscapian/lnplay/tree/tabconf/lnplay/clightning/cln-plugins/lnplaylive). You can specify the optional `label` paramemter to associate this payout to some external `id`. +> Note, Prism payouts via `prism-pay` DO NOT respect the payment_threshold. Your node will pay for all member payout fees when using `prism-pay`. Consider adding a binding so that fees can be tracked by maintaing a member outlay. + ```json { "prism_member_payouts": { - "0922ff11-15fb-428f-9607-fd3ad9096964": { - "destination": "0357278851e5d78242aa4ced7db265d4024de95f550ddd16d36eac18ca78ea6212", - "payment_hash": "871aa78ad8b30dc95bb24a50dc76de33f17e2ebb17b1689970fd1bc17e826751", - "created_at": 1714147772.989214, + "088db12c-5bbc-4ecd-bd9f-66553f6dc277": { + "destination": "02c6cc409869da026082800319a4f692e4ead4fd6aa06c7f70066a46286439e817", + "payment_hash": "abb1fcaaaacd541969d1edaebd5f9f01c6da75f333daaab124a813c0c3be55fc", + "created_at": 1715879764.8129447, "parts": 1, - "amount_msat": 33333, - "amount_sent_msat": 33333, - "payment_preimage": "17de2266ce2cce92b1523593b46ffe18b582542f6d3e6135884ff57a89247413", + "amount_msat": 3333333, + "amount_sent_msat": 3333333, + "payment_preimage": "b4abf87c99cf6861161083fc35e7483b7d88a685394d8f70fb92324a4afc5fd7", "status": "complete" }, - "394c41d9-a9a6-4c5d-916f-083105ec35b7": { - "destination": "0258dc215bef8eca15ceb424aea162519cbc40d0b9b0eb107339bc7432de51c0e1", - "payment_hash": "356a7fcc43ad4c329553cfe925688f6148b933396094e6fcbac0310dd29c04c9", - "created_at": 1714147773.9578664, + "1cfa8bf2-f251-4891-ae08-b812d214fa07": { + "destination": "02ffefcc4240dd5f339e6e451f0eceadd7e1f2d3c3b74ae256f53b6ae8f575d91a", + "payment_hash": "ef6c217ce60c2ef048bc308060eb76a39d91c36f4ce36cf579669a056270fe33", + "created_at": 1715879765.7926252, "parts": 1, - "amount_msat": 33333, - "amount_sent_msat": 33333, - "payment_preimage": "146e5eee75d84f5d779ca3e0ab8538dc04940b8026fd5d54a4cb60651139c353", + "amount_msat": 3333333, + "amount_sent_msat": 3333333, + "payment_preimage": "0f95f40f4ff52ab9b4a22f75f8769e750ac231e142bf1597c449c635f3738610", "status": "complete" }, - "02eceb88-b64d-4129-b861-cb5c3d231a46": { - "destination": "03d2f22b54e0d8c952015380d1bf6a75239c5359f87b363746a0adadb9fd763e7a", - "payment_hash": "e586f808e8381cfc8750ffed8c32dbd0d7c25040caae983cb20b59ee9ebed99b", - "created_at": 1714147774.9850466, + "fb639dd9-8d07-4ca9-9fbc-5ae08505627a": { + "destination": "02ba5fc8ed7251948193ff8983c8975e0c6b89a205379de05ef68b2ec70f909848", + "payment_hash": "12f4cf34789dfb73d3162b3f204c97d7a28ee6d8c7ff5689db994ed67da4b207", + "created_at": 1715879766.762006, "parts": 1, - "amount_msat": 33333, - "amount_sent_msat": 33333, - "payment_preimage": "fa6071450e296e80d0de9ae5bc1f54e25891b8650955353bda3a45a57320ed5d", + "amount_msat": 3333333, + "amount_sent_msat": 3333333, + "payment_preimage": "9e82e3ff68a84d8937923028a76052898ec9366d9f08ae7ce0b5a26ac4d6a77f", "status": "complete" } } @@ -164,46 +190,47 @@ Often you will want your prisms to be paid out whenever you have an incoming pay ### Create a binding -`lightning-cli -k prism-bindingadd -k bind_to=64b2eaba3882444833eda9bab3535d836f1976753613729427c374bcbba04913 prism_id=prism1` +`lightning-cli -k prism-bindingadd -k offer_id=458f1a21f5d24158dd756c44735f11fe688d4d5d0d97fd8b33235b634a2ca52f prism_id=prism1` Binds a prism to either a bolt12 offer such that the prism will be executed upon incoming payment. ```json { "status": "must-create", - "bind_to": "64b2eaba3882444833eda9bab3535d836f1976753613729427c374bcbba04913", - "prism_id": "prism1", + "timestamp": 1715879765, + "offer_id": "2a5afc3132b75e6c30a3ad932507f83c27c57fa96e56a6ff856b67db9e12d9a9", + "prism_id": "prism3", "prism_binding_key": [ "prism", "v2", "bind", "bolt12", - "64b2eaba3882444833eda9bab3535d836f1976753613729427c374bcbba04913" + "2a5afc3132b75e6c30a3ad932507f83c27c57fa96e56a6ff856b67db9e12d9a9" ], "prism_members": [ { - "member_id": "0922ff11-15fb-428f-9607-fd3ad9096964", + "member_id": "064e2765-6773-4177-8c83-218e48fce2e4", "label": "Carol", - "destination": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2qajx2enpw4k8g93pqdtj0zz3uhtcys42fnkhmvn96spym62l25xa69knd6kp3jncaf3py", + "destination": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2qajx2enpw4k8g93pqtrvcsycd8dqycyzsqp3nf8kjtjw448ad2sxclmsqe4yv2ry885pw", "split": 1, "fees_incurred_by": "remote", - "payout_threshold": "0msat" + "payout_threshold_msat": "500000" }, { - "member_id": "394c41d9-a9a6-4c5d-916f-083105ec35b7", + "member_id": "180e2490-c389-4926-8325-819d00d497de", "label": "Dave", - "destination": "0258dc215bef8eca15ceb424aea162519cbc40d0b9b0eb107339bc7432de51c0e1", + "destination": "02ffefcc4240dd5f339e6e451f0eceadd7e1f2d3c3b74ae256f53b6ae8f575d91a", "split": 1, "fees_incurred_by": "remote", - "payout_threshold": "0msat" + "payout_threshold_msat": "500000" }, { - "member_id": "02eceb88-b64d-4129-b861-cb5c3d231a46", + "member_id": "ae1aecc2-ff10-487e-9221-271050ce4949", "label": "Erin", - "destination": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2qajx2enpw4k8g93pq0f0y265urvvj5sp2wqdr0m2w53ec56elpanvd6x5zk6mw0awcl85", + "destination": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2qajx2enpw4k8g93pq2a9lj8dwfgefqvnl7yc8jyhtcxxhzdzq5memcz7769ja3c0jzvys", "split": 1, "fees_incurred_by": "remote", - "payout_threshold": "0msat" + "payout_threshold_msat": "500000" } ] } @@ -211,29 +238,37 @@ Binds a prism to either a bolt12 offer such that the prism will be executed upon ### List Prism Bindings -Want to see all your bindings? Run `prism-bindinglist`. (Hint, run `prism-bindingshow` to list a specific binding state.) +Want to see your bindings? Run `prism-bindinglist`. Add an `offer_id` to view a specific binding. -`lightning-cli -k prism-bindinglist` +`lightning-cli -k prism-bindinglist 2a5afc3132b75e6c30a3ad932507f83c27c57fa96e56a6ff856b67db9e12d9a9` ```json { - "bolt12_prism_bindings": [ - { - "offer_id": "64b2eaba3882444833eda9bab3535d836f1976753613729427c374bcbba04913", - "prism_id": "prism1", - "member_outlays": { - "0922ff11-15fb-428f-9607-fd3ad9096964": "0msat", - "394c41d9-a9a6-4c5d-916f-083105ec35b7": "0msat", - "02eceb88-b64d-4129-b861-cb5c3d231a46": "0msat" + "bolt12_prism_bindings": { + "offer_id": "2a5afc3132b75e6c30a3ad932507f83c27c57fa96e56a6ff856b67db9e12d9a9", + "prism_id": "prism3", + "timestamp": 1715879765, + "member_outlays": [ + { + "member_id": "064e2765-6773-4177-8c83-218e48fce2e4", + "outlay_msat": "0" + }, + { + "member_id": "180e2490-c389-4926-8325-819d00d497de", + "outlay_msat": "0" + }, + { + "member_id": "ae1aecc2-ff10-487e-9221-271050ce4949", + "outlay_msat": "0" } - } - ] + ] + } } ``` Notice that outlay property? That's how the prism plugin deals with failed payments AND Lightning Network fees. When a prism binding has an incoming payment, prism member outlays in the binding are increased according the prism policy and incoming amount. -When `fees_incurred_by=remote` and a payment to a prism member succeeds, the outlay is decremented by the total amount of the payment including fees paid. When `fees_incurred_by=local`, fees are paid by the node operator hosting the prism. Prism member payouts occur when outlays exceed the `payout_threshold` in the respective prism policy. Until then, outlays accumulate and eventually get paid-out. +When `fees_incurred_by=remote` and a payment to a prism member succeeds, the outlay is decremented by the total amount of the payment including fees paid. When `fees_incurred_by=local`, fees are paid by the node operator hosting the prism. Prism member payouts occur when outlays exceed the `payout_threshold_msat` in the respective prism policy. Until then, outlays accumulate and eventually get paid-out. If a payment to a prism member fails for whatever reason, the outlay remains unchanged. diff --git a/bolt12-prism.py b/bolt12-prism.py index 4c48b86..a5cc830 100755 --- a/bolt12-prism.py +++ b/bolt12-prism.py @@ -34,13 +34,23 @@ def init(options, configuration, plugin, **kwargs): @plugin.method("prism-create") -def createprism(plugin, members, prism_id=""): +def createprism(plugin, members, prism_id="", outlay_factor: float = 1.0, pay_to_self_enabled: bool = False): '''Create a prism.''' + plugin.log(f"prism-create invoked having an outlay_factor of {outlay_factor}", "info") + prism_members = [Member(plugin=plugin, member_dict=m) for m in members] # create a new prism object (this is used for our return object only) - prism = Prism.create(plugin, prism_id, prism_members) + prism = Prism.create(plugin=plugin, prism_id=prism_id, members=prism_members, outlay_factor=outlay_factor) + + # now we want to create a unique offer that is associated with this prism + # this offer facilitates pay-to-self-destination use case. + if pay_to_self_enabled == True: + create_offer_response = plugin.rpc.offer(amount="any", description=prism_id, label=f"internal:prism:{prism_id}") + ptsd_offer_id = create_offer_response["offer_id"] + plugin.log(f"In prism-create. Trying to create a PTSD offer binding. here's the ptsd_offer_bolt12 {ptsd_offer_id}") + bind_prism_response = bindprism(plugin=plugin, prism_id=prism.id, offer_id=ptsd_offer_id) # return the prism json return prism.to_dict() @@ -48,23 +58,33 @@ def createprism(plugin, members, prism_id=""): @plugin.method("prism-list") def listprisms(plugin, prism_id=None): '''List prisms.''' - + # if a prism_id is not supplied, we return all prism policy objects (like in listoffers) if prism_id == None: try: + prism_ids = Prism.find_all(plugin) + prisms = [] + for prism_id in prism_ids: + prism = Prism.get(plugin=plugin, prism_id=prism_id) + prisms.append(prism) + return { - "prism_ids": Prism.find_all(plugin) + "prisms": [prism.to_dict() for prism in prisms] } except RpcError as e: plugin.log(e) return e else: + # otherwise we return a single document. prism = Prism.get(plugin=plugin, prism_id=prism_id) if prism is None: raise Exception(f"Prism with id {prism_id} not found.") - return prism.to_dict() + return { + "prisms": [prism.to_dict()] + } + @plugin.method("prism-update") @@ -92,63 +112,100 @@ def updateprism(plugin, prism_id, members): @plugin.method("prism-bindinglist") -def list_bindings(plugin, bind_to=None, bolt_version="bolt12"): +def list_bindings(plugin, offer_id=None, invoice_label=""): '''Lists all prism bindings.''' - if bind_to == None: + bolt12_prism_response = None + + # if an offer_id is not supplied and also an invoice_label, then we return all bindings. + if offer_id == None and invoice_label == "": - binding_offers = PrismBinding.list_binding_offers( - plugin, bolt_version=bolt_version) - response = { - f"{bolt_version}_prism_bindings": [binding.to_dict() for binding in binding_offers] + binding_offers = PrismBinding.list_binding_offers(plugin) + prism_response = { + f"bolt12_prism_bindings": [binding.to_dict() for binding in binding_offers] } - return response - else: + if offer_id != None: - binding = PrismBinding.get(plugin, bind_to, bolt_version) + # then we're going to return a single binding. + binding = PrismBinding.get(plugin, offer_id) + + if not binding: + raise Exception("ERROR: could not find a binding for this offer.") + + plugin.log(f"prism-bindingslist executed for '{offer_id}'", "info") + + prism_response = { + f"bolt12_prism_bindings": binding.to_dict() + } + + if offer_id == None and invoice_label != "": + + # then we're going to return a single binding. + binding = PrismBinding.get(plugin, bind_to=invoice_label, bolt_version="bolt11") if not binding: raise Exception("ERROR: could not find a binding for this offer.") - plugin.log(f"prism-bindingsbindinghow executed for {bolt_version} offer '{bind_to}'", "info") + plugin.log(f"prism-bindingslist executed for '{offer_id}'", "info") + + prism_response = { + f"bolt11_prism_bindings": binding.to_dict() + } + + return prism_response - return binding.to_dict() # adds a binding to the database. @plugin.method("prism-bindingadd") -def bindprism(plugin: Plugin, prism_id, bind_to, bolt_version="bolt12"): +def bindprism(plugin: Plugin, prism_id, offer_id=None, invoice_label=""): '''Binds a prism to a BOLT12 Offer or a BOLT11 invoice.''' - bolt_versions = ["bolt11", "bolt12"] - if bolt_version not in bolt_versions: - raise Exception("ERROR: 'type' MUST be either 'bolt12' or 'bolt11'.") + plugin.log(f"In bindprism with prism_id={prism_id} and offer_id={offer_id}.", "info") trigger = None + bolt_version = None + bind_to = None + if offer_id == None and invoice_label != "": + bolt_version = "bolt11" + bind_to = invoice_label + elif offer_id != None: + bolt_version = "bolt12" + bind_to = offer_id + else: + raise Exception("bindprism was has some issues.") + # ensure the offer/invoice exists if bolt_version == "bolt12": - trigger = plugin.rpc.listoffers(offer_id=bind_to)["offers"] + trigger = plugin.rpc.listoffers(offer_id=offer_id)["offers"] if [trigger] == []: raise Exception("ERROR: the bolt12 offer does not exist!") elif bolt_version == "bolt11": - trigger = plugin.rpc.listinvoices(label=bind_to)["invoices"] + trigger = plugin.rpc.listinvoices(label=invoice_label)["invoices"] if trigger == []: raise Exception("ERROR: the bolt11 invoice does not exist.") add_binding_result = PrismBinding.add_binding( - plugin=plugin, bind_to=bind_to, prism_id=prism_id, bolt_version=bolt_version) + plugin=plugin, bind_to=bind_to, prism_id=prism_id, + bolt_version=bolt_version + ) return add_binding_result @plugin.method("prism-bindingremove") -def remove_prism_binding(plugin, offer_id, bolt_version="bolt12"): +def remove_prism_binding(plugin, offer_id=None, invoice_label=""): '''Removes a prism binding.''' + ## TODO implement invoice_label + bolt_version = "bolt12" + if invoice_label != "" and offer_id == None: + bolt_version = "bolt11" + try: binding = PrismBinding.get(plugin, offer_id, bolt_version) @@ -194,41 +251,28 @@ def prism_execute(plugin, prism_id, amount_msat=0, label=""): '''Executes (pays-out) a prism.''' plugin.log( - f"In prism_execute with prism_ID {prism_id} and amount = {amount_msat}") + f"In prism-pay with prism_ID {prism_id} and amount = {amount_msat}") if not isinstance(amount_msat, int): raise Exception("ERROR: amount_msat is the incorrect type.") if amount_msat <= 0: - plugin.log(f"ERROR: amount_msat must be greater than 0.") raise Exception("ERROR: amount_msat must be greater than 0.") - # # TODO; first thing we should do here probably is update the Prism with new outlay values. - # # that way we can immediately record/persist - plugin.log(f"{amount_msat}") - plugin.log( - f"Starting prism_execute for prism_id: {prism_id} for {amount_msat}msats.") - prism = Prism.get(plugin, prism_id) if prism is None: raise Exception("ERROR: could not find prism.") - # if prism.members is None: - # raise Exception(f"ERROR: Could not extract prism_members for prism {prism_id}") - plugin.log("PAYING") pay_results = prism.pay(amount_msat=amount_msat) return { "prism_member_payouts": pay_results } - @plugin.subscribe("invoice_payment") def on_payment(plugin, invoice_payment, **kwargs): - #plugin.log(f"Incoming invoice_payment {invoice_payment}", 'info') - # try: payment_label = invoice_payment["label"] #plugin.log(f"payment_label: {payment_label}") @@ -239,40 +283,32 @@ def on_payment(plugin, invoice_payment, **kwargs): return bind_to = None - bind_type = None + bolt_version = None # invoices will likely be generated from BOLT 12 if "local_offer_id" in invoice: bind_to = invoice["local_offer_id"] - bind_type = "bolt12" + bolt_version = "bolt12" else: bind_to = payment_label - bind_type = "bolt11" + bolt_version = "bolt11" # TODO: return PrismBinding.get as class member rather than json binding = None - binding = PrismBinding.get(plugin, bind_to, bind_type) - - #plugin.log(f"binding: {binding.id}") - if not binding: - plugin.log("Incoming payment not associated with prism binding. Nothing to do.", "info") + try: + binding = PrismBinding.get(plugin, bind_to, bolt_version) + except Exception as e: + plugin.log("Incoming payment not associated with prism binding. Skipping.", "info") return # try: amount_msat = invoice_payment['msat'] plugin.log(f"amount_msat: {amount_msat}") binding.pay(amount_msat=int(amount_msat)) - # except Exception as e: - # plugin.log( - # f"ERROR: something went wrong with binding payout {binding.prism.id}. {e}") - # invoices can only be paid once, so we delete the bolt11 binding - if bind_type == "bolt11": - PrismBinding.delete(plugin, bind_to, bolt_version=bind_type) - - # except Exception as e: - # plugin.log(f"invoice_payment has no prism bindings.", "info") + if bolt_version == "bolt11": + PrismBinding.delete(plugin, bind_to, bolt_version=bolt_version) plugin.run() # Run our plugin diff --git a/contrib/jupyter/.ipynb_checkpoints/create-checkpoint.ipynb b/contrib/jupyter/.ipynb_checkpoints/create-checkpoint.ipynb index 363fcab..f43a4eb 100644 --- a/contrib/jupyter/.ipynb_checkpoints/create-checkpoint.ipynb +++ b/contrib/jupyter/.ipynb_checkpoints/create-checkpoint.ipynb @@ -1,6 +1,1144 @@ { - "cells": [], - "metadata": {}, + "cells": [ + { + "cell_type": "code", + "execution_count": 36, + "id": "66c7d7e1-53cb-4456-80a8-f1af081b7a5b", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "l1's lightning-cli is: /nix/store/h198rxd1qyja377cgdr5zr91di2p9hy6-clightning-v24.02.2/bin/lightning-cli --lightning-dir=/home/gudnuf/code/bolt12-prism/.lightning_nodes/l1\n", + "l2's lightning-cli is: /nix/store/h198rxd1qyja377cgdr5zr91di2p9hy6-clightning-v24.02.2/bin/lightning-cli --lightning-dir=/home/gudnuf/code/bolt12-prism/.lightning_nodes/l2\n" + ] + } + ], + "source": [ + "from config import l1, l2, l3, l4, l5\n", + "import json\n", + "import random\n", + "import string\n", + "\n", + "def generate_random_string(length):\n", + " # Create a sequence of all letters and digits\n", + " characters = string.ascii_letters + string.digits\n", + " # Randomly choose a character from the sequence for the specified length\n", + " random_string = ''.join(random.choice(characters) for i in range(length))\n", + " return random_string\n", + "\n", + "def setup_network(lightning_clis):\n", + " for cli in lightning_clis:\n", + " out = !cli getinfo\n", + " print(out)\n", + "\n", + "#setup_network([l1,l2,l3,l4,l5])\n", + "\n", + "print(\"l1's lightning-cli is: \", l1)\n", + "print(\"l2's lightning-cli is: \", l2)" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "id": "f2727f12-519f-4a25-9b66-8955d42d8f3a", + "metadata": {}, + "outputs": [], + "source": [ + "def create_prism_members():\n", + " members = []\n", + " clis = [l3, l4, l5]\n", + " names = [\"carol {}\".format({generate_random_string(3)}) , \"Dave\", \"erin\"]\n", + " for cli, name in zip(clis, names):\n", + " get_offer = f'{cli} -k offer amount=any description={generate_random_string(12)}'\n", + " offer = !$get_offer | jq -r .bolt12\n", + " members.append({\n", + " \"label\": name,\n", + " \"destination\": offer[0],\n", + " \"split\": 1,\n", + " \"payout_threshold_msat\": \"100000\"\n", + " })\n", + " return members" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "id": "9888ffd9-4ab7-40d3-9fd9-979240eda650", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'prism_id': 'cfe57707-5391-4363-ae86-d2fe4620ccdb',\n", + " 'timestamp': 1715548706,\n", + " 'outlay_factor': 1.0,\n", + " 'prism_members': [{'member_id': '69de6dbb-6cfe-4ac4-b7af-e620b4283982',\n", + " 'label': 'carol {BWv}',\n", + " 'destination': 'lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3r5u4nr29xxw4jngdr4593pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz',\n", + " 'split': 1,\n", + " 'fees_incurred_by': 'remote',\n", + " 'payout_threshold_msat': '100000'},\n", + " {'member_id': '07e1e1ba-7869-4c75-bd77-f9031a1d1dab',\n", + " 'label': 'Dave',\n", + " 'destination': 'lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3mxxa66w9ukk32ew449g93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5',\n", + " 'split': 1,\n", + " 'fees_incurred_by': 'remote',\n", + " 'payout_threshold_msat': '100000'},\n", + " {'member_id': 'da392519-c3f1-4b84-b033-985d4c9609a9',\n", + " 'label': 'erin',\n", + " 'destination': 'lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p38nwwrhd9xkjanx2afkw93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66',\n", + " 'split': 1,\n", + " 'fees_incurred_by': 'remote',\n", + " 'payout_threshold_msat': '100000'}]}" + ] + }, + "execution_count": 40, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "prism_members = create_prism_members()\n", + "#lightning-cli -k prism-create members='[]'\n", + "create_prism_command = f'{l2} -k prism-create members=\\'{json.dumps(prism_members)}\\''\n", + "prism = !$create_prism_command\n", + "prism = json.loads(''.join(prism))\n", + "prism" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "id": "5fb87195-8774-4a46-bc39-cd826853298a", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"prisms\": [\n", + " {\n", + " \"prism_id\": \"cfe57707-5391-4363-ae86-d2fe4620ccdb\",\n", + " \"timestamp\": 1715548706,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"69de6dbb-6cfe-4ac4-b7af-e620b4283982\",\n", + " \"label\": \"carol {BWv}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3r5u4nr29xxw4jngdr4593pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"100000\"\n", + " },\n", + " {\n", + " \"member_id\": \"07e1e1ba-7869-4c75-bd77-f9031a1d1dab\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3mxxa66w9ukk32ew449g93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"100000\"\n", + " },\n", + " {\n", + " \"member_id\": \"da392519-c3f1-4b84-b033-985d4c9609a9\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p38nwwrhd9xkjanx2afkw93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"100000\"\n", + " }\n", + " ]\n", + " }\n", + " ]\n", + "}\n" + ] + } + ], + "source": [ + "prism_show_command = f'{l2} prism-list {prism.get(\"prism_id\")}'\n", + "!$prism_show_command" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "id": "d20e6830-1c55-41f9-8f72-d32f402f7e3e", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"prisms\": [\n", + " {\n", + " \"prism_id\": \"0ab91c5f-0356-4913-84cd-3f2787e79e36\",\n", + " \"timestamp\": 1715545229,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"9cb1b315-0e00-4b28-a414-70d88e196018\",\n", + " \"label\": \"carol {AsE}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3g8scj4gajh23n4gd5rq93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"b05e54ba-9563-4b9e-a513-c59487212b12\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p324w4j0dashsknxgdp4x93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"3b3955cd-e9f1-4123-bb50-2af22527d158\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p365j32gwfr9z3nw892hy93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"13dfa796-30f0-46d8-8ddc-dbe4520cdbf0\",\n", + " \"timestamp\": null,\n", + " \"outlay_factor\": null,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"e96d9723-1c41-4472-8c01-f657442dc2c1\",\n", + " \"label\": \"carol {fEv}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3p8w6mwfak9s6fhgap5y93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"fef92cbb-78ee-49c5-bd5a-670c2ec4f738\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3v55wz2wv69zkf309dyg93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"e80da8ab-aed8-4ae0-8acf-c28048f4c0da\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3z95ez3dfhxu6r8f4cky93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"21f8a72a-89af-4f8c-a66c-7d8144640c89\",\n", + " \"timestamp\": 1715545064,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"df9f4d54-c004-42f1-982d-a85efdcae009\",\n", + " \"label\": \"carol {w6z}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3rk7ezddehr2425xfv9293pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"9f7ab91d-961b-4480-b12c-db9a5d3e1a10\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2psuhs7tkdexhx5rddenx593pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"c24dde81-cbb3-4d31-9aae-2eacb9fd1bb2\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p39yzdjcfq6rj5r5vau4593pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"26f23263-129a-4448-bb3c-2240c5647f3b\",\n", + " \"timestamp\": 1715544722,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"5830665d-7f1c-4642-837e-7a1504acef41\",\n", + " \"label\": \"carol {jqY}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p328v7j5f5cyv7pn0pmy793pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"aad45a5d-4ed2-4a6d-a8d5-0578a5f95705\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3y52vnpvetkucf4ffxk593pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"bb2ee47d-ba50-410e-985c-293ca715f7f9\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2ps6kzk2e2dv9z7jswa84v93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"3b9073c8-e111-4820-8162-7ddb938ec348\",\n", + " \"timestamp\": 1715544946,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"54c2054f-9d33-4a1c-a638-3887697474a5\",\n", + " \"label\": \"carol {Q79}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3thqmztv9khqnmg2pd9g93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"3aa70313-efa7-4f18-bd31-1d9f934059eb\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3s4wcn6fve4vvryg9s4w93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"c0b3eebb-b3b7-4d06-9e1c-3c4b917a47a6\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2ps6xy6z5d4ek546jxd2yu93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"5f87fcd4-a59f-4e79-9cc2-a6bfc9094170\",\n", + " \"timestamp\": 1715544606,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"794f582e-9301-483d-b314-64615b84e385\",\n", + " \"label\": \"carol {O5H}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3jyy5jv2p44gc2w23uhs93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"3af475b1-9cfe-4be9-b486-fa6ac65fe639\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p33hjcmwdcuxjm63v4r9j93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"edeaabc2-dcfb-418c-b921-7a876730738d\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2psurzv6cwfd8wnfkfcmxc93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"94e7080b-3e7c-4a03-9407-5baec58c7429\",\n", + " \"timestamp\": 1715545371,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"03bd5e3c-1bf7-4b9e-a1b7-690ccea19686\",\n", + " \"label\": \"carol {yo8}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3zrqkztw469q6jcveprs93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"f411ea87-c5cc-4b80-8d2b-a8c9693d6407\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3ykuet3gee4vnmdg444293pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"98a80368-aeeb-4317-9442-7991cfd750e1\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3zk74t3ve6xy4eex388w93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"98401736-e858-4696-b5d3-dc52b3a447f6\",\n", + " \"timestamp\": 1715545420,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"6ecb3b3d-2008-4fbc-9fe8-9d868952dec3\",\n", + " \"label\": \"carol {V9j}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3gk636h898kkernxg64v93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"d146a91f-ef82-4398-94df-c4ccf3050f59\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3jxk4jvv9pnxvz9wf9y593pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"3dd653a0-a68b-4b29-95fc-810de26ed60a\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3v9q3tktfp8x4pkw9v5u93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"9962bb81-93d7-422d-a770-26760da81eef\",\n", + " \"timestamp\": 1715544535,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"a93e359c-f97b-452a-a8f0-b6196ee7f6c2\",\n", + " \"label\": \"carol {WBq}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2psc52dr48p4yjcjcxcehw93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"7bef0587-2250-4dfa-a5db-bca046d4f44e\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3rr2nj38p3yzjzy2564593pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"35706d6c-559e-4380-8830-34aa399dcbb9\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3ghxnz5xp64gw28g959593pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"cfe57707-5391-4363-ae86-d2fe4620ccdb\",\n", + " \"timestamp\": 1715548706,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"69de6dbb-6cfe-4ac4-b7af-e620b4283982\",\n", + " \"label\": \"carol {BWv}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3r5u4nr29xxw4jngdr4593pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"100000\"\n", + " },\n", + " {\n", + " \"member_id\": \"07e1e1ba-7869-4c75-bd77-f9031a1d1dab\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3mxxa66w9ukk32ew449g93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"100000\"\n", + " },\n", + " {\n", + " \"member_id\": \"da392519-c3f1-4b84-b033-985d4c9609a9\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p38nwwrhd9xkjanx2afkw93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"100000\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"d2bb453b-9388-400c-a737-e686075eee75\",\n", + " \"timestamp\": 1715545142,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"6232a22d-99cb-47b3-9194-c251eb01ac17\",\n", + " \"label\": \"carol {yJS}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3c4vd2yd3g8wm2h24x8x93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"80754a85-7e27-4477-8e82-0b2f528a302f\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3vh2stvt9f5636dxdm8v93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"a4678b02-10ed-4197-b5eb-90d804cb5123\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3cxxe24d3h5yjz0g99hq93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"dc95b284-3310-4145-832c-8bc1689176a8\",\n", + " \"timestamp\": 1715545299,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"7d72b585-64d2-4492-b876-a481b90ea874\",\n", + " \"label\": \"carol {G23}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3g8gs2v0pz5ceee0p9hs93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"499d15eb-33aa-47e1-a5fc-52dcbeaeddb3\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3pk56mt2p8x7enwgauxv93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"a73e1c03-b140-4105-b6ab-78d5d8303b14\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3jnwa3sfc6rsa6zv3ax593pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"e3bf07e6-615c-4aff-8174-c6ad4cf98081\",\n", + " \"timestamp\": 1714331443,\n", + " \"outlay_factor\": null,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"2a08b48d-6640-43dd-8f7e-26e01792a4e9\",\n", + " \"label\": \"carol {mcs}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2psexc7nxwazhzje4fdvxj93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"4c58fcef-20b3-42d5-97cd-cd2b6f52256d\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3h8jc6f0fgkxwzw24pns93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"36a9ee46-4d57-4527-9fbb-01f706297f7c\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2ps65s6tjga24266ptgukv93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"f3a519fb-97af-4dcf-b570-87ada3c6a383\",\n", + " \"timestamp\": 1714331057,\n", + " \"outlay_factor\": null,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"975012f0-2c35-480d-aa98-632423d2acc9\",\n", + " \"label\": \"carol {Tcf}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p36nqdz3gacx67jwva8xj93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"e03b99ce-7d5b-4b9b-84ee-d6f943da6762\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p38xjenrgcm9y32cgf9rz93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"ad3feb18-24ab-4aac-8c1a-b7e52671e80e\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3dy7ntdfpnkj6mjxe4xv93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " }\n", + " ]\n", + "}\n" + ] + } + ], + "source": [ + "!$l2 prism-list" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "id": "87655b12-681c-4000-9a55-a8dffec871b8", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"code\": -32601,\n", + " \"message\": \"Unknown command 'prism-delete'\"\n", + "}\n" + ] + } + ], + "source": [ + "delete_prism_command = f'{l2} prism-delete {prism.get(\"prism_id\")}'\n", + "!$delete_prism_command" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "44b7ffcc-f0fd-44ed-a198-afec41167d16", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"prism_id\": \"98401736-e858-4696-b5d3-dc52b3a447f6\",\n", + " \"timestamp\": 1715545420,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"6ecb3b3d-2008-4fbc-9fe8-9d868952dec3\",\n", + " \"label\": \"carol {V9j}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3gk636h898kkernxg64v93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"d146a91f-ef82-4398-94df-c4ccf3050f59\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3jxk4jvv9pnxvz9wf9y593pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"3dd653a0-a68b-4b29-95fc-810de26ed60a\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3v9q3tktfp8x4pkw9v5u93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + "}\n" + ] + } + ], + "source": [ + "update_prism_command = f'{l2} -k prism-update prism_id=\"{prism.get(\"prism_id\")}\" members=\\'{json.dumps(create_prism_members())}\\''\n", + "!$update_prism_command" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "b73364b1-b1c1-445c-a89d-d65fd4ee8ed1", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"bolt12_prism_bindings\": [\n", + " {\n", + " \"binding_id\": \"ed272d2c9af5303c281fd7b244becb65d5bc2b326c4421ade32401729db6b9d4\",\n", + " \"offer_id\": \"1421d98445bf49751612fb867d2f3651aed10a56f74b14fe5f1ea71df772818d\",\n", + " \"prism_id\": \"13dfa796-30f0-46d8-8ddc-dbe4520cdbf0\",\n", + " \"timestamp\": 0,\n", + " \"member_outlays\": [\n", + " {\n", + " \"member_id\": \"e96d9723-1c41-4472-8c01-f657442dc2c1\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"fef92cbb-78ee-49c5-bd5a-670c2ec4f738\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"e80da8ab-aed8-4ae0-8acf-c28048f4c0da\",\n", + " \"outlay_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"binding_id\": \"cca0268522924ac7519c8aaeac975df07bf44220b1ca1e47c2821e2b6b385947\",\n", + " \"offer_id\": \"17de53e5f9a39aeb762cdd07ce8b07cd6a033bac6bbfc2c3c2dcaa1fcdcb1734\",\n", + " \"prism_id\": \"13dfa796-30f0-46d8-8ddc-dbe4520cdbf0\",\n", + " \"timestamp\": 0,\n", + " \"member_outlays\": [\n", + " {\n", + " \"member_id\": \"e96d9723-1c41-4472-8c01-f657442dc2c1\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"fef92cbb-78ee-49c5-bd5a-670c2ec4f738\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"e80da8ab-aed8-4ae0-8acf-c28048f4c0da\",\n", + " \"outlay_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"binding_id\": \"3c3df04290a4123e95a9aef3d790ef611bf19d397e6a48daebb9d6d9d431d6ab\",\n", + " \"offer_id\": \"2ccb734f48d8c902faea20be31721fcaa1177af51b699a0fe17b97c3e4f1ce6c\",\n", + " \"prism_id\": \"e3bf07e6-615c-4aff-8174-c6ad4cf98081\",\n", + " \"timestamp\": 1714331581,\n", + " \"member_outlays\": [\n", + " {\n", + " \"member_id\": \"65e0caec-6d56-48d9-8b52-f4dd596f6ffa\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"841d7e25-336c-4780-be75-7d8920ecf2f5\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"4e291c78-a5b0-4209-944b-8f3b05c722e2\",\n", + " \"outlay_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"binding_id\": \"96953956188fdd3cdcdcd3e42299e16c274af2f505c2d2c924f69b47a52f7be6\",\n", + " \"offer_id\": \"622b0e9caad92a384e520c868cfa72950fe82429b4a8e9098f88fcf899f09193\",\n", + " \"prism_id\": \"e3bf07e6-615c-4aff-8174-c6ad4cf98081\",\n", + " \"timestamp\": 1714331498.3983443,\n", + " \"member_outlays\": [\n", + " {\n", + " \"member_id\": \"65e0caec-6d56-48d9-8b52-f4dd596f6ffa\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"841d7e25-336c-4780-be75-7d8920ecf2f5\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"4e291c78-a5b0-4209-944b-8f3b05c722e2\",\n", + " \"outlay_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"binding_id\": \"0ca3a59d67ed7bc07ccf063ee0b387bddb9c77541753b3c2836921a8f846d285\",\n", + " \"offer_id\": \"78428d0a48c71e124014be5057c39980157a414c063c3419d1ede43d91fcb119\",\n", + " \"prism_id\": \"98401736-e858-4696-b5d3-dc52b3a447f6\",\n", + " \"timestamp\": 1715545420,\n", + " \"member_outlays\": [\n", + " {\n", + " \"member_id\": \"7c84d572-a576-4097-9538-ce9d8f6596c6\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"0e56b46d-e0bb-4a7a-b1a0-58d5a27b83f0\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"e6a9062b-a22f-4b63-bb5a-8daaeb4a28ad\",\n", + " \"outlay_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"binding_id\": \"bfcad68bbdd769003e9dc1d646132031433da9260269bfeb3925312b403e4e07\",\n", + " \"offer_id\": \"ff547ff75f32ae3b0d1a1c5e7ac68d79c499d5e901884131234c156afbb470e1\",\n", + " \"prism_id\": \"e3bf07e6-615c-4aff-8174-c6ad4cf98081\",\n", + " \"timestamp\": 1714331685,\n", + " \"member_outlays\": [\n", + " {\n", + " \"member_id\": \"65e0caec-6d56-48d9-8b52-f4dd596f6ffa\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"841d7e25-336c-4780-be75-7d8920ecf2f5\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"4e291c78-a5b0-4209-944b-8f3b05c722e2\",\n", + " \"outlay_msat\": \"0\"\n", + " }\n", + " ]\n", + " }\n", + " ]\n", + "}\n" + ] + } + ], + "source": [ + "!$l2 prism-bindinglist" + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "id": "73cc0bdc-224b-4d7b-a9a5-acbb7761c737", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"prism_id\": \"077f8010-c5b1-4c6b-923f-dd80b7233ad0\",\n", + " \"bolt\": \"bolt12\",\n", + " \"offer_ids\": []\n", + "}\n" + ] + } + ], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 43, + "id": "3bfacd8a-e0ce-45da-b43b-635e17020f97", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "083f64e36b398b73b98cd8003894a3dcd1bc676be17b314f0a0663d6d502f5a7\n", + "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3x9y7rjxseys5jcv32kj93pqw5lzxuq0nes2h6e6fsxlat8udyytm8uzjjsf3u460cnmnae4p7gj\n" + ] + } + ], + "source": [ + "get_offer = f'{l2} -k offer amount=any description={generate_random_string(12)}'\n", + "prism_offer = !$get_offer\n", + "prism_offer = json.loads(''.join(prism_offer))\n", + "prism_offer_id = prism_offer.get(\"offer_id\")\n", + "prism_bolt12 = prism_offer.get(\"bolt12\")\n", + "\n", + "print(prism_offer_id)\n", + "print(prism_bolt12)" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "id": "11f59065-5f3a-4740-9742-348b1625a6d6", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"status\": \"must-create\",\n", + " \"timestamp\": 1715548727,\n", + " \"bind_to\": \"083f64e36b398b73b98cd8003894a3dcd1bc676be17b314f0a0663d6d502f5a7\",\n", + " \"prism_id\": \"cfe57707-5391-4363-ae86-d2fe4620ccdb\",\n", + " \"prism_binding_key\": [\n", + " \"prism\",\n", + " \"v2\",\n", + " \"bind\",\n", + " \"bolt12\",\n", + " \"083f64e36b398b73b98cd8003894a3dcd1bc676be17b314f0a0663d6d502f5a7\"\n", + " ],\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"69de6dbb-6cfe-4ac4-b7af-e620b4283982\",\n", + " \"label\": \"carol {BWv}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3r5u4nr29xxw4jngdr4593pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"100000\"\n", + " },\n", + " {\n", + " \"member_id\": \"07e1e1ba-7869-4c75-bd77-f9031a1d1dab\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3mxxa66w9ukk32ew449g93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"100000\"\n", + " },\n", + " {\n", + " \"member_id\": \"da392519-c3f1-4b84-b033-985d4c9609a9\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p38nwwrhd9xkjanx2afkw93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"100000\"\n", + " }\n", + " ]\n", + "}\n" + ] + } + ], + "source": [ + "prism_id=prism.get(\"prism_id\")\n", + "\n", + "def bind_prism_to_offer(prism_id, offer_id):\n", + " bind_to = f'{l2} prism-bindingadd -k prism_id={prism_id} offer_id={offer_id}'\n", + " !$bind_to\n", + "\n", + "bind_prism_to_offer(prism_id=prism_id, offer_id=prism_offer_id)\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "id": "6b24d85d-ffd9-42cf-9574-5d228c7a81b4", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"bolt12_prism_bindings\": {\n", + " \"binding_id\": \"1827e7ad306db7a964f6ea005c29231aadd67612b7dfda9db426fd96ec906c77\",\n", + " \"offer_id\": \"083f64e36b398b73b98cd8003894a3dcd1bc676be17b314f0a0663d6d502f5a7\",\n", + " \"prism_id\": \"cfe57707-5391-4363-ae86-d2fe4620ccdb\",\n", + " \"timestamp\": 1715548727,\n", + " \"member_outlays\": [\n", + " {\n", + " \"member_id\": \"69de6dbb-6cfe-4ac4-b7af-e620b4283982\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"07e1e1ba-7869-4c75-bd77-f9031a1d1dab\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"da392519-c3f1-4b84-b033-985d4c9609a9\",\n", + " \"outlay_msat\": \"0\"\n", + " }\n", + " ]\n", + " }\n", + "}\n" + ] + } + ], + "source": [ + "#!$l2 prism-bindinglist\n", + "show_binding_command = f'{l2} -k prism-bindinglist offer_id={prism_offer_id}'\n", + "!$show_binding_command" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "id": "fd69c329-ed05-40b5-97ba-d76168a77e98", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "lni1qqgrdxrmg3l4a7wk0wq7rx6jmlcr6q3qqc3xu3s3rg94nj40zfsy866mhu5vxne6tcej5878k2mneuvgjy8s5rzv2fu8ydpjfpf9sez4dytzzqaf7ydcql8nq404n5nqdl6k0c6gghk0c999qnret5l38h8mn2ru39gzqp3zderpzxstt8927ynqg044h0egcd8n5h3n9g0u0v4h8ncc3yg02gpsrp4qtqssy8yltye4jzdxqrve3nxljzc07tawuwdexvy98jd0jh4pgyqfpwqk5zvq8203rwq8euc9tavaycr074n7xjz9an7pffgyc72a8ufae7u6slyfqvfe6hsjuyke79452s2sw0yuhh0pt762npezx4axvpv03m7tecepcqgzh2697ymlclxajz0un5w7p23d3krty9asn88388h7d7n7des692msqvn3ma02kcmt526h234fu267dddld4ya0038apl8ne4awvlf7r0qur9pl3zgv8wqpwaysrga37xvnym2h34zrsqqqqqqqqqqqqqqpgqqqqqqqqqqqqqayjedltzjqqqqqq9yq3nyzvhh4qsqe80f883urdz7xnugpa62y7xx7xj49vzqgv0zujkte99zl3eats92qvqcdg9syyp6nugmsp70xp2lt8fxqml4vl35s30vls222px8jhflz0w0hx58ez0sgp9e060lelvu69vuasdyw4t5x4qlhdtp5p3ehrqdqykgxh42kex07j6kp45mu7y4htf90s7ar33lgjp6n3xal0q5dkmns0v8wq2km799\n" + ] + } + ], + "source": [ + "def get_invoice_from_offer(lightning_cli, bolt12, amount_msat):\n", + " fetch_invoice = f'{lightning_cli} fetchinvoice {bolt12} {amount_msat}'\n", + " invoice = !$fetch_invoice\n", + " return json.loads(''.join(invoice)).get('invoice')\n", + "\n", + "invoice = get_invoice_from_offer(l1, prism_bolt12, 100000) \n", + "\n", + "print(invoice)" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "id": "cadabf7c-5f5c-4efc-a1fa-b1fe8db83cf9", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"destination\": \"03a9f11b807cf3055f59d2606ff567e34845ecfc14a504c795d3f13dcfb9a87c89\",\n", + " \"payment_hash\": \"0c9de939e3c1b45e34f880f74a278c6f1a552b040431e2e4acbc94a2fc73d5c0\",\n", + " \"created_at\": 1715548919.885159434,\n", + " \"parts\": 1,\n", + " \"amount_msat\": 100000,\n", + " \"amount_sent_msat\": 100000,\n", + " \"payment_preimage\": \"8fcfbc91430b691e91519d2a8761535febc0d647708de000eac2d123529e3001\",\n", + " \"status\": \"complete\"\n", + "}\n" + ] + } + ], + "source": [ + "def pay_invoice(lightning_cli, invoice):\n", + " pay_invoice = f'{lightning_cli} pay {invoice}'\n", + " !$pay_invoice\n", + "\n", + "pay_invoice(l1, invoice)" + ] + }, + { + "cell_type": "raw", + "id": "68fbb18a-f453-47e4-9bde-99dfaa09afb3", + "metadata": {}, + "source": [ + "def pay_prism(lightning_cli, prism_id, amount_msat):\n", + " pay = f'{lightning_cli} prism-pay {prism_id} {amount_msat}'\n", + " !$pay\n", + "\n", + "pay_prism(l2, prism_id, 100000)" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "id": "266b2089-c602-4185-83a9-d74a58a3e012", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"prism_member_payouts\": {\n", + " \"69de6dbb-6cfe-4ac4-b7af-e620b4283982\": {\n", + " \"destination\": \"0201e0a1624499d8ec6debd242c58d08101a7322533b5a55a39a1030e9a1b4da11\",\n", + " \"payment_hash\": \"fbbda001d3bb82cb9ce934e312687eb5507b1e88dc6121585939cd4e81535882\",\n", + " \"created_at\": 1715549097.881403,\n", + " \"parts\": 1,\n", + " \"amount_msat\": \"33333msat\",\n", + " \"amount_sent_msat\": \"33333msat\",\n", + " \"payment_preimage\": \"5c4fc2b8d1669f0a7117699cd022ce67a696157053a9d99ab02272c953759872\",\n", + " \"status\": \"complete\"\n", + " },\n", + " \"07e1e1ba-7869-4c75-bd77-f9031a1d1dab\": {\n", + " \"destination\": \"03bb87120a3664b77b9e340df4614b1d9f9e2f1e2bd2258955b3f9b1bbb7cea5da\",\n", + " \"payment_hash\": \"68eeada8c8c60265bd93225fdf91199504ce0f1c1ad30fde46380f3e77a6ba42\",\n", + " \"created_at\": 1715549098.8109088,\n", + " \"parts\": 1,\n", + " \"amount_msat\": \"33333msat\",\n", + " \"amount_sent_msat\": \"33333msat\",\n", + " \"payment_preimage\": \"ff887c6a9c528aa6ad7a5665ffd439727e1f61973c1f7efc9d296896d8680237\",\n", + " \"status\": \"complete\"\n", + " },\n", + " \"da392519-c3f1-4b84-b033-985d4c9609a9\": {\n", + " \"destination\": \"02dff99f1b5647a7d80065d6ed745f513a9cbb61a0c119eaa406016ffde92817ad\",\n", + " \"payment_hash\": \"ccf05f1224767049ff7baef3071ae2455ccafb48546c41c1685a2f0f2b97088b\",\n", + " \"created_at\": 1715549099.7399845,\n", + " \"parts\": 1,\n", + " \"amount_msat\": \"33333msat\",\n", + " \"amount_sent_msat\": \"33333msat\",\n", + " \"payment_preimage\": \"3ce2ae72e76101158dfeeca5f94f31e562b26205c5ced0c8aed25035239e4b0a\",\n", + " \"status\": \"complete\"\n", + " }\n", + " }\n", + "}\n" + ] + } + ], + "source": [ + "def pay_prism(lightning_cli, prism_id, amount_msat):\n", + " pay = f'{lightning_cli} prism-pay {prism_id} {amount_msat}'\n", + " !$pay\n", + "\n", + "pay_prism(l2, prism_id, 100000)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f3bcfbfa-214c-4acd-a116-4edc05ddf9c7", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.7" + } + }, "nbformat": 4, "nbformat_minor": 5 } diff --git a/contrib/jupyter/create.ipynb b/contrib/jupyter/create.ipynb index 362c316..f43a4eb 100644 --- a/contrib/jupyter/create.ipynb +++ b/contrib/jupyter/create.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 12, + "execution_count": 36, "id": "66c7d7e1-53cb-4456-80a8-f1af081b7a5b", "metadata": {}, "outputs": [ @@ -41,7 +41,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 39, "id": "f2727f12-519f-4a25-9b66-8955d42d8f3a", "metadata": {}, "outputs": [], @@ -56,15 +56,15 @@ " members.append({\n", " \"label\": name,\n", " \"destination\": offer[0],\n", - " \"type\": \"bolt12\",\n", - " \"split\": 1\n", + " \"split\": 1,\n", + " \"payout_threshold_msat\": \"100000\"\n", " })\n", " return members" ] }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 40, "id": "9888ffd9-4ab7-40d3-9fd9-979240eda650", "metadata": { "scrolled": true @@ -73,28 +73,30 @@ { "data": { "text/plain": [ - "{'prism_id': 'a9f1c094-cbc9-45c3-9632-cdcc2929caa8',\n", - " 'prism_members': [{'member_id': 'a8a938fa-7d81-4aae-b671-0b460cf97d9b',\n", - " 'label': 'carol {C1m}',\n", - " 'destination': 'lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3phswrpvfjk7ejv89e5g93pqgfjkx3qvsv22wj39220cpesvsdmsyuvegaad6wsdw7lsahrkv4sw',\n", + "{'prism_id': 'cfe57707-5391-4363-ae86-d2fe4620ccdb',\n", + " 'timestamp': 1715548706,\n", + " 'outlay_factor': 1.0,\n", + " 'prism_members': [{'member_id': '69de6dbb-6cfe-4ac4-b7af-e620b4283982',\n", + " 'label': 'carol {BWv}',\n", + " 'destination': 'lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3r5u4nr29xxw4jngdr4593pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz',\n", " 'split': 1,\n", " 'fees_incurred_by': 'remote',\n", - " 'payout_threshold': '0msat'},\n", - " {'member_id': '11ec6990-613f-4287-9687-73b7800bd9c6',\n", + " 'payout_threshold_msat': '100000'},\n", + " {'member_id': '07e1e1ba-7869-4c75-bd77-f9031a1d1dab',\n", " 'label': 'Dave',\n", - " 'destination': 'lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p339wmp4favkw5n2dpy9s93pq032lzz97ehk7fxvn4lqgdz6kmpvfw54m6dkt8ahhnn0vyxulm375',\n", + " 'destination': 'lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3mxxa66w9ukk32ew449g93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5',\n", " 'split': 1,\n", " 'fees_incurred_by': 'remote',\n", - " 'payout_threshold': '0msat'},\n", - " {'member_id': '554e038f-266e-4788-805b-ec3a41f887c9',\n", + " 'payout_threshold_msat': '100000'},\n", + " {'member_id': 'da392519-c3f1-4b84-b033-985d4c9609a9',\n", " 'label': 'erin',\n", - " 'destination': 'lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3p4w6nsg4u4v4nfwe6yv93pqgmlacrhla00z62s9z8yfu5uh0s50c02lwtmaucz24qzzyaemretx',\n", + " 'destination': 'lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p38nwwrhd9xkjanx2afkw93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66',\n", " 'split': 1,\n", " 'fees_incurred_by': 'remote',\n", - " 'payout_threshold': '0msat'}]}" + " 'payout_threshold_msat': '100000'}]}" ] }, - "execution_count": 14, + "execution_count": 40, "metadata": {}, "output_type": "execute_result" } @@ -110,7 +112,7 @@ }, { "cell_type": "code", - "execution_count": 88, + "execution_count": 41, "id": "5fb87195-8774-4a46-bc39-cd826853298a", "metadata": { "scrolled": true @@ -121,36 +123,37 @@ "output_type": "stream", "text": [ "{\n", - " \"prism_id\": \"2072b63d-c422-4db3-9db0-10e223bbe7f8\",\n", - " \"version\": \"v0.0.2\",\n", - " \"sdf\": \"relative\",\n", - " \"members\": [\n", - " {\n", - " \"name\": \"carol {g3N}\",\n", - " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3g4yk2r0fey7ured498y93pqfx9yx7yz2utew9j8d84p975w4n6fvm0dkqsv4phexzehjkwrt2ry\",\n", - " \"split\": 1,\n", - " \"type\": \"bolt12\",\n", - " \"outlay_msat\": null,\n", - " \"fees_incurred_by\": \"remote\",\n", - " \"threshold\": 0\n", - " },\n", - " {\n", - " \"name\": \"Dave\",\n", - " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3mhg6jvvye8gjrxw4uk593pqfuhd5s96s38hl9svuyulalxxq5cz2sd7tz062sfe4chntf3v4v6c\",\n", - " \"split\": 1,\n", - " \"type\": \"bolt12\",\n", - " \"outlay_msat\": null,\n", - " \"fees_incurred_by\": \"remote\",\n", - " \"threshold\": 0\n", - " },\n", + " \"prisms\": [\n", " {\n", - " \"name\": \"erin\",\n", - " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3t8x4mvff29gezx09c5y93pqfzjd89nwfavtpv7leu0n8dn2jev4cnlfzthv878jwpm022ykavp5\",\n", - " \"split\": 1,\n", - " \"type\": \"bolt12\",\n", - " \"outlay_msat\": null,\n", - " \"fees_incurred_by\": \"remote\",\n", - " \"threshold\": 0\n", + " \"prism_id\": \"cfe57707-5391-4363-ae86-d2fe4620ccdb\",\n", + " \"timestamp\": 1715548706,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"69de6dbb-6cfe-4ac4-b7af-e620b4283982\",\n", + " \"label\": \"carol {BWv}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3r5u4nr29xxw4jngdr4593pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"100000\"\n", + " },\n", + " {\n", + " \"member_id\": \"07e1e1ba-7869-4c75-bd77-f9031a1d1dab\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3mxxa66w9ukk32ew449g93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"100000\"\n", + " },\n", + " {\n", + " \"member_id\": \"da392519-c3f1-4b84-b033-985d4c9609a9\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p38nwwrhd9xkjanx2afkw93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"100000\"\n", + " }\n", + " ]\n", " }\n", " ]\n", "}\n" @@ -158,13 +161,13 @@ } ], "source": [ - "prism_show_command = f'{l2} prism-show {prism.get(\"prism_id\")}'\n", + "prism_show_command = f'{l2} prism-list {prism.get(\"prism_id\")}'\n", "!$prism_show_command" ] }, { "cell_type": "code", - "execution_count": 77, + "execution_count": 42, "id": "d20e6830-1c55-41f9-8f72-d32f402f7e3e", "metadata": { "scrolled": true @@ -174,42 +177,444 @@ "name": "stdout", "output_type": "stream", "text": [ - "[\n", - " {\n", - " \"prism_id\": \"2072b63d-c422-4db3-9db0-10e223bbe7f8\",\n", - " \"version\": \"v0.0.2\",\n", - " \"sdf\": \"relative\",\n", - " \"members\": [\n", - " {\n", - " \"name\": \"carol\",\n", - " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2ps68yuzx23nnz7tddpvrq93pqfx9yx7yz2utew9j8d84p975w4n6fvm0dkqsv4phexzehjkwrt2ry\",\n", - " \"split\": 1,\n", - " \"type\": \"bolt12\",\n", - " \"outlay_msat\": null,\n", - " \"fees_incurred_by\": \"remote\",\n", - " \"threshold\": 0\n", - " },\n", - " {\n", - " \"name\": \"Dave\",\n", - " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p368xv6kxg6k2w2c8pc8293pqfuhd5s96s38hl9svuyulalxxq5cz2sd7tz062sfe4chntf3v4v6c\",\n", - " \"split\": 1,\n", - " \"type\": \"bolt12\",\n", - " \"outlay_msat\": null,\n", - " \"fees_incurred_by\": \"remote\",\n", - " \"threshold\": 0\n", - " },\n", - " {\n", - " \"name\": \"erin\",\n", - " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p36h2dmx0pqnqepetg6kv93pqfzjd89nwfavtpv7leu0n8dn2jev4cnlfzthv878jwpm022ykavp5\",\n", - " \"split\": 1,\n", - " \"type\": \"bolt12\",\n", - " \"outlay_msat\": null,\n", - " \"fees_incurred_by\": \"remote\",\n", - " \"threshold\": 0\n", - " }\n", - " ]\n", - " }\n", - "]\n" + "{\n", + " \"prisms\": [\n", + " {\n", + " \"prism_id\": \"0ab91c5f-0356-4913-84cd-3f2787e79e36\",\n", + " \"timestamp\": 1715545229,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"9cb1b315-0e00-4b28-a414-70d88e196018\",\n", + " \"label\": \"carol {AsE}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3g8scj4gajh23n4gd5rq93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"b05e54ba-9563-4b9e-a513-c59487212b12\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p324w4j0dashsknxgdp4x93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"3b3955cd-e9f1-4123-bb50-2af22527d158\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p365j32gwfr9z3nw892hy93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"13dfa796-30f0-46d8-8ddc-dbe4520cdbf0\",\n", + " \"timestamp\": null,\n", + " \"outlay_factor\": null,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"e96d9723-1c41-4472-8c01-f657442dc2c1\",\n", + " \"label\": \"carol {fEv}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3p8w6mwfak9s6fhgap5y93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"fef92cbb-78ee-49c5-bd5a-670c2ec4f738\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3v55wz2wv69zkf309dyg93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"e80da8ab-aed8-4ae0-8acf-c28048f4c0da\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3z95ez3dfhxu6r8f4cky93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"21f8a72a-89af-4f8c-a66c-7d8144640c89\",\n", + " \"timestamp\": 1715545064,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"df9f4d54-c004-42f1-982d-a85efdcae009\",\n", + " \"label\": \"carol {w6z}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3rk7ezddehr2425xfv9293pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"9f7ab91d-961b-4480-b12c-db9a5d3e1a10\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2psuhs7tkdexhx5rddenx593pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"c24dde81-cbb3-4d31-9aae-2eacb9fd1bb2\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p39yzdjcfq6rj5r5vau4593pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"26f23263-129a-4448-bb3c-2240c5647f3b\",\n", + " \"timestamp\": 1715544722,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"5830665d-7f1c-4642-837e-7a1504acef41\",\n", + " \"label\": \"carol {jqY}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p328v7j5f5cyv7pn0pmy793pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"aad45a5d-4ed2-4a6d-a8d5-0578a5f95705\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3y52vnpvetkucf4ffxk593pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"bb2ee47d-ba50-410e-985c-293ca715f7f9\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2ps6kzk2e2dv9z7jswa84v93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"3b9073c8-e111-4820-8162-7ddb938ec348\",\n", + " \"timestamp\": 1715544946,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"54c2054f-9d33-4a1c-a638-3887697474a5\",\n", + " \"label\": \"carol {Q79}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3thqmztv9khqnmg2pd9g93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"3aa70313-efa7-4f18-bd31-1d9f934059eb\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3s4wcn6fve4vvryg9s4w93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"c0b3eebb-b3b7-4d06-9e1c-3c4b917a47a6\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2ps6xy6z5d4ek546jxd2yu93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"5f87fcd4-a59f-4e79-9cc2-a6bfc9094170\",\n", + " \"timestamp\": 1715544606,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"794f582e-9301-483d-b314-64615b84e385\",\n", + " \"label\": \"carol {O5H}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3jyy5jv2p44gc2w23uhs93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"3af475b1-9cfe-4be9-b486-fa6ac65fe639\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p33hjcmwdcuxjm63v4r9j93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"edeaabc2-dcfb-418c-b921-7a876730738d\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2psurzv6cwfd8wnfkfcmxc93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"94e7080b-3e7c-4a03-9407-5baec58c7429\",\n", + " \"timestamp\": 1715545371,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"03bd5e3c-1bf7-4b9e-a1b7-690ccea19686\",\n", + " \"label\": \"carol {yo8}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3zrqkztw469q6jcveprs93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"f411ea87-c5cc-4b80-8d2b-a8c9693d6407\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3ykuet3gee4vnmdg444293pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"98a80368-aeeb-4317-9442-7991cfd750e1\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3zk74t3ve6xy4eex388w93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"98401736-e858-4696-b5d3-dc52b3a447f6\",\n", + " \"timestamp\": 1715545420,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"6ecb3b3d-2008-4fbc-9fe8-9d868952dec3\",\n", + " \"label\": \"carol {V9j}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3gk636h898kkernxg64v93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"d146a91f-ef82-4398-94df-c4ccf3050f59\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3jxk4jvv9pnxvz9wf9y593pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"3dd653a0-a68b-4b29-95fc-810de26ed60a\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3v9q3tktfp8x4pkw9v5u93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"9962bb81-93d7-422d-a770-26760da81eef\",\n", + " \"timestamp\": 1715544535,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"a93e359c-f97b-452a-a8f0-b6196ee7f6c2\",\n", + " \"label\": \"carol {WBq}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2psc52dr48p4yjcjcxcehw93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"7bef0587-2250-4dfa-a5db-bca046d4f44e\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3rr2nj38p3yzjzy2564593pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"35706d6c-559e-4380-8830-34aa399dcbb9\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3ghxnz5xp64gw28g959593pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"cfe57707-5391-4363-ae86-d2fe4620ccdb\",\n", + " \"timestamp\": 1715548706,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"69de6dbb-6cfe-4ac4-b7af-e620b4283982\",\n", + " \"label\": \"carol {BWv}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3r5u4nr29xxw4jngdr4593pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"100000\"\n", + " },\n", + " {\n", + " \"member_id\": \"07e1e1ba-7869-4c75-bd77-f9031a1d1dab\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3mxxa66w9ukk32ew449g93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"100000\"\n", + " },\n", + " {\n", + " \"member_id\": \"da392519-c3f1-4b84-b033-985d4c9609a9\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p38nwwrhd9xkjanx2afkw93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"100000\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"d2bb453b-9388-400c-a737-e686075eee75\",\n", + " \"timestamp\": 1715545142,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"6232a22d-99cb-47b3-9194-c251eb01ac17\",\n", + " \"label\": \"carol {yJS}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3c4vd2yd3g8wm2h24x8x93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"80754a85-7e27-4477-8e82-0b2f528a302f\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3vh2stvt9f5636dxdm8v93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"a4678b02-10ed-4197-b5eb-90d804cb5123\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3cxxe24d3h5yjz0g99hq93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"dc95b284-3310-4145-832c-8bc1689176a8\",\n", + " \"timestamp\": 1715545299,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"7d72b585-64d2-4492-b876-a481b90ea874\",\n", + " \"label\": \"carol {G23}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3g8gs2v0pz5ceee0p9hs93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"499d15eb-33aa-47e1-a5fc-52dcbeaeddb3\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3pk56mt2p8x7enwgauxv93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"a73e1c03-b140-4105-b6ab-78d5d8303b14\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3jnwa3sfc6rsa6zv3ax593pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"e3bf07e6-615c-4aff-8174-c6ad4cf98081\",\n", + " \"timestamp\": 1714331443,\n", + " \"outlay_factor\": null,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"2a08b48d-6640-43dd-8f7e-26e01792a4e9\",\n", + " \"label\": \"carol {mcs}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2psexc7nxwazhzje4fdvxj93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"4c58fcef-20b3-42d5-97cd-cd2b6f52256d\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3h8jc6f0fgkxwzw24pns93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"36a9ee46-4d57-4527-9fbb-01f706297f7c\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2ps65s6tjga24266ptgukv93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"prism_id\": \"f3a519fb-97af-4dcf-b570-87ada3c6a383\",\n", + " \"timestamp\": 1714331057,\n", + " \"outlay_factor\": null,\n", + " \"prism_members\": [\n", + " {\n", + " \"member_id\": \"975012f0-2c35-480d-aa98-632423d2acc9\",\n", + " \"label\": \"carol {Tcf}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p36nqdz3gacx67jwva8xj93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"e03b99ce-7d5b-4b9b-84ee-d6f943da6762\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p38xjenrgcm9y32cgf9rz93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"ad3feb18-24ab-4aac-8c1a-b7e52671e80e\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3dy7ntdfpnkj6mjxe4xv93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", + " \"split\": 1,\n", + " \"fees_incurred_by\": \"remote\",\n", + " \"payout_threshold_msat\": \"0\"\n", + " }\n", + " ]\n", + " }\n", + " ]\n", + "}\n" ] } ], @@ -241,7 +646,7 @@ }, { "cell_type": "code", - "execution_count": 89, + "execution_count": 17, "id": "44b7ffcc-f0fd-44ed-a198-afec41167d16", "metadata": {}, "outputs": [ @@ -250,36 +655,33 @@ "output_type": "stream", "text": [ "{\n", - " \"prism_id\": \"2072b63d-c422-4db3-9db0-10e223bbe7f8\",\n", - " \"version\": \"v0.0.2\",\n", - " \"sdf\": \"relative\",\n", - " \"members\": [\n", + " \"prism_id\": \"98401736-e858-4696-b5d3-dc52b3a447f6\",\n", + " \"timestamp\": 1715545420,\n", + " \"outlay_factor\": 1.0,\n", + " \"prism_members\": [\n", " {\n", - " \"name\": \"carol {SsC}\",\n", - " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3ryvdnsxfr9qa2j89mxx93pqfx9yx7yz2utew9j8d84p975w4n6fvm0dkqsv4phexzehjkwrt2ry\",\n", + " \"member_id\": \"6ecb3b3d-2008-4fbc-9fe8-9d868952dec3\",\n", + " \"label\": \"carol {V9j}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3gk636h898kkernxg64v93pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", " \"split\": 1,\n", - " \"type\": \"bolt12\",\n", - " \"outlay_msat\": null,\n", " \"fees_incurred_by\": \"remote\",\n", - " \"threshold\": 0\n", + " \"payout_threshold_msat\": \"0\"\n", " },\n", " {\n", - " \"name\": \"Dave\",\n", - " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3n8w4ek0py9wnpcw9mky93pqfuhd5s96s38hl9svuyulalxxq5cz2sd7tz062sfe4chntf3v4v6c\",\n", + " \"member_id\": \"d146a91f-ef82-4398-94df-c4ccf3050f59\",\n", + " \"label\": \"Dave\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3jxk4jvv9pnxvz9wf9y593pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", " \"split\": 1,\n", - " \"type\": \"bolt12\",\n", - " \"outlay_msat\": null,\n", " \"fees_incurred_by\": \"remote\",\n", - " \"threshold\": 0\n", + " \"payout_threshold_msat\": \"0\"\n", " },\n", " {\n", - " \"name\": \"erin\",\n", - " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3e8sum0vdcygnrxgezyy93pqfzjd89nwfavtpv7leu0n8dn2jev4cnlfzthv878jwpm022ykavp5\",\n", + " \"member_id\": \"3dd653a0-a68b-4b29-95fc-810de26ed60a\",\n", + " \"label\": \"erin\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3v9q3tktfp8x4pkw9v5u93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", " \"split\": 1,\n", - " \"type\": \"bolt12\",\n", - " \"outlay_msat\": null,\n", " \"fees_incurred_by\": \"remote\",\n", - " \"threshold\": 0\n", + " \"payout_threshold_msat\": \"0\"\n", " }\n", " ]\n", "}\n" @@ -293,16 +695,139 @@ }, { "cell_type": "code", - "execution_count": 55, + "execution_count": 18, "id": "b73364b1-b1c1-445c-a89d-d65fd4ee8ed1", - "metadata": {}, + "metadata": { + "scrolled": true + }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{\n", - " \"bolt12_bindings\": []\n", + " \"bolt12_prism_bindings\": [\n", + " {\n", + " \"binding_id\": \"ed272d2c9af5303c281fd7b244becb65d5bc2b326c4421ade32401729db6b9d4\",\n", + " \"offer_id\": \"1421d98445bf49751612fb867d2f3651aed10a56f74b14fe5f1ea71df772818d\",\n", + " \"prism_id\": \"13dfa796-30f0-46d8-8ddc-dbe4520cdbf0\",\n", + " \"timestamp\": 0,\n", + " \"member_outlays\": [\n", + " {\n", + " \"member_id\": \"e96d9723-1c41-4472-8c01-f657442dc2c1\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"fef92cbb-78ee-49c5-bd5a-670c2ec4f738\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"e80da8ab-aed8-4ae0-8acf-c28048f4c0da\",\n", + " \"outlay_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"binding_id\": \"cca0268522924ac7519c8aaeac975df07bf44220b1ca1e47c2821e2b6b385947\",\n", + " \"offer_id\": \"17de53e5f9a39aeb762cdd07ce8b07cd6a033bac6bbfc2c3c2dcaa1fcdcb1734\",\n", + " \"prism_id\": \"13dfa796-30f0-46d8-8ddc-dbe4520cdbf0\",\n", + " \"timestamp\": 0,\n", + " \"member_outlays\": [\n", + " {\n", + " \"member_id\": \"e96d9723-1c41-4472-8c01-f657442dc2c1\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"fef92cbb-78ee-49c5-bd5a-670c2ec4f738\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"e80da8ab-aed8-4ae0-8acf-c28048f4c0da\",\n", + " \"outlay_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"binding_id\": \"3c3df04290a4123e95a9aef3d790ef611bf19d397e6a48daebb9d6d9d431d6ab\",\n", + " \"offer_id\": \"2ccb734f48d8c902faea20be31721fcaa1177af51b699a0fe17b97c3e4f1ce6c\",\n", + " \"prism_id\": \"e3bf07e6-615c-4aff-8174-c6ad4cf98081\",\n", + " \"timestamp\": 1714331581,\n", + " \"member_outlays\": [\n", + " {\n", + " \"member_id\": \"65e0caec-6d56-48d9-8b52-f4dd596f6ffa\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"841d7e25-336c-4780-be75-7d8920ecf2f5\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"4e291c78-a5b0-4209-944b-8f3b05c722e2\",\n", + " \"outlay_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"binding_id\": \"96953956188fdd3cdcdcd3e42299e16c274af2f505c2d2c924f69b47a52f7be6\",\n", + " \"offer_id\": \"622b0e9caad92a384e520c868cfa72950fe82429b4a8e9098f88fcf899f09193\",\n", + " \"prism_id\": \"e3bf07e6-615c-4aff-8174-c6ad4cf98081\",\n", + " \"timestamp\": 1714331498.3983443,\n", + " \"member_outlays\": [\n", + " {\n", + " \"member_id\": \"65e0caec-6d56-48d9-8b52-f4dd596f6ffa\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"841d7e25-336c-4780-be75-7d8920ecf2f5\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"4e291c78-a5b0-4209-944b-8f3b05c722e2\",\n", + " \"outlay_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"binding_id\": \"0ca3a59d67ed7bc07ccf063ee0b387bddb9c77541753b3c2836921a8f846d285\",\n", + " \"offer_id\": \"78428d0a48c71e124014be5057c39980157a414c063c3419d1ede43d91fcb119\",\n", + " \"prism_id\": \"98401736-e858-4696-b5d3-dc52b3a447f6\",\n", + " \"timestamp\": 1715545420,\n", + " \"member_outlays\": [\n", + " {\n", + " \"member_id\": \"7c84d572-a576-4097-9538-ce9d8f6596c6\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"0e56b46d-e0bb-4a7a-b1a0-58d5a27b83f0\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"e6a9062b-a22f-4b63-bb5a-8daaeb4a28ad\",\n", + " \"outlay_msat\": \"0\"\n", + " }\n", + " ]\n", + " },\n", + " {\n", + " \"binding_id\": \"bfcad68bbdd769003e9dc1d646132031433da9260269bfeb3925312b403e4e07\",\n", + " \"offer_id\": \"ff547ff75f32ae3b0d1a1c5e7ac68d79c499d5e901884131234c156afbb470e1\",\n", + " \"prism_id\": \"e3bf07e6-615c-4aff-8174-c6ad4cf98081\",\n", + " \"timestamp\": 1714331685,\n", + " \"member_outlays\": [\n", + " {\n", + " \"member_id\": \"65e0caec-6d56-48d9-8b52-f4dd596f6ffa\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"841d7e25-336c-4780-be75-7d8920ecf2f5\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"4e291c78-a5b0-4209-944b-8f3b05c722e2\",\n", + " \"outlay_msat\": \"0\"\n", + " }\n", + " ]\n", + " }\n", + " ]\n", "}\n" ] } @@ -333,7 +858,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 43, "id": "3bfacd8a-e0ce-45da-b43b-635e17020f97", "metadata": {}, "outputs": [ @@ -341,8 +866,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "3b7d4a948b63777dfa58eb8727c92533dffff185ddee7f806844b3fea5e587c0\n", - "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p358gunhxpxnwnfet9eyw93pq0pjn85qgrpplrv7vqe6muf8cl04dzd8cr2vk5aw5eex257fuqy82\n" + "083f64e36b398b73b98cd8003894a3dcd1bc676be17b314f0a0663d6d502f5a7\n", + "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3x9y7rjxseys5jcv32kj93pqw5lzxuq0nes2h6e6fsxlat8udyytm8uzjjsf3u460cnmnae4p7gj\n" ] } ], @@ -359,9 +884,11 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 44, "id": "11f59065-5f3a-4740-9742-348b1625a6d6", - "metadata": {}, + "metadata": { + "scrolled": true + }, "outputs": [ { "name": "stdout", @@ -369,39 +896,40 @@ "text": [ "{\n", " \"status\": \"must-create\",\n", - " \"bind_to\": \"3b7d4a948b63777dfa58eb8727c92533dffff185ddee7f806844b3fea5e587c0\",\n", - " \"prism_id\": \"a9f1c094-cbc9-45c3-9632-cdcc2929caa8\",\n", + " \"timestamp\": 1715548727,\n", + " \"bind_to\": \"083f64e36b398b73b98cd8003894a3dcd1bc676be17b314f0a0663d6d502f5a7\",\n", + " \"prism_id\": \"cfe57707-5391-4363-ae86-d2fe4620ccdb\",\n", " \"prism_binding_key\": [\n", " \"prism\",\n", " \"v2\",\n", " \"bind\",\n", " \"bolt12\",\n", - " \"3b7d4a948b63777dfa58eb8727c92533dffff185ddee7f806844b3fea5e587c0\"\n", + " \"083f64e36b398b73b98cd8003894a3dcd1bc676be17b314f0a0663d6d502f5a7\"\n", " ],\n", " \"prism_members\": [\n", " {\n", - " \"member_id\": \"a8a938fa-7d81-4aae-b671-0b460cf97d9b\",\n", - " \"label\": \"carol {C1m}\",\n", - " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3phswrpvfjk7ejv89e5g93pqgfjkx3qvsv22wj39220cpesvsdmsyuvegaad6wsdw7lsahrkv4sw\",\n", + " \"member_id\": \"69de6dbb-6cfe-4ac4-b7af-e620b4283982\",\n", + " \"label\": \"carol {BWv}\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3r5u4nr29xxw4jngdr4593pqgq7pgtzgjva3mrda0fy93vdpqgp5uez2va454drnggrp6dpkndpz\",\n", " \"split\": 1,\n", " \"fees_incurred_by\": \"remote\",\n", - " \"payout_threshold\": \"0msat\"\n", + " \"payout_threshold_msat\": \"100000\"\n", " },\n", " {\n", - " \"member_id\": \"11ec6990-613f-4287-9687-73b7800bd9c6\",\n", + " \"member_id\": \"07e1e1ba-7869-4c75-bd77-f9031a1d1dab\",\n", " \"label\": \"Dave\",\n", - " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p339wmp4favkw5n2dpy9s93pq032lzz97ehk7fxvn4lqgdz6kmpvfw54m6dkt8ahhnn0vyxulm375\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3mxxa66w9ukk32ew449g93pqwacwys2xejtw7u7xsxlgc2trk0eutc790fztz24k0umrwahe6ja5\",\n", " \"split\": 1,\n", " \"fees_incurred_by\": \"remote\",\n", - " \"payout_threshold\": \"0msat\"\n", + " \"payout_threshold_msat\": \"100000\"\n", " },\n", " {\n", - " \"member_id\": \"554e038f-266e-4788-805b-ec3a41f887c9\",\n", + " \"member_id\": \"da392519-c3f1-4b84-b033-985d4c9609a9\",\n", " \"label\": \"erin\",\n", - " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p3p4w6nsg4u4v4nfwe6yv93pqgmlacrhla00z62s9z8yfu5uh0s50c02lwtmaucz24qzzyaemretx\",\n", + " \"destination\": \"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrc2p38nwwrhd9xkjanx2afkw93pqt0ln8cm2er60kqqvhtw6azl2yafewmp5rq3n64yqcqkll0f9qt66\",\n", " \"split\": 1,\n", " \"fees_incurred_by\": \"remote\",\n", - " \"payout_threshold\": \"0msat\"\n", + " \"payout_threshold_msat\": \"100000\"\n", " }\n", " ]\n", "}\n" @@ -412,7 +940,7 @@ "prism_id=prism.get(\"prism_id\")\n", "\n", "def bind_prism_to_offer(prism_id, offer_id):\n", - " bind_to = f'{l2} prism-bindingadd -k prism_id={prism_id} bind_to={offer_id}'\n", + " bind_to = f'{l2} prism-bindingadd -k prism_id={prism_id} offer_id={offer_id}'\n", " !$bind_to\n", "\n", "bind_prism_to_offer(prism_id=prism_id, offer_id=prism_offer_id)\n", @@ -421,7 +949,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 58, "id": "6b24d85d-ffd9-42cf-9574-5d228c7a81b4", "metadata": {}, "outputs": [ @@ -430,12 +958,25 @@ "output_type": "stream", "text": [ "{\n", - " \"offer_id\": \"3b7d4a948b63777dfa58eb8727c92533dffff185ddee7f806844b3fea5e587c0\",\n", - " \"prism_id\": \"a9f1c094-cbc9-45c3-9632-cdcc2929caa8\",\n", - " \"member_outlays\": {\n", - " \"a8a938fa-7d81-4aae-b671-0b460cf97d9b\": \"0msat\",\n", - " \"11ec6990-613f-4287-9687-73b7800bd9c6\": \"0msat\",\n", - " \"554e038f-266e-4788-805b-ec3a41f887c9\": \"0msat\"\n", + " \"bolt12_prism_bindings\": {\n", + " \"binding_id\": \"1827e7ad306db7a964f6ea005c29231aadd67612b7dfda9db426fd96ec906c77\",\n", + " \"offer_id\": \"083f64e36b398b73b98cd8003894a3dcd1bc676be17b314f0a0663d6d502f5a7\",\n", + " \"prism_id\": \"cfe57707-5391-4363-ae86-d2fe4620ccdb\",\n", + " \"timestamp\": 1715548727,\n", + " \"member_outlays\": [\n", + " {\n", + " \"member_id\": \"69de6dbb-6cfe-4ac4-b7af-e620b4283982\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"07e1e1ba-7869-4c75-bd77-f9031a1d1dab\",\n", + " \"outlay_msat\": \"0\"\n", + " },\n", + " {\n", + " \"member_id\": \"da392519-c3f1-4b84-b033-985d4c9609a9\",\n", + " \"outlay_msat\": \"0\"\n", + " }\n", + " ]\n", " }\n", "}\n" ] @@ -443,16 +984,24 @@ ], "source": [ "#!$l2 prism-bindinglist\n", - "show_binding_command = f'{l2} -k prism-bindingshow bind_to={prism_offer_id}'\n", + "show_binding_command = f'{l2} -k prism-bindinglist offer_id={prism_offer_id}'\n", "!$show_binding_command" ] }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 55, "id": "fd69c329-ed05-40b5-97ba-d76168a77e98", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "lni1qqgrdxrmg3l4a7wk0wq7rx6jmlcr6q3qqc3xu3s3rg94nj40zfsy866mhu5vxne6tcej5878k2mneuvgjy8s5rzv2fu8ydpjfpf9sez4dytzzqaf7ydcql8nq404n5nqdl6k0c6gghk0c999qnret5l38h8mn2ru39gzqp3zderpzxstt8927ynqg044h0egcd8n5h3n9g0u0v4h8ncc3yg02gpsrp4qtqssy8yltye4jzdxqrve3nxljzc07tawuwdexvy98jd0jh4pgyqfpwqk5zvq8203rwq8euc9tavaycr074n7xjz9an7pffgyc72a8ufae7u6slyfqvfe6hsjuyke79452s2sw0yuhh0pt762npezx4axvpv03m7tecepcqgzh2697ymlclxajz0un5w7p23d3krty9asn88388h7d7n7des692msqvn3ma02kcmt526h234fu267dddld4ya0038apl8ne4awvlf7r0qur9pl3zgv8wqpwaysrga37xvnym2h34zrsqqqqqqqqqqqqqqpgqqqqqqqqqqqqqayjedltzjqqqqqq9yq3nyzvhh4qsqe80f883urdz7xnugpa62y7xx7xj49vzqgv0zujkte99zl3eats92qvqcdg9syyp6nugmsp70xp2lt8fxqml4vl35s30vls222px8jhflz0w0hx58ez0sgp9e060lelvu69vuasdyw4t5x4qlhdtp5p3ehrqdqykgxh42kex07j6kp45mu7y4htf90s7ar33lgjp6n3xal0q5dkmns0v8wq2km799\n" + ] + } + ], "source": [ "def get_invoice_from_offer(lightning_cli, bolt12, amount_msat):\n", " fetch_invoice = f'{lightning_cli} fetchinvoice {bolt12} {amount_msat}'\n", @@ -460,12 +1009,13 @@ " return json.loads(''.join(invoice)).get('invoice')\n", "\n", "invoice = get_invoice_from_offer(l1, prism_bolt12, 100000) \n", - "\n" + "\n", + "print(invoice)" ] }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 56, "id": "cadabf7c-5f5c-4efc-a1fa-b1fe8db83cf9", "metadata": {}, "outputs": [ @@ -474,13 +1024,13 @@ "output_type": "stream", "text": [ "{\n", - " \"destination\": \"03c3299e8040c21f8d9e6033adf127c7df5689a7c0d4cb53aea6726553c9e00875\",\n", - " \"payment_hash\": \"a68227559bd02858f92f810275b467d40fbd5d841a95959cf10a62bb0389a882\",\n", - " \"created_at\": 1713931260.521324945,\n", + " \"destination\": \"03a9f11b807cf3055f59d2606ff567e34845ecfc14a504c795d3f13dcfb9a87c89\",\n", + " \"payment_hash\": \"0c9de939e3c1b45e34f880f74a278c6f1a552b040431e2e4acbc94a2fc73d5c0\",\n", + " \"created_at\": 1715548919.885159434,\n", " \"parts\": 1,\n", " \"amount_msat\": 100000,\n", " \"amount_sent_msat\": 100000,\n", - " \"payment_preimage\": \"cebc1f4e4193fdd8db4cb1a6ae53d91349f296bba71cffa232c597eecc0007af\",\n", + " \"payment_preimage\": \"8fcfbc91430b691e91519d2a8761535febc0d647708de000eac2d123529e3001\",\n", " \"status\": \"complete\"\n", "}\n" ] @@ -508,7 +1058,7 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 59, "id": "266b2089-c602-4185-83a9-d74a58a3e012", "metadata": {}, "outputs": [ @@ -518,34 +1068,34 @@ "text": [ "{\n", " \"prism_member_payouts\": {\n", - " \"a8a938fa-7d81-4aae-b671-0b460cf97d9b\": {\n", - " \"destination\": \"02132b1a206418a53a512a94fc0730641bb8138cca3bd6e9d06bbdf876e3b32b07\",\n", - " \"payment_hash\": \"91aa3c76c72f46d088295f329fb89a583abbd548d3a1748b867f68cc2adcc1e8\",\n", - " \"created_at\": 1713932022.986966,\n", + " \"69de6dbb-6cfe-4ac4-b7af-e620b4283982\": {\n", + " \"destination\": \"0201e0a1624499d8ec6debd242c58d08101a7322533b5a55a39a1030e9a1b4da11\",\n", + " \"payment_hash\": \"fbbda001d3bb82cb9ce934e312687eb5507b1e88dc6121585939cd4e81535882\",\n", + " \"created_at\": 1715549097.881403,\n", " \"parts\": 1,\n", " \"amount_msat\": \"33333msat\",\n", " \"amount_sent_msat\": \"33333msat\",\n", - " \"payment_preimage\": \"4b029b41c7244d71b7ea930b38594446274b384039c607919911006c7324613a\",\n", + " \"payment_preimage\": \"5c4fc2b8d1669f0a7117699cd022ce67a696157053a9d99ab02272c953759872\",\n", " \"status\": \"complete\"\n", " },\n", - " \"11ec6990-613f-4287-9687-73b7800bd9c6\": {\n", - " \"destination\": \"03e2af8845f66f6f24cc9d7e04345ab6c2c4ba95de9b659fb7bce6f610dcfee3ea\",\n", - " \"payment_hash\": \"2821596cf33af4f092f89895b7c7f4b3062c6cc06dc572b7326e0cdeb5dd1cb0\",\n", - " \"created_at\": 1713932023.9246294,\n", + " \"07e1e1ba-7869-4c75-bd77-f9031a1d1dab\": {\n", + " \"destination\": \"03bb87120a3664b77b9e340df4614b1d9f9e2f1e2bd2258955b3f9b1bbb7cea5da\",\n", + " \"payment_hash\": \"68eeada8c8c60265bd93225fdf91199504ce0f1c1ad30fde46380f3e77a6ba42\",\n", + " \"created_at\": 1715549098.8109088,\n", " \"parts\": 1,\n", " \"amount_msat\": \"33333msat\",\n", " \"amount_sent_msat\": \"33333msat\",\n", - " \"payment_preimage\": \"0a9905c8359c96f0f09b523c36270a2c4d896e26d1401e3049f9f24299e2347a\",\n", + " \"payment_preimage\": \"ff887c6a9c528aa6ad7a5665ffd439727e1f61973c1f7efc9d296896d8680237\",\n", " \"status\": \"complete\"\n", " },\n", - " \"554e038f-266e-4788-805b-ec3a41f887c9\": {\n", - " \"destination\": \"0237fee077ff5ef16950288e44f29cbbe147e1eafb97bef30255402113b9d8f2b3\",\n", - " \"payment_hash\": \"a0f05a82cfc3d0d3840afa044e20b90e48317cf34555bcc033e51a8fbf79b5e4\",\n", - " \"created_at\": 1713932024.8518887,\n", + " \"da392519-c3f1-4b84-b033-985d4c9609a9\": {\n", + " \"destination\": \"02dff99f1b5647a7d80065d6ed745f513a9cbb61a0c119eaa406016ffde92817ad\",\n", + " \"payment_hash\": \"ccf05f1224767049ff7baef3071ae2455ccafb48546c41c1685a2f0f2b97088b\",\n", + " \"created_at\": 1715549099.7399845,\n", " \"parts\": 1,\n", " \"amount_msat\": \"33333msat\",\n", " \"amount_sent_msat\": \"33333msat\",\n", - " \"payment_preimage\": \"807d7998aaf532c65c78d3eae4acaf3e492138b8078e28600e8dfcdbfce973d4\",\n", + " \"payment_preimage\": \"3ce2ae72e76101158dfeeca5f94f31e562b26205c5ced0c8aed25035239e4b0a\",\n", " \"status\": \"complete\"\n", " }\n", " }\n", diff --git a/lib.py b/lib.py index 0e8b99e..c82c67c 100644 --- a/lib.py +++ b/lib.py @@ -7,6 +7,7 @@ import json import math import time + import hashlib except ModuleNotFoundError as err: # OK, something is not installed? import json @@ -56,7 +57,7 @@ def validate(member): member['fees_incurred_by'] = member.get('fees_incurred_by', "remote") # TODO - member['payout_threshold'] = member.get('payout_threshold', 0) + member['payout_threshold_msat'] = member.get('payout_threshold_msat', 0) # TODO also check to see if the user provided MORE fields than is allowed. @@ -96,8 +97,8 @@ def __init__(self, plugin: Plugin, member_dict=None): self.split: str = member_dict.get("split") self.fees_incurred_by: str = member_dict.get( "fees_incurred_by") if member_dict.get("fees_incurred_by") else "remote" - self.payout_threshold: Millisatoshi = Millisatoshi(member_dict.get( - "payout_threshold")) if member_dict.get("payout_threshold") else Millisatoshi(0) + self.payout_threshold_msat: Millisatoshi = Millisatoshi(member_dict.get( + "payout_threshold_msat") + "msat") if member_dict.get("payout_threshold_msat") else Millisatoshi(0) self._plugin = plugin @@ -120,7 +121,7 @@ def to_json(self): "split": self.split, # TODO: shold this be at the prism level instead? "fees_incurred_by": self.fees_incurred_by, - "payout_threshold": self.payout_threshold + "payout_threshold_msat": str(self.payout_threshold_msat).replace('msat', '') }) def to_dict(self): @@ -130,7 +131,7 @@ def to_dict(self): "destination": self.destination, "split": self.split, "fees_incurred_by": self.fees_incurred_by, - "payout_threshold": self.payout_threshold + "payout_threshold_msat": str(self.payout_threshold_msat).replace('msat', '') } class Prism: @@ -146,10 +147,12 @@ def from_db_string(plugin: Plugin, prism_string: str): members = Member.find_many(plugin, prism_dict.get("prism_members")) - timestamp = prism_dict.get("timestamp", 0) + timestamp = prism_dict.get("timestamp") - return Prism(plugin, timestamp=timestamp, prism_id=prism_id, members=members) + outlay_factor = prism_dict.get("outlay_factor") + return Prism(plugin, outlay_factor=outlay_factor, timestamp=timestamp, prism_id=prism_id, members=members) + @staticmethod def get(plugin: Plugin, prism_id: str): prism_record = plugin.rpc.listdatastore( @@ -173,9 +176,9 @@ def find_all(plugin: Plugin): return prism_ids @staticmethod - def create(plugin: Plugin, prism_id: str = None, members: List[Member] = None): + def create(plugin: Plugin, outlay_factor, prism_id: str = None, members: List[Member] = None): timestamp = round(time.time()) - prism = Prism(plugin, timestamp=timestamp, prism_id=prism_id, members=members) + prism = Prism(plugin, timestamp=timestamp, prism_id=prism_id, members=members, outlay_factor=outlay_factor) prism.save() return prism @@ -199,15 +202,16 @@ def bindings(self): our_bindings = [b for b in all_bindings if b.prism.id == self.id] - self._plugin.log(f'This prism\'s bindings: {our_bindings}') + self._plugin.log(f"This prism's bindings: {our_bindings}") return our_bindings - def __init__(self, plugin: Plugin, timestamp: str, prism_id: str = None, members: List[Member] = None): + def __init__(self, plugin: Plugin, outlay_factor: float, timestamp: str, prism_id: str = None, members: List[Member] = None): self.validate(members) self.members = members self.id = prism_id if prism_id else str(uuid.uuid4()) self.timestamp = timestamp + self.outlay_factor = outlay_factor self._plugin = plugin def to_json(self, member_ids_only=False): @@ -219,6 +223,7 @@ def to_json(self, member_ids_only=False): return json.dumps({ "prism_id": self.id, "timestamp": self.timestamp, + "outlay_factor": self.outlay_factor, "prism_members": members }) @@ -226,6 +231,7 @@ def to_dict(self): return { "prism_id": self.id, "timestamp": self.timestamp, + "outlay_factor": self.outlay_factor, "prism_members": [member.to_dict() for member in self.members] } @@ -274,20 +280,25 @@ def pay(self, amount_msat: int, binding = None): results = {} for m in self.members: - member_msat = 0 + member_msat = Millisatoshi(0) if binding is None: # when a binding is not provided (when we're using prism.pay, for example) # the member_msat is set to the proportional share of defined in the split defintion - member_msat = math.floor(amount_msat * (m.split / self.total_splits)) - self._plugin.log(f"In Prism.pay, but no binding was provided. Setting member_msat to {member_msat}") - #self._plugin.log(f"member_msat {member_msat} ") + member_msat = Millisatoshi(math.floor(amount_msat * (m.split / self.total_splits))) + self._plugin.log(f"In Prism.pay, but no binding was provided, thus setting member_msat to a {member_msat}.") + else: # but if the user provids a binding object, then we set the member_msat to the # outlay for the respective prism member. - member_msat = binding.outlays[m.id] + member_msat = Millisatoshi(binding.outlays[m.id]) self._plugin.log(f"In Prism.pay, and a binding was provided. Setting member_msat to the member's outlay: {member_msat}") + # we stop processing if the + if member_msat <= m.payout_threshold_msat: + self._plugin.log("Member outlay is less than the payout threshold. Skipping.") + continue + payment = None if bolt12Regex.match(m.destination): try: @@ -369,7 +380,6 @@ def from_db_string(plugin: Plugin, string: str, bind_to: str, bolt_version: str) @staticmethod def get(plugin: Plugin, bind_to: str, bolt_version="bolt12"): - types = ["bolt11", "bolt12"] if bolt_version not in types: raise Exception( @@ -409,6 +419,9 @@ def add_binding(plugin: Plugin, bind_to: str, prism_id: str, bolt_version="bolt dbmode = "must-replace" prism = Prism.get(plugin=plugin, prism_id=prism_id) + + plugin.log(f"prism: {prism}") + if not prism: raise Exception(f"Could not find prism: {prism_id}") members = prism.members @@ -430,7 +443,7 @@ def add_binding(plugin: Plugin, bind_to: str, prism_id: str, bolt_version="bolt response = { "status": dbmode, "timestamp": timestamp, - "bind_to": bind_to, + "offer_id": bind_to, "prism_id": prism_id, "prism_binding_key": prism_binding_key, "prism_members": [member.to_dict() for member in members] @@ -485,11 +498,20 @@ def __init__(self, plugin: Plugin, timestamp: int, outlays, offer_id, prism_id, "bind", bolt_version, offer_id] def to_dict(self): + sha256 = hashlib.sha256() + sha256.update(self.offer_id.encode('utf-8')) + return { "offer_id": self.offer_id, "prism_id": self.prism.id, "timestamp": self.timestamp, - "member_outlays": self.outlays + "member_outlays": [ + { + "member_id": member_id, + "outlay_msat": outlay.replace('msat','') + } + for member_id, outlay in self.outlays.items() + ] } def to_json(self): @@ -510,6 +532,7 @@ def save(self): key=self._datastore_key, string=string, mode="must-replace") def increment_outlays(self, amount_msat): + self._plugin.log(f"Incrementing outlays for binding '{self.offer_id}' with total income of {amount_msat}msats.") new_outlays = {} for member_id, outlay in self.outlays.items(): @@ -549,7 +572,7 @@ def update_outlays(self, payment_results): payment_amount = payment_result.get("amount_sent_msat", 0) else: - self._plugin.log(f"No payment_result for member {member_id}. This could indicate a failed payment.", "warn") + self._plugin.log(f"No payment_result for member {member_id}. This could indicate a failed payment. Outlays will remain unchanged.", "warn") new_outlay = Millisatoshi(outlay) - Millisatoshi(payment_amount) @@ -563,7 +586,10 @@ def update_outlays(self, payment_results): def pay(self, amount_msat): payment_results = None - self.increment_outlays(amount_msat=amount_msat) + self._plugin.log(f"Calculating total outlays...") + total_outlays = amount_msat * self.prism.outlay_factor + self._plugin.log(f"Total outlays are {total_outlays} after applying an outlay factor of {self.prism.outlay_factor} to the income amount {amount_msat}.") + self.increment_outlays(amount_msat=total_outlays) # TODO we need to narrow the gap between these two functions. payment_results = self.prism.pay(amount_msat, binding=self) diff --git a/run_tests.sh b/run_tests.sh index 8612094..ef6a85b 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -4,10 +4,8 @@ set -eu # first build the image if it doesn't exit. BOLT12_PRISM_IMAGE_NAME="bolt12-prism-pyln-testing:v24.02.2" -if ! docker image inspect "$BOLT12_PRISM_IMAGE_NAME" &>/dev/null; then - docker buildx build . -t "$BOLT12_PRISM_IMAGE_NAME" --load -fi +docker buildx build . -t "$BOLT12_PRISM_IMAGE_NAME" --load if ! docker ps -a | grep bolt12-tester >> /dev/null; then - docker run --rm --name bolt12-tester -it bolt12-prism-pyln-testing:v24.02.2 + docker run --rm --name bolt12-tester -it "$BOLT12_PRISM_IMAGE_NAME" fi \ No newline at end of file diff --git a/test_bolt12_prism.py b/test_bolt12_prism.py index 3b71060..14d724f 100644 --- a/test_bolt12_prism.py +++ b/test_bolt12_prism.py @@ -97,12 +97,10 @@ def test_general_prism(node_factory, bitcoind): l2.rpc.call( "prism-create", {"members": members_json, "prism_id": prism1_id} ) - assert prism1_id in l2.rpc.call("prism-list")["prism_ids"] - # prism-show in README but not in code - # assert ( - # len(l2.rpc.call("prism-show", {"prism_id": prism1_id})["prism_members"]) - # == 3 - # ) + + prism_ids = [prism["prism_id"] for prism in l2.rpc.call("prism-list")["prisms"]] + assert prism1_id in prism_ids + l2.rpc.call("prism-pay", {"prism_id": prism1_id, "amount_msat": 1_000_000}) wait_for( lambda: l3.rpc.listpeerchannels()["channels"][0]["to_us_msat"] > 300_000 @@ -117,7 +115,7 @@ def test_general_prism(node_factory, bitcoind): l2_offer = l2.rpc.offer("any", "Prism") l2.rpc.call( "prism-bindingadd", - {"bind_to": l2_offer["offer_id"], "prism_id": prism1_id}, + {"offer_id": l2_offer["offer_id"], "prism_id": prism1_id}, ) binding = l2.rpc.call("prism-bindinglist")["bolt12_prism_bindings"][0] assert binding["offer_id"] == l2_offer["offer_id"] @@ -139,7 +137,7 @@ def test_general_prism(node_factory, bitcoind): assert len(l2.rpc.call("prism-bindinglist")["bolt12_prism_bindings"]) == 0 l2.rpc.call("prism-delete", {"prism_id": prism1_id}) - assert prism1_id not in l2.rpc.call("prism-list")["prism_ids"] + assert prism1_id not in [prism["prism_id"] for prism in l2.rpc.call("prism-list")["prisms"]] def test_splits(node_factory, bitcoind): @@ -260,7 +258,7 @@ def test_payment_threshold(node_factory, bitcoind): "label": "Lead-Singer", "destination": l3_offer["bolt12"], "split": 1, - "payout_threshold": 500_000, + "payout_threshold_msat": "500000", }, { "label": "Drummer", @@ -282,7 +280,7 @@ def test_payment_threshold(node_factory, bitcoind): l2_offer = l2.rpc.offer("any", "Prism") l2.rpc.call( "prism-bindingadd", - {"bind_to": l2_offer["offer_id"], "prism_id": prism1_id}, + {"offer_id": l2_offer["offer_id"], "prism_id": prism1_id}, ) invoice = l1.rpc.fetchinvoice(l2_offer["bolt12"], 1_000_000)