@Test public void failWithoutSettingWallet() throws Throwable { TransactionBuilder b = new TransactionBuilder(neow); exceptionRule.expect(TransactionConfigurationException.class); exceptionRule.expectMessage("wallet"); b.buildTransaction(); }
Transaction buildTransaction() throws Throwable { if (wallet == null) { throw new TransactionConfigurationException( "Cannot build a transaction without a wallet."); } if (script == null || script.length == 0) { throw new TransactionConfigurationException( "Cannot build a transaction without a script."); } if (validUntilBlock == null) { this.validUntilBlock( fetchCurrentBlockNr() + NeoConstants.MAX_VALID_UNTIL_BLOCK_INCREMENT - 1); } if (signers.isEmpty()) { throw new IllegalStateException("Can't create a transaction without any signer. " + "A transaction requires at least one signer with witness scope fee-only " + "or higher."); } long systemFee = getSystemFeeForScript(); long networkFee = calcNetworkFee() + additionalNetworkFee; BigInteger fees = BigInteger.valueOf(systemFee + networkFee); if (supplier != null && !canSenderCoverFees(fees)) { throw supplier.get(); } else if (consumer != null) { BigInteger senderGasBalance = getSenderGasBalance(); if (fees.compareTo(senderGasBalance) > 0) { consumer.accept(fees, senderGasBalance); } } return new Transaction(neow, version, nonce, validUntilBlock, signers, systemFee, networkFee, attributes, script, witnesses); }
TransactionBuilder { Transaction buildTransaction() throws Throwable { if (wallet == null) { throw new TransactionConfigurationException( "Cannot build a transaction without a wallet."); } if (script == null || script.length == 0) { throw new TransactionConfigurationException( "Cannot build a transaction without a script."); } if (validUntilBlock == null) { this.validUntilBlock( fetchCurrentBlockNr() + NeoConstants.MAX_VALID_UNTIL_BLOCK_INCREMENT - 1); } if (signers.isEmpty()) { throw new IllegalStateException("Can't create a transaction without any signer. " + "A transaction requires at least one signer with witness scope fee-only " + "or higher."); } long systemFee = getSystemFeeForScript(); long networkFee = calcNetworkFee() + additionalNetworkFee; BigInteger fees = BigInteger.valueOf(systemFee + networkFee); if (supplier != null && !canSenderCoverFees(fees)) { throw supplier.get(); } else if (consumer != null) { BigInteger senderGasBalance = getSenderGasBalance(); if (fees.compareTo(senderGasBalance) > 0) { consumer.accept(fees, senderGasBalance); } } return new Transaction(neow, version, nonce, validUntilBlock, signers, systemFee, networkFee, attributes, script, witnesses); } }
TransactionBuilder { Transaction buildTransaction() throws Throwable { if (wallet == null) { throw new TransactionConfigurationException( "Cannot build a transaction without a wallet."); } if (script == null || script.length == 0) { throw new TransactionConfigurationException( "Cannot build a transaction without a script."); } if (validUntilBlock == null) { this.validUntilBlock( fetchCurrentBlockNr() + NeoConstants.MAX_VALID_UNTIL_BLOCK_INCREMENT - 1); } if (signers.isEmpty()) { throw new IllegalStateException("Can't create a transaction without any signer. " + "A transaction requires at least one signer with witness scope fee-only " + "or higher."); } long systemFee = getSystemFeeForScript(); long networkFee = calcNetworkFee() + additionalNetworkFee; BigInteger fees = BigInteger.valueOf(systemFee + networkFee); if (supplier != null && !canSenderCoverFees(fees)) { throw supplier.get(); } else if (consumer != null) { BigInteger senderGasBalance = getSenderGasBalance(); if (fees.compareTo(senderGasBalance) > 0) { consumer.accept(fees, senderGasBalance); } } return new Transaction(neow, version, nonce, validUntilBlock, signers, systemFee, networkFee, attributes, script, witnesses); } protected  TransactionBuilder(Neow3j neow); }
TransactionBuilder { Transaction buildTransaction() throws Throwable { if (wallet == null) { throw new TransactionConfigurationException( "Cannot build a transaction without a wallet."); } if (script == null || script.length == 0) { throw new TransactionConfigurationException( "Cannot build a transaction without a script."); } if (validUntilBlock == null) { this.validUntilBlock( fetchCurrentBlockNr() + NeoConstants.MAX_VALID_UNTIL_BLOCK_INCREMENT - 1); } if (signers.isEmpty()) { throw new IllegalStateException("Can't create a transaction without any signer. " + "A transaction requires at least one signer with witness scope fee-only " + "or higher."); } long systemFee = getSystemFeeForScript(); long networkFee = calcNetworkFee() + additionalNetworkFee; BigInteger fees = BigInteger.valueOf(systemFee + networkFee); if (supplier != null && !canSenderCoverFees(fees)) { throw supplier.get(); } else if (consumer != null) { BigInteger senderGasBalance = getSenderGasBalance(); if (fees.compareTo(senderGasBalance) > 0) { consumer.accept(fees, senderGasBalance); } } return new Transaction(neow, version, nonce, validUntilBlock, signers, systemFee, networkFee, attributes, script, witnesses); } protected  TransactionBuilder(Neow3j neow); TransactionBuilder wallet(Wallet wallet); TransactionBuilder version(byte version); TransactionBuilder nonce(Long nonce); TransactionBuilder validUntilBlock(long blockNr); TransactionBuilder firstSigner(ScriptHash sender); TransactionBuilder signers(Signer... signers); TransactionBuilder additionalNetworkFee(Long fee); TransactionBuilder script(byte[] script); TransactionBuilder attributes(TransactionAttribute... attributes); NeoInvokeScript callInvokeScript(); Transaction sign(); Transaction getUnsignedTransaction(); TransactionBuilder doIfSenderCannotCoverFees(
            BiConsumer<BigInteger, BigInteger> consumer); TransactionBuilder throwIfSenderCannotCoverFees(
            Supplier<? extends Throwable> exceptionSupplier); }
TransactionBuilder { Transaction buildTransaction() throws Throwable { if (wallet == null) { throw new TransactionConfigurationException( "Cannot build a transaction without a wallet."); } if (script == null || script.length == 0) { throw new TransactionConfigurationException( "Cannot build a transaction without a script."); } if (validUntilBlock == null) { this.validUntilBlock( fetchCurrentBlockNr() + NeoConstants.MAX_VALID_UNTIL_BLOCK_INCREMENT - 1); } if (signers.isEmpty()) { throw new IllegalStateException("Can't create a transaction without any signer. " + "A transaction requires at least one signer with witness scope fee-only " + "or higher."); } long systemFee = getSystemFeeForScript(); long networkFee = calcNetworkFee() + additionalNetworkFee; BigInteger fees = BigInteger.valueOf(systemFee + networkFee); if (supplier != null && !canSenderCoverFees(fees)) { throw supplier.get(); } else if (consumer != null) { BigInteger senderGasBalance = getSenderGasBalance(); if (fees.compareTo(senderGasBalance) > 0) { consumer.accept(fees, senderGasBalance); } } return new Transaction(neow, version, nonce, validUntilBlock, signers, systemFee, networkFee, attributes, script, witnesses); } protected  TransactionBuilder(Neow3j neow); TransactionBuilder wallet(Wallet wallet); TransactionBuilder version(byte version); TransactionBuilder nonce(Long nonce); TransactionBuilder validUntilBlock(long blockNr); TransactionBuilder firstSigner(ScriptHash sender); TransactionBuilder signers(Signer... signers); TransactionBuilder additionalNetworkFee(Long fee); TransactionBuilder script(byte[] script); TransactionBuilder attributes(TransactionAttribute... attributes); NeoInvokeScript callInvokeScript(); Transaction sign(); Transaction getUnsignedTransaction(); TransactionBuilder doIfSenderCannotCoverFees(
            BiConsumer<BigInteger, BigInteger> consumer); TransactionBuilder throwIfSenderCannotCoverFees(
            Supplier<? extends Throwable> exceptionSupplier);  }