forked from bitsoex/bitso-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBitsoLedger.java
More file actions
29 lines (23 loc) · 776 Bytes
/
Copy pathBitsoLedger.java
File metadata and controls
29 lines (23 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.bitso;
import org.json.JSONArray;
import org.json.JSONObject;
import com.bitso.helpers.Helpers;
public class BitsoLedger {
BitsoOperation[] operations;
public BitsoLedger(JSONObject o){
JSONArray operationsJson = o.getJSONArray("payload");
operations = retrieveOperations(operationsJson);
}
private BitsoOperation[] retrieveOperations(JSONArray array){
int totalElements = array.length();
BitsoOperation[] operations = new BitsoOperation[totalElements];
for(int i=0; i<totalElements; i++){
operations[i] = new BitsoOperation(array.getJSONObject(i));
}
return operations;
}
@Override
public String toString() {
return Helpers.fieldPrinter(this);
}
}