Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/org/arkecosystem/client/Connection.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import org.arkecosystem.client.http.Client;

public class Connection {
private Api api;
private Client client;
private final Api api;
private final Client client;

public Connection(Map<String, Object> config) {
this.client = new Client(config.get("host").toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.util.Map;

public class ConnectionManager {
private Map<String, Connection> connections;
private final Map<String, Connection> connections;
private String defaultConnection = "main";

public ConnectionManager() {
Expand All @@ -23,7 +23,7 @@ public Map<String, Connection> getConnections() {
return this.connections;
}

public Connection connect(Map config, String name) {
public Connection connect(Map<String, Object> config, String name) {
if (this.connections.containsKey(name)) {
throw new IllegalArgumentException("Connection [" + name + "] is already configured.");
}
Expand All @@ -33,7 +33,7 @@ public Connection connect(Map config, String name) {
return this.connections.get(name);
}

public Connection connect(Map config) {
public Connection connect(Map<String, Object> config) {
return connect(config, "main");
}

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/org/arkecosystem/client/api/Blockchain.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
package org.arkecosystem.client.api;

import com.google.gson.internal.LinkedTreeMap;
import java.io.IOException;
import java.util.Map;

import org.arkecosystem.client.http.Client;

public class Blockchain {

private Client client;
private final Client client;

public Blockchain(Client client) {
this.client = client;
}

public LinkedTreeMap<String, Object> all() throws IOException {
public Map<String, Object> all() throws IOException {
return this.client.get("blockchain");
}
}
14 changes: 7 additions & 7 deletions src/main/java/org/arkecosystem/client/api/Blocks.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
package org.arkecosystem.client.api;

import com.google.gson.internal.LinkedTreeMap;
import java.io.IOException;
import java.util.Map;

import org.arkecosystem.client.http.Client;

public class Blocks {
private Client client;
private final Client client;

public Blocks(Client client) {
this.client = client;
}

public LinkedTreeMap<String, Object> all() throws IOException {
public Map<String, Object> all() throws IOException {
return this.client.get("blocks");
}

public LinkedTreeMap<String, Object> first() throws IOException {
public Map<String, Object> first() throws IOException {
return this.client.get("blocks/first");
}

public LinkedTreeMap<String, Object> last() throws IOException {
public Map<String, Object> last() throws IOException {
return this.client.get("blocks/last");
}

public LinkedTreeMap<String, Object> show(String id) throws IOException {
public Map<String, Object> show(String id) throws IOException {
return this.client.get("blocks/" + id);
}

public LinkedTreeMap<String, Object> transactions(String id) throws IOException {
public Map<String, Object> transactions(String id) throws IOException {
return this.client.get("blocks/" + id + "/transactions");
}
}
13 changes: 6 additions & 7 deletions src/main/java/org/arkecosystem/client/api/Delegates.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
package org.arkecosystem.client.api;

import com.google.gson.internal.LinkedTreeMap;
import java.io.IOException;
import java.util.Map;
import org.arkecosystem.client.http.Client;

public class Delegates {
private Client client;
private final Client client;

public Delegates(Client client) {
this.client = client;
}

public LinkedTreeMap<String, Object> all() throws IOException {
public Map<String, Object> all() throws IOException {
return this.client.get("delegates");
}

public LinkedTreeMap<String, Object> show(String id) throws IOException {
public Map<String, Object> show(String id) throws IOException {
return this.client.get("delegates/" + id);
}

public LinkedTreeMap<String, Object> blocks(String id) throws IOException {
public Map<String, Object> blocks(String id) throws IOException {
return this.client.get("delegates/" + id + "/blocks");
}

public LinkedTreeMap<String, Object> voters(String id) throws IOException {
public Map<String, Object> voters(String id) throws IOException {
return this.client.get("delegates/" + id + "/voters");
}

public LinkedTreeMap<String, Object> search(Map<String, Object> parameters) throws IOException {
public Map<String, Object> search(Map<String, Object> parameters) throws IOException {
return this.client.post("delegates/search", parameters);
}
}
9 changes: 4 additions & 5 deletions src/main/java/org/arkecosystem/client/api/Locks.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
package org.arkecosystem.client.api;

import com.google.gson.internal.LinkedTreeMap;
import java.io.IOException;
import java.util.Map;
import org.arkecosystem.client.http.Client;

public class Locks {
private Client client;
private final Client client;

public Locks(Client client) {
this.client = client;
}

public LinkedTreeMap<String, Object> all() throws IOException {
public Map<String, Object> all() throws IOException {
return this.client.get("locks");
}

public LinkedTreeMap<String, Object> show(String id) throws IOException {
public Map<String, Object> show(String id) throws IOException {
return this.client.get("locks/" + id);
}

public LinkedTreeMap<String, Object> searchUnlocked(Map<String, Object> parameters)
public Map<String, Object> searchUnlocked(Map<String, Object> parameters)
throws IOException {
return this.client.post("locks/unlocked", parameters);
}
Expand Down
25 changes: 16 additions & 9 deletions src/main/java/org/arkecosystem/client/api/Node.java
Original file line number Diff line number Diff line change
@@ -1,40 +1,47 @@
package org.arkecosystem.client.api;

import com.google.gson.internal.LinkedTreeMap;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.arkecosystem.client.http.Client;

public class Node {
private Client client;
private final Client client;

public Node(Client client) {
this.client = client;
}

public LinkedTreeMap<String, Object> status() throws IOException {
public Map<String, Object> status() throws IOException {
return this.client.get("node/status");
}

public LinkedTreeMap<String, Object> syncing() throws IOException {
public Map<String, Object> syncing() throws IOException {
return this.client.get("node/syncing");
}

public LinkedTreeMap<String, Object> configuration() throws IOException {
public Map<String, Object> configuration() throws IOException {
return this.client.get("node/configuration");
}

public LinkedTreeMap<String, Object> crypto() throws IOException {
public Map<String, Object> crypto() throws IOException {
return this.client.get("node/configuration/crypto");
}

public LinkedTreeMap<String, Object> fees(Integer... days) throws IOException {
public Map<String, Object> fees(int days) throws IOException {
HashMap<String, Object> parameters = new HashMap<>();
parameters.put("days", days);
return this.client.get("node/fees", parameters);
}

public Map<String, Object> fees() throws IOException {
HashMap<String, Object> parameters = new HashMap<>();
parameters.put("days", days.length > 0 ? days[0] : null);
parameters.put("days", null);
return this.client.get("node/fees", parameters);
}

public LinkedTreeMap<String, Object> debug() throws IOException {
public Map<String, Object> debug() throws IOException {
return this.client.get("node/debug");
}
}
9 changes: 5 additions & 4 deletions src/main/java/org/arkecosystem/client/api/Peers.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
package org.arkecosystem.client.api;

import com.google.gson.internal.LinkedTreeMap;
import java.io.IOException;
import java.util.Map;

import org.arkecosystem.client.http.Client;

public class Peers {
private Client client;
private final Client client;

public Peers(Client client) {
this.client = client;
}

public LinkedTreeMap<String, Object> all() throws IOException {
public Map<String, Object> all() throws IOException {
return this.client.get("peers");
}

public LinkedTreeMap<String, Object> show(String ip) throws IOException {
public Map<String, Object> show(String ip) throws IOException {
return this.client.get("peers/" + ip);
}
}
7 changes: 4 additions & 3 deletions src/main/java/org/arkecosystem/client/api/Rounds.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package org.arkecosystem.client.api;

import com.google.gson.internal.LinkedTreeMap;
import java.io.IOException;
import java.util.Map;

import org.arkecosystem.client.http.Client;

public class Rounds {
private Client client;
private final Client client;

public Rounds(Client client) {
this.client = client;
}

public LinkedTreeMap<String, Object> delegates(int id) throws IOException {
public Map<String, Object> delegates(int id) throws IOException {
return this.client.get("rounds/" + id + "/delegates");
}
}
22 changes: 11 additions & 11 deletions src/main/java/org/arkecosystem/client/api/Transactions.java
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
package org.arkecosystem.client.api;

import com.google.gson.internal.LinkedTreeMap;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.arkecosystem.client.http.Client;

public class Transactions {
private Client client;
private final Client client;

public Transactions(Client client) {
this.client = client;
}

public LinkedTreeMap<String, Object> all() throws IOException {
public Map<String, Object> all() throws IOException {
return this.client.get("transactions");
}

public LinkedTreeMap<String, Object> create(List<HashMap> transactions) throws IOException {
HashMap<String, List<HashMap>> params = new HashMap<>();
public Map<String, Object> create(List<Map<String, ?>> transactions) throws IOException {
Map<String, Object> params = new HashMap<>();
params.put("transactions", transactions);
return this.client.post("transactions", params);
}

public LinkedTreeMap<String, Object> show(String id) throws IOException {
public Map<String, Object> show(String id) throws IOException {
return this.client.get("transactions/" + id);
}

public LinkedTreeMap<String, Object> allUnconfirmed() throws IOException {
public Map<String, Object> allUnconfirmed() throws IOException {
return this.client.get("transactions/unconfirmed");
}

public LinkedTreeMap<String, Object> showUnconfirmed(String id) throws IOException {
public Map<String, Object> showUnconfirmed(String id) throws IOException {
return this.client.get("transactions/unconfirmed/" + id);
}

public LinkedTreeMap<String, Object> types() throws IOException {
public Map<String, Object> types() throws IOException {
return this.client.get("transactions/types");
}

public LinkedTreeMap<String, Object> schemas() throws IOException {
public Map<String, Object> schemas() throws IOException {
return this.client.get("transactions/schemas");
}

public LinkedTreeMap<String, Object> fees() throws IOException {
public Map<String, Object> fees() throws IOException {
return this.client.get("transactions/fees");
}
}
9 changes: 5 additions & 4 deletions src/main/java/org/arkecosystem/client/api/Votes.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
package org.arkecosystem.client.api;

import com.google.gson.internal.LinkedTreeMap;
import java.io.IOException;
import java.util.Map;

import org.arkecosystem.client.http.Client;

public class Votes {
private Client client;
private final Client client;

public Votes(Client client) {
this.client = client;
}

public LinkedTreeMap<String, Object> all() throws IOException {
public Map<String, Object> all() throws IOException {
return this.client.get("votes");
}

public LinkedTreeMap<String, Object> show(String id) throws IOException {
public Map<String, Object> show(String id) throws IOException {
return this.client.get("votes/" + id);
}
}
Loading