Skip to content

Bug: Error when receiving get_info response via NWC #3262

@MegalithicBTC

Description

@MegalithicBTC

This is a rather subtle bug and I'm not surprised that your testing hasn't caught it yet.

It took me quite a few weeks of noticing it, being puzzled about it, until I figured out what is going on.

Here is how to reproduce the issue:

  1. Use a NWC string in Damus from a NWC provider who supports the get_info action:
    https://github.com/nostr-protocol/nips/blob/master/47.md#get_info

(For example, any NWC string from https://rizful.com/ will work.)

  1. You should find that the NWC service in Damus works as expected. You will be able to send zaps, list_transactions, etc.

  2. Now use the same NWC code simultaneously in A DIFFERENT NWC client. For my testing purposes, I'm using the Alby browser extension: https://chromewebstore.google.com/detail/alby-bitcoin-wallet-for-l/iokeahhehimjnekafflcihljlcjccdbe?hl=en

  3. Open the Alby browser extension to the default page, which will call get_info and list_transactions to the NWC service.

  4. Look back at Damus, and you should see:

Image
  1. Click "copy technical information" in Damus. You should see:
Failed to decode NWC Wallet response JSON. Error: typeMismatch(damus.WalletConnect.Response.Result.ResultType, Swift.DecodingError.Context(codingPath: [], debugDescription: "result_type get_info is unknown", underlyingError: nil))

So. I think what is happening is that Damus is unable to handle the get_info response.

The tricky thing here is that it's not Damus who made the get_info request... BUT... Damus is listening to the NWC relay, so it gets the get_info response if a different NWC client made that request!

I believe the solution is either to support and use the get_info response, or just gracefully ignore it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs recreationIssues requires concrete steps for recreationbugSomething is not working, or not working as intendednwc

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions