From 8b113f31cfc2bbce98298d1df64f3fc0f687c807 Mon Sep 17 00:00:00 2001 From: Conner Gallagher Date: Wed, 18 Jan 2023 16:40:25 -0700 Subject: [PATCH] solana.js: published 2.0.112 --- javascript/solana.js/package-lock.json | 4 +- javascript/solana.js/package.json | 2 +- .../src/test/SwitchboardTestContextV2.ts | 41 ++++++++++--------- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/javascript/solana.js/package-lock.json b/javascript/solana.js/package-lock.json index 9f89632..db07e2e 100644 --- a/javascript/solana.js/package-lock.json +++ b/javascript/solana.js/package-lock.json @@ -1,12 +1,12 @@ { "name": "@switchboard-xyz/solana.js", - "version": "2.0.111", + "version": "2.0.112", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@switchboard-xyz/solana.js", - "version": "2.0.111", + "version": "2.0.112", "license": "MIT", "dependencies": { "@project-serum/anchor": "^0.26.0", diff --git a/javascript/solana.js/package.json b/javascript/solana.js/package.json index 06d8e65..6fad57d 100644 --- a/javascript/solana.js/package.json +++ b/javascript/solana.js/package.json @@ -1,6 +1,6 @@ { "name": "@switchboard-xyz/solana.js", - "version": "2.0.111", + "version": "2.0.112", "author": "", "license": "MIT", "description": "API wrapper for integrating with the Switchboard V2 program on Solana", diff --git a/javascript/solana.js/src/test/SwitchboardTestContextV2.ts b/javascript/solana.js/src/test/SwitchboardTestContextV2.ts index 7f2f877..267a39f 100644 --- a/javascript/solana.js/src/test/SwitchboardTestContextV2.ts +++ b/javascript/solana.js/src/test/SwitchboardTestContextV2.ts @@ -142,7 +142,26 @@ export class SwitchboardTestContextV2 { 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 { if ('keypair' in networkParams) { const queuePubkey = networkParams.keypair!.publicKey; @@ -160,25 +179,7 @@ export class SwitchboardTestContextV2 { // eslint-disable-next-line no-empty } catch {} - // only allow creating a single oracle - // 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 [network] = await SwitchboardNetwork.create(program, networkParams); const loadedNetwork = await network.load(); if (loadedNetwork.oracles.length !== 1) {