Tutorial testing
const Dash = require('dash');
const client = new Dash.Client();
async function connect() {
return await client.getDAPIClient().core.getBestBlockHash();
}
connect()
.then((d) => console.log('Connected. Best block hash:\n', d))
.catch((e) => console.error('Something went wrong:\n', e))
.finally(() => client.disconnect());
package org.dashevo.examples;
import org.dashevo.Client;
import org.dashevo.dapiclient.DapiClient;
public class Connect {
static Client sdk;
public static void main(String[] args) {
sdk = new Client("testnet");
DapiClient client = sdk.getPlatform().client;
connect(client);
}
private static void connect(DapiClient client) {
try {
System.out.println(String.format("Connected. Best block hash: %s", client.getBestBlockHash()));
} catch (Exception e) {
System.out.println(String.format("\nSomething went wrong:\n%s", e.getLocalizedMessage()));
}
}
}
import org.dashevo.Client
fun main(args: Array<String>) {
connect()
}
fun connect() {
val sdk = Client("testnet")
val client = sdk.platform.client
try {
println("Connected. Best block hash: ${client.getBestBlockHash()}")
} catch (e: Exception) {
println("Something went wrong:\n${e.localizedMessage}")
}
}
Updated about 4 years ago