@Test(expected = IllegalArgumentException.class) public void testTransferFromSpecificAccounts_illegalAmountProvided() throws IOException { neoToken.transferFromSpecificAccounts(Wallet.createWallet(), RECIPIENT_SCRIPT_HASH, new BigDecimal("-2"), account1.getScriptHash()); }
public TransactionBuilder transferFromSpecificAccounts(Wallet wallet, ScriptHash to, BigDecimal amount, ScriptHash... from) throws IOException { if (from.length == 0) { throw new IllegalArgumentException( "An account address must be provided to build an invocation."); } if (amount.signum() < 0) { throw new IllegalArgumentException( "The parameter amount must be greater than or equal to 0"); } List<Account> accounts = new ArrayList<>(); for (ScriptHash fromScriptHash : from) { Account a = wallet.getAccount(fromScriptHash); if (a.isMultiSig() && !privateKeysArePresentForMultiSig(wallet, fromScriptHash)) { throw new IllegalArgumentException("The multi-sig account with script hash " + fromScriptHash.toString() + " does not have the corresponding private " + "keys in the wallet that are required for signing the transfer " + "transaction."); } accounts.add(a); } return buildMultiTransferInvocation(wallet, to, amount, accounts); }
Nep5Token extends SmartContract { public TransactionBuilder transferFromSpecificAccounts(Wallet wallet, ScriptHash to, BigDecimal amount, ScriptHash... from) throws IOException { if (from.length == 0) { throw new IllegalArgumentException( "An account address must be provided to build an invocation."); } if (amount.signum() < 0) { throw new IllegalArgumentException( "The parameter amount must be greater than or equal to 0"); } List<Account> accounts = new ArrayList<>(); for (ScriptHash fromScriptHash : from) { Account a = wallet.getAccount(fromScriptHash); if (a.isMultiSig() && !privateKeysArePresentForMultiSig(wallet, fromScriptHash)) { throw new IllegalArgumentException("The multi-sig account with script hash " + fromScriptHash.toString() + " does not have the corresponding private " + "keys in the wallet that are required for signing the transfer " + "transaction."); } accounts.add(a); } return buildMultiTransferInvocation(wallet, to, amount, accounts); } }
Nep5Token extends SmartContract { public TransactionBuilder transferFromSpecificAccounts(Wallet wallet, ScriptHash to, BigDecimal amount, ScriptHash... from) throws IOException { if (from.length == 0) { throw new IllegalArgumentException( "An account address must be provided to build an invocation."); } if (amount.signum() < 0) { throw new IllegalArgumentException( "The parameter amount must be greater than or equal to 0"); } List<Account> accounts = new ArrayList<>(); for (ScriptHash fromScriptHash : from) { Account a = wallet.getAccount(fromScriptHash); if (a.isMultiSig() && !privateKeysArePresentForMultiSig(wallet, fromScriptHash)) { throw new IllegalArgumentException("The multi-sig account with script hash " + fromScriptHash.toString() + " does not have the corresponding private " + "keys in the wallet that are required for signing the transfer " + "transaction."); } accounts.add(a); } return buildMultiTransferInvocation(wallet, to, amount, accounts); } Nep5Token(ScriptHash scriptHash, Neow3j neow); }
Nep5Token extends SmartContract { public TransactionBuilder transferFromSpecificAccounts(Wallet wallet, ScriptHash to, BigDecimal amount, ScriptHash... from) throws IOException { if (from.length == 0) { throw new IllegalArgumentException( "An account address must be provided to build an invocation."); } if (amount.signum() < 0) { throw new IllegalArgumentException( "The parameter amount must be greater than or equal to 0"); } List<Account> accounts = new ArrayList<>(); for (ScriptHash fromScriptHash : from) { Account a = wallet.getAccount(fromScriptHash); if (a.isMultiSig() && !privateKeysArePresentForMultiSig(wallet, fromScriptHash)) { throw new IllegalArgumentException("The multi-sig account with script hash " + fromScriptHash.toString() + " does not have the corresponding private " + "keys in the wallet that are required for signing the transfer " + "transaction."); } accounts.add(a); } return buildMultiTransferInvocation(wallet, to, amount, accounts); } Nep5Token(ScriptHash scriptHash, Neow3j neow); String getName(); String getSymbol(); BigInteger getTotalSupply(); int getDecimals(); BigInteger getBalanceOf(ScriptHash scriptHash); BigInteger getBalanceOf(Wallet wallet); TransactionBuilder transfer(Wallet wallet, ScriptHash to, BigDecimal amount); TransactionBuilder transferFromSpecificAccounts(Wallet wallet, ScriptHash to,
            BigDecimal amount, ScriptHash... from); TransactionBuilder transferFromDefaultAccount(Wallet wallet, ScriptHash to,
            BigDecimal amount); }
Nep5Token extends SmartContract { public TransactionBuilder transferFromSpecificAccounts(Wallet wallet, ScriptHash to, BigDecimal amount, ScriptHash... from) throws IOException { if (from.length == 0) { throw new IllegalArgumentException( "An account address must be provided to build an invocation."); } if (amount.signum() < 0) { throw new IllegalArgumentException( "The parameter amount must be greater than or equal to 0"); } List<Account> accounts = new ArrayList<>(); for (ScriptHash fromScriptHash : from) { Account a = wallet.getAccount(fromScriptHash); if (a.isMultiSig() && !privateKeysArePresentForMultiSig(wallet, fromScriptHash)) { throw new IllegalArgumentException("The multi-sig account with script hash " + fromScriptHash.toString() + " does not have the corresponding private " + "keys in the wallet that are required for signing the transfer " + "transaction."); } accounts.add(a); } return buildMultiTransferInvocation(wallet, to, amount, accounts); } Nep5Token(ScriptHash scriptHash, Neow3j neow); String getName(); String getSymbol(); BigInteger getTotalSupply(); int getDecimals(); BigInteger getBalanceOf(ScriptHash scriptHash); BigInteger getBalanceOf(Wallet wallet); TransactionBuilder transfer(Wallet wallet, ScriptHash to, BigDecimal amount); TransactionBuilder transferFromSpecificAccounts(Wallet wallet, ScriptHash to,
            BigDecimal amount, ScriptHash... from); TransactionBuilder transferFromDefaultAccount(Wallet wallet, ScriptHash to,
            BigDecimal amount);  }