Methods
Joining the Network
import ZenZ from "@zenz-solutions/js-zenz-client"
const zenz = new ZenZ({/* appSecret */});
await zenz.init()The init() will manage the authentication and joining of network.
Connection Management
import { IdentityServiceType, StorageServiceType, ComputeServiceType } from "@zenz-solutions/js-zenz-client/types";
const closestIdentityPeer = zenz.getEdgePeer("IdentityServiceType");
const closestStoragePeer = zenz.getEdgePeer("StorageServiceType");
const closestComputePeer = zenz.getEdgePeer("ComputeServiceType");The getEdgePeer will utilize the metadata-rich DHT module and picks up the nearest peer of specific peer based on geographical proximity.
Resource Connection
const { identitybaseURL } = closestIdentityPeer;
axios.post(`${identitybaseURL}, {
method: "identity"
})
const { computeBaseURL } = closestComputePeer;
axios.post(`${computeBaseURL}, {
method: "compute",
})Network Health Monitoring
axios.post(`${computeBaseURL}/health, {
params: {
duration: "24h"
}
})Last updated on: