JSPM

eosjs

1.0.12
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 186460
  • Score
    100M100P100Q164256F
  • License ISC

General purpose library for the EOS blockchain.

Package Exports

  • eosjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (eosjs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Build Status NPM

Status: Alpha (this is for eosjs library developers)

Eos Js

General purpose library for the EOS blockchain.

Usage

Eos = require('eosjs') // Or Eos = require('.')

// API, note: testnet uses eosd at localhost (until there is a testnet)
eos = Eos.Testnet()

// For promises instead of callbacks, use something like npmjs 'sb-promisify'
callback = (err, res) => {err ? console.error(err) : console.log(res)}

// All API methods print help when called with no-arguments.
// More docs at https://github.com/eosjs/api
eos.getBlock()

// Your going to need localhost:8888
eos.getBlock(1, callback)

// Transaction
eos.transaction({
  scope: ['inita', 'initb'],
  messages: [
    {// work-in-progress - transaction error 'Bad Cast'
      code: 'eos',
      type: 'transfer',
      data: {
        from: 'eos',
        to: 'inita',
        amount: 13
      }
    }
  ],
  authorizations: [{
    account: 'eos',
    permission: 'active'
  }],
  sign: ['5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3']
}, callback)

Related Libraries

These lower level libraries are exported from eosjs or may be used separately.

Exported modules

var {json, api, ecc, Fcbuffer} = Eos.modules

About

  • eosjs-api [Github, NPM]

    • Remote API to an EOS blockchain node (eosd)
    • Use this library directly if you need read-only access to the blockchain (don't need to sign transactions).
  • eosjs-ecc [Github, NPM]

    • Private Key, Public Key, Signature, AES, Encryption / Decryption
    • Validate public or private keys
    • Encrypt or decrypt with EOS compatible checksums
    • Calculate a shared secret
  • eosjs-json [Github, NPM]

    • Blockchain definitions (api method names, blockchain operations, etc)
    • Maybe used by any language that can parse json
    • Kept up-to-date
  • Fcbuffer [Github, NPM]

    • Binary serialization used by the blockchain
    • Clients sign the binary form of the transaction
    • Essential so the client knows what it is signing

Example Transactions

var {json} = Eos.modules

// The node console will print more documentation and message structure
json.schema.Message
json.schema.transfer

// Includes data types
var {structs} = Eos({defaults: true})
structs.newaccount.toObject()
structs.newaccount.toObject().owner

Environment

Node 6+ and browser (browserify, webpack, etc)