-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dutch
committed
Sep 20, 2022
1 parent
693c0c5
commit c5768fb
Showing
5 changed files
with
702 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ target | |
node_modules | ||
|
||
Cargo.lock | ||
out.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import * as anchor from "@project-serum/anchor"; | ||
import { Program, Wallet } from "@project-serum/anchor"; | ||
import { Connection, Keypair, PublicKey } from "@solana/web3.js"; | ||
import { AggregatorAccount, loadSwitchboardProgram } from "@switchboard-xyz/switchboard-v2"; | ||
import { RustDecimalWrapper } from "@vyper-protocol/rust-decimal-wrapper"; | ||
import { IDL } from "../../target/types/rate_switchboard"; | ||
|
||
import * as fs from "fs"; | ||
|
||
const AGGREGATOR = new PublicKey("GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR"); | ||
|
||
const main = async () => { | ||
const connection = new Connection("https://api.devnet.solana.com"); | ||
|
||
const program = await loadSwitchboardProgram("devnet", connection); | ||
|
||
const aggregatorAccount = new AggregatorAccount({ | ||
program, | ||
publicKey: AGGREGATOR, | ||
}); | ||
|
||
const history = await aggregatorAccount.loadHistory(); | ||
|
||
history.forEach((c) => | ||
fs.appendFileSync("./out.csv", `${new Date(c.timestamp.toNumber() * 1000)};${c.value.toNumber()}\n`) | ||
); | ||
}; | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.