Skip to content

eoscostarica/eosjs-camel-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TravisCI StandardJS Collaborative Etiquette chat on Discord follow on Twitter MIT

EOS API module ( in CamelCase 🐫)

Application programming interface for using the EOS blockchain via the RPC API provided by Block Producer Nodes. This is for read-only API calls.

This project wraps the official eosio/eosjs-api to provide camelcase output. It only works with await/async and promise code style, there's no support for the callback style.

It is a work in progress.

Contents

Getting Started

yarn add @eoscostarica/eosjs-camel-api  # or npm install -S @eoscostarica/eosjs-camel-api
const eosCamelApi = require('eosjs-camel-api')
const api = eosCamelApi.getInstance(options)  // same options object that eosio/eosjs-api supports

const logInfo = async () => {
 const info = await api.getInfo({})
 console.log(info)
}

logInfo()

// { serverVersion: 'ad4ba283',
//   chainId: '038f4b0fc8ff18a4f0842a8f0564611f6e96e8535901dd45e43ac8691a1c4dca',
//   headBlockNum: 8448809,
//   lastIrreversibleBlockNum: 8448494,
//   lastIrreversibleBlockId: '0080e9eefdcfb032231d2c8cc5c850a004034fb85831febc22d55e63723da590',
//   headBlockId: '0080eb294f506de95c636e690cf523c7895987114d32bb87378ff13b322d2904',
//   headBlockTime: '2018-08-06T02:32:26.000',
//   headBlockProducer: 'acryptolions',
//   virtualBlockCpuLimit: 200000000,
//   virtualBlockNetLimit: 1048576000,
//   blockCpuLimit: 199900,
//   blockNetLimit: 1048576 }

eosjs-camel-api functions receive both snakecase and camelcase arguments and always return camelcase objects.

It defaults to the Jungle Testnet via the https://jungle.eosio.cr endpoint.

Camel Namespace Functions

eosjs-camel-api exposes functions that not part of eosjs-api in the camel namespace. Eg

const eosCamelApi = require('eosjs-camel-api')
const jungleApi = eosCamelApi.getInstance() 
const mainNetApi = eosCamelApi.getInstance({httpEndpoint: 'https://api.eosio.cr'}) 

console.log(jungleApi.camel.getConfig())
// { httpEndpoint: 'https://jungle.eosio.cr' }

console.log(mainNetApi.camel.getConfig())
// { httpEndpoint: 'https://api.eosio.cr' }

Contributing

We follow the open source collaborative ettiquete, the standardjs code style.

Read EOS Costa Rica's Open Source Contributing Guidelines for more detail

https://developers.eoscostarica.io/docs/open-source-guidelines

Bug Reporting

Please report bugs big and small by opening an issue. No possible bug report is too small.

Maintainers

About EOS Costa Rica

We challenge ourselves to provide the EOS platform with a strong geographical and political diversity by running the most robust EOS Block Producer possible from Costa Rica; We pledge to leverage our talent, experience, and sustainable internet resources to meet such an important challenge.

EOS Costa Rica supports the EOSIO community by maintaining and contributing to open source initiatives, meetups and workshops.

eoscostarica.io

License

MIT © EOS Costa Rica