@@ -473,15 +473,26 @@ class BroadcasterUpdateTests extends BaseSecureOwnableTest {
473473 this . getRoleWalletObject ( 'owner' )
474474 ) ;
475475
476- // Try to get the txId from pending transactions
476+ const expectedOpType = this . getOperationType ( 'BROADCASTER_UPDATE' ) ;
477+
478+ // Try to find the broadcaster-update request among all pending transactions.
479+ // Other workflows (e.g. ERC20 mint) may leave unrelated pending txs around.
477480 for ( let i = 0 ; i < 5 ; i ++ ) {
478481 const pending = await this . callContractMethod ( this . contract . methods . getPendingTransactions ( ) ) ;
479- if ( pending . length > 0 ) {
480- const txId = pending [ 0 ] ;
481- const txRecord = await this . callContractMethod ( this . contract . methods . getTransaction ( txId ) ) ;
482- if ( txRecord . params . operationType === this . getOperationType ( 'BROADCASTER_UPDATE' ) ) {
483- console . log ( ` ✅ Broadcaster update request created` ) ;
484- return txRecord ;
482+ if ( pending && pending . length > 0 ) {
483+ for ( const txId of pending ) {
484+ const txRecord = await this . callContractMethod ( this . contract . methods . getTransaction ( txId ) ) ;
485+ const op = txRecord && txRecord . params && txRecord . params . operationType ;
486+ if (
487+ op &&
488+ ( op === expectedOpType ||
489+ ( typeof op === 'string' &&
490+ typeof expectedOpType === 'string' &&
491+ op . toLowerCase ( ) === expectedOpType . toLowerCase ( ) ) )
492+ ) {
493+ console . log ( ` ✅ Broadcaster update request created (txId: ${ txRecord . txId || txId } )` ) ;
494+ return txRecord ;
495+ }
485496 }
486497 }
487498 await new Promise ( resolve => setTimeout ( resolve , 1000 ) ) ;
0 commit comments