forked from Qortal/qortal
Include memo for incoming ARRR transactions.
This commit is contained in:
parent
57acf7dffe
commit
830a608b14
@ -534,7 +534,7 @@ public abstract class Bitcoiny implements ForeignBlockchain {
|
||||
amount = 0;
|
||||
}
|
||||
long timestampMillis = t.timestamp * 1000L;
|
||||
return new SimpleTransaction(t.txHash, timestampMillis, amount, fee, inputs, outputs);
|
||||
return new SimpleTransaction(t.txHash, timestampMillis, amount, fee, inputs, outputs, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -296,6 +296,7 @@ public class PirateChain extends Bitcoiny {
|
||||
Long timestamp = transactionJson.getLong("datetime");
|
||||
Long amount = transactionJson.getLong("amount");
|
||||
Long fee = transactionJson.getLong("fee");
|
||||
String memo = null;
|
||||
|
||||
if (transactionJson.has("incoming_metadata")) {
|
||||
JSONArray incomingMetadatas = transactionJson.getJSONArray("incoming_metadata");
|
||||
@ -305,10 +306,12 @@ public class PirateChain extends Bitcoiny {
|
||||
if (incomingMetadata.has("value")) {
|
||||
//String address = incomingMetadata.getString("address");
|
||||
Long value = incomingMetadata.getLong("value");
|
||||
//String memo = incomingMetadata.getString("memo");
|
||||
|
||||
amount = value; // TODO: figure out how to parse transactions with multiple incomingMetadata entries
|
||||
}
|
||||
|
||||
if (incomingMetadata.has("memo") && !incomingMetadata.isNull("memo")) {
|
||||
memo = incomingMetadata.getString("memo");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -316,7 +319,7 @@ public class PirateChain extends Bitcoiny {
|
||||
// TODO: JSONArray outgoingMetadatas = transactionJson.getJSONArray("outgoing_metadata");
|
||||
|
||||
long timestampMillis = Math.toIntExact(timestamp) * 1000L;
|
||||
SimpleTransaction transaction = new SimpleTransaction(txId, timestampMillis, amount, fee, null, null);
|
||||
SimpleTransaction transaction = new SimpleTransaction(txId, timestampMillis, amount, fee, null, null, memo);
|
||||
transactions.add(transaction);
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ public class SimpleTransaction {
|
||||
private long feeAmount;
|
||||
private List<Input> inputs;
|
||||
private List<Output> outputs;
|
||||
private String memo;
|
||||
|
||||
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@ -74,13 +75,14 @@ public class SimpleTransaction {
|
||||
public SimpleTransaction() {
|
||||
}
|
||||
|
||||
public SimpleTransaction(String txHash, Long timestamp, long totalAmount, long feeAmount, List<Input> inputs, List<Output> outputs) {
|
||||
public SimpleTransaction(String txHash, Long timestamp, long totalAmount, long feeAmount, List<Input> inputs, List<Output> outputs, String memo) {
|
||||
this.txHash = txHash;
|
||||
this.timestamp = timestamp;
|
||||
this.totalAmount = totalAmount;
|
||||
this.feeAmount = feeAmount;
|
||||
this.inputs = inputs;
|
||||
this.outputs = outputs;
|
||||
this.memo = memo;
|
||||
}
|
||||
|
||||
public String getTxHash() {
|
||||
|
Loading…
Reference in New Issue
Block a user