Skip to content

Commit cf73007

Browse files
authored
Merge pull request #120 from PracticalParticle/work
feat: enhance broadcaster update transaction retrieval in Broadcaster…
2 parents ff6fdab + 55b4c50 commit cf73007

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

scripts/sanity/secure-ownable/broadcaster-update-tests.cjs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)