@@ -9,7 +9,7 @@ import { BatchUnstakingBuilder } from './batchUnstakingBuilder';
99import { WithdrawUnbondedBuilder } from './withdrawUnbondedBuilder' ;
1010import utils from './utils' ;
1111import { Interface , SingletonRegistry , TransactionBuilder } from './' ;
12- import { TxMethod } from './iface' ;
12+ import { TxMethod , BatchCallObject } from './iface' ;
1313import { Transaction as BaseTransaction } from '@bitgo/abstract-substrate' ;
1414import { Transaction as PolyxTransaction } from './transaction' ;
1515
@@ -77,15 +77,19 @@ export class TransactionBuilderFactory extends BaseTransactionBuilderFactory {
7777 } else if ( methodName === 'bondExtra' ) {
7878 return this . getBondExtraBuilder ( ) ;
7979 } else if ( methodName === 'batchAll' ) {
80- const args = decodedTxn . method . args as { calls ?: { method : string ; args : Record < string , unknown > } [ ] } ;
80+ const args = decodedTxn . method . args as { calls ?: BatchCallObject [ ] } ;
8181
8282 if ( args . calls && args . calls . length === 2 ) {
83+ // Decode method names from the calls using utils.decodeMethodName
84+ const firstCallMethod = utils . decodeMethodName ( args . calls [ 0 ] , registry ) ;
85+ const secondCallMethod = utils . decodeMethodName ( args . calls [ 1 ] , registry ) ;
86+
8387 // Check for batch staking pattern: bond + nominate
84- if ( args . calls [ 0 ] . method === 'bond' && args . calls [ 1 ] . method === 'nominate' ) {
88+ if ( firstCallMethod === 'bond' && secondCallMethod === 'nominate' ) {
8589 return this . getBatchBuilder ( ) ;
8690 }
8791 // Check for batch unstaking pattern: chill + unbond
88- if ( args . calls [ 0 ] . method === 'chill' && args . calls [ 1 ] . method === 'unbond' ) {
92+ if ( firstCallMethod === 'chill' && secondCallMethod === 'unbond' ) {
8993 return this . getBatchUnstakingBuilder ( ) ;
9094 }
9195 }
0 commit comments