-
Notifications
You must be signed in to change notification settings - Fork 500
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
suggestions for Client.submitAndWait #2470
Comments
It may also be worth considering that the default |
Why not just use
This seems quite complicated to use if you just want the happy path or if you're more of a beginner dev (it took me a couple of minutes to understand how you could use it in the manner described).
IMO this is probably the best solution - so that if you want the custom functionality in your other proposed solutions, you can just write it yourself.
Do we have any |
I would still want the ability to easily check/wait for finalization.
Agreed. Here a suggestion of how it could look like. Slightly changing the interface of
For easy access, possibly make Old: async function waitForFinalTransactionOutcome<
T extends BaseTransaction = Transaction,
>(
client: Client,
txHash: string,
lastLedger: number,
submissionResult: string,
): Promise<TxResponse<T>> New: async function waitForFinalTransactionOutcome<
T extends BaseTransaction = Transaction,
>(
client: Client,
submitResponse: SubmitResponse<T>,
): Promise<TxResponse<T>> Usage: const submitResponse = await client.submit(...);
const txResponse = await client.waitForFinalTransactionOutcome(submitResponse); |
Problem: If a transaction is unsuccessful or is rejected (
accepted: false
, with tec code), the behavior of thesubmitAndWait
function is quite restricted. In certain cases, we would want to abort early and not wait for the sequence number timeout (can take quite some time). Furthermore, the function also doesn't provide a lot of details about the failure reason.Possible solutions:
opts
to fail immediately, if transaction is rejectedSubmitResponse
(likeClient.submit
) andPromise<TxResponse<T>>
, depending on the result one can choose not to resolve the promisewaitForFinalTransactionOutcome
function to allow developers to easily implement their own version ofsubmitAndWait
The text was updated successfully, but these errors were encountered: