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
We're currently authoring tutorials about starknet-rs for the StarkNet Book. As part of this effort, we're developing a function that deploys a contract and then calls upon this newly deployed contract, all within the same script.
To ensure seamless operation, we need to verify that the contract deployment transaction has been accepted on L2 before we proceed to the invocation part. Could you recommend the best approach for confirming a transaction's status on L2 using starknet-rs?
Specifically, we're looking for a function or method that efficiently fetches the status of a specific transaction hash, and then allows further execution only if the status is 'Accepted' on L2.
Thank you for your time and support.
Best Regards,
The text was updated successfully, but these errors were encountered:
Thanks for reaching out and I'm glad you like the library :)
Transaction watching isn't something that's built-in right now, and applications must implement their own watching logic. For example, this is how it's currently implemented in starkli:
This feature should be part of starknet-rs though. I'd imagine a dedicated TransactionWatcher type that can be either manually constructed or converted from any transaction submission response tyoes. And with this type users should be able to configure poll interval, timeout, and expected transaction status.
That said, as of today, a naive loop as demostrated in the starkli example above should be the best way.
I'll leave this issue open for tracking the implementation of this feature.
Thanks for the speedy response, @xJonathanLEI! Thank you for referencing me to the watch_tx function, I will be employing a similar logic in the Book tutorial! Our goal is to get more persons to use starknet-rs.
Also, your insights make sense - a built-in TransactionWatcher could be a strong addition to starknet-rs. For now, using the simple loop from starkli seems like our best bet for the Book. Looking forward to tracking the progress of this feature.
Hey! Big fan of
starknet-rs
here.We're currently authoring tutorials about starknet-rs for the StarkNet Book. As part of this effort, we're developing a function that deploys a contract and then calls upon this newly deployed contract, all within the same script.
To ensure seamless operation, we need to verify that the contract deployment transaction has been accepted on L2 before we proceed to the invocation part. Could you recommend the best approach for confirming a transaction's status on L2 using starknet-rs?
I can imagine something like:
Specifically, we're looking for a function or method that efficiently fetches the status of a specific transaction hash, and then allows further execution only if the status is 'Accepted' on L2.
Thank you for your time and support.
Best Regards,
The text was updated successfully, but these errors were encountered: