mirror of
https://github.com/gosticks/iota.lib.java.git
synced 2026-10-04 13:37:00 +00:00
added GetTransferResponse and SendTransferResponse
This commit is contained in:
@@ -270,13 +270,13 @@ public class IotaAPIProxy {
|
||||
* @method getTransfers
|
||||
* @param {string} seed
|
||||
* @param {object} options
|
||||
* @property {int} start Starting key index
|
||||
* @param {function} callback
|
||||
* @property {int} start Starting key index
|
||||
* @property {int} end Ending key index
|
||||
* @property {bool} inclusionStates returns confirmation status of all transactions
|
||||
* @param {function} callback
|
||||
* @returns {object} success
|
||||
**/
|
||||
public Bundle[] getTransfers(String seed, Integer start, Integer end, Boolean inclusionStates) throws ArgumentException, InvalidBundleException, InvalidSignatureException {
|
||||
public GetTransferResponse getTransfers(String seed, Integer start, Integer end, Boolean inclusionStates) throws ArgumentException, InvalidBundleException, InvalidSignatureException {
|
||||
start = start != null ? 0 : start;
|
||||
end = end == null ? null : end;
|
||||
inclusionStates = inclusionStates != null ? inclusionStates : null;
|
||||
@@ -287,7 +287,7 @@ public class IotaAPIProxy {
|
||||
|
||||
GetNewAddressResponse gnr = getNewAddress(seed, start, false, end == null ? end - start : end, true);
|
||||
if (gnr != null && gnr.getAddresses() != null) {
|
||||
return bundlesFromAddresses(gnr.getAddresses().toArray(new String[gnr.getAddresses().size()]), inclusionStates);
|
||||
return GetTransferResponse.create(bundlesFromAddresses(gnr.getAddresses().toArray(new String[gnr.getAddresses().size()]), inclusionStates));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -808,11 +808,11 @@ public class IotaAPIProxy {
|
||||
return getInclusionStates(hashes, latestMilestone);
|
||||
}
|
||||
|
||||
public Transaction[] sendTransfer(String seed, int depth, int minWeightMagnitude, Transfer[] transactions, Input[] inputs, String address) {
|
||||
public SendTransferResponse sendTransfer(String seed, int depth, int minWeightMagnitude, Transfer[] transactions, Input[] inputs, String address) {
|
||||
|
||||
List<String> trytes = prepareTransfers(seed, Arrays.asList(transactions), address, inputs == null ? null : Arrays.asList(inputs));
|
||||
List<Transaction> trxs = sendTrytes(trytes.toArray(new String[trytes.size()]), minWeightMagnitude);
|
||||
return trxs.toArray(new Transaction[trxs.size()]);
|
||||
return SendTransferResponse.create(trxs.toArray(new Transaction[trxs.size()]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package jota.dto.response;
|
||||
|
||||
import jota.model.Bundle;
|
||||
import jota.model.Transfer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by pinpong on 28.12.16.
|
||||
*/
|
||||
public class GetTransferResponse {
|
||||
|
||||
private List<Transfer> transfers = new ArrayList<>();
|
||||
|
||||
public static GetTransferResponse create(Bundle[] transfers) {
|
||||
GetTransferResponse res = new GetTransferResponse();
|
||||
res.transfers = transfers;
|
||||
return res;
|
||||
}
|
||||
|
||||
public List<Transfer> getTransfers() {
|
||||
return transfers;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package jota.dto.response;
|
||||
|
||||
/**
|
||||
* Created by pinpong on 28.12.16.
|
||||
*/
|
||||
public class SendTransferResponse {
|
||||
|
||||
private Boolean successfully;
|
||||
|
||||
public static SendTransferResponse create(Boolean successfully) {
|
||||
SendTransferResponse res = new SendTransferResponse();
|
||||
res.successfully = successfully;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Boolean getSuccessfully() {
|
||||
return successfully;
|
||||
}
|
||||
|
||||
public void setSuccessfully(Boolean successfully) {
|
||||
this.successfully = successfully;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user