1.0.4 • Published 5 years ago

tgn-node-app v1.0.4

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

tgn-node-app

General Features

  • Implementation of all General, Market Data and Accounting Related Data.
  • Simple handling of authentication
  • Manage Wallet, Transaction Details, Rates And Block Details.
  • Exception Handling.
  • API Response in diffrent formats like JSON & XML.
  • Unique API Key & Secret Key provided to each user.

API key

To use Terragreen API, user will need to obtain API key and secret key, which are passed to TerraGreen API with every request. API keys can be generated in the TerraGreen BlockChain Portal, under section 'API KEYS'. Direct link to API key creation panel: Get API Key

Steps to obtain API Key and Secrat key:

Installation

The Node.js library for the Terragreen API.

npm i tgn-node-app

Initialization

const tgn = require('tgn-node-app');

const app_tgn = new tgn({
  apiKey: process.env.COIN_API_KEY,
  secret: process.env.COIN_SECRET_KEY,
  walletName: '[wallet_name]',
  password: '[password]'
});

Block

Get Blocks Details

Get block details.

var block_id = 1;
app_tgn._GetBlockDetails(block_id,function(results){
	console.log(results);
});

Get Blocks

Get Blocklist.

var start_index = 1;
var end_index = 5;
app_tgn._GetBlocks(start_index,end_index,function(results){
	console.log(results);
});

Get Block Number

Get Block Number.

app_tgn._GetBlockNumber(function(results){
	console.log(results);
});

Get Latest Block

Gets latest block list.

app_tgn._GetLatestBlock(function(results){
	console.log(results);
});

Rate

Get Rate

Get TGCoin's current rates.

app_tgn._CurrentRate(function(results){
	console.log(results);
});

Get All Rate

Get TGCoin rates.

app_tgn._AllRate(function(results){
	console.log(results);
});

Transaction

Get New Address

Get new receive address.

app_tgn._GetNewAddress(function(results){
	console.log(results);
});

Send Balance

Send amount to other user's wallet.

var send_address = '[send_address]';
var amount = 10;
app_tgn._SendBalance(send_address,amount,function(results){
	console.log(results);
});

Get Transaction List

Get transaction list of the user.

app_tgn._GetTransactionList(function(results){
	console.log(results);
});

Verify Payment

Verify transaction's payment status.

var receive_address = '[receive_address]';
app_tgn._VerifyPaymentStatus(receive_address,function(results){
	console.log(results);
});

Wallet

Create Wallet

Create Wallet Account.

app_tgn._CreateWallet(function(results){
	console.log(results);
});

Get Initialize

Get access-token to access all authorized apis.

app_tgn._GetInitialize(function(results){
	console.log(results);
});

Get Balance

Get Wallet Balance.

app_tgn._GetBalance(function(results){
	console.log(results);
});

Address Balance

Get Address Balance.

app_tgn._AddressBalance(walletaddress,function(results){
	console.log(results);
});

Transaction List By Address

Get Transaction List By Address.

app_tgn._GetTransactionListByAddress(walletaddress,startingIndex,endingIndexfunction(results){
	console.log(results);
});