@@ -39,6 +39,10 @@ class ContractFunction extends Component {
39
39
return ! this . isPureCall ( method ) && ( method . type === 'event' ) ;
40
40
}
41
41
42
+ static isFallback ( method ) {
43
+ return method . type === 'fallback' ;
44
+ }
45
+
42
46
buttonTitle ( ) {
43
47
const { method} = this . props ;
44
48
if ( method . name === 'constructor' ) {
@@ -140,24 +144,31 @@ class ContractFunction extends Component {
140
144
'border-bottom-0' : ! this . state . functionCollapse ,
141
145
'rounded' : ! this . state . functionCollapse
142
146
} ) }
143
- onClick = { ( ) => this . toggleFunction ( ) } >
147
+ onClick = { ContractFunction . isFallback ( this . props . method )
148
+ ? ( ) => { }
149
+ : ( ) => this . toggleFunction ( ) } >
144
150
< CardTitle >
145
151
< span className = "contract-function-signature" >
146
- { `${ this . props . method . name } ` +
152
+ { ContractFunction . isFallback ( this . props . method )
153
+ ? 'function()'
154
+ : `${ this . props . method . name } ` +
147
155
`(${ this . props . method . inputs . map ( i => i . name ) . join ( ', ' ) } )` }
148
156
</ span >
149
157
< div >
150
- { ( ContractFunction . isPureCall ( this . props . method ) &&
151
- this . makeBadge ( 'success' , 'white' , 'call' ) ) ||
152
- this . makeBadge ( 'warning' , 'black' , 'send' ) }
158
+ { ContractFunction . isFallback ( this . props . method )
159
+ ? this . makeBadge ( 'light' , 'black' , 'fallback' )
160
+ : ( ContractFunction . isPureCall ( this . props . method ) &&
161
+ this . makeBadge ( 'success' , 'white' , 'call' ) ) ||
162
+ this . makeBadge ( 'warning' , 'black' , 'send' ) }
153
163
</ div >
154
164
</ CardTitle >
155
165
</ CardHeader >
156
- < Collapse isOpen = { this . state . functionCollapse } className = "relative" >
166
+ { ! ContractFunction . isFallback ( this . props . method ) &&
167
+ < Collapse isOpen = { this . state . functionCollapse } className = "relative" >
157
168
< CardBody >
158
169
< Form inline >
159
- { this . props . method . inputs . map ( input => (
160
- < FormGroup key = { input . name } >
170
+ { this . props . method . inputs . map ( ( input , idx ) => (
171
+ < FormGroup key = { idx } >
161
172
< Label for = { input . name } className = "mr-2 font-weight-bold contract-function-input" >
162
173
{ input . name }
163
174
</ Label >
@@ -240,7 +251,7 @@ class ContractFunction extends Component {
240
251
) ) }
241
252
</ ListGroup >
242
253
</ CardFooter > }
243
- </ Collapse >
254
+ </ Collapse > }
244
255
</ Card >
245
256
) ;
246
257
}
@@ -275,7 +286,7 @@ const ContractOverview = (props) => {
275
286
. filter ( ( method ) => {
276
287
return props . onlyConstructor ? method . type === 'constructor' : method . type !== 'constructor' ;
277
288
} )
278
- . map ( method => < ContractFunction key = { method . name }
289
+ . map ( ( method , idx ) => < ContractFunction key = { idx }
279
290
contractName = { contract . className }
280
291
method = { method }
281
292
contractFunctions = { filterContractFunctions ( props . contractFunctions , contract . className , method . name ) }
0 commit comments