use of org.aion.types.Transaction in project aion by aionnetwork.
the class InvokableTransactionTest method encodeDecodeContractCreateTest.
@Test
public void encodeDecodeContractCreateTest() {
Transaction tx = Transaction.contractCreateTransaction(new AionAddress(key.getAddress()), new byte[0], BigInteger.ZERO, BigInteger.ZERO, new byte[0], 1L, 1L);
AionAddress executor = AddressUtils.ZERO_ADDRESS;
byte[] invokable = InvokableTxUtil.encodeInvokableTransaction(key, tx.nonce, tx.destinationAddress, tx.value, tx.copyOfTransactionData(), executor);
InternalTransaction tx2 = InvokableTxUtil.decode(invokable, AddressUtils.ZERO_ADDRESS, 1L, 1L);
assertNotNull(tx2);
assertEquals(tx.destinationAddress, tx2.destination);
assertEquals(tx.nonce, tx2.senderNonce);
assertEquals(tx.value, tx2.value);
assertArrayEquals(tx.copyOfTransactionData(), tx2.copyOfData());
}
use of org.aion.types.Transaction in project aion by aionnetwork.
the class AvmTransactionExecutor method toAionTypesTransactions.
/**
* Converts the specified transactions to equivalent aion_types transactions.
*
* @param transactions The transactions to convert.
* @return the converted transactions.
*/
private static Transaction[] toAionTypesTransactions(AionTransaction[] transactions) {
Transaction[] aionTypesTransactions = new Transaction[transactions.length];
int index = 0;
for (AionTransaction transaction : transactions) {
aionTypesTransactions[index] = toAionTypesTransaction(transaction);
index++;
}
return aionTypesTransactions;
}
Aggregations