Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dapp-client

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dapp-client

DAPP JavaScript/TypeScript Client Library

  • 0.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

DAPP JavaScript/TypeScript Client Library

Installation

Using Yarn:

yarn add dapp-client

or using NPM:

npm install --save dapp-client

or using latest:

npm install --save git+ssh://git@github.com:EOS-Nation/dapp-client-js.git

Quick Start

CommonJS

const { DappClient } = require("dapp-client")
const fetch = require("isomorphic-fetch")

const endpoint = "https://dsp.eosn.io"
const client = new DappClient(endpoint, { fetch })

TypeScript

import { DappClient } from "dapp-client"
import fetch from "isomorphic-fetch"

const endpoint = "https://dsp.eosn.io"
const client = new DappClient(endpoint, { fetch })

Supported Endpoints

# Chain
/v1/chain/get_table_rows
/v1/chain/get_table_by_scope
/v1/chain/get_currency_stats

API

Table of Contents

DAPP

DAPP

Examples
import { names } from "dapp-client"

names.DAPP // => "......2ke1.o4"

DappClient

DAPP Client

Parameters
  • endpoint string dsp endpoint
  • options object optional params (optional, default {})
    • options.dappservices string dappservices code (optional, default "dappservices")
    • options.ipfsservice1 string ipfsservice1 code (optional, default "ipfsservice1")
    • options.fetch Fetch fetch (optional, default global.fetch)
Examples
const endpoint = "https://dsp.eosn.io"
const client = new DappClient(endpoint, { fetch })
get_table_package

Get TABLE package

Parameters
  • options object optional params (optional, default {})
    • options.lower_bound string? Filters results to return the first element that is not less than provided value in set
    • options.upper_bound string? Filters results to return the first element that is greater than provided value in set
    • options.limit number Limit the result amount (optional, default 10)
    • options.show_payer boolean Show Payer (optional, default false)
Examples
const response = await client.get_table_package({limit: 500});

for (const row of response.rows) {
    console.log(row);
    // {
    //     id: 9,
    //     api_endpoint: 'https://dsp.eosn.io',
    //     package_json_uri: 'https://eosnation.io/package1.dsp-package.json',
    //     package_id: 'package1',
    //     service: 'ipfsservice1',
    //     provider: 'eosnationdsp',
    //     quota: '500.0000 QUOTA',
    //     package_period: 86400,
    //     min_stake_quantity: '10000.0000 DAPP',
    //     min_unstake_period: 3600,
    //     enabled: 1
    // }
}
get_table_accountext

Get TABLE accountext

Parameters
  • options object optional params (optional, default {})
    • options.lower_bound string? Filters results to return the first element that is not less than provided value in set
    • options.upper_bound string? Filters results to return the first element that is greater than provided value in set
    • options.limit number Limit the result amount (optional, default 10)
    • options.show_payer boolean Show Payer (optional, default false)
Examples
const response = await client.get_table_accountext({limit: 500});

for (const row of response.rows) {
    console.log(row);
    // {
    //     id: 29,
    //     account: 'eosnationdsp',
    //     service: 'ipfsservice1',
    //     provider: 'eosnationdsp',
    //     quota: '0.0001 QUOTA',
    //     balance: '255101.1461 DAPP',
    //     last_usage: '1555466031000',
    //     last_reward: '1555466031000',
    //     package: 'package2',
    //     pending_package: 'package2',
    //     package_started: '1555466031000',
    //     package_end: '1555469631000'
    // }
}
get_table_rows

GET /v1/chain/get_table_rows

Returns an object containing rows from the specified table.

Parameters
  • code string The name of the smart contract that controls the provided table
  • scope string The account to which this data belongs
  • table string The name of the table to query
  • options object optional params (optional, default {})
    • options.lower_bound string? Filters results to return the first element that is not less than provided value in set
    • options.upper_bound string? Filters results to return the first element that is greater than provided value in set
    • options.limit number Limit the result amount (optional, default 10)
    • options.show_payer boolean Show Payer (optional, default false)
    • options.json boolean JSON response (optional, default true)
    • options.index_position number Position of the index used (optional, default 1)
    • options.key_type string? Type of key specified by index_position (for example - uint64_t or name)
    • options.table_key string? Table Key
    • options.encode_type string? Encode type
Examples
const response = await rpc.get_table_rows("<code>", "<scope>", "<table>");
console.log(response);

Returns Promise<GetTableRows> table rows

get_table_by_scope

GET /v1/chain/get_table_by_scope

Returns an object containing rows from the specified table.

Parameters
  • code string name of the contract to return table data for
  • options object optional params (optional, default {})
    • options.table string? Filter results by table
    • options.lower_bound string? Filters results to return the first element that is not less than provided value in set
    • options.upper_bound string? Filters results to return the first element that is greater than provided value in set
    • options.limit number? Limit number of results returned.
    • options.reverse boolean Reverse the order of returned results (optional, default false)
Examples
const response = await rpc.get_table_by_scope();
console.log(response);

Returns Promise<GetTableByScope> table rows

claimrewards

claimrewards

Parameters

close

close

Parameters

closeprv

closeprv

Parameters

create

create

Parameters
  • maximum_supply_amount string uint64_t
  • inflation_per_block number double
  • inflation_starts_at string uint64_t

issue

issue

Parameters

modifypkg

modifypkg

Parameters

open

open

Parameters

refund

refund

Parameters

regpkg

regpkg

Parameters

retire

retire

Parameters

selectpkg

selectpkg

Parameters

stake

stake

Parameters

transfer

transfer

Parameters

unstake

unstake

Parameters

usage

usage

Parameters

xsignal

xsignal

Parameters

FAQs

Package last updated on 23 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc