question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add timeout option for signClient.request

See original GitHub issue

Is your feature request related to a problem? Please describe.

The default timeout for request sign is 5 minutes in hard code way, but in some scenarios, we need to customize the timeout value. One possible scenario is the wallet sign is an async process and may take more than 5 minutes. It’s a better way to expose this option to Dapps.

Describe the solution you’d like

  • add timeout option in params
  public request: IEngine["request"] = async <T>(params: EngineTypes.RequestParams) => {
    this.isInitialized();
    await this.isValidRequest(params);
    const { chainId, request, topic, timeout } = params;
    const id = await this.sendRequest(topic, "wc_sessionRequest", { request, chainId });
    const { done, resolve, reject } = createDelayedPromise<T>(timeout);
    this.events.once<"session_request">(engineEvent("session_request", id), ({ error, result }) => {
      if (error) reject(error);
      else resolve(result);
    });
    return await done();
  };
  • support timeout option in createDelayedPromise
export function createDelayedPromise<T>(timeout?: number) {
  timeout = toMiliseconds(timeout || FIVE_MINUTES);

Issue Analytics

  • State:open
  • Created 9 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
bkremcommented, Dec 14, 2022

Hi @junyulah,

So the team went over this suggestion and it looks like this will already be covered by an upcoming implementation change (optional expiry values for wc_sessionRequest) outlined in this PR: https://github.com/WalletConnect/walletconnect-docs/pull/315/files

This hasn’t been agreed yet, but the way this would likely be implemented in the JS SignClient is similar to what you suggested: an additional expiry/timeout parameter (presumably the duration in seconds) which the client then internally converts to a UNIX timestamp as outlined in the spec PR.

Please let us know if you see issues here from your side.

cc @ganchoradkov

1reaction
junyulahcommented, Dec 10, 2022

Hi @bkrem, thanks for the quick response. The follow-up question is a great question! Currently we haven’t go that far, we are still developing the wallet. For our first step, we are working with a partner team which is working on a Dapp, that Dapp will the set timeout to a longer time. Like you said, there are many options for our partner team to do, but sounds like using the metadata of our wallet to distinguish requests is a better solution, but up the timeout in general is also acceptable in our first step.

Very excited to hear your team will discuss this, hope to hear your conclusions soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java HTTP Client Request with defined timeout - Stack Overflow
For setting Timeout: I have used the RequestConfig object. You can also set the property Connection Request Timeout for setting timeout for ...
Read more >
HttpClient.Timeout Property (System.Net.Http) | Microsoft Learn
Gets or sets the timespan to wait before the request times out. ... To set an infinite timeout, set the property value to...
Read more >
How to set a timeout for a Curl request? - ReqBin
In this Curl timeout example, we set the timeout for sending requests to the ReqBin echo URL. Click the Run button to execute...
Read more >
Add timeout option for signClient.request - PullAnswer
The default timeout for request sign is 5 minutes in hard code way, but in some scenarios, we need to customize the timeout...
Read more >
ClientConfiguration (AWS SDK for Java - 1.12.372)
Client configuration options such as proxy settings, user agent string, max retry attempts, etc. ... The default timeout for a request.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found