@@ -323,6 +323,47 @@ test("Simple transaction executed", async () => {
323323 expect ( retrievedTransaction . collectionBlock ) . toBe ( previousBlock . number ! + 1n )
324324} )
325325
326+ test ( "A transaction created using calldata is executed correctly" , async ( ) => {
327+ const previousCount = await getCurrentCounterValue ( )
328+
329+ const calldata = encodeFunctionData ( {
330+ abi : abis . HappyCounter ,
331+ functionName : "increment" ,
332+ args : [ ] ,
333+ } )
334+
335+ const transaction = await txm . createTransaction ( {
336+ address : deployment . HappyCounter ,
337+ calldata,
338+ } )
339+
340+ transactionQueue . push ( transaction )
341+
342+ await mineBlock ( 2 )
343+
344+ const persistedTransaction = await getPersistedTransaction ( transaction . intentId )
345+
346+ if ( ! assertIsDefined ( persistedTransaction ) ) return
347+
348+ const executedTransaction = await txm . getTransaction ( transaction . intentId )
349+
350+ if ( ! assertIsOk ( executedTransaction ) ) return
351+
352+ const executedTransactionValue = executedTransaction . value
353+
354+ if ( ! assertIsDefined ( executedTransactionValue ) ) return
355+
356+ const receipt = await directBlockchainClient . getTransactionReceipt ( {
357+ hash : executedTransactionValue . attempts [ 0 ] . hash ,
358+ } )
359+
360+ expect ( persistedTransaction . status ) . toBe ( TransactionStatus . Success )
361+ expect ( persistedTransaction . calldata ) . toBe ( calldata )
362+ expect ( executedTransactionValue . status ) . toBe ( TransactionStatus . Success )
363+ expect ( receipt . status ) . toBe ( "success" )
364+ expect ( await getCurrentCounterValue ( ) ) . toBe ( previousCount + 1n )
365+ } )
366+
326367test ( "Transaction retried" , async ( ) => {
327368 const previousCount = await getCurrentCounterValue ( )
328369
@@ -845,44 +886,3 @@ test("RPC liveness monitor works correctly", async () => {
845886 configurable : true ,
846887 } )
847888} )
848-
849- test ( "A transaction created using calldata is executed correctly" , async ( ) => {
850- const previousCount = await getCurrentCounterValue ( )
851-
852- const calldata = encodeFunctionData ( {
853- abi : abis . HappyCounter ,
854- functionName : "increment" ,
855- args : [ ] ,
856- } )
857-
858- const transaction = await txm . createTransaction ( {
859- address : deployment . HappyCounter ,
860- calldata,
861- } )
862-
863- transactionQueue . push ( transaction )
864-
865- await mineBlock ( 2 )
866-
867- const persistedTransaction = await getPersistedTransaction ( transaction . intentId )
868-
869- if ( ! assertIsDefined ( persistedTransaction ) ) return
870-
871- const executedTransaction = await txm . getTransaction ( transaction . intentId )
872-
873- if ( ! assertIsOk ( executedTransaction ) ) return
874-
875- const executedTransactionValue = executedTransaction . value
876-
877- if ( ! assertIsDefined ( executedTransactionValue ) ) return
878-
879- const receipt = await directBlockchainClient . getTransactionReceipt ( {
880- hash : executedTransactionValue . attempts [ 0 ] . hash ,
881- } )
882-
883- expect ( persistedTransaction . status ) . toBe ( TransactionStatus . Success )
884- expect ( persistedTransaction . calldata ) . toBe ( calldata )
885- expect ( executedTransactionValue . status ) . toBe ( TransactionStatus . Success )
886- expect ( receipt . status ) . toBe ( "success" )
887- expect ( await getCurrentCounterValue ( ) ) . toBe ( previousCount + 1n )
888- } )
0 commit comments