solana.js: published 2.0.112

This commit is contained in:
Conner Gallagher 2023-01-18 16:40:25 -07:00
parent c02c0c92c7
commit 8b113f31cf
3 changed files with 24 additions and 23 deletions

View File

@ -1,12 +1,12 @@
{ {
"name": "@switchboard-xyz/solana.js", "name": "@switchboard-xyz/solana.js",
"version": "2.0.111", "version": "2.0.112",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@switchboard-xyz/solana.js", "name": "@switchboard-xyz/solana.js",
"version": "2.0.111", "version": "2.0.112",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@project-serum/anchor": "^0.26.0", "@project-serum/anchor": "^0.26.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "@switchboard-xyz/solana.js", "name": "@switchboard-xyz/solana.js",
"version": "2.0.111", "version": "2.0.112",
"author": "", "author": "",
"license": "MIT", "license": "MIT",
"description": "API wrapper for integrating with the Switchboard V2 program on Solana", "description": "API wrapper for integrating with the Switchboard V2 program on Solana",

View File

@ -142,7 +142,26 @@ export class SwitchboardTestContextV2 {
const program = await SwitchboardProgram.fromConnection(connection, wallet); const program = await SwitchboardProgram.fromConnection(connection, wallet);
const networkParams = networkInitParams ?? DEFAULT_LOCALNET_NETWORK; const networkInit = networkInitParams ?? DEFAULT_LOCALNET_NETWORK;
// only allow creating a single oracle
// ensure authority matches Anchor.toml wallet so we dont need to worry about transferring oracle funds
const networkParams: NetworkInitParams = _.merge(
{ reward: 0, minStake: 0, size: 10 },
networkInit,
{
authority: undefined,
oracles: [
networkInit.oracle
? _.merge(networkInit.oracle, {
authority: undefined,
enable: true,
})
: { authority: undefined, enable: true },
],
}
);
// try to load existing network
try { try {
if ('keypair' in networkParams) { if ('keypair' in networkParams) {
const queuePubkey = networkParams.keypair!.publicKey; const queuePubkey = networkParams.keypair!.publicKey;
@ -160,25 +179,7 @@ export class SwitchboardTestContextV2 {
// eslint-disable-next-line no-empty // eslint-disable-next-line no-empty
} catch {} } catch {}
// only allow creating a single oracle const [network] = await SwitchboardNetwork.create(program, networkParams);
// ensure authority matches Anchor.toml wallet so we dont need to worry about transferring oracle funds
const mergedNetworkParams = _.merge(
DEFAULT_LOCALNET_NETWORK,
networkParams,
{
authority: undefined,
oracles: [
_.merge(DEFAULT_LOCALNET_NETWORK.oracle, networkParams.oracle, {
authority: undefined,
}),
],
}
);
const [network] = await SwitchboardNetwork.create(
program,
mergedNetworkParams
);
const loadedNetwork = await network.load(); const loadedNetwork = await network.load();
if (loadedNetwork.oracles.length !== 1) { if (loadedNetwork.oracles.length !== 1) {