updated program examples

This commit is contained in:
Conner Gallagher 2023-01-18 20:17:40 -07:00
parent 8b113f31cf
commit 9ee9cd4e0d
30 changed files with 736 additions and 1131 deletions

View File

@ -10,6 +10,8 @@ wallet = "~/.config/solana/id.json"
[programs.localnet] [programs.localnet]
anchor_buffer_parser = "96punQGZDShZGkzsBa3SsfTxfUnwu4XGpzXbhF7NTgcP" anchor_buffer_parser = "96punQGZDShZGkzsBa3SsfTxfUnwu4XGpzXbhF7NTgcP"
[programs.devnet]
anchor_buffer_parser = "96punQGZDShZGkzsBa3SsfTxfUnwu4XGpzXbhF7NTgcP"
[registry] [registry]
url = "https://anchor.projectserum.com" url = "https://anchor.projectserum.com"
@ -17,12 +19,23 @@ url = "https://anchor.projectserum.com"
[scripts] [scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 ./tests/*.test.ts" test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 ./tests/*.test.ts"
[test.validator] [test.validator]
url="https://api.devnet.solana.com" url = "https://api.devnet.solana.com"
[test] [test]
startup_wait = 10000 startup_wait = 15000
[[test.validator.clone]] [[test.validator.clone]] # sbv2 devnet programID
address="GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR" # sbv2 SOL/USD Feed address = "2TfB33aLaneQb5TNVwyDz3jSZXS6jdW2ARw1Dgf84XCG"
[[test.validator.clone]] # sbv2 devnet IDL
address = "CKwZcshn4XDvhaWVH9EXnk3iu19t6t5xP2Sy2pD6TRDp"
[[test.validator.clone]] # sbv2 devnet SbState
address = "BYM81n8HvTJuqZU1PmTVcwZ9G8uoji7FKM6EaPkwphPt"
[[test.validator.clone]] # sbv2 devnet tokenVault
address = "FVLfR6C2ckZhbSwBzZY4CX7YBcddUSge5BNeGQv5eKhy"
[[test.validator.clone]] # sbv2 SOL/USD Feed
address="GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR"

View File

@ -18,6 +18,6 @@ cpi = ["no-entrypoint"]
[dependencies] [dependencies]
switchboard-v2 = { path = "../../rust/switchboard-v2" } switchboard-v2 = { path = "../../rust/switchboard-v2" }
# switchboard-v2 = { version = "^0.1.17" } # switchboard-v2 = { version = "^0.1.20" }
anchor-lang = "^0.26.0" anchor-lang = "^0.26.0"
solana-program = "~1.14.0" solana-program = "~1.14.0"

View File

@ -10,7 +10,7 @@
"dependencies": { "dependencies": {
"@project-serum/anchor": "^0.26.0", "@project-serum/anchor": "^0.26.0",
"@solana/web3.js": "^1.66.2", "@solana/web3.js": "^1.66.2",
"@switchboard-xyz/common": "^2.1.8", "@switchboard-xyz/common": "^2.1.26",
"@switchboard-xyz/solana.js": "file:../../javascript/solana.js", "@switchboard-xyz/solana.js": "file:../../javascript/solana.js",
"node-fetch": "^2.6" "node-fetch": "^2.6"
}, },
@ -27,25 +27,24 @@
} }
}, },
"../../javascript/solana.js": { "../../javascript/solana.js": {
"version": "2.0.52", "name": "@switchboard-xyz/solana.js",
"version": "2.0.112",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@project-serum/anchor": "^0.25.0", "@project-serum/anchor": "^0.26.0",
"@project-serum/borsh": "^0.2.5", "@project-serum/borsh": "^0.2.5",
"@solana/spl-token": "^0.3.5", "@solana/spl-token": "^0.3.6",
"@solana/web3.js": "^1.66.1", "@solana/web3.js": "^1.73.0",
"@switchboard-xyz/common": "^2.1.8", "@switchboard-xyz/common": "^2.1.26",
"big.js": "^6.2.1", "dotenv": "^16.0.3",
"bn.js": "^5.2.1", "lodash": "^4.17.21"
"dotenv": "^16.0.3"
}, },
"devDependencies": { "devDependencies": {
"@types/big.js": "^6.1.6",
"@types/bn.js": "^5.1.1",
"@types/chai": "^4.3.4", "@types/chai": "^4.3.4",
"@types/expect": "^24.3.0", "@types/expect": "^24.3.0",
"@types/lodash": "^4.14.191",
"@types/mocha": "^10.0.0", "@types/mocha": "^10.0.0",
"@types/node": "^18.11.0", "@types/node": "^18.11.18",
"anchor-client-gen": "^0.25.0", "anchor-client-gen": "^0.25.0",
"chai": "^4.3.7", "chai": "^4.3.7",
"chalk": "^4.1.2", "chalk": "^4.1.2",
@ -55,8 +54,8 @@
"shx": "^0.3.4", "shx": "^0.3.4",
"ts-mocha": "^10.0.0", "ts-mocha": "^10.0.0",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typedoc": "^0.23.16", "typedoc": "^0.23.23",
"typescript": "^4.8.4" "typescript": "^4.9.4"
}, },
"engines": { "engines": {
"node": ">=16.0.0", "node": ">=16.0.0",
@ -303,10 +302,11 @@
} }
}, },
"node_modules/@switchboard-xyz/common": { "node_modules/@switchboard-xyz/common": {
"version": "2.1.8", "version": "2.1.26",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.8.tgz", "resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.26.tgz",
"integrity": "sha512-mqCDwCtBf3tY2Bvce0USR4m6DsXSqw8rn4luc2sjLL4PPFKCuCZVgzysfkwzwBHoipbnx6odRQ+BIfm35nhWDA==", "integrity": "sha512-uyyEhX/mRgfWqvXbin0pvTmVdJfK7e6w/cWUvA04e6jRzSVzSzh4ZEj+2Dh+8Dj3GlxqRTRiSA3Os8+h5eIa8Q==",
"dependencies": { "dependencies": {
"@solana/web3.js": "^1.66.2",
"big.js": "^6.2.1", "big.js": "^6.2.1",
"bn.js": "^5.2.1", "bn.js": "^5.2.1",
"decimal.js": "^10.4.3", "decimal.js": "^10.4.3",
@ -2473,10 +2473,11 @@
} }
}, },
"@switchboard-xyz/common": { "@switchboard-xyz/common": {
"version": "2.1.8", "version": "2.1.26",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.8.tgz", "resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.26.tgz",
"integrity": "sha512-mqCDwCtBf3tY2Bvce0USR4m6DsXSqw8rn4luc2sjLL4PPFKCuCZVgzysfkwzwBHoipbnx6odRQ+BIfm35nhWDA==", "integrity": "sha512-uyyEhX/mRgfWqvXbin0pvTmVdJfK7e6w/cWUvA04e6jRzSVzSzh4ZEj+2Dh+8Dj3GlxqRTRiSA3Os8+h5eIa8Q==",
"requires": { "requires": {
"@solana/web3.js": "^1.66.2",
"big.js": "^6.2.1", "big.js": "^6.2.1",
"bn.js": "^5.2.1", "bn.js": "^5.2.1",
"decimal.js": "^10.4.3", "decimal.js": "^10.4.3",
@ -2486,31 +2487,29 @@
"@switchboard-xyz/solana.js": { "@switchboard-xyz/solana.js": {
"version": "file:../../javascript/solana.js", "version": "file:../../javascript/solana.js",
"requires": { "requires": {
"@project-serum/anchor": "^0.25.0", "@project-serum/anchor": "^0.26.0",
"@project-serum/borsh": "^0.2.5", "@project-serum/borsh": "^0.2.5",
"@solana/spl-token": "^0.3.5", "@solana/spl-token": "^0.3.6",
"@solana/web3.js": "^1.66.1", "@solana/web3.js": "^1.73.0",
"@switchboard-xyz/common": "^2.1.8", "@switchboard-xyz/common": "^2.1.26",
"@types/big.js": "^6.1.6",
"@types/bn.js": "^5.1.1",
"@types/chai": "^4.3.4", "@types/chai": "^4.3.4",
"@types/expect": "^24.3.0", "@types/expect": "^24.3.0",
"@types/lodash": "^4.14.191",
"@types/mocha": "^10.0.0", "@types/mocha": "^10.0.0",
"@types/node": "^18.11.0", "@types/node": "^18.11.18",
"anchor-client-gen": "^0.25.0", "anchor-client-gen": "^0.25.0",
"big.js": "^6.2.1",
"bn.js": "^5.2.1",
"chai": "^4.3.7", "chai": "^4.3.7",
"chalk": "^4.1.2", "chalk": "^4.1.2",
"dotenv": "^16.0.3", "dotenv": "^16.0.3",
"gts": "^3.1.1", "gts": "^3.1.1",
"lodash": "^4.17.21",
"mocha": "^10.1.0", "mocha": "^10.1.0",
"shelljs": "^0.8.5", "shelljs": "^0.8.5",
"shx": "^0.3.4", "shx": "^0.3.4",
"ts-mocha": "^10.0.0", "ts-mocha": "^10.0.0",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typedoc": "^0.23.16", "typedoc": "^0.23.23",
"typescript": "^4.8.4" "typescript": "^4.9.4"
} }
}, },
"@tsconfig/node10": { "@tsconfig/node10": {

View File

@ -14,7 +14,7 @@
"dependencies": { "dependencies": {
"@project-serum/anchor": "^0.26.0", "@project-serum/anchor": "^0.26.0",
"@solana/web3.js": "^1.66.2", "@solana/web3.js": "^1.66.2",
"@switchboard-xyz/common": "^2.1.8", "@switchboard-xyz/common": "^2.1.26",
"@switchboard-xyz/solana.js": "file:../../javascript/solana.js", "@switchboard-xyz/solana.js": "file:../../javascript/solana.js",
"node-fetch": "^2.6" "node-fetch": "^2.6"
}, },

View File

@ -1,45 +1,50 @@
import * as anchor from "@project-serum/anchor"; import * as anchor from "@project-serum/anchor";
import { OracleJob, sleep } from "@switchboard-xyz/common"; import { OracleJob, sleep } from "@switchboard-xyz/common";
import { import { SwitchboardTestContextV2 } from "@switchboard-xyz/solana.js";
AnchorWallet,
SwitchboardTestContext,
} from "@switchboard-xyz/solana.js";
import fetch from "node-fetch"; import fetch from "node-fetch";
import { PROGRAM_ID } from "../client/programId"; import { AnchorBufferParser } from "../target/types/anchor_buffer_parser";
import { AnchorBufferParser, IDL } from "../target/types/anchor_buffer_parser";
describe("anchor-buffer-parser test", () => { describe("anchor-buffer-parser test", () => {
const provider = anchor.AnchorProvider.env(); const provider = anchor.AnchorProvider.env();
anchor.setProvider(provider); anchor.setProvider(provider);
// const bufferParserProgram = anchor.workspace const bufferParserProgram = anchor.workspace
// .AnchorBufferParser as Program<AnchorBufferParser>; .AnchorBufferParser as anchor.Program<AnchorBufferParser>;
const bufferParserProgram = new anchor.Program( // const bufferParserProgram = new anchor.Program(
IDL, // IDL,
PROGRAM_ID, // PROGRAM_ID,
provider, // provider,
new anchor.BorshCoder(IDL) // new anchor.BorshCoder(IDL)
) as anchor.Program<AnchorBufferParser>; // ) as anchor.Program<AnchorBufferParser>;
const payer = (provider.wallet as AnchorWallet).payer; let switchboard: SwitchboardTestContextV2;
let switchboard: SwitchboardTestContext;
before(async () => { before(async () => {
// Attempt to load the env from a local file switchboard = await SwitchboardTestContextV2.loadFromProvider(provider, {
try { // You can provide a keypair to so the PDA schemes dont change between test runs
switchboard = await SwitchboardTestContext.loadFromEnv(provider); name: "Test Queue",
console.log("local env file detected"); // keypair: Keypair.generate(),
return; queueSize: 10,
} catch (error: any) { reward: 0,
console.log(`Error: SBV2 Localnet - ${error.message}`); minStake: 0,
console.error(error); oracleTimeout: 900,
unpermissionedFeeds: true,
unpermissionedVrf: true,
enableBufferRelayers: true,
oracle: {
name: "Test Oracle",
enable: true,
// stakingWalletKeypair: Keypair.generate(),
},
});
await switchboard.start("dev-v2-RC_01_17_23_16_22", undefined);
});
after(async () => {
if (switchboard) {
switchboard.stop();
} }
// If fails, throw error
throw new Error(
`Failed to load the SwitchboardTestContext from a switchboard.env file`
);
}); });
it("Create and read buffer account", async () => { it("Create and read buffer account", async () => {
@ -76,10 +81,16 @@ describe("anchor-buffer-parser test", () => {
console.log(`BufferRelayer ${bufferAccount.publicKey}`); console.log(`BufferRelayer ${bufferAccount.publicKey}`);
const [payerTokenWallet] =
await switchboard.program.mint.getOrCreateWrappedUser(
provider.publicKey,
{ fundUpTo: 0.01 }
);
const [buffer, openRoundSignature] = const [buffer, openRoundSignature] =
await bufferAccount.openRoundAndAwaitResult( await bufferAccount.openRoundAndAwaitResult(
{ {
tokenWallet: switchboard.payerTokenWallet, tokenWallet: payerTokenWallet,
}, },
30_000 30_000
); );

View File

@ -9,13 +9,9 @@
"noEmit": true, "noEmit": true,
"esModuleInterop": true, "esModuleInterop": true,
"paths": { "paths": {
"@switchboard-xyz/switchboard-v2": ["../../javascript/switchboard-v2"], "@switchboard-xyz/solana.js": ["../../javascript/solana.js"]
"@switchboard-xyz/sbv2-utils": ["../../javascript/sbv2-utils"]
} }
}, },
"include": ["tests/**/*", "client/**/*", "./target/types/anchor_feed_parser"], "include": ["tests/**/*", "client/**/*", "./target/types/anchor_feed_parser"],
"references": [ "references": [{ "path": "../../javascript/solana.js" }]
{ "path": "../../javascript/switchboard-v2" },
{ "path": "../../javascript/sbv2-utils" }
]
} }

View File

@ -5,9 +5,12 @@ members = [
[programs.localnet] [programs.localnet]
anchor_feed_parser = "Fstf3oTcBxHMZFaoBzxk5oSkTh5HaAjxjh6zcgdZpNBb" anchor_feed_parser = "Fstf3oTcBxHMZFaoBzxk5oSkTh5HaAjxjh6zcgdZpNBb"
[programs.devnet]
anchor_feed_parser = "Fstf3oTcBxHMZFaoBzxk5oSkTh5HaAjxjh6zcgdZpNBb"
[provider] [provider]
cluster = "devnet" # cluster = "devnet"
cluster = "localnet"
wallet = "~/.config/solana/id.json" wallet = "~/.config/solana/id.json"
[registry] [registry]
@ -16,11 +19,23 @@ url = "https://anchor.projectserum.com"
[scripts] [scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 ./tests/*.test.ts" test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 ./tests/*.test.ts"
# [test.validator] [test.validator]
# url="https://api.devnet.solana.com" url = "https://api.devnet.solana.com"
# [test] [test]
# startup_wait = 10000 startup_wait = 15000
# [[test.validator.clone]] [[test.validator.clone]] # sbv2 devnet programID
# address="GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR" # sbv2 SOL/USD Feed address = "2TfB33aLaneQb5TNVwyDz3jSZXS6jdW2ARw1Dgf84XCG"
[[test.validator.clone]] # sbv2 devnet IDL
address = "CKwZcshn4XDvhaWVH9EXnk3iu19t6t5xP2Sy2pD6TRDp"
[[test.validator.clone]] # sbv2 devnet SbState
address = "BYM81n8HvTJuqZU1PmTVcwZ9G8uoji7FKM6EaPkwphPt"
[[test.validator.clone]] # sbv2 devnet tokenVault
address = "FVLfR6C2ckZhbSwBzZY4CX7YBcddUSge5BNeGQv5eKhy"
[[test.validator.clone]] # sbv2 SOL/USD Feed
address="GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR"

View File

@ -18,7 +18,7 @@ cpi = ["no-entrypoint"]
[dependencies] [dependencies]
switchboard-v2 = { path = "../../rust/switchboard-v2" } switchboard-v2 = { path = "../../rust/switchboard-v2" }
# switchboard-v2 = { version = "0.1.16" } # switchboard-v2 = { version = "0.1.20" }
anchor-lang = "^0.26.0" anchor-lang = "^0.26.0"
solana-program = "~1.14.0" solana-program = "~1.14.0"
bytemuck = "1.7.2" bytemuck = "1.7.2"

View File

@ -10,8 +10,8 @@
"dependencies": { "dependencies": {
"@project-serum/anchor": "^0.26.0", "@project-serum/anchor": "^0.26.0",
"@solana/web3.js": "^1.70.1", "@solana/web3.js": "^1.70.1",
"@switchboard-xyz/common": "^2.1.8", "@switchboard-xyz/common": "^2.1.26",
"@switchboard-xyz/solana.js": "^2.0.52" "@switchboard-xyz/solana.js": "file:../../javascript/solana.js"
}, },
"devDependencies": { "devDependencies": {
"@types/chai": "^4.3.0", "@types/chai": "^4.3.0",
@ -24,6 +24,41 @@
"typescript": "^4.7" "typescript": "^4.7"
} }
}, },
"../../javascript/solana.js": {
"version": "2.0.112",
"license": "MIT",
"dependencies": {
"@project-serum/anchor": "^0.26.0",
"@project-serum/borsh": "^0.2.5",
"@solana/spl-token": "^0.3.6",
"@solana/web3.js": "^1.73.0",
"@switchboard-xyz/common": "^2.1.26",
"dotenv": "^16.0.3",
"lodash": "^4.17.21"
},
"devDependencies": {
"@types/chai": "^4.3.4",
"@types/expect": "^24.3.0",
"@types/lodash": "^4.14.191",
"@types/mocha": "^10.0.0",
"@types/node": "^18.11.18",
"anchor-client-gen": "^0.25.0",
"chai": "^4.3.7",
"chalk": "^4.1.2",
"gts": "^3.1.1",
"mocha": "^10.1.0",
"shelljs": "^0.8.5",
"shx": "^0.3.4",
"ts-mocha": "^10.0.0",
"ts-node": "^10.9.1",
"typedoc": "^0.23.23",
"typescript": "^4.9.4"
},
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@babel/runtime": { "node_modules/@babel/runtime": {
"version": "7.19.0", "version": "7.19.0",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.19.0.tgz", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.19.0.tgz",
@ -150,21 +185,6 @@
"resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz", "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz",
"integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ==" "integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ=="
}, },
"node_modules/@project-serum/borsh": {
"version": "0.2.5",
"resolved": "https://registry.npmjs.org/@project-serum/borsh/-/borsh-0.2.5.tgz",
"integrity": "sha1-YFkoeqYk7Ou/wO3TXkwo/5h9hmM= sha512-UmeUkUoKdQ7rhx6Leve1SssMR/Ghv8qrEiyywyxSWg7ooV7StdpPBhciiy5eB3T0qU1BXvdRNC8TdrkxK7WC5Q==",
"dependencies": {
"bn.js": "^5.1.2",
"buffer-layout": "^1.2.0"
},
"engines": {
"node": ">=10"
},
"peerDependencies": {
"@solana/web3.js": "^1.2.0"
}
},
"node_modules/@protobufjs/aspromise": { "node_modules/@protobufjs/aspromise": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
@ -230,46 +250,17 @@
"node": ">=5.10" "node": ">=5.10"
} }
}, },
"node_modules/@solana/buffer-layout-utils": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/@solana/buffer-layout-utils/-/buffer-layout-utils-0.2.0.tgz",
"integrity": "sha512-szG4sxgJGktbuZYDg2FfNmkMi0DYQoVjN2h7ta1W1hPrwzarcFLBq9UpX1UjNXsNpT9dn+chgprtWGioUAr4/g==",
"dependencies": {
"@solana/buffer-layout": "^4.0.0",
"@solana/web3.js": "^1.32.0",
"bigint-buffer": "^1.1.5",
"bignumber.js": "^9.0.1"
},
"engines": {
"node": ">= 10"
}
},
"node_modules/@solana/spl-token": {
"version": "0.3.6",
"resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.3.6.tgz",
"integrity": "sha512-P9pTXjDIRvVbjr3J0mCnSamYqLnICeds7IoH1/Ro2R9OBuOHdp5pqKZoscfZ3UYrgnCWUc1bc9M2m/YPHjw+1g==",
"dependencies": {
"@solana/buffer-layout": "^4.0.0",
"@solana/buffer-layout-utils": "^0.2.0",
"buffer": "^6.0.3"
},
"engines": {
"node": ">=16"
},
"peerDependencies": {
"@solana/web3.js": "^1.47.4"
}
},
"node_modules/@solana/web3.js": { "node_modules/@solana/web3.js": {
"version": "1.70.1", "version": "1.73.0",
"resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.70.1.tgz", "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.73.0.tgz",
"integrity": "sha512-AnaqCF1cJ3w7d0yhvLGAKAcRI+n5o+ursQihhoTe4cUh8/9d4gbT73SoHYElS7e67OtAgLmSfbcC5hcOAgdvnQ==", "integrity": "sha512-YrgX3Py7ylh8NYkbanoINUPCj//bWUjYZ5/WPy9nQ9SK3Cl7QWCR+NmbDjmC/fTspZGR+VO9LTQslM++jr5PRw==",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.12.5", "@babel/runtime": "^7.12.5",
"@noble/ed25519": "^1.7.0", "@noble/ed25519": "^1.7.0",
"@noble/hashes": "^1.1.2", "@noble/hashes": "^1.1.2",
"@noble/secp256k1": "^1.6.3", "@noble/secp256k1": "^1.6.3",
"@solana/buffer-layout": "^4.0.0", "@solana/buffer-layout": "^4.0.0",
"agentkeepalive": "^4.2.1",
"bigint-buffer": "^1.1.5", "bigint-buffer": "^1.1.5",
"bn.js": "^5.0.0", "bn.js": "^5.0.0",
"borsh": "^0.7.0", "borsh": "^0.7.0",
@ -309,10 +300,11 @@
} }
}, },
"node_modules/@switchboard-xyz/common": { "node_modules/@switchboard-xyz/common": {
"version": "2.1.8", "version": "2.1.26",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.8.tgz", "resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.26.tgz",
"integrity": "sha512-mqCDwCtBf3tY2Bvce0USR4m6DsXSqw8rn4luc2sjLL4PPFKCuCZVgzysfkwzwBHoipbnx6odRQ+BIfm35nhWDA==", "integrity": "sha512-uyyEhX/mRgfWqvXbin0pvTmVdJfK7e6w/cWUvA04e6jRzSVzSzh4ZEj+2Dh+8Dj3GlxqRTRiSA3Os8+h5eIa8Q==",
"dependencies": { "dependencies": {
"@solana/web3.js": "^1.66.2",
"big.js": "^6.2.1", "big.js": "^6.2.1",
"bn.js": "^5.2.1", "bn.js": "^5.2.1",
"decimal.js": "^10.4.3", "decimal.js": "^10.4.3",
@ -320,60 +312,8 @@
} }
}, },
"node_modules/@switchboard-xyz/solana.js": { "node_modules/@switchboard-xyz/solana.js": {
"version": "2.0.52", "resolved": "../../javascript/solana.js",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/solana.js/-/solana.js-2.0.52.tgz", "link": true
"integrity": "sha512-ppM64vBeR8DZ9RYeVi7mhG4OwwLvBOYAlitaa7v32/43Qlz7rHokdRkyQPYh50mr2rRiebVlpMINh6ZD6tWP6A==",
"dependencies": {
"@project-serum/anchor": "^0.25.0",
"@project-serum/borsh": "^0.2.5",
"@solana/spl-token": "^0.3.5",
"@solana/web3.js": "^1.66.1",
"@switchboard-xyz/common": "^2.1.8",
"big.js": "^6.2.1",
"bn.js": "^5.2.1"
},
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@switchboard-xyz/solana.js/node_modules/@project-serum/anchor": {
"version": "0.25.0",
"resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.25.0.tgz",
"integrity": "sha512-E6A5Y/ijqpfMJ5psJvbw0kVTzLZFUcOFgs6eSM2M2iWE1lVRF18T6hWZVNl6zqZsoz98jgnNHtVGJMs+ds9A7A==",
"dependencies": {
"@project-serum/borsh": "^0.2.5",
"@solana/web3.js": "^1.36.0",
"base64-js": "^1.5.1",
"bn.js": "^5.1.2",
"bs58": "^4.0.1",
"buffer-layout": "^1.2.2",
"camelcase": "^5.3.1",
"cross-fetch": "^3.1.5",
"crypto-hash": "^1.3.0",
"eventemitter3": "^4.0.7",
"js-sha256": "^0.9.0",
"pako": "^2.0.3",
"snake-case": "^3.0.4",
"superstruct": "^0.15.4",
"toml": "^3.0.0"
},
"engines": {
"node": ">=11"
}
},
"node_modules/@switchboard-xyz/solana.js/node_modules/camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
"engines": {
"node": ">=6"
}
},
"node_modules/@switchboard-xyz/solana.js/node_modules/superstruct": {
"version": "0.15.5",
"resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz",
"integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ=="
}, },
"node_modules/@tsconfig/node10": { "node_modules/@tsconfig/node10": {
"version": "1.0.9", "version": "1.0.9",
@ -464,6 +404,19 @@
"node": ">=0.4.0" "node": ">=0.4.0"
} }
}, },
"node_modules/agentkeepalive": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz",
"integrity": "sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA==",
"dependencies": {
"debug": "^4.1.0",
"depd": "^1.1.2",
"humanize-ms": "^1.2.1"
},
"engines": {
"node": ">= 8.0.0"
}
},
"node_modules/ansi-colors": { "node_modules/ansi-colors": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
@ -591,14 +544,6 @@
"node": ">= 10.0.0" "node": ">= 10.0.0"
} }
}, },
"node_modules/bignumber.js": {
"version": "9.1.1",
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz",
"integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==",
"engines": {
"node": "*"
}
},
"node_modules/binary-extensions": { "node_modules/binary-extensions": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
@ -875,6 +820,22 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"dependencies": {
"ms": "2.1.2"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/decamelize": { "node_modules/decamelize": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz",
@ -915,6 +876,14 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/depd": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
"integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/diff": { "node_modules/diff": {
"version": "5.0.0", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz",
@ -1130,6 +1099,14 @@
"he": "bin/he" "he": "bin/he"
} }
}, },
"node_modules/humanize-ms": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz",
"integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==",
"dependencies": {
"ms": "^2.0.0"
}
},
"node_modules/ieee754": { "node_modules/ieee754": {
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
@ -1524,6 +1501,11 @@
"integrity": "sha1-V0yBOM4dK1hh8LRFedut1gxmFbI= sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "integrity": "sha1-V0yBOM4dK1hh8LRFedut1gxmFbI= sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"dev": true "dev": true
}, },
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"node_modules/nanoid": { "node_modules/nanoid": {
"version": "3.3.1", "version": "3.3.1",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz",
@ -2365,15 +2347,6 @@
} }
} }
}, },
"@project-serum/borsh": {
"version": "0.2.5",
"resolved": "https://registry.npmjs.org/@project-serum/borsh/-/borsh-0.2.5.tgz",
"integrity": "sha1-YFkoeqYk7Ou/wO3TXkwo/5h9hmM= sha512-UmeUkUoKdQ7rhx6Leve1SssMR/Ghv8qrEiyywyxSWg7ooV7StdpPBhciiy5eB3T0qU1BXvdRNC8TdrkxK7WC5Q==",
"requires": {
"bn.js": "^5.1.2",
"buffer-layout": "^1.2.0"
}
},
"@protobufjs/aspromise": { "@protobufjs/aspromise": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
@ -2436,37 +2409,17 @@
"buffer": "~6.0.3" "buffer": "~6.0.3"
} }
}, },
"@solana/buffer-layout-utils": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/@solana/buffer-layout-utils/-/buffer-layout-utils-0.2.0.tgz",
"integrity": "sha512-szG4sxgJGktbuZYDg2FfNmkMi0DYQoVjN2h7ta1W1hPrwzarcFLBq9UpX1UjNXsNpT9dn+chgprtWGioUAr4/g==",
"requires": {
"@solana/buffer-layout": "^4.0.0",
"@solana/web3.js": "^1.32.0",
"bigint-buffer": "^1.1.5",
"bignumber.js": "^9.0.1"
}
},
"@solana/spl-token": {
"version": "0.3.6",
"resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.3.6.tgz",
"integrity": "sha512-P9pTXjDIRvVbjr3J0mCnSamYqLnICeds7IoH1/Ro2R9OBuOHdp5pqKZoscfZ3UYrgnCWUc1bc9M2m/YPHjw+1g==",
"requires": {
"@solana/buffer-layout": "^4.0.0",
"@solana/buffer-layout-utils": "^0.2.0",
"buffer": "^6.0.3"
}
},
"@solana/web3.js": { "@solana/web3.js": {
"version": "1.70.1", "version": "1.73.0",
"resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.70.1.tgz", "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.73.0.tgz",
"integrity": "sha512-AnaqCF1cJ3w7d0yhvLGAKAcRI+n5o+ursQihhoTe4cUh8/9d4gbT73SoHYElS7e67OtAgLmSfbcC5hcOAgdvnQ==", "integrity": "sha512-YrgX3Py7ylh8NYkbanoINUPCj//bWUjYZ5/WPy9nQ9SK3Cl7QWCR+NmbDjmC/fTspZGR+VO9LTQslM++jr5PRw==",
"requires": { "requires": {
"@babel/runtime": "^7.12.5", "@babel/runtime": "^7.12.5",
"@noble/ed25519": "^1.7.0", "@noble/ed25519": "^1.7.0",
"@noble/hashes": "^1.1.2", "@noble/hashes": "^1.1.2",
"@noble/secp256k1": "^1.6.3", "@noble/secp256k1": "^1.6.3",
"@solana/buffer-layout": "^4.0.0", "@solana/buffer-layout": "^4.0.0",
"agentkeepalive": "^4.2.1",
"bigint-buffer": "^1.1.5", "bigint-buffer": "^1.1.5",
"bn.js": "^5.0.0", "bn.js": "^5.0.0",
"borsh": "^0.7.0", "borsh": "^0.7.0",
@ -2491,10 +2444,11 @@
} }
}, },
"@switchboard-xyz/common": { "@switchboard-xyz/common": {
"version": "2.1.8", "version": "2.1.26",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.8.tgz", "resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.26.tgz",
"integrity": "sha512-mqCDwCtBf3tY2Bvce0USR4m6DsXSqw8rn4luc2sjLL4PPFKCuCZVgzysfkwzwBHoipbnx6odRQ+BIfm35nhWDA==", "integrity": "sha512-uyyEhX/mRgfWqvXbin0pvTmVdJfK7e6w/cWUvA04e6jRzSVzSzh4ZEj+2Dh+8Dj3GlxqRTRiSA3Os8+h5eIa8Q==",
"requires": { "requires": {
"@solana/web3.js": "^1.66.2",
"big.js": "^6.2.1", "big.js": "^6.2.1",
"bn.js": "^5.2.1", "bn.js": "^5.2.1",
"decimal.js": "^10.4.3", "decimal.js": "^10.4.3",
@ -2502,51 +2456,31 @@
} }
}, },
"@switchboard-xyz/solana.js": { "@switchboard-xyz/solana.js": {
"version": "2.0.52", "version": "file:../../javascript/solana.js",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/solana.js/-/solana.js-2.0.52.tgz",
"integrity": "sha512-ppM64vBeR8DZ9RYeVi7mhG4OwwLvBOYAlitaa7v32/43Qlz7rHokdRkyQPYh50mr2rRiebVlpMINh6ZD6tWP6A==",
"requires": { "requires": {
"@project-serum/anchor": "^0.25.0", "@project-serum/anchor": "^0.26.0",
"@project-serum/borsh": "^0.2.5", "@project-serum/borsh": "^0.2.5",
"@solana/spl-token": "^0.3.5", "@solana/spl-token": "^0.3.6",
"@solana/web3.js": "^1.66.1", "@solana/web3.js": "^1.73.0",
"@switchboard-xyz/common": "^2.1.8", "@switchboard-xyz/common": "^2.1.26",
"big.js": "^6.2.1", "@types/chai": "^4.3.4",
"bn.js": "^5.2.1" "@types/expect": "^24.3.0",
}, "@types/lodash": "^4.14.191",
"dependencies": { "@types/mocha": "^10.0.0",
"@project-serum/anchor": { "@types/node": "^18.11.18",
"version": "0.25.0", "anchor-client-gen": "^0.25.0",
"resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.25.0.tgz", "chai": "^4.3.7",
"integrity": "sha512-E6A5Y/ijqpfMJ5psJvbw0kVTzLZFUcOFgs6eSM2M2iWE1lVRF18T6hWZVNl6zqZsoz98jgnNHtVGJMs+ds9A7A==", "chalk": "^4.1.2",
"requires": { "dotenv": "^16.0.3",
"@project-serum/borsh": "^0.2.5", "gts": "^3.1.1",
"@solana/web3.js": "^1.36.0", "lodash": "^4.17.21",
"base64-js": "^1.5.1", "mocha": "^10.1.0",
"bn.js": "^5.1.2", "shelljs": "^0.8.5",
"bs58": "^4.0.1", "shx": "^0.3.4",
"buffer-layout": "^1.2.2", "ts-mocha": "^10.0.0",
"camelcase": "^5.3.1", "ts-node": "^10.9.1",
"cross-fetch": "^3.1.5", "typedoc": "^0.23.23",
"crypto-hash": "^1.3.0", "typescript": "^4.9.4"
"eventemitter3": "^4.0.7",
"js-sha256": "^0.9.0",
"pako": "^2.0.3",
"snake-case": "^3.0.4",
"superstruct": "^0.15.4",
"toml": "^3.0.0"
}
},
"camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
},
"superstruct": {
"version": "0.15.5",
"resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz",
"integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ=="
}
} }
}, },
"@tsconfig/node10": { "@tsconfig/node10": {
@ -2639,6 +2573,16 @@
"integrity": "sha1-dBIQ8uJCZFRQiFOi9E0KuDt/acE= sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", "integrity": "sha1-dBIQ8uJCZFRQiFOi9E0KuDt/acE= sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
"dev": true "dev": true
}, },
"agentkeepalive": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz",
"integrity": "sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA==",
"requires": {
"debug": "^4.1.0",
"depd": "^1.1.2",
"humanize-ms": "^1.2.1"
}
},
"ansi-colors": { "ansi-colors": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
@ -2720,11 +2664,6 @@
"bindings": "^1.3.0" "bindings": "^1.3.0"
} }
}, },
"bignumber.js": {
"version": "9.1.1",
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz",
"integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig=="
},
"binary-extensions": { "binary-extensions": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
@ -2935,6 +2874,14 @@
"resolved": "https://registry.npmjs.org/crypto-hash/-/crypto-hash-1.3.0.tgz", "resolved": "https://registry.npmjs.org/crypto-hash/-/crypto-hash-1.3.0.tgz",
"integrity": "sha1-tALLCPRSnp9PCTRsPidZQvhF4kc= sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg==" "integrity": "sha1-tALLCPRSnp9PCTRsPidZQvhF4kc= sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg=="
}, },
"debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"requires": {
"ms": "2.1.2"
}
},
"decamelize": { "decamelize": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz",
@ -2960,6 +2907,11 @@
"resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz",
"integrity": "sha1-E3BF7xuW5QcQYN1b5gv5M0Q2vR0= sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==" "integrity": "sha1-E3BF7xuW5QcQYN1b5gv5M0Q2vR0= sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw=="
}, },
"depd": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
"integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ=="
},
"diff": { "diff": {
"version": "5.0.0", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz",
@ -3117,6 +3069,14 @@
"integrity": "sha1-hK5l+n6vsWX922FWauFLrwVmTw8= sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "integrity": "sha1-hK5l+n6vsWX922FWauFLrwVmTw8= sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
"dev": true "dev": true
}, },
"humanize-ms": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz",
"integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==",
"requires": {
"ms": "^2.0.0"
}
},
"ieee754": { "ieee754": {
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
@ -3416,6 +3376,11 @@
} }
} }
}, },
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"nanoid": { "nanoid": {
"version": "3.3.1", "version": "3.3.1",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz",

View File

@ -14,8 +14,8 @@
"dependencies": { "dependencies": {
"@project-serum/anchor": "^0.26.0", "@project-serum/anchor": "^0.26.0",
"@solana/web3.js": "^1.70.1", "@solana/web3.js": "^1.70.1",
"@switchboard-xyz/common": "^2.1.8", "@switchboard-xyz/common": "^2.1.26",
"@switchboard-xyz/solana.js": "^2.0.52" "@switchboard-xyz/solana.js": "file:../../javascript/solana.js"
}, },
"devDependencies": { "devDependencies": {
"@types/chai": "^4.3.0", "@types/chai": "^4.3.0",

View File

@ -0,0 +1,123 @@
import * as anchor from "@project-serum/anchor";
import { PublicKey } from "@solana/web3.js";
import { OracleJob, sleep } from "@switchboard-xyz/common";
import {
AggregatorAccount,
SwitchboardTestContextV2,
} from "@switchboard-xyz/solana.js";
import assert from "assert";
import chai from "chai";
import { AnchorFeedParser } from "../target/types/anchor_feed_parser";
const expect = chai.expect;
// Anchor.toml will copy this to localnet when we start our tests
const DEFAULT_SOL_USD_FEED = new PublicKey(
"GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR"
);
describe("anchor-feed-parser test", () => {
const provider = anchor.AnchorProvider.env();
anchor.setProvider(provider);
const feedParserProgram = anchor.workspace
.AnchorFeedParser as anchor.Program<AnchorFeedParser>;
// const feedParserProgram = new anchor.Program(
// IDL,
// PROGRAM_ID,
// provider,
// new anchor.BorshCoder(IDL)
// ) as anchor.Program<AnchorFeedParser>;
let switchboard: SwitchboardTestContextV2;
before(async () => {
switchboard = await SwitchboardTestContextV2.loadFromProvider(provider, {
// You can provide a keypair to so the PDA schemes dont change between test runs
name: "Test Queue",
// keypair: Keypair.generate(),
queueSize: 10,
reward: 0,
minStake: 0,
oracleTimeout: 900,
unpermissionedFeeds: true,
unpermissionedVrf: true,
enableBufferRelayers: true,
oracle: {
name: "Test Oracle",
enable: true,
// stakingWalletKeypair: Keypair.generate(),
},
});
await switchboard.start("dev-v2-RC_01_17_23_16_22", undefined);
});
after(async () => {
if (switchboard) {
switchboard.stop();
}
});
it("Read SOL/USD Feed", async () => {
const signature = await feedParserProgram.methods
.readResult({ maxConfidenceInterval: null })
.accounts({ aggregator: DEFAULT_SOL_USD_FEED })
.rpc();
// wait for RPC
await sleep(2000);
const logs = await provider.connection.getParsedTransaction(
signature,
"confirmed"
);
console.log(JSON.stringify(logs?.meta?.logMessages, undefined, 2));
});
it("Fails to read feed if confidence interval is exceeded", async () => {
await assert.rejects(
async () => {
await feedParserProgram.methods
.readResult({ maxConfidenceInterval: 0.0000000001 })
.accounts({ aggregator: DEFAULT_SOL_USD_FEED })
.rpc();
},
new RegExp(/ConfidenceIntervalExceeded/g),
"Confidence interval was not exceeded"
);
});
it("Creates a static feed that resolves to 100", async () => {
const [myAggregatorAccount] = await switchboard.queue.createFeed({
batchSize: 1,
minRequiredOracleResults: 1,
minRequiredJobResults: 1,
minUpdateDelaySeconds: 10,
fundAmount: 0.15,
enable: true,
slidingWindow: true,
jobs: [
{
weight: 2,
data: OracleJob.encodeDelimited(
OracleJob.fromObject({
tasks: [
{
valueTask: {
value: 100,
},
},
],
})
).finish(),
},
],
});
const aggregator = await myAggregatorAccount.loadData();
const [updatedState] = await myAggregatorAccount.openRoundAndAwaitResult();
const result = AggregatorAccount.decodeLatestValue(updatedState);
assert(result.toNumber() === 100, "Aggregator result mismatch");
});
});

View File

@ -1,97 +0,0 @@
import * as anchor from "@project-serum/anchor";
import { PublicKey } from "@solana/web3.js";
import chai from "chai";
import { sleep } from "@switchboard-xyz/common";
import {
AnchorWallet,
SwitchboardTestContext,
} from "@switchboard-xyz/solana.js";
import { PROGRAM_ID } from "../client/programId";
import { AnchorFeedParser, IDL } from "../target/types/anchor_feed_parser";
const expect = chai.expect;
// Anchor.toml will copy this to localnet when we start our tests
const DEFAULT_SOL_USD_FEED = new PublicKey(
"GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR"
);
describe("anchor-feed-parser test", () => {
const provider = anchor.AnchorProvider.env();
anchor.setProvider(provider);
// const feedParserProgram = anchor.workspace
// .AnchorFeedParser as Program<AnchorFeedParser>;
const feedParserProgram = new anchor.Program(
IDL,
PROGRAM_ID,
provider,
new anchor.BorshCoder(IDL)
) as anchor.Program<AnchorFeedParser>;
const payer = (provider.wallet as AnchorWallet).payer;
let switchboard: SwitchboardTestContext;
let aggregatorKey: PublicKey;
console.log(
`devnet tests rpc: ${feedParserProgram.provider.connection.rpcEndpoint}`
);
before(async () => {
try {
switchboard = await SwitchboardTestContext.loadDevnetQueue(
provider,
"F8ce7MsckeZAbAGmxjJNetxYXQa9mKr9nnrC3qKubyYy"
);
aggregatorKey = DEFAULT_SOL_USD_FEED;
console.log("devnet detected");
return;
} catch (error: any) {
console.log(`Error: SBV2 Devnet - ${error.message}`);
}
// If fails, throw error
throw new Error(`Failed to load the SwitchboardTestContext from devnet`);
});
it("Read SOL/USD Feed", async () => {
const signature = await feedParserProgram.methods
.readResult({ maxConfidenceInterval: null })
.accounts({ aggregator: aggregatorKey })
.rpc();
// wait for RPC
await sleep(2000);
const logs = await provider.connection.getParsedTransaction(
signature,
"confirmed"
);
console.log(JSON.stringify(logs?.meta?.logMessages, undefined, 2));
});
it("Fails to read feed if confidence interval is exceeded", async () => {
// await assert.rejects(
// async () => {
// await feedParserProgram.methods
// .readResult({ maxConfidenceInterval: 0.0000000001 })
// .accounts({ aggregator: aggregatorKey })
// .rpc();
// },
// /ConfidenceIntervalExceeded/,
// "Confidence interval was not exceeded"
// );
try {
await feedParserProgram.methods
.readResult({ maxConfidenceInterval: 0.0000000001 })
.accounts({ aggregator: aggregatorKey })
.rpc();
} catch (error: any) {
if (!error.toString().includes("ConfidenceIntervalExceeded")) {
throw error;
}
}
});
});

View File

@ -1,108 +0,0 @@
import * as anchor from "@project-serum/anchor";
import { Connection } from "@solana/web3.js";
import { sleep } from "@switchboard-xyz/common";
import {
AggregatorAccount,
SwitchboardTestContext,
} from "@switchboard-xyz/solana.js";
import chai from "chai";
import { PROGRAM_ID } from "../client/programId";
import { AnchorFeedParser, IDL } from "../target/types/anchor_feed_parser";
const expect = chai.expect;
describe("anchor-feed-parser localnet test", () => {
const tomlProvider = anchor.AnchorProvider.env();
const provider = new anchor.AnchorProvider(
new Connection("http://localhost:8899"),
tomlProvider.wallet,
{}
);
anchor.setProvider(provider);
// const feedParserProgram = anchor.workspace
// .AnchorFeedParser as Program<AnchorFeedParser>;
const feedParserProgram = new anchor.Program(
IDL,
PROGRAM_ID,
provider
) as anchor.Program<AnchorFeedParser>;
let switchboard: SwitchboardTestContext;
let aggregatorAccount: AggregatorAccount;
before(async () => {
switchboard = await SwitchboardTestContext.loadFromEnv(provider);
});
it("Creates a static feed that resolves to 100", async () => {
[aggregatorAccount] = await switchboard.createStaticFeed(100);
console.log(`Created Feed: ${aggregatorAccount.publicKey}`);
});
it("Reads the static feed", async () => {
if (!aggregatorAccount) {
throw new Error(`No aggregatorAccount to read`);
}
const signature = await feedParserProgram.methods
.readResult({ maxConfidenceInterval: 0.25 })
.accounts({ aggregator: aggregatorAccount.publicKey })
.rpc();
// wait for RPC
await sleep(2000);
const logs = await provider.connection.getParsedTransaction(
signature,
"confirmed"
);
// TODO: grep logs and verify the price
console.log(JSON.stringify(logs?.meta?.logMessages, undefined, 2));
});
it("Fails to read feed if confidence interval is exceeded", async () => {
if (!aggregatorAccount) {
throw new Error(`No aggregatorAccount to read`);
}
try {
await feedParserProgram.methods
.readResult({ maxConfidenceInterval: 0.0000000001 })
.accounts({ aggregator: aggregatorAccount.publicKey })
.rpc();
} catch (error: any) {
if (!error.toString().includes("ConfidenceIntervalExceeded")) {
throw error;
}
}
});
it("Updates static feed to resolve to 110", async () => {
if (!aggregatorAccount) {
throw new Error(`No aggregatorAccount to read`);
}
await switchboard.updateStaticFeed(aggregatorAccount, 110, 45);
const signature = await feedParserProgram.methods
.readResult({ maxConfidenceInterval: 0.25 })
.accounts({ aggregator: aggregatorAccount.publicKey })
.rpc();
// wait for RPC
await sleep(2000);
const logs = await provider.connection.getParsedTransaction(
signature,
"confirmed"
);
// TODO: grep logs and verify the price
console.log(JSON.stringify(logs?.meta?.logMessages, undefined, 2));
});
});

View File

@ -7,6 +7,8 @@ members = [
seeds = false seeds = false
[programs.localnet] [programs.localnet]
anchor_history_parser = "C7rn1qJkq9FjTwV86RrY5Uih91NgymRVLdJ81rqLNXRS" anchor_history_parser = "C7rn1qJkq9FjTwV86RrY5Uih91NgymRVLdJ81rqLNXRS"
[programs.devnet]
anchor_history_parser = "C7rn1qJkq9FjTwV86RrY5Uih91NgymRVLdJ81rqLNXRS"
[registry] [registry]
url = "https://anchor.projectserum.com" url = "https://anchor.projectserum.com"
@ -21,10 +23,25 @@ wallet = "~/.config/solana/id.json"
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.test.ts" test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.test.ts"
[test.validator] [test.validator]
url="https://api.devnet.solana.com" url = "https://api.devnet.solana.com"
[[test.validator.clone]] [test]
address="GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR" # sbv2 SOL/USD Feed startup_wait = 15000
[[test.validator.clone]] [[test.validator.clone]] # sbv2 devnet programID
address="7LLvRhMs73FqcLkA8jvEE1AM2mYZXTmqfUv8GAEurymx" # sbv2 SOL/USD History Buffer address = "2TfB33aLaneQb5TNVwyDz3jSZXS6jdW2ARw1Dgf84XCG"
[[test.validator.clone]] # sbv2 devnet IDL
address = "CKwZcshn4XDvhaWVH9EXnk3iu19t6t5xP2Sy2pD6TRDp"
[[test.validator.clone]] # sbv2 devnet SbState
address = "BYM81n8HvTJuqZU1PmTVcwZ9G8uoji7FKM6EaPkwphPt"
[[test.validator.clone]] # sbv2 devnet tokenVault
address = "FVLfR6C2ckZhbSwBzZY4CX7YBcddUSge5BNeGQv5eKhy"
[[test.validator.clone]] # sbv2 SOL/USD Feed
address="GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR"
[[test.validator.clone]] # sbv2 SOL/USD History Buffer
address="7LLvRhMs73FqcLkA8jvEE1AM2mYZXTmqfUv8GAEurymx"

View File

@ -21,6 +21,6 @@ overflow-checks = true
[dependencies] [dependencies]
switchboard-v2 = { path = "../../rust/switchboard-v2" } switchboard-v2 = { path = "../../rust/switchboard-v2" }
# switchboard-v2 = { version = "^0.1.17" } # switchboard-v2 = { version = "^0.1.20" }
anchor-lang = "^0.26.0" anchor-lang = "^0.26.0"
solana-program = "^1.13.6" solana-program = "^1.13.6"

View File

@ -6,8 +6,8 @@
"": { "": {
"dependencies": { "dependencies": {
"@project-serum/anchor": "^0.26.0", "@project-serum/anchor": "^0.26.0",
"@switchboard-xyz/common": "^2.1.8", "@switchboard-xyz/common": "^2.1.26",
"@switchboard-xyz/solana.js": "^2.0.52" "@switchboard-xyz/solana.js": "file:../../javascript/solana.js"
}, },
"devDependencies": { "devDependencies": {
"@types/bn.js": "^5.1.0", "@types/bn.js": "^5.1.0",
@ -20,6 +20,42 @@
"typescript": "^4.3.5" "typescript": "^4.3.5"
} }
}, },
"../../javascript/solana.js": {
"name": "@switchboard-xyz/solana.js",
"version": "2.0.112",
"license": "MIT",
"dependencies": {
"@project-serum/anchor": "^0.26.0",
"@project-serum/borsh": "^0.2.5",
"@solana/spl-token": "^0.3.6",
"@solana/web3.js": "^1.73.0",
"@switchboard-xyz/common": "^2.1.26",
"dotenv": "^16.0.3",
"lodash": "^4.17.21"
},
"devDependencies": {
"@types/chai": "^4.3.4",
"@types/expect": "^24.3.0",
"@types/lodash": "^4.14.191",
"@types/mocha": "^10.0.0",
"@types/node": "^18.11.18",
"anchor-client-gen": "^0.25.0",
"chai": "^4.3.7",
"chalk": "^4.1.2",
"gts": "^3.1.1",
"mocha": "^10.1.0",
"shelljs": "^0.8.5",
"shx": "^0.3.4",
"ts-mocha": "^10.0.0",
"ts-node": "^10.9.1",
"typedoc": "^0.23.23",
"typescript": "^4.9.4"
},
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@babel/runtime": { "node_modules/@babel/runtime": {
"version": "7.19.4", "version": "7.19.4",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.19.4.tgz", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.19.4.tgz",
@ -109,21 +145,6 @@
"resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz", "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz",
"integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ==" "integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ=="
}, },
"node_modules/@project-serum/borsh": {
"version": "0.2.5",
"resolved": "https://registry.npmjs.org/@project-serum/borsh/-/borsh-0.2.5.tgz",
"integrity": "sha1-YFkoeqYk7Ou/wO3TXkwo/5h9hmM= sha512-UmeUkUoKdQ7rhx6Leve1SssMR/Ghv8qrEiyywyxSWg7ooV7StdpPBhciiy5eB3T0qU1BXvdRNC8TdrkxK7WC5Q==",
"dependencies": {
"bn.js": "^5.1.2",
"buffer-layout": "^1.2.0"
},
"engines": {
"node": ">=10"
},
"peerDependencies": {
"@solana/web3.js": "^1.2.0"
}
},
"node_modules/@protobufjs/aspromise": { "node_modules/@protobufjs/aspromise": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
@ -189,20 +210,6 @@
"node": ">=5.10" "node": ">=5.10"
} }
}, },
"node_modules/@solana/buffer-layout-utils": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/@solana/buffer-layout-utils/-/buffer-layout-utils-0.2.0.tgz",
"integrity": "sha512-szG4sxgJGktbuZYDg2FfNmkMi0DYQoVjN2h7ta1W1hPrwzarcFLBq9UpX1UjNXsNpT9dn+chgprtWGioUAr4/g==",
"dependencies": {
"@solana/buffer-layout": "^4.0.0",
"@solana/web3.js": "^1.32.0",
"bigint-buffer": "^1.1.5",
"bignumber.js": "^9.0.1"
},
"engines": {
"node": ">= 10"
}
},
"node_modules/@solana/buffer-layout/node_modules/buffer": { "node_modules/@solana/buffer-layout/node_modules/buffer": {
"version": "6.0.3", "version": "6.0.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
@ -226,45 +233,6 @@
"ieee754": "^1.2.1" "ieee754": "^1.2.1"
} }
}, },
"node_modules/@solana/spl-token": {
"version": "0.3.6",
"resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.3.6.tgz",
"integrity": "sha512-P9pTXjDIRvVbjr3J0mCnSamYqLnICeds7IoH1/Ro2R9OBuOHdp5pqKZoscfZ3UYrgnCWUc1bc9M2m/YPHjw+1g==",
"dependencies": {
"@solana/buffer-layout": "^4.0.0",
"@solana/buffer-layout-utils": "^0.2.0",
"buffer": "^6.0.3"
},
"engines": {
"node": ">=16"
},
"peerDependencies": {
"@solana/web3.js": "^1.47.4"
}
},
"node_modules/@solana/spl-token/node_modules/buffer": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
"integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"dependencies": {
"base64-js": "^1.3.1",
"ieee754": "^1.2.1"
}
},
"node_modules/@solana/web3.js": { "node_modules/@solana/web3.js": {
"version": "1.70.1", "version": "1.70.1",
"resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.70.1.tgz", "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.70.1.tgz",
@ -291,10 +259,11 @@
} }
}, },
"node_modules/@switchboard-xyz/common": { "node_modules/@switchboard-xyz/common": {
"version": "2.1.8", "version": "2.1.26",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.8.tgz", "resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.26.tgz",
"integrity": "sha512-mqCDwCtBf3tY2Bvce0USR4m6DsXSqw8rn4luc2sjLL4PPFKCuCZVgzysfkwzwBHoipbnx6odRQ+BIfm35nhWDA==", "integrity": "sha512-uyyEhX/mRgfWqvXbin0pvTmVdJfK7e6w/cWUvA04e6jRzSVzSzh4ZEj+2Dh+8Dj3GlxqRTRiSA3Os8+h5eIa8Q==",
"dependencies": { "dependencies": {
"@solana/web3.js": "^1.66.2",
"big.js": "^6.2.1", "big.js": "^6.2.1",
"bn.js": "^5.2.1", "bn.js": "^5.2.1",
"decimal.js": "^10.4.3", "decimal.js": "^10.4.3",
@ -302,60 +271,8 @@
} }
}, },
"node_modules/@switchboard-xyz/solana.js": { "node_modules/@switchboard-xyz/solana.js": {
"version": "2.0.52", "resolved": "../../javascript/solana.js",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/solana.js/-/solana.js-2.0.52.tgz", "link": true
"integrity": "sha512-ppM64vBeR8DZ9RYeVi7mhG4OwwLvBOYAlitaa7v32/43Qlz7rHokdRkyQPYh50mr2rRiebVlpMINh6ZD6tWP6A==",
"dependencies": {
"@project-serum/anchor": "^0.25.0",
"@project-serum/borsh": "^0.2.5",
"@solana/spl-token": "^0.3.5",
"@solana/web3.js": "^1.66.1",
"@switchboard-xyz/common": "^2.1.8",
"big.js": "^6.2.1",
"bn.js": "^5.2.1"
},
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@switchboard-xyz/solana.js/node_modules/@project-serum/anchor": {
"version": "0.25.0",
"resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.25.0.tgz",
"integrity": "sha512-E6A5Y/ijqpfMJ5psJvbw0kVTzLZFUcOFgs6eSM2M2iWE1lVRF18T6hWZVNl6zqZsoz98jgnNHtVGJMs+ds9A7A==",
"dependencies": {
"@project-serum/borsh": "^0.2.5",
"@solana/web3.js": "^1.36.0",
"base64-js": "^1.5.1",
"bn.js": "^5.1.2",
"bs58": "^4.0.1",
"buffer-layout": "^1.2.2",
"camelcase": "^5.3.1",
"cross-fetch": "^3.1.5",
"crypto-hash": "^1.3.0",
"eventemitter3": "^4.0.7",
"js-sha256": "^0.9.0",
"pako": "^2.0.3",
"snake-case": "^3.0.4",
"superstruct": "^0.15.4",
"toml": "^3.0.0"
},
"engines": {
"node": ">=11"
}
},
"node_modules/@switchboard-xyz/solana.js/node_modules/camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
"engines": {
"node": ">=6"
}
},
"node_modules/@switchboard-xyz/solana.js/node_modules/superstruct": {
"version": "0.15.5",
"resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz",
"integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ=="
}, },
"node_modules/@types/bn.js": { "node_modules/@types/bn.js": {
"version": "5.1.1", "version": "5.1.1",
@ -533,14 +450,6 @@
"node": ">= 10.0.0" "node": ">= 10.0.0"
} }
}, },
"node_modules/bignumber.js": {
"version": "9.1.1",
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz",
"integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==",
"engines": {
"node": "*"
}
},
"node_modules/binary-extensions": { "node_modules/binary-extensions": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
@ -2209,15 +2118,6 @@
} }
} }
}, },
"@project-serum/borsh": {
"version": "0.2.5",
"resolved": "https://registry.npmjs.org/@project-serum/borsh/-/borsh-0.2.5.tgz",
"integrity": "sha1-YFkoeqYk7Ou/wO3TXkwo/5h9hmM= sha512-UmeUkUoKdQ7rhx6Leve1SssMR/Ghv8qrEiyywyxSWg7ooV7StdpPBhciiy5eB3T0qU1BXvdRNC8TdrkxK7WC5Q==",
"requires": {
"bn.js": "^5.1.2",
"buffer-layout": "^1.2.0"
}
},
"@protobufjs/aspromise": { "@protobufjs/aspromise": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
@ -2291,38 +2191,6 @@
} }
} }
}, },
"@solana/buffer-layout-utils": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/@solana/buffer-layout-utils/-/buffer-layout-utils-0.2.0.tgz",
"integrity": "sha512-szG4sxgJGktbuZYDg2FfNmkMi0DYQoVjN2h7ta1W1hPrwzarcFLBq9UpX1UjNXsNpT9dn+chgprtWGioUAr4/g==",
"requires": {
"@solana/buffer-layout": "^4.0.0",
"@solana/web3.js": "^1.32.0",
"bigint-buffer": "^1.1.5",
"bignumber.js": "^9.0.1"
}
},
"@solana/spl-token": {
"version": "0.3.6",
"resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.3.6.tgz",
"integrity": "sha512-P9pTXjDIRvVbjr3J0mCnSamYqLnICeds7IoH1/Ro2R9OBuOHdp5pqKZoscfZ3UYrgnCWUc1bc9M2m/YPHjw+1g==",
"requires": {
"@solana/buffer-layout": "^4.0.0",
"@solana/buffer-layout-utils": "^0.2.0",
"buffer": "^6.0.3"
},
"dependencies": {
"buffer": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
"integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
"requires": {
"base64-js": "^1.3.1",
"ieee754": "^1.2.1"
}
}
}
},
"@solana/web3.js": { "@solana/web3.js": {
"version": "1.70.1", "version": "1.70.1",
"resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.70.1.tgz", "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.70.1.tgz",
@ -2346,10 +2214,11 @@
} }
}, },
"@switchboard-xyz/common": { "@switchboard-xyz/common": {
"version": "2.1.8", "version": "2.1.26",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.8.tgz", "resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.26.tgz",
"integrity": "sha512-mqCDwCtBf3tY2Bvce0USR4m6DsXSqw8rn4luc2sjLL4PPFKCuCZVgzysfkwzwBHoipbnx6odRQ+BIfm35nhWDA==", "integrity": "sha512-uyyEhX/mRgfWqvXbin0pvTmVdJfK7e6w/cWUvA04e6jRzSVzSzh4ZEj+2Dh+8Dj3GlxqRTRiSA3Os8+h5eIa8Q==",
"requires": { "requires": {
"@solana/web3.js": "^1.66.2",
"big.js": "^6.2.1", "big.js": "^6.2.1",
"bn.js": "^5.2.1", "bn.js": "^5.2.1",
"decimal.js": "^10.4.3", "decimal.js": "^10.4.3",
@ -2357,51 +2226,31 @@
} }
}, },
"@switchboard-xyz/solana.js": { "@switchboard-xyz/solana.js": {
"version": "2.0.52", "version": "file:../../javascript/solana.js",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/solana.js/-/solana.js-2.0.52.tgz",
"integrity": "sha512-ppM64vBeR8DZ9RYeVi7mhG4OwwLvBOYAlitaa7v32/43Qlz7rHokdRkyQPYh50mr2rRiebVlpMINh6ZD6tWP6A==",
"requires": { "requires": {
"@project-serum/anchor": "^0.25.0", "@project-serum/anchor": "^0.26.0",
"@project-serum/borsh": "^0.2.5", "@project-serum/borsh": "^0.2.5",
"@solana/spl-token": "^0.3.5", "@solana/spl-token": "^0.3.6",
"@solana/web3.js": "^1.66.1", "@solana/web3.js": "^1.73.0",
"@switchboard-xyz/common": "^2.1.8", "@switchboard-xyz/common": "^2.1.26",
"big.js": "^6.2.1", "@types/chai": "^4.3.4",
"bn.js": "^5.2.1" "@types/expect": "^24.3.0",
}, "@types/lodash": "^4.14.191",
"dependencies": { "@types/mocha": "^10.0.0",
"@project-serum/anchor": { "@types/node": "^18.11.18",
"version": "0.25.0", "anchor-client-gen": "^0.25.0",
"resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.25.0.tgz", "chai": "^4.3.7",
"integrity": "sha512-E6A5Y/ijqpfMJ5psJvbw0kVTzLZFUcOFgs6eSM2M2iWE1lVRF18T6hWZVNl6zqZsoz98jgnNHtVGJMs+ds9A7A==", "chalk": "^4.1.2",
"requires": { "dotenv": "^16.0.3",
"@project-serum/borsh": "^0.2.5", "gts": "^3.1.1",
"@solana/web3.js": "^1.36.0", "lodash": "^4.17.21",
"base64-js": "^1.5.1", "mocha": "^10.1.0",
"bn.js": "^5.1.2", "shelljs": "^0.8.5",
"bs58": "^4.0.1", "shx": "^0.3.4",
"buffer-layout": "^1.2.2", "ts-mocha": "^10.0.0",
"camelcase": "^5.3.1", "ts-node": "^10.9.1",
"cross-fetch": "^3.1.5", "typedoc": "^0.23.23",
"crypto-hash": "^1.3.0", "typescript": "^4.9.4"
"eventemitter3": "^4.0.7",
"js-sha256": "^0.9.0",
"pako": "^2.0.3",
"snake-case": "^3.0.4",
"superstruct": "^0.15.4",
"toml": "^3.0.0"
}
},
"camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
},
"superstruct": {
"version": "0.15.5",
"resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz",
"integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ=="
}
} }
}, },
"@types/bn.js": { "@types/bn.js": {
@ -2534,11 +2383,6 @@
"bindings": "^1.3.0" "bindings": "^1.3.0"
} }
}, },
"bignumber.js": {
"version": "9.1.1",
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz",
"integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig=="
},
"binary-extensions": { "binary-extensions": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",

View File

@ -5,8 +5,8 @@
}, },
"dependencies": { "dependencies": {
"@project-serum/anchor": "^0.26.0", "@project-serum/anchor": "^0.26.0",
"@switchboard-xyz/common": "^2.1.8", "@switchboard-xyz/common": "^2.1.26",
"@switchboard-xyz/solana.js": "^2.0.52" "@switchboard-xyz/solana.js": "file:../../javascript/solana.js"
}, },
"devDependencies": { "devDependencies": {
"@types/bn.js": "^5.1.0", "@types/bn.js": "^5.1.0",

View File

@ -4,8 +4,7 @@ import { Program } from "@project-serum/anchor";
import { OracleJob } from "@switchboard-xyz/common"; import { OracleJob } from "@switchboard-xyz/common";
import { import {
AggregatorAccount, AggregatorAccount,
JobAccount, SwitchboardTestContextV2,
SwitchboardTestContext,
} from "@switchboard-xyz/solana.js"; } from "@switchboard-xyz/solana.js";
import { AnchorHistoryParser } from "../target/types/anchor_history_parser"; import { AnchorHistoryParser } from "../target/types/anchor_history_parser";
@ -20,7 +19,8 @@ export const sleep = (ms: number): Promise<any> =>
describe("anchor-history-parser", () => { describe("anchor-history-parser", () => {
// Configure the client to use the local cluster. // Configure the client to use the local cluster.
anchor.setProvider(anchor.AnchorProvider.env()); const provider = anchor.AnchorProvider.env();
anchor.setProvider(provider);
const program = anchor.workspace const program = anchor.workspace
.AnchorHistoryParser as Program<AnchorHistoryParser>; .AnchorHistoryParser as Program<AnchorHistoryParser>;
@ -28,21 +28,33 @@ describe("anchor-history-parser", () => {
let aggregatorAccount: AggregatorAccount; let aggregatorAccount: AggregatorAccount;
let historyBuffer: anchor.web3.PublicKey; let historyBuffer: anchor.web3.PublicKey;
let switchboard: SwitchboardTestContext; let switchboard: SwitchboardTestContextV2;
before(async () => { before(async () => {
try { switchboard = await SwitchboardTestContextV2.loadFromProvider(provider, {
switchboard = await SwitchboardTestContext.loadDevnetQueue( // You can provide a keypair to so the PDA schemes dont change between test runs
program.provider as anchor.AnchorProvider, name: "Test Queue",
"F8ce7MsckeZAbAGmxjJNetxYXQa9mKr9nnrC3qKubyYy" // keypair: Keypair.generate(),
); queueSize: 10,
console.log("devnet detected"); reward: 0,
return; minStake: 0,
} catch (error: any) { oracleTimeout: 900,
console.log(`Error: SBV2 Devnet - ${error.message}`); unpermissionedFeeds: true,
unpermissionedVrf: true,
enableBufferRelayers: true,
oracle: {
name: "Test Oracle",
enable: true,
// stakingWalletKeypair: Keypair.generate(),
},
});
await switchboard.start("dev-v2-RC_01_17_23_16_22", undefined);
});
after(async () => {
if (switchboard) {
switchboard.stop();
} }
// If fails, throw error
throw new Error(`Failed to load the SwitchboardTestContext from devnet`);
}); });
/** Example showing how to create a new data feed with a history buffer storing 200k samples. /** Example showing how to create a new data feed with a history buffer storing 200k samples.

View File

@ -8,8 +8,7 @@
"target": "es6", "target": "es6",
"esModuleInterop": true, "esModuleInterop": true,
"paths": { "paths": {
"@switchboard-xyz/switchboard-v2": ["../../javascript/switchboard-v2"], "@switchboard-xyz/solana.js": ["../../javascript/solana.js"]
"@switchboard-xyz/sbv2-utils": ["../../javascript/sbv2-utils"]
} }
}, },
"include": [ "include": [
@ -17,8 +16,5 @@
"client/**/*", "client/**/*",
"./target/types/anchor_history_parser" "./target/types/anchor_history_parser"
], ],
"references": [ "references": [{ "path": "../../javascript/solana.js" }]
{ "path": "../../javascript/switchboard-v2" },
{ "path": "../../javascript/sbv2-utils" }
]
} }

View File

@ -10,6 +10,8 @@ wallet = "~/.config/solana/id.json"
[programs.localnet] [programs.localnet]
anchor_vrf_parser = "4wTeTACfwiXqqvy44bNBB3V2rFjmSTXVoEr4ZAYamJEN" anchor_vrf_parser = "4wTeTACfwiXqqvy44bNBB3V2rFjmSTXVoEr4ZAYamJEN"
[programs.devnet]
anchor_vrf_parser = "4wTeTACfwiXqqvy44bNBB3V2rFjmSTXVoEr4ZAYamJEN"
[registry] [registry]
url = "https://anchor.projectserum.com" url = "https://anchor.projectserum.com"
@ -18,5 +20,19 @@ url = "https://anchor.projectserum.com"
test = "yarn run ts-mocha -p ./tsconfig.json -t 60000 ./tests/*.test.ts" test = "yarn run ts-mocha -p ./tsconfig.json -t 60000 ./tests/*.test.ts"
[test.validator] [test.validator]
url="https://api.devnet.solana.com" url = "https://api.devnet.solana.com"
[test]
startup_wait = 15000
[[test.validator.clone]] # sbv2 devnet programID
address = "2TfB33aLaneQb5TNVwyDz3jSZXS6jdW2ARw1Dgf84XCG"
[[test.validator.clone]] # sbv2 devnet IDL
address = "CKwZcshn4XDvhaWVH9EXnk3iu19t6t5xP2Sy2pD6TRDp"
[[test.validator.clone]] # sbv2 devnet SbState
address = "BYM81n8HvTJuqZU1PmTVcwZ9G8uoji7FKM6EaPkwphPt"
[[test.validator.clone]] # sbv2 devnet tokenVault
address = "FVLfR6C2ckZhbSwBzZY4CX7YBcddUSge5BNeGQv5eKhy"

View File

@ -18,7 +18,7 @@ cpi = ["no-entrypoint"]
[dependencies] [dependencies]
switchboard-v2 = { path = "../../rust/switchboard-v2" } switchboard-v2 = { path = "../../rust/switchboard-v2" }
# switchboard-v2 = { version = "^0.1.16" } # switchboard-v2 = { version = "^0.1.20" }
anchor-lang = "^0.26.0" anchor-lang = "^0.26.0"
anchor-spl = "^0.26.0" anchor-spl = "^0.26.0"
solana-program = "~1.14.0" solana-program = "~1.14.0"

View File

@ -13,8 +13,8 @@
"@project-serum/borsh": "^0.2.5", "@project-serum/borsh": "^0.2.5",
"@solana/spl-token": "^0.3.6", "@solana/spl-token": "^0.3.6",
"@solana/web3.js": "^1.67.0", "@solana/web3.js": "^1.67.0",
"@switchboard-xyz/common": "^2.1.8", "@switchboard-xyz/common": "^2.1.26",
"@switchboard-xyz/solana.js": "^2.0.79", "@switchboard-xyz/solana.js": "file:../../javascript/solana.js",
"chalk": "^4.1.2", "chalk": "^4.1.2",
"dotenv": "^16.0.1", "dotenv": "^16.0.1",
"yargs": "^17.5.1" "yargs": "^17.5.1"
@ -40,6 +40,42 @@
"typescript": "^4.9.3" "typescript": "^4.9.3"
} }
}, },
"../../javascript/solana.js": {
"name": "@switchboard-xyz/solana.js",
"version": "2.0.112",
"license": "MIT",
"dependencies": {
"@project-serum/anchor": "^0.26.0",
"@project-serum/borsh": "^0.2.5",
"@solana/spl-token": "^0.3.6",
"@solana/web3.js": "^1.73.0",
"@switchboard-xyz/common": "^2.1.26",
"dotenv": "^16.0.3",
"lodash": "^4.17.21"
},
"devDependencies": {
"@types/chai": "^4.3.4",
"@types/expect": "^24.3.0",
"@types/lodash": "^4.14.191",
"@types/mocha": "^10.0.0",
"@types/node": "^18.11.18",
"anchor-client-gen": "^0.25.0",
"chai": "^4.3.7",
"chalk": "^4.1.2",
"gts": "^3.1.1",
"mocha": "^10.1.0",
"shelljs": "^0.8.5",
"shx": "^0.3.4",
"ts-mocha": "^10.0.0",
"ts-node": "^10.9.1",
"typedoc": "^0.23.23",
"typescript": "^4.9.4"
},
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@babel/runtime": { "node_modules/@babel/runtime": {
"version": "7.20.1", "version": "7.20.1",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.1.tgz", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.1.tgz",
@ -275,36 +311,6 @@
"node": ">= 8" "node": ">= 8"
} }
}, },
"node_modules/@project-serum/anchor": {
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.26.0.tgz",
"integrity": "sha512-Nq+COIjE1135T7qfnOHEn7E0q39bQTgXLFk837/rgFe6Hkew9WML7eHsS+lSYD2p3OJaTiUOHTAq1lHy36oIqQ==",
"dependencies": {
"@coral-xyz/borsh": "^0.26.0",
"@solana/web3.js": "^1.68.0",
"base64-js": "^1.5.1",
"bn.js": "^5.1.2",
"bs58": "^4.0.1",
"buffer-layout": "^1.2.2",
"camelcase": "^6.3.0",
"cross-fetch": "^3.1.5",
"crypto-hash": "^1.3.0",
"eventemitter3": "^4.0.7",
"js-sha256": "^0.9.0",
"pako": "^2.0.3",
"snake-case": "^3.0.4",
"superstruct": "^0.15.4",
"toml": "^3.0.0"
},
"engines": {
"node": ">=11"
}
},
"node_modules/@project-serum/anchor/node_modules/superstruct": {
"version": "0.15.5",
"resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz",
"integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ=="
},
"node_modules/@project-serum/borsh": { "node_modules/@project-serum/borsh": {
"version": "0.2.5", "version": "0.2.5",
"resolved": "https://registry.npmjs.org/@project-serum/borsh/-/borsh-0.2.5.tgz", "resolved": "https://registry.npmjs.org/@project-serum/borsh/-/borsh-0.2.5.tgz",
@ -465,10 +471,11 @@
} }
}, },
"node_modules/@switchboard-xyz/common": { "node_modules/@switchboard-xyz/common": {
"version": "2.1.8", "version": "2.1.26",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.8.tgz", "resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.26.tgz",
"integrity": "sha512-mqCDwCtBf3tY2Bvce0USR4m6DsXSqw8rn4luc2sjLL4PPFKCuCZVgzysfkwzwBHoipbnx6odRQ+BIfm35nhWDA==", "integrity": "sha512-uyyEhX/mRgfWqvXbin0pvTmVdJfK7e6w/cWUvA04e6jRzSVzSzh4ZEj+2Dh+8Dj3GlxqRTRiSA3Os8+h5eIa8Q==",
"dependencies": { "dependencies": {
"@solana/web3.js": "^1.66.2",
"big.js": "^6.2.1", "big.js": "^6.2.1",
"bn.js": "^5.2.1", "bn.js": "^5.2.1",
"decimal.js": "^10.4.3", "decimal.js": "^10.4.3",
@ -476,24 +483,8 @@
} }
}, },
"node_modules/@switchboard-xyz/solana.js": { "node_modules/@switchboard-xyz/solana.js": {
"version": "2.0.79", "resolved": "../../javascript/solana.js",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/solana.js/-/solana.js-2.0.79.tgz", "link": true
"integrity": "sha512-gQeseWGpzWDcpQEqivRNw+FgjGjV2nxmEXgcZWwRz7SpRYehuhZVBnkueTlQEAdGYmi/oXU32YpERcfm6s2jXg==",
"dependencies": {
"@project-serum/anchor": "^0.26.0",
"@project-serum/borsh": "^0.2.5",
"@solana/spl-token": "^0.3.6",
"@solana/web3.js": "^1.73.0",
"@switchboard-xyz/common": "^2.1.8",
"big.js": "^6.2.1",
"bn.js": "^5.2.1",
"dotenv": "^16.0.3",
"lodash": "^4.17.21"
},
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
}, },
"node_modules/@tsconfig/node10": { "node_modules/@tsconfig/node10": {
"version": "1.0.9", "version": "1.0.9",
@ -4784,35 +4775,6 @@
"fastq": "^1.6.0" "fastq": "^1.6.0"
} }
}, },
"@project-serum/anchor": {
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.26.0.tgz",
"integrity": "sha512-Nq+COIjE1135T7qfnOHEn7E0q39bQTgXLFk837/rgFe6Hkew9WML7eHsS+lSYD2p3OJaTiUOHTAq1lHy36oIqQ==",
"requires": {
"@coral-xyz/borsh": "^0.26.0",
"@solana/web3.js": "^1.68.0",
"base64-js": "^1.5.1",
"bn.js": "^5.1.2",
"bs58": "^4.0.1",
"buffer-layout": "^1.2.2",
"camelcase": "^6.3.0",
"cross-fetch": "^3.1.5",
"crypto-hash": "^1.3.0",
"eventemitter3": "^4.0.7",
"js-sha256": "^0.9.0",
"pako": "^2.0.3",
"snake-case": "^3.0.4",
"superstruct": "^0.15.4",
"toml": "^3.0.0"
},
"dependencies": {
"superstruct": {
"version": "0.15.5",
"resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz",
"integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ=="
}
}
},
"@project-serum/borsh": { "@project-serum/borsh": {
"version": "0.2.5", "version": "0.2.5",
"resolved": "https://registry.npmjs.org/@project-serum/borsh/-/borsh-0.2.5.tgz", "resolved": "https://registry.npmjs.org/@project-serum/borsh/-/borsh-0.2.5.tgz",
@ -4940,10 +4902,11 @@
} }
}, },
"@switchboard-xyz/common": { "@switchboard-xyz/common": {
"version": "2.1.8", "version": "2.1.26",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.8.tgz", "resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.26.tgz",
"integrity": "sha512-mqCDwCtBf3tY2Bvce0USR4m6DsXSqw8rn4luc2sjLL4PPFKCuCZVgzysfkwzwBHoipbnx6odRQ+BIfm35nhWDA==", "integrity": "sha512-uyyEhX/mRgfWqvXbin0pvTmVdJfK7e6w/cWUvA04e6jRzSVzSzh4ZEj+2Dh+8Dj3GlxqRTRiSA3Os8+h5eIa8Q==",
"requires": { "requires": {
"@solana/web3.js": "^1.66.2",
"big.js": "^6.2.1", "big.js": "^6.2.1",
"bn.js": "^5.2.1", "bn.js": "^5.2.1",
"decimal.js": "^10.4.3", "decimal.js": "^10.4.3",
@ -4951,19 +4914,31 @@
} }
}, },
"@switchboard-xyz/solana.js": { "@switchboard-xyz/solana.js": {
"version": "2.0.79", "version": "file:../../javascript/solana.js",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/solana.js/-/solana.js-2.0.79.tgz",
"integrity": "sha512-gQeseWGpzWDcpQEqivRNw+FgjGjV2nxmEXgcZWwRz7SpRYehuhZVBnkueTlQEAdGYmi/oXU32YpERcfm6s2jXg==",
"requires": { "requires": {
"@project-serum/anchor": "^0.26.0", "@project-serum/anchor": "^0.26.0",
"@project-serum/borsh": "^0.2.5", "@project-serum/borsh": "^0.2.5",
"@solana/spl-token": "^0.3.6", "@solana/spl-token": "^0.3.6",
"@solana/web3.js": "^1.73.0", "@solana/web3.js": "^1.73.0",
"@switchboard-xyz/common": "^2.1.8", "@switchboard-xyz/common": "^2.1.26",
"big.js": "^6.2.1", "@types/chai": "^4.3.4",
"bn.js": "^5.2.1", "@types/expect": "^24.3.0",
"@types/lodash": "^4.14.191",
"@types/mocha": "^10.0.0",
"@types/node": "^18.11.18",
"anchor-client-gen": "^0.25.0",
"chai": "^4.3.7",
"chalk": "^4.1.2",
"dotenv": "^16.0.3", "dotenv": "^16.0.3",
"lodash": "^4.17.21" "gts": "^3.1.1",
"lodash": "^4.17.21",
"mocha": "^10.1.0",
"shelljs": "^0.8.5",
"shx": "^0.3.4",
"ts-mocha": "^10.0.0",
"ts-node": "^10.9.1",
"typedoc": "^0.23.23",
"typescript": "^4.9.4"
} }
}, },
"@tsconfig/node10": { "@tsconfig/node10": {

View File

@ -29,8 +29,8 @@
"@project-serum/borsh": "^0.2.5", "@project-serum/borsh": "^0.2.5",
"@solana/spl-token": "^0.3.6", "@solana/spl-token": "^0.3.6",
"@solana/web3.js": "^1.67.0", "@solana/web3.js": "^1.67.0",
"@switchboard-xyz/common": "^2.1.8", "@switchboard-xyz/common": "^2.1.26",
"@switchboard-xyz/solana.js": "^2.0.79", "@switchboard-xyz/solana.js": "file:../../javascript/solana.js",
"chalk": "^4.1.2", "chalk": "^4.1.2",
"dotenv": "^16.0.1", "dotenv": "^16.0.1",
"yargs": "^17.5.1" "yargs": "^17.5.1"

View File

@ -7,37 +7,34 @@ import {
SYSVAR_RECENT_BLOCKHASHES_PUBKEY, SYSVAR_RECENT_BLOCKHASHES_PUBKEY,
} from "@solana/web3.js"; } from "@solana/web3.js";
import { AnchorVrfParser, IDL } from "../target/types/anchor_vrf_parser"; import { TOKEN_PROGRAM_ID } from "@solana/spl-token";
import { VrfClient } from "../client/accounts"; import { sleep } from "@switchboard-xyz/common";
import { PROGRAM_ID } from "../client/programId";
import { import {
AnchorWallet, AnchorWallet,
Callback, Callback,
PermissionAccount, PermissionAccount,
SwitchboardTestContextV2,
types, types,
} from "@switchboard-xyz/solana.js"; } from "@switchboard-xyz/solana.js";
import { sleep } from "@switchboard-xyz/common"; import { VrfClient } from "../client/accounts";
import { TOKEN_PROGRAM_ID } from "@solana/spl-token"; import { AnchorVrfParser } from "../target/types/anchor_vrf_parser";
import { Switchboard } from "./init";
describe("anchor-vrf-parser test", () => { describe("anchor-vrf-parser test", () => {
const provider = AnchorProvider.env(); const provider = AnchorProvider.env();
anchor.setProvider(provider); anchor.setProvider(provider);
// const vrfClientProgram = anchor.workspace const vrfClientProgram = anchor.workspace
// .AnchorVrfParser as Program<AnchorVrfParser>; .AnchorVrfParser as anchor.Program<AnchorVrfParser>;
const vrfClientProgram = new anchor.Program( // const vrfClientProgram = new anchor.Program(
IDL, // IDL,
PROGRAM_ID, // PROGRAM_ID,
provider, // provider,
new anchor.BorshCoder(IDL) // new anchor.BorshCoder(IDL)
) as anchor.Program<AnchorVrfParser>; // ) as anchor.Program<AnchorVrfParser>;
const payer = (provider.wallet as AnchorWallet).payer; const payer = (provider.wallet as AnchorWallet).payer;
let switchboard: Switchboard;
const vrfSecret = anchor.web3.Keypair.generate(); const vrfSecret = anchor.web3.Keypair.generate();
console.log(`VRF Account: ${vrfSecret.publicKey}`); console.log(`VRF Account: ${vrfSecret.publicKey}`);
@ -62,12 +59,31 @@ describe("anchor-vrf-parser test", () => {
ixData: vrfIxCoder.encode("updateResult", ""), // pass any params for instruction here ixData: vrfIxCoder.encode("updateResult", ""), // pass any params for instruction here
}; };
let switchboard: SwitchboardTestContextV2;
before(async () => { before(async () => {
switchboard = await Switchboard.load(provider); switchboard = await SwitchboardTestContextV2.loadFromProvider(provider, {
// You can provide a keypair to so the PDA schemes dont change between test runs
name: "Test Queue",
// keypair: Keypair.generate(),
queueSize: 10,
reward: 0,
minStake: 0,
oracleTimeout: 900,
unpermissionedFeeds: true,
unpermissionedVrf: true,
enableBufferRelayers: true,
oracle: {
name: "Test Oracle",
enable: true,
// stakingWalletKeypair: Keypair.generate(),
},
});
await switchboard.start("dev-v2-RC_01_17_23_16_22", undefined);
}); });
it("Creates a vrfClient account", async () => { it("Creates a vrfClient account", async () => {
const queue = switchboard.queue.account; const queue = switchboard.queue;
const { unpermissionedVrfEnabled, authority, dataBuffer } = const { unpermissionedVrfEnabled, authority, dataBuffer } =
await queue.loadData(); await queue.loadData();

View File

@ -1,60 +0,0 @@
import { AnchorProvider } from "@coral-xyz/anchor";
import { Cluster, clusterApiUrl, Keypair } from "@solana/web3.js";
import {
ISwitchboardNetwork,
SwitchboardNetwork,
SwitchboardProgram,
} from "@switchboard-xyz/solana.js";
import os from "os";
import path from "path";
export const DEFAULT_KEYPAIR_PATH = path.join(
os.homedir(),
".config/solana/id.json"
);
export function getCluster(
rpcEndpoint: string
): Cluster | "localnet" | undefined {
switch (rpcEndpoint) {
case "http://localhost:8899":
return "localnet";
case clusterApiUrl("devnet"):
return "devnet";
case clusterApiUrl("mainnet-beta"):
return "mainnet-beta";
default:
return undefined;
}
}
export class Switchboard extends SwitchboardNetwork {
private static _instances: Map<string, Promise<Switchboard>> = new Map();
private constructor(network: SwitchboardNetwork, readonly name: string) {
super(network);
}
public static load(
provider: AnchorProvider,
name = "default"
): Promise<Switchboard> {
if (!this._instances.has(name)) {
this._instances.set(
name,
new Promise(async (resolve, reject) => {
try {
const program = await SwitchboardProgram.fromProvider(provider);
const switchboardNetwork = SwitchboardNetwork.find(program, name);
const switchboard = new Switchboard(switchboardNetwork, name);
resolve(switchboard);
} catch (error) {
reject(error);
}
})
);
}
return this._instances.get(name)!;
}
}

View File

@ -14,15 +14,10 @@
"strictNullChecks": false, "strictNullChecks": false,
"target": "es6", "target": "es6",
"paths": { "paths": {
"@switchboard-xyz/switchboard-v2": ["../../javascript/switchboard-v2"], "@switchboard-xyz/solana.js": ["../../javascript/solana.js"]
"@switchboard-xyz/sbv2-utils": ["../../javascript/sbv2-utils"],
"@solana/spl-token": ["./node_modules/@solana/spl-token"]
} }
}, },
"include": ["tests/**/*", "./cli.ts", "./client/**/*"], "include": ["tests/**/*", "./cli.ts", "./client/**/*"],
"exclude": ["target", "lib"], "exclude": ["target", "lib"],
"references": [ "references": [{ "path": "../../javascript/solana.js" }]
{ "path": "../../javascript/switchboard-v2" },
{ "path": "../../javascript/sbv2-utils" }
]
} }

View File

@ -11,7 +11,7 @@ name = "native_feed_parser"
no-entrypoint = [] no-entrypoint = []
[dependencies] [dependencies]
# switchboard-v2 = { path = "../../rust/switchboard-v2", features = ["devnet"] } switchboard-v2 = { path = "../../rust/switchboard-v2", features = ["devnet"] }
switchboard-v2 = { version = "^0.1.17", features = ["devnet"] } # switchboard-v2 = { version = "^0.1.20", features = ["devnet"] }
solana-program = "~1.14.0" solana-program = "~1.14.0"
anchor-lang = "^0.26.0" anchor-lang = "^0.26.0"

View File

@ -10,8 +10,8 @@
"dependencies": { "dependencies": {
"@project-serum/anchor": "^0.26.0", "@project-serum/anchor": "^0.26.0",
"@solana/web3.js": "^1.66.2", "@solana/web3.js": "^1.66.2",
"@switchboard-xyz/common": "^2.1.8", "@switchboard-xyz/common": "^2.1.26",
"@switchboard-xyz/solana.js": "^2.0.52" "@switchboard-xyz/solana.js": "file:../../javascript/solana.js"
}, },
"devDependencies": { "devDependencies": {
"@types/chai": "^4.3.0", "@types/chai": "^4.3.0",
@ -24,6 +24,41 @@
"typescript": "^4.7" "typescript": "^4.7"
} }
}, },
"../../javascript/solana.js": {
"version": "2.0.112",
"license": "MIT",
"dependencies": {
"@project-serum/anchor": "^0.26.0",
"@project-serum/borsh": "^0.2.5",
"@solana/spl-token": "^0.3.6",
"@solana/web3.js": "^1.73.0",
"@switchboard-xyz/common": "^2.1.26",
"dotenv": "^16.0.3",
"lodash": "^4.17.21"
},
"devDependencies": {
"@types/chai": "^4.3.4",
"@types/expect": "^24.3.0",
"@types/lodash": "^4.14.191",
"@types/mocha": "^10.0.0",
"@types/node": "^18.11.18",
"anchor-client-gen": "^0.25.0",
"chai": "^4.3.7",
"chalk": "^4.1.2",
"gts": "^3.1.1",
"mocha": "^10.1.0",
"shelljs": "^0.8.5",
"shx": "^0.3.4",
"ts-mocha": "^10.0.0",
"ts-node": "^10.9.1",
"typedoc": "^0.23.23",
"typescript": "^4.9.4"
},
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@babel/runtime": { "node_modules/@babel/runtime": {
"version": "7.19.0", "version": "7.19.0",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.19.0.tgz", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.19.0.tgz",
@ -150,21 +185,6 @@
"resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz", "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz",
"integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ==" "integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ=="
}, },
"node_modules/@project-serum/borsh": {
"version": "0.2.5",
"resolved": "https://registry.npmjs.org/@project-serum/borsh/-/borsh-0.2.5.tgz",
"integrity": "sha512-UmeUkUoKdQ7rhx6Leve1SssMR/Ghv8qrEiyywyxSWg7ooV7StdpPBhciiy5eB3T0qU1BXvdRNC8TdrkxK7WC5Q==",
"dependencies": {
"bn.js": "^5.1.2",
"buffer-layout": "^1.2.0"
},
"engines": {
"node": ">=10"
},
"peerDependencies": {
"@solana/web3.js": "^1.2.0"
}
},
"node_modules/@protobufjs/aspromise": { "node_modules/@protobufjs/aspromise": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
@ -230,36 +250,6 @@
"node": ">=5.10" "node": ">=5.10"
} }
}, },
"node_modules/@solana/buffer-layout-utils": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/@solana/buffer-layout-utils/-/buffer-layout-utils-0.2.0.tgz",
"integrity": "sha512-szG4sxgJGktbuZYDg2FfNmkMi0DYQoVjN2h7ta1W1hPrwzarcFLBq9UpX1UjNXsNpT9dn+chgprtWGioUAr4/g==",
"dependencies": {
"@solana/buffer-layout": "^4.0.0",
"@solana/web3.js": "^1.32.0",
"bigint-buffer": "^1.1.5",
"bignumber.js": "^9.0.1"
},
"engines": {
"node": ">= 10"
}
},
"node_modules/@solana/spl-token": {
"version": "0.3.6",
"resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.3.6.tgz",
"integrity": "sha512-P9pTXjDIRvVbjr3J0mCnSamYqLnICeds7IoH1/Ro2R9OBuOHdp5pqKZoscfZ3UYrgnCWUc1bc9M2m/YPHjw+1g==",
"dependencies": {
"@solana/buffer-layout": "^4.0.0",
"@solana/buffer-layout-utils": "^0.2.0",
"buffer": "^6.0.3"
},
"engines": {
"node": ">=16"
},
"peerDependencies": {
"@solana/web3.js": "^1.47.4"
}
},
"node_modules/@solana/web3.js": { "node_modules/@solana/web3.js": {
"version": "1.70.1", "version": "1.70.1",
"resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.70.1.tgz", "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.70.1.tgz",
@ -309,10 +299,11 @@
} }
}, },
"node_modules/@switchboard-xyz/common": { "node_modules/@switchboard-xyz/common": {
"version": "2.1.8", "version": "2.1.26",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.8.tgz", "resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.26.tgz",
"integrity": "sha512-mqCDwCtBf3tY2Bvce0USR4m6DsXSqw8rn4luc2sjLL4PPFKCuCZVgzysfkwzwBHoipbnx6odRQ+BIfm35nhWDA==", "integrity": "sha512-uyyEhX/mRgfWqvXbin0pvTmVdJfK7e6w/cWUvA04e6jRzSVzSzh4ZEj+2Dh+8Dj3GlxqRTRiSA3Os8+h5eIa8Q==",
"dependencies": { "dependencies": {
"@solana/web3.js": "^1.66.2",
"big.js": "^6.2.1", "big.js": "^6.2.1",
"bn.js": "^5.2.1", "bn.js": "^5.2.1",
"decimal.js": "^10.4.3", "decimal.js": "^10.4.3",
@ -320,60 +311,8 @@
} }
}, },
"node_modules/@switchboard-xyz/solana.js": { "node_modules/@switchboard-xyz/solana.js": {
"version": "2.0.52", "resolved": "../../javascript/solana.js",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/solana.js/-/solana.js-2.0.52.tgz", "link": true
"integrity": "sha512-ppM64vBeR8DZ9RYeVi7mhG4OwwLvBOYAlitaa7v32/43Qlz7rHokdRkyQPYh50mr2rRiebVlpMINh6ZD6tWP6A==",
"dependencies": {
"@project-serum/anchor": "^0.25.0",
"@project-serum/borsh": "^0.2.5",
"@solana/spl-token": "^0.3.5",
"@solana/web3.js": "^1.66.1",
"@switchboard-xyz/common": "^2.1.8",
"big.js": "^6.2.1",
"bn.js": "^5.2.1"
},
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
}
},
"node_modules/@switchboard-xyz/solana.js/node_modules/@project-serum/anchor": {
"version": "0.25.0",
"resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.25.0.tgz",
"integrity": "sha512-E6A5Y/ijqpfMJ5psJvbw0kVTzLZFUcOFgs6eSM2M2iWE1lVRF18T6hWZVNl6zqZsoz98jgnNHtVGJMs+ds9A7A==",
"dependencies": {
"@project-serum/borsh": "^0.2.5",
"@solana/web3.js": "^1.36.0",
"base64-js": "^1.5.1",
"bn.js": "^5.1.2",
"bs58": "^4.0.1",
"buffer-layout": "^1.2.2",
"camelcase": "^5.3.1",
"cross-fetch": "^3.1.5",
"crypto-hash": "^1.3.0",
"eventemitter3": "^4.0.7",
"js-sha256": "^0.9.0",
"pako": "^2.0.3",
"snake-case": "^3.0.4",
"superstruct": "^0.15.4",
"toml": "^3.0.0"
},
"engines": {
"node": ">=11"
}
},
"node_modules/@switchboard-xyz/solana.js/node_modules/camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
"engines": {
"node": ">=6"
}
},
"node_modules/@switchboard-xyz/solana.js/node_modules/superstruct": {
"version": "0.15.5",
"resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz",
"integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ=="
}, },
"node_modules/@tsconfig/node10": { "node_modules/@tsconfig/node10": {
"version": "1.0.9", "version": "1.0.9",
@ -591,14 +530,6 @@
"node": ">= 10.0.0" "node": ">= 10.0.0"
} }
}, },
"node_modules/bignumber.js": {
"version": "9.1.1",
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz",
"integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==",
"engines": {
"node": "*"
}
},
"node_modules/binary-extensions": { "node_modules/binary-extensions": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
@ -2365,15 +2296,6 @@
} }
} }
}, },
"@project-serum/borsh": {
"version": "0.2.5",
"resolved": "https://registry.npmjs.org/@project-serum/borsh/-/borsh-0.2.5.tgz",
"integrity": "sha512-UmeUkUoKdQ7rhx6Leve1SssMR/Ghv8qrEiyywyxSWg7ooV7StdpPBhciiy5eB3T0qU1BXvdRNC8TdrkxK7WC5Q==",
"requires": {
"bn.js": "^5.1.2",
"buffer-layout": "^1.2.0"
}
},
"@protobufjs/aspromise": { "@protobufjs/aspromise": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
@ -2436,27 +2358,6 @@
"buffer": "~6.0.3" "buffer": "~6.0.3"
} }
}, },
"@solana/buffer-layout-utils": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/@solana/buffer-layout-utils/-/buffer-layout-utils-0.2.0.tgz",
"integrity": "sha512-szG4sxgJGktbuZYDg2FfNmkMi0DYQoVjN2h7ta1W1hPrwzarcFLBq9UpX1UjNXsNpT9dn+chgprtWGioUAr4/g==",
"requires": {
"@solana/buffer-layout": "^4.0.0",
"@solana/web3.js": "^1.32.0",
"bigint-buffer": "^1.1.5",
"bignumber.js": "^9.0.1"
}
},
"@solana/spl-token": {
"version": "0.3.6",
"resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.3.6.tgz",
"integrity": "sha512-P9pTXjDIRvVbjr3J0mCnSamYqLnICeds7IoH1/Ro2R9OBuOHdp5pqKZoscfZ3UYrgnCWUc1bc9M2m/YPHjw+1g==",
"requires": {
"@solana/buffer-layout": "^4.0.0",
"@solana/buffer-layout-utils": "^0.2.0",
"buffer": "^6.0.3"
}
},
"@solana/web3.js": { "@solana/web3.js": {
"version": "1.70.1", "version": "1.70.1",
"resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.70.1.tgz", "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.70.1.tgz",
@ -2491,10 +2392,11 @@
} }
}, },
"@switchboard-xyz/common": { "@switchboard-xyz/common": {
"version": "2.1.8", "version": "2.1.26",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.8.tgz", "resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.26.tgz",
"integrity": "sha512-mqCDwCtBf3tY2Bvce0USR4m6DsXSqw8rn4luc2sjLL4PPFKCuCZVgzysfkwzwBHoipbnx6odRQ+BIfm35nhWDA==", "integrity": "sha512-uyyEhX/mRgfWqvXbin0pvTmVdJfK7e6w/cWUvA04e6jRzSVzSzh4ZEj+2Dh+8Dj3GlxqRTRiSA3Os8+h5eIa8Q==",
"requires": { "requires": {
"@solana/web3.js": "^1.66.2",
"big.js": "^6.2.1", "big.js": "^6.2.1",
"bn.js": "^5.2.1", "bn.js": "^5.2.1",
"decimal.js": "^10.4.3", "decimal.js": "^10.4.3",
@ -2502,51 +2404,31 @@
} }
}, },
"@switchboard-xyz/solana.js": { "@switchboard-xyz/solana.js": {
"version": "2.0.52", "version": "file:../../javascript/solana.js",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/solana.js/-/solana.js-2.0.52.tgz",
"integrity": "sha512-ppM64vBeR8DZ9RYeVi7mhG4OwwLvBOYAlitaa7v32/43Qlz7rHokdRkyQPYh50mr2rRiebVlpMINh6ZD6tWP6A==",
"requires": { "requires": {
"@project-serum/anchor": "^0.25.0", "@project-serum/anchor": "^0.26.0",
"@project-serum/borsh": "^0.2.5", "@project-serum/borsh": "^0.2.5",
"@solana/spl-token": "^0.3.5", "@solana/spl-token": "^0.3.6",
"@solana/web3.js": "^1.66.1", "@solana/web3.js": "^1.73.0",
"@switchboard-xyz/common": "^2.1.8", "@switchboard-xyz/common": "^2.1.26",
"big.js": "^6.2.1", "@types/chai": "^4.3.4",
"bn.js": "^5.2.1" "@types/expect": "^24.3.0",
}, "@types/lodash": "^4.14.191",
"dependencies": { "@types/mocha": "^10.0.0",
"@project-serum/anchor": { "@types/node": "^18.11.18",
"version": "0.25.0", "anchor-client-gen": "^0.25.0",
"resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.25.0.tgz", "chai": "^4.3.7",
"integrity": "sha512-E6A5Y/ijqpfMJ5psJvbw0kVTzLZFUcOFgs6eSM2M2iWE1lVRF18T6hWZVNl6zqZsoz98jgnNHtVGJMs+ds9A7A==", "chalk": "^4.1.2",
"requires": { "dotenv": "^16.0.3",
"@project-serum/borsh": "^0.2.5", "gts": "^3.1.1",
"@solana/web3.js": "^1.36.0", "lodash": "^4.17.21",
"base64-js": "^1.5.1", "mocha": "^10.1.0",
"bn.js": "^5.1.2", "shelljs": "^0.8.5",
"bs58": "^4.0.1", "shx": "^0.3.4",
"buffer-layout": "^1.2.2", "ts-mocha": "^10.0.0",
"camelcase": "^5.3.1", "ts-node": "^10.9.1",
"cross-fetch": "^3.1.5", "typedoc": "^0.23.23",
"crypto-hash": "^1.3.0", "typescript": "^4.9.4"
"eventemitter3": "^4.0.7",
"js-sha256": "^0.9.0",
"pako": "^2.0.3",
"snake-case": "^3.0.4",
"superstruct": "^0.15.4",
"toml": "^3.0.0"
}
},
"camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
},
"superstruct": {
"version": "0.15.5",
"resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz",
"integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ=="
}
} }
}, },
"@tsconfig/node10": { "@tsconfig/node10": {
@ -2720,11 +2602,6 @@
"bindings": "^1.3.0" "bindings": "^1.3.0"
} }
}, },
"bignumber.js": {
"version": "9.1.1",
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.1.tgz",
"integrity": "sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig=="
},
"binary-extensions": { "binary-extensions": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",

View File

@ -16,8 +16,8 @@
"dependencies": { "dependencies": {
"@project-serum/anchor": "^0.26.0", "@project-serum/anchor": "^0.26.0",
"@solana/web3.js": "^1.66.2", "@solana/web3.js": "^1.66.2",
"@switchboard-xyz/common": "^2.1.8", "@switchboard-xyz/common": "^2.1.26",
"@switchboard-xyz/solana.js": "^2.0.52" "@switchboard-xyz/solana.js": "file:../../javascript/solana.js"
}, },
"devDependencies": { "devDependencies": {
"@types/chai": "^4.3.0", "@types/chai": "^4.3.0",

View File

@ -8,28 +8,28 @@ javascript_dir="$project_dir"/javascript
program_dir="$project_dir"/programs program_dir="$project_dir"/programs
cd "$javascript_dir"/solana.js cd "$javascript_dir"/solana.js
yarn install && yarn build npm ci && npm run build
cd "$javascript_dir"/sbv2-utils cd "$javascript_dir"/sbv2-utils
yarn install && yarn build npm ci && npm run build
cd "$javascript_dir"/sbv2-lite cd "$javascript_dir"/sbv2-lite
yarn install && yarn build npm ci && npm run build
cd "$javascript_dir"/feed-parser cd "$javascript_dir"/feed-parser
yarn install && yarn build npm ci && npm run build
cd "$javascript_dir"/feed-walkthrough cd "$javascript_dir"/feed-walkthrough
yarn install && yarn build npm ci && npm run build
cd "$javascript_dir"/lease-observer cd "$javascript_dir"/lease-observer
yarn install && yarn build npm ci && npm run build
cd "$program_dir"/anchor-buffer-parser cd "$program_dir"/anchor-buffer-parser
yarn install npm ci && anchor build
cd "$program_dir"/anchor-feed-parser cd "$program_dir"/anchor-feed-parser
yarn install npm ci && anchor build
cd "$program_dir"/anchor-vrf-parser cd "$program_dir"/anchor-vrf-parser
yarn install npm ci && anchor build