3.2.18 • Published 2 years ago

@eoscafe/light-api v3.2.18

Weekly downloads
8
License
MIT
Repository
github
Last release
2 years ago

LIGHT API HTTP Javascript library

Installation

Using Yarn:

yarn add @eoscafe/light-api

or using NPM:

npm install --save @eoscafe/light-api

Quick Start

CommonJS

const { JsonRpc } = require("@eoscafe/light-api")
const fetch = require("isomorphic-fetch")

const endpoint = "https://api.light.xeos.me"
const rpc = new JsonRpc(endpoint, { fetch, chain: "eos" })

TypeScript

import { JsonRpc } from "@eoscafe/light-api"
import fetch from "isomorphic-fetch"

const endpoint = "https://api.light.xeos.me"
const rpc = new JsonRpc(endpoint, { fetch, chain: "eos" })

API

Table of Contents

JsonRpc

JsonRpc

Parameters

  • endpoint string LIGHT API endpoint

Examples

const endpoint = "https://api.light.xeos.me"
const rpc = new JsonRpc(endpoint, { fetch, chain: "eos" })

get_account

GET /api/account

Retrieve all token balances, resources and authorization information for an account:

Parameters
  • accountName string name of account

Returns Promise<GetAccount> account

get_account_info

GET /api/accinfo

Retrieve all resources and authorization information for an account:

Parameters
  • accountName string name of account

Returns Promise<GetAccountInfo> account

get_balances

GET /api/balances

Retrieve only token balances for an account

Parameters
  • accountName string name of account

Returns Promise<GetBalances> balances

get_key_accounts

GET /api/key

Retrieve all accounts in all known EOS networks dependent on a public key:

Parameters

Returns Promise<GetKeyAccounts> accounts

get_networks

GET /api/networks

Retrieve all accounts in all known EOS networks dependent on a public key:

Returns Promise<GetNetworks> accounts

get_sync_info

GET /api/sync

returns a plain text with delay in seconds that this server's blockchain database is behind the real time, and a status: OK if the delay is within 180 seconds, or 'OUT_OF_SYNC' otherwise.

Returns Promise<string> get sync

get_token_balance

GET /api/tokenbalance

returns a plain text with numeric output indicating the token balance. Zero is returned if the token is not present or does not exist.

Parameters

Returns Promise<string> token balance

get_topholders

GET /api/topholders

returns top NUM holders of a specified token in a JSON array containing arrays of (account, amount) pairs. NUM must not be less than 10 or more than 1000.

Parameters
  • contract string token contract
  • token string token symbol
  • num string number of top holders (min 10, max 1000)

Returns Promise<string> token balance

get_usercount

GET /api/usercount

returns a plain text with total number of accounts in the network.

Returns Promise<string> token balance

get_topram

GET /api/topram

returns top NUM RAM buyers in a JSON array containing arrays of (account, bytes) pairs. NUM must not be less than 10 or more than 1000.

Parameters
  • num string number of top holders (min 10, max 1000)

Returns Promise<GetTopRam> top ram holders

get_topstake

GET /api/topstake

returns top NUM RAM buyers in a JSON array containing arrays of (account, bytes) pairs. NUM must not be less than 10 or more than 1000.

Parameters
  • num string returns top NUM stake holders by sum of CPU and Net stakes, in a JSON array containing arrays of (account, cpu_weight, net_weight) tuples. NUM must not be less than 10 or more than 1000.

Returns Promise<GetTopStake> top stake holders

get_codehash

GET /api/codehash

retrieves all accounts in all known EOS networks by contract hash.

Parameters
  • hash
  • num string returns top NUM stake holders by sum of CPU and Net stakes, in a JSON array containing arrays of (account, cpu_weight, net_weight) tuples. NUM must not be less than 10 or more than 1000.

Returns Promise<GetCodehash> accounts

get_tokenholder_count

GET /api/holdercount

returns a plaintext integer indicating the number of accounts with positive balance for a specified token.

Parameters

Returns Promise<number> count

JsonRpc

get_account

GET /api/account

Retrieve all token balances, resources and authorization information for an account:

Parameters
  • accountName string name of account

Returns Promise<GetAccount> account

get_account_info

GET /api/accinfo

Retrieve all resources and authorization information for an account:

Parameters
  • accountName string name of account

Returns Promise<GetAccountInfo> account

get_balances

GET /api/balances

Retrieve only token balances for an account

Parameters
  • accountName string name of account

Returns Promise<GetBalances> balances

get_key_accounts

GET /api/key

Retrieve all accounts in all known EOS networks dependent on a public key:

Parameters

Returns Promise<GetKeyAccounts> accounts

get_networks

GET /api/networks

Retrieve all accounts in all known EOS networks dependent on a public key:

Returns Promise<GetNetworks> accounts

get_sync_info

GET /api/sync

returns a plain text with delay in seconds that this server's blockchain database is behind the real time, and a status: OK if the delay is within 180 seconds, or 'OUT_OF_SYNC' otherwise.

Returns Promise<string> get sync

get_token_balance

GET /api/tokenbalance

returns a plain text with numeric output indicating the token balance. Zero is returned if the token is not present or does not exist.

Parameters

Returns Promise<string> token balance

get_topholders

GET /api/topholders

returns top NUM holders of a specified token in a JSON array containing arrays of (account, amount) pairs. NUM must not be less than 10 or more than 1000.

Parameters
  • contract string token contract
  • token string token symbol
  • num string number of top holders (min 10, max 1000)

Returns Promise<string> token balance

get_usercount

GET /api/usercount

returns a plain text with total number of accounts in the network.

Returns Promise<string> token balance

get_topram

GET /api/topram

returns top NUM RAM buyers in a JSON array containing arrays of (account, bytes) pairs. NUM must not be less than 10 or more than 1000.

Parameters
  • num string number of top holders (min 10, max 1000)

Returns Promise<GetTopRam> top ram holders

get_topstake

GET /api/topstake

returns top NUM RAM buyers in a JSON array containing arrays of (account, bytes) pairs. NUM must not be less than 10 or more than 1000.

Parameters
  • num string returns top NUM stake holders by sum of CPU and Net stakes, in a JSON array containing arrays of (account, cpu_weight, net_weight) tuples. NUM must not be less than 10 or more than 1000.

Returns Promise<GetTopStake> top stake holders

get_codehash

GET /api/codehash

retrieves all accounts in all known EOS networks by contract hash.

Parameters
  • hash
  • num string returns top NUM stake holders by sum of CPU and Net stakes, in a JSON array containing arrays of (account, cpu_weight, net_weight) tuples. NUM must not be less than 10 or more than 1000.

Returns Promise<GetCodehash> accounts

get_tokenholder_count

GET /api/holdercount

returns a plaintext integer indicating the number of accounts with positive balance for a specified token.

Parameters

Returns Promise<number> count

Error

Error

3.2.15

2 years ago

3.2.17

2 years ago

3.2.16

2 years ago

3.2.18

2 years ago

3.2.13

3 years ago

3.2.12

3 years ago

3.2.11

3 years ago

3.2.10

3 years ago

3.2.9

3 years ago

3.2.8

4 years ago

3.2.7

4 years ago

3.2.6

4 years ago

3.2.5

5 years ago

1.0.0

5 years ago

4.0.0

5 years ago

3.2.4

5 years ago

3.2.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago