Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot process request from Dapp #380

Closed
ditzdragos opened this issue Aug 31, 2022 · 14 comments
Closed

Cannot process request from Dapp #380

ditzdragos opened this issue Aug 31, 2022 · 14 comments
Assignees
Labels
accepted bug Something isn't working

Comments

@ditzdragos
Copy link

ditzdragos commented Aug 31, 2022

Describe the bug
I cannot process a request from our Dapp, as the SDK throws an error before I receive the request.

Error:
com.walletconnect.sign.core.exceptions.client.WalletConnectException$InternalError: RelayerInteractor: Unknown request params

Request format:
{ "id": 1660822734877742, "topic": "3560bebfde43da4d36f29afbfcb2bc433a0f029be757a9b1fa02be4f89b7ae22", "params": { "request": { "method": "erd_cancelAction", "params": { "action": "cancelSignTx" } }, "chainId": "elrond:D" } }

SDK Version

  • Client: Kotlin
  • Version: 2.0.0-rc.2

Additional context
For other requests, it works ok.

@ditzdragos ditzdragos added the bug Something isn't working label Aug 31, 2022
@jakubuid
Copy link
Contributor

jakubuid commented Sep 1, 2022

Hey @ditzdragos thanks for reporting.
Could you provide all other requests that works ok in json format?

@jakubuid
Copy link
Contributor

jakubuid commented Sep 1, 2022

Also, please provide how your Dapp constructs a Sign.Params.Request.
Do you use your own RelayInterface implementation?

@shiny-mountain
Copy link

shiny-mountain commented Sep 1, 2022

@jakobuid I have the same issue. My request from the Dapp(JS, "@walletconnect/sign-client": "2.0.0-rc.2"):

this.client.request({
  topic: this.session.topic,
  chainId: 'stellar:pubnet',
  request: {
    method: 'stellar_signAndSubmitXDR',
    params: {
      xdr: '...transaction converted to XDR',
    },
  },
})

The error in the Kotlin client(2.0.0-rc.2) is exactly the same RelayerInteractor: Unknown request params

@jakubuid
Copy link
Contributor

jakubuid commented Sep 1, 2022

@shiny-mountain @ditzdragos
We've just released the 2.0.0-rc.3 with session request parsing fixed issues. Give it a try and let us know if it works for you.

@ditzdragos
Copy link
Author

It seems that it still happens on RC 4
com.walletconnect.sign.core.exceptions.client.WalletConnectException$InternalError: RelayerInteractor: Unknown request params

@jakubuid jakubuid added this to the Sign v2.0-rc.5 milestone Sep 12, 2022
@Elyniss Elyniss assigned jakubuid and unassigned TalhaAli00 Sep 12, 2022
@jakubuid
Copy link
Contributor

Hey @ditzdragos you issue is fixed and it'll be available within next sign release.

@shiny-mountain please use valid json format. Replace the single quotes with double quotes and please remove coma in the end of the params object. This and current fix should allow you to parse your request correctly.

@shiny-mountain
Copy link

@jakobuid You must be confusing something. A valid json is not required in this method. It's javascript, here's the interface:

interface RequestParams {
        topic: string;
        request: {
            method: string;
            params: any;
        };
        chainId: string;
    }

Our linter settings should not affect the result.
Screenshot 2022-09-14 at 14 48 36

@jakubuid
Copy link
Contributor

@shiny-mountain Thanks for pointing this. What I meant is how you construct params field. We expect stringified json where we follow: https://www.json.org/json-en.html standard (double quotes and no coma in the end)
What is true in JS is not necessarily in jvm.

Here you can find a ref of valid examples: https://docs.walletconnect.com/2.0/advanced/rpc-reference/ethereum-rpc

@shiny-mountain
Copy link

@jakobuid This still doesn't work in the rc-4 version.

This is my code:

const xdr = tx.toEnvelope().toXDR('base64'); // return string

this.client.request({
  topic: this.session.topic,
  chainId: PUBNET,
  request: {
    method: STELLAR_METHODS.SIGN_AND_SUBMIT,
    params: {
       xdr,
     },
  },
})

Here is your example from here

const result = await client!.request<{ signature: string }>({
            chainId,
            topic: session!.topic,
            request: {
              method: DEFAULT_POLKADOT_METHODS.POLKADOT_SIGN_MESSAGE,
              params: {
                address,
                message,
              },
            },
          });

What am I doing wrong? The error is still RelayerInteractor: Unknown request params

@jakubuid
Copy link
Contributor

Hey, @shiny-mountain can you provide the json that is being sent trough the network?

@shiny-mountain
Copy link

@jakobuid I didn't understand how to see which json is sent to the network. I found which message is sent via websockets:

id: 1665749281737835
jsonrpc: "2.0"
method: "irn_publish"
params: {
  message: "APcozbB2aXrNe9Q5RsShUJ81WR6zGREvsI7lYY8K6bjLZrw37joYafDqfpcXS6BfHEtfx4u/JyGtCWDBnJPkfOHwh9yrJloN4Eop6TEOVAP+Wb70V0yy/xB1/PCEJbN3sJOLNLmC3Q75UVszPxRDQ9KUVLxIJDG6yNcBKT9NC8/bFJcBR3jRtUL5lJrJKRfZtcBRkZx6sWfFxhFhm4wXzTi4ov9rsnSjOt196OmLSjo0+KuqvIiHf3ral2m9Wh2DGFzwAm7nUB4cbeVi+Go3VpBDEByu66xYU5oDLUfNtoyIZNYxWikAu2JNz8+XkWDCarvyS+or+ylJ4dEeUqC0rencgex1Y/d3LRrZMsiVdeYab3jJVBL5Ce6ABdrFSXCKN6oev8cHejfRlGnTkbUdq7t+XOHWwZdmunHJehdB06rUg97uXsXWqyBFafdZOAGRjRSrmjh0V3lwX3Ret3XGnncn4CwEKhJRtAmUuhCreVlHKr4qBfmsc1Q1sw0qP751N9HChRraYR+BFtr7FsmkeqF9oA=="
  prompt: true
  tag: 1108
  topic: "d3e836143dba131b35c52fa9f78f8127d3cca575b42a54c88448b2b5c45075dd"
  ttl: 21600
}

I also see that in the local storage in wc@2:client:0.3//history there is:

chainId: null
id: 1665749281732610
request: {
  method: "wc_sessionRequest"
  params: {
    chainId: "stellar:pubnet"
    request: {
      method: "stellar_signAndSubmitXDR"
      params: {
        xdr: "AAAAAgAAAAAPmrVWGzfyKQeyCcUCgrXy3AvCAG9pDGdUZkpZvNi6NwABhqACPMa1AACEaAAAAAEAAAAAAAAAAAAAAABjcN4hAAAAAAAAAAEAAAAAAAAABgAAAAFCQ0gAAAAAAER1cmhoFeVeY+BDayo9CjTlJ+L58X70Keo4o7YMmvtLAAAAAAAAAAAAAAAAAAAAAA=="
      }
    }
  }
}
topic: "d3e836143dba131b35c52fa9f78f8127d3cca575b42a54c88448b2b5c45075dd"

@jakubuid jakubuid reopened this Oct 20, 2022
@jakubuid jakubuid removed their assignment Oct 20, 2022
@TalhaAli00 TalhaAli00 self-assigned this Nov 4, 2022
@TalhaAli00 TalhaAli00 removed this from the Sign v2.0-rc.5 milestone Nov 4, 2022
@jakubuid jakubuid assigned jakubuid and unassigned TalhaAli00 Nov 9, 2022
@jakubuid
Copy link
Contributor

@shiny-mountain I've checked your example. Based on the documentation, the xdr field should be wrapped in the double quotation. Ref link: https://docs.walletconnect.com/2.0/advanced/rpc-reference/stellar-rpc#stellar_signandsubmitxdr

I've already checked that on our internal tests, and with that change, the session request is parsed correctly.

@shiny-mountain
Copy link

shiny-mountain commented Nov 11, 2022

@jakobuid I wrote this documentation :) I think the reason was not in quotes, because after the release of version 2.0 everything works correctly, but nothing changed in the code.

@jakubuid
Copy link
Contributor

Nice to meet you then!
Alright, I'm glad that the issue has been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

4 participants