Package Exports
- substreams
- substreams/dist/index.js
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 (substreams) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Substreams Javascript consumer
SubstreamJavascript consumer library using native Node.js event emitters.
Install
Using NPM:
npm install --save substreamsor using Yarn:
yarn add substreamsRequirements
Firsehose V2
| Chain | Host |
|---|---|
| EOS | eos.firehose.eosnation.io:9001 |
| WAX | wax.firehose.eosnation.io:9001 |
| Ore | ore.firehose.eosnation.io:9001 |
| Telos | telos.firehose.eosnation.io:9001 |
Firsehose V2 (Testnets)
| Chain | Host |
|---|---|
| WAX Testnet | waxtest.firehose.eosnation.io:9001 |
| Jungle 4 | jungle4.firehose.eosnation.io:9001 |
| Kylin | kylin.firehose.eosnation.io:9001 |
| Ore Stage | orestage.firehose.eosnation.io:9001 |
| Telos Testnet | telostest.firehose.eosnation.io:9001 |
Quickstart
import { Substreams, download } from "substreams";
// User input
const host = "eos.firehose.eosnation.io:9001";
const substream = "https://eos.mypinata.cloud/ipfs/Qmdf7GT6jaT9NB3XPLvss8YxuHiSAC1PP1xm9UqLbuouYT";
const outputModules = ["map_action_traces"];
const startBlockNum = "283000000";
const stopBlockNum = "283001000";
// Initialize Substreams
const substreams = new Substreams(host, {
startBlockNum,
stopBlockNum,
outputModules,
});
(async () => {
// download Substream from IPFS
const {modules, registry} = await download(substream);
// Find Protobuf message types from registry
const ActionTraces = registry.findMessage("antelope.common.v1.ActionTraces");
if ( !ActionTraces) throw new Error("Could not find ActionTraces message type");
substreams.on("mapOutput", output => {
const { actionTraces } = ActionTraces.fromBinary(output.data.mapOutput.value);
for ( const actionTrace of actionTraces ) {
console.log(actionTrace);
}
});
// start streaming Substream
await substreams.start(modules);
// end of Substream
console.log("done");
process.exit();
})();Tests
$ npm ci
$ npm test