On Circular, transactions are final as soon as the block is minted. There is no need to wait for multiple block confirmations since Circular is designed to prevent forking, ensuring blocks are final. This approach maintains strong security while offering fast transaction finality.
asyncfunctionsendAndCheckTransaction( ID, From, To, Timestamp, Type, Payload, Nonce, Signature, Blockchain) {try {// Submitting transactionconstdata=awaitCircular.SendTransaction(ID, From, To, Timestamp, Type, Payload, Nonce, Signature, Blockchain );// If the transaction is correctly receivedif (data.Result ===200) {// Extracts the TxIDvar TxID =data.Response.TxID;// Waits for the transaction to be finalizedconsttransaction=awaitCircular.GetTransactionOutcome( Blockchain,// Blockchain TxID,// Transaction waited on25// 25 seconds timeout );// If the transaction is foundif (transaction) {// Extracts the transaction statusif (transaction.Status) {constStatus=transaction.Status;// Calculation of the total fee paidvar TxFee =transaction.NagFee +transaction.BroadcastFee +transaction.ProcessingFee +transaction.ProtocolFee;// Extraction of the BlockID where the transaction isvar Block =transaction.BlockID;// Posts a message with the detailsalert(`TxID: ${TxID}\n Tx Status: ${Status}\n Fees: ${TxFee} CIRX\n BlockID: ${Block}`); } else {console.log('Status field is missing in the transaction response.'); } } else {console.log('Transaction not successful or Response was "Transaction Not Found".'); } } else {alert('Transaction Rejected: '+data.Reponse); } } catch (error) {console.error('Error:',error.message); }}