Search in sources :

Example 1 with GetAttachToTangleResponse

use of jota.dto.response.GetAttachToTangleResponse in project isf-jclient by mikrohash.

the class IotaAPI method sendSpam.

public void sendSpam() throws ArgumentException {
    ArrayList<Transfer> transfers = new ArrayList<Transfer>();
    String message = UploadDataManager.getNextData();
    transfers.add(new Transfer(AddressManager.getSpamAddress(), 0, message, SpamThread.getTag()));
    List<Input> inputs = new ArrayList<Input>();
    List<String> trytes = prepareTransfers("", SECURITY, transfers, null, inputs, false);
    GetTransactionsToApproveResponse txs = TipPool.getTransactionsToApprove();
    while (txs == null) txs = NodeManager.getTransactionsToApprove(NodeManager.getRotatedAPI());
    final GetAttachToTangleResponse res = attachToTangle(txs.getTrunkTransaction(), txs.getBranchTransaction(), MIN_WEIGHT_MAGNITUDE, trytes.toArray(new String[trytes.size()]));
    TxBroadcaster.queueTrytes(res);
}
Also used : Input(jota.model.Input) GetAttachToTangleResponse(jota.dto.response.GetAttachToTangleResponse) Transfer(jota.model.Transfer) ArrayList(java.util.ArrayList) GetTransactionsToApproveResponse(jota.dto.response.GetTransactionsToApproveResponse)

Example 2 with GetAttachToTangleResponse

use of jota.dto.response.GetAttachToTangleResponse in project isf-jclient by mikrohash.

the class IotaAPI method createSpam.

public void createSpam() throws ArgumentException {
    ArrayList<Transfer> transfers = new ArrayList<Transfer>();
    String message = UploadDataManager.getNextData();
    transfers.add(new Transfer(AddressManager.getSpamAddress(), 0, message, SpamThread.getTag()));
    List<Input> inputs = new ArrayList<Input>();
    List<String> trytes = prepareTransfers("", SECURITY, transfers, null, inputs, false);
    String[] tips = TipPool.getTransactionsToApprove();
    while (tips == null) {
        GetTransactionsToApproveResponse gttar = NodeManager.getTransactionsToApprove(NodeManager.getRotatedAPI());
        tips = new String[] { gttar.getTrunkTransaction(), gttar.getBranchTransaction() };
    }
    final GetAttachToTangleResponse res = attachToTangle(tips[0], tips[1], MIN_WEIGHT_MAGNITUDE, trytes.toArray(new String[trytes.size()]));
    TxBroadcaster.queueTrytes(res);
}
Also used : Input(jota.model.Input) GetAttachToTangleResponse(jota.dto.response.GetAttachToTangleResponse) Transfer(jota.model.Transfer) ArrayList(java.util.ArrayList) GetTransactionsToApproveResponse(jota.dto.response.GetTransactionsToApproveResponse)

Aggregations

ArrayList (java.util.ArrayList)2 GetAttachToTangleResponse (jota.dto.response.GetAttachToTangleResponse)2 GetTransactionsToApproveResponse (jota.dto.response.GetTransactionsToApproveResponse)2 Input (jota.model.Input)2 Transfer (jota.model.Transfer)2