Skip to content
Node.js SDK for the GIN Platform API
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
test
.babelrc
.gitignore
LICENSE
README.md
package.json

README.md

GIN Platform API Node.js SDK

Downloads version License

Usage

The package is available in the npm registry:

npm install gin-platform-node-sdk --save

ES6 module system usage:

import { Sdk } from 'gin-platform-node-sdk'

const sdk = new Sdk()
const apiKey = '...secret...'
const client = sdk.getClient(apiKey)

await client.blockchains.list() //get blockchains list
await client.blockchains.get('gincoin') //get the gincoin blockchain

await client.nodes.list() //get all my nodes
await client.nodes.get('replace-with-node-id') //get all my nodes
await client.nodes.create({ blockchain: 'gincoin', collateral: 1000, txid: 'tx-id-here', dedicated: true }) //create a node
await client.nodes.update('replace-with-node-id', { meta: { key1: 'value1' } }) //update a node
await client.nodes.delete('replace-with-node-id') //delete a node

await client.user.get() //get current user's details
await client.user.transactions() //get current user's billing transactions

ES5 module system usage:

const Sdk = require('gin-platform-node-sdk').Sdk;
const sdk = new Sdk();

Developement

Requirements:

  • Node.js >= 8
  • Babel
  • Mocha
npm install -g mocha babel-cli

Installation:

git clone https://github.com/GIN-Platform/Node-SDK.git
cd Node-SDK
npm install
npm test

Build NPM package:

npm run build #the distribution should be produced in the /dist directory
npm run distrib #will upload the contents of /dist to the npm registry
You can’t perform that action at this time.