RaiBlocksJS
An isomorphic async library that interfaces with the RaiBlocks RPC protocol https://github.com/clemahieu/raiblocks/wiki/RPC-protocol
Optimized for version 8+
Installation
yarn add raiblocks-js
Note
To test locally, you'll need to setup your own node. See instructions here: https://github.com/clemahieu/raiblocks/wiki/Docker-node
Usage
Boilerplate
https://gist.github.com/orrybaram/b1c4b724b134c8b7fb0cafe52cb5f6c6
Basic implementation
; const rai = ; // creates default connection to localhost:7076const blockCount = raiblocks; // returns Promise with a response objectblockCount // => { count: '1000', unchecked: '10' } const accountWeight = raiaccount;accountWeight // => 1000000
Creating raw rpc actions
const rai = ;const blockCount = rai; // returns Promise with a response objectblockCount // => { count: '1000', unchecked: '10' } const accountWeight = rai;accountWeight // => 1000000
Connecting to a custom node
const rai = 'https://xrb.example-node.io:3000';
A note about import vs require:
If you are not using es modules, you'll need to reference the default value:
const default: Rai = ;
Methods
## rai.account #### balance() #### blockCount() #### create() #### info() #### history() #### get() #### key() #### list() #### move() #### remove() #### getRepresentative() #### setRepresentative() #### weight()
## rai.accounts #### balances() #### create() #### frontiers() #### pending()
## rai.blocks #### account() #### count: getCount() #### countByType() #### chain() #### create() #### process() #### get()
## rai.bootstrap() ####
## rai.delegators #### count() #### get()
## rai.frontiers #### count: () #### get()
## rai.keys #### create() #### deterministic() #### expand()
## rai.ledger #### get() #### history() #### succesors()
## rai.network #### availableSupply() #### keepAlive() #### republish()
## rai.node #### version() #### stop()
## rai.payment #### begin() #### init() #### end() #### wait()
## rai.peers #### addWorkPeer() #### getWorkPeers() #### clearWorkPeers() #### get()
## rai.pending #### get() #### exists() #### search()
## rai.proofOfWork #### cancel() #### get() #### generate() #### set()
## rai.receive #### get() #### minimum() #### setMinimum()
## rai.representatives #### get() #### wallet() #### walletSet()
## rai.send()
## rai.unchecked #### clear() #### get() #### keys() #### list()
## rai.wallet #### add() #### balanceTotal() #### balances() #### changeSeed() #### contains() #### create() #### destroy() #### export: exportWallet() #### frontiers() #### locked() #### passwordChange() #### passwordEnter() #### passwordValid() #### pending() #### getRepresentative() #### setRepresentative() #### republish() #### unlock() #### workGet()
Extended Methods
## rai.extended #### change() #### checkSignature() #### open() #### proofOfWork() #### receive() #### seedKey() #### seedKeys() #### send()
RPC improvement progress here: https://github.com/clemahieu/raiblocks/issues/29