use of co.rsk.test.builders.TransactionBuilder in project rskj by rsksmart.
the class TransactionFactoryHelper method createSampleTransactionWithData.
public static Transaction createSampleTransactionWithData(int from, int nonce, String data) {
Account sender = createAccount(from);
Transaction tx = new TransactionBuilder().sender(sender).receiverAddress(new byte[0]).nonce(nonce).data(data).gasLimit(BigInteger.valueOf(1000000)).build();
return tx;
}
use of co.rsk.test.builders.TransactionBuilder in project rskj by rsksmart.
the class ImmutableTransactionTest method createImmutableTransaction.
private static Transaction createImmutableTransaction() {
Account sender = new AccountBuilder().name("sender").build();
Account receiver = new AccountBuilder().name("receiver").build();
Transaction tx = new TransactionBuilder().sender(sender).receiver(receiver).value(BigInteger.TEN).nonce(2).immutable().build();
return tx;
}
use of co.rsk.test.builders.TransactionBuilder in project rskj by rsksmart.
the class MessageTest method createTransaction.
private static Transaction createTransaction(int number) {
AccountBuilder acbuilder = new AccountBuilder();
acbuilder.name("sender" + number);
Account sender = acbuilder.build();
acbuilder.name("receiver" + number);
Account receiver = acbuilder.build();
TransactionBuilder txbuilder = new TransactionBuilder();
return txbuilder.sender(sender).receiver(receiver).value(BigInteger.valueOf(number * 1000 + 1000)).build();
}
use of co.rsk.test.builders.TransactionBuilder in project rskj by rsksmart.
the class Web3ImplLogsTest method getWeb3WithContractCreationWithoutEvents.
private Web3Impl getWeb3WithContractCreationWithoutEvents() {
World world = new World();
Account acc1 = new AccountBuilder(world).name("notDefault").balance(Coin.valueOf(10000000)).build();
Block genesis = world.getBlockByName("g00");
/* contract compiled in data attribute of tx
contract greeter {
address owner;
modifier onlyOwner { if (msg.sender != owner) throw; _ ; }
function greeter() public {
owner = msg.sender;
}
function greet(string param) onlyOwner constant returns (string) {
return param;
}
} */
Transaction tx = new TransactionBuilder().sender(acc1).gasLimit(BigInteger.valueOf(100000)).gasPrice(BigInteger.ONE).data(compiledGreeter).build();
List<Transaction> txs = new ArrayList<>();
txs.add(tx);
BlockChainImpl blockChain = world.getBlockChain();
Block block1 = new BlockBuilder(world).parent(genesis).transactions(txs).build();
blockChain.tryToConnect(block1);
TransactionPool transactionPool = new TransactionPoolImpl(config, world.getRepository(), blockChain.getBlockStore(), null, null, null, 10, 100);
Web3Impl web3 = createWeb3(world.getBlockChain(), transactionPool);
web3.personal_newAccountWithSeed("notDefault");
return web3;
}
use of co.rsk.test.builders.TransactionBuilder in project rskj by rsksmart.
the class TxPoolModuleImplTest method createSampleTransaction.
private Transaction createSampleTransaction(int from, int to, long value, int nonce) {
Account sender = getAccount(from);
Account receiver = getAccount(to);
Transaction tx = new TransactionBuilder().sender(sender).receiver(receiver).nonce(nonce).value(BigInteger.valueOf(value)).build();
return tx;
}
Aggregations