Created
May 11, 2022 16:56
-
-
Save mgild/fe59d674e21983f98199408c3f6bb70f to your computer and use it in GitHub Desktop.
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
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