@haechi-labs/ql-handler-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

ql-handler-sdk

SDK to build handler of Query Layer

TypeScript License: MIT

import { Ethereum } from "@haechi-labs/ql-handler-sdk";

export.handler = (event: Ethereum.ProcessedEvent) => {
    // do something awesome !
    return result;
}

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js. Node.js 8.12 or higher is required. Also you need to install ts-node package >= v7.0.1 is required

Installation is done using the npm install command:

$ npm install --save ql-handler-sdk

Features

  • provide querylayer user-defined function event interface

Quick Start

Create your package and initialize npm.

$ mkdir awesome-function && cd awesome-function && npm init

Install the ql-handler-sdk package:

$ npm i --save @haechi-labs/ql-handler-sdk

Write your own function code:

import { Ethereum } from "@haechi-labs/ql-handler-sdk"

exports.handler = (event: Ethereum.ProcessedEvent) => {
    const { blockMeta } = event;
    const { receipt } = blockMeta;
    
    if (receipt.gasUsed >= 10000) {
     	return {
            id: event.id,
            msg: "gas used over 10000"
     	};   
    }
}

License

MIT

Package Sidebar

Install

npm i @haechi-labs/ql-handler-sdk

Weekly Downloads

1

Version

0.0.4

License

MIT

Unpacked Size

23.2 kB

Total Files

17

Last publish

Collaborators

  • beingbook2
  • haechi_labs
  • borre.facewallet