1.0.9 ā€¢ Published 4 years ago

@bandprotocol/cron-requester v1.0.9

Weekly downloads
10
License
MIT
Repository
github
Last release
4 years ago

ā­ļø Features

  • Support cron-style scheduling
  • Support configuration via json file
  • Support execution through npx, no installation needed

šŸ“¦ Prerequisite

You need to create a config.json file in your machine. Note that all the fields are mandatory, except cronPattern and requestInterval.

See example config.json for an example of requesting data from Band's GuanYu devnet every 5 minutes:

{
  "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": "*/5 * * * *",
  "requestInterval": 1000,
  "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
      }
    }
  ]
}

āš ļø Important: You need to have enough BAND in the requester account for paying transaction fees, otherwise your requests will fail.

šŸ’Ž Example Usage

npx @bandprotocol/cron-requester config.json

Request Mode

If config.json does NOT specifies cronPattern, the requests will be sent in just one time.

āˆŸ āœ… 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 was submitted
--------------------------------------------------------

Cron Mode

If config.json has specified cronPattern, the requests will be running by the interval specified.

--------------------------------------------------------
ā­ļø 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 was submitted
--------------------------------------------------------
1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago