You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-7
Original file line number
Diff line number
Diff line change
@@ -452,20 +452,22 @@ functionsRouterAddress,
452
452
453
453
To listen for a response to a single Functions request, use the `listenForResponseFromTransaction()` method.
454
454
Optionally, you can provide:
455
-
- timeout after which the listener will throw an error indicating that the time limit was exceeded (default 5 minutes)
456
-
- number of block confirmations (default 2)
457
-
- frequency of checking if the request is already included on-chain (or if it got moved after a chain re-org) (default 2 seconds)
455
+
456
+
- timeout after which the listener will throw an error indicating that the time limit was exceeded (default 5 minutes expressed in milliseconds)
457
+
- number of block confirmations (default 1, but note that should be 2 or more to for higher confidence in finality, and to protect against reorgs)
458
+
- frequency of checking if the request is already included on-chain (or if it got moved after a chain re-org) (default 2 seconds, but note that `checkInterval`s higher than block time could cause this listener to hang as the response will have completed before the next check.)
This package can also be used in most modern web browsers. You can import the package in your front-end application, and call the APIs as you would in a back end NodeJs/Deno environment.
728
+
729
+
This package can also be used in most modern web browsers. You can import the package in your front-end application, and call the APIs as you would in a back end NodeJs/Deno environment.
reject('Response not received within timeout period')
29
-
},timeout)
32
+
},timeoutMs)
30
33
31
34
this.functionsRouter.on(
32
35
'RequestProcessed',
@@ -60,11 +63,19 @@ export class ResponseListener {
60
63
returnresponsePromise
61
64
}
62
65
66
+
/**
67
+
*
68
+
* @param txHash Tx hash for the Functions Request
69
+
* @param timeoutMs after which the listener throws, indicating the time limit was exceeded (default 5 minutes)
70
+
* @param confirmations number of confirmations to wait for before considering the transaction successful (default 1, but recommend 2 or more)
71
+
* @param checkIntervalMs frequency of checking if the Tx is included on-chain (or if it got moved after a chain re-org) (default 2 seconds. Intervals longer than block time may cause the listener to wait indefinitely.)
0 commit comments