/** * Broadcast a transaction on the Steem blockchain. This method will validate * the transaction and return immediately. Please notice that this does not mean * that the operation has been accepted and has been processed. If you want to * make sure that this is the case use the * {@link #broadcastTransactionSynchronous(SignedTransaction)} method. * * @param transaction * The {@link SignedTransaction} object to broadcast. * @throws SteemCommunicationException * <ul> * <li>If the server was not able to answer the request in the given * time (see * {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(int) * setResponseTimeout}).</li> * <li>If there is a connection problem.</li> * </ul> * @throws SteemResponseException * <ul> * <li>If the SteemJ is unable to transform the JSON response into a * Java object.</li> * <li>If the Server returned an error object.</li> * </ul> * @throws SteemInvalidTransactionException * In case the provided transaction is not valid. */ public void broadcastTransaction(SignedTransaction transaction) throws SteemCommunicationException, SteemResponseException, SteemInvalidTransactionException { NetworkBroadcastApi.broadcastTransaction(communicationHandler, transaction); }
/** * Broadcast a transaction on the Steem blockchain. This method will validate * the transaction and return after it has been accepted and applied. * * @param transaction * The {@link SignedTransaction} object to broadcast. * @return A {@link BroadcastTransactionSynchronousReturn} object providing * information about the block in which the transaction has been * applied. * @throws SteemCommunicationException * <ul> * <li>If the server was not able to answer the request in the given * time (see * {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(int) * setResponseTimeout}).</li> * <li>If there is a connection problem.</li> * </ul> * @throws SteemResponseException * <ul> * <li>If the SteemJ is unable to transform the JSON response into a * Java object.</li> * <li>If the Server returned an error object.</li> * </ul> * @throws SteemInvalidTransactionException * In case the provided transaction is not valid. */ public BroadcastTransactionSynchronousReturn broadcastTransactionSynchronous(SignedTransaction transaction) throws SteemCommunicationException, SteemResponseException, SteemInvalidTransactionException { return NetworkBroadcastApi.broadcastTransactionSynchronous(communicationHandler, transaction); }
/** * Broadcast a whole block. * * @param signedBlock * The {@link SignedBlock} object to broadcast. * @throws SteemCommunicationException * <ul> * <li>If the server was not able to answer the request in the given * time (see * {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(int) * setResponseTimeout}).</li> * <li>If there is a connection problem.</li> * </ul> * @throws SteemResponseException * <ul> * <li>If the SteemJ is unable to transform the JSON response into a * Java object.</li> * <li>If the Server returned an error object.</li> * </ul> */ public void broadcastBlock(SignedBlock signedBlock) throws SteemCommunicationException, SteemResponseException { NetworkBroadcastApi.broadcastBlock(communicationHandler, signedBlock); }
/** * Broadcast a transaction on the Steem blockchain. This method will validate * the transaction and return immediately. Please notice that this does not mean * that the operation has been accepted and has been processed. If you want to * make sure that this is the case use the * {@link #broadcastTransactionSynchronous(SignedTransaction)} method. * * @param transaction * The {@link SignedTransaction} object to broadcast. * @throws SteemCommunicationException * <ul> * <li>If the server was not able to answer the request in the given * time (see * {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(int) * setResponseTimeout}).</li> * <li>If there is a connection problem.</li> * </ul> * @throws SteemResponseException * <ul> * <li>If the SteemJ is unable to transform the JSON response into a * Java object.</li> * <li>If the Server returned an error object.</li> * </ul> * @throws SteemInvalidTransactionException * In case the provided transaction is not valid. */ public void broadcastTransaction(SignedTransaction transaction) throws SteemCommunicationException, SteemResponseException, SteemInvalidTransactionException { NetworkBroadcastApi.broadcastTransaction(communicationHandler, transaction); }
/** * Broadcast a transaction on the Steem blockchain. This method will validate * the transaction and return after it has been accepted and applied. * * @param transaction * The {@link SignedTransaction} object to broadcast. * @return A {@link BroadcastTransactionSynchronousReturn} object providing * information about the block in which the transaction has been * applied. * @throws SteemCommunicationException * <ul> * <li>If the server was not able to answer the request in the given * time (see * {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(int) * setResponseTimeout}).</li> * <li>If there is a connection problem.</li> * </ul> * @throws SteemResponseException * <ul> * <li>If the SteemJ is unable to transform the JSON response into a * Java object.</li> * <li>If the Server returned an error object.</li> * </ul> * @throws SteemInvalidTransactionException * In case the provided transaction is not valid. */ public BroadcastTransactionSynchronousReturn broadcastTransactionSynchronous(SignedTransaction transaction) throws SteemCommunicationException, SteemResponseException, SteemInvalidTransactionException { return NetworkBroadcastApi.broadcastTransactionSynchronous(communicationHandler, transaction); }
/** * Broadcast a whole block. * * @param signedBlock * The {@link SignedBlock} object to broadcast. * @throws SteemCommunicationException * <ul> * <li>If the server was not able to answer the request in the given * time (see * {@link eu.bittrade.libs.steemj.configuration.SteemJConfig#setResponseTimeout(int) * setResponseTimeout}).</li> * <li>If there is a connection problem.</li> * </ul> * @throws SteemResponseException * <ul> * <li>If the SteemJ is unable to transform the JSON response into a * Java object.</li> * <li>If the Server returned an error object.</li> * </ul> */ public void broadcastBlock(SignedBlock signedBlock) throws SteemCommunicationException, SteemResponseException { NetworkBroadcastApi.broadcastBlock(communicationHandler, signedBlock); }
/** * Test the * {@link eu.bittrade.libs.steemj.plugins.network.broadcast.api.NetworkBroadcastApi#broadcastTransaction(CommunicationHandler, eu.bittrade.libs.steemj.base.models.SignedTransaction)} * method. * * @throws SteemCommunicationException * If a communication error occurs. * @throws SteemResponseException * If the response is an error. * @throws SteemInvalidTransactionException * If the transaction is not valid. */ @Category({ IntegrationTest.class }) @Test public void testBroadcastTransaction() throws SteemCommunicationException, SteemResponseException, SteemInvalidTransactionException { ArrayList<AccountName> requiredPostingAuths = new ArrayList<>(); requiredPostingAuths.add(BaseTransactionalIT.STEEMJ_ACCOUNT_NAME); String id = "follow"; String json = (new FollowOperation(BaseTransactionalIT.STEEMJ_ACCOUNT_NAME, BaseTransactionalIT.DEZ_ACCOUNT_NAME, Arrays.asList(FollowType.BLOG))).toJson(); CustomJsonOperation customJsonOperation = new CustomJsonOperation(null, requiredPostingAuths, id, json); ArrayList<Operation> operations = new ArrayList<>(); operations.add(customJsonOperation); DynamicGlobalProperty globalProperties = steemJ.getDynamicGlobalProperties(); signedTransaction = new SignedTransaction(globalProperties.getHeadBlockId(), operations, null); signedTransaction.sign(); NetworkBroadcastApi.broadcastTransaction(COMMUNICATION_HANDLER, signedTransaction); }
.broadcastTransactionSynchronous(COMMUNICATION_HANDLER, signedTransaction);