🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

bufnita

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bufnita

Bufnița is a contract observer and indexer library, that reads events from a web3 provider, stores them into a MongoDB database, notify them to webhooks and execute callbacks.

latest
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

🦉 Bufnița

Bufnița is a contract observer and indexer library, that reads events from a web3 provider, stores them into a MongoDB database, notify them to webhooks and execute callbacks.

1. Usage

Bufnița can be used as library or as command line interface.

1.1 Command Line Interface

# Installation
npm i -g bufnita

# Execution

bufnita [manifest-file, default=manifest.yml]

1.2 Library

// Typescript
import Bufnita from "bufnita";
// Javascript
const Bufnita = require("bufnita");

Bufnita.create(options).then(() => {
	console.log("Observer has been initialized.");
});

1. Manifest File / Bufnița Options

The manifest file and Bufnița options share the same schema, but they are in different situations. Manifest file is the input for the command line, and the Bufnița options object is the input for the Bufnița library.

interface  IManifest {
	version:  string; // Version = "1"
	mongoUrl:  string; // MongoDB URL to connect
	web3Rpc:  string; // Web3 RPC to connect, websockets recommended
	interval?:  number; // How many time between http requests (Http web3rpc only)
	
	contracts?: { // Contracts to observe
		[contractName:  string]:  { // Contract Name
			address:  string; // Contract Address
			events?:  string[] // Events to Observe, All by default
			abi:  string; // ABI Json File Path
			callbacks?: { // Not available in yml, callbacks
				[event:  string]: (data:  any) =>  any // Callbacks are executed by event name
			}
		}
	}
	
	collections?: { // Mongodb data where events & contract meta will be stored
		events?:  string; // default = bufnita-events
		contracts?:  string; // default = bufnita-contracts
	}
	
	rsa?: { // RSA Keys to sign webhooks, default = no signature
		priv:  string; // Path to rsa priv key
		pub:  string; // Path to rsa pub key
	}
	
	webhooks?:  string[]; // List of url where events will be notified
}

3. Flowchart

enter image description here

FAQs

Package last updated on 13 Apr 2023

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