added doc comments to generated types

This commit is contained in:
Conner Gallagher 2022-11-30 19:58:43 -07:00
parent 46e68b8f20
commit 872375877d
26 changed files with 752 additions and 79 deletions

View File

@ -45,13 +45,8 @@ export class OracleAccount extends Account<types.OracleAccountData> {
program: SwitchboardProgram, program: SwitchboardProgram,
payer: PublicKey, payer: PublicKey,
params: { params: {
queuePubkey: PublicKey; queueAccount: QueueAccount;
} & Partial<{ } & OracleInitParams
mint: PublicKey;
name: string;
metadata: string;
authority: Keypair; // defaults to payer
}>
): Promise<[TransactionObject, OracleAccount]> { ): Promise<[TransactionObject, OracleAccount]> {
const tokenWallet = Keypair.generate(); const tokenWallet = Keypair.generate();
// console.log(`tokenWallet`, tokenWallet.publicKey.toBase58()); // console.log(`tokenWallet`, tokenWallet.publicKey.toBase58());
@ -60,7 +55,7 @@ export class OracleAccount extends Account<types.OracleAccountData> {
const [oracleAccount, oracleBump] = OracleAccount.fromSeed( const [oracleAccount, oracleBump] = OracleAccount.fromSeed(
program, program,
params.queuePubkey, params.queueAccount.publicKey,
tokenWallet.publicKey tokenWallet.publicKey
); );
@ -104,7 +99,7 @@ export class OracleAccount extends Account<types.OracleAccountData> {
oracleAuthority: authority, oracleAuthority: authority,
wallet: tokenWallet.publicKey, wallet: tokenWallet.publicKey,
programState: program.programState.publicKey, programState: program.programState.publicKey,
queue: params.queuePubkey, queue: params.queueAccount.publicKey,
payer, payer,
systemProgram: SystemProgram.programId, systemProgram: SystemProgram.programId,
} }
@ -125,31 +120,12 @@ export class OracleAccount extends Account<types.OracleAccountData> {
program: SwitchboardProgram, program: SwitchboardProgram,
params: { params: {
queueAccount: QueueAccount; queueAccount: QueueAccount;
} & Partial<{ } & OracleInitParams
name: string;
metadata: string;
mint: PublicKey;
authority: Keypair; // defaults to payer
}>
): Promise<[TransactionSignature, OracleAccount]> { ): Promise<[TransactionSignature, OracleAccount]> {
let mint = params.mint;
if (!mint) {
const queue = await params.queueAccount.loadData();
mint = queue.mint.equals(PublicKey.default)
? spl.NATIVE_MINT
: queue.mint;
}
const [txnObject, oracleAccount] = await OracleAccount.createInstructions( const [txnObject, oracleAccount] = await OracleAccount.createInstructions(
program, program,
program.walletPubkey, program.walletPubkey,
{ params
queuePubkey: params.queueAccount.publicKey,
mint: mint,
name: params.name,
metadata: params.metadata,
authority: params.authority,
}
); );
const txnSignature = await program.signAndSend(txnObject); const txnSignature = await program.signAndSend(txnObject);
@ -371,3 +347,12 @@ export class OracleAccount extends Account<types.OracleAccountData> {
return txnSignature; return txnSignature;
} }
} }
export interface OracleInitParams {
/** Name of the oracle for easier identification. */
name?: string;
/** Metadata of the oracle for easier identification. */
metadata?: string;
/** Alternative keypair that will be the authority for the oracle. If not set the payer will be used. */
authority?: Keypair;
}

View File

@ -15,6 +15,20 @@ export interface PermissionAccountInitParams {
authority: PublicKey; authority: PublicKey;
} }
export type PermissionSetParams =
| {
/** The {@linkcode types.SwitchboardPermission} to set for the grantee. */
permission: boolean;
/** Keypair used to enable heartbeat permissions if payer is not the queue authority. */
queueAuthority?: Keypair;
}
| {
/** Whether to enable PERMIT_ORACLE_HEARTBEAT permissions. **Note:** Requires a provided queueAuthority keypair or payer to be the assigned queue authority. */
enable?: boolean;
/** Keypair used to enable heartbeat permissions if payer is not the queue authority. */
queueAuthority?: Keypair;
};
/** /**
* @class PermissionAccount * @class PermissionAccount
* Account type dictating the level of permissions between a granter and a grantee. * Account type dictating the level of permissions between a granter and a grantee.

View File

@ -24,7 +24,7 @@ import { BufferRelayerAccount, BufferRelayerInit } from './bufferRelayAccount';
import { CrankAccount, CrankInitParams } from './crankAccount'; import { CrankAccount, CrankInitParams } from './crankAccount';
import { JobAccount, JobInitParams } from './jobAccount'; import { JobAccount, JobInitParams } from './jobAccount';
import { LeaseAccount } from './leaseAccount'; import { LeaseAccount } from './leaseAccount';
import { OracleAccount } from './oracleAccount'; import { OracleAccount, OracleInitParams } from './oracleAccount';
import { PermissionAccount } from './permissionAccount'; import { PermissionAccount } from './permissionAccount';
import { VrfAccount, VrfInitParams } from './vrfAccount'; import { VrfAccount, VrfInitParams } from './vrfAccount';
@ -119,22 +119,6 @@ export class QueueAccount extends Account<types.OracleQueueAccountData> {
return this.program.mint.mint; return this.program.mint.mint;
} }
/**
* Create a new QueueAccount.
*/
public static async create(
program: SwitchboardProgram,
params: QueueInitParams
): Promise<[string, QueueAccount]> {
const [txnObject, account] = await this.createInstructions(
program,
program.walletPubkey,
params
);
const txnSignature = await program.signAndSend(txnObject);
return [txnSignature, account];
}
/** /**
* Create a {@linkcode TransactionObject} that contains the Solana TransactionInstructions and signers required to create a new QueueAccount on-chain. * Create a {@linkcode TransactionObject} that contains the Solana TransactionInstructions and signers required to create a new QueueAccount on-chain.
*/ */
@ -216,47 +200,32 @@ export class QueueAccount extends Account<types.OracleQueueAccountData> {
} }
/** /**
* Create a new {@linkcode OracleAccount} for the queue. * Create a new QueueAccount.
*/ */
public async createOracle(params: { public static async create(
name?: string; program: SwitchboardProgram,
metadata?: string; params: QueueInitParams
enable?: boolean; ): Promise<[string, QueueAccount]> {
queueAuthority?: Keypair; const [txnObject, account] = await this.createInstructions(
authority?: Keypair; // defaults to payer program,
}): Promise<[TransactionSignature, OracleAccount]> { program.walletPubkey,
const signers: Keypair[] = [];
const queue = await this.loadData();
if (
params.queueAuthority &&
params.queueAuthority.publicKey.equals(queue.authority)
) {
signers.push(params.queueAuthority);
}
const [txn, oracleAccount] = await this.createOracleInstructions(
this.program.walletPubkey,
params params
); );
const txnSignature = await program.signAndSend(txnObject);
const signature = await this.program.signAndSend(txn); return [txnSignature, account];
return [signature, oracleAccount];
} }
/** /**
* Create a {@linkcode TransactionObject} that can then be used to create a new {@linkcode OracleAccount} for the queue. * Create a {@linkcode TransactionObject} that can then be used to create a new {@linkcode OracleAccount} for the queue.
*/ */
public async createOracleInstructions( public async createOracleInstructions(
/** The publicKey of the account that will pay for the new accounts. Will also be used as the account authority if no other authority is provided. */
payer: PublicKey, payer: PublicKey,
params: { params: OracleInitParams & {
name?: string; /** Whether to enable PERMIT_ORACLE_HEARTBEAT permissions. **Note:** Requires a provided queueAuthority keypair or payer to be the assigned queue authority. */
metadata?: string;
enable?: boolean; enable?: boolean;
/** Keypair used to enable heartbeat permissions if payer is not the queue authority. */
queueAuthority?: Keypair; queueAuthority?: Keypair;
authority?: Keypair; // defaults to payer
} }
): Promise<[TransactionObject, OracleAccount]> { ): Promise<[TransactionObject, OracleAccount]> {
const queue = await this.loadData(); const queue = await this.loadData();
@ -264,7 +233,7 @@ export class QueueAccount extends Account<types.OracleQueueAccountData> {
const [createOracleTxnObject, oracleAccount] = const [createOracleTxnObject, oracleAccount] =
await OracleAccount.createInstructions(this.program, payer, { await OracleAccount.createInstructions(this.program, payer, {
...params, ...params,
queuePubkey: this.publicKey, queueAccount: this,
}); });
const [createPermissionTxnObject, permissionAccount] = const [createPermissionTxnObject, permissionAccount] =
@ -289,6 +258,38 @@ export class QueueAccount extends Account<types.OracleQueueAccountData> {
]; ];
} }
/**
* Create a new {@linkcode OracleAccount} for the queue.
*/
public async createOracle(
params: OracleInitParams & {
/** Whether to enable PERMIT_ORACLE_HEARTBEAT permissions. **Note:** Requires a provided queueAuthority keypair or payer to be the assigned queue authority. */
enable?: boolean;
/** Keypair used to enable heartbeat permissions if payer is not the queue authority. */
queueAuthority?: Keypair;
}
): Promise<[TransactionSignature, OracleAccount]> {
const signers: Keypair[] = [];
const queue = await this.loadData();
if (
params.queueAuthority &&
params.queueAuthority.publicKey.equals(queue.authority)
) {
signers.push(params.queueAuthority);
}
const [txn, oracleAccount] = await this.createOracleInstructions(
this.program.walletPubkey,
params
);
const signature = await this.program.signAndSend(txn);
return [signature, oracleAccount];
}
/** /**
* Create a new {@linkcode AggregatorAccount} for the queue, along with its {@linkcode PermissionAccount} and {@linkcode LeaseAccount}. * Create a new {@linkcode AggregatorAccount} for the queue, along with its {@linkcode PermissionAccount} and {@linkcode LeaseAccount}.
* *

View File

@ -5,116 +5,227 @@ import * as borsh from '@project-serum/borsh'; // eslint-disable-line @typescrip
import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars
export interface AggregatorAccountDataFields { export interface AggregatorAccountDataFields {
/** Name of the aggregator to store on-chain. */
name: Array<number>; name: Array<number>;
/** Metadata of the aggregator to store on-chain. */
metadata: Array<number>; metadata: Array<number>;
/** Reserved. */
reserved1: Array<number>; reserved1: Array<number>;
/** Pubkey of the queue the aggregator belongs to. */
queuePubkey: PublicKey; queuePubkey: PublicKey;
/**
* CONFIGS
* Number of oracles assigned to an update request.
*/
oracleRequestBatchSize: number; oracleRequestBatchSize: number;
/** Minimum number of oracle responses required before a round is validated. */
minOracleResults: number; minOracleResults: number;
/** Minimum number of job results before an oracle accepts a result. */
minJobResults: number; minJobResults: number;
/** Minimum number of seconds required between aggregator rounds. */
minUpdateDelaySeconds: number; minUpdateDelaySeconds: number;
/** Unix timestamp for which no feed update will occur before. */
startAfter: BN; startAfter: BN;
/** Change percentage required between a previous round and the current round. If variance percentage is not met, reject new oracle responses. */
varianceThreshold: types.SwitchboardDecimalFields; varianceThreshold: types.SwitchboardDecimalFields;
/** Number of seconds for which, even if the variance threshold is not passed, accept new responses from oracles. */
forceReportPeriod: BN; forceReportPeriod: BN;
/** Timestamp when the feed is no longer needed. */
expiration: BN; expiration: BN;
/** Counter for the number of consecutive failures before a feed is removed from a queue. If set to 0, failed feeds will remain on the queue. */
consecutiveFailureCount: BN; consecutiveFailureCount: BN;
/** Timestamp when the next update request will be available. */
nextAllowedUpdateTime: BN; nextAllowedUpdateTime: BN;
/** Flag for whether an aggregators configuration is locked for editing. */
isLocked: boolean; isLocked: boolean;
/** Optional, public key of the crank the aggregator is currently using. Event based feeds do not need a crank. */
crankPubkey: PublicKey; crankPubkey: PublicKey;
/** Latest confirmed update request result that has been accepted as valid. */
latestConfirmedRound: types.AggregatorRoundFields; latestConfirmedRound: types.AggregatorRoundFields;
/** Oracle results from the current round of update request that has not been accepted as valid yet. */
currentRound: types.AggregatorRoundFields; currentRound: types.AggregatorRoundFields;
/** List of public keys containing the job definitions for how data is sourced off-chain by oracles. */
jobPubkeysData: Array<PublicKey>; jobPubkeysData: Array<PublicKey>;
/** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment. */
jobHashes: Array<types.HashFields>; jobHashes: Array<types.HashFields>;
/** Number of jobs assigned to an oracle. */
jobPubkeysSize: number; jobPubkeysSize: number;
/** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment. */
jobsChecksum: Array<number>; jobsChecksum: Array<number>;
/** The account delegated as the authority for making account changes. */
authority: PublicKey; authority: PublicKey;
/** Optional, public key of a history buffer account storing the last N accepted results and their timestamps. */
historyBuffer: PublicKey; historyBuffer: PublicKey;
/** The previous confirmed round result. */
previousConfirmedRoundResult: types.SwitchboardDecimalFields; previousConfirmedRoundResult: types.SwitchboardDecimalFields;
/** The slot when the previous confirmed round was opened. */
previousConfirmedRoundSlot: BN; previousConfirmedRoundSlot: BN;
/** Whether an aggregator is permitted to join a crank. */
disableCrank: boolean; disableCrank: boolean;
/** Job weights used for the weighted median of the aggregator's assigned job accounts. */
jobWeights: Array<number>; jobWeights: Array<number>;
/** Unix timestamp when the feed was created. */
creationTimestamp: BN; creationTimestamp: BN;
/**
* Use sliding window or round based resolution
* NOTE: This changes result propogation in latest_round_result
*/
resolutionMode: types.AggregatorResolutionModeKind; resolutionMode: types.AggregatorResolutionModeKind;
basePriorityFee: number; basePriorityFee: number;
priorityFeeBump: number; priorityFeeBump: number;
priorityFeeBumpPeriod: number; priorityFeeBumpPeriod: number;
maxPriorityFeeMultiplier: number; maxPriorityFeeMultiplier: number;
/** Reserved for future info. */
ebuf: Array<number>; ebuf: Array<number>;
} }
export interface AggregatorAccountDataJSON { export interface AggregatorAccountDataJSON {
/** Name of the aggregator to store on-chain. */
name: Array<number>; name: Array<number>;
/** Metadata of the aggregator to store on-chain. */
metadata: Array<number>; metadata: Array<number>;
/** Reserved. */
reserved1: Array<number>; reserved1: Array<number>;
/** Pubkey of the queue the aggregator belongs to. */
queuePubkey: string; queuePubkey: string;
/**
* CONFIGS
* Number of oracles assigned to an update request.
*/
oracleRequestBatchSize: number; oracleRequestBatchSize: number;
/** Minimum number of oracle responses required before a round is validated. */
minOracleResults: number; minOracleResults: number;
/** Minimum number of job results before an oracle accepts a result. */
minJobResults: number; minJobResults: number;
/** Minimum number of seconds required between aggregator rounds. */
minUpdateDelaySeconds: number; minUpdateDelaySeconds: number;
/** Unix timestamp for which no feed update will occur before. */
startAfter: string; startAfter: string;
/** Change percentage required between a previous round and the current round. If variance percentage is not met, reject new oracle responses. */
varianceThreshold: types.SwitchboardDecimalJSON; varianceThreshold: types.SwitchboardDecimalJSON;
/** Number of seconds for which, even if the variance threshold is not passed, accept new responses from oracles. */
forceReportPeriod: string; forceReportPeriod: string;
/** Timestamp when the feed is no longer needed. */
expiration: string; expiration: string;
/** Counter for the number of consecutive failures before a feed is removed from a queue. If set to 0, failed feeds will remain on the queue. */
consecutiveFailureCount: string; consecutiveFailureCount: string;
/** Timestamp when the next update request will be available. */
nextAllowedUpdateTime: string; nextAllowedUpdateTime: string;
/** Flag for whether an aggregators configuration is locked for editing. */
isLocked: boolean; isLocked: boolean;
/** Optional, public key of the crank the aggregator is currently using. Event based feeds do not need a crank. */
crankPubkey: string; crankPubkey: string;
/** Latest confirmed update request result that has been accepted as valid. */
latestConfirmedRound: types.AggregatorRoundJSON; latestConfirmedRound: types.AggregatorRoundJSON;
/** Oracle results from the current round of update request that has not been accepted as valid yet. */
currentRound: types.AggregatorRoundJSON; currentRound: types.AggregatorRoundJSON;
/** List of public keys containing the job definitions for how data is sourced off-chain by oracles. */
jobPubkeysData: Array<string>; jobPubkeysData: Array<string>;
/** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment. */
jobHashes: Array<types.HashJSON>; jobHashes: Array<types.HashJSON>;
/** Number of jobs assigned to an oracle. */
jobPubkeysSize: number; jobPubkeysSize: number;
/** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment. */
jobsChecksum: Array<number>; jobsChecksum: Array<number>;
/** The account delegated as the authority for making account changes. */
authority: string; authority: string;
/** Optional, public key of a history buffer account storing the last N accepted results and their timestamps. */
historyBuffer: string; historyBuffer: string;
/** The previous confirmed round result. */
previousConfirmedRoundResult: types.SwitchboardDecimalJSON; previousConfirmedRoundResult: types.SwitchboardDecimalJSON;
/** The slot when the previous confirmed round was opened. */
previousConfirmedRoundSlot: string; previousConfirmedRoundSlot: string;
/** Whether an aggregator is permitted to join a crank. */
disableCrank: boolean; disableCrank: boolean;
/** Job weights used for the weighted median of the aggregator's assigned job accounts. */
jobWeights: Array<number>; jobWeights: Array<number>;
/** Unix timestamp when the feed was created. */
creationTimestamp: string; creationTimestamp: string;
/**
* Use sliding window or round based resolution
* NOTE: This changes result propogation in latest_round_result
*/
resolutionMode: types.AggregatorResolutionModeJSON; resolutionMode: types.AggregatorResolutionModeJSON;
basePriorityFee: number; basePriorityFee: number;
priorityFeeBump: number; priorityFeeBump: number;
priorityFeeBumpPeriod: number; priorityFeeBumpPeriod: number;
maxPriorityFeeMultiplier: number; maxPriorityFeeMultiplier: number;
/** Reserved for future info. */
ebuf: Array<number>; ebuf: Array<number>;
} }
export class AggregatorAccountData { export class AggregatorAccountData {
/** Name of the aggregator to store on-chain. */
readonly name: Array<number>; readonly name: Array<number>;
/** Metadata of the aggregator to store on-chain. */
readonly metadata: Array<number>; readonly metadata: Array<number>;
/** Reserved. */
readonly reserved1: Array<number>; readonly reserved1: Array<number>;
/** Pubkey of the queue the aggregator belongs to. */
readonly queuePubkey: PublicKey; readonly queuePubkey: PublicKey;
/**
* CONFIGS
* Number of oracles assigned to an update request.
*/
readonly oracleRequestBatchSize: number; readonly oracleRequestBatchSize: number;
/** Minimum number of oracle responses required before a round is validated. */
readonly minOracleResults: number; readonly minOracleResults: number;
/** Minimum number of job results before an oracle accepts a result. */
readonly minJobResults: number; readonly minJobResults: number;
/** Minimum number of seconds required between aggregator rounds. */
readonly minUpdateDelaySeconds: number; readonly minUpdateDelaySeconds: number;
/** Unix timestamp for which no feed update will occur before. */
readonly startAfter: BN; readonly startAfter: BN;
/** Change percentage required between a previous round and the current round. If variance percentage is not met, reject new oracle responses. */
readonly varianceThreshold: types.SwitchboardDecimal; readonly varianceThreshold: types.SwitchboardDecimal;
/** Number of seconds for which, even if the variance threshold is not passed, accept new responses from oracles. */
readonly forceReportPeriod: BN; readonly forceReportPeriod: BN;
/** Timestamp when the feed is no longer needed. */
readonly expiration: BN; readonly expiration: BN;
/** Counter for the number of consecutive failures before a feed is removed from a queue. If set to 0, failed feeds will remain on the queue. */
readonly consecutiveFailureCount: BN; readonly consecutiveFailureCount: BN;
/** Timestamp when the next update request will be available. */
readonly nextAllowedUpdateTime: BN; readonly nextAllowedUpdateTime: BN;
/** Flag for whether an aggregators configuration is locked for editing. */
readonly isLocked: boolean; readonly isLocked: boolean;
/** Optional, public key of the crank the aggregator is currently using. Event based feeds do not need a crank. */
readonly crankPubkey: PublicKey; readonly crankPubkey: PublicKey;
/** Latest confirmed update request result that has been accepted as valid. */
readonly latestConfirmedRound: types.AggregatorRound; readonly latestConfirmedRound: types.AggregatorRound;
/** Oracle results from the current round of update request that has not been accepted as valid yet. */
readonly currentRound: types.AggregatorRound; readonly currentRound: types.AggregatorRound;
/** List of public keys containing the job definitions for how data is sourced off-chain by oracles. */
readonly jobPubkeysData: Array<PublicKey>; readonly jobPubkeysData: Array<PublicKey>;
/** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment. */
readonly jobHashes: Array<types.Hash>; readonly jobHashes: Array<types.Hash>;
/** Number of jobs assigned to an oracle. */
readonly jobPubkeysSize: number; readonly jobPubkeysSize: number;
/** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment. */
readonly jobsChecksum: Array<number>; readonly jobsChecksum: Array<number>;
/** The account delegated as the authority for making account changes. */
readonly authority: PublicKey; readonly authority: PublicKey;
/** Optional, public key of a history buffer account storing the last N accepted results and their timestamps. */
readonly historyBuffer: PublicKey; readonly historyBuffer: PublicKey;
/** The previous confirmed round result. */
readonly previousConfirmedRoundResult: types.SwitchboardDecimal; readonly previousConfirmedRoundResult: types.SwitchboardDecimal;
/** The slot when the previous confirmed round was opened. */
readonly previousConfirmedRoundSlot: BN; readonly previousConfirmedRoundSlot: BN;
/** Whether an aggregator is permitted to join a crank. */
readonly disableCrank: boolean; readonly disableCrank: boolean;
/** Job weights used for the weighted median of the aggregator's assigned job accounts. */
readonly jobWeights: Array<number>; readonly jobWeights: Array<number>;
/** Unix timestamp when the feed was created. */
readonly creationTimestamp: BN; readonly creationTimestamp: BN;
/**
* Use sliding window or round based resolution
* NOTE: This changes result propogation in latest_round_result
*/
readonly resolutionMode: types.AggregatorResolutionModeKind; readonly resolutionMode: types.AggregatorResolutionModeKind;
readonly basePriorityFee: number; readonly basePriorityFee: number;
readonly priorityFeeBump: number; readonly priorityFeeBump: number;
readonly priorityFeeBumpPeriod: number; readonly priorityFeeBumpPeriod: number;
readonly maxPriorityFeeMultiplier: number; readonly maxPriorityFeeMultiplier: number;
/** Reserved for future info. */
readonly ebuf: Array<number>; readonly ebuf: Array<number>;
static readonly discriminator = Buffer.from([ static readonly discriminator = Buffer.from([

View File

@ -5,44 +5,77 @@ import * as borsh from '@project-serum/borsh'; // eslint-disable-line @typescrip
import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars
export interface BufferRelayerAccountDataFields { export interface BufferRelayerAccountDataFields {
/** Name of the buffer account to store on-chain. */
name: Array<number>; name: Array<number>;
/** Public key of the OracleQueueAccountData that is currently assigned to fulfill buffer relayer update request. */
queuePubkey: PublicKey; queuePubkey: PublicKey;
/** Token account to reward oracles for completing update request. */
escrow: PublicKey; escrow: PublicKey;
/** The account delegated as the authority for making account changes. */
authority: PublicKey; authority: PublicKey;
/** Public key of the JobAccountData that defines how the buffer relayer is updated. */
jobPubkey: PublicKey; jobPubkey: PublicKey;
/** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment */
jobHash: Array<number>; jobHash: Array<number>;
/** Minimum delay between update request. */
minUpdateDelaySeconds: number; minUpdateDelaySeconds: number;
/** Whether buffer relayer config is locked for further changes. */
isLocked: boolean; isLocked: boolean;
/** The current buffer relayer update round that is yet to be confirmed. */
currentRound: types.BufferRelayerRoundFields; currentRound: types.BufferRelayerRoundFields;
/** The latest confirmed buffer relayer update round. */
latestConfirmedRound: types.BufferRelayerRoundFields; latestConfirmedRound: types.BufferRelayerRoundFields;
/** The buffer holding the latest confirmed result. */
result: Uint8Array; result: Uint8Array;
} }
export interface BufferRelayerAccountDataJSON { export interface BufferRelayerAccountDataJSON {
/** Name of the buffer account to store on-chain. */
name: Array<number>; name: Array<number>;
/** Public key of the OracleQueueAccountData that is currently assigned to fulfill buffer relayer update request. */
queuePubkey: string; queuePubkey: string;
/** Token account to reward oracles for completing update request. */
escrow: string; escrow: string;
/** The account delegated as the authority for making account changes. */
authority: string; authority: string;
/** Public key of the JobAccountData that defines how the buffer relayer is updated. */
jobPubkey: string; jobPubkey: string;
/** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment */
jobHash: Array<number>; jobHash: Array<number>;
/** Minimum delay between update request. */
minUpdateDelaySeconds: number; minUpdateDelaySeconds: number;
/** Whether buffer relayer config is locked for further changes. */
isLocked: boolean; isLocked: boolean;
/** The current buffer relayer update round that is yet to be confirmed. */
currentRound: types.BufferRelayerRoundJSON; currentRound: types.BufferRelayerRoundJSON;
/** The latest confirmed buffer relayer update round. */
latestConfirmedRound: types.BufferRelayerRoundJSON; latestConfirmedRound: types.BufferRelayerRoundJSON;
/** The buffer holding the latest confirmed result. */
result: Array<number>; result: Array<number>;
} }
export class BufferRelayerAccountData { export class BufferRelayerAccountData {
/** Name of the buffer account to store on-chain. */
readonly name: Array<number>; readonly name: Array<number>;
/** Public key of the OracleQueueAccountData that is currently assigned to fulfill buffer relayer update request. */
readonly queuePubkey: PublicKey; readonly queuePubkey: PublicKey;
/** Token account to reward oracles for completing update request. */
readonly escrow: PublicKey; readonly escrow: PublicKey;
/** The account delegated as the authority for making account changes. */
readonly authority: PublicKey; readonly authority: PublicKey;
/** Public key of the JobAccountData that defines how the buffer relayer is updated. */
readonly jobPubkey: PublicKey; readonly jobPubkey: PublicKey;
/** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment */
readonly jobHash: Array<number>; readonly jobHash: Array<number>;
/** Minimum delay between update request. */
readonly minUpdateDelaySeconds: number; readonly minUpdateDelaySeconds: number;
/** Whether buffer relayer config is locked for further changes. */
readonly isLocked: boolean; readonly isLocked: boolean;
/** The current buffer relayer update round that is yet to be confirmed. */
readonly currentRound: types.BufferRelayerRound; readonly currentRound: types.BufferRelayerRound;
/** The latest confirmed buffer relayer update round. */
readonly latestConfirmedRound: types.BufferRelayerRound; readonly latestConfirmedRound: types.BufferRelayerRound;
/** The buffer holding the latest confirmed result. */
readonly result: Uint8Array; readonly result: Uint8Array;
static readonly discriminator = Buffer.from([ static readonly discriminator = Buffer.from([

View File

@ -5,35 +5,59 @@ import * as borsh from '@project-serum/borsh'; // eslint-disable-line @typescrip
import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars
export interface CrankAccountDataFields { export interface CrankAccountDataFields {
/** Name of the crank to store on-chain. */
name: Array<number>; name: Array<number>;
/** Metadata of the crank to store on-chain. */
metadata: Array<number>; metadata: Array<number>;
/** Public key of the oracle queue who owns the crank. */
queuePubkey: PublicKey; queuePubkey: PublicKey;
/** Number of aggregators added to the crank. */
pqSize: number; pqSize: number;
/** Maximum number of aggregators allowed to be added to a crank. */
maxRows: number; maxRows: number;
/** Pseudorandom value added to next aggregator update time. */
jitterModifier: number; jitterModifier: number;
/** Reserved for future info. */
ebuf: Array<number>; ebuf: Array<number>;
/** The public key of the CrankBuffer account holding a collection of Aggregator pubkeys and their next allowed update time. */
dataBuffer: PublicKey; dataBuffer: PublicKey;
} }
export interface CrankAccountDataJSON { export interface CrankAccountDataJSON {
/** Name of the crank to store on-chain. */
name: Array<number>; name: Array<number>;
/** Metadata of the crank to store on-chain. */
metadata: Array<number>; metadata: Array<number>;
/** Public key of the oracle queue who owns the crank. */
queuePubkey: string; queuePubkey: string;
/** Number of aggregators added to the crank. */
pqSize: number; pqSize: number;
/** Maximum number of aggregators allowed to be added to a crank. */
maxRows: number; maxRows: number;
/** Pseudorandom value added to next aggregator update time. */
jitterModifier: number; jitterModifier: number;
/** Reserved for future info. */
ebuf: Array<number>; ebuf: Array<number>;
/** The public key of the CrankBuffer account holding a collection of Aggregator pubkeys and their next allowed update time. */
dataBuffer: string; dataBuffer: string;
} }
export class CrankAccountData { export class CrankAccountData {
/** Name of the crank to store on-chain. */
readonly name: Array<number>; readonly name: Array<number>;
/** Metadata of the crank to store on-chain. */
readonly metadata: Array<number>; readonly metadata: Array<number>;
/** Public key of the oracle queue who owns the crank. */
readonly queuePubkey: PublicKey; readonly queuePubkey: PublicKey;
/** Number of aggregators added to the crank. */
readonly pqSize: number; readonly pqSize: number;
/** Maximum number of aggregators allowed to be added to a crank. */
readonly maxRows: number; readonly maxRows: number;
/** Pseudorandom value added to next aggregator update time. */
readonly jitterModifier: number; readonly jitterModifier: number;
/** Reserved for future info. */
readonly ebuf: Array<number>; readonly ebuf: Array<number>;
/** The public key of the CrankBuffer account holding a collection of Aggregator pubkeys and their next allowed update time. */
readonly dataBuffer: PublicKey; readonly dataBuffer: PublicKey;
static readonly discriminator = Buffer.from([ static readonly discriminator = Buffer.from([

View File

@ -5,40 +5,67 @@ import * as borsh from '@project-serum/borsh'; // eslint-disable-line @typescrip
import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars
export interface JobAccountDataFields { export interface JobAccountDataFields {
/** Name of the job to store on-chain. */
name: Array<number>; name: Array<number>;
/** Metadata of the job to store on-chain. */
metadata: Array<number>; metadata: Array<number>;
/** The account delegated as the authority for making account changes. */
authority: PublicKey; authority: PublicKey;
/** Unix timestamp when the job is considered invalid */
expiration: BN; expiration: BN;
/** Hash of the serialized data to prevent tampering. */
hash: Array<number>; hash: Array<number>;
/** Serialized protobuf containing the collection of task to retrieve data off-chain. */
data: Uint8Array; data: Uint8Array;
/** The number of data feeds referencing the job account.. */
referenceCount: number; referenceCount: number;
/** The token amount funded into a feed that contains this job account. */
totalSpent: BN; totalSpent: BN;
/** Unix timestamp when the job was created on-chain. */
createdAt: BN; createdAt: BN;
isInitializing: number; isInitializing: number;
} }
export interface JobAccountDataJSON { export interface JobAccountDataJSON {
/** Name of the job to store on-chain. */
name: Array<number>; name: Array<number>;
/** Metadata of the job to store on-chain. */
metadata: Array<number>; metadata: Array<number>;
/** The account delegated as the authority for making account changes. */
authority: string; authority: string;
/** Unix timestamp when the job is considered invalid */
expiration: string; expiration: string;
/** Hash of the serialized data to prevent tampering. */
hash: Array<number>; hash: Array<number>;
/** Serialized protobuf containing the collection of task to retrieve data off-chain. */
data: Array<number>; data: Array<number>;
/** The number of data feeds referencing the job account.. */
referenceCount: number; referenceCount: number;
/** The token amount funded into a feed that contains this job account. */
totalSpent: string; totalSpent: string;
/** Unix timestamp when the job was created on-chain. */
createdAt: string; createdAt: string;
isInitializing: number; isInitializing: number;
} }
export class JobAccountData { export class JobAccountData {
/** Name of the job to store on-chain. */
readonly name: Array<number>; readonly name: Array<number>;
/** Metadata of the job to store on-chain. */
readonly metadata: Array<number>; readonly metadata: Array<number>;
/** The account delegated as the authority for making account changes. */
readonly authority: PublicKey; readonly authority: PublicKey;
/** Unix timestamp when the job is considered invalid */
readonly expiration: BN; readonly expiration: BN;
/** Hash of the serialized data to prevent tampering. */
readonly hash: Array<number>; readonly hash: Array<number>;
/** Serialized protobuf containing the collection of task to retrieve data off-chain. */
readonly data: Uint8Array; readonly data: Uint8Array;
/** The number of data feeds referencing the job account.. */
readonly referenceCount: number; readonly referenceCount: number;
/** The token amount funded into a feed that contains this job account. */
readonly totalSpent: BN; readonly totalSpent: BN;
/** Unix timestamp when the job was created on-chain. */
readonly createdAt: BN; readonly createdAt: BN;
readonly isInitializing: number; readonly isInitializing: number;

View File

@ -5,40 +5,68 @@ import * as borsh from '@project-serum/borsh'; // eslint-disable-line @typescrip
import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars
export interface LeaseAccountDataFields { export interface LeaseAccountDataFields {
/** Public key of the token account holding the lease contract funds until rewarded to oracles for successfully processing updates */
escrow: PublicKey; escrow: PublicKey;
/** Public key of the oracle queue that the lease contract is applicable for. */
queue: PublicKey; queue: PublicKey;
/** Public key of the aggregator that the lease contract is applicable for */
aggregator: PublicKey; aggregator: PublicKey;
/** Public key of the Solana token program ID. */
tokenProgram: PublicKey; tokenProgram: PublicKey;
/** Whether the lease contract is still active. */
isActive: boolean; isActive: boolean;
/** Index of an aggregators position on a crank. */
crankRowCount: number; crankRowCount: number;
/** Timestamp when the lease contract was created. */
createdAt: BN; createdAt: BN;
/** Counter keeping track of the number of updates for the given aggregator. */
updateCount: BN; updateCount: BN;
/** Public key of keypair that may withdraw funds from the lease at any time */
withdrawAuthority: PublicKey; withdrawAuthority: PublicKey;
ebuf: Array<number>; ebuf: Array<number>;
} }
export interface LeaseAccountDataJSON { export interface LeaseAccountDataJSON {
/** Public key of the token account holding the lease contract funds until rewarded to oracles for successfully processing updates */
escrow: string; escrow: string;
/** Public key of the oracle queue that the lease contract is applicable for. */
queue: string; queue: string;
/** Public key of the aggregator that the lease contract is applicable for */
aggregator: string; aggregator: string;
/** Public key of the Solana token program ID. */
tokenProgram: string; tokenProgram: string;
/** Whether the lease contract is still active. */
isActive: boolean; isActive: boolean;
/** Index of an aggregators position on a crank. */
crankRowCount: number; crankRowCount: number;
/** Timestamp when the lease contract was created. */
createdAt: string; createdAt: string;
/** Counter keeping track of the number of updates for the given aggregator. */
updateCount: string; updateCount: string;
/** Public key of keypair that may withdraw funds from the lease at any time */
withdrawAuthority: string; withdrawAuthority: string;
ebuf: Array<number>; ebuf: Array<number>;
} }
/** This should be any ccount that links a permission to an escrow */
export class LeaseAccountData { export class LeaseAccountData {
/** Public key of the token account holding the lease contract funds until rewarded to oracles for successfully processing updates */
readonly escrow: PublicKey; readonly escrow: PublicKey;
/** Public key of the oracle queue that the lease contract is applicable for. */
readonly queue: PublicKey; readonly queue: PublicKey;
/** Public key of the aggregator that the lease contract is applicable for */
readonly aggregator: PublicKey; readonly aggregator: PublicKey;
/** Public key of the Solana token program ID. */
readonly tokenProgram: PublicKey; readonly tokenProgram: PublicKey;
/** Whether the lease contract is still active. */
readonly isActive: boolean; readonly isActive: boolean;
/** Index of an aggregators position on a crank. */
readonly crankRowCount: number; readonly crankRowCount: number;
/** Timestamp when the lease contract was created. */
readonly createdAt: BN; readonly createdAt: BN;
/** Counter keeping track of the number of updates for the given aggregator. */
readonly updateCount: BN; readonly updateCount: BN;
/** Public key of keypair that may withdraw funds from the lease at any time */
readonly withdrawAuthority: PublicKey; readonly withdrawAuthority: PublicKey;
readonly ebuf: Array<number>; readonly ebuf: Array<number>;

View File

@ -5,38 +5,65 @@ import * as borsh from '@project-serum/borsh'; // eslint-disable-line @typescrip
import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars
export interface OracleAccountDataFields { export interface OracleAccountDataFields {
/** Name of the oracle to store on-chain. */
name: Array<number>; name: Array<number>;
/** Metadata of the oracle to store on-chain. */
metadata: Array<number>; metadata: Array<number>;
/** The account delegated as the authority for making account changes or withdrawing funds from a staking wallet. */
oracleAuthority: PublicKey; oracleAuthority: PublicKey;
/** Unix timestamp when the oracle last heartbeated */
lastHeartbeat: BN; lastHeartbeat: BN;
/** Flag dictating if an oracle is active and has heartbeated before the queue's oracle timeout parameter. */
numInUse: number; numInUse: number;
/** Stake account and reward/slashing wallet. */
tokenAccount: PublicKey; tokenAccount: PublicKey;
/** Public key of the oracle queue who has granted it permission to use its resources. */
queuePubkey: PublicKey; queuePubkey: PublicKey;
/** Oracle track record. */
metrics: types.OracleMetricsFields; metrics: types.OracleMetricsFields;
/** Reserved for future info. */
ebuf: Array<number>; ebuf: Array<number>;
} }
export interface OracleAccountDataJSON { export interface OracleAccountDataJSON {
/** Name of the oracle to store on-chain. */
name: Array<number>; name: Array<number>;
/** Metadata of the oracle to store on-chain. */
metadata: Array<number>; metadata: Array<number>;
/** The account delegated as the authority for making account changes or withdrawing funds from a staking wallet. */
oracleAuthority: string; oracleAuthority: string;
/** Unix timestamp when the oracle last heartbeated */
lastHeartbeat: string; lastHeartbeat: string;
/** Flag dictating if an oracle is active and has heartbeated before the queue's oracle timeout parameter. */
numInUse: number; numInUse: number;
/** Stake account and reward/slashing wallet. */
tokenAccount: string; tokenAccount: string;
/** Public key of the oracle queue who has granted it permission to use its resources. */
queuePubkey: string; queuePubkey: string;
/** Oracle track record. */
metrics: types.OracleMetricsJSON; metrics: types.OracleMetricsJSON;
/** Reserved for future info. */
ebuf: Array<number>; ebuf: Array<number>;
} }
export class OracleAccountData { export class OracleAccountData {
/** Name of the oracle to store on-chain. */
readonly name: Array<number>; readonly name: Array<number>;
/** Metadata of the oracle to store on-chain. */
readonly metadata: Array<number>; readonly metadata: Array<number>;
/** The account delegated as the authority for making account changes or withdrawing funds from a staking wallet. */
readonly oracleAuthority: PublicKey; readonly oracleAuthority: PublicKey;
/** Unix timestamp when the oracle last heartbeated */
readonly lastHeartbeat: BN; readonly lastHeartbeat: BN;
/** Flag dictating if an oracle is active and has heartbeated before the queue's oracle timeout parameter. */
readonly numInUse: number; readonly numInUse: number;
/** Stake account and reward/slashing wallet. */
readonly tokenAccount: PublicKey; readonly tokenAccount: PublicKey;
/** Public key of the oracle queue who has granted it permission to use its resources. */
readonly queuePubkey: PublicKey; readonly queuePubkey: PublicKey;
/** Oracle track record. */
readonly metrics: types.OracleMetrics; readonly metrics: types.OracleMetrics;
/** Reserved for future info. */
readonly ebuf: Array<number>; readonly ebuf: Array<number>;
static readonly discriminator = Buffer.from([ static readonly discriminator = Buffer.from([

View File

@ -5,80 +5,176 @@ import * as borsh from '@project-serum/borsh'; // eslint-disable-line @typescrip
import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars
export interface OracleQueueAccountDataFields { export interface OracleQueueAccountDataFields {
/** Name of the queue to store on-chain. */
name: Array<number>; name: Array<number>;
/** Metadata of the queue to store on-chain. */
metadata: Array<number>; metadata: Array<number>;
/** The account delegated as the authority for making account changes or assigning permissions targeted at the queue. */
authority: PublicKey; authority: PublicKey;
/** Interval when stale oracles will be removed if they fail to heartbeat. */
oracleTimeout: number; oracleTimeout: number;
/** Rewards to provide oracles and round openers on this queue. */
reward: BN; reward: BN;
/** The minimum amount of stake oracles must present to remain on the queue. */
minStake: BN; minStake: BN;
/** Whether slashing is enabled on this queue. */
slashingEnabled: boolean; slashingEnabled: boolean;
/**
* The tolerated variance amount oracle results can have from the accepted round result before being slashed.
* slashBound = varianceToleranceMultiplier * stdDeviation Default: 2
*/
varianceToleranceMultiplier: types.SwitchboardDecimalFields; varianceToleranceMultiplier: types.SwitchboardDecimalFields;
/**
* Number of update rounds new feeds are on probation for.
* If a feed returns 429s within probation period, auto disable permissions.
*/
feedProbationPeriod: number; feedProbationPeriod: number;
/** Current index of the oracle rotation. */
currIdx: number; currIdx: number;
/** Current number of oracles on a queue. */
size: number; size: number;
/** Garbage collection index. */
gcIdx: number; gcIdx: number;
/** Consecutive failure limit for a feed before feed permission is revoked. */
consecutiveFeedFailureLimit: BN; consecutiveFeedFailureLimit: BN;
/** Consecutive failure limit for an oracle before oracle permission is revoked. */
consecutiveOracleFailureLimit: BN; consecutiveOracleFailureLimit: BN;
/** Enabling this setting means data feeds do not need explicit permission to join the queue and request new values from its oracles. */
unpermissionedFeedsEnabled: boolean; unpermissionedFeedsEnabled: boolean;
/** Enabling this setting means VRF accounts do not need explicit permission to join the queue and request new values from its oracles. */
unpermissionedVrfEnabled: boolean; unpermissionedVrfEnabled: boolean;
/** TODO: Revenue percentage rewarded to job curators overall. */
curatorRewardCut: types.SwitchboardDecimalFields; curatorRewardCut: types.SwitchboardDecimalFields;
/**
* Prevent new leases from being funded n this queue.
* Useful to turn down a queue for migrations, since authority is always immutable.
*/
lockLeaseFunding: boolean; lockLeaseFunding: boolean;
/** Token mint used for the oracle queue rewards and slashing. */
mint: PublicKey; mint: PublicKey;
/** Whether oracles are permitted to fulfill buffer relayer update request. */
enableBufferRelayers: boolean; enableBufferRelayers: boolean;
/** Reserved for future info. */
ebuf: Array<number>; ebuf: Array<number>;
/** Maximum number of oracles a queue can support. */
maxSize: number; maxSize: number;
/** The public key of the OracleQueueBuffer account holding a collection of Oracle pubkeys that haver successfully heartbeated before the queues `oracleTimeout`. */
dataBuffer: PublicKey; dataBuffer: PublicKey;
} }
export interface OracleQueueAccountDataJSON { export interface OracleQueueAccountDataJSON {
/** Name of the queue to store on-chain. */
name: Array<number>; name: Array<number>;
/** Metadata of the queue to store on-chain. */
metadata: Array<number>; metadata: Array<number>;
/** The account delegated as the authority for making account changes or assigning permissions targeted at the queue. */
authority: string; authority: string;
/** Interval when stale oracles will be removed if they fail to heartbeat. */
oracleTimeout: number; oracleTimeout: number;
/** Rewards to provide oracles and round openers on this queue. */
reward: string; reward: string;
/** The minimum amount of stake oracles must present to remain on the queue. */
minStake: string; minStake: string;
/** Whether slashing is enabled on this queue. */
slashingEnabled: boolean; slashingEnabled: boolean;
/**
* The tolerated variance amount oracle results can have from the accepted round result before being slashed.
* slashBound = varianceToleranceMultiplier * stdDeviation Default: 2
*/
varianceToleranceMultiplier: types.SwitchboardDecimalJSON; varianceToleranceMultiplier: types.SwitchboardDecimalJSON;
/**
* Number of update rounds new feeds are on probation for.
* If a feed returns 429s within probation period, auto disable permissions.
*/
feedProbationPeriod: number; feedProbationPeriod: number;
/** Current index of the oracle rotation. */
currIdx: number; currIdx: number;
/** Current number of oracles on a queue. */
size: number; size: number;
/** Garbage collection index. */
gcIdx: number; gcIdx: number;
/** Consecutive failure limit for a feed before feed permission is revoked. */
consecutiveFeedFailureLimit: string; consecutiveFeedFailureLimit: string;
/** Consecutive failure limit for an oracle before oracle permission is revoked. */
consecutiveOracleFailureLimit: string; consecutiveOracleFailureLimit: string;
/** Enabling this setting means data feeds do not need explicit permission to join the queue and request new values from its oracles. */
unpermissionedFeedsEnabled: boolean; unpermissionedFeedsEnabled: boolean;
/** Enabling this setting means VRF accounts do not need explicit permission to join the queue and request new values from its oracles. */
unpermissionedVrfEnabled: boolean; unpermissionedVrfEnabled: boolean;
/** TODO: Revenue percentage rewarded to job curators overall. */
curatorRewardCut: types.SwitchboardDecimalJSON; curatorRewardCut: types.SwitchboardDecimalJSON;
/**
* Prevent new leases from being funded n this queue.
* Useful to turn down a queue for migrations, since authority is always immutable.
*/
lockLeaseFunding: boolean; lockLeaseFunding: boolean;
/** Token mint used for the oracle queue rewards and slashing. */
mint: string; mint: string;
/** Whether oracles are permitted to fulfill buffer relayer update request. */
enableBufferRelayers: boolean; enableBufferRelayers: boolean;
/** Reserved for future info. */
ebuf: Array<number>; ebuf: Array<number>;
/** Maximum number of oracles a queue can support. */
maxSize: number; maxSize: number;
/** The public key of the OracleQueueBuffer account holding a collection of Oracle pubkeys that haver successfully heartbeated before the queues `oracleTimeout`. */
dataBuffer: string; dataBuffer: string;
} }
export class OracleQueueAccountData { export class OracleQueueAccountData {
/** Name of the queue to store on-chain. */
readonly name: Array<number>; readonly name: Array<number>;
/** Metadata of the queue to store on-chain. */
readonly metadata: Array<number>; readonly metadata: Array<number>;
/** The account delegated as the authority for making account changes or assigning permissions targeted at the queue. */
readonly authority: PublicKey; readonly authority: PublicKey;
/** Interval when stale oracles will be removed if they fail to heartbeat. */
readonly oracleTimeout: number; readonly oracleTimeout: number;
/** Rewards to provide oracles and round openers on this queue. */
readonly reward: BN; readonly reward: BN;
/** The minimum amount of stake oracles must present to remain on the queue. */
readonly minStake: BN; readonly minStake: BN;
/** Whether slashing is enabled on this queue. */
readonly slashingEnabled: boolean; readonly slashingEnabled: boolean;
/**
* The tolerated variance amount oracle results can have from the accepted round result before being slashed.
* slashBound = varianceToleranceMultiplier * stdDeviation Default: 2
*/
readonly varianceToleranceMultiplier: types.SwitchboardDecimal; readonly varianceToleranceMultiplier: types.SwitchboardDecimal;
/**
* Number of update rounds new feeds are on probation for.
* If a feed returns 429s within probation period, auto disable permissions.
*/
readonly feedProbationPeriod: number; readonly feedProbationPeriod: number;
/** Current index of the oracle rotation. */
readonly currIdx: number; readonly currIdx: number;
/** Current number of oracles on a queue. */
readonly size: number; readonly size: number;
/** Garbage collection index. */
readonly gcIdx: number; readonly gcIdx: number;
/** Consecutive failure limit for a feed before feed permission is revoked. */
readonly consecutiveFeedFailureLimit: BN; readonly consecutiveFeedFailureLimit: BN;
/** Consecutive failure limit for an oracle before oracle permission is revoked. */
readonly consecutiveOracleFailureLimit: BN; readonly consecutiveOracleFailureLimit: BN;
/** Enabling this setting means data feeds do not need explicit permission to join the queue and request new values from its oracles. */
readonly unpermissionedFeedsEnabled: boolean; readonly unpermissionedFeedsEnabled: boolean;
/** Enabling this setting means VRF accounts do not need explicit permission to join the queue and request new values from its oracles. */
readonly unpermissionedVrfEnabled: boolean; readonly unpermissionedVrfEnabled: boolean;
/** TODO: Revenue percentage rewarded to job curators overall. */
readonly curatorRewardCut: types.SwitchboardDecimal; readonly curatorRewardCut: types.SwitchboardDecimal;
/**
* Prevent new leases from being funded n this queue.
* Useful to turn down a queue for migrations, since authority is always immutable.
*/
readonly lockLeaseFunding: boolean; readonly lockLeaseFunding: boolean;
/** Token mint used for the oracle queue rewards and slashing. */
readonly mint: PublicKey; readonly mint: PublicKey;
/** Whether oracles are permitted to fulfill buffer relayer update request. */
readonly enableBufferRelayers: boolean; readonly enableBufferRelayers: boolean;
/** Reserved for future info. */
readonly ebuf: Array<number>; readonly ebuf: Array<number>;
/** Maximum number of oracles a queue can support. */
readonly maxSize: number; readonly maxSize: number;
/** The public key of the OracleQueueBuffer account holding a collection of Oracle pubkeys that haver successfully heartbeated before the queues `oracleTimeout`. */
readonly dataBuffer: PublicKey; readonly dataBuffer: PublicKey;
static readonly discriminator = Buffer.from([ static readonly discriminator = Buffer.from([

View File

@ -5,29 +5,59 @@ import * as borsh from '@project-serum/borsh'; // eslint-disable-line @typescrip
import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars
export interface PermissionAccountDataFields { export interface PermissionAccountDataFields {
/** The authority that is allowed to set permissions for this account. */
authority: PublicKey; authority: PublicKey;
/** The SwitchboardPermission enumeration assigned by the granter to the grantee. */
permissions: number; permissions: number;
/** Public key of account that is granting permissions to use its resources. */
granter: PublicKey; granter: PublicKey;
/** Public key of account that is being assigned permissions to use a granters resources. */
grantee: PublicKey; grantee: PublicKey;
/**
* unused currently. may want permission PDA per permission for
* unique expiration periods, BUT currently only one permission
* per account makes sense for the infra. Dont over engineer.
*/
expiration: BN; expiration: BN;
/** Reserved for future info. */
ebuf: Array<number>; ebuf: Array<number>;
} }
export interface PermissionAccountDataJSON { export interface PermissionAccountDataJSON {
/** The authority that is allowed to set permissions for this account. */
authority: string; authority: string;
/** The SwitchboardPermission enumeration assigned by the granter to the grantee. */
permissions: number; permissions: number;
/** Public key of account that is granting permissions to use its resources. */
granter: string; granter: string;
/** Public key of account that is being assigned permissions to use a granters resources. */
grantee: string; grantee: string;
/**
* unused currently. may want permission PDA per permission for
* unique expiration periods, BUT currently only one permission
* per account makes sense for the infra. Dont over engineer.
*/
expiration: string; expiration: string;
/** Reserved for future info. */
ebuf: Array<number>; ebuf: Array<number>;
} }
export class PermissionAccountData { export class PermissionAccountData {
/** The authority that is allowed to set permissions for this account. */
readonly authority: PublicKey; readonly authority: PublicKey;
/** The SwitchboardPermission enumeration assigned by the granter to the grantee. */
readonly permissions: number; readonly permissions: number;
/** Public key of account that is granting permissions to use its resources. */
readonly granter: PublicKey; readonly granter: PublicKey;
/** Public key of account that is being assigned permissions to use a granters resources. */
readonly grantee: PublicKey; readonly grantee: PublicKey;
/**
* unused currently. may want permission PDA per permission for
* unique expiration periods, BUT currently only one permission
* per account makes sense for the infra. Dont over engineer.
*/
readonly expiration: BN; readonly expiration: BN;
/** Reserved for future info. */
readonly ebuf: Array<number>; readonly ebuf: Array<number>;
static readonly discriminator = Buffer.from([ static readonly discriminator = Buffer.from([

View File

@ -5,26 +5,41 @@ import * as borsh from '@project-serum/borsh'; // eslint-disable-line @typescrip
import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars
export interface SbStateFields { export interface SbStateFields {
/** The account authority permitted to make account changes. */
authority: PublicKey; authority: PublicKey;
/** The token mint used for oracle rewards, aggregator leases, and other reward incentives. */
tokenMint: PublicKey; tokenMint: PublicKey;
/** Token vault used by the program to receive kickbacks. */
tokenVault: PublicKey; tokenVault: PublicKey;
/** The token mint used by the DAO. */
daoMint: PublicKey; daoMint: PublicKey;
/** Reserved for future info. */
ebuf: Array<number>; ebuf: Array<number>;
} }
export interface SbStateJSON { export interface SbStateJSON {
/** The account authority permitted to make account changes. */
authority: string; authority: string;
/** The token mint used for oracle rewards, aggregator leases, and other reward incentives. */
tokenMint: string; tokenMint: string;
/** Token vault used by the program to receive kickbacks. */
tokenVault: string; tokenVault: string;
/** The token mint used by the DAO. */
daoMint: string; daoMint: string;
/** Reserved for future info. */
ebuf: Array<number>; ebuf: Array<number>;
} }
export class SbState { export class SbState {
/** The account authority permitted to make account changes. */
readonly authority: PublicKey; readonly authority: PublicKey;
/** The token mint used for oracle rewards, aggregator leases, and other reward incentives. */
readonly tokenMint: PublicKey; readonly tokenMint: PublicKey;
/** Token vault used by the program to receive kickbacks. */
readonly tokenVault: PublicKey; readonly tokenVault: PublicKey;
/** The token mint used by the DAO. */
readonly daoMint: PublicKey; readonly daoMint: PublicKey;
/** Reserved for future info. */
readonly ebuf: Array<number>; readonly ebuf: Array<number>;
static readonly discriminator = Buffer.from([ static readonly discriminator = Buffer.from([

View File

@ -5,47 +5,80 @@ import * as borsh from '@project-serum/borsh'; // eslint-disable-line @typescrip
import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-unused-vars
export interface VrfAccountDataFields { export interface VrfAccountDataFields {
/** The current status of the VRF account. */
status: types.VrfStatusKind; status: types.VrfStatusKind;
/** Incremental counter for tracking VRF rounds. */
counter: BN; counter: BN;
/** On-chain account delegated for making account changes. */
authority: PublicKey; authority: PublicKey;
/** The OracleQueueAccountData that is assigned to fulfill VRF update request. */
oracleQueue: PublicKey; oracleQueue: PublicKey;
/** The token account used to hold funds for VRF update request. */
escrow: PublicKey; escrow: PublicKey;
/** The callback that is invoked when an update request is successfully verified. */
callback: types.CallbackZCFields; callback: types.CallbackZCFields;
/** The number of oracles assigned to a VRF update request. */
batchSize: number; batchSize: number;
/** Struct containing the intermediate state between VRF crank actions. */
builders: Array<types.VrfBuilderFields>; builders: Array<types.VrfBuilderFields>;
/** The number of builders. */
buildersLen: number; buildersLen: number;
testMode: boolean; testMode: boolean;
/** Oracle results from the current round of update request that has not been accepted as valid yet */
currentRound: types.VrfRoundFields; currentRound: types.VrfRoundFields;
/** Reserved for future info. */
ebuf: Array<number>; ebuf: Array<number>;
} }
export interface VrfAccountDataJSON { export interface VrfAccountDataJSON {
/** The current status of the VRF account. */
status: types.VrfStatusJSON; status: types.VrfStatusJSON;
/** Incremental counter for tracking VRF rounds. */
counter: string; counter: string;
/** On-chain account delegated for making account changes. */
authority: string; authority: string;
/** The OracleQueueAccountData that is assigned to fulfill VRF update request. */
oracleQueue: string; oracleQueue: string;
/** The token account used to hold funds for VRF update request. */
escrow: string; escrow: string;
/** The callback that is invoked when an update request is successfully verified. */
callback: types.CallbackZCJSON; callback: types.CallbackZCJSON;
/** The number of oracles assigned to a VRF update request. */
batchSize: number; batchSize: number;
/** Struct containing the intermediate state between VRF crank actions. */
builders: Array<types.VrfBuilderJSON>; builders: Array<types.VrfBuilderJSON>;
/** The number of builders. */
buildersLen: number; buildersLen: number;
testMode: boolean; testMode: boolean;
/** Oracle results from the current round of update request that has not been accepted as valid yet */
currentRound: types.VrfRoundJSON; currentRound: types.VrfRoundJSON;
/** Reserved for future info. */
ebuf: Array<number>; ebuf: Array<number>;
} }
export class VrfAccountData { export class VrfAccountData {
/** The current status of the VRF account. */
readonly status: types.VrfStatusKind; readonly status: types.VrfStatusKind;
/** Incremental counter for tracking VRF rounds. */
readonly counter: BN; readonly counter: BN;
/** On-chain account delegated for making account changes. */
readonly authority: PublicKey; readonly authority: PublicKey;
/** The OracleQueueAccountData that is assigned to fulfill VRF update request. */
readonly oracleQueue: PublicKey; readonly oracleQueue: PublicKey;
/** The token account used to hold funds for VRF update request. */
readonly escrow: PublicKey; readonly escrow: PublicKey;
/** The callback that is invoked when an update request is successfully verified. */
readonly callback: types.CallbackZC; readonly callback: types.CallbackZC;
/** The number of oracles assigned to a VRF update request. */
readonly batchSize: number; readonly batchSize: number;
/** Struct containing the intermediate state between VRF crank actions. */
readonly builders: Array<types.VrfBuilder>; readonly builders: Array<types.VrfBuilder>;
/** The number of builders. */
readonly buildersLen: number; readonly buildersLen: number;
readonly testMode: boolean; readonly testMode: boolean;
/** Oracle results from the current round of update request that has not been accepted as valid yet */
readonly currentRound: types.VrfRound; readonly currentRound: types.VrfRound;
/** Reserved for future info. */
readonly ebuf: Array<number>; readonly ebuf: Array<number>;
static readonly discriminator = Buffer.from([ static readonly discriminator = Buffer.from([

View File

@ -4,17 +4,23 @@ import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-
import * as borsh from '@project-serum/borsh'; import * as borsh from '@project-serum/borsh';
export interface AggregatorHistoryRowFields { export interface AggregatorHistoryRowFields {
/** The timestamp of the sample. */
timestamp: BN; timestamp: BN;
/** The value of the sample. */
value: types.SwitchboardDecimalFields; value: types.SwitchboardDecimalFields;
} }
export interface AggregatorHistoryRowJSON { export interface AggregatorHistoryRowJSON {
/** The timestamp of the sample. */
timestamp: string; timestamp: string;
/** The value of the sample. */
value: types.SwitchboardDecimalJSON; value: types.SwitchboardDecimalJSON;
} }
export class AggregatorHistoryRow { export class AggregatorHistoryRow {
/** The timestamp of the sample. */
readonly timestamp: BN; readonly timestamp: BN;
/** The value of the sample. */
readonly value: types.SwitchboardDecimal; readonly value: types.SwitchboardDecimal;
constructor(fields: AggregatorHistoryRowFields) { constructor(fields: AggregatorHistoryRowFields) {

View File

@ -4,53 +4,104 @@ import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-
import * as borsh from '@project-serum/borsh'; import * as borsh from '@project-serum/borsh';
export interface AggregatorRoundFields { export interface AggregatorRoundFields {
/**
* Maintains the number of successful responses received from nodes.
* Nodes can submit one successful response per round.
*/
numSuccess: number; numSuccess: number;
/** Number of error responses. */
numError: number; numError: number;
/** Whether an update request round has ended. */
isClosed: boolean; isClosed: boolean;
/** Maintains the `solana_program::clock::Slot` that the round was opened at. */
roundOpenSlot: BN; roundOpenSlot: BN;
/** Maintains the `solana_program::clock::UnixTimestamp;` the round was opened at. */
roundOpenTimestamp: BN; roundOpenTimestamp: BN;
/** Maintains the current median of all successful round responses. */
result: types.SwitchboardDecimalFields; result: types.SwitchboardDecimalFields;
/** Standard deviation of the accepted results in the round. */
stdDeviation: types.SwitchboardDecimalFields; stdDeviation: types.SwitchboardDecimalFields;
/** Maintains the minimum node response this round. */
minResponse: types.SwitchboardDecimalFields; minResponse: types.SwitchboardDecimalFields;
/** Maintains the maximum node response this round. */
maxResponse: types.SwitchboardDecimalFields; maxResponse: types.SwitchboardDecimalFields;
/** Pubkeys of the oracles fulfilling this round. */
oraclePubkeysData: Array<PublicKey>; oraclePubkeysData: Array<PublicKey>;
/** Represents all successful node responses this round. `NaN` if empty. */
mediansData: Array<types.SwitchboardDecimalFields>; mediansData: Array<types.SwitchboardDecimalFields>;
/** Current rewards/slashes oracles have received this round. */
currentPayout: Array<BN>; currentPayout: Array<BN>;
/** Keep track of which responses are fulfilled here. */
mediansFulfilled: Array<boolean>; mediansFulfilled: Array<boolean>;
/** Keeps track of which errors are fulfilled here. */
errorsFulfilled: Array<boolean>; errorsFulfilled: Array<boolean>;
} }
export interface AggregatorRoundJSON { export interface AggregatorRoundJSON {
/**
* Maintains the number of successful responses received from nodes.
* Nodes can submit one successful response per round.
*/
numSuccess: number; numSuccess: number;
/** Number of error responses. */
numError: number; numError: number;
/** Whether an update request round has ended. */
isClosed: boolean; isClosed: boolean;
/** Maintains the `solana_program::clock::Slot` that the round was opened at. */
roundOpenSlot: string; roundOpenSlot: string;
/** Maintains the `solana_program::clock::UnixTimestamp;` the round was opened at. */
roundOpenTimestamp: string; roundOpenTimestamp: string;
/** Maintains the current median of all successful round responses. */
result: types.SwitchboardDecimalJSON; result: types.SwitchboardDecimalJSON;
/** Standard deviation of the accepted results in the round. */
stdDeviation: types.SwitchboardDecimalJSON; stdDeviation: types.SwitchboardDecimalJSON;
/** Maintains the minimum node response this round. */
minResponse: types.SwitchboardDecimalJSON; minResponse: types.SwitchboardDecimalJSON;
/** Maintains the maximum node response this round. */
maxResponse: types.SwitchboardDecimalJSON; maxResponse: types.SwitchboardDecimalJSON;
/** Pubkeys of the oracles fulfilling this round. */
oraclePubkeysData: Array<string>; oraclePubkeysData: Array<string>;
/** Represents all successful node responses this round. `NaN` if empty. */
mediansData: Array<types.SwitchboardDecimalJSON>; mediansData: Array<types.SwitchboardDecimalJSON>;
/** Current rewards/slashes oracles have received this round. */
currentPayout: Array<string>; currentPayout: Array<string>;
/** Keep track of which responses are fulfilled here. */
mediansFulfilled: Array<boolean>; mediansFulfilled: Array<boolean>;
/** Keeps track of which errors are fulfilled here. */
errorsFulfilled: Array<boolean>; errorsFulfilled: Array<boolean>;
} }
export class AggregatorRound { export class AggregatorRound {
/**
* Maintains the number of successful responses received from nodes.
* Nodes can submit one successful response per round.
*/
readonly numSuccess: number; readonly numSuccess: number;
/** Number of error responses. */
readonly numError: number; readonly numError: number;
/** Whether an update request round has ended. */
readonly isClosed: boolean; readonly isClosed: boolean;
/** Maintains the `solana_program::clock::Slot` that the round was opened at. */
readonly roundOpenSlot: BN; readonly roundOpenSlot: BN;
/** Maintains the `solana_program::clock::UnixTimestamp;` the round was opened at. */
readonly roundOpenTimestamp: BN; readonly roundOpenTimestamp: BN;
/** Maintains the current median of all successful round responses. */
readonly result: types.SwitchboardDecimal; readonly result: types.SwitchboardDecimal;
/** Standard deviation of the accepted results in the round. */
readonly stdDeviation: types.SwitchboardDecimal; readonly stdDeviation: types.SwitchboardDecimal;
/** Maintains the minimum node response this round. */
readonly minResponse: types.SwitchboardDecimal; readonly minResponse: types.SwitchboardDecimal;
/** Maintains the maximum node response this round. */
readonly maxResponse: types.SwitchboardDecimal; readonly maxResponse: types.SwitchboardDecimal;
/** Pubkeys of the oracles fulfilling this round. */
readonly oraclePubkeysData: Array<PublicKey>; readonly oraclePubkeysData: Array<PublicKey>;
/** Represents all successful node responses this round. `NaN` if empty. */
readonly mediansData: Array<types.SwitchboardDecimal>; readonly mediansData: Array<types.SwitchboardDecimal>;
/** Current rewards/slashes oracles have received this round. */
readonly currentPayout: Array<BN>; readonly currentPayout: Array<BN>;
/** Keep track of which responses are fulfilled here. */
readonly mediansFulfilled: Array<boolean>; readonly mediansFulfilled: Array<boolean>;
/** Keeps track of which errors are fulfilled here. */
readonly errorsFulfilled: Array<boolean>; readonly errorsFulfilled: Array<boolean>;
constructor(fields: AggregatorRoundFields) { constructor(fields: AggregatorRoundFields) {

View File

@ -4,26 +4,41 @@ import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-
import * as borsh from '@project-serum/borsh'; import * as borsh from '@project-serum/borsh';
export interface BufferRelayerRoundFields { export interface BufferRelayerRoundFields {
/** Number of successful responses. */
numSuccess: number; numSuccess: number;
/** Number of error responses. */
numError: number; numError: number;
/** Slot when the buffer relayer round was opened. */
roundOpenSlot: BN; roundOpenSlot: BN;
/** Timestamp when the buffer relayer round was opened. */
roundOpenTimestamp: BN; roundOpenTimestamp: BN;
/** The public key of the oracle fulfilling the buffer relayer update request. */
oraclePubkey: PublicKey; oraclePubkey: PublicKey;
} }
export interface BufferRelayerRoundJSON { export interface BufferRelayerRoundJSON {
/** Number of successful responses. */
numSuccess: number; numSuccess: number;
/** Number of error responses. */
numError: number; numError: number;
/** Slot when the buffer relayer round was opened. */
roundOpenSlot: string; roundOpenSlot: string;
/** Timestamp when the buffer relayer round was opened. */
roundOpenTimestamp: string; roundOpenTimestamp: string;
/** The public key of the oracle fulfilling the buffer relayer update request. */
oraclePubkey: string; oraclePubkey: string;
} }
export class BufferRelayerRound { export class BufferRelayerRound {
/** Number of successful responses. */
readonly numSuccess: number; readonly numSuccess: number;
/** Number of error responses. */
readonly numError: number; readonly numError: number;
/** Slot when the buffer relayer round was opened. */
readonly roundOpenSlot: BN; readonly roundOpenSlot: BN;
/** Timestamp when the buffer relayer round was opened. */
readonly roundOpenTimestamp: BN; readonly roundOpenTimestamp: BN;
/** The public key of the oracle fulfilling the buffer relayer update request. */
readonly oraclePubkey: PublicKey; readonly oraclePubkey: PublicKey;
constructor(fields: BufferRelayerRoundFields) { constructor(fields: BufferRelayerRoundFields) {

View File

@ -4,26 +4,41 @@ import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-
import * as borsh from '@project-serum/borsh'; import * as borsh from '@project-serum/borsh';
export interface CallbackZCFields { export interface CallbackZCFields {
/** The program ID of the callback program being invoked. */
programId: PublicKey; programId: PublicKey;
/** The accounts being used in the callback instruction. */
accounts: Array<types.AccountMetaZCFields>; accounts: Array<types.AccountMetaZCFields>;
/** The number of accounts used in the callback */
accountsLen: number; accountsLen: number;
/** The serialized instruction data. */
ixData: Array<number>; ixData: Array<number>;
/** The number of serialized bytes in the instruction data. */
ixDataLen: number; ixDataLen: number;
} }
export interface CallbackZCJSON { export interface CallbackZCJSON {
/** The program ID of the callback program being invoked. */
programId: string; programId: string;
/** The accounts being used in the callback instruction. */
accounts: Array<types.AccountMetaZCJSON>; accounts: Array<types.AccountMetaZCJSON>;
/** The number of accounts used in the callback */
accountsLen: number; accountsLen: number;
/** The serialized instruction data. */
ixData: Array<number>; ixData: Array<number>;
/** The number of serialized bytes in the instruction data. */
ixDataLen: number; ixDataLen: number;
} }
export class CallbackZC { export class CallbackZC {
/** The program ID of the callback program being invoked. */
readonly programId: PublicKey; readonly programId: PublicKey;
/** The accounts being used in the callback instruction. */
readonly accounts: Array<types.AccountMetaZC>; readonly accounts: Array<types.AccountMetaZC>;
/** The number of accounts used in the callback */
readonly accountsLen: number; readonly accountsLen: number;
/** The serialized instruction data. */
readonly ixData: Array<number>; readonly ixData: Array<number>;
/** The number of serialized bytes in the instruction data. */
readonly ixDataLen: number; readonly ixDataLen: number;
constructor(fields: CallbackZCFields) { constructor(fields: CallbackZCFields) {

View File

@ -4,17 +4,23 @@ import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-
import * as borsh from '@project-serum/borsh'; import * as borsh from '@project-serum/borsh';
export interface CrankRowFields { export interface CrankRowFields {
/** The PublicKey of the AggregatorAccountData. */
pubkey: PublicKey; pubkey: PublicKey;
/** The aggregator's next available update time. */
nextTimestamp: BN; nextTimestamp: BN;
} }
export interface CrankRowJSON { export interface CrankRowJSON {
/** The PublicKey of the AggregatorAccountData. */
pubkey: string; pubkey: string;
/** The aggregator's next available update time. */
nextTimestamp: string; nextTimestamp: string;
} }
export class CrankRow { export class CrankRow {
/** The PublicKey of the AggregatorAccountData. */
readonly pubkey: PublicKey; readonly pubkey: PublicKey;
/** The aggregator's next available update time. */
readonly nextTimestamp: BN; readonly nextTimestamp: BN;
constructor(fields: CrankRowFields) { constructor(fields: CrankRowFields) {

View File

@ -4,14 +4,17 @@ import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-
import * as borsh from '@project-serum/borsh'; import * as borsh from '@project-serum/borsh';
export interface HashFields { export interface HashFields {
/** The bytes used to derive the hash. */
data: Array<number>; data: Array<number>;
} }
export interface HashJSON { export interface HashJSON {
/** The bytes used to derive the hash. */
data: Array<number>; data: Array<number>;
} }
export class Hash { export class Hash {
/** The bytes used to derive the hash. */
readonly data: Array<number>; readonly data: Array<number>;
constructor(fields: HashFields) { constructor(fields: HashFields) {

View File

@ -162,6 +162,9 @@ export function fromDecoded(obj: any): types.LanesKind {
if ('AD' in obj) { if ('AD' in obj) {
return new AD(); return new AD();
} }
if ('BCD' in obj) {
return new BCD();
}
throw new Error('Invalid enum object'); throw new Error('Invalid enum object');
} }
@ -183,6 +186,9 @@ export function fromJSON(obj: types.LanesJSON): types.LanesKind {
case 'AD': { case 'AD': {
return new AD(); return new AD();
} }
case 'BCD': {
return new BCD();
}
} }
} }
@ -193,6 +199,7 @@ export function layout(property?: string) {
borsh.struct([], 'AB'), borsh.struct([], 'AB'),
borsh.struct([], 'AC'), borsh.struct([], 'AC'),
borsh.struct([], 'AD'), borsh.struct([], 'AD'),
borsh.struct([], 'BCD'),
]); ]);
if (property !== undefined) { if (property !== undefined) {
return ret.replicate(property); return ret.replicate(property);

View File

@ -4,38 +4,65 @@ import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-
import * as borsh from '@project-serum/borsh'; import * as borsh from '@project-serum/borsh';
export interface OracleMetricsFields { export interface OracleMetricsFields {
/** Number of consecutive successful update request. */
consecutiveSuccess: BN; consecutiveSuccess: BN;
/** Number of consecutive update request that resulted in an error. */
consecutiveError: BN; consecutiveError: BN;
/** Number of consecutive update request that resulted in a disagreement with the accepted median result. */
consecutiveDisagreement: BN; consecutiveDisagreement: BN;
/** Number of consecutive update request that were posted on-chain late and not included in an accepted result. */
consecutiveLateResponse: BN; consecutiveLateResponse: BN;
/** Number of consecutive update request that resulted in a failure. */
consecutiveFailure: BN; consecutiveFailure: BN;
/** Total number of successful update request. */
totalSuccess: BN; totalSuccess: BN;
/** Total number of update request that resulted in an error. */
totalError: BN; totalError: BN;
/** Total number of update request that resulted in a disagreement with the accepted median result. */
totalDisagreement: BN; totalDisagreement: BN;
/** Total number of update request that were posted on-chain late and not included in an accepted result. */
totalLateResponse: BN; totalLateResponse: BN;
} }
export interface OracleMetricsJSON { export interface OracleMetricsJSON {
/** Number of consecutive successful update request. */
consecutiveSuccess: string; consecutiveSuccess: string;
/** Number of consecutive update request that resulted in an error. */
consecutiveError: string; consecutiveError: string;
/** Number of consecutive update request that resulted in a disagreement with the accepted median result. */
consecutiveDisagreement: string; consecutiveDisagreement: string;
/** Number of consecutive update request that were posted on-chain late and not included in an accepted result. */
consecutiveLateResponse: string; consecutiveLateResponse: string;
/** Number of consecutive update request that resulted in a failure. */
consecutiveFailure: string; consecutiveFailure: string;
/** Total number of successful update request. */
totalSuccess: string; totalSuccess: string;
/** Total number of update request that resulted in an error. */
totalError: string; totalError: string;
/** Total number of update request that resulted in a disagreement with the accepted median result. */
totalDisagreement: string; totalDisagreement: string;
/** Total number of update request that were posted on-chain late and not included in an accepted result. */
totalLateResponse: string; totalLateResponse: string;
} }
export class OracleMetrics { export class OracleMetrics {
/** Number of consecutive successful update request. */
readonly consecutiveSuccess: BN; readonly consecutiveSuccess: BN;
/** Number of consecutive update request that resulted in an error. */
readonly consecutiveError: BN; readonly consecutiveError: BN;
/** Number of consecutive update request that resulted in a disagreement with the accepted median result. */
readonly consecutiveDisagreement: BN; readonly consecutiveDisagreement: BN;
/** Number of consecutive update request that were posted on-chain late and not included in an accepted result. */
readonly consecutiveLateResponse: BN; readonly consecutiveLateResponse: BN;
/** Number of consecutive update request that resulted in a failure. */
readonly consecutiveFailure: BN; readonly consecutiveFailure: BN;
/** Total number of successful update request. */
readonly totalSuccess: BN; readonly totalSuccess: BN;
/** Total number of update request that resulted in an error. */
readonly totalError: BN; readonly totalError: BN;
/** Total number of update request that resulted in a disagreement with the accepted median result. */
readonly totalDisagreement: BN; readonly totalDisagreement: BN;
/** Total number of update request that were posted on-chain late and not included in an accepted result. */
readonly totalLateResponse: BN; readonly totalLateResponse: BN;
constructor(fields: OracleMetricsFields) { constructor(fields: OracleMetricsFields) {

View File

@ -4,14 +4,51 @@ import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-
import * as borsh from '@project-serum/borsh'; import * as borsh from '@project-serum/borsh';
export interface ScalarFields { export interface ScalarFields {
/**
* `bytes` is a little-endian byte encoding of an integer representing a scalar modulo the
* group order.
*
* # Invariant
*
* The integer representing this scalar must be bounded above by \\(2\^{255}\\), or
* equivalently the high bit of `bytes[31]` must be zero.
*
* This ensures that there is room for a carry bit when computing a NAF representation.
*/
bytes: Array<number>; bytes: Array<number>;
} }
export interface ScalarJSON { export interface ScalarJSON {
/**
* `bytes` is a little-endian byte encoding of an integer representing a scalar modulo the
* group order.
*
* # Invariant
*
* The integer representing this scalar must be bounded above by \\(2\^{255}\\), or
* equivalently the high bit of `bytes[31]` must be zero.
*
* This ensures that there is room for a carry bit when computing a NAF representation.
*/
bytes: Array<number>; bytes: Array<number>;
} }
/**
* The `Scalar` struct holds an integer \\(s < 2\^{255} \\) which
* represents an element of \\(\mathbb Z / \ell\\).
*/
export class Scalar { export class Scalar {
/**
* `bytes` is a little-endian byte encoding of an integer representing a scalar modulo the
* group order.
*
* # Invariant
*
* The integer representing this scalar must be bounded above by \\(2\^{255}\\), or
* equivalently the high bit of `bytes[31]` must be zero.
*
* This ensures that there is room for a carry bit when computing a NAF representation.
*/
readonly bytes: Array<number>; readonly bytes: Array<number>;
constructor(fields: ScalarFields) { constructor(fields: ScalarFields) {

View File

@ -5,17 +5,32 @@ import * as borsh from '@project-serum/borsh';
import Big from 'big.js'; import Big from 'big.js';
export interface SwitchboardDecimalFields { export interface SwitchboardDecimalFields {
/**
* The part of a floating-point number that represents the significant digits of that number,
* and that is multiplied by the base, 10, raised to the power of scale to give the actual value of the number.
*/
mantissa: BN; mantissa: BN;
/** The number of decimal places to move to the left to yield the actual value. */
scale: number; scale: number;
} }
export interface SwitchboardDecimalJSON { export interface SwitchboardDecimalJSON {
/**
* The part of a floating-point number that represents the significant digits of that number,
* and that is multiplied by the base, 10, raised to the power of scale to give the actual value of the number.
*/
mantissa: string; mantissa: string;
/** The number of decimal places to move to the left to yield the actual value. */
scale: number; scale: number;
} }
export class SwitchboardDecimal { export class SwitchboardDecimal {
/**
* The part of a floating-point number that represents the significant digits of that number,
* and that is multiplied by the base, 10, raised to the power of scale to give the actual value of the number.
*/
readonly mantissa: BN; readonly mantissa: BN;
/** The number of decimal places to move to the left to yield the actual value. */
readonly scale: number; readonly scale: number;
constructor(fields: SwitchboardDecimalFields) { constructor(fields: SwitchboardDecimalFields) {

View File

@ -4,8 +4,11 @@ import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-
import * as borsh from '@project-serum/borsh'; import * as borsh from '@project-serum/borsh';
export interface VrfBuilderFields { export interface VrfBuilderFields {
/** The OracleAccountData that is producing the randomness. */
producer: PublicKey; producer: PublicKey;
/** The current status of the VRF verification. */
status: types.VrfStatusKind; status: types.VrfStatusKind;
/** The VRF proof sourced from the producer. */
reprProof: Array<number>; reprProof: Array<number>;
proof: types.EcvrfProofZCFields; proof: types.EcvrfProofZCFields;
yPoint: PublicKey; yPoint: PublicKey;
@ -39,14 +42,20 @@ export interface VrfBuilderFields {
cPrimeHashbuf: Array<number>; cPrimeHashbuf: Array<number>;
m1: types.FieldElementZCFields; m1: types.FieldElementZCFields;
m2: types.FieldElementZCFields; m2: types.FieldElementZCFields;
/** The number of transactions remaining to verify the VRF proof. */
txRemaining: number; txRemaining: number;
/** Whether the VRF proof has been verified on-chain. */
verified: boolean; verified: boolean;
/** The VRF proof verification result. Will be zeroized if still awaiting fulfillment. */
result: Array<number>; result: Array<number>;
} }
export interface VrfBuilderJSON { export interface VrfBuilderJSON {
/** The OracleAccountData that is producing the randomness. */
producer: string; producer: string;
/** The current status of the VRF verification. */
status: types.VrfStatusJSON; status: types.VrfStatusJSON;
/** The VRF proof sourced from the producer. */
reprProof: Array<number>; reprProof: Array<number>;
proof: types.EcvrfProofZCJSON; proof: types.EcvrfProofZCJSON;
yPoint: string; yPoint: string;
@ -80,14 +89,20 @@ export interface VrfBuilderJSON {
cPrimeHashbuf: Array<number>; cPrimeHashbuf: Array<number>;
m1: types.FieldElementZCJSON; m1: types.FieldElementZCJSON;
m2: types.FieldElementZCJSON; m2: types.FieldElementZCJSON;
/** The number of transactions remaining to verify the VRF proof. */
txRemaining: number; txRemaining: number;
/** Whether the VRF proof has been verified on-chain. */
verified: boolean; verified: boolean;
/** The VRF proof verification result. Will be zeroized if still awaiting fulfillment. */
result: Array<number>; result: Array<number>;
} }
export class VrfBuilder { export class VrfBuilder {
/** The OracleAccountData that is producing the randomness. */
readonly producer: PublicKey; readonly producer: PublicKey;
/** The current status of the VRF verification. */
readonly status: types.VrfStatusKind; readonly status: types.VrfStatusKind;
/** The VRF proof sourced from the producer. */
readonly reprProof: Array<number>; readonly reprProof: Array<number>;
readonly proof: types.EcvrfProofZC; readonly proof: types.EcvrfProofZC;
readonly yPoint: PublicKey; readonly yPoint: PublicKey;
@ -121,8 +136,11 @@ export class VrfBuilder {
readonly cPrimeHashbuf: Array<number>; readonly cPrimeHashbuf: Array<number>;
readonly m1: types.FieldElementZC; readonly m1: types.FieldElementZC;
readonly m2: types.FieldElementZC; readonly m2: types.FieldElementZC;
/** The number of transactions remaining to verify the VRF proof. */
readonly txRemaining: number; readonly txRemaining: number;
/** Whether the VRF proof has been verified on-chain. */
readonly verified: boolean; readonly verified: boolean;
/** The VRF proof verification result. Will be zeroized if still awaiting fulfillment. */
readonly result: Array<number>; readonly result: Array<number>;
constructor(fields: VrfBuilderFields) { constructor(fields: VrfBuilderFields) {

View File

@ -4,32 +4,53 @@ import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-
import * as borsh from '@project-serum/borsh'; import * as borsh from '@project-serum/borsh';
export interface VrfRoundFields { export interface VrfRoundFields {
/** The alpha bytes used to calculate the VRF proof. */
alpha: Array<number>; alpha: Array<number>;
/** The number of bytes in the alpha buffer. */
alphaLen: number; alphaLen: number;
/** The Slot when the VRF round was opened. */
requestSlot: BN; requestSlot: BN;
/** The unix timestamp when the VRF round was opened. */
requestTimestamp: BN; requestTimestamp: BN;
/** The VRF round result. Will be zeroized if still awaiting fulfillment. */
result: Array<number>; result: Array<number>;
/** The number of builders who verified the VRF proof. */
numVerified: number; numVerified: number;
/** Reserved for future info. */
ebuf: Array<number>; ebuf: Array<number>;
} }
export interface VrfRoundJSON { export interface VrfRoundJSON {
/** The alpha bytes used to calculate the VRF proof. */
alpha: Array<number>; alpha: Array<number>;
/** The number of bytes in the alpha buffer. */
alphaLen: number; alphaLen: number;
/** The Slot when the VRF round was opened. */
requestSlot: string; requestSlot: string;
/** The unix timestamp when the VRF round was opened. */
requestTimestamp: string; requestTimestamp: string;
/** The VRF round result. Will be zeroized if still awaiting fulfillment. */
result: Array<number>; result: Array<number>;
/** The number of builders who verified the VRF proof. */
numVerified: number; numVerified: number;
/** Reserved for future info. */
ebuf: Array<number>; ebuf: Array<number>;
} }
export class VrfRound { export class VrfRound {
/** The alpha bytes used to calculate the VRF proof. */
readonly alpha: Array<number>; readonly alpha: Array<number>;
/** The number of bytes in the alpha buffer. */
readonly alphaLen: number; readonly alphaLen: number;
/** The Slot when the VRF round was opened. */
readonly requestSlot: BN; readonly requestSlot: BN;
/** The unix timestamp when the VRF round was opened. */
readonly requestTimestamp: BN; readonly requestTimestamp: BN;
/** The VRF round result. Will be zeroized if still awaiting fulfillment. */
readonly result: Array<number>; readonly result: Array<number>;
/** The number of builders who verified the VRF proof. */
readonly numVerified: number; readonly numVerified: number;
/** Reserved for future info. */
readonly ebuf: Array<number>; readonly ebuf: Array<number>;
constructor(fields: VrfRoundFields) { constructor(fields: VrfRoundFields) {

View File

@ -316,14 +316,42 @@ export { Lanes };
export { Shuffle }; export { Shuffle };
export { Error }; export { Error };
export type LanesKind = Lanes.C | Lanes.D | Lanes.AB | Lanes.AC | Lanes.AD; /**
* The `Lanes` enum represents a subset of the lanes `A,B,C,D` of a
* `FieldElement2625x4`.
*
* It's used to specify blend operations without
* having to know details about the data layout of the
* `FieldElement2625x4`.
*/
export type LanesKind =
| Lanes.C
| Lanes.D
| Lanes.AB
| Lanes.AC
| Lanes.CD
| Lanes.AD
| Lanes.BC
| Lanes.ABCD;
export type LanesJSON = export type LanesJSON =
| Lanes.CJSON | Lanes.CJSON
| Lanes.DJSON | Lanes.DJSON
| Lanes.ABJSON | Lanes.ABJSON
| Lanes.ACJSON | Lanes.ACJSON
| Lanes.ADJSON; | Lanes.CDJSON
| Lanes.ADJSON
| Lanes.BCJSON
| Lanes.ABCDJSON;
export { Shuffle };
/**
* The `Shuffle` enum represents a shuffle of a `FieldElement2625x4`.
*
* The enum variants are named by what they do to a vector \\(
* (A,B,C,D) \\); for instance, `Shuffle::BADC` turns \\( (A, B, C,
* D) \\) into \\( (B, A, D, C) \\).
*/
export type ShuffleKind = export type ShuffleKind =
| Shuffle.AAAA | Shuffle.AAAA
| Shuffle.BBBB | Shuffle.BBBB