Giter Site home page Giter Site logo

blockchain-explorer-sdk's Introduction

Blockchain Explorer SDK

Pillar blockchain explorer SDK for node.

Install

$ npm install @pillarwallet/bcx-api
  • copy /.sample.env file to /.env with your local development settings Development To enable dev mode - add NODE_ENV=development to .env file

Usage

var bcx = require('@pillarwallet/bcx-api')
bcx = new BCX({apiUrl:`https://apiurl.io:${port}`)

Transaction history, gas station, and gas info

Transaction History
const payload = {
      address1: '0xe6220A8FF48E2F94D3B4Cddf8Ba1d69f8276f895',
      asset: 'ETH',
    }

bcx.txHistory(payload).then(console.log)
Response

{
  [
  transaction: 
  {
    schema: 
    {
      hash: '0xfe0083d38169d3d0fa0330558ef917c6e4884e318df8abaa26cec540ee4f49c',
      nonce: 264,
      blockHash: '0xe0083d38169d3d0fa0330558ef917c6e4884e318df8abaa26cec540ee4f49c',
      blockNumber: 2980845,
      transactionIndex: 134,
      from: '0xabA31e585c4a221d9e196EA46c98793e0A0490bD',
      to: '0x5eDa0D39f19C28731a64491eD48dF5EDB0945169',
      value: '7890000000000000000',
      gasPrice: '1000000000',
      gas: '49000000000',
      input: 'string'
    }
  },
  receipt: 
  {
    schema: 
    {
      blockHash: '0xfe0083d38169d3d0fa0330558ef917c6e4884e318df8abaa26cec540ee4f49c',
      blockNumber: 2980845,
      transactionHash: '0xfe0083d38169d3d0fa0330558ef917c6e4884e318df8abaa26cec540ee4f49c',
      transactionIndex: 134,
      from: '0xabA31e585c4a221d9e196EA46c98793e0A0490bD',
      to: '0x5eDa0D39f19C28731a64491eD48dF5EDB0945169',
      contractAddress: '0x583cbbb8a8443b38abcc0c956bece47340ea1367',
      cumulativeGasUsed: 314159,
      gasUsed: 30234
    }
  },
  hash: '0xfe0083d38169d3d0fa0330558ef917c6e4884e318df8abaa26cec540ee4f49c',
  to: '0x5eDa0D39f19C28731a64491eD48dF5EDB0945169',
  from: '0xabA31e585c4a221d9e196EA46c98793e0A0490bD',
  tmstmp: 12345678910,
  asset: 'PLR',
  value: 7.89,
  nbConfirmations: 2,
  status: 'pending'
  ]
}

Gas Station
bcx.gasStation().then(console.log);
Response

{ result: 'success',
  safeLow: 7,
  standard: 8,
  fast: 13,
  fastest: 50,
  blockTime: 15,
  blockNumber: 6795711 }

Gas Info
bcx.gasInfo().then(console.log);
Response

{
result: 'success',
avgGasPrice: 6984665476.524783,
stdDev: 4497814031.576423,
topBlock: 6795711
}

License

MIT

blockchain-explorer-sdk's People

Contributors

danwatkinson avatar antonioned avatar iamkio avatar gavboulton avatar alazarevski avatar rostislavcn avatar vitorpy avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.