How Can We Help?
Search for answers or browse our knowledge base.
How to install the JavaScript API
Install GNY Client
Install by npm
npm install @gny/client
Usage
import { Connection } from "@gny/client";
const connection = new Connection();
const accountApi = connection.api.Account;
const generateAccount = async () => {
const response = await accountApi.generateAccount();
console.log(response);
};
(async () => {
await generateAccount();
})();
Connection configuration
:::: tabs
::: tab mainnet
This is the mainnet
configuration:
const host = "https://mainnet.gny.io";
const port = 8096;
const network = "mainnet";
const https = true;
const connection = new Connection(host, port, network, https);
:::
::: tab testnet
This is the testnet
configuration:
const host = "https://testnet.gny.io";
const port = 4096;
const network = "testnet";
const https = true;
const connection = new Connection(host, port, network, https);
:::
::::
Default value
All the args of Connection
are optional, and the default values are:
{
"host": "127.0.0.1",
"port": 4096,
"network": "localnet",
"https": false
}