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

Expose result of await transactionWatcher.awaitCompleted(tx); to callback #15

Closed
janniksam opened this issue Oct 22, 2022 · 2 comments
Closed
Labels
enhancement New feature or request

Comments

@janniksam
Copy link

In many cases its necessary to know, if a transaction is failing or not.

We already call it here: sendTxOperations#L27

const transactionWatcher = new TransactionWatcher(apiNetworkProvider);
await transactionWatcher.awaitCompleted(tx);
setTransaction(tx);
cb?.({ transaction: tx, pending: false });

To be able to deal with the transactions status at a higher level I would suggest something like this:

const transactionWatcher = new TransactionWatcher(apiNetworkProvider);
const txResult = await transactionWatcher.awaitCompleted(tx);
setTransaction(tx);
cb?.({ transaction: tx, pending: false; result: txResult });
@juliancwirko juliancwirko added the enhancement New feature or request label Oct 22, 2022
@juliancwirko
Copy link
Member

juliancwirko commented Oct 22, 2022

Good point. It may need more work, like global states handling responses from smart contracts, etc. I added it to the todo list: https://github.com/orgs/xdevguild/projects/1. I'll get back to it shortly

@juliancwirko
Copy link
Member

useTransaction and useScTransaction now return txResult

const { pending, triggerTx, transaction, txResult, error } = useTransaction({ cb });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

2 participants