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
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)
testnet = 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
testnet.getBlock()
// Your going to need localhost:8888
testnet.getBlock(1, callback)
// Transaction
testnet.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.modulesAbout
-
- 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).
-
- Private Key, Public Key, Signature, AES, Encryption / Decryption
- Validate public or private keys
- Encrypt or decrypt with EOS compatible checksums
- Calculate a shared secret
-
- Blockchain definitions (api method names, blockchain operations, etc)
- Maybe used by any language that can parse json
- Kept up-to-date
-
- 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().ownerEnvironment
Node 6+ and browser (browserify, webpack, etc)