Add timeout option for signClient.request
See original GitHub issueIs 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:
- Created 9 months ago
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 forwc_sessionRequest
) outlined in this PR: https://github.com/WalletConnect/walletconnect-docs/pull/315/filesThis 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
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.