How to get transaction status in dapp?

Hello!
I can’t figure out how to get the transaction status in version 3.5 of the webSDK. (For example smart contract init, to get the address and subindex).

Previously I used to use

const status = await connection
				.getJsonRpcClient()
				.getTransactionStatus(submittedTxHash);

But now getJsonRpcClient() is not in connection. I also couldn’t find getTransactionStatus in the connection.
Could you please suggest what tools can be used to achieve the desired result?

The JSON RPC client is no longer supported. You have to use the GRPC client. I would also suggest updating the web SDK to the latest version.

I assume you’re using the browser wallet as the connection here? In this case, here is some documentation on how to use the grpc client exposed by the browser wallet API:

concordium-browser-wallet/packages/browser-wallet-api-helpers at main · Concordium/concordium-browser-wallet · GitHub.

Hope this helps.

1 Like

Thanks for the quick reply!
I looked at some of the documentation you sent me and saw how to call the smartcontract and get the txHash, but I couldn’t find methods to get the transaction status from the transaction hash (I need the status (success or failure code) and the index of the initialised smartcontract).

Maybe I’m looking for the wrong thing?

Once you have the GRPC client, you can invoke waitForTransactionFinalization on the client to both wait for the transaction to finalize on chain and get the transaction status of the finalized transaction.

That should get you where you want to go :slight_smile:

Oh thank you so much, this is just what I was looking for!