Midpoint CLI

Command-Line Utility for Midpoint

# Latest Release: 0.0.1
npm install -g midpoint-cli
midpoint setup <token>
  • Run this command to setup your authentication token, replacing <token> with your Midpoint API Key. You can obtain an API Key here.

  • Paste your token in the CLI. This creates a credentials file in your root directory. To edit it directly, run:

vi ~/.midpoint_cred
midpoint init <template> <name>
  • Run this command to configure your midpoint, replacing <template> with one of the templates [oracle, price-feed, data-bridge, event-notifier, cross-chain-data, filecoin-wikipedia-oracle, filecoin-filrep-oracle, black]; replacing <name> with your midpoint name. It will also create a new folder with all the midpoint config json files inside.

  • path file describes the relation between all other json config files. In this example, contract-called.json will eventually trigger transact-data-back-on-chain.json.

midpoint upload
  • Run this command to upload your local midpoint configuration. In this example, a new midpoint 159 is created with name new-midpoint. The source definition is in contract-called.json, and the task definition is in transact-data-back-on-chain.json.

midpoint add-secret <value> <name>
  • Run this command to create a secret. This is especially useful for HTTP Request authentication, or anywhere you have a value you want to keep private. Replace <value> with your private secrets, and replacing <name> with a name that will be used inside task definition files.

midpoint delete-secret <name>
  • Run this command to delete a secret you have created. Replace <name> with the secret name you defined before.

midpoint publish [noUpload]
  • Run this command to publish midpoint. In this case the midpoint will start running, which means it can periodically trigger requests (cron job), be able to process blockchain events (smart contract generated by Midpoint specifically or any other public smart contract). Option noUpload is False by default. It will automatically upload the latest midpoint configuration, and then publish the midpoint. IMPORTANT: a published midpoint cannot add-secret, delete-secret, upload, ext.

midpoint unpublish
  • Run this command to unpublish a midpoint. In this case the midpoint will stop running, and you can modify the definition, add/delete secrets.

midpoint add-task <taskType> <name>
  • Run this command to define a new task. The new task will be added into the <name>.json file. The taskType is one of the options [makeHttpRequest, transactToEvmFunctionTestnet, transactToEvmFunctionMainnet, callEvmFunction, shiftDecimal]. IMPORTANT: you need to link the new task inside path file by editing the path file.

  • When modifying the path file. You have two options: if you want to run the task in parallel to other tasks, you can follow this example where transact-data-back-on-chain and send-slack-message will run in parallel.

  • If you want to run the task sequentially, you can follow this example where transact-data-back-on-chain will start right after send-slack-message has finished.

midpoint add-source <sourceType> <name>
  • Run this command to define a new source. The new source will be added into the <name>.json file. The sourceType is one of the options [startpointCalledSource, evmEventEmittedSource, cronJobTriggeredSource]. IMPORTANT: you need to link the new source inside the path file manually. You can only have one source per midpoint!

  • In this demo, you have to remove the default source in the path file.

midpoint list-secrets
  • Run this command to list all secrets you have created so far.

midpoint get-status
  • Run this command to show the current status of your midpoint. The status could be live/draft/deleted.

Last updated