use of org.xel.http.APICall.Builder in project elastic-core-maven by OrdinaryDude.
the class PhasingOnlyTest method testRejectingPendingTransaction.
@Test
public void testRejectingPendingTransaction() throws Exception {
Builder builder = new ACTestUtils.Builder("sendMoney", ALICE.getSecretPhrase()).recipient(BOB.getId()).param("amountNQT", 1 * Constants.ONE_NXT);
setTransactionPhasingParams(builder, 4, VotingModel.ACCOUNT, null, 1L, null, null, new long[] { BOB.getId(), CHUCK.getId() });
JSONObject sendMoneyJSON = ACTestUtils.assertTransactionSuccess(builder);
generateBlock();
builder = new ACTestUtils.Builder("setPhasingOnlyControl", ALICE.getSecretPhrase());
setControlPhasingParams(builder, VotingModel.ACCOUNT, null, 1L, null, null, new long[] { DAVE.getId() }, 0, 0, 0);
ACTestUtils.assertTransactionSuccess(builder);
generateBlock();
long balanceBeforeTransactionRejection = ACTestUtils.getAccountBalance(ALICE.getId(), "unconfirmedBalanceNQT");
String fullHash = (String) sendMoneyJSON.get("fullHash");
// approve the pending transaction
builder = new ACTestUtils.Builder("approveTransaction", BOB.getSecretPhrase()).param("transactionFullHash", fullHash);
ACTestUtils.assertTransactionSuccess(builder);
generateBlock();
// the sendMoney finish height
generateBlock();
// Assert the unconfirmed balance is recovered
Assert.assertEquals(balanceBeforeTransactionRejection + 1 * Constants.ONE_NXT, ACTestUtils.getAccountBalance(ALICE.getId(), "unconfirmedBalanceNQT"));
}
use of org.xel.http.APICall.Builder in project elastic-core-maven by OrdinaryDude.
the class PhasingOnlyTest method setPhasingOnlyControl.
private void setPhasingOnlyControl(VotingModel votingModel, String holdingId, Long quorum, Long minBalance, MinBalanceModel minBalanceModel, long[] whitelist, long maxFees, int minDuration, int maxDuration) {
Builder builder = new ACTestUtils.Builder("setPhasingOnlyControl", ALICE.getSecretPhrase());
setControlPhasingParams(builder, votingModel, holdingId, quorum, minBalance, minBalanceModel, whitelist, maxFees, minDuration, maxDuration);
APICall apiCall = builder.build();
JSONObject response = apiCall.invoke();
Logger.logMessage("setPhasingOnlyControl response: " + response.toJSONString());
String result = (String) response.get("transaction");
Assert.assertNotNull(result);
generateBlock();
}
Aggregations