use of org.aion.solidity.SolidityType.BytesType in project aion by aionnetwork.
the class SolidityTypeTest method testBytes1.
@Test
public void testBytes1() throws Exception {
byte[] x = Hex.decode("1122334455667788");
SolidityType type = new BytesType();
byte[] params = ByteUtil.merge(Hex.decode("00000000000000000000000000000010"), type.encode(x));
System.out.println(Hex.toHexString(params));
AionTransaction tx = createTransaction(ByteUtil.merge(Hex.decode("61cb5a01"), params));
MiningBlock block = createDummyBlock();
RepositoryCache repo = createRepository(tx);
AionTxReceipt receipt = executeTransaction(tx, block, repo).getReceipt();
System.out.println(receipt);
assertArrayEquals(params, receipt.getTransactionOutput());
assertArrayEquals(x, (byte[]) type.decode(receipt.getTransactionOutput(), 16));
}
use of org.aion.solidity.SolidityType.BytesType in project aion by aionnetwork.
the class SolidityTypeTest method testBytes2.
@Test
public void testBytes2() throws Exception {
byte[] x = Hex.decode("11223344556677881122334455667788112233445566778811223344556677881122334455667788");
SolidityType type = new BytesType();
byte[] params = ByteUtil.merge(Hex.decode("00000000000000000000000000000010"), type.encode(x));
System.out.println(Hex.toHexString(params));
AionTransaction tx = createTransaction(ByteUtil.merge(Hex.decode("61cb5a01"), params));
MiningBlock block = createDummyBlock();
RepositoryCache repo = createRepository(tx);
AionTxReceipt receipt = executeTransaction(tx, block, repo).getReceipt();
System.out.println(receipt);
assertArrayEquals(params, receipt.getTransactionOutput());
assertArrayEquals(x, (byte[]) type.decode(receipt.getTransactionOutput(), 16));
}
Aggregations