Skip to content

Instantly share code, notes, and snippets.

@mgild
Created May 11, 2022 16:56
Show Gist options
  • Save mgild/fe59d674e21983f98199408c3f6bb70f to your computer and use it in GitHub Desktop.
Save mgild/fe59d674e21983f98199408c3f6bb70f to your computer and use it in GitHub Desktop.
const queue = new PublicKey("F8ce7MsckeZAbAGmxjJNetxYXQa9mKr9nnrC3qKubyYy");
const burl = `https://api.raydium.io/coin/price?coins=LARIX`;
const tasks = [
OracleJob.Task.create({
httpTask: OracleJob.HttpTask.create({
url: burl,
method: OracleJob.HttpTask.Method.METHOD_GET,
}),
}),
];
const data = Buffer.from(
OracleJob.encodeDelimited(
OracleJob.create({
tasks,
})
).finish()
);
const jobAccount = await sbv2.JobAccount.create(program, {
data,
keypair: Keypair.generate(),
authority: sbv2.programWallet(program).publicKey,
});
const minUpdateDelaySeconds = 5;
const bufRelayer = await sbv2.BufferRelayerAccount.create(program, {
name: Buffer.from("t1"),
minUpdateDelaySeconds,
queueAccount: new sbv2.OracleQueueAccount({
program,
publicKey: queue,
}),
authority: sbv2.programWallet(program).publicKey,
jobAccount,
});
const permissionAccount = await sbv2.PermissionAccount.create(program, {
authority: walletKeypair.publicKey,
granter: queue,
grantee: bufRelayer.publicKey,
});
let sig = await bufRelayer.openRound();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment