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.
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.
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:
export async function getOracleInfo(): Promise<void> {
const feedAccountId = new PublicKey("DGaMbFh9BPZbNVWLygK4m3VhxBaNZkCumbnhpijFroaD") // It is `degods`
let feedAccount = {
pubkey: feedAccountId,
isSigner: false,
isWritable: false,
};
let answer = {
pubkey: answerPubkey,
isSigner: false,
isWritable: true
};
const instruction = new TransactionInstruction({
keys: [feedAccount, answer],
programId,
data: Buffer.alloc(0),
});
await sendAndConfirmTransaction(
connection,
new Transaction().add(instruction),
[payer],
);
// print the detail of answer account
const accountInfo = await connection.getAccountInfo(answerPubkey);
if (accountInfo === null) {
throw 'Error: cannot find the account';
}
const answerInfo = borsh.deserializeUnchecked(
AnswerSchema,
AnswerAccount,
Buffer.from(accountInfo.data),
);
answerInfo.print();
}
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.