@@ -9,7 +9,7 @@ import { BatchUnstakingBuilder } from './batchUnstakingBuilder';
9
9
import { WithdrawUnbondedBuilder } from './withdrawUnbondedBuilder' ;
10
10
import utils from './utils' ;
11
11
import { Interface , SingletonRegistry , TransactionBuilder } from './' ;
12
- import { TxMethod } from './iface' ;
12
+ import { TxMethod , BatchCallObject } from './iface' ;
13
13
import { Transaction as BaseTransaction } from '@bitgo/abstract-substrate' ;
14
14
import { Transaction as PolyxTransaction } from './transaction' ;
15
15
@@ -77,15 +77,19 @@ export class TransactionBuilderFactory extends BaseTransactionBuilderFactory {
77
77
} else if ( methodName === 'bondExtra' ) {
78
78
return this . getBondExtraBuilder ( ) ;
79
79
} 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 [ ] } ;
81
81
82
82
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
+
83
87
// 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' ) {
85
89
return this . getBatchBuilder ( ) ;
86
90
}
87
91
// 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' ) {
89
93
return this . getBatchUnstakingBuilder ( ) ;
90
94
}
91
95
}
0 commit comments