-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Project import generated by Copybara. (#117)
GitOrigin-RevId: 2b76139229beb79bca032660b3c9faa05ca71091 Co-authored-by: Copybara <[email protected]>
- Loading branch information
gallynaut
and
Copybara
authored
Aug 16, 2023
1 parent
1dae1ce
commit c8b6ec9
Showing
38 changed files
with
241 additions
and
129 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,62 @@ | ||
import type { BasicOracle } from "../target/types/basic_oracle"; | ||
|
||
import * as anchor from "@coral-xyz/anchor"; | ||
import { Connection, PublicKey } from "@solana/web3.js"; | ||
import * as sb from "@switchboard-xyz/solana.js"; | ||
|
||
const rpcUrl = | ||
"https://api.devnet.solana.com"; | ||
const kp = sb.loadKeypair( | ||
"~/switchboard_environments_v2/devnet/upgrade_authority/upgrade_authority.json" | ||
); | ||
const DEFAULT_DEVNET_QUEUE = "CkvizjVnm2zA5Wuwan34NhVT3zFc7vqUyGnA6tuEF5aE"; | ||
const DEFAULT_MAINNET_QUEUE = "2ie3JZfKcvsRLsJaP5fSo43gUo1vsurnUAtAgUdUAiDG"; | ||
|
||
async function main() { | ||
const con = new Connection(rpcUrl); | ||
const switchboardProgram = await sb.SwitchboardProgram.load( | ||
"mainnet-beta", | ||
con, | ||
kp | ||
); | ||
const attestationProgram = await sb.SwitchboardProgram.loadAnchorProgram( | ||
"mainnet-beta", | ||
con, | ||
kp, | ||
switchboardProgram.attestationProgramId | ||
); | ||
|
||
console.log(`ProgramID: ${switchboardProgram}`); | ||
|
||
const recentSlot = ( | ||
await con.getLatestBlockhashAndContext({ | ||
commitment: "finalized", | ||
}) | ||
).context.slot; | ||
console.log(recentSlot); | ||
const [fn, tx] = await sb.FunctionAccount.create(switchboardProgram, { | ||
container: "t1", | ||
recentSlot: recentSlot, | ||
attestationQueue: new sb.AttestationQueueAccount( | ||
switchboardProgram, | ||
new PublicKey(DEFAULT_DEVNET_QUEUE) | ||
), | ||
mrEnclave: Buffer.from( | ||
"63ba8df478b4a74795a79a73b8f0a6f792f88e95f9ed6202289091e6e1b65fa1", | ||
"hex" | ||
), | ||
requestsDisabled: false, | ||
requestsRequireAuthorization: false, | ||
requestsDefaultSlotsUntilExpiration: new anchor.BN("0"), | ||
requestsFee: 0, | ||
}); | ||
|
||
// console.log("Your transaction signature", tx); | ||
|
||
console.log("Your transaction signature", tx); | ||
} | ||
|
||
main().catch((err) => { | ||
console.error(err); | ||
process.exit(1); | ||
}); |
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
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 |
---|---|---|
|
@@ -33,4 +33,4 @@ impl SetFunction<'_> { | |
program.function = ctx.accounts.function.key(); | ||
Ok(()) | ||
} | ||
} | ||
} |
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
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
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
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.