Skip to main content
To query prices from Connect oracle on WasmVM, you need to utilize the queries provided by the wasm-connect-query contract. Specifically, the contract provides 3 queries:
  1. GetAllCurrencyPairs: Returns all of the currently supported asset pairs
  2. GetPrice: Returns the price of a single asset pair
  3. GetPrices: Returns the price of multiple asset pairs

Integrating the Queries Into Your Contract

To make the queries from your own contracts, you can copy the packages 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)
The response is of type 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)
Example Response

GetPrices

This query takes a list of asset pair IDs and returns the prices of the asset pairs. Unlike for GetPrice, 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)
Example Response