use of org.fisco.bcos.web3j.abi.datatypes.generated.Uint256 in project web3sdk by FISCO-BCOS.
the class UtilsTest method encodeGetLengthTest.
@Test
public void encodeGetLengthTest() {
// uint256
assertThat(Utils.getLength(Arrays.asList(new Uint256(1))), is(1));
// int256
assertThat(Utils.getLength(Arrays.asList(new Int256(1))), is(1));
// bool
assertThat(Utils.getLength(Arrays.asList(new Bool(true))), is(1));
// address
assertThat(Utils.getLength(Arrays.asList(new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"))), is(1));
// bytes2
assertThat(Utils.getLength(Arrays.asList(new Bytes2("ab".getBytes()))), is(1));
// bytes32
assertThat(Utils.getLength(Arrays.asList(new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()))), is(1));
// bytes
assertThat(Utils.getLength(Arrays.asList(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()))), is(1));
// string
assertThat(Utils.getLength(Arrays.asList(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"))), is(1));
// uint256[4]
assertThat(Utils.getLength(Arrays.asList(new StaticArray4<Uint256>(new Uint256(1), new Uint256(1), new Uint256(1), new Uint256(1)))), is(4));
// uint256[5]
assertThat(Utils.getLength(Arrays.asList(new StaticArray5<Uint256>(new Uint256(1), new Uint256(1), new Uint256(1), new Uint256(1), new Uint256(1)))), is(5));
// uint256[]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<Uint256>(new Uint256(1), new Uint256(1), new Uint256(1), new Uint256(1), new Uint256(1)))), is(1));
// uint256[][2]
assertThat(Utils.getLength(Arrays.asList(new StaticArray2<DynamicArray>(new DynamicArray<Uint256>(new Uint256(1), new Uint256(1), new Uint256(1), new Uint256(1), new Uint256(1)), new DynamicArray<Uint256>(new Uint256(1), new Uint256(1), new Uint256(1), new Uint256(1), new Uint256(1))))), is(1));
// uint256[2][]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<StaticArray2>(new StaticArray2<Uint256>(new Uint256(1), new Uint256(1)), new StaticArray2<Uint256>(new Uint256(1), new Uint256(1))))), is(1));
// uint256[][]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<DynamicArray>(new DynamicArray<Uint256>(new Uint256(1), new Uint256(1)), new DynamicArray<Uint256>(new Uint256(1), new Uint256(1))))), is(1));
// uint256[2][2]
assertThat(Utils.getLength(Arrays.asList(new StaticArray2<StaticArray2>(new StaticArray2<Uint256>(new Uint256(1), new Uint256(1)), new StaticArray2<Uint256>(new Uint256(1), new Uint256(1))))), is(4));
// int256[4]
assertThat(Utils.getLength(Arrays.asList(new StaticArray4<Int256>(new Int256(1), new Int256(1), new Int256(1), new Int256(1)))), is(4));
// int256[5]
assertThat(Utils.getLength(Arrays.asList(new StaticArray5<Int256>(new Int256(1), new Int256(1), new Int256(1), new Int256(1), new Int256(1)))), is(5));
// int256[]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<Int256>(new Int256(1), new Int256(1), new Int256(1), new Int256(1), new Int256(1)))), is(1));
// int256[][2]
assertThat(Utils.getLength(Arrays.asList(new StaticArray2<DynamicArray>(new DynamicArray<Int256>(new Int256(1), new Int256(1), new Int256(1), new Int256(1), new Int256(1)), new DynamicArray<Int256>(new Int256(1), new Int256(1), new Int256(1), new Int256(1), new Int256(1))))), is(1));
// int256[][]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<DynamicArray>(new DynamicArray<Int256>(new Int256(1), new Int256(1), new Int256(1), new Int256(1), new Int256(1)), new DynamicArray<Int256>(new Int256(1), new Int256(1), new Int256(1), new Int256(1), new Int256(1))))), is(1));
// int256[2][]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<StaticArray2>(new StaticArray2<Int256>(new Int256(1), new Int256(1)), new StaticArray2<Int256>(new Int256(1), new Int256(1))))), is(1));
// int256[2][2]
assertThat(Utils.getLength(Arrays.asList(new StaticArray2<StaticArray2>(new StaticArray2<Int256>(new Int256(1), new Int256(1)), new StaticArray2<Int256>(new Int256(1), new Int256(1))))), is(4));
// bool[4]
assertThat(Utils.getLength(Arrays.asList(new StaticArray4<Bool>(new Bool(true), new Bool(true), new Bool(true), new Bool(true)))), is(4));
// bool[10]
assertThat(Utils.getLength(Arrays.asList(new StaticArray10<Bool>(new Bool(true), new Bool(true), new Bool(true), new Bool(true), new Bool(true), new Bool(true), new Bool(true), new Bool(true), new Bool(true), new Bool(true)))), is(10));
// bool[]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<Bool>(new Bool(true), new Bool(true), new Bool(true), new Bool(true), new Bool(true), new Bool(true), new Bool(true), new Bool(true), new Bool(true), new Bool(true)))), is(1));
// bool[][2]
assertThat(Utils.getLength(Arrays.asList(new StaticArray2<DynamicArray>(new DynamicArray<Bool>(new Bool(true), new Bool(true), new Bool(true), new Bool(true), new Bool(true)), new DynamicArray<Bool>(new Bool(true), new Bool(true), new Bool(true), new Bool(true), new Bool(true))))), is(1));
// bool[2][]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<StaticArray2>(new StaticArray2<Bool>(new Bool(true), new Bool(true)), new StaticArray2<Bool>(new Bool(true), new Bool(true))))), is(1));
// bool[][]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<DynamicArray>(new DynamicArray<Bool>(new Bool(true), new Bool(true)), new DynamicArray<Bool>(new Bool(true), new Bool(true))))), is(1));
// bool[2][2]
assertThat(Utils.getLength(Arrays.asList(new StaticArray2<StaticArray2>(new StaticArray2<Bool>(new Bool(true), new Bool(true)), new StaticArray2<Bool>(new Bool(true), new Bool(true))))), is(4));
// bool[2][2][2]
assertThat(Utils.getLength(Arrays.asList(new StaticArray2<StaticArray2<StaticArray2>>(new StaticArray2<StaticArray2>(new StaticArray2<Bool>(new Bool(true), new Bool(true)), new StaticArray2<Bool>(new Bool(true), new Bool(true))), new StaticArray2<StaticArray2>(new StaticArray2<Bool>(new Bool(true), new Bool(true)), new StaticArray2<Bool>(new Bool(true), new Bool(true)))))), is(8));
// address[4]
assertThat(Utils.getLength(Arrays.asList(new StaticArray4<Address>(new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa")))), is(4));
// address[5]
assertThat(Utils.getLength(Arrays.asList(new StaticArray5<Address>(new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa")))), is(5));
// address[]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<Address>(new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa")))), is(1));
// address[][2]
assertThat(Utils.getLength(Arrays.asList(new StaticArray2<DynamicArray>(new DynamicArray<Address>(new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa")), new DynamicArray<Address>(new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"))))), is(1));
// address[2][]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<StaticArray2>(new StaticArray2<Address>(new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa")), new StaticArray2<Address>(new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"))))), is(1));
// address[][]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<DynamicArray>(new DynamicArray<Address>(new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa")), new DynamicArray<Address>(new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"))))), is(1));
// address[3][3]
assertThat(Utils.getLength(Arrays.asList(new StaticArray3<StaticArray3>(new StaticArray3<Address>(new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa")), new StaticArray3<Address>(new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa")), new StaticArray3<Address>(new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"))))), is(9));
// bytes32[6]
assertThat(Utils.getLength(Arrays.asList(new StaticArray6<Bytes32>(new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())))), is(6));
// bytes32[]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<Bytes32>(new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())))), is(1));
// bytes32[][2]
assertThat(Utils.getLength(Arrays.asList(new StaticArray2<DynamicArray>(new DynamicArray<Bytes32>(new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())), new DynamicArray<Bytes32>(new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()))))), is(1));
// bytes32[2][]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<StaticArray2>(new StaticArray2<Bytes32>(new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())), new StaticArray2<Bytes32>(new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()))))), is(1));
// bytes32[][]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<DynamicArray>(new DynamicArray<Bytes32>(new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())), new DynamicArray<Bytes32>(new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()))))), is(1));
// bytes32[3][3]
assertThat(Utils.getLength(Arrays.asList(new StaticArray3<StaticArray3>(new StaticArray3<Bytes32>(new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())), new StaticArray3<Bytes32>(new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())), new StaticArray3<Bytes32>(new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()))))), is(9));
// string[2]
assertThat(Utils.getLength(Arrays.asList(new StaticArray2<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d")))), is(1));
// string[4]
assertThat(Utils.getLength(Arrays.asList(new StaticArray4<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d")))), is(1));
// string[]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d")))), is(1));
// string[][2]
assertThat(Utils.getLength(Arrays.asList(new StaticArray2<DynamicArray>(new DynamicArray<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d")), new DynamicArray<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"))))), is(1));
// string[2][]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<StaticArray2>(new StaticArray2<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d")), new StaticArray2<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"))))), is(1));
// string[][]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<DynamicArray>(new DynamicArray<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d")), new DynamicArray<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"))))), is(1));
// string[3][3]
assertThat(Utils.getLength(Arrays.asList(new StaticArray3<StaticArray3>(new StaticArray3<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d")), new StaticArray3<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d")), new StaticArray3<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"))))), is(1));
// bytes[2]
assertThat(Utils.getLength(Arrays.asList(new StaticArray2<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())))), is(1));
// bytes[3]
assertThat(Utils.getLength(Arrays.asList(new StaticArray3<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())))), is(1));
// bytes[]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())))), is(1));
// bytes[][2]
assertThat(Utils.getLength(Arrays.asList(new StaticArray2<DynamicArray>(new DynamicArray<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())), new DynamicArray<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()))))), is(1));
// bytes[2][]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<StaticArray2>(new StaticArray2<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())), new StaticArray2<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()))))), is(1));
// bytes[][]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<DynamicArray>(new DynamicArray<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())), new DynamicArray<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()))))), is(1));
// bytes[3][3]
assertThat(Utils.getLength(Arrays.asList(new StaticArray3<StaticArray3>(new StaticArray3<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())), new StaticArray3<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())), new StaticArray3<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()))))), is(1));
// int256
assertThat(Utils.getLength(Arrays.asList(new Int256(1))), is(1));
// uint256
assertThat(Utils.getLength(Arrays.asList(new Uint256(1))), is(1));
// int
assertThat(Utils.getLength(Arrays.asList(new Int(new BigInteger("1")))), is(1));
// uint
assertThat(Utils.getLength(Arrays.asList(new Uint(new BigInteger("1")))), is(1));
// address
assertThat(Utils.getLength(Arrays.asList(new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"))), is(1));
// int,uint,bool,address,bytes32,bytes,string
assertThat(Utils.getLength(Arrays.asList(new Int256(1), new Uint256(1), new Bool(true), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("aa".getBytes()), new Utf8String("bb"))), is(7));
// int[3],uint[3],bool[3],address[3],bytes32[3],bytes[3],string[3]
assertThat(Utils.getLength(Arrays.asList(new StaticArray3<Int256>(new Int256(1), new Int256(1), new Int256(1)), new StaticArray3<Uint256>(new Uint256(1), new Uint256(1), new Uint256(1)), new StaticArray3<Bool>(new Bool(true), new Bool(false), new Bool(true)), new StaticArray3<Address>(new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa")), new StaticArray3<Bytes32>(new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())), new StaticArray3<DynamicBytes>(new DynamicBytes("aa".getBytes()), new DynamicBytes("aa".getBytes()), new DynamicBytes("aa".getBytes())), new StaticArray3<Utf8String>(new Utf8String("bb"), new Utf8String("bb"), new Utf8String("bb")))), is(17));
// int[],uint[],bool[],address[],bytes32[],bytes[],string[]
assertThat(Utils.getLength(Arrays.asList(new DynamicArray<Int256>(new Int256(1), new Int256(1), new Int256(1)), new DynamicArray<Uint256>(new Uint256(1), new Uint256(1), new Uint256(1)), new DynamicArray<Bool>(new Bool(true), new Bool(false), new Bool(true)), new DynamicArray<Address>(new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa")), new DynamicArray<Bytes32>(new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())), new DynamicArray<DynamicBytes>(new DynamicBytes("aa".getBytes()), new DynamicBytes("aa".getBytes()), new DynamicBytes("aa".getBytes())), new DynamicArray<Utf8String>(new Utf8String("bb"), new Utf8String("bb"), new Utf8String("bb")))), is(7));
// int,uint,bool,address,bytes32,bytes,string,int[3],uint[3],bool[3],address[3],bytes32[3],bytes[3],string[3]
assertThat(Utils.getLength(Arrays.asList(new Int256(1), new Uint256(1), new Bool(true), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("aa".getBytes()), new Utf8String("bb"), new StaticArray3<Int256>(new Int256(1), new Int256(1), new Int256(1)), new StaticArray3<Uint256>(new Uint256(1), new Uint256(1), new Uint256(1)), new StaticArray3<Bool>(new Bool(true), new Bool(false), new Bool(true)), new StaticArray3<Address>(new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa")), new StaticArray3<Bytes32>(new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())), new StaticArray3<DynamicBytes>(new DynamicBytes("aa".getBytes()), new DynamicBytes("aa".getBytes()), new DynamicBytes("aa".getBytes())), new StaticArray3<Utf8String>(new Utf8String("bb"), new Utf8String("bb"), new Utf8String("bb")))), is(24));
// int,uint,bool,address,bytes32,bytes,string,int[],uint[],bool[],address[],bytes32[],bytes[],string[]
assertThat(Utils.getLength(Arrays.asList(new Int256(1), new Uint256(1), new Bool(true), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("aa".getBytes()), new Utf8String("bb"), new DynamicArray<Int256>(new Int256(1), new Int256(1), new Int256(1)), new DynamicArray<Uint256>(new Uint256(1), new Uint256(1), new Uint256(1)), new DynamicArray<Bool>(new Bool(true), new Bool(false), new Bool(true)), new DynamicArray<Address>(new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa"), new Address("0xb87213121fb89cbd8b877cb1bb3ff84dd2869cfa")), new DynamicArray<Bytes32>(new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new Bytes32("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())), new DynamicArray<DynamicBytes>(new DynamicBytes("aa".getBytes()), new DynamicBytes("aa".getBytes()), new DynamicBytes("aa".getBytes())), new DynamicArray<Utf8String>(new Utf8String("bb"), new Utf8String("bb"), new Utf8String("bb")))), is(14));
// uint256[][2],uint256[2][],uint256[][],uint256[2][2]
assertThat(Utils.getLength(Arrays.asList(new StaticArray2<DynamicArray>(new DynamicArray<Uint256>(new Uint256(1), new Uint256(1), new Uint256(1), new Uint256(1), new Uint256(1)), new DynamicArray<Uint256>(new Uint256(1), new Uint256(1), new Uint256(1), new Uint256(1), new Uint256(1))), new DynamicArray<StaticArray2>(new StaticArray2<Uint256>(new Uint256(1), new Uint256(1)), new StaticArray2<Uint256>(new Uint256(1), new Uint256(1))), new DynamicArray<DynamicArray>(new DynamicArray<Uint256>(new Uint256(1), new Uint256(1)), new DynamicArray<Uint256>(new Uint256(1), new Uint256(1))), new StaticArray2<StaticArray2>(new StaticArray2<Uint256>(new Uint256(1), new Uint256(1)), new StaticArray2<Uint256>(new Uint256(1), new Uint256(1))))), is(7));
// int256[][2],int256[2][],int256[][],int256[2][2]
assertThat(Utils.getLength(Arrays.asList(new StaticArray2<DynamicArray>(new DynamicArray<Int256>(new Int256(1), new Int256(1), new Int256(1), new Int256(1), new Int256(1)), new DynamicArray<Int256>(new Int256(1), new Int256(1), new Int256(1), new Int256(1), new Int256(1))), new DynamicArray<StaticArray2>(new StaticArray2<Int256>(new Int256(1), new Int256(1)), new StaticArray2<Int256>(new Int256(1), new Int256(1))), new DynamicArray<DynamicArray>(new DynamicArray<Int256>(new Int256(1), new Int256(1)), new DynamicArray<Int256>(new Int256(1), new Int256(1))), new StaticArray2<StaticArray2>(new StaticArray2<Int256>(new Int256(1), new Int256(1)), new StaticArray2<Int256>(new Int256(1), new Int256(1))))), is(7));
// string[][2],string[2][],string[][],string[3][3]
assertThat(Utils.getLength(Arrays.asList(new StaticArray2<DynamicArray>(new DynamicArray<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d")), new DynamicArray<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"))), new DynamicArray<StaticArray2>(new StaticArray2<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d")), new StaticArray2<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"))), new DynamicArray<DynamicArray>(new DynamicArray<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d")), new DynamicArray<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"))), new StaticArray3<StaticArray3>(new StaticArray3<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d")), new StaticArray3<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d")), new StaticArray3<Utf8String>(new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"), new Utf8String("b87213121fb89cbd8b877cb1bb3ff84d"))))), is(4));
// bytes[][2],bytes[2][],bytes[][],bytes[2][2]
assertThat(Utils.getLength(Arrays.asList(new StaticArray2<DynamicArray>(new DynamicArray<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())), new DynamicArray<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()))), new DynamicArray<StaticArray2>(new StaticArray2<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())), new StaticArray2<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()))), new DynamicArray<DynamicArray>(new DynamicArray<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())), new DynamicArray<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()))), new StaticArray3<StaticArray3>(new StaticArray3<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())), new StaticArray3<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes())), new StaticArray3<DynamicBytes>(new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()), new DynamicBytes("b87213121fb89cbd8b877cb1bb3ff84d".getBytes()))))), is(4));
}
use of org.fisco.bcos.web3j.abi.datatypes.generated.Uint256 in project web3sdk by FISCO-BCOS.
the class UtilsTest method testTypeMap.
@Test
public void testTypeMap() throws Exception {
final List<BigInteger> input = Arrays.asList(BigInteger.ZERO, BigInteger.ONE, BigInteger.TEN);
assertThat(Utils.typeMap(input, Uint256.class), equalTo(Arrays.asList(new Uint256(BigInteger.ZERO), new Uint256(BigInteger.ONE), new Uint256(BigInteger.TEN))));
}
use of org.fisco.bcos.web3j.abi.datatypes.generated.Uint256 in project web3sdk by FISCO-BCOS.
the class EventEncoderTest method testEventbuildMethodSignature7.
@Test
public void testEventbuildMethodSignature7() {
Event event = new Event("test7", Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {
}, new TypeReference<Address>() {
}, new TypeReference<Utf8String>() {
}, new TypeReference<DynamicArray<Uint256>>() {
}, new TypeReference<StaticArray3<Uint256>>() {
}, new TypeReference<DynamicArray<Utf8String>>() {
}, new TypeReference<StaticArray3<Utf8String>>() {
}, new TypeReference<DynamicArray<DynamicArray<Uint256>>>() {
}, new TypeReference<DynamicArray<StaticArray3<Uint256>>>() {
}));
assertThat(EventEncoder.buildMethodSignature(event.getName(), event.getParameters()), is("test7(uint256,address,string,uint256[],uint256[3],string[],string[3],uint256[][],uint256[3][])"));
assertThat(EventEncoder.encode(event), is("0x63c45f0c8793f28acf7f800281aaf63198c09afdef34c785429628237221a648"));
assertThat(EventEncoder.buildEventSignature("test7(uint256,address,string,uint256[],uint256[3],string[],string[3],uint256[][],uint256[3][])"), is("0x63c45f0c8793f28acf7f800281aaf63198c09afdef34c785429628237221a648"));
}
use of org.fisco.bcos.web3j.abi.datatypes.generated.Uint256 in project web3sdk by FISCO-BCOS.
the class EventEncoderTest method testEventbuildMethodSignature9.
@Test
public void testEventbuildMethodSignature9() {
Event event = new Event("test9", Arrays.<TypeReference<?>>asList(new TypeReference<Utf8String>() {
}, new TypeReference<Uint256>() {
}, new TypeReference<StaticArray6<Uint256>>() {
}, new TypeReference<DynamicArray<Uint256>>() {
}, new TypeReference<Bool>() {
}, new TypeReference<Address>() {
}));
assertThat(EventEncoder.buildMethodSignature(event.getName(), event.getParameters()), is("test9(string,uint256,uint256[6],uint256[],bool,address)"));
assertThat(EventEncoder.encode(event), is("0xa37d8a63087cf5837e0b9ff13d07d756479f8afdfe4b05ea3dfdc98154ef58ed"));
assertThat(EventEncoder.buildEventSignature("test9(string,uint256,uint256[6],uint256[],bool,address)"), is("0xa37d8a63087cf5837e0b9ff13d07d756479f8afdfe4b05ea3dfdc98154ef58ed"));
}
use of org.fisco.bcos.web3j.abi.datatypes.generated.Uint256 in project web3sdk by FISCO-BCOS.
the class EventEncoderTest method testEventbuildMethodSignature2.
@Test
public void testEventbuildMethodSignature2() {
Event event = new Event("f", Arrays.<TypeReference<?>>asList(new TypeReference<DynamicBytes>() {
}, new TypeReference<Bool>() {
}, new TypeReference<DynamicArray<Uint256>>() {
}));
assertThat(EventEncoder.buildMethodSignature(event.getName(), event.getParameters()), is("f(bytes,bool,uint256[])"));
assertThat(EventEncoder.encode(event), is("0xa83b3f0112fa8ecc02937d734929bbaa30731fe27b20195418852fb64ac2837d"));
assertThat(EventEncoder.buildEventSignature("f(bytes,bool,uint256[])"), is("0xa83b3f0112fa8ecc02937d734929bbaa30731fe27b20195418852fb64ac2837d"));
}
Aggregations