Reintroducing the GetKeyReferences single argument constructor in order to maintain backwards compatibility

This commit is contained in:
Nelson R. Perez 2017-04-17 16:05:57 -05:00
parent 85430b8b46
commit c9c33566fa

View file

@ -23,21 +23,29 @@ import de.bitsharesmunich.graphenej.models.WitnessResponse;
*/ */
public class GetKeyReferences extends BaseGrapheneHandler { public class GetKeyReferences extends BaseGrapheneHandler {
private Address address; private List<Address> addresses;
private WitnessResponseListener mListener;
public GetKeyReferences(Address address, WitnessResponseListener listener) { public GetKeyReferences(Address address, WitnessResponseListener listener){
super(listener); super(listener);
this.address = address; addresses = new ArrayList<>();
addresses.add(address);
}
public GetKeyReferences(List<Address> addresses, WitnessResponseListener listener) {
super(listener);
this.addresses = addresses;
this.mListener = listener; this.mListener = listener;
} }
@Override @Override
public void onConnected(WebSocket websocket, Map<String, List<String>> headers) throws Exception { public void onConnected(WebSocket websocket, Map<String, List<String>> headers) throws Exception {
ArrayList<Serializable> params = new ArrayList(); ArrayList<Serializable> inner = new ArrayList();
ArrayList<Serializable> addresses = new ArrayList(); for(Address addr : addresses){
addresses.add(address.toString()); inner.add(addr.toString());
params.add(addresses); }
ArrayList<Serializable> params = new ArrayList<>();
params.add(inner);
ApiCall getAccountByAddress = new ApiCall(0, RPC.CALL_GET_KEY_REFERENCES, params, RPC.VERSION, 1); ApiCall getAccountByAddress = new ApiCall(0, RPC.CALL_GET_KEY_REFERENCES, params, RPC.VERSION, 1);
websocket.sendText(getAccountByAddress.toJsonString()); websocket.sendText(getAccountByAddress.toJsonString());
} }