@@ -71,14 +71,21 @@ class InputDataDecoder {
71
71
if ( typeof data !== 'string' ) {
72
72
data = ''
73
73
}
74
-
75
74
data = data . trim ( )
76
75
77
76
const dataBuf = Buffer . from ( data . replace ( / ^ 0 x / , '' ) , 'hex' )
78
77
const methodId = toHexString ( dataBuf . subarray ( 0 , 4 ) )
79
78
var inputsBuf = dataBuf . subarray ( 4 )
80
79
80
+ // console.log(methodId)
81
+ // console.log(inputsBuf.toString('hex'))
82
+
81
83
const result = this . abi . reduce ( ( acc , obj ) => {
84
+ // console.log('acc')
85
+ // console.log(acc)
86
+ // console.log('obj')
87
+ // console.log(obj)
88
+
82
89
if ( obj . type === 'constructor' ) return acc
83
90
if ( obj . type === 'event' ) return acc
84
91
const method = obj . name || null
@@ -164,21 +171,20 @@ class InputDataDecoder {
164
171
165
172
// remove 0x from addresses
166
173
function deepStripTupleAddresses ( input , tupleTypes ) {
167
- // check for deeper nested tuples recursively
168
- if ( Array . isArray ( input [ 0 ] ) ) {
169
- return input . map ( function ( item ) {
170
- return deepStripTupleAddresses ( item , tupleTypes )
171
- } )
172
- }
173
174
174
175
return input . map ( ( item , i ) => {
175
- const type = tupleTypes [ i ] . type
176
+ const type = tupleTypes [ i ] ? tupleTypes [ i ] . type : tupleTypes
177
+
176
178
if ( type === 'address' && typeof item === 'string' ) {
177
179
return item . split ( '0x' ) [ 1 ]
178
180
}
179
181
if ( type === 'address[]' || Array . isArray ( ) ) {
180
182
return item . map ( a => a . split ( '0x' ) [ 1 ] )
181
183
}
184
+
185
+ if ( Array . isArray ( item ) ) {
186
+ return deepStripTupleAddresses ( item , tupleTypes )
187
+ }
182
188
return item
183
189
} )
184
190
}
0 commit comments