@Test public void getBlockedAccounts_emptyList() throws IOException { setUpWireMockForInvokeFunction("getBlockedAccounts", "policy_getBlockedAccounts_empty.json"); PolicyContract policyContract = new PolicyContract(neow3j); assertNotNull(policyContract.getBlockedAccounts()); assertThat(policyContract.getBlockedAccounts().size(), is(0)); }
public List<ScriptHash> getBlockedAccounts() throws IOException { StackItem arrayItem = callInvokeFunction(GET_BLOCKED_ACCOUNTS) .getInvocationResult().getStack().get(0); if (!arrayItem.getType().equals(StackItemType.ARRAY)) { throw new UnexpectedReturnTypeException(arrayItem.getType(), StackItemType.ARRAY); } return arrayItem.asArray().getValue() .stream().map(ac -> ScriptHash.fromAddress(ac.asByteString().getAsAddress())) .collect(Collectors.toList()); }
PolicyContract extends SmartContract { public List<ScriptHash> getBlockedAccounts() throws IOException { StackItem arrayItem = callInvokeFunction(GET_BLOCKED_ACCOUNTS) .getInvocationResult().getStack().get(0); if (!arrayItem.getType().equals(StackItemType.ARRAY)) { throw new UnexpectedReturnTypeException(arrayItem.getType(), StackItemType.ARRAY); } return arrayItem.asArray().getValue() .stream().map(ac -> ScriptHash.fromAddress(ac.asByteString().getAsAddress())) .collect(Collectors.toList()); } }
PolicyContract extends SmartContract { public List<ScriptHash> getBlockedAccounts() throws IOException { StackItem arrayItem = callInvokeFunction(GET_BLOCKED_ACCOUNTS) .getInvocationResult().getStack().get(0); if (!arrayItem.getType().equals(StackItemType.ARRAY)) { throw new UnexpectedReturnTypeException(arrayItem.getType(), StackItemType.ARRAY); } return arrayItem.asArray().getValue() .stream().map(ac -> ScriptHash.fromAddress(ac.asByteString().getAsAddress())) .collect(Collectors.toList()); } PolicyContract(Neow3j neow); }
PolicyContract extends SmartContract { public List<ScriptHash> getBlockedAccounts() throws IOException { StackItem arrayItem = callInvokeFunction(GET_BLOCKED_ACCOUNTS) .getInvocationResult().getStack().get(0); if (!arrayItem.getType().equals(StackItemType.ARRAY)) { throw new UnexpectedReturnTypeException(arrayItem.getType(), StackItemType.ARRAY); } return arrayItem.asArray().getValue() .stream().map(ac -> ScriptHash.fromAddress(ac.asByteString().getAsAddress())) .collect(Collectors.toList()); } PolicyContract(Neow3j neow); Integer getMaxTransactionsPerBlock(); Integer getMaxBlockSize(); BigInteger getMaxBlockSystemFee(); Integer getFeePerByte(); List<ScriptHash> getBlockedAccounts(); TransactionBuilder setMaxBlockSize(Integer maxBlockSize); TransactionBuilder setMaxTransactionsPerBlock(Integer maxTxPerBlock); TransactionBuilder setMaxBlockSystemFee(BigInteger maxBlockSystemFee); TransactionBuilder setFeePerByte(Integer fee); TransactionBuilder blockAccount(ScriptHash accountToBlock); TransactionBuilder unblockAccount(ScriptHash accountToUnblock); }
PolicyContract extends SmartContract { public List<ScriptHash> getBlockedAccounts() throws IOException { StackItem arrayItem = callInvokeFunction(GET_BLOCKED_ACCOUNTS) .getInvocationResult().getStack().get(0); if (!arrayItem.getType().equals(StackItemType.ARRAY)) { throw new UnexpectedReturnTypeException(arrayItem.getType(), StackItemType.ARRAY); } return arrayItem.asArray().getValue() .stream().map(ac -> ScriptHash.fromAddress(ac.asByteString().getAsAddress())) .collect(Collectors.toList()); } PolicyContract(Neow3j neow); Integer getMaxTransactionsPerBlock(); Integer getMaxBlockSize(); BigInteger getMaxBlockSystemFee(); Integer getFeePerByte(); List<ScriptHash> getBlockedAccounts(); TransactionBuilder setMaxBlockSize(Integer maxBlockSize); TransactionBuilder setMaxTransactionsPerBlock(Integer maxTxPerBlock); TransactionBuilder setMaxBlockSystemFee(BigInteger maxBlockSystemFee); TransactionBuilder setFeePerByte(Integer fee); TransactionBuilder blockAccount(ScriptHash accountToBlock); TransactionBuilder unblockAccount(ScriptHash accountToUnblock); static final ScriptHash SCRIPT_HASH; }