0.1.4 • Published 5 years ago

intergallactic v0.1.4

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Help developers interact with Gallactic blockchain

NPM Version

Intergallactic

A module for Interacting with Gallactic blockchain node. This provides a simple way to communicate with the node. Intergallactic supports json rpc protocol to communicate with Gallactic. You can use this module to get information such as account, transaction also send, call, bond or unbond transaction.

Installation

npm install intergallactic

Usage:

To use intergallactic in Node.js, just require it:

var intergallactic = require('intergallactic');
intergallactic.gallactic.getStatus()
  .then(res => {
    /**
    res: {
      statusCode: 200,
      body: {
        result: {
          NodeInfo: {
            protocol_version: [Object],
            id: '982592c078ed7ffa5529a4f73d9a479498cb5b03',
            listen_addr: 'tcp://0.0.0.0:46656',
            network: 'test-chain-5bc7-A4EA60',
            version: '0.26.4',
            channels: '4020212223303800',
            moniker: '',
            other: [Object]
          },
          GenesisHash: 'a4ea6096f5750c5b61c80d7c488dcb07c49b2b5c04b70111b45546d0d77a9575',
          PubKey: 'pjDvQc1rF8HhCAK8L8zu3SJQcKtCMroo1rmRWf8o8m111DexqzX',
          LatestBlockHash: '6c6889dd74663a3553b026b7c89c8781240fa28ef849b6cff448399a0d3419c3',
          LatestBlockHeight: 3331,
          LatestBlockTime: 1543988825012679000,
          NodeVersion: '0.3.0-276b672b'
        },
        id: 'bd09dbba-840b-61f4-3385-1f6d20b75476',
        jsonrpc: '2.0'
      }
    }
    */
  })

A minified, browserified file can be generated by running command like below:

npm run browser

And the file dist/intergallactic.min.js will be generated for use in the browser. Including this file simply attaches Intergallactic object to window:

<sciprt src="dist/intergallactic.min.js" type="text/javascript"></script>

Tests

Unit tests are in the test directory and can be run with mocha:

npm test

The command will help run webpack generate new minified file under dist folder. inside the test folder, there's test.html that will trigger to run mocha if opened using a browser for browser testing. Otherwise, you can run mocha to start the test

mocha

License

MIT