Merge branch 'program-examples' into main

This commit is contained in:
Conner Gallagher 2022-12-19 09:00:32 -07:00
commit b55a594548
36 changed files with 2774 additions and 35716 deletions

View File

@ -65,7 +65,8 @@
"@solana/web3.js": "^1.66.1",
"@switchboard-xyz/common": "^2.1.8",
"big.js": "^6.2.1",
"bn.js": "^5.2.1"
"bn.js": "^5.2.1",
"dotenv": "^16.0.3"
},
"devDependencies": {
"@types/big.js": "^6.1.6",
@ -77,7 +78,6 @@
"anchor-client-gen": "^0.25.0",
"chai": "^4.3.7",
"chalk": "^4.1.2",
"dotenv": "^16.0.3",
"gts": "^3.1.1",
"mocha": "^10.1.0",
"shelljs": "^0.8.5",

View File

@ -23,6 +23,7 @@ import { Account, OnAccountChangeCallback } from './account';
import { JobAccount } from './jobAccount';
import { PermissionAccount } from './permissionAccount';
import { QueueAccount } from './queueAccount';
import { promiseWithTimeout } from '@switchboard-xyz/common';
/**
* Account type holding a buffer of data sourced from the buffers sole {@linkcode JobAccount}. A buffer relayer has no consensus mechanism and relies on trusting an {@linkcode OracleAccount} to respond honestly. A buffer relayer has a max capacity of 500 bytes.
@ -185,12 +186,7 @@ export class BufferRelayerAccount extends Account<types.BufferRelayerAccountData
public async openRoundInstructions(
payer: PublicKey,
params: {
tokenWallet: PublicKey;
bufferRelayer?: types.BufferRelayerAccountData;
queueAccount?: QueueAccount;
queue?: types.OracleQueueAccountData;
}
params: BufferRelayerOpenRoundParams
): Promise<TransactionObject> {
const ixns: TransactionInstruction[] = [];
const bufferRelayer = params.bufferRelayer ?? (await this.loadData());
@ -247,12 +243,9 @@ export class BufferRelayerAccount extends Account<types.BufferRelayerAccountData
return new TransactionObject(payer, ixns, []);
}
public async openRound(params: {
tokenWallet: PublicKey;
bufferRelayer?: types.BufferRelayerAccountData;
queueAccount?: QueueAccount;
queue?: types.OracleQueueAccountData;
}): Promise<TransactionSignature> {
public async openRound(
params: BufferRelayerOpenRoundParams
): Promise<TransactionSignature> {
const openRound = await this.openRoundInstructions(
this.program.walletPubkey,
params
@ -261,6 +254,55 @@ export class BufferRelayerAccount extends Account<types.BufferRelayerAccountData
return txnSignature;
}
public async openRoundAndAwaitResult(
params: BufferRelayerOpenRoundParams,
timeout = 30000
): Promise<[types.BufferRelayerAccountData, TransactionSignature]> {
const bufferRelayer = params?.bufferRelayer ?? (await this.loadData());
const currentRoundOpenSlot = bufferRelayer.currentRound.roundOpenSlot;
let ws: number | undefined = undefined;
const closeWebsocket = async () => {
if (ws !== undefined) {
await this.program.connection.removeAccountChangeListener(ws);
ws = undefined;
}
};
const statePromise: Promise<types.BufferRelayerAccountData> =
promiseWithTimeout(
timeout,
new Promise(
(
resolve: (result: types.BufferRelayerAccountData) => void,
reject: (reason: string) => void
) => {
ws = this.onChange(bufferRelayer => {
if (
bufferRelayer.currentRound.roundOpenSlot.gt(
currentRoundOpenSlot
) &&
bufferRelayer.currentRound.numSuccess > 0
) {
resolve(bufferRelayer);
}
});
}
)
).finally(async () => {
await closeWebsocket();
});
const openRoundSignature = await this.openRound(params);
const state = await statePromise;
await closeWebsocket();
return [state, openRoundSignature];
}
public getAccounts(params: {
queueAccount: QueueAccount;
queueAuthority: PublicKey;
@ -395,3 +437,10 @@ export type BufferRelayerAccountsJSON = types.BufferRelayerAccountDataJSON & {
publicKey: PublicKey;
};
};
export type BufferRelayerOpenRoundParams = {
tokenWallet: PublicKey;
bufferRelayer?: types.BufferRelayerAccountData;
queueAccount?: QueueAccount;
queue?: types.OracleQueueAccountData;
};

View File

@ -606,6 +606,13 @@ export class VrfAccount extends Account<types.VrfAccountData> {
}
let ws: number | undefined;
const closeWebsocket = async () => {
if (ws !== undefined) {
await this.program.connection.removeAccountChangeListener(ws);
ws = undefined;
}
};
let result: VrfResult;
try {
result = await promiseWithTimeout(
@ -644,15 +651,10 @@ export class VrfAccount extends Account<types.VrfAccountData> {
)
);
} finally {
if (ws !== undefined) {
await this.program.connection.removeAccountChangeListener(ws);
ws = undefined;
}
closeWebsocket();
}
if (ws !== undefined) {
await this.program.connection.removeAccountChangeListener(ws);
}
closeWebsocket();
return result;
}

View File

@ -395,6 +395,13 @@ export type SwitchboardPermissionJSON =
| SwitchboardPermission.PermitOracleQueueUsageJSON
| SwitchboardPermission.PermitVrfRequestsJSON;
export {
PermitNone,
PermitOracleHeartbeat,
PermitOracleQueueUsage,
PermitVrfRequests,
} from './SwitchboardPermission';
export { OracleResponseType };
export type OracleResponseTypeKind =

View File

@ -1,3 +1,4 @@
import * as dotenv from 'dotenv';
import * as anchor from '@project-serum/anchor';
import { clusterApiUrl, Connection, Keypair, PublicKey } from '@solana/web3.js';
import { AggregatorAccount, JobAccount, QueueAccount } from '../accounts';
@ -8,7 +9,10 @@ import { BNtoDateTimeString, OracleJob } from '@switchboard-xyz/common';
import { Mint } from '../mint';
import { AggregatorAccountData } from '../generated';
import { TransactionObject } from '../TransactionObject';
import { SWITCHBOARD_LABS_DEVNET_PERMISSIONLESS_QUEUE } from '../const';
import {
DEVNET_GENESIS_HASH,
SWITCHBOARD_LABS_DEVNET_PERMISSIONLESS_QUEUE,
} from '../const';
import { SwitchboardNetwork } from '../SwitchboardNetwork';
export const LATEST_DOCKER_VERSION = 'dev-v2-RC_12_05_22_22_48';
@ -42,6 +46,63 @@ export class SwitchboardTestContext {
readonly payerTokenWallet: PublicKey
) {}
public static async load(
provider: anchor.AnchorProvider,
params?: {
tokenAmount?: number;
queueKey?: PublicKey | string;
filePath?: string;
}
): Promise<SwitchboardTestContext> {
// fetch genesis hash
const genesisHash = await provider.connection.getGenesisHash();
if (genesisHash === DEVNET_GENESIS_HASH) {
// if queueKey is defined should we bother loading the local env?
// first try to load the local env
try {
const testContext = await SwitchboardTestContext.loadFromEnv(
provider,
params?.filePath ?? undefined,
params?.tokenAmount ?? undefined
);
// verify the oracle is heartbeating
const oracles = await testContext.queue.loadActiveOracleAccounts();
if (oracles.length > 0) {
return testContext;
}
// eslint-disable-next-line no-empty
} catch (error) {}
// fallback to the devnet permissionless queue
try {
const testContext = await SwitchboardTestContext.loadDevnetQueue(
provider,
params?.queueKey ?? undefined,
params?.tokenAmount ?? undefined
);
// verify the oracle is heartbeating
const oracles = await testContext.queue.loadActiveOracleAccounts();
if (oracles.length > 0) {
return testContext;
}
// eslint-disable-next-line no-empty
} catch (error) {}
throw new Error(
`Failed to load a Switchboard environment from a local file or the devnet permissionless queue`
);
} else {
const testContext = await SwitchboardTestContext.loadFromEnv(
provider,
params?.filePath ?? undefined,
params?.tokenAmount ?? undefined
);
return testContext;
}
}
/** Load SwitchboardTestContext using a specified queue
* @param provider anchor Provider containing connection and payer Keypair
* @param queueKey the oracle queue to load
@ -155,7 +216,7 @@ export class SwitchboardTestContext {
tokenAmount = 0
): Promise<SwitchboardTestContext> {
// eslint-disable-next-line node/no-unpublished-require
require('dotenv').config({ path: filePath });
dotenv.config({ path: filePath });
if (!process.env.SWITCHBOARD_PROGRAM_ID) {
throw new Error(`your env file must have $SWITCHBOARD_PROGRAM_ID set`);
}

View File

@ -6,8 +6,7 @@ members = [
[provider]
# cluster = "devnet"
cluster = "localnet"
wallet = "../../../payer-keypair.json"
# wallet = "~/.config/solana/id.json"
wallet = "~/.config/solana/id.json"
[programs.localnet]
anchor_buffer_parser = "96punQGZDShZGkzsBa3SsfTxfUnwu4XGpzXbhF7NTgcP"

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -12,11 +12,10 @@
"lint": "eslint --ext .js,.json,.ts 'src/**' --fix"
},
"dependencies": {
"@project-serum/anchor": "^0.25.0",
"@project-serum/anchor": "^0.26.0",
"@solana/web3.js": "^1.66.2",
"@switchboard-xyz/common": "^2.1.7",
"@switchboard-xyz/sbv2-utils": "^0.1.53",
"@switchboard-xyz/switchboard-v2": "^0.0.165",
"@switchboard-xyz/common": "^2.1.8",
"@switchboard-xyz/solana.js": "file:../../javascript/solana.js",
"node-fetch": "^2.6"
},
"devDependencies": {

View File

@ -1,16 +1,9 @@
import * as anchor from "@project-serum/anchor";
import { OracleJob } from "@switchboard-xyz/common";
import {
promiseWithTimeout,
sleep,
SwitchboardTestContext,
} from "@switchboard-xyz/sbv2-utils";
import { OracleJob, sleep } from "@switchboard-xyz/common";
import {
AnchorWallet,
BufferRelayerAccount,
JobAccount,
PermissionAccount,
} from "@switchboard-xyz/switchboard-v2";
SwitchboardTestContext,
} from "@switchboard-xyz/solana.js";
import fetch from "node-fetch";
import { PROGRAM_ID } from "../client/programId";
import { AnchorBufferParser, IDL } from "../target/types/anchor_buffer_parser";
@ -58,7 +51,14 @@ describe("anchor-buffer-parser test", () => {
const url = "https://jsonplaceholder.typicode.com/todos/1";
const expectedResult = Buffer.from(await (await fetch(url)).text());
const jobData = Buffer.from(
const [bufferAccount] = await switchboard.queue.createBufferRelayer({
name: "My Buffer",
minUpdateDelaySeconds: 30,
enable: true,
queueAuthorityPubkey: switchboard.program.walletPubkey,
job: {
name: "Buffer Job",
data: Buffer.from(
OracleJob.encodeDelimited(
OracleJob.create({
tasks: [
@ -70,44 +70,23 @@ describe("anchor-buffer-parser test", () => {
],
})
).finish()
);
const jobKeypair = anchor.web3.Keypair.generate();
const jobAccount = await JobAccount.create(switchboard.program, {
data: jobData,
keypair: jobKeypair,
authority: payer.publicKey,
),
},
});
const bufferAccount = await BufferRelayerAccount.create(
switchboard.program,
{
name: Buffer.from("My Buffer").slice(0, 32),
minUpdateDelaySeconds: 30,
queueAccount: switchboard.queue,
authority: payer.publicKey,
jobAccount,
}
);
console.log(`BufferRelayer ${bufferAccount.publicKey}`);
const permissionAccount = await PermissionAccount.create(
switchboard.program,
const [buffer, openRoundSignature] =
await bufferAccount.openRoundAndAwaitResult(
{
granter: switchboard.queue.publicKey,
grantee: bufferAccount.publicKey,
authority: queue.authority,
}
tokenWallet: switchboard.payerTokenWallet,
},
30_000
);
// call openRound
bufferAccount
.openRound()
.then((sig) => console.log(`OpenRound Txn: ${sig}`));
const buf = await awaitCallback(bufferAccount, 30_000);
console.log(`Current Buffer Result: [${new Uint8Array(buf).toString()}]`);
console.log(
`Current Buffer Result: [${new Uint8Array(buffer.result).toString()}]`
);
const signature = await bufferParserProgram.methods
.readResult({ expectedResult: expectedResult })
@ -128,52 +107,3 @@ describe("anchor-buffer-parser test", () => {
console.log(JSON.stringify(logs?.meta?.logMessages, undefined, 2));
});
});
async function awaitCallback(
bufferAccount: BufferRelayerAccount,
timeoutInterval: number,
errorMsg = "Timed out waiting for Buffer Relayer open round."
) {
const acctCoder = new anchor.BorshAccountsCoder(bufferAccount.program.idl);
let ws: number | undefined = undefined;
const result: Buffer = await promiseWithTimeout(
timeoutInterval,
new Promise(
(resolve: (result: Buffer) => void, reject: (reason: string) => void) => {
ws = bufferAccount.program.provider.connection.onAccountChange(
bufferAccount.publicKey,
async (
accountInfo: anchor.web3.AccountInfo<Buffer>,
context: anchor.web3.Context
) => {
const buf = acctCoder.decode(
"BufferRelayerAccountData",
accountInfo.data
);
const bufResult = buf.result as Buffer;
if (bufResult.byteLength > 0) {
resolve(bufResult);
}
}
);
}
).finally(async () => {
if (ws) {
await bufferAccount.program.provider.connection.removeAccountChangeListener(
ws
);
}
ws = undefined;
}),
new Error(errorMsg)
).finally(async () => {
if (ws) {
await bufferAccount.program.provider.connection.removeAccountChangeListener(
ws
);
}
ws = undefined;
});
return result;
}

View File

@ -4,7 +4,7 @@ members = [
]
[programs.localnet]
anchor_feed_parser = "5cjAZXFoY4KN1Sq35ZYE72fGdVy8sy5YGpNix1N4rtHY"
anchor_feed_parser = "Fstf3oTcBxHMZFaoBzxk5oSkTh5HaAjxjh6zcgdZpNBb"
[provider]
cluster = "devnet"

View File

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

View File

@ -8,8 +8,10 @@
"name": "anchor-feed-parser",
"version": "1.0.0",
"dependencies": {
"@project-serum/anchor": "^0.25.0",
"@solana/web3.js": "^1.66.2"
"@project-serum/anchor": "^0.26.0",
"@solana/web3.js": "^1.70.1",
"@switchboard-xyz/common": "^2.1.8",
"@switchboard-xyz/solana.js": "^2.0.52"
},
"devDependencies": {
"@types/chai": "^4.3.0",
@ -33,6 +35,21 @@
"node": ">=6.9.0"
}
},
"node_modules/@coral-xyz/borsh": {
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/@coral-xyz/borsh/-/borsh-0.26.0.tgz",
"integrity": "sha512-uCZ0xus0CszQPHYfWAqKS5swS1UxvePu83oOF+TWpUkedsNlg6p2p4azxZNSSqwXb9uXMFgxhuMBX9r3Xoi0vQ==",
"dependencies": {
"bn.js": "^5.1.2",
"buffer-layout": "^1.2.0"
},
"engines": {
"node": ">=10"
},
"peerDependencies": {
"@solana/web3.js": "^1.68.0"
}
},
"node_modules/@cspotcode/source-map-support": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
@ -104,17 +121,17 @@
]
},
"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==",
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.26.0.tgz",
"integrity": "sha512-Nq+COIjE1135T7qfnOHEn7E0q39bQTgXLFk837/rgFe6Hkew9WML7eHsS+lSYD2p3OJaTiUOHTAq1lHy36oIqQ==",
"dependencies": {
"@project-serum/borsh": "^0.2.5",
"@solana/web3.js": "^1.36.0",
"@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": "^5.3.1",
"camelcase": "^6.3.0",
"cross-fetch": "^3.1.5",
"crypto-hash": "^1.3.0",
"eventemitter3": "^4.0.7",
@ -148,6 +165,60 @@
"@solana/web3.js": "^1.2.0"
}
},
"node_modules/@protobufjs/aspromise": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
"integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ=="
},
"node_modules/@protobufjs/base64": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",
"integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg=="
},
"node_modules/@protobufjs/codegen": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz",
"integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg=="
},
"node_modules/@protobufjs/eventemitter": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz",
"integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q=="
},
"node_modules/@protobufjs/fetch": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz",
"integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==",
"dependencies": {
"@protobufjs/aspromise": "^1.1.1",
"@protobufjs/inquire": "^1.1.0"
}
},
"node_modules/@protobufjs/float": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",
"integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ=="
},
"node_modules/@protobufjs/inquire": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz",
"integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q=="
},
"node_modules/@protobufjs/path": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",
"integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA=="
},
"node_modules/@protobufjs/pool": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
"integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw=="
},
"node_modules/@protobufjs/utf8": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",
"integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw=="
},
"node_modules/@solana/buffer-layout": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.0.tgz",
@ -159,10 +230,40 @@
"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": {
"version": "1.66.2",
"resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.66.2.tgz",
"integrity": "sha512-RyaHMR2jGmaesnYP045VLeBGfR/gAW3cvZHzMFGg7bkO+WOYOYp1nEllf0/la4U4qsYGKCsO9eEevR5fhHiVHg==",
"version": "1.70.1",
"resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.70.1.tgz",
"integrity": "sha512-AnaqCF1cJ3w7d0yhvLGAKAcRI+n5o+ursQihhoTe4cUh8/9d4gbT73SoHYElS7e67OtAgLmSfbcC5hcOAgdvnQ==",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@noble/ed25519": "^1.7.0",
@ -207,6 +308,73 @@
"ieee754": "^1.2.1"
}
},
"node_modules/@switchboard-xyz/common": {
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.8.tgz",
"integrity": "sha512-mqCDwCtBf3tY2Bvce0USR4m6DsXSqw8rn4luc2sjLL4PPFKCuCZVgzysfkwzwBHoipbnx6odRQ+BIfm35nhWDA==",
"dependencies": {
"big.js": "^6.2.1",
"bn.js": "^5.2.1",
"decimal.js": "^10.4.3",
"protobufjs": "^7.1.2"
}
},
"node_modules/@switchboard-xyz/solana.js": {
"version": "2.0.52",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/solana.js/-/solana.js-2.0.52.tgz",
"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": {
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
@ -266,8 +434,7 @@
"node_modules/@types/node": {
"version": "17.0.45",
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz",
"integrity": "sha1-LA+v14cF56GLeQa1IBpSJxncUZA= sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==",
"dev": true
"integrity": "sha1-LA+v14cF56GLeQa1IBpSJxncUZA= sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw=="
},
"node_modules/@types/ws": {
"version": "7.4.7",
@ -400,6 +567,18 @@
}
]
},
"node_modules/big.js": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/big.js/-/big.js-6.2.1.tgz",
"integrity": "sha512-bCtHMwL9LeDIozFn+oNhhFoq+yQ3BNdnsLSASUxLciOb1vgvpHsIO1dsENiGMgbb4SkP5TrzWzRiLddn8ahVOQ==",
"engines": {
"node": "*"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/bigjs"
}
},
"node_modules/bigint-buffer": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/bigint-buffer/-/bigint-buffer-1.1.5.tgz",
@ -412,6 +591,14 @@
"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": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
@ -531,11 +718,14 @@
}
},
"node_modules/camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha1-48mzFWnhBoEd8kL3FXJaH0xJQyA= sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
"integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==",
"engines": {
"node": ">=6"
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/chai": {
@ -697,6 +887,11 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/decimal.js": {
"version": "10.4.3",
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz",
"integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA=="
},
"node_modules/deep-eql": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
@ -1169,6 +1364,11 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/long": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/long/-/long-5.2.1.tgz",
"integrity": "sha512-GKSNGeNAtw8IryjjkhZxuKB3JzlcLTwjtiQCHKvqQet81I93kXslhDQruGI/QsddO83mcDToBVy7GqGS/zYf/A=="
},
"node_modules/loupe": {
"version": "2.3.4",
"resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.4.tgz",
@ -1467,6 +1667,29 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/protobufjs": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.1.2.tgz",
"integrity": "sha512-4ZPTPkXCdel3+L81yw3dG6+Kq3umdWKh7Dc7GW/CpNk4SX3hK58iPCWeCyhVTDrbkNeKrYNZ7EojM5WDaEWTLQ==",
"hasInstallScript": true,
"dependencies": {
"@protobufjs/aspromise": "^1.1.2",
"@protobufjs/base64": "^1.1.2",
"@protobufjs/codegen": "^2.0.4",
"@protobufjs/eventemitter": "^1.1.0",
"@protobufjs/fetch": "^1.1.0",
"@protobufjs/float": "^1.0.2",
"@protobufjs/inquire": "^1.1.0",
"@protobufjs/path": "^1.1.2",
"@protobufjs/pool": "^1.1.0",
"@protobufjs/utf8": "^1.1.0",
"@types/node": ">=13.7.0",
"long": "^5.0.0"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/randombytes": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
@ -2018,18 +2241,6 @@
"node": ">=10"
}
},
"node_modules/yargs-unparser/node_modules/camelcase": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
"integrity": "sha1-VoW5XrIJrJwMF3Rnd4ychN9Yupo= sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==",
"dev": true,
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/yargs/node_modules/yargs-parser": {
"version": "20.2.9",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz",
@ -2070,6 +2281,15 @@
"regenerator-runtime": "^0.13.4"
}
},
"@coral-xyz/borsh": {
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/@coral-xyz/borsh/-/borsh-0.26.0.tgz",
"integrity": "sha512-uCZ0xus0CszQPHYfWAqKS5swS1UxvePu83oOF+TWpUkedsNlg6p2p4azxZNSSqwXb9uXMFgxhuMBX9r3Xoi0vQ==",
"requires": {
"bn.js": "^5.1.2",
"buffer-layout": "^1.2.0"
}
},
"@cspotcode/source-map-support": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
@ -2117,17 +2337,17 @@
"integrity": "sha1-0VNX98In51HZCqBrBaDlz5k7qME= sha512-kbacwGSsH/CTout0ZnZWxnW1B+jH/7r/WAAKLBtrRJ/+CUH7lgmQzl3GTrQua3SGKWNSDsS6lmjnDpIJ5Dxyaw=="
},
"@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==",
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.26.0.tgz",
"integrity": "sha512-Nq+COIjE1135T7qfnOHEn7E0q39bQTgXLFk837/rgFe6Hkew9WML7eHsS+lSYD2p3OJaTiUOHTAq1lHy36oIqQ==",
"requires": {
"@project-serum/borsh": "^0.2.5",
"@solana/web3.js": "^1.36.0",
"@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": "^5.3.1",
"camelcase": "^6.3.0",
"cross-fetch": "^3.1.5",
"crypto-hash": "^1.3.0",
"eventemitter3": "^4.0.7",
@ -2154,6 +2374,60 @@
"buffer-layout": "^1.2.0"
}
},
"@protobufjs/aspromise": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
"integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ=="
},
"@protobufjs/base64": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",
"integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg=="
},
"@protobufjs/codegen": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz",
"integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg=="
},
"@protobufjs/eventemitter": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz",
"integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q=="
},
"@protobufjs/fetch": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz",
"integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==",
"requires": {
"@protobufjs/aspromise": "^1.1.1",
"@protobufjs/inquire": "^1.1.0"
}
},
"@protobufjs/float": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",
"integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ=="
},
"@protobufjs/inquire": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz",
"integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q=="
},
"@protobufjs/path": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",
"integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA=="
},
"@protobufjs/pool": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
"integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw=="
},
"@protobufjs/utf8": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",
"integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw=="
},
"@solana/buffer-layout": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.0.tgz",
@ -2162,10 +2436,31 @@
"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": {
"version": "1.66.2",
"resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.66.2.tgz",
"integrity": "sha512-RyaHMR2jGmaesnYP045VLeBGfR/gAW3cvZHzMFGg7bkO+WOYOYp1nEllf0/la4U4qsYGKCsO9eEevR5fhHiVHg==",
"version": "1.70.1",
"resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.70.1.tgz",
"integrity": "sha512-AnaqCF1cJ3w7d0yhvLGAKAcRI+n5o+ursQihhoTe4cUh8/9d4gbT73SoHYElS7e67OtAgLmSfbcC5hcOAgdvnQ==",
"requires": {
"@babel/runtime": "^7.12.5",
"@noble/ed25519": "^1.7.0",
@ -2195,6 +2490,65 @@
}
}
},
"@switchboard-xyz/common": {
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/common/-/common-2.1.8.tgz",
"integrity": "sha512-mqCDwCtBf3tY2Bvce0USR4m6DsXSqw8rn4luc2sjLL4PPFKCuCZVgzysfkwzwBHoipbnx6odRQ+BIfm35nhWDA==",
"requires": {
"big.js": "^6.2.1",
"bn.js": "^5.2.1",
"decimal.js": "^10.4.3",
"protobufjs": "^7.1.2"
}
},
"@switchboard-xyz/solana.js": {
"version": "2.0.52",
"resolved": "https://registry.npmjs.org/@switchboard-xyz/solana.js/-/solana.js-2.0.52.tgz",
"integrity": "sha512-ppM64vBeR8DZ9RYeVi7mhG4OwwLvBOYAlitaa7v32/43Qlz7rHokdRkyQPYh50mr2rRiebVlpMINh6ZD6tWP6A==",
"requires": {
"@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"
},
"dependencies": {
"@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==",
"requires": {
"@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"
}
},
"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": {
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
@ -2256,8 +2610,7 @@
"@types/node": {
"version": "17.0.45",
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz",
"integrity": "sha1-LA+v14cF56GLeQa1IBpSJxncUZA= sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==",
"dev": true
"integrity": "sha1-LA+v14cF56GLeQa1IBpSJxncUZA= sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw=="
},
"@types/ws": {
"version": "7.4.7",
@ -2354,6 +2707,11 @@
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
"integrity": "sha1-GxtEAWClv3rUC2UPCVljSBkDkwo= sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
},
"big.js": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/big.js/-/big.js-6.2.1.tgz",
"integrity": "sha512-bCtHMwL9LeDIozFn+oNhhFoq+yQ3BNdnsLSASUxLciOb1vgvpHsIO1dsENiGMgbb4SkP5TrzWzRiLddn8ahVOQ=="
},
"bigint-buffer": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/bigint-buffer/-/bigint-buffer-1.1.5.tgz",
@ -2362,6 +2720,11 @@
"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": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
@ -2454,9 +2817,9 @@
}
},
"camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha1-48mzFWnhBoEd8kL3FXJaH0xJQyA= sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg=="
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
"integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA=="
},
"chai": {
"version": "4.3.6",
@ -2578,6 +2941,11 @@
"integrity": "sha1-qkcte/Zg6xXzSU79UxyrfypwmDc= sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==",
"dev": true
},
"decimal.js": {
"version": "10.4.3",
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz",
"integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA=="
},
"deep-eql": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz",
@ -2915,6 +3283,11 @@
"is-unicode-supported": "^0.1.0"
}
},
"long": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/long/-/long-5.2.1.tgz",
"integrity": "sha512-GKSNGeNAtw8IryjjkhZxuKB3JzlcLTwjtiQCHKvqQet81I93kXslhDQruGI/QsddO83mcDToBVy7GqGS/zYf/A=="
},
"loupe": {
"version": "2.3.4",
"resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.4.tgz",
@ -3134,6 +3507,25 @@
"integrity": "sha1-O6ODNzNkbZ0+SZWUbBNlpn+wekI= sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true
},
"protobufjs": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.1.2.tgz",
"integrity": "sha512-4ZPTPkXCdel3+L81yw3dG6+Kq3umdWKh7Dc7GW/CpNk4SX3hK58iPCWeCyhVTDrbkNeKrYNZ7EojM5WDaEWTLQ==",
"requires": {
"@protobufjs/aspromise": "^1.1.2",
"@protobufjs/base64": "^1.1.2",
"@protobufjs/codegen": "^2.0.4",
"@protobufjs/eventemitter": "^1.1.0",
"@protobufjs/fetch": "^1.1.0",
"@protobufjs/float": "^1.0.2",
"@protobufjs/inquire": "^1.1.0",
"@protobufjs/path": "^1.1.2",
"@protobufjs/pool": "^1.1.0",
"@protobufjs/utf8": "^1.1.0",
"@types/node": ">=13.7.0",
"long": "^5.0.0"
}
},
"randombytes": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
@ -3521,14 +3913,6 @@
"decamelize": "^4.0.0",
"flat": "^5.0.2",
"is-plain-obj": "^2.1.0"
},
"dependencies": {
"camelcase": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
"integrity": "sha1-VoW5XrIJrJwMF3Rnd4ychN9Yupo= sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==",
"dev": true
}
}
},
"yn": {

View File

@ -12,8 +12,10 @@
"lint": "eslint --ext .js,.json,.ts 'src/**' --fix"
},
"dependencies": {
"@project-serum/anchor": "^0.25.0",
"@solana/web3.js": "^1.66.2"
"@project-serum/anchor": "^0.26.0",
"@solana/web3.js": "^1.70.1",
"@switchboard-xyz/common": "^2.1.8",
"@switchboard-xyz/solana.js": "^2.0.52"
},
"devDependencies": {
"@types/chai": "^4.3.0",

View File

@ -3,7 +3,7 @@ use anchor_lang::solana_program::clock;
use std::convert::TryInto;
pub use switchboard_v2::{AggregatorAccountData, SwitchboardDecimal, SWITCHBOARD_PROGRAM_ID};
declare_id!("5cjAZXFoY4KN1Sq35ZYE72fGdVy8sy5YGpNix1N4rtHY");
declare_id!("Fstf3oTcBxHMZFaoBzxk5oSkTh5HaAjxjh6zcgdZpNBb");
#[derive(Accounts)]
#[instruction(params: ReadResultParams)]

View File

@ -1,8 +1,11 @@
import * as anchor from "@project-serum/anchor";
import { PublicKey } from "@solana/web3.js";
import { sleep, SwitchboardTestContext } from "@switchboard-xyz/sbv2-utils";
import type { AnchorWallet } from "@switchboard-xyz/switchboard-v2";
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;
@ -31,7 +34,9 @@ describe("anchor-feed-parser test", () => {
let switchboard: SwitchboardTestContext;
let aggregatorKey: PublicKey;
console.log(`rpc: ${feedParserProgram.provider.connection.rpcEndpoint}`);
console.log(
`devnet tests rpc: ${feedParserProgram.provider.connection.rpcEndpoint}`
);
before(async () => {
try {

View File

@ -1,16 +1,16 @@
import * as anchor from "@project-serum/anchor";
import { Connection } from "@solana/web3.js";
import { sleep, SwitchboardTestContext } from "@switchboard-xyz/sbv2-utils";
import type {
import { sleep } from "@switchboard-xyz/common";
import {
AggregatorAccount,
AnchorWallet,
} from "@switchboard-xyz/switchboard-v2";
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 test", () => {
describe("anchor-feed-parser localnet test", () => {
const tomlProvider = anchor.AnchorProvider.env();
const provider = new anchor.AnchorProvider(
new Connection("http://localhost:8899"),
@ -25,35 +25,27 @@ describe("anchor-feed-parser test", () => {
const feedParserProgram = new anchor.Program(
IDL,
PROGRAM_ID,
provider,
new anchor.BorshCoder(IDL)
provider
) as anchor.Program<AnchorFeedParser>;
const payer = (provider.wallet as AnchorWallet).payer;
let switchboard: SwitchboardTestContext;
let aggregatorAccount: AggregatorAccount;
before(async () => {
try {
switchboard = await SwitchboardTestContext.loadFromEnv(provider);
console.log("local env detected");
return;
} catch (error: any) {
console.log(`Error: SBV2 Localnet - ${error.message}`);
console.error(error);
}
throw new Error(`Failed to load the localnet Switchboard environment`);
});
it("Creates a static feed that resolves to 100", async () => {
aggregatorAccount = await switchboard.createStaticFeed(100);
[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 })
@ -73,6 +65,10 @@ describe("anchor-feed-parser test", () => {
});
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 })
@ -86,6 +82,10 @@ describe("anchor-feed-parser test", () => {
});
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

View File

@ -5,14 +5,11 @@
"module": "CommonJS",
"noEmit": true,
"esModuleInterop": true,
"moduleResolution": "node16",
"paths": {
"@switchboard-xyz/switchboard-v2": ["../../javascript/switchboard-v2"],
"@switchboard-xyz/sbv2-utils": ["../../javascript/sbv2-utils"]
"@switchboard-xyz/solana.js": ["../../javascript/solana.js"]
}
},
"include": ["tests/**/*", "client/**/*", "./target/types/anchor_feed_parser"],
"references": [
{ "path": "../../javascript/switchboard-v2" },
{ "path": "../../javascript/sbv2-utils" }
]
"references": [{ "path": "../../javascript/solana.js" }]
}

View File

@ -12,10 +12,9 @@ anchor_history_parser = "C7rn1qJkq9FjTwV86RrY5Uih91NgymRVLdJ81rqLNXRS"
url = "https://anchor.projectserum.com"
[provider]
cluster = "devnet"
# cluster = "localnet"
wallet = "../../../payer-keypair.json"
# wallet = "~/.config/solana/id.json"
# cluster = "devnet"
cluster = "localnet"
wallet = "~/.config/solana/id.json"
[scripts]

View File

@ -20,7 +20,7 @@ cpi = ["no-entrypoint"]
overflow-checks = true
[dependencies]
# switchboard-v2 = { path = "../../rust/switchboard-v2" }
switchboard-v2 = { version = "^0.1.16" }
anchor-lang = "0.25.0"
solana-program = "~1.10.29"
switchboard-v2 = { path = "../../rust/switchboard-v2" }
# switchboard-v2 = { version = "^0.1.17" }
anchor-lang = "^0.26.0"
solana-program = "^1.13.6"

File diff suppressed because it is too large Load Diff

View File

@ -4,10 +4,9 @@
"lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check"
},
"dependencies": {
"@project-serum/anchor": "^0.25.0",
"@switchboard-xyz/common": "^2.1.7",
"@switchboard-xyz/sbv2-utils": "^0.1.53",
"@switchboard-xyz/switchboard-v2": "^0.0.165"
"@project-serum/anchor": "^0.26.0",
"@switchboard-xyz/common": "^2.1.8",
"@switchboard-xyz/solana.js": "^2.0.52"
},
"devDependencies": {
"@types/bn.js": "^5.1.0",

View File

@ -1,14 +1,12 @@
/** This test will only work on devnet because we need a populated history to read */
import * as anchor from "@project-serum/anchor";
import { Program } from "@project-serum/anchor";
import { SwitchboardTestContext } from "@switchboard-xyz/sbv2-utils";
import { OracleJob } from "@switchboard-xyz/common";
import {
AggregatorAccount,
JobAccount,
loadSwitchboardProgram,
programWallet,
} from "@switchboard-xyz/switchboard-v2";
SwitchboardTestContext,
} from "@switchboard-xyz/solana.js";
import { AnchorHistoryParser } from "../target/types/anchor_history_parser";
export const AGGREGATOR_PUBKEY: anchor.web3.PublicKey =
@ -51,20 +49,16 @@ describe("anchor-history-parser", () => {
* Note: This will not update until added to a crank or manually calling openRound
*/
it("Creates a feed with a history buffer", async () => {
const aggregatorAccount = await AggregatorAccount.create(
switchboard.program,
{
name: Buffer.from("History Aggregator"),
[aggregatorAccount] = await switchboard.queue.createFeed({
name: "History Aggregator",
batchSize: 1,
minRequiredOracleResults: 1,
minRequiredJobResults: 1,
minUpdateDelaySeconds: 30,
queueAccount: switchboard.queue,
}
);
const jobAccount = await JobAccount.create(switchboard.program, {
name: Buffer.from("Example Job"),
authority: anchor.web3.PublicKey.default,
historyLimit: 200_000,
jobs: [
{
name: "Job 1",
data: Buffer.from(
OracleJob.encodeDelimited(
OracleJob.create({
@ -78,21 +72,22 @@ describe("anchor-history-parser", () => {
})
).finish()
),
},
],
});
await aggregatorAccount.addJob(jobAccount);
const historyBufferKeypair = anchor.web3.Keypair.generate();
await aggregatorAccount.setHistoryBuffer({ size: 200_000 });
const aggregator = await aggregatorAccount.loadData();
const history = await aggregatorAccount.history.loadData();
});
/** Example showing how to read a history buffer on-chain for an existing feed with an existing history buffer with pre-populated samples. (This will only work on devnet) */
it("Reads an aggregator history buffer", async () => {
// const ONE_HOUR_AGO: number = Math.floor(Date.now()) - 60 * 60;
const aggregatorAccount = new AggregatorAccount({
program: switchboard.program,
publicKey: AGGREGATOR_PUBKEY,
});
const aggregatorAccount = new AggregatorAccount(
switchboard.program,
AGGREGATOR_PUBKEY
);
const aggregator = await aggregatorAccount.loadData();
// TODO: Verify the value in the program logs matches the history samples

View File

@ -1,21 +1,21 @@
[workspace]
members = [
"programs/*"
"."
]
[provider]
cluster = "devnet"
# cluster = "localnet"
# cluster = "devnet"
cluster = "localnet"
wallet = "~/.config/solana/id.json"
[programs.localnet]
anchor_vrf_parser = "HjjRFjCyQH3ne6Gg8Yn3TQafrrYecRrphwLwnh2A26vM"
anchor_vrf_parser = "4wTeTACfwiXqqvy44bNBB3V2rFjmSTXVoEr4ZAYamJEN"
[registry]
url = "https://anchor.projectserum.com"
[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 ./tests/*.test.ts"
test = "yarn run ts-mocha -p ./tsconfig.json -t 30000 ./tests/*.test.ts"
[test.validator]
url="https://api.devnet.solana.com"

View File

@ -17,9 +17,9 @@ no-log-ix-name = []
cpi = ["no-entrypoint"]
[dependencies]
# switchboard-v2 = { path = "../../rust/switchboard-v2" }
switchboard-v2 = { version = "^0.1.16" }
anchor-lang = "^0.25.0"
anchor-spl = "^0.25.0"
solana-program = "~1.10.29"
switchboard-v2 = { path = "../../rust/switchboard-v2" }
# switchboard-v2 = { version = "^0.1.16" }
anchor-lang = "^0.26.0"
anchor-spl = "^0.26.0"
solana-program = "~1.14.0"
bytemuck = "1.7.2"

File diff suppressed because it is too large Load Diff

View File

@ -15,18 +15,18 @@
"lint": "eslint --ext .js,.json,.ts 'src/**' --fix"
},
"dependencies": {
"@project-serum/anchor": "^0.25.0",
"@coral-xyz/anchor": "^0.26.0",
"@coral-xyz/borsh": "^0.26.0",
"@project-serum/borsh": "^0.2.5",
"@solana/spl-token": "^0.3.6",
"@solana/web3.js": "^1.67.0",
"@switchboard-xyz/sbv2-utils": "^0.1.53",
"@switchboard-xyz/switchboard-v2": "^0.0.168",
"@switchboard-xyz/common": "^2.1.8",
"@switchboard-xyz/solana.js": "^2.0.52",
"chalk": "^4.1.2",
"dotenv": "^16.0.1",
"yargs": "^17.5.1"
},
"devDependencies": {
"@switchboard-xyz/cli": "^2.0.23",
"@types/chai": "^4.3.0",
"@types/mocha": "^9.0.0",
"@types/node": "^17.0.45",

View File

@ -6,7 +6,7 @@ use anchor_spl::token::TokenAccount;
pub use switchboard_v2::SWITCHBOARD_PROGRAM_ID;
declare_id!("HjjRFjCyQH3ne6Gg8Yn3TQafrrYecRrphwLwnh2A26vM");
declare_id!("4wTeTACfwiXqqvy44bNBB3V2rFjmSTXVoEr4ZAYamJEN");
const MAX_RESULT: u64 = u64::MAX;

View File

@ -1,27 +1,24 @@
import * as anchor from "@project-serum/anchor";
import { AnchorProvider } from "@project-serum/anchor";
import * as spl from "@solana/spl-token-v2";
import "mocha";
import * as anchor from "@coral-xyz/anchor";
import { AnchorProvider } from "@coral-xyz/anchor";
import {
SystemProgram,
SYSVAR_RECENT_BLOCKHASHES_PUBKEY,
} from "@solana/web3.js";
import {
promiseWithTimeout,
sleep,
SwitchboardTestContext,
} from "@switchboard-xyz/sbv2-utils";
import { AnchorVrfParser, IDL } from "../target/types/anchor_vrf_parser";
import { VrfClient } from "../client/accounts";
import { PROGRAM_ID } from "../client/programId";
import {
AnchorWallet,
Callback,
PermissionAccount,
ProgramStateAccount,
SwitchboardPermission,
VrfAccount,
} from "@switchboard-xyz/switchboard-v2";
import "mocha";
import { AnchorVrfParser, IDL } from "../target/types/anchor_vrf_parser";
import { VrfClient } from "../client/accounts";
import { PROGRAM_ID } from "../client/programId";
SwitchboardTestContext,
types,
} from "@switchboard-xyz/solana.js";
import { sleep } from "@switchboard-xyz/common";
import { TOKEN_PROGRAM_ID } from "@solana/spl-token";
describe("anchor-vrf-parser test", () => {
const provider = AnchorProvider.env();
@ -98,65 +95,28 @@ describe("anchor-vrf-parser test", () => {
);
});
beforeEach(async () => {
const maxTime = 60000;
const retryCount = 10;
const retryInterval = maxTime / retryCount;
let isReady = false;
const timer = setInterval(async () => {
const queue = await switchboard.queue.loadData();
const oracles = queue.queue as anchor.web3.PublicKey[];
if (oracles.length > 0) {
// console.log(`oracle ready, ${oracles.length}`);
isReady = true;
clearTimeout(timer);
} else {
// console.log(`oracle not ready, ${oracles.length}`);
}
}, retryInterval);
let n = maxTime / 1000;
while (!isReady && n > 0) {
if (isReady) {
// console.log(`finally ready`);
break;
}
// console.log(`still not ready ${n} ...`);
await sleep(1 * 1000);
--n;
}
if (!isReady) {
throw new Error(`Docker oracle failed to initialize in 60seconds`);
}
clearTimeout(timer);
});
it("Creates a vrfClient account", async () => {
const queue = switchboard.queue;
const { unpermissionedVrfEnabled, authority, dataBuffer } =
await queue.loadData();
// Create Switchboard VRF and Permission account
const vrfAccount = await VrfAccount.create(switchboard.program, {
queue,
const [vrfAccount] = await queue.createVrf({
callback: vrfClientCallback,
authority: vrfClientKey, // vrf authority
keypair: vrfSecret,
vrfKeypair: vrfSecret,
enable: false,
});
console.log(`Created VRF Account: ${vrfAccount.publicKey}`);
const permissionAccount = await PermissionAccount.create(
switchboard.program,
{
const [permissionAccount, permissionBump] = PermissionAccount.fromSeed(
queue.program,
authority,
granter: queue.publicKey,
grantee: vrfAccount.publicKey,
}
queue.publicKey,
vrfAccount.publicKey
);
console.log(`Created Permission Account: ${permissionAccount.publicKey}`);
// If queue requires permissions to use VRF, check the correct authority was provided
@ -168,8 +128,8 @@ describe("anchor-vrf-parser test", () => {
}
await permissionAccount.set({
authority: payer,
permission: SwitchboardPermission.PERMIT_VRF_REQUESTS,
queueAuthority: payer,
permission: new types.SwitchboardPermission.PermitVrfRequests(),
enable: true,
});
console.log(`Set VRF Permissions`);
@ -190,32 +150,22 @@ describe("anchor-vrf-parser test", () => {
.rpc();
console.log(`Created VrfClient Account: ${vrfClientKey}`);
// Get required switchboard accounts
const [programStateAccount, programStateBump] =
ProgramStateAccount.fromSeed(switchboard.program);
const [permissionKey, permissionBump] = PermissionAccount.fromSeed(
switchboard.program,
authority,
queue.publicKey,
vrfAccount.publicKey
);
const mint = await programStateAccount.getTokenMint();
const payerTokenAccount = await spl.getOrCreateAssociatedTokenAccount(
provider.connection,
payer,
mint.address,
payer.publicKey
const [payerTokenWallet] =
await switchboard.program.mint.getOrCreateWrappedUser(
switchboard.program.walletPubkey,
{ fundUpTo: 0.002 }
);
const { escrow } = await vrfAccount.loadData();
const vrf = await vrfAccount.loadData();
// give account time to propagate to oracle RPCs
await sleep(2000);
// Request randomness
await vrfClientProgram.methods.requestResult!({
switchboardStateBump: programStateBump,
switchboardStateBump: switchboard.program.programState.bump,
permissionBump,
// callback: vrf.callback,
})
.accounts({
state: vrfClientKey,
@ -226,68 +176,30 @@ describe("anchor-vrf-parser test", () => {
queueAuthority: authority,
dataBuffer,
permission: permissionAccount.publicKey,
escrow,
payerWallet: payerTokenAccount.address,
escrow: vrf.escrow,
payerWallet: payerTokenWallet,
payerAuthority: payer.publicKey,
recentBlockhashes: SYSVAR_RECENT_BLOCKHASHES_PUBKEY,
programState: programStateAccount.publicKey,
tokenProgram: spl.TOKEN_PROGRAM_ID,
programState: switchboard.program.programState.publicKey,
tokenProgram: TOKEN_PROGRAM_ID,
})
.rpc();
// .then((sig) => {
// console.log(`RequestRandomness Txn: ${sig}`);
// });
const result = await awaitCallback(
vrfClientProgram.provider.connection,
vrfClientKey,
const result = await vrfAccount.nextResult(
new anchor.BN(vrf.counter.toNumber() + 1),
45_000
);
if (!result.success) {
throw new Error(`Failed to get VRF Result: ${result.status}`);
}
console.log(`VrfClient Result: ${result}`);
const vrfClient = await VrfClient.fetch(
vrfClientProgram.provider.connection,
vrfClientKey
);
console.log(`VrfClient Result: ${vrfClient.result}`);
return;
});
});
async function awaitCallback(
connection: anchor.web3.Connection,
vrfClientKey: anchor.web3.PublicKey,
timeoutInterval: number,
errorMsg = "Timed out waiting for VRF Client callback"
) {
let ws: number | undefined = undefined;
const result: anchor.BN = await promiseWithTimeout(
timeoutInterval,
new Promise(
(
resolve: (result: anchor.BN) => void,
reject: (reason: string) => void
) => {
ws = connection.onAccountChange(
vrfClientKey,
async (
accountInfo: anchor.web3.AccountInfo<Buffer>,
context: anchor.web3.Context
) => {
const clientState = VrfClient.decode(accountInfo.data);
if (clientState.result.gt(new anchor.BN(0))) {
resolve(clientState.result);
}
}
);
}
).finally(async () => {
if (ws) {
await connection.removeAccountChangeListener(ws);
}
ws = undefined;
}),
new Error(errorMsg)
).finally(async () => {
if (ws) {
await connection.removeAccountChangeListener(ws);
}
ws = undefined;
});
return result;
}

View File

@ -12,6 +12,6 @@ no-entrypoint = []
[dependencies]
# switchboard-v2 = { path = "../../rust/switchboard-v2", features = ["devnet"] }
switchboard-v2 = { version = "^0.1.16", features = ["devnet"] }
solana-program = "~1.10.29"
anchor-lang = "^0.25.0"
switchboard-v2 = { version = "^0.1.17", features = ["devnet"] }
solana-program = "~1.14.0"
anchor-lang = "^0.26.0"

File diff suppressed because it is too large Load Diff

View File

@ -14,10 +14,10 @@
"test": "echo \"For workspace native-feed-parser, use the anchor:test script\" && exit 0"
},
"dependencies": {
"@project-serum/anchor": "^0.25.0",
"@project-serum/anchor": "^0.26.0",
"@solana/web3.js": "^1.66.2",
"@switchboard-xyz/sbv2-utils": "^0.1.53",
"@switchboard-xyz/switchboard-v2": "^0.0.165"
"@switchboard-xyz/common": "^2.1.8",
"@switchboard-xyz/solana.js": "^2.0.52"
},
"devDependencies": {
"@types/chai": "^4.3.0",

View File

@ -5,7 +5,7 @@ import {
Transaction,
TransactionInstruction,
} from "@solana/web3.js";
import { SwitchboardTestContext } from "@switchboard-xyz/sbv2-utils";
import { SwitchboardTestContext } from "@switchboard-xyz/solana.js";
import fs from "fs";
import path from "path";
@ -58,7 +58,7 @@ describe("native-feed-parser test", () => {
// If fails, fallback to looking for a local env file
try {
switchboard = await SwitchboardTestContext.loadFromEnv(provider);
const aggregatorAccount = await switchboard.createStaticFeed(100);
const [aggregatorAccount] = await switchboard.createStaticFeed(100);
aggregatorKey = aggregatorAccount.publicKey ?? PublicKey.default;
console.log("local env detected");
return;

View File

@ -8,13 +8,9 @@
"esModuleInterop": true,
"noEmit": true,
"paths": {
"@switchboard-xyz/switchboard-v2": ["../../javascript/switchboard-v2"],
"@switchboard-xyz/sbv2-utils": ["../../javascript/sbv2-utils"]
"@switchboard-xyz/solana.js": ["../../javascript/solana.js"]
}
},
"exclude": ["target"],
"references": [
{ "path": ".../../javascript/switchboard-v2" },
{ "path": "../../javascript/sbv2-utils" }
]
"references": [{ "path": "../../javascript/solana.js" }]
}

View File

@ -6,7 +6,7 @@ description = "A Rust library to interact with Switchboard V2 accounts."
readme = "README.md"
keywords = ["switchboard", "oracle", "solana"]
homepage = "https://docs.switchboard.xyz"
repository = "https://github.com/switchboard-xyz/sbv2-solana/tree/main/libraries/rs"
repository = "https://github.com/switchboard-xyz/sbv2-solana/tree/main/rust/switchboard-v2"
license = "MIT"
documentation = "https://docs.rs/switchboard-v2/"
@ -23,15 +23,10 @@ cpi = ["no-entrypoint"]
devnet = []
[dependencies]
anchor-lang = "0.26.0"
anchor-spl = "0.26.0"
rust_decimal = "1.26.0"
solana-program = "1.1.14"
anchor-lang = "^0.26.0"
anchor-spl = "^0.26.0"
rust_decimal = "^1.18.0"
solana-program = "^1.13.6"
bytemuck = "1.7.2"
superslice = "1"
spl-token = "3.5"
# solana-program = "1.10"
# spl-token = "3.5"
# anchor-lang = { git = "https://github.com/coral-xyz/anchor.git", rev = "66e4295fe0d2cc2456055bea50e8d227492bdbad" }
# anchor-spl = { git = "https://github.com/coral-xyz/anchor.git", rev = "66e4295fe0d2cc2456055bea50e8d227492bdbad" }

View File

@ -102,9 +102,6 @@ impl BufferRelayerAccountData {
}
impl Discriminator for BufferRelayerAccountData {
const DISCRIMINATOR: [u8; 8] = [50, 35, 51, 115, 169, 219, 158, 52];
fn discriminator() -> [u8; 8] {
[50, 35, 51, 115, 169, 219, 158, 52]
}
}
impl Owner for BufferRelayerAccountData {
fn owner() -> solana_program::pubkey::Pubkey {