Zap-term

CLI Tool for interacting with Zap contracts for providers and users

Installation

Prerequisites: npm

npm install -g zap-term

This will install zap-term as a program you can run on your terminal. You can turn it on using the command below, which will take you to the configuration menu.

zap-term

Once you choose that, you can input a network id(or leave it empty to use the default network id) as well as your pneumonic to the main menu.

Usage

General Menu

  • List Oracles : Returns a list of every address within the given network

  • Get Oracle Info : Returns public information about a given oracle provider. Takes in oracle address as parameter.

  • Get Query Status : Gets pending status of a query given the query ID generated by ZAP contracts.

  • Calculate Required Zap : Given an oracle address and endpoint, calculates how much ZAP is required to purchase a certain amount of dots for an oracle.

  • Get Bound Dots : Retrieves how many dots are currently bound to an oracle

  • Get Bound Zap : Retrieves how much ZAP is currently invested into an oracle

  • Get Dot Limit : Retrieves the maximum number of dots that can be bound to any single oracle.

Provider Menu

The menu specifically for provider based functions. It is built around building and editing your own oracles.

  • Get Current Provider's Info: Retrieves the public information of the zap-term user.

  • Create Oracle : Initializes an oracle provider from the zap-term user's address and inserts the data into the zap contract database.

  • Set Title : Allows you to set or change the name of your Oracle Provider

  • Initiate Endpoint : Allows you to create an Oracle and set up a bonding curve. It will prompt you for the Title of the oracle, a broker address if you so choose to have one, and the ability to set up a bonding curve. If you set up a broker, only that address can bond and unbond to the bonding curve. The bonding curve is set up as a piecewise polynomial function.

  • Clear Endpoint : Deletes one of your endpoints on the condition that no ZAP is bonded to it.

  • List Endpoints : Returns a list of every endpoint created by the user.

  • Get Endpoint's Info : Retrieves information about an endpoint, such as number of dots and ZAP bound, as well as the bonding curve information

  • Get Provider's Bound Dots : Returns how many dots one of your subscribers have bound to one of your endpoints

  • Get Provider's Bound Zap : Retrieves the number of Zap bound to one of your endpoints

  • Get Endpoint Params : Retrieves the names of the endpoint parameters necessary to access your endpoint

  • Set Endpoint Params : Changes the names of the endpoint parameters for accessing one of your endpoints

  • Get Params : Gets parameters for your provider, as defined by you

  • Set Params : Sets up parameters for your provider, for example provider assets , images, ipfs links, etc

  • Save endpoint to ipfs : Saves your endpoint data to an ipfs link.

  • Save .md file to ipfs : Saves an .md file to an ipfs link. The md file must have the same name as your endpoint and be placed within the .md folder. This can only be done by downloading the zap-term from github directly using

git clone https://github.com/zapproject/zap-term.git

Once you've done this, you can set your markdown file in the md folder and give it the same name as your endpoint. For example, if you have a "price" endpoint, you should save your md file as "price.md". Once these markdown files are saved to ipfs, they can be viewed in OracleMarketCap

  • Respond to Query : Manually respond to a query made to you, given that you have the correct query ID

  • Listen to Queries : Turns zap-term into a Daemon that listens for query events.

Subscriber Menu

The subscriber menu is meant for bonding and using oracles, whether your own or someone else's

  • Get Subscriber's Bound Dots : Get how many dots one has bonded to an oracle given the address and endpoint

  • Get Subscriber's Bound Zaps : Get how much ZAP one has bonded to an oracle given the address and endpoint

  • Approve Provider : Approve a certain amount of Zap to be bonded to a provider.

  • Bond To Endpoint : Purchase an endpoint's dots using ZAP from a provider

  • Unbond To Endpoint : Sell an endpoints dots for ZAP from a provider.

  • Query : If you have bonded to an endpoint, you may spend one dot to make a query to an endpoint. If you know how to structure the query and endpoint parameters, you simply input them one after the other

  • Cancel Query : If a query is pending and has yet to be answered, you may get a refund on your dot, given that you have the query ID

  • Start Subscription : For temporal subscriptions. One dot is equivalent to one blocktime of subscription time, which is approximately 15 seconds in Ethereum. It only requires the address, endpoint, and how many blocks you intend to subscribe for

  • End Subscription : Ends a temporal subscription, refunding any unused dots.

  • Get Subscription : Retrieves subscription data, such as how many dots have been escrowed, as well as the starting block.

  • Get Starting Block : Retrieves the block number at the time of subscription

  • Get Ending Block : Get the block at the estimated time of the end of the subscription

Last updated