TokenRules { public String getTransactionExecutableData(List<String> addressListArray, List<String> transferAmountArray) { List<Address> addressList = new ArrayList<>(); List<Uint256> transferAmountList = new ArrayList<>(); for (String address : addressListArray) { addressList.add(new Address(address)); } for (String amount : transferAmountArray) { transferAmountList.add(new Uint256(new BigInteger(amount))); } Function function = new Function( DIRECT_TRANSFERS, Arrays.asList(new DynamicArray(addressList), new DynamicArray(transferAmountList)), Collections.emptyList()); return FunctionEncoder.encode(function); } TokenRules(); String getTransactionExecutableData(List<String> addressListArray, List<String> transferAmountArray); String getTransactionRawCallData(List<String> tokenHolderAddresses, List<String> amounts); String calDirectTransferSpendingLimit(List<String> amounts);  }
@Test public void testDirectTransferCallData() { String expectedOutput = "0x94ac7a3f0000000000000000000000000000000000000000000000000000000000" + "00004000000000000000000000000000000000000000000000000000000000000000800000000000000" + "0000000000000000000000000000000000000000000000000010000000000000000000000004a523bf8" + "cd96323e315df9442c6d04880c6fafb50000000000000000000000000000000000000000000000000000" + "00000000000100000000000000000000000000000000000000000000000000000002540be400"; List<String> tokenHolderAddresses = Arrays.asList("0x4a523bf8cd96323e315df9442c6d04880c6fafb5"); List<String> amounts = Arrays.asList("10000000000"); String encodeMessage = new TokenRules().getTransactionExecutableData(tokenHolderAddresses, amounts); assertEquals(expectedOutput, encodeMessage); }