@@ -7,37 +7,47 @@ tape('ABI translator', function (t) {
7
7
st . end ( ) ;
8
8
} ) ;
9
9
t . test ( '0.1.1 (no constructor)' , function ( st ) {
10
- st . deepEqual ( abi . update ( '0.1.1' , [ ] ) , [ { inputs : [ ] , payable : true , type : 'constructor' } , { payable : true , type : 'fallback' } ] ) ;
10
+ st . deepEqual ( abi . update ( '0.1.1' , [ ] ) , [ { inputs : [ ] , payable : true , stateMutability : 'payable' , type : 'constructor' } , { payable : true , stateMutability : 'payable' , type : 'fallback' } ] ) ;
11
11
st . end ( ) ;
12
12
} ) ;
13
13
t . test ( '0.3.6 (constructor)' , function ( st ) {
14
14
var input = [ { inputs : [ ] , type : 'constructor' } ] ;
15
- st . deepEqual ( abi . update ( '0.3.6' , input ) , [ { inputs : [ ] , payable : true , type : 'constructor' } , { payable : true , type : 'fallback' } ] ) ;
15
+ st . deepEqual ( abi . update ( '0.3.6' , input ) , [ { inputs : [ ] , payable : true , stateMutability : 'payable' , type : 'constructor' } , { payable : true , stateMutability : 'payable' , type : 'fallback' } ] ) ;
16
16
st . end ( ) ;
17
17
} ) ;
18
18
t . test ( '0.3.6 (function)' , function ( st ) {
19
19
var input = [ { inputs : [ ] , type : 'function' } ] ;
20
- st . deepEqual ( abi . update ( '0.3.6' , input ) , [ { inputs : [ ] , payable : true , type : 'function' } , { payable : true , type : 'fallback' } ] ) ;
20
+ st . deepEqual ( abi . update ( '0.3.6' , input ) , [ { inputs : [ ] , payable : true , stateMutability : 'payable' , type : 'function' } , { payable : true , stateMutability : 'payable' , type : 'fallback' } ] ) ;
21
21
st . end ( ) ;
22
22
} ) ;
23
23
t . test ( '0.3.6 (event)' , function ( st ) {
24
24
var input = [ { inputs : [ ] , type : 'event' } ] ;
25
- st . deepEqual ( abi . update ( '0.3.6' , input ) , [ { inputs : [ ] , type : 'event' } , { payable : true , type : 'fallback' } ] ) ;
25
+ st . deepEqual ( abi . update ( '0.3.6' , input ) , [ { inputs : [ ] , type : 'event' } , { payable : true , stateMutability : 'payable' , type : 'fallback' } ] ) ;
26
26
st . end ( ) ;
27
27
} ) ;
28
28
t . test ( '0.4.0 (has fallback)' , function ( st ) {
29
29
var input = [ { inputs : [ ] , type : 'constructor' } ] ;
30
- st . deepEqual ( abi . update ( '0.4.0' , input ) , [ { inputs : [ ] , payable : true , type : 'constructor' } ] ) ;
30
+ st . deepEqual ( abi . update ( '0.4.0' , input ) , [ { inputs : [ ] , payable : true , stateMutability : 'payable' , type : 'constructor' } ] ) ;
31
+ st . end ( ) ;
32
+ } ) ;
33
+ t . test ( '0.4.0 (constant function)' , function ( st ) {
34
+ var input = [ { inputs : [ ] , type : 'function' , constant : true } ] ;
35
+ st . deepEqual ( abi . update ( '0.4.0' , input ) , [ { inputs : [ ] , constant : true , stateMutability : 'view' , type : 'function' } ] ) ;
31
36
st . end ( ) ;
32
37
} ) ;
33
38
t . test ( '0.4.1 (constructor not payable)' , function ( st ) {
34
39
var input = [ { inputs : [ ] , payable : false , type : 'constructor' } ] ;
35
- st . deepEqual ( abi . update ( '0.4.1' , input ) , [ { inputs : [ ] , payable : true , type : 'constructor' } ] ) ;
40
+ st . deepEqual ( abi . update ( '0.4.1' , input ) , [ { inputs : [ ] , payable : true , stateMutability : 'payable' , type : 'constructor' } ] ) ;
36
41
st . end ( ) ;
37
42
} ) ;
38
43
t . test ( '0.4.5 (constructor payable)' , function ( st ) {
39
44
var input = [ { inputs : [ ] , payable : false , type : 'constructor' } ] ;
40
- st . deepEqual ( abi . update ( '0.4.5' , input ) , [ { inputs : [ ] , payable : false , type : 'constructor' } ] ) ;
45
+ st . deepEqual ( abi . update ( '0.4.5' , input ) , [ { inputs : [ ] , payable : false , stateMutability : 'nonpayable' , type : 'constructor' } ] ) ;
46
+ st . end ( ) ;
47
+ } ) ;
48
+ t . test ( '0.4.16 (statemutability)' , function ( st ) {
49
+ var input = [ { inputs : [ ] , payable : false , stateMutability : 'pure' , type : 'function' } ] ;
50
+ st . deepEqual ( abi . update ( '0.4.16' , input ) , [ { inputs : [ ] , payable : false , stateMutability : 'pure' , type : 'function' } ] ) ;
41
51
st . end ( ) ;
42
52
} ) ;
43
53
} ) ;
0 commit comments