Getting Started
Helps user get their API keys and interact with the protocol.
Last updated
Helps user get their API keys and interact with the protocol.
Last updated
To use Doot Oracles in your project, you will have to generate an API key through the user interface and interact with the npm/yarn package. Don't worry its really quick For this step we require the user to have an address on-chain and have the Auro Wallet extension on their browsers installed.
After you are done with per-requisites, follow the given steps :
Visit www.doot.foundation and click on the Dashboard.
As soon as you visit the Dashboard, you will be shown a prompt asking you to connect your wallet with the website. Click on connect.
If you are a new user, another pop-up will now appear before you to generate an API key. Hit Onboard and wait for a few seconds for the next wallet interaction to appear.
Once clicked, the Auro Wallet extension will ask for your signature over a simple message, the signature is to prove the ownership of the account and one such signature is only valid for 60 seconds.
After you have copied the API key, navigate to your project and install the client package using npm/yarn as :
As of now, Doot supports 5 asset prices including : $MINA, $ETH, $BTC, $LINK and $SOL.
Move over to your interact.ts script (Or the .ts file through which you are interacting with your zkApp's smart contract) and include the following lines to fetch the latest price of say $MINA.
The valid values for client.Price() are : 'mina', 'ethereum', 'chainlink', 'solana' and 'bitcoin'.
The following step fetches the latest price of $MINA and stores it in your variable.
ClientResultObject is an interface defining the data returned and their types. The Result contains the following data :
asset : The name of the asset.
price : The fetched price as a multiple of 10**decimals since Mina smart contracts can't handle floating point numbers.
decimals : The multiplication factor.
signature : The signature over price. The signature is crucial and can be used as a proof that yes the price was returned by the oracle's Public Key. Is a base58 value.
oracle : The Public Key of the oracle. Is a base58 value.
Wait a few seconds and you will be presented with your API keys as follow. Clicking on the displayed key will conveniently copy it to your clipboard.
Now all you need to do is to wrap them around with appropriate o1js types and you are good to go!
Congratulations! You now know how to use Doot Oracles with your zkApps! Ready to build the next big thing on Mina? We will all be cheering for you!