Program Client
Banksea Oracle aims to provide value of NFTs support on Solana. In this guide, we will teach you how to get the value (floor price, AI floor price, avg price in 24h) of collection on Solana Devnet.
Environment Setup
Development requires rust and solana environment:
Clone the example
Clone the example about Banksea Oracle:
Run the example
This section will guide you how to run the Banksea Oracle example.
Install the dependencies
Build the program
Set Solana cluster to Devnet
Deploy the program
Run the test client
Run the following command to test the example program:
Then, the result will be print, like following:
Review the example
In this section, we will review the example code with you.
Cargo settings
First of all, please view the cargo.toml on root directory of the example project.
There is banksea-oracle which is a rust library for Banksea Oracle. If you want to use Banksea Oracle on your program, you should copy this line to the cargo.toml on your project.
Program
the lib.rs is a simple program example:
Client will call the process_instruction with feed_account and answer_account.
The process_instruction call the banksea_oracle::get_feed_info (to parse the feed_account) and copy the result to answer_account.
Then, the Client will print the detail of answer_account.
The table below provides an overview of the fields on FeedInfo:
Field Name
Description
oracle
The oracle handle which save configure of the oracle.
subscriber
The subcriber of this feeding.
code
The collection code which identify a collection.
unit
The unit of price.
decimals
The decimals of price.
aggregate_time
The latest aggregation time.
aggregate_node_count
The number of nodes at the latest aggregation.
floor_price
Minimum listing price of this collection on marketplace
ai_floor_price
The minimum AI valuation of this collection
avg_price
The 24 hour average price of the collection
Client
The typescript client is inclue:
main.ts: the program entry of client.
oracle.ts: the oracle call.
utils.ts: the utils of solana access.
Please View getOracleInfo on oracle.ts:
This function is an example for getting feed information about DeGods. If you want to get other collection, you can find the Feed Account on our site and replace the value of feedAccountId with it.
Last updated