Closed im-adithya closed 7 months ago
Hmm, I am not sure this is the best way to do it because of the introduced conditional below and now we have to handle resp and resps, and now there is a lot of array handling and returning an array of resps which we should try to avoid because it forces us to wait for all responses to come back before sending them.
if resp != nil {
svc.publishEvent(ctx, sub, event, resp)
}
if resps != nil {
...
}
Also HandleMultiPayInvoiceEvent
has it's own waitgroup so that function will not return until all payments have been sent, which means responses won't be sent as soon as they are available.
Maybe we can move svc.publishEvent
to the individual handlers (and maybe create a new handler for HandleNotImplemented
for the default case in the switch), then the multi_x ones can call svc.publishEvent
once per element in the array.
Then we should also remove createAndAppendResponse
and not deal with returning an array of responses.
Does that make sense? do you see any issues doing it this way?
After this is ready for merge, we should also make the changes (cherry pick maybe?) on https://github.com/getAlby/nwc.getalby.com so that Alby backend for NWC also has this methods implemented.
But this will take some time to fix. Do you guys have any thoughts / opinions here? @im-adithya @bumi
PR to address some of the TODOs / issues in this PR:
https://github.com/getAlby/nostr-wallet-connect/pull/230
CC @im-adithya @bumi
@im-adithya can you change the merge branch to feat/wails-v2
and merge feat/wails-v2
into this branch?
We decided we will not add the multi_* support to nwc.getalby.com for now.
Adds
multi_pay_invoice
method