
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Status: Alpha (this is for eosjs library developers)
General purpose library for the EOS blockchain.
Eos = require('eosjs') // Or Eos = require('.')
// API, note: testnet uses eosd at localhost (until there is a testnet)
eos = Eos.Testnet()
// All API methods print help when called with no-arguments.
eos.getBlock()
// Next, your going to need eosd running on localhost:8888
// If a callback is not provided, a Promise is returned
eos.getBlock(1).then(result => {console.log(result)})
// Parameters can be sequential or an object
eos.getBlock({block_num_or_id: 1}).then(result => console.log(result))
// Callbacks are similar
callback = (err, res) => {err ? console.error(err) : console.log(res)}
eos.getBlock(1, callback)
eos.getBlock({block_num_or_id: 1}, callback)
// Provide an empty object or a callback if an API call has no arguments
eos.getInfo({}).then(result => {console.log(result)})
Status: all transactions fail to verify in eosd: tx_missing_sigs.. To work-around,
run ./eosd with the --skip-transaction-signatures
parameter.
Eos = require('eosjs') // Or Eos = require('.')
eos = Eos.Testnet({
signProvider: ({authorization, buf, sign}) => {
// Example: account === 'inita' && permission === 'active'
const {account, permission} = authorization
// 'sign' returns a hex string. A Promise resolving to a Hex string works too.
return sign(buf, '5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3')
}
})
// All Eos transactions as of the last update are available. Run with no
// arguments to print usage.
eos.transfer()
// Object or ordered args may be used
eos.transfer({from: 'inita', to: 'initb', amount: 1})
eos.transfer('inita', 'initb', 1)
// A broadcast boolean may be provided allowing any transaction to be created
// but not sent.
eos.transfer({from: 'inita', to: 'initb', amount: 1}, {broadcast: false})
eos.transfer('inita', 'initb', 1, false)
Shorthand is available for some types such as Asset and Authority.
For example:
'10 EOS'
is shorthand for {amount: 10, symbol: 'EOS'}
'EOS6MRy..'
is shorthand for {threshold: 1, keys: [key: 'EOS6MRy..', weight: 1]}
Eos = require('eosjs') // Or Eos = require('.')
wif = '5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3'
eos = Eos.Testnet({signProvider: ({sign, buf}) => sign(buf, wif)})
eos.newaccount({
creator: 'inita',
name: 'mynewacct',
owner: 'EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV',
active: 'EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV',
recovery: 'EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV',
deposit: '10 EOS'
})
A manual transaction provides for more flexibility.
// eos = Eos.Testnet({signProvider: ...})
eos.transaction({
scope: ['inita', 'initb'],
messages: [
{
code: 'eos',
type: 'transfer',
authorization: [{
account: 'inita',
permission: 'active'
}],
data: {
from: 'inita',
to: 'initb',
amount: 7
}
}
]
})
These libraries are exported from eosjs
or may be used separately.
var {api, ecc, json, Fcbuffer} = Eos.modules
Node 6+ and browser (browserify, webpack, etc)
React Native should work, create an issue if you find a bug.
FAQs
Talk to eos API
The npm package eosjs receives a total of 49,766 weekly downloads. As such, eosjs popularity was classified as popular.
We found that eosjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
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.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.