File tree Expand file tree Collapse file tree 5 files changed +38
-19
lines changed
main/java/cc/etherspace/web3j Expand file tree Collapse file tree 5 files changed +38
-19
lines changed Original file line number Diff line number Diff line change @@ -41,4 +41,20 @@ contract greeter is mortal {
4141 event Modified (
4242 string indexed oldGreetingIdx , string indexed newGreetingIdx ,
4343 string oldGreeting , string newGreeting );
44+
45+ function boolType (bool a ) constant returns (bool ) {
46+ return a;
47+ }
48+
49+ function intType (int a ) constant returns (int ) {
50+ return a;
51+ }
52+
53+ function uintType (uint a ) constant returns (uint ) {
54+ return a;
55+ }
56+
57+ function int24Type (int24 a ) constant returns (int24 ) {
58+ return a;
59+ }
4460}
Original file line number Diff line number Diff line change @@ -110,16 +110,21 @@ class Web3jAbi : Web3.Abi {
110110 val web3jType = when {
111111 typeToken.childOf(String ::class ) -> Utf8String ::class .java
112112 typeToken.childOf(Boolean ::class ) -> Bool ::class .java
113+ typeToken.childOf(java.lang.Boolean ::class ) -> Bool ::class .java
113114 typeToken.childOf(BigInteger ::class ) -> Int256 ::class .java
114115 typeToken.childOf(Short ::class ) -> Int16 ::class .java
116+ typeToken.childOf(java.lang.Short ::class ) -> Int16 ::class .java
115117 typeToken.childOf(Int ::class ) -> Int32 ::class .java
118+ typeToken.childOf(java.lang.Integer ::class ) -> Int32 ::class .java
116119 typeToken.childOf(Long ::class ) -> Int64 ::class .java
120+ typeToken.childOf(java.lang.Long ::class ) -> Int64 ::class .java
117121 typeToken.childOf(Ushort ::class ) -> Uint16 ::class .java
118122 typeToken.childOf(unsigned.Uint ::class ) -> Uint32 ::class .java
119123 typeToken.childOf(Ulong ::class ) -> Uint64 ::class .java
120124 typeToken.childOf(SolNumber ::class ) -> typeToken.toWeb3jNumberType()
121125 typeToken.childOf(SolAddress ::class ) -> Address ::class .java
122126 typeToken.childOf(Byte ::class ) -> Bytes1 ::class .java
127+ typeToken.childOf(java.lang.Byte ::class ) -> Bytes1 ::class .java
123128 typeToken.childOf(SolBytes ::class ) -> typeToken.toWeb3jBytesType()
124129 typeToken.childOf(ByteArray ::class ) -> DynamicBytes ::class .java
125130 typeToken.childOf(List ::class ) -> toWeb3jArrayType(typeToken)
Original file line number Diff line number Diff line change @@ -45,6 +45,15 @@ class LocalGreeterTest {
4545 ret.`should equal`(SolUint256 (3 ))
4646 }
4747
48+ @Test
49+ fun boolType () {
50+ var b = greeter.boolType(true )
51+ b.`should be equal to`(true )
52+
53+ b = greeter.boolType(false )
54+ b.`should be equal to`(false )
55+ }
56+
4857 @Test
4958 fun newGreeting () {
5059 val receipt = greeter.newGreeting(" Hello World" )
Original file line number Diff line number Diff line change @@ -25,13 +25,9 @@ interface CoroutineGreeter {
2525 @Call
2626 fun greet_wrongFunctionName (): Deferred <String >
2727
28- @Throws(IOException ::class )
29- @Send
30- fun newPersonalGreeting (from : String , greeting : String ): Deferred <String >
31-
3228 @Throws(IOException ::class )
3329 @Call
34- fun personalGreet ( ): Deferred <Pair < String , String > >
30+ fun boolType ( bool : Boolean ): Deferred <Boolean >
3531
3632 data class Modified @EventConstructor constructor(@Indexed(value = String ::class ) val oldGreetingIdx : SolBytes32 ,
3733 @Indexed(value = String ::class ) val newGreetingIdx : SolBytes32 ,
Original file line number Diff line number Diff line change @@ -3,9 +3,7 @@ package cc.etherspace.calladapter
33import cc.etherspace.*
44import kotlinx.coroutines.experimental.Deferred
55import kotlinx.coroutines.experimental.runBlocking
6- import org.amshove.kluent.`should be equal to`
7- import org.amshove.kluent.`should be greater than`
8- import org.amshove.kluent.`should equal`
6+ import org.amshove.kluent.*
97import org.junit.Before
108import org.junit.Test
119import org.web3j.utils.Numeric
@@ -83,19 +81,14 @@ class CoroutineGreeterTest {
8381 }
8482 }
8583
86- fun newPersonalGreeting () {
87- runBlocking {
88- val transactionHash = greeter.newPersonalGreeting(" tempo" , " Hello World" ).await()
89- transactionHash.length.`should be equal to`(66 )
90- }
91- }
92-
9384 @Test
94- fun personalGreet () {
85+ fun boolType () {
9586 runBlocking {
96- val pair = greeter.personalGreet().await()
97- pair.first.`should equal`(" tempo" )
98- pair.second.`should equal`(" Hello World" )
87+ var greet = greeter.boolType(true ).await()
88+ greet.`should be true `()
89+
90+ greet = greeter.boolType(false ).await()
91+ greet.`should be false `()
9992 }
10093 }
10194}
You can’t perform that action at this time.
0 commit comments