open-index/open-npm huggingface dataset:
npm package: @ruleos/core-engine-sdk
Description: ```shell npm install @ruleos/core-engine-sdk                                                 ```
Latest version: 0.0.5

# install

```shell
npm install @ruleos/core-engine-sdk                                                
```

# example

```js
import { Engine, PCluster, Helper, HANDLER_CMD, loadEngine } from "@ruleos/core-engine-sdk";
import { ethers } from "ethers";

let [signer] = await ethers.getSigners();

// initialize the SDK
let contracts = await loadEngine();
const engine = await Engine.create(signer, contracts);

// create cluster from protocolJson
let protocolJson = { /*...*/ };
let pCluster = PCluster.load(protocolJson);
let cluster = pCluster.toCluster();

// register cluster
let eventCluster = await engine.regRule(cluster);

// input for rule
let inTokenList: Token[] = [
  Token.newERC20("erc20.address", "5000000000000000000")
];
let eventTask = await engine.input(eventCluster.clusterId, 0, 1, 1, 0, 10000, inTokenList, []);

// execute
eventTask = await engine.execute(eventTask.taskId, Helper.rlp([HANDLER_CMD.EXECUTE]), [0]);


```