cron-requester

1.0.0 • Public • Published

Band Data Requester

A light-weight node.js tool to query data on BandChain periadically

⭐️ Features

  • Support cron-style scheduling
  • Support configuration via json file
  • No-installation required with npx

📦 Prerequisite

You need to create a config.json file in your machine.

See example config.json for requesting data from GuanYu devnet every 5 minutes:

{
  "chainId": "band-guanyu-devnet-2",
  "endpoint": "http://guanyu-devnet.bandchain.org/rest",
  "mnemonic": "final little loud vicious door hope differ lucky alpha morning clog oval milk repair off course indicate stumble remove nest position journey throw crane",
  "cronPattern": "*/1 * * * *",
  "validatorCounts": {
    "minCount": 3,
    "askCount": 4
  },
  "requests": [
    {
      "oracleScriptId": 1,
      "params": {
        "symbol": "BTC",
        "multiplier": 1000000
      }
    },
    {
      "oracleScriptId": 13,
      "params": {
        "base_symbol": "ETH",
        "quote_symbol": "CNY",
        "aggregation_method": "median",
        "multiplier": 1000000
      }
    }
  ]
}
 

💎 Example Usages

npx @bandprotocol/cron-requester config.json

If the config.json is correctly formatted, you should see something like this:

--------------------------------------------------------
⭐️ Cron is running! Your requests will be executed with cron pattern */5 * * * *
📆 Your first requests will start at Sun Jun 14 2020 19:25:00 GMT+0700
--------------------------------------------------------
⏰ Requests start at 6/14/2020, 7:25:00 PM
∟ ✅ requestId = 180 | oracleScript #1 {"symbol":"BTC","multiplier":1000000}
∟ ✅ requestId = 181 | oracleScript #13 {"base_symbol":"ETH","quote_symbol":"CNY","aggregation_method":"median","multiplier":1000000}
⛳️ [2/2] requests went through
--------------------------------------------------------

Package Sidebar

Install

npm i cron-requester

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

6.6 kB

Total Files

4

Last publish

Collaborators

  • smiled0g