starknet-rs icon indicating copy to clipboard operation
starknet-rs copied to clipboard

Starknet-rs Deployment: Checking Transaction Status for Subsequent Invocation

Open omarespejel opened this issue 1 year ago • 2 comments

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:

SequencerGatewayProvider::starknet_alpha_goerli()
            .wait_for_tx(BlockId::Pending, &transaction_hash, None)
            .unwrap();

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,

omarespejel avatar May 22 '23 04:05 omarespejel