@haechi-labs/henesis-sdk
v0.3.0
Published
SDK to build handler of Henesis
Downloads
1
Readme
henesis-sdk
SDK to build handler of Henesis
import { Ethereum } from "@haechi-labs/henesis-sdk";
exports.handler = (web3, event: Ethereum.Event, blockMeta: Ethereum.BlockMeta, userMeta: Ethereum.UserMeta) => {
// 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 @haechi-labs/henesis-sdk
Features
- provide henesis user-defined function event interface
Quick Start
Create your package and initialize npm.
$ mkdir awesome-function && cd awesome-function && npm init
Install the henesis-sdk package:
$ npm i --save @haechi-labs/henesis-sdk
Write your own function code:
import { Ethereum } from "@haechi-labs/henesis-sdk"
exports.handler = (web3, event: Ethereum.Event, blockMeta: Ethereum.BlockMeta, userMeta: Ethereum.UserMeta) => {
const { index, payload } = event;
const { name, data, transaction } = payload;
if (transaction.gasUsed >= 10000) {
return {
index: index,
msg: "gas used over 10000"
};
}
}