@haechi-labs/ql-handler-sdk
v0.0.4
Published
SDK to build handler of Query Layer(Assumed Name)
Downloads
8
Readme
ql-handler-sdk
SDK to build handler of Query Layer
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"
};
}
}