Skip to main content

Switchboard Logo

@switchboard-xyz/solana.js

A Typescript client to interact with Switchboard V2 on Solana.

Test Status Anchor Test Status

NPM Badge Types Badge

Install

npm i --save @switchboard-xyz/solana.js

Usage

Directory

Load Switchboard Program

import { Connection } from "@solana/web3.js";
import {
SwitchboardProgram,
TransactionObject,
} from "@switchboard-xyz/solana.js";

const program = await SwitchboardProgram.load(
"mainnet-beta",
new Connection("https://api.mainnet-beta.solana.com"),
payerKeypair /** Optional, READ-ONLY if not provided */
);

Create a Queue

import { QueueAccount } from "@switchboard-xyz/solana.js";

const [queueAccount, txnSignature] = await QueueAccount.create(program, {
name: "My Queue",
metadata: "Top Secret",
queueSize: 100,
reward: 0.00001337,
minStake: 10,
oracleTimeout: 60,
slashingEnabled: false,
unpermissionedFeeds: true,
unpermissionedVrf: true,
enableBufferRelayers: false,
});
const queue = await queueAccount.loadData();

Add an Oracle

import { QueueAccount } from "@switchboard-xyz/solana.js";

const queueAccount = new QueueAccount(program, queuePubkey);

const [oracleAccount, oracleInitSignature] = await queueAccount.createOracle({
name: "My Oracle",
metadata: "Oracle #1",
stakeAmount: 10,
});
const oracle = await oracleAccount.loadData();

await oracleAccount.heartbeat();

Create a Data Feed

import { QueueAccount } from "@switchboard-xyz/solana.js";
import { OracleJob } from "@switchboard-xyz/common";

const queueAccount = new QueueAccount(program, queuePubkey);

const [aggregatorAccount, aggregatorInitSignatures] =
await queueAccount.createFeed({
batchSize: 1,
minRequiredOracleResults: 1,
minRequiredJobResults: 1,
minUpdateDelaySeconds: 60,
fundAmount: 2.5, // deposit 2.5 wSOL into the leaseAccount escrow
jobs: [
{ pubkey: jobAccount.publicKey },
{
weight: 2,
data: OracleJob.encodeDelimited(
OracleJob.fromObject({
tasks: [
{
valueTask: {
value: 1,
},
},
],
})
).finish(),
},
],
});
const aggregator = await aggregatorAccount.loadData();

Request a New Value

import { AggregatorAccount } from "@switchboard-xyz/solana.js";

const aggregatorAccount = new AggregatorAccount(program, aggregatorPubkey);

await aggregatorAccount.openRound();

Read a Data Feed

After the oracles respond, read the feed result

import Big from "big.js";
import { AggregatorAccount } from "@switchboard-xyz/solana.js";

const aggregatorAccount = new AggregatorAccount(program, aggregatorPubkey);

const result: Big | null = await aggregatorAccount.fetchLatestValue();
if (result === null) {
throw new Error("Aggregator holds no value");
}
console.log(result.toString());

Add a History Buffer

Optionally, add a history buffer to your feed to store the last N historical samples

import {
AggregatorAccount,
AggregatorHistoryBuffer,
} from "@switchboard-xyz/solana.js";

const aggregatorAccount = new AggregatorAccount(program, aggregatorPubkey);
const aggregator = await aggregatorAccount.loadData();

const [historyBuffer, addHistorySignature] =
await AggregatorHistoryBuffer.create(program, {
aggregatorAccount,
maxSamples: 10000,
});
const history = await historyBuffer.loadData();

Watch Data Feed

Setup a websocket listener to invoke a callback whenever an aggregator is updated

import Big from "big.js";
import { AggregatorAccount } from "@switchboard-xyz/solana.js";

const aggregatorAccount = new AggregatorAccount(program, aggregatorPubkey);

const ws = aggregatorAccount.onChange((aggregator) => {
const result = AggregatorAccount.decodeLatestValue(aggregator);
if (result !== null) {
console.log(result.toString());
}
});

Index

Classes

Functions

Interfaces

Namespaces

Properties

References

Type Aliases

Variables

Properties

combineMrEnclaveSets

combineMrEnclaveSets: any

References

SwitchboardTestContextV2

Renames and re-exports SwitchboardTestContext

containsMrEnclave

Renames and re-exports combineMrEnclaveSets

filterEmptyMrEnclaves

Renames and re-exports combineMrEnclaveSets

Type Aliases

AggregatorAccounts

AggregatorAccounts: { aggregator: { data: AggregatorAccountData; publicKey: PublicKey }; jobs: { data: JobAccountData; publicKey: PublicKey; tasks: OracleJob.ITask[] }[]; lease: { balance: number; bump: number; data: LeaseAccountData; publicKey: PublicKey }; permission: { bump: number; data: PermissionAccountData; publicKey: PublicKey }; queue: { data: OracleQueueAccountData; publicKey: PublicKey } }

Type declaration

AggregatorAccountsJSON

AggregatorAccountsJSON: AggregatorAccountDataJSON & { jobs: (JobAccountDataJSON & { publicKey: PublicKey; tasks: OracleJob.ITask[] })[]; lease: LeaseAccountDataJSON & { bump: number; publicKey: PublicKey } & { balance: number }; permission: PermissionAccountDataJSON & { bump: number; publicKey: PublicKey }; publicKey: PublicKey; queue: OracleQueueAccountDataJSON & { publicKey: PublicKey } }

AggregatorAddJobEvent

AggregatorAddJobEvent: { feedPubkey: anchor.web3.PublicKey; jobPubkey: anchor.web3.PublicKey }

Type declaration

  • feedPubkey: anchor.web3.PublicKey
  • jobPubkey: anchor.web3.PublicKey

AggregatorCrankEvictionEvent

AggregatorCrankEvictionEvent: { aggregatorPubkey: anchor.web3.PublicKey; crankPubkey: anchor.web3.PublicKey; reason?: number; timestamp: BN }

Type declaration

  • aggregatorPubkey: anchor.web3.PublicKey
  • crankPubkey: anchor.web3.PublicKey
  • optionalreason?: number
  • timestamp: BN

AggregatorDefinition

AggregatorDefinition: AccountDefinition<AggregatorAccount> & { lease: LeaseDefinition; permission: PermissionDefinition }

AggregatorHistoryMetrics

AggregatorHistoryMetrics: { averageUpdateDelay: number; averageValue: number; end: types.AggregatorHistoryRow; history: types.AggregatorHistoryRow[]; max: types.AggregatorHistoryRow; maxUpdateIntervalWithJitter: number; min: types.AggregatorHistoryRow; minUpdateDelaySeconds: number; numSamples: number; period: number; standardDeviation: number; start: types.AggregatorHistoryRow; updateCoefficient: number }

Type declaration

AggregatorInitEvent

AggregatorInitEvent: { feedPubkey: anchor.web3.PublicKey }

Type declaration

  • feedPubkey: anchor.web3.PublicKey

AggregatorLockEvent

AggregatorLockEvent: { feedPubkey: anchor.web3.PublicKey }

Type declaration

  • feedPubkey: anchor.web3.PublicKey

AggregatorOpenRoundEvent

AggregatorOpenRoundEvent: { feedPubkey: anchor.web3.PublicKey; jobPubkeys: anchor.web3.PublicKey[]; oraclePubkeys: anchor.web3.PublicKey[]; queueAuthority: anchor.web3.PublicKey; remainingFunds: BN }

Type declaration

  • feedPubkey: anchor.web3.PublicKey
  • jobPubkeys: anchor.web3.PublicKey[]
  • oraclePubkeys: anchor.web3.PublicKey[]
  • queueAuthority: anchor.web3.PublicKey
  • remainingFunds: BN

AggregatorPdaAccounts

AggregatorPdaAccounts: { leaseAccount: LeaseAccount; leaseBump: number; leaseEscrow: PublicKey; permissionAccount: PermissionAccount; permissionBump: number }

Type declaration

AggregatorRemoveJobEvent

AggregatorRemoveJobEvent: { feedPubkey: anchor.web3.PublicKey; jobPubkey: anchor.web3.PublicKey }

Type declaration

  • feedPubkey: anchor.web3.PublicKey
  • jobPubkey: anchor.web3.PublicKey

AggregatorSaveResultAsyncParams

AggregatorSaveResultAsyncParams: SaveResultResponse & (Partial<SaveResultAccounts> & { oracleAccount: OracleAccount })

AggregatorSaveResultEvent

AggregatorSaveResultEvent: { feedPubkey: anchor.web3.PublicKey; jobValues: types.BorshDecimal[]; oraclePubkey: anchor.web3.PublicKey; slot: BN; timestamp: BN; value: types.BorshDecimal }

Type declaration

AggregatorSaveResultSyncParams

AggregatorSaveResultSyncParams: SaveResultResponse & SaveResultAccounts

AggregatorSetAuthorityEvent

AggregatorSetAuthorityEvent: { feedPubkey: anchor.web3.PublicKey; newAuthority: anchor.web3.PublicKey; oldAuthority: anchor.web3.PublicKey }

Type declaration

  • feedPubkey: anchor.web3.PublicKey
  • newAuthority: anchor.web3.PublicKey
  • oldAuthority: anchor.web3.PublicKey

AggregatorSetConfigsEvent

AggregatorSetConfigsEvent: { feedPubkey: anchor.web3.PublicKey }

Type declaration

  • feedPubkey: anchor.web3.PublicKey

AggregatorValueUpdateEvent

AggregatorValueUpdateEvent: { feedPubkey: anchor.web3.PublicKey; oraclePubkeys: anchor.web3.PublicKey[]; oracleValues: types.SwitchboardDecimalFields[]; slot: BN; timestamp: BN; value: types.SwitchboardDecimalFields }

Type declaration

BootstrappedAttestationQueue

BootstrappedAttestationQueue: { attestationQueue: { account: AttestationQueueAccount; authority: PublicKey; publicKey: PublicKey }; program: SwitchboardProgram; verifier: { account: VerifierAccount; permissionAccount: AttestationPermissionAccount; publicKey: PublicKey; signer: Keypair } }

Type declaration

BufferRelayerAccounts

BufferRelayerAccounts: { bufferRelayer: { data: types.BufferRelayerAccountData; publicKey: PublicKey }; escrow: { balance: number; data: spl.Account; publicKey: PublicKey }; permission: { bump: number; data: types.PermissionAccountData; publicKey: PublicKey }; queue: { data: types.OracleQueueAccountData; publicKey: PublicKey } }

Type declaration

BufferRelayerAccountsJSON

BufferRelayerAccountsJSON: types.BufferRelayerAccountDataJSON & { balance: number; permission: types.PermissionAccountDataJSON & { bump: number; publicKey: PublicKey }; publicKey: PublicKey; queue: types.OracleQueueAccountDataJSON & { publicKey: PublicKey } }

BufferRelayerDefinition

BufferRelayerOpenRoundEvent

BufferRelayerOpenRoundEvent: { jobPubkey: anchor.web3.PublicKey; oraclePubkeys: anchor.web3.PublicKey[]; queue: anchor.web3.PublicKey; relayerPubkey: anchor.web3.PublicKey; remainingFunds: BN }

Type declaration

  • jobPubkey: anchor.web3.PublicKey
  • oraclePubkeys: anchor.web3.PublicKey[]
  • queue: anchor.web3.PublicKey
  • relayerPubkey: anchor.web3.PublicKey
  • remainingFunds: BN

BufferRelayerOpenRoundParams

BufferRelayerOpenRoundParams: { bufferRelayer?: types.BufferRelayerAccountData; queue?: types.OracleQueueAccountData; queueAccount?: QueueAccount; tokenWallet?: PublicKey }

Type declaration

BufferRelayerSaveResultParams

BufferRelayerSaveResultParams: { result: Buffer; success: boolean }

Type declaration

  • result: Buffer
  • success: boolean

BufferRelayerSaveResultSyncParams

BufferRelayerSaveResultSyncParams: BufferRelayerSaveResultParams & { escrow: PublicKey; oracleAccount: OracleAccount; oracleAuthority: PublicKey; oracleTokenAccount: PublicKey; permissionAccount: PermissionAccount; permissionBump: number; queueAccount: QueueAccount; queueAuthority: PublicKey; queueDataBuffer: PublicKey }

ContainerRegistryType

ContainerRegistryType: dockerhub | ipfs

CrankAccounts

CrankAccounts: { aggregators: { data: types.AggregatorAccountData; publicKey: PublicKey }[]; crank: { data: types.CrankAccountData; publicKey: PublicKey }; dataBuffer: { data: types.CrankRow[]; publicKey: PublicKey }; queue: { data: types.OracleQueueAccountData; publicKey: PublicKey } }

Type declaration

CrankAccountsJSON

CrankAccountsJSON: Omit<types.CrankAccountDataJSON, dataBuffer> & { dataBuffer: { data: types.CrankRow[]; publicKey: PublicKey }; publicKey: PublicKey }

CrankDefinition

CrankLeaseInsufficientFundsEvent

CrankLeaseInsufficientFundsEvent: { feedPubkey: anchor.web3.PublicKey; leasePubkey: anchor.web3.PublicKey }

Type declaration

  • feedPubkey: anchor.web3.PublicKey
  • leasePubkey: anchor.web3.PublicKey

CrankPopExpectedFailureEvent

CrankPopExpectedFailureEvent: { feedPubkey: anchor.web3.PublicKey; leasePubkey: anchor.web3.PublicKey }

Type declaration

  • feedPubkey: anchor.web3.PublicKey
  • leasePubkey: anchor.web3.PublicKey

CreateBootstrappedQueueParams

CreateBootstrappedQueueParams: AttestationQueueAccountInitParams & { enclaveSigner?: Keypair; registryKey?: RawBuffer; verifierEnclave: RawBuffer }

CreateFunctionParams

CreateFunctionParams: Omit<FunctionAccountInitParams, attestationQueue> & Partial<AttestationPermissionSetParams> & { queueAuthorityPubkey?: PublicKey }

CreateFunctionRequestParams

CreateFunctionRequestParams: Omit<FunctionRequestAccountInitParams, functionAccount> & { keypair?: Keypair }

CreateFunctionRoutineParams

CreateFunctionRoutineParams: Omit<FunctionRoutineAccountInitParams, functionAccount> & { keypair?: Keypair }

CreateQueueBufferRelayerParams

CreateQueueBufferRelayerParams: Omit<Omit<BufferRelayerInit, jobAccount>, queueAccount> & Partial<PermissionSetParams> & { job: JobAccount | PublicKey | Omit<JobInitParams, weight> } & { queueAuthorityPubkey?: PublicKey }

CreateQueueCrankParams

CreateQueueCrankParams: Omit<CrankInitParams, queueAccount>

CreateQueueFeedParams

CreateQueueFeedParams: Omit<Omit<Omit<AggregatorInitParams, queueAccount>, queueAuthority>, authority> & { authority?: PublicKey; crankDataBuffer?: PublicKey; crankPubkey?: PublicKey; historyLimit?: number } & { basePriorityFee?: number; maxPriorityFeeMultiplier?: number; priorityFeeBump?: number; priorityFeeBumpPeriod?: number; slidingWindow?: boolean } & Partial<LeaseInitParams> & Partial<PermissionSetParams> & { jobs?: ({ pubkey: PublicKey; weight?: number } | JobInitParams)[] } & { queueAuthorityPubkey?: PublicKey }

CreateQueueOracleParams

CreateQueueOracleParams: OracleInitParams & Partial<OracleStakeParams> & Partial<PermissionSetParams> & { queueAuthorityPubkey?: PublicKey }

CreateQueueQuoteParams

CreateQueueQuoteParams: Omit<VerifierAccountInitParams, queueAccount> & Partial<AttestationPermissionSetParams> & { queueAuthorityPubkey?: PublicKey } & { createPermissions?: boolean }

CreateQueueVrfParams

CreateQueueVrfParams: Omit<VrfInitParams, queueAccount> & Partial<PermissionSetParams> & { queueAuthorityPubkey?: PublicKey }

CreateVrfLiteParams

CreateVrfLiteParams: VrfLiteInitParams & Partial<PermissionSetParams> & { queueAuthorityPubkey?: PublicKey }

FeedPermissionRevokedEvent

FeedPermissionRevokedEvent: { feedPubkey: anchor.web3.PublicKey; timestamp: BN }

Type declaration

  • feedPubkey: anchor.web3.PublicKey
  • timestamp: BN

FunctionAccountInitParams

FunctionAccountInitParams: FunctionAccountInitSeeds & { attestationQueue: AttestationQueueAccount; authority?: PublicKey; container: string; containerRegistry?: ContainerRegistryType; metadata?: string; mrEnclave?: Buffer | Uint8Array | number[]; name?: string; requestsDisabled?: boolean; requestsFee?: number; requestsRequireAuthorization?: boolean; routinesDisabled?: boolean; routinesFee?: number; routinesRequireAuthorization?: boolean; version?: string }

Parameters for initializing a FunctionAccount

FunctionAccountInitSeeds

FunctionAccountInitSeeds: { creatorSeed?: RawBuffer; recentSlot?: number }

Type declaration

  • optionalcreatorSeed?: RawBuffer
  • optionalrecentSlot?: number

GarbageCollectFailureEvent

GarbageCollectFailureEvent: { queuePubkey: anchor.web3.PublicKey }

Type declaration

  • queuePubkey: anchor.web3.PublicKey

JobAccountsJSON

JobAccountsJSON: types.JobAccountDataJSON & { publicKey: PublicKey; tasks: OracleJob.ITask[] }

LeaseDefinition

LeaseFundEvent

LeaseFundEvent: { amount: BN; funder: anchor.web3.PublicKey; leasePubkey: anchor.web3.PublicKey; timestamp: BN }

Type declaration

  • amount: BN
  • funder: anchor.web3.PublicKey
  • leasePubkey: anchor.web3.PublicKey
  • timestamp: BN

LeaseWithdrawEvent

LeaseWithdrawEvent: { leasePubkey: anchor.web3.PublicKey; newAmount: BN; previousAmount: BN; timestamp: BN; walletPubkey: anchor.web3.PublicKey }

Type declaration

  • leasePubkey: anchor.web3.PublicKey
  • newAmount: BN
  • previousAmount: BN
  • timestamp: BN
  • walletPubkey: anchor.web3.PublicKey

LeaseWithdrawParams

LoadedAggregatorDefinition

LoadedBufferRelayerDefinition

LoadedCrankDefinition

LoadedJobDefinition

LoadedLeaseDefinition

LoadedOracleDefinition

LoadedPermissionDefinition

LoadedProgramStateDefinition

LoadedQueueDefinition

LoadedVrfDefinition

NetworkInitParams

NetworkInitParams: Omit<QueueInitParams, authority> & { authority?: Keypair } & { aggregators?: (CreateQueueFeedParams & { crankIndex?: number })[]; bufferRelayers?: CreateQueueBufferRelayerParams[]; cranks?: CreateQueueCrankParams[]; oracles?: CreateQueueOracleParams[]; vrfs?: CreateQueueVrfParams[] }

Parameters to create a new queue with a set of associated accounts

OnAccountChangeCallback

OnAccountChangeCallback<T>: (accountData: T) => void

Type parameters

  • T

Type declaration

    • (accountData: T): void
    • Callback to pass deserialized account data when updated on-chain


      Parameters

      • accountData: T

      Returns void

OracleAccountsJSON

OracleAccountsJSON: types.OracleAccountDataJSON & { balance: number; permission: types.PermissionAccountDataJSON & { publicKey: PublicKey }; publicKey: PublicKey }

OracleBootedEvent

OracleBootedEvent: { oraclePubkey: anchor.web3.PublicKey; queuePubkey: anchor.web3.PublicKey }

Type declaration

  • oraclePubkey: anchor.web3.PublicKey
  • queuePubkey: anchor.web3.PublicKey

OracleDefinition

OracleDefinition: AccountDefinition<OracleAccount> & { permission: PermissionDefinition }

OracleRewardEvent

OracleRewardEvent: { amount: BN; feedPubkey: anchor.web3.PublicKey; leasePubkey: anchor.web3.PublicKey; oraclePubkey: anchor.web3.PublicKey; roundSlot: BN; timestamp: BN; walletPubkey: anchor.web3.PublicKey }

Type declaration

  • amount: BN
  • feedPubkey: anchor.web3.PublicKey
  • leasePubkey: anchor.web3.PublicKey
  • oraclePubkey: anchor.web3.PublicKey
  • roundSlot: BN
  • timestamp: BN
  • walletPubkey: anchor.web3.PublicKey

OracleSlashEvent

OracleSlashEvent: { amount: BN; feedPubkey: anchor.web3.PublicKey; leasePubkey: anchor.web3.PublicKey; oraclePubkey: anchor.web3.PublicKey; roundSlot: BN; timestamp: BN; walletPubkey: anchor.web3.PublicKey }

Type declaration

  • amount: BN
  • feedPubkey: anchor.web3.PublicKey
  • leasePubkey: anchor.web3.PublicKey
  • oraclePubkey: anchor.web3.PublicKey
  • roundSlot: BN
  • timestamp: BN
  • walletPubkey: anchor.web3.PublicKey

OracleTeeHeartbeatParams

OracleTeeHeartbeatParams: { authority?: Keypair; permission?: [PermissionAccount, number]; queue?: types.OracleQueueAccountData; queueAccount?: QueueAccount; queueAuthority?: PublicKey; quoteKeypair: Keypair; tokenWallet?: PublicKey }

Type declaration

OracleTeeHeartbeatSyncParams

OracleTeeHeartbeatSyncParams: { authority: PublicKey; dataBuffer: PublicKey; gcOracle: PublicKey; oracleQueue: PublicKey; permission: [PermissionAccount, number]; queueAuthority: PublicKey; quote: PublicKey; tokenWallet: PublicKey }

Type declaration

OracleWithdrawEvent

OracleWithdrawEvent: { destinationWallet: anchor.web3.PublicKey; newAmount: BN; oraclePubkey: anchor.web3.PublicKey; previousAmount: BN; timestamp: BN; walletPubkey: anchor.web3.PublicKey }

Type declaration

  • destinationWallet: anchor.web3.PublicKey
  • newAmount: BN
  • oraclePubkey: anchor.web3.PublicKey
  • previousAmount: BN
  • timestamp: BN
  • walletPubkey: anchor.web3.PublicKey

OracleWithdrawParams

PermissionDefinition

PermissionSetEvent

PermissionSetEvent: { enable: boolean; permission: types.SwitchboardPermissionKind; permissionKey: anchor.web3.PublicKey }

Type declaration

PriorityFeeReimburseEvent

PriorityFeeReimburseEvent: { fee: BN; feedPubkey: anchor.web3.PublicKey; slot: BN; timestamp: BN }

Type declaration

  • fee: BN
  • feedPubkey: anchor.web3.PublicKey
  • slot: BN
  • timestamp: BN

ProbationBrokenEvent

ProbationBrokenEvent: { feedPubkey: anchor.web3.PublicKey; queuePubkey: anchor.web3.PublicKey; timestamp: BN }

Type declaration

  • feedPubkey: anchor.web3.PublicKey
  • queuePubkey: anchor.web3.PublicKey
  • timestamp: BN

ProgramStateDefinition

ProgramStateDefinition: PdaAccountDefinition<ProgramStateAccount>

QueueAccounts

QueueAccounts: { dataBuffer: { data: PublicKey[]; publicKey: PublicKey }; oracles: { data: types.OracleAccountData; publicKey: PublicKey }[]; queue: { data: types.OracleQueueAccountData; publicKey: PublicKey } }

Type declaration

QueueAccountsJSON

QueueAccountsJSON: Omit<types.OracleQueueAccountDataJSON, dataBuffer> & { dataBuffer: { data: PublicKey[]; publicKey: PublicKey }; oracles: { data: types.OracleAccountDataJSON; publicKey: PublicKey }[]; publicKey: PublicKey }

QueueDefinition

SaveResultAccounts

SaveResultAccounts: AggregatorPdaAccounts & { aggregator: AggregatorAccountData; historyBuffer?: PublicKey; oracleIdx: number; oraclePermission: [PermissionAccount, number]; oracles: { account: OracleAccount; state: OracleAccountData }[]; queueAccount: QueueAccount; queueAuthority: PublicKey }

SaveResultResponse

SaveResultResponse: { error?: boolean; jobs: OracleJob[]; maxResponse: Big; minResponse: Big; value: Big }

Type declaration

SendTransactionObjectOptions

SendTransactionObjectOptions: TransactionObjectOptions & SendTransactionOptions

SendTransactionOptions

SendTransactionOptions: (ConfirmOptions | SendOptions) & { skipConfrimation?: boolean }

SwitchboardAccount

SwitchboardAccountData

SwitchboardAccountType

SwitchboardAccountType: Aggregator | AggregatorHistory | BufferRelayer | Crank | CrankBuffer | Job | Lease | Oracle | Permission | ProgramState | Queue | QueueBuffer | SlidingWindow | Vrf | Buffer

SwitchboardEvents

SwitchboardEvents: { AggregatorAddJobEvent: AggregatorAddJobEvent; AggregatorCrankEvictionEvent: AggregatorCrankEvictionEvent; AggregatorInitEvent: AggregatorInitEvent; AggregatorLockEvent: AggregatorLockEvent; AggregatorOpenRoundEvent: AggregatorOpenRoundEvent; AggregatorRemoveJobEvent: AggregatorRemoveJobEvent; AggregatorSaveResultEvent: AggregatorSaveResultEvent; AggregatorSetAuthorityEvent: AggregatorSetAuthorityEvent; AggregatorSetConfigsEvent: AggregatorSetConfigsEvent; AggregatorValueUpdateEvent: AggregatorValueUpdateEvent; BufferRelayerOpenRoundEvent: BufferRelayerOpenRoundEvent; CrankLeaseInsufficientFundsEvent: CrankLeaseInsufficientFundsEvent; CrankPopExpectedFailureEvent: CrankPopExpectedFailureEvent; FeedPermissionRevokedEvent: FeedPermissionRevokedEvent; GarbageCollectFailureEvent: GarbageCollectFailureEvent; LeaseFundEvent: LeaseFundEvent; LeaseWithdrawEvent: LeaseWithdrawEvent; OracleBootedEvent: OracleBootedEvent; OracleRewardEvent: OracleRewardEvent; OracleSlashEvent: OracleSlashEvent; OracleWithdrawEvent: OracleWithdrawEvent; PermissionSetEvent: PermissionSetEvent; PriorityFeeReimburseEvent: PriorityFeeReimburseEvent; ProbationBrokenEvent: ProbationBrokenEvent; VrfCallbackPerformedEvent: VrfCallbackPerformedEvent; VrfPoolRequestEvent: VrfPoolRequestEvent; VrfPoolUpdateEvent: VrfPoolUpdateEvent; VrfProveEvent: VrfProveEvent; VrfRequestEvent: VrfRequestEvent; VrfRequestRandomnessEvent: VrfRequestRandomnessEvent; VrfVerifyEvent: VrfVerifyEvent }

Type declaration

SwitchboardTestContextInit

SwitchboardTestContextInit: Omit<Omit<NetworkInitParams, authority>, oracles> & { oracle: Omit<CreateQueueOracleParams, authority> }

SwitchboardWalletFundParams

SwitchboardWalletWithEscrow

SwitchboardWalletWithEscrow: SwitchboardWalletState & { tokenWalletAccount: spl.Account }

TransactionOptions

TransactionOptions: { blockhash: string; lastValidBlockHeight: number } | { minContextSlot: number; nonceInfo: NonceInformation }

TransactionPackOptions

TransactionPackOptions: TransactionObjectOptions & { postIxns?: TransactionInstruction[]; preIxns?: TransactionInstruction[] }

VerifierHeartbeatParams

VerifierHeartbeatParams: Partial<VerifierHeartbeatSyncParams> & { enclaveSigner: Keypair } & Partial<{ queue: types.AttestationQueueAccountData; quote: types.VerifierAccountData }>

Parameters for an types.quoteHeartbeat instruction.

VrfAccounts

VrfAccounts: { escrow: { balance: number; data: spl.Account; publicKey: PublicKey }; permission: { bump: number; data: types.PermissionAccountData; publicKey: PublicKey }; queue: { data: types.OracleQueueAccountData; publicKey: PublicKey }; vrf: { data: types.VrfAccountData; publicKey: PublicKey } }

Type declaration

VrfAccountsJSON

VrfAccountsJSON: Omit<types.VrfAccountDataJSON, escrow> & { escrow: { balance: number; publicKey: PublicKey }; permission: types.PermissionAccountDataJSON & { publicKey: PublicKey }; publicKey: PublicKey; queue: types.OracleQueueAccountDataJSON & { publicKey: PublicKey } }

VrfCallbackPerformedEvent

VrfCallbackPerformedEvent: { amount: BN; oraclePubkey: anchor.web3.PublicKey; vrfPubkey: anchor.web3.PublicKey }

Type declaration

  • amount: BN
  • oraclePubkey: anchor.web3.PublicKey
  • vrfPubkey: anchor.web3.PublicKey

VrfDefinition

VrfLiteDepositParams

VrfLiteDepositParams: { amount: number; tokenAuthority?: Keypair; tokenWallet?: PublicKey }

Type declaration

VrfPoolAccountData

VrfPoolAccountData: types.VrfPoolAccountData & { pool: types.VrfPoolRow[] }

VrfPoolDepositParams

VrfPoolDepositParams: { amount: number; disableWrap?: boolean; tokenAuthority?: Keypair; tokenWallet?: PublicKey }

Type declaration

  • amount: number
  • optionaldisableWrap?: boolean
  • optionaltokenAuthority?: Keypair
  • optionaltokenWallet?: PublicKey

VrfPoolPushNewParams

VrfPoolPushNewParams: CreateVrfLiteParams & Omit<VrfPoolPushParams, vrf> & { queueAccount?: QueueAccount; vrfPool?: types.VrfPoolAccountData }

VrfPoolRequestEvent

VrfPoolRequestEvent: { oraclePubkey: anchor.web3.PublicKey; queuePubkey: anchor.web3.PublicKey; slot: BN; timestamp: BN; vrfPoolPubkey: anchor.web3.PublicKey; vrfPubkey: anchor.web3.PublicKey }

Type declaration

  • oraclePubkey: anchor.web3.PublicKey
  • queuePubkey: anchor.web3.PublicKey
  • slot: BN
  • timestamp: BN
  • vrfPoolPubkey: anchor.web3.PublicKey
  • vrfPubkey: anchor.web3.PublicKey

VrfPoolUpdateEvent

VrfPoolUpdateEvent: { minInterval: number; newSize: number; queuePubkey: anchor.web3.PublicKey; vrfPoolPubkey: anchor.web3.PublicKey; vrfPubkey: anchor.web3.PublicKey }

Type declaration

  • minInterval: number
  • newSize: number
  • queuePubkey: anchor.web3.PublicKey
  • vrfPoolPubkey: anchor.web3.PublicKey
  • vrfPubkey: anchor.web3.PublicKey

VrfProveEvent

VrfProveEvent: { authorityPubkey: anchor.web3.PublicKey; oraclePubkey: anchor.web3.PublicKey; vrfPubkey: anchor.web3.PublicKey }

Type declaration

  • authorityPubkey: anchor.web3.PublicKey
  • oraclePubkey: anchor.web3.PublicKey
  • vrfPubkey: anchor.web3.PublicKey

VrfRequestEvent

VrfRequestEvent: { oraclePubkeys: anchor.web3.PublicKey[]; vrfPubkey: anchor.web3.PublicKey }

Type declaration

  • oraclePubkeys: anchor.web3.PublicKey[]
  • vrfPubkey: anchor.web3.PublicKey

VrfRequestRandomnessEvent

VrfRequestRandomnessEvent: { alpha: Buffer; counter: BN; existingAmount: BN; loadAmount: BN; oraclePubkeys: anchor.web3.PublicKey[]; vrfPubkey: anchor.web3.PublicKey }

Type declaration

  • alpha: Buffer
  • counter: BN
  • existingAmount: BN
  • loadAmount: BN
  • oraclePubkeys: anchor.web3.PublicKey[]
  • vrfPubkey: anchor.web3.PublicKey

VrfVerifyEvent

VrfVerifyEvent: { amount: BN; authorityPubkey: anchor.web3.PublicKey; oraclePubkey: anchor.web3.PublicKey; vrfPubkey: anchor.web3.PublicKey }

Type declaration

  • amount: BN
  • authorityPubkey: anchor.web3.PublicKey
  • oraclePubkey: anchor.web3.PublicKey
  • vrfPubkey: anchor.web3.PublicKey

WithRequired

WithRequired<T, K>: T & { [ P in K ]-?: T[P] }

Type parameters

  • T
  • K: keyof T

Variables

constBUFFER_DISCRIMINATOR

BUFFER_DISCRIMINATOR: Buffer = ...

constDEFAULT_LOCALNET_NETWORK

DEFAULT_LOCALNET_NETWORK: SwitchboardTestContextInit = ...

constDEFAULT_SEND_TRANSACTION_OPTIONS

DEFAULT_SEND_TRANSACTION_OPTIONS: SendTransactionOptions = ...

constDEVNET_GENESIS_HASH

DEVNET_GENESIS_HASH: EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG = "EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG"

constDISCRIMINATOR_MAP

DISCRIMINATOR_MAP: Map<string, SwitchboardAccountType> = ...

constMAINNET_GENESIS_HASH

MAINNET_GENESIS_HASH: 5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d = "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d"

constQUOTE_SEED

QUOTE_SEED: string = "QuoteAccountData"

constREAD_ONLY_KEYPAIR

READ_ONLY_KEYPAIR: any = ...

A generated keypair that is assigned as the payerKeypair when in read-only mode.

constSB_ATTESTATION_PID

SB_ATTESTATION_PID: any = ...

Switchboard’s Attestation Program ID

constSB_V2_PID

SB_V2_PID: any = ...

Switchboard’s V2 Program ID

constSWITCHBOARD_LABS_DEVNET_PERMISSIONED_CRANK

SWITCHBOARD_LABS_DEVNET_PERMISSIONED_CRANK: any = ...

constSWITCHBOARD_LABS_DEVNET_PERMISSIONED_QUEUE

SWITCHBOARD_LABS_DEVNET_PERMISSIONED_QUEUE: any = ...

constSWITCHBOARD_LABS_DEVNET_PERMISSIONLESS_CRANK

SWITCHBOARD_LABS_DEVNET_PERMISSIONLESS_CRANK: any = ...

constSWITCHBOARD_LABS_DEVNET_PERMISSIONLESS_QUEUE

SWITCHBOARD_LABS_DEVNET_PERMISSIONLESS_QUEUE: any = ...

constSWITCHBOARD_LABS_MAINNET_PERMISSIONED_CRANK

SWITCHBOARD_LABS_MAINNET_PERMISSIONED_CRANK: any = ...

constSWITCHBOARD_LABS_MAINNET_PERMISSIONED_QUEUE

SWITCHBOARD_LABS_MAINNET_PERMISSIONED_QUEUE: any = ...

constSWITCHBOARD_LABS_MAINNET_PERMISSIONLESS_CRANK

SWITCHBOARD_LABS_MAINNET_PERMISSIONLESS_CRANK: any = ...

constSWITCHBOARD_LABS_MAINNET_PERMISSIONLESS_QUEUE

SWITCHBOARD_LABS_MAINNET_PERMISSIONLESS_QUEUE: any = ...

constVRF_POOL_REQUEST_AMOUNT

VRF_POOL_REQUEST_AMOUNT: 0.002 = 0.002