New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

arweave-synchronizer

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arweave-synchronizer

A cool tool to process and sync all transactions from a custom GQL query in order to gather metrics for from a specific data protocol.

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

Arweave synchronizer node

A cool tool to process and sync all transactions from a custom GQL query in order to gather metrics for from a specific data protocol.

Documentation

Getting started

$ npm install arweave-synchronizer

or

$ yarn add arweave-synchronizer

Simple example

import Synchronizer from 'arweave-synchronizer';

const sync = new Synchronizer([
  { name: "Protocol-Name", values: "Account-0.2" },
  { name: "Signing-Client", values: "ArConnect" }
]);

sync.on('response', ({txs, txCounter}) => {
  // process the page of transactions here
});

sync.start(); // This must be called at the end

References

Constructor arguments

argumentdefault
Tags array (GQLTagInterface[])x
Txs per query100
Delay between queries (ms)5000

Event listeners

⚠️ Event listeners must be set before sync.start() method is called or it won't work.

In chronological order:

  • on start:
sync.on('start', () => console.log(" 🚦 Starting the synchronizer..."));
  • on request:
sync.on('request', () => console.log(" 🔄 Requesting transactions, waiting for response..."));
  • on exception:
sync.on('exception', (e) => console.log(` ❌ ${e.message}`));
  • on response:
sync.on('response', ({txs, txCounter, timestamp, cursor}) => {
  // process the transactions page 
});
  • on synchronized:
sync.on('synchronized', () => console.log(" ✅ The node has synchronized with the Blockweave."));

Status

You can get the current status:

console.log(sync.getStatus()) // return "stopped", "syncing" or "synced"

To do

  • Add optional caching that would store the txCounter in a flat file so stopping synchronization doesn't require to start over from the beginning

Keywords

Arweave

FAQs

Package last updated on 04 Jul 2022

Did you know?

Socket

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.

Install

Related posts