GetAllCurrencyPairs
: Returns all of the currently supported asset pairsGetPrice
: Returns the price of a single asset pairGetPrices
: Returns the price of multiple asset pairs
Integrating the Queries into Your Contract
To make the queries from your own contracts, you can copy thepackages
folder found in the wasm-connect-query contract repository into your own project. This folder contains the necessary files and definitions to make the queries from your own contracts.
See here for an example contract that integrated the queries.
The way that you use each query and the response structure returned from each is then outlined below.
GetAllCurrencyPairs
This query takes no arguments and returns the list of all of the currently supported asset pairs. Example Usage (Simplified)GetAllCurrencyPairsResponse
and is in the following form:
Example Response
GetPrice
This query takes two arguments:base
and quote
, which represent the base and quote asset symbol strings of the asset pair you want to query. Note that the base
and quote
pair must be supported by Connect and be included in the GetAllCurrencyPairsResponse
. For example, “BTC” and “USD” is a valid pair, but “BTC” and “AAVE” is not.
Example Usage (Simplified)
GetPrices
This query takes a list of asset pair IDs and returns the prices of the asset pairs. Unlike forGetPrice
, the pair IDs are not an object symbol, but instead a single string in the format {base}/{quote}
. For example, BTC/USD
or ETH/USD
.
Example Usage (Simplified)