terragreen/terragreen-official-api-docs-master

There is no license information available for the latest version (dev-master) of this package.

PHP TerraGreen API is an asynchronous PHP library for the TerraGreen API designed to be easy to use.

dev-master 2019-07-15 07:22 UTC

This package is auto-updated.

Last update: 2024-09-15 18:59:47 UTC


README

PHP TerraGreen API

General API 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 different formats like JSON & XML.
  • Unique API Key & Secret Key provided to each user.

API key

To use Terragreen API, the user will need to obtain an 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 the section 'API KEYS'. Direct link to API key creation panel:Click Here

Steps to obtain an API Key and Secret key:

  1. Create an account at BlockChain portal. click here
  2. Verify your account
  3. SignIn at BlockChain portal click here
  4. Go to API Key section click here
  5. Create API Key click here

Installation

Install the library using Composer. Please read the Composer Documentation if you are unfamiliar with Composer or dependency managers in general.
composer require terragreen/terragreen-official-api-docs-master

Getting started

Set Below parameters in config.php file, which you obtain from BlockChain portal.

$API_KEY = "[API_KEY]";
$SECRECT_KEY="[SECRECT_KEY]";
$EMAIL_ADDRESS="[EMAIL_ADDRESS]";
$USERNAME="[WALLET_NAME]";
$PASSWORD="[PASSWORD]";
$SEND_ADDRESS="[SEND_ADDRESS]";

Add Namespace & Below Config Files for all operations

use TerraGreen\TGNAPI; //Main Class Library 

require_once 'vendor/autoload.php'; // Autoload files using Composer autoload require_once 'vendor/config.php'; // Autoload data using config file

Block

Get Blocks Details

Get block details.

$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);

$BlockId = 375808; $response = $api->GetBlockDetails($BlockId); echo json_encode($response);

Get Blocks

Get Blocklist.

$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);

$start = 1; $end = 5; $response = $api->GetBlockDetails($start,$end); echo json_encode($response);

Get Latest Block

Gets latest block list.

$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);

$response = $api->GetLatestBlock(); echo json_encode($response);

Rate

Get Rate

Get TGCoin's current rates.

$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);

$response = $api->CurrentRate(); echo json_encode($response);

Get All Rate

Get TGCoin rates.

$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);

$response = $api->GetAllRate(); echo json_encode($response);

Transaction

Get New Address

Get new receive address.

$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);

$response = $api->GetNewAddress(); echo json_encode($response);

Send Balance

Send amount to other user's wallet.

$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);

$amount = 2.1; $response = $api->SendBalance($SEND_ADDRESS,$amount); echo json_encode($response);

Get Transaction List

Get transaction list of the user.

$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);

$response = $api->GetTransactionList(); echo json_encode($response);

Verify Payment

Verify transaction's payment status.

$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);

$response = $api->VerifyPaymentStatus($SEND_ADDRESS); echo json_encode($response);

Wallet

Create Wallet

Create Wallet Account.

$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);

$response = $api->CreateWallet(); echo json_encode($response);

Get Initialize

Get access-token to access all authorized apis.

$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);

$response = $api->GetInitialize(); echo json_encode($response);

Get Balance

Get Wallet Balance.

$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);

$response = $api->GetBalance(); echo json_encode($response);