Fact Finance Solana SDK is a library that provides a set of tools to interact with the Fact Finance protocol on the Solana blockchain.
git clone https://github.com/FactFinance/fact-sdk.gitThen, install the dependencies:
cd fact-sdk
yarn import { TheFactOracle } from 'TheFactOracle';
const theFactOracle = new TheFactOracle(provider, "testnet");
let [value, timestamp] = await theFactOracle.getValueAccount(datafeedAccount); import { TheFactOracle } from 'TheFactOracle';
const wallet = await getKey();
const anchorWallet = new anchor.Wallet(wallet);
let connection = new web3.Connection("https://api.testnet.solana.com", "confirmed");
const provider = new anchor.AnchorProvider(connection, anchorWallet, {})
anchor.setProvider(provider);
const theFactOracle = new TheFactOracle(provider, "testnet");
const pdaAdmin = new web3.PublicKey(FACT_PDA_ADMIN);
const testnetProgram = new web3.PublicKey(TESTNET_FACT_PROGRAM_ID);
const feedId = 150;
let [datafeedAccount, _] = await anchor.web3.PublicKey.findProgramAddress(
[pdaAdmin.toBuffer(), Buffer.from("_"), Buffer.from(feedId.toString())],
testnetProgram
);
let [value, timestamp, confidenceIndex] = await theFactOracle.getValueAccount(datafeedAccount);MIT