added doc comments to generated types
This commit is contained in:
parent
46e68b8f20
commit
872375877d
|
@ -45,13 +45,8 @@ export class OracleAccount extends Account<types.OracleAccountData> {
|
|||
program: SwitchboardProgram,
|
||||
payer: PublicKey,
|
||||
params: {
|
||||
queuePubkey: PublicKey;
|
||||
} & Partial<{
|
||||
mint: PublicKey;
|
||||
name: string;
|
||||
metadata: string;
|
||||
authority: Keypair; // defaults to payer
|
||||
}>
|
||||
queueAccount: QueueAccount;
|
||||
} & OracleInitParams
|
||||
): Promise<[TransactionObject, OracleAccount]> {
|
||||
const tokenWallet = Keypair.generate();
|
||||
// console.log(`tokenWallet`, tokenWallet.publicKey.toBase58());
|
||||
|
@ -60,7 +55,7 @@ export class OracleAccount extends Account<types.OracleAccountData> {
|
|||
|
||||
const [oracleAccount, oracleBump] = OracleAccount.fromSeed(
|
||||
program,
|
||||
params.queuePubkey,
|
||||
params.queueAccount.publicKey,
|
||||
tokenWallet.publicKey
|
||||
);
|
||||
|
||||
|
@ -104,7 +99,7 @@ export class OracleAccount extends Account<types.OracleAccountData> {
|
|||
oracleAuthority: authority,
|
||||
wallet: tokenWallet.publicKey,
|
||||
programState: program.programState.publicKey,
|
||||
queue: params.queuePubkey,
|
||||
queue: params.queueAccount.publicKey,
|
||||
payer,
|
||||
systemProgram: SystemProgram.programId,
|
||||
}
|
||||
|
@ -125,31 +120,12 @@ export class OracleAccount extends Account<types.OracleAccountData> {
|
|||
program: SwitchboardProgram,
|
||||
params: {
|
||||
queueAccount: QueueAccount;
|
||||
} & Partial<{
|
||||
name: string;
|
||||
metadata: string;
|
||||
mint: PublicKey;
|
||||
authority: Keypair; // defaults to payer
|
||||
}>
|
||||
} & OracleInitParams
|
||||
): 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(
|
||||
program,
|
||||
program.walletPubkey,
|
||||
{
|
||||
queuePubkey: params.queueAccount.publicKey,
|
||||
mint: mint,
|
||||
name: params.name,
|
||||
metadata: params.metadata,
|
||||
authority: params.authority,
|
||||
}
|
||||
params
|
||||
);
|
||||
|
||||
const txnSignature = await program.signAndSend(txnObject);
|
||||
|
@ -371,3 +347,12 @@ export class OracleAccount extends Account<types.OracleAccountData> {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,20 @@ export interface PermissionAccountInitParams {
|
|||
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
|
||||
* Account type dictating the level of permissions between a granter and a grantee.
|
||||
|
|
|
@ -24,7 +24,7 @@ import { BufferRelayerAccount, BufferRelayerInit } from './bufferRelayAccount';
|
|||
import { CrankAccount, CrankInitParams } from './crankAccount';
|
||||
import { JobAccount, JobInitParams } from './jobAccount';
|
||||
import { LeaseAccount } from './leaseAccount';
|
||||
import { OracleAccount } from './oracleAccount';
|
||||
import { OracleAccount, OracleInitParams } from './oracleAccount';
|
||||
import { PermissionAccount } from './permissionAccount';
|
||||
import { VrfAccount, VrfInitParams } from './vrfAccount';
|
||||
|
||||
|
@ -119,22 +119,6 @@ export class QueueAccount extends Account<types.OracleQueueAccountData> {
|
|||
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.
|
||||
*/
|
||||
|
@ -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: {
|
||||
name?: string;
|
||||
metadata?: string;
|
||||
enable?: boolean;
|
||||
queueAuthority?: Keypair;
|
||||
authority?: Keypair; // defaults to payer
|
||||
}): 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,
|
||||
public static async create(
|
||||
program: SwitchboardProgram,
|
||||
params: QueueInitParams
|
||||
): Promise<[string, QueueAccount]> {
|
||||
const [txnObject, account] = await this.createInstructions(
|
||||
program,
|
||||
program.walletPubkey,
|
||||
params
|
||||
);
|
||||
|
||||
const signature = await this.program.signAndSend(txn);
|
||||
|
||||
return [signature, oracleAccount];
|
||||
const txnSignature = await program.signAndSend(txnObject);
|
||||
return [txnSignature, account];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@linkcode TransactionObject} that can then be used to create a new {@linkcode OracleAccount} for the queue.
|
||||
*/
|
||||
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,
|
||||
params: {
|
||||
name?: string;
|
||||
metadata?: string;
|
||||
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;
|
||||
authority?: Keypair; // defaults to payer
|
||||
}
|
||||
): Promise<[TransactionObject, OracleAccount]> {
|
||||
const queue = await this.loadData();
|
||||
|
@ -264,7 +233,7 @@ export class QueueAccount extends Account<types.OracleQueueAccountData> {
|
|||
const [createOracleTxnObject, oracleAccount] =
|
||||
await OracleAccount.createInstructions(this.program, payer, {
|
||||
...params,
|
||||
queuePubkey: this.publicKey,
|
||||
queueAccount: this,
|
||||
});
|
||||
|
||||
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}.
|
||||
*
|
||||
|
|
|
@ -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
|
||||
|
||||
export interface AggregatorAccountDataFields {
|
||||
/** Name of the aggregator to store on-chain. */
|
||||
name: Array<number>;
|
||||
/** Metadata of the aggregator to store on-chain. */
|
||||
metadata: Array<number>;
|
||||
/** Reserved. */
|
||||
reserved1: Array<number>;
|
||||
/** Pubkey of the queue the aggregator belongs to. */
|
||||
queuePubkey: PublicKey;
|
||||
/**
|
||||
* CONFIGS
|
||||
* Number of oracles assigned to an update request.
|
||||
*/
|
||||
oracleRequestBatchSize: number;
|
||||
/** Minimum number of oracle responses required before a round is validated. */
|
||||
minOracleResults: number;
|
||||
/** Minimum number of job results before an oracle accepts a result. */
|
||||
minJobResults: number;
|
||||
/** Minimum number of seconds required between aggregator rounds. */
|
||||
minUpdateDelaySeconds: number;
|
||||
/** Unix timestamp for which no feed update will occur before. */
|
||||
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;
|
||||
/** Number of seconds for which, even if the variance threshold is not passed, accept new responses from oracles. */
|
||||
forceReportPeriod: BN;
|
||||
/** Timestamp when the feed is no longer needed. */
|
||||
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;
|
||||
/** Timestamp when the next update request will be available. */
|
||||
nextAllowedUpdateTime: BN;
|
||||
/** Flag for whether an aggregators configuration is locked for editing. */
|
||||
isLocked: boolean;
|
||||
/** Optional, public key of the crank the aggregator is currently using. Event based feeds do not need a crank. */
|
||||
crankPubkey: PublicKey;
|
||||
/** Latest confirmed update request result that has been accepted as valid. */
|
||||
latestConfirmedRound: types.AggregatorRoundFields;
|
||||
/** Oracle results from the current round of update request that has not been accepted as valid yet. */
|
||||
currentRound: types.AggregatorRoundFields;
|
||||
/** List of public keys containing the job definitions for how data is sourced off-chain by oracles. */
|
||||
jobPubkeysData: Array<PublicKey>;
|
||||
/** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment. */
|
||||
jobHashes: Array<types.HashFields>;
|
||||
/** Number of jobs assigned to an oracle. */
|
||||
jobPubkeysSize: number;
|
||||
/** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment. */
|
||||
jobsChecksum: Array<number>;
|
||||
/** The account delegated as the authority for making account changes. */
|
||||
authority: PublicKey;
|
||||
/** Optional, public key of a history buffer account storing the last N accepted results and their timestamps. */
|
||||
historyBuffer: PublicKey;
|
||||
/** The previous confirmed round result. */
|
||||
previousConfirmedRoundResult: types.SwitchboardDecimalFields;
|
||||
/** The slot when the previous confirmed round was opened. */
|
||||
previousConfirmedRoundSlot: BN;
|
||||
/** Whether an aggregator is permitted to join a crank. */
|
||||
disableCrank: boolean;
|
||||
/** Job weights used for the weighted median of the aggregator's assigned job accounts. */
|
||||
jobWeights: Array<number>;
|
||||
/** Unix timestamp when the feed was created. */
|
||||
creationTimestamp: BN;
|
||||
/**
|
||||
* Use sliding window or round based resolution
|
||||
* NOTE: This changes result propogation in latest_round_result
|
||||
*/
|
||||
resolutionMode: types.AggregatorResolutionModeKind;
|
||||
basePriorityFee: number;
|
||||
priorityFeeBump: number;
|
||||
priorityFeeBumpPeriod: number;
|
||||
maxPriorityFeeMultiplier: number;
|
||||
/** Reserved for future info. */
|
||||
ebuf: Array<number>;
|
||||
}
|
||||
|
||||
export interface AggregatorAccountDataJSON {
|
||||
/** Name of the aggregator to store on-chain. */
|
||||
name: Array<number>;
|
||||
/** Metadata of the aggregator to store on-chain. */
|
||||
metadata: Array<number>;
|
||||
/** Reserved. */
|
||||
reserved1: Array<number>;
|
||||
/** Pubkey of the queue the aggregator belongs to. */
|
||||
queuePubkey: string;
|
||||
/**
|
||||
* CONFIGS
|
||||
* Number of oracles assigned to an update request.
|
||||
*/
|
||||
oracleRequestBatchSize: number;
|
||||
/** Minimum number of oracle responses required before a round is validated. */
|
||||
minOracleResults: number;
|
||||
/** Minimum number of job results before an oracle accepts a result. */
|
||||
minJobResults: number;
|
||||
/** Minimum number of seconds required between aggregator rounds. */
|
||||
minUpdateDelaySeconds: number;
|
||||
/** Unix timestamp for which no feed update will occur before. */
|
||||
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;
|
||||
/** Number of seconds for which, even if the variance threshold is not passed, accept new responses from oracles. */
|
||||
forceReportPeriod: string;
|
||||
/** Timestamp when the feed is no longer needed. */
|
||||
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;
|
||||
/** Timestamp when the next update request will be available. */
|
||||
nextAllowedUpdateTime: string;
|
||||
/** Flag for whether an aggregators configuration is locked for editing. */
|
||||
isLocked: boolean;
|
||||
/** Optional, public key of the crank the aggregator is currently using. Event based feeds do not need a crank. */
|
||||
crankPubkey: string;
|
||||
/** Latest confirmed update request result that has been accepted as valid. */
|
||||
latestConfirmedRound: types.AggregatorRoundJSON;
|
||||
/** Oracle results from the current round of update request that has not been accepted as valid yet. */
|
||||
currentRound: types.AggregatorRoundJSON;
|
||||
/** List of public keys containing the job definitions for how data is sourced off-chain by oracles. */
|
||||
jobPubkeysData: Array<string>;
|
||||
/** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment. */
|
||||
jobHashes: Array<types.HashJSON>;
|
||||
/** Number of jobs assigned to an oracle. */
|
||||
jobPubkeysSize: number;
|
||||
/** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment. */
|
||||
jobsChecksum: Array<number>;
|
||||
/** The account delegated as the authority for making account changes. */
|
||||
authority: string;
|
||||
/** Optional, public key of a history buffer account storing the last N accepted results and their timestamps. */
|
||||
historyBuffer: string;
|
||||
/** The previous confirmed round result. */
|
||||
previousConfirmedRoundResult: types.SwitchboardDecimalJSON;
|
||||
/** The slot when the previous confirmed round was opened. */
|
||||
previousConfirmedRoundSlot: string;
|
||||
/** Whether an aggregator is permitted to join a crank. */
|
||||
disableCrank: boolean;
|
||||
/** Job weights used for the weighted median of the aggregator's assigned job accounts. */
|
||||
jobWeights: Array<number>;
|
||||
/** Unix timestamp when the feed was created. */
|
||||
creationTimestamp: string;
|
||||
/**
|
||||
* Use sliding window or round based resolution
|
||||
* NOTE: This changes result propogation in latest_round_result
|
||||
*/
|
||||
resolutionMode: types.AggregatorResolutionModeJSON;
|
||||
basePriorityFee: number;
|
||||
priorityFeeBump: number;
|
||||
priorityFeeBumpPeriod: number;
|
||||
maxPriorityFeeMultiplier: number;
|
||||
/** Reserved for future info. */
|
||||
ebuf: Array<number>;
|
||||
}
|
||||
|
||||
export class AggregatorAccountData {
|
||||
/** Name of the aggregator to store on-chain. */
|
||||
readonly name: Array<number>;
|
||||
/** Metadata of the aggregator to store on-chain. */
|
||||
readonly metadata: Array<number>;
|
||||
/** Reserved. */
|
||||
readonly reserved1: Array<number>;
|
||||
/** Pubkey of the queue the aggregator belongs to. */
|
||||
readonly queuePubkey: PublicKey;
|
||||
/**
|
||||
* CONFIGS
|
||||
* Number of oracles assigned to an update request.
|
||||
*/
|
||||
readonly oracleRequestBatchSize: number;
|
||||
/** Minimum number of oracle responses required before a round is validated. */
|
||||
readonly minOracleResults: number;
|
||||
/** Minimum number of job results before an oracle accepts a result. */
|
||||
readonly minJobResults: number;
|
||||
/** Minimum number of seconds required between aggregator rounds. */
|
||||
readonly minUpdateDelaySeconds: number;
|
||||
/** Unix timestamp for which no feed update will occur before. */
|
||||
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;
|
||||
/** Number of seconds for which, even if the variance threshold is not passed, accept new responses from oracles. */
|
||||
readonly forceReportPeriod: BN;
|
||||
/** Timestamp when the feed is no longer needed. */
|
||||
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;
|
||||
/** Timestamp when the next update request will be available. */
|
||||
readonly nextAllowedUpdateTime: BN;
|
||||
/** Flag for whether an aggregators configuration is locked for editing. */
|
||||
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;
|
||||
/** Latest confirmed update request result that has been accepted as valid. */
|
||||
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;
|
||||
/** List of public keys containing the job definitions for how data is sourced off-chain by oracles. */
|
||||
readonly jobPubkeysData: Array<PublicKey>;
|
||||
/** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment. */
|
||||
readonly jobHashes: Array<types.Hash>;
|
||||
/** Number of jobs assigned to an oracle. */
|
||||
readonly jobPubkeysSize: number;
|
||||
/** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment. */
|
||||
readonly jobsChecksum: Array<number>;
|
||||
/** The account delegated as the authority for making account changes. */
|
||||
readonly authority: PublicKey;
|
||||
/** Optional, public key of a history buffer account storing the last N accepted results and their timestamps. */
|
||||
readonly historyBuffer: PublicKey;
|
||||
/** The previous confirmed round result. */
|
||||
readonly previousConfirmedRoundResult: types.SwitchboardDecimal;
|
||||
/** The slot when the previous confirmed round was opened. */
|
||||
readonly previousConfirmedRoundSlot: BN;
|
||||
/** Whether an aggregator is permitted to join a crank. */
|
||||
readonly disableCrank: boolean;
|
||||
/** Job weights used for the weighted median of the aggregator's assigned job accounts. */
|
||||
readonly jobWeights: Array<number>;
|
||||
/** Unix timestamp when the feed was created. */
|
||||
readonly creationTimestamp: BN;
|
||||
/**
|
||||
* Use sliding window or round based resolution
|
||||
* NOTE: This changes result propogation in latest_round_result
|
||||
*/
|
||||
readonly resolutionMode: types.AggregatorResolutionModeKind;
|
||||
readonly basePriorityFee: number;
|
||||
readonly priorityFeeBump: number;
|
||||
readonly priorityFeeBumpPeriod: number;
|
||||
readonly maxPriorityFeeMultiplier: number;
|
||||
/** Reserved for future info. */
|
||||
readonly ebuf: Array<number>;
|
||||
|
||||
static readonly discriminator = Buffer.from([
|
||||
|
|
|
@ -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
|
||||
|
||||
export interface BufferRelayerAccountDataFields {
|
||||
/** Name of the buffer account to store on-chain. */
|
||||
name: Array<number>;
|
||||
/** Public key of the OracleQueueAccountData that is currently assigned to fulfill buffer relayer update request. */
|
||||
queuePubkey: PublicKey;
|
||||
/** Token account to reward oracles for completing update request. */
|
||||
escrow: PublicKey;
|
||||
/** The account delegated as the authority for making account changes. */
|
||||
authority: PublicKey;
|
||||
/** Public key of the JobAccountData that defines how the buffer relayer is updated. */
|
||||
jobPubkey: PublicKey;
|
||||
/** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment */
|
||||
jobHash: Array<number>;
|
||||
/** Minimum delay between update request. */
|
||||
minUpdateDelaySeconds: number;
|
||||
/** Whether buffer relayer config is locked for further changes. */
|
||||
isLocked: boolean;
|
||||
/** The current buffer relayer update round that is yet to be confirmed. */
|
||||
currentRound: types.BufferRelayerRoundFields;
|
||||
/** The latest confirmed buffer relayer update round. */
|
||||
latestConfirmedRound: types.BufferRelayerRoundFields;
|
||||
/** The buffer holding the latest confirmed result. */
|
||||
result: Uint8Array;
|
||||
}
|
||||
|
||||
export interface BufferRelayerAccountDataJSON {
|
||||
/** Name of the buffer account to store on-chain. */
|
||||
name: Array<number>;
|
||||
/** Public key of the OracleQueueAccountData that is currently assigned to fulfill buffer relayer update request. */
|
||||
queuePubkey: string;
|
||||
/** Token account to reward oracles for completing update request. */
|
||||
escrow: string;
|
||||
/** The account delegated as the authority for making account changes. */
|
||||
authority: string;
|
||||
/** Public key of the JobAccountData that defines how the buffer relayer is updated. */
|
||||
jobPubkey: string;
|
||||
/** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment */
|
||||
jobHash: Array<number>;
|
||||
/** Minimum delay between update request. */
|
||||
minUpdateDelaySeconds: number;
|
||||
/** Whether buffer relayer config is locked for further changes. */
|
||||
isLocked: boolean;
|
||||
/** The current buffer relayer update round that is yet to be confirmed. */
|
||||
currentRound: types.BufferRelayerRoundJSON;
|
||||
/** The latest confirmed buffer relayer update round. */
|
||||
latestConfirmedRound: types.BufferRelayerRoundJSON;
|
||||
/** The buffer holding the latest confirmed result. */
|
||||
result: Array<number>;
|
||||
}
|
||||
|
||||
export class BufferRelayerAccountData {
|
||||
/** Name of the buffer account to store on-chain. */
|
||||
readonly name: Array<number>;
|
||||
/** Public key of the OracleQueueAccountData that is currently assigned to fulfill buffer relayer update request. */
|
||||
readonly queuePubkey: PublicKey;
|
||||
/** Token account to reward oracles for completing update request. */
|
||||
readonly escrow: PublicKey;
|
||||
/** The account delegated as the authority for making account changes. */
|
||||
readonly authority: PublicKey;
|
||||
/** Public key of the JobAccountData that defines how the buffer relayer is updated. */
|
||||
readonly jobPubkey: PublicKey;
|
||||
/** Used to protect against malicious RPC nodes providing incorrect task definitions to oracles before fulfillment */
|
||||
readonly jobHash: Array<number>;
|
||||
/** Minimum delay between update request. */
|
||||
readonly minUpdateDelaySeconds: number;
|
||||
/** Whether buffer relayer config is locked for further changes. */
|
||||
readonly isLocked: boolean;
|
||||
/** The current buffer relayer update round that is yet to be confirmed. */
|
||||
readonly currentRound: types.BufferRelayerRound;
|
||||
/** The latest confirmed buffer relayer update round. */
|
||||
readonly latestConfirmedRound: types.BufferRelayerRound;
|
||||
/** The buffer holding the latest confirmed result. */
|
||||
readonly result: Uint8Array;
|
||||
|
||||
static readonly discriminator = Buffer.from([
|
||||
|
|
|
@ -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
|
||||
|
||||
export interface CrankAccountDataFields {
|
||||
/** Name of the crank to store on-chain. */
|
||||
name: Array<number>;
|
||||
/** Metadata of the crank to store on-chain. */
|
||||
metadata: Array<number>;
|
||||
/** Public key of the oracle queue who owns the crank. */
|
||||
queuePubkey: PublicKey;
|
||||
/** Number of aggregators added to the crank. */
|
||||
pqSize: number;
|
||||
/** Maximum number of aggregators allowed to be added to a crank. */
|
||||
maxRows: number;
|
||||
/** Pseudorandom value added to next aggregator update time. */
|
||||
jitterModifier: number;
|
||||
/** Reserved for future info. */
|
||||
ebuf: Array<number>;
|
||||
/** The public key of the CrankBuffer account holding a collection of Aggregator pubkeys and their next allowed update time. */
|
||||
dataBuffer: PublicKey;
|
||||
}
|
||||
|
||||
export interface CrankAccountDataJSON {
|
||||
/** Name of the crank to store on-chain. */
|
||||
name: Array<number>;
|
||||
/** Metadata of the crank to store on-chain. */
|
||||
metadata: Array<number>;
|
||||
/** Public key of the oracle queue who owns the crank. */
|
||||
queuePubkey: string;
|
||||
/** Number of aggregators added to the crank. */
|
||||
pqSize: number;
|
||||
/** Maximum number of aggregators allowed to be added to a crank. */
|
||||
maxRows: number;
|
||||
/** Pseudorandom value added to next aggregator update time. */
|
||||
jitterModifier: number;
|
||||
/** Reserved for future info. */
|
||||
ebuf: Array<number>;
|
||||
/** The public key of the CrankBuffer account holding a collection of Aggregator pubkeys and their next allowed update time. */
|
||||
dataBuffer: string;
|
||||
}
|
||||
|
||||
export class CrankAccountData {
|
||||
/** Name of the crank to store on-chain. */
|
||||
readonly name: Array<number>;
|
||||
/** Metadata of the crank to store on-chain. */
|
||||
readonly metadata: Array<number>;
|
||||
/** Public key of the oracle queue who owns the crank. */
|
||||
readonly queuePubkey: PublicKey;
|
||||
/** Number of aggregators added to the crank. */
|
||||
readonly pqSize: number;
|
||||
/** Maximum number of aggregators allowed to be added to a crank. */
|
||||
readonly maxRows: number;
|
||||
/** Pseudorandom value added to next aggregator update time. */
|
||||
readonly jitterModifier: number;
|
||||
/** Reserved for future info. */
|
||||
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;
|
||||
|
||||
static readonly discriminator = Buffer.from([
|
||||
|
|
|
@ -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
|
||||
|
||||
export interface JobAccountDataFields {
|
||||
/** Name of the job to store on-chain. */
|
||||
name: Array<number>;
|
||||
/** Metadata of the job to store on-chain. */
|
||||
metadata: Array<number>;
|
||||
/** The account delegated as the authority for making account changes. */
|
||||
authority: PublicKey;
|
||||
/** Unix timestamp when the job is considered invalid */
|
||||
expiration: BN;
|
||||
/** Hash of the serialized data to prevent tampering. */
|
||||
hash: Array<number>;
|
||||
/** Serialized protobuf containing the collection of task to retrieve data off-chain. */
|
||||
data: Uint8Array;
|
||||
/** The number of data feeds referencing the job account.. */
|
||||
referenceCount: number;
|
||||
/** The token amount funded into a feed that contains this job account. */
|
||||
totalSpent: BN;
|
||||
/** Unix timestamp when the job was created on-chain. */
|
||||
createdAt: BN;
|
||||
isInitializing: number;
|
||||
}
|
||||
|
||||
export interface JobAccountDataJSON {
|
||||
/** Name of the job to store on-chain. */
|
||||
name: Array<number>;
|
||||
/** Metadata of the job to store on-chain. */
|
||||
metadata: Array<number>;
|
||||
/** The account delegated as the authority for making account changes. */
|
||||
authority: string;
|
||||
/** Unix timestamp when the job is considered invalid */
|
||||
expiration: string;
|
||||
/** Hash of the serialized data to prevent tampering. */
|
||||
hash: Array<number>;
|
||||
/** Serialized protobuf containing the collection of task to retrieve data off-chain. */
|
||||
data: Array<number>;
|
||||
/** The number of data feeds referencing the job account.. */
|
||||
referenceCount: number;
|
||||
/** The token amount funded into a feed that contains this job account. */
|
||||
totalSpent: string;
|
||||
/** Unix timestamp when the job was created on-chain. */
|
||||
createdAt: string;
|
||||
isInitializing: number;
|
||||
}
|
||||
|
||||
export class JobAccountData {
|
||||
/** Name of the job to store on-chain. */
|
||||
readonly name: Array<number>;
|
||||
/** Metadata of the job to store on-chain. */
|
||||
readonly metadata: Array<number>;
|
||||
/** The account delegated as the authority for making account changes. */
|
||||
readonly authority: PublicKey;
|
||||
/** Unix timestamp when the job is considered invalid */
|
||||
readonly expiration: BN;
|
||||
/** Hash of the serialized data to prevent tampering. */
|
||||
readonly hash: Array<number>;
|
||||
/** Serialized protobuf containing the collection of task to retrieve data off-chain. */
|
||||
readonly data: Uint8Array;
|
||||
/** The number of data feeds referencing the job account.. */
|
||||
readonly referenceCount: number;
|
||||
/** The token amount funded into a feed that contains this job account. */
|
||||
readonly totalSpent: BN;
|
||||
/** Unix timestamp when the job was created on-chain. */
|
||||
readonly createdAt: BN;
|
||||
readonly isInitializing: number;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
export interface LeaseAccountDataFields {
|
||||
/** Public key of the token account holding the lease contract funds until rewarded to oracles for successfully processing updates */
|
||||
escrow: PublicKey;
|
||||
/** Public key of the oracle queue that the lease contract is applicable for. */
|
||||
queue: PublicKey;
|
||||
/** Public key of the aggregator that the lease contract is applicable for */
|
||||
aggregator: PublicKey;
|
||||
/** Public key of the Solana token program ID. */
|
||||
tokenProgram: PublicKey;
|
||||
/** Whether the lease contract is still active. */
|
||||
isActive: boolean;
|
||||
/** Index of an aggregators position on a crank. */
|
||||
crankRowCount: number;
|
||||
/** Timestamp when the lease contract was created. */
|
||||
createdAt: BN;
|
||||
/** Counter keeping track of the number of updates for the given aggregator. */
|
||||
updateCount: BN;
|
||||
/** Public key of keypair that may withdraw funds from the lease at any time */
|
||||
withdrawAuthority: PublicKey;
|
||||
ebuf: Array<number>;
|
||||
}
|
||||
|
||||
export interface LeaseAccountDataJSON {
|
||||
/** Public key of the token account holding the lease contract funds until rewarded to oracles for successfully processing updates */
|
||||
escrow: string;
|
||||
/** Public key of the oracle queue that the lease contract is applicable for. */
|
||||
queue: string;
|
||||
/** Public key of the aggregator that the lease contract is applicable for */
|
||||
aggregator: string;
|
||||
/** Public key of the Solana token program ID. */
|
||||
tokenProgram: string;
|
||||
/** Whether the lease contract is still active. */
|
||||
isActive: boolean;
|
||||
/** Index of an aggregators position on a crank. */
|
||||
crankRowCount: number;
|
||||
/** Timestamp when the lease contract was created. */
|
||||
createdAt: string;
|
||||
/** Counter keeping track of the number of updates for the given aggregator. */
|
||||
updateCount: string;
|
||||
/** Public key of keypair that may withdraw funds from the lease at any time */
|
||||
withdrawAuthority: string;
|
||||
ebuf: Array<number>;
|
||||
}
|
||||
|
||||
/** This should be any ccount that links a permission to an escrow */
|
||||
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;
|
||||
/** Public key of the oracle queue that the lease contract is applicable for. */
|
||||
readonly queue: PublicKey;
|
||||
/** Public key of the aggregator that the lease contract is applicable for */
|
||||
readonly aggregator: PublicKey;
|
||||
/** Public key of the Solana token program ID. */
|
||||
readonly tokenProgram: PublicKey;
|
||||
/** Whether the lease contract is still active. */
|
||||
readonly isActive: boolean;
|
||||
/** Index of an aggregators position on a crank. */
|
||||
readonly crankRowCount: number;
|
||||
/** Timestamp when the lease contract was created. */
|
||||
readonly createdAt: BN;
|
||||
/** Counter keeping track of the number of updates for the given aggregator. */
|
||||
readonly updateCount: BN;
|
||||
/** Public key of keypair that may withdraw funds from the lease at any time */
|
||||
readonly withdrawAuthority: PublicKey;
|
||||
readonly ebuf: Array<number>;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
export interface OracleAccountDataFields {
|
||||
/** Name of the oracle to store on-chain. */
|
||||
name: Array<number>;
|
||||
/** Metadata of the oracle to store on-chain. */
|
||||
metadata: Array<number>;
|
||||
/** The account delegated as the authority for making account changes or withdrawing funds from a staking wallet. */
|
||||
oracleAuthority: PublicKey;
|
||||
/** Unix timestamp when the oracle last heartbeated */
|
||||
lastHeartbeat: BN;
|
||||
/** Flag dictating if an oracle is active and has heartbeated before the queue's oracle timeout parameter. */
|
||||
numInUse: number;
|
||||
/** Stake account and reward/slashing wallet. */
|
||||
tokenAccount: PublicKey;
|
||||
/** Public key of the oracle queue who has granted it permission to use its resources. */
|
||||
queuePubkey: PublicKey;
|
||||
/** Oracle track record. */
|
||||
metrics: types.OracleMetricsFields;
|
||||
/** Reserved for future info. */
|
||||
ebuf: Array<number>;
|
||||
}
|
||||
|
||||
export interface OracleAccountDataJSON {
|
||||
/** Name of the oracle to store on-chain. */
|
||||
name: Array<number>;
|
||||
/** Metadata of the oracle to store on-chain. */
|
||||
metadata: Array<number>;
|
||||
/** The account delegated as the authority for making account changes or withdrawing funds from a staking wallet. */
|
||||
oracleAuthority: string;
|
||||
/** Unix timestamp when the oracle last heartbeated */
|
||||
lastHeartbeat: string;
|
||||
/** Flag dictating if an oracle is active and has heartbeated before the queue's oracle timeout parameter. */
|
||||
numInUse: number;
|
||||
/** Stake account and reward/slashing wallet. */
|
||||
tokenAccount: string;
|
||||
/** Public key of the oracle queue who has granted it permission to use its resources. */
|
||||
queuePubkey: string;
|
||||
/** Oracle track record. */
|
||||
metrics: types.OracleMetricsJSON;
|
||||
/** Reserved for future info. */
|
||||
ebuf: Array<number>;
|
||||
}
|
||||
|
||||
export class OracleAccountData {
|
||||
/** Name of the oracle to store on-chain. */
|
||||
readonly name: Array<number>;
|
||||
/** Metadata of the oracle to store on-chain. */
|
||||
readonly metadata: Array<number>;
|
||||
/** The account delegated as the authority for making account changes or withdrawing funds from a staking wallet. */
|
||||
readonly oracleAuthority: PublicKey;
|
||||
/** Unix timestamp when the oracle last heartbeated */
|
||||
readonly lastHeartbeat: BN;
|
||||
/** Flag dictating if an oracle is active and has heartbeated before the queue's oracle timeout parameter. */
|
||||
readonly numInUse: number;
|
||||
/** Stake account and reward/slashing wallet. */
|
||||
readonly tokenAccount: PublicKey;
|
||||
/** Public key of the oracle queue who has granted it permission to use its resources. */
|
||||
readonly queuePubkey: PublicKey;
|
||||
/** Oracle track record. */
|
||||
readonly metrics: types.OracleMetrics;
|
||||
/** Reserved for future info. */
|
||||
readonly ebuf: Array<number>;
|
||||
|
||||
static readonly discriminator = Buffer.from([
|
||||
|
|
|
@ -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
|
||||
|
||||
export interface OracleQueueAccountDataFields {
|
||||
/** Name of the queue to store on-chain. */
|
||||
name: Array<number>;
|
||||
/** Metadata of the queue to store on-chain. */
|
||||
metadata: Array<number>;
|
||||
/** The account delegated as the authority for making account changes or assigning permissions targeted at the queue. */
|
||||
authority: PublicKey;
|
||||
/** Interval when stale oracles will be removed if they fail to heartbeat. */
|
||||
oracleTimeout: number;
|
||||
/** Rewards to provide oracles and round openers on this queue. */
|
||||
reward: BN;
|
||||
/** The minimum amount of stake oracles must present to remain on the queue. */
|
||||
minStake: BN;
|
||||
/** Whether slashing is enabled on this queue. */
|
||||
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;
|
||||
/**
|
||||
* Number of update rounds new feeds are on probation for.
|
||||
* If a feed returns 429s within probation period, auto disable permissions.
|
||||
*/
|
||||
feedProbationPeriod: number;
|
||||
/** Current index of the oracle rotation. */
|
||||
currIdx: number;
|
||||
/** Current number of oracles on a queue. */
|
||||
size: number;
|
||||
/** Garbage collection index. */
|
||||
gcIdx: number;
|
||||
/** Consecutive failure limit for a feed before feed permission is revoked. */
|
||||
consecutiveFeedFailureLimit: BN;
|
||||
/** Consecutive failure limit for an oracle before oracle permission is revoked. */
|
||||
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;
|
||||
/** Enabling this setting means VRF accounts do not need explicit permission to join the queue and request new values from its oracles. */
|
||||
unpermissionedVrfEnabled: boolean;
|
||||
/** TODO: Revenue percentage rewarded to job curators overall. */
|
||||
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;
|
||||
/** Token mint used for the oracle queue rewards and slashing. */
|
||||
mint: PublicKey;
|
||||
/** Whether oracles are permitted to fulfill buffer relayer update request. */
|
||||
enableBufferRelayers: boolean;
|
||||
/** Reserved for future info. */
|
||||
ebuf: Array<number>;
|
||||
/** Maximum number of oracles a queue can support. */
|
||||
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;
|
||||
}
|
||||
|
||||
export interface OracleQueueAccountDataJSON {
|
||||
/** Name of the queue to store on-chain. */
|
||||
name: Array<number>;
|
||||
/** Metadata of the queue to store on-chain. */
|
||||
metadata: Array<number>;
|
||||
/** The account delegated as the authority for making account changes or assigning permissions targeted at the queue. */
|
||||
authority: string;
|
||||
/** Interval when stale oracles will be removed if they fail to heartbeat. */
|
||||
oracleTimeout: number;
|
||||
/** Rewards to provide oracles and round openers on this queue. */
|
||||
reward: string;
|
||||
/** The minimum amount of stake oracles must present to remain on the queue. */
|
||||
minStake: string;
|
||||
/** Whether slashing is enabled on this queue. */
|
||||
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;
|
||||
/**
|
||||
* Number of update rounds new feeds are on probation for.
|
||||
* If a feed returns 429s within probation period, auto disable permissions.
|
||||
*/
|
||||
feedProbationPeriod: number;
|
||||
/** Current index of the oracle rotation. */
|
||||
currIdx: number;
|
||||
/** Current number of oracles on a queue. */
|
||||
size: number;
|
||||
/** Garbage collection index. */
|
||||
gcIdx: number;
|
||||
/** Consecutive failure limit for a feed before feed permission is revoked. */
|
||||
consecutiveFeedFailureLimit: string;
|
||||
/** Consecutive failure limit for an oracle before oracle permission is revoked. */
|
||||
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;
|
||||
/** Enabling this setting means VRF accounts do not need explicit permission to join the queue and request new values from its oracles. */
|
||||
unpermissionedVrfEnabled: boolean;
|
||||
/** TODO: Revenue percentage rewarded to job curators overall. */
|
||||
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;
|
||||
/** Token mint used for the oracle queue rewards and slashing. */
|
||||
mint: string;
|
||||
/** Whether oracles are permitted to fulfill buffer relayer update request. */
|
||||
enableBufferRelayers: boolean;
|
||||
/** Reserved for future info. */
|
||||
ebuf: Array<number>;
|
||||
/** Maximum number of oracles a queue can support. */
|
||||
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;
|
||||
}
|
||||
|
||||
export class OracleQueueAccountData {
|
||||
/** Name of the queue to store on-chain. */
|
||||
readonly name: Array<number>;
|
||||
/** Metadata of the queue to store on-chain. */
|
||||
readonly metadata: Array<number>;
|
||||
/** The account delegated as the authority for making account changes or assigning permissions targeted at the queue. */
|
||||
readonly authority: PublicKey;
|
||||
/** Interval when stale oracles will be removed if they fail to heartbeat. */
|
||||
readonly oracleTimeout: number;
|
||||
/** Rewards to provide oracles and round openers on this queue. */
|
||||
readonly reward: BN;
|
||||
/** The minimum amount of stake oracles must present to remain on the queue. */
|
||||
readonly minStake: BN;
|
||||
/** Whether slashing is enabled on this queue. */
|
||||
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;
|
||||
/**
|
||||
* Number of update rounds new feeds are on probation for.
|
||||
* If a feed returns 429s within probation period, auto disable permissions.
|
||||
*/
|
||||
readonly feedProbationPeriod: number;
|
||||
/** Current index of the oracle rotation. */
|
||||
readonly currIdx: number;
|
||||
/** Current number of oracles on a queue. */
|
||||
readonly size: number;
|
||||
/** Garbage collection index. */
|
||||
readonly gcIdx: number;
|
||||
/** Consecutive failure limit for a feed before feed permission is revoked. */
|
||||
readonly consecutiveFeedFailureLimit: BN;
|
||||
/** Consecutive failure limit for an oracle before oracle permission is revoked. */
|
||||
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;
|
||||
/** 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;
|
||||
/** TODO: Revenue percentage rewarded to job curators overall. */
|
||||
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;
|
||||
/** Token mint used for the oracle queue rewards and slashing. */
|
||||
readonly mint: PublicKey;
|
||||
/** Whether oracles are permitted to fulfill buffer relayer update request. */
|
||||
readonly enableBufferRelayers: boolean;
|
||||
/** Reserved for future info. */
|
||||
readonly ebuf: Array<number>;
|
||||
/** Maximum number of oracles a queue can support. */
|
||||
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;
|
||||
|
||||
static readonly discriminator = Buffer.from([
|
||||
|
|
|
@ -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
|
||||
|
||||
export interface PermissionAccountDataFields {
|
||||
/** The authority that is allowed to set permissions for this account. */
|
||||
authority: PublicKey;
|
||||
/** The SwitchboardPermission enumeration assigned by the granter to the grantee. */
|
||||
permissions: number;
|
||||
/** Public key of account that is granting permissions to use its resources. */
|
||||
granter: PublicKey;
|
||||
/** Public key of account that is being assigned permissions to use a granters resources. */
|
||||
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;
|
||||
/** Reserved for future info. */
|
||||
ebuf: Array<number>;
|
||||
}
|
||||
|
||||
export interface PermissionAccountDataJSON {
|
||||
/** The authority that is allowed to set permissions for this account. */
|
||||
authority: string;
|
||||
/** The SwitchboardPermission enumeration assigned by the granter to the grantee. */
|
||||
permissions: number;
|
||||
/** Public key of account that is granting permissions to use its resources. */
|
||||
granter: string;
|
||||
/** Public key of account that is being assigned permissions to use a granters resources. */
|
||||
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;
|
||||
/** Reserved for future info. */
|
||||
ebuf: Array<number>;
|
||||
}
|
||||
|
||||
export class PermissionAccountData {
|
||||
/** The authority that is allowed to set permissions for this account. */
|
||||
readonly authority: PublicKey;
|
||||
/** The SwitchboardPermission enumeration assigned by the granter to the grantee. */
|
||||
readonly permissions: number;
|
||||
/** Public key of account that is granting permissions to use its resources. */
|
||||
readonly granter: PublicKey;
|
||||
/** Public key of account that is being assigned permissions to use a granters resources. */
|
||||
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;
|
||||
/** Reserved for future info. */
|
||||
readonly ebuf: Array<number>;
|
||||
|
||||
static readonly discriminator = Buffer.from([
|
||||
|
|
|
@ -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
|
||||
|
||||
export interface SbStateFields {
|
||||
/** The account authority permitted to make account changes. */
|
||||
authority: PublicKey;
|
||||
/** The token mint used for oracle rewards, aggregator leases, and other reward incentives. */
|
||||
tokenMint: PublicKey;
|
||||
/** Token vault used by the program to receive kickbacks. */
|
||||
tokenVault: PublicKey;
|
||||
/** The token mint used by the DAO. */
|
||||
daoMint: PublicKey;
|
||||
/** Reserved for future info. */
|
||||
ebuf: Array<number>;
|
||||
}
|
||||
|
||||
export interface SbStateJSON {
|
||||
/** The account authority permitted to make account changes. */
|
||||
authority: string;
|
||||
/** The token mint used for oracle rewards, aggregator leases, and other reward incentives. */
|
||||
tokenMint: string;
|
||||
/** Token vault used by the program to receive kickbacks. */
|
||||
tokenVault: string;
|
||||
/** The token mint used by the DAO. */
|
||||
daoMint: string;
|
||||
/** Reserved for future info. */
|
||||
ebuf: Array<number>;
|
||||
}
|
||||
|
||||
export class SbState {
|
||||
/** The account authority permitted to make account changes. */
|
||||
readonly authority: PublicKey;
|
||||
/** The token mint used for oracle rewards, aggregator leases, and other reward incentives. */
|
||||
readonly tokenMint: PublicKey;
|
||||
/** Token vault used by the program to receive kickbacks. */
|
||||
readonly tokenVault: PublicKey;
|
||||
/** The token mint used by the DAO. */
|
||||
readonly daoMint: PublicKey;
|
||||
/** Reserved for future info. */
|
||||
readonly ebuf: Array<number>;
|
||||
|
||||
static readonly discriminator = Buffer.from([
|
||||
|
|
|
@ -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
|
||||
|
||||
export interface VrfAccountDataFields {
|
||||
/** The current status of the VRF account. */
|
||||
status: types.VrfStatusKind;
|
||||
/** Incremental counter for tracking VRF rounds. */
|
||||
counter: BN;
|
||||
/** On-chain account delegated for making account changes. */
|
||||
authority: PublicKey;
|
||||
/** The OracleQueueAccountData that is assigned to fulfill VRF update request. */
|
||||
oracleQueue: PublicKey;
|
||||
/** The token account used to hold funds for VRF update request. */
|
||||
escrow: PublicKey;
|
||||
/** The callback that is invoked when an update request is successfully verified. */
|
||||
callback: types.CallbackZCFields;
|
||||
/** The number of oracles assigned to a VRF update request. */
|
||||
batchSize: number;
|
||||
/** Struct containing the intermediate state between VRF crank actions. */
|
||||
builders: Array<types.VrfBuilderFields>;
|
||||
/** The number of builders. */
|
||||
buildersLen: number;
|
||||
testMode: boolean;
|
||||
/** Oracle results from the current round of update request that has not been accepted as valid yet */
|
||||
currentRound: types.VrfRoundFields;
|
||||
/** Reserved for future info. */
|
||||
ebuf: Array<number>;
|
||||
}
|
||||
|
||||
export interface VrfAccountDataJSON {
|
||||
/** The current status of the VRF account. */
|
||||
status: types.VrfStatusJSON;
|
||||
/** Incremental counter for tracking VRF rounds. */
|
||||
counter: string;
|
||||
/** On-chain account delegated for making account changes. */
|
||||
authority: string;
|
||||
/** The OracleQueueAccountData that is assigned to fulfill VRF update request. */
|
||||
oracleQueue: string;
|
||||
/** The token account used to hold funds for VRF update request. */
|
||||
escrow: string;
|
||||
/** The callback that is invoked when an update request is successfully verified. */
|
||||
callback: types.CallbackZCJSON;
|
||||
/** The number of oracles assigned to a VRF update request. */
|
||||
batchSize: number;
|
||||
/** Struct containing the intermediate state between VRF crank actions. */
|
||||
builders: Array<types.VrfBuilderJSON>;
|
||||
/** The number of builders. */
|
||||
buildersLen: number;
|
||||
testMode: boolean;
|
||||
/** Oracle results from the current round of update request that has not been accepted as valid yet */
|
||||
currentRound: types.VrfRoundJSON;
|
||||
/** Reserved for future info. */
|
||||
ebuf: Array<number>;
|
||||
}
|
||||
|
||||
export class VrfAccountData {
|
||||
/** The current status of the VRF account. */
|
||||
readonly status: types.VrfStatusKind;
|
||||
/** Incremental counter for tracking VRF rounds. */
|
||||
readonly counter: BN;
|
||||
/** On-chain account delegated for making account changes. */
|
||||
readonly authority: PublicKey;
|
||||
/** The OracleQueueAccountData that is assigned to fulfill VRF update request. */
|
||||
readonly oracleQueue: PublicKey;
|
||||
/** The token account used to hold funds for VRF update request. */
|
||||
readonly escrow: PublicKey;
|
||||
/** The callback that is invoked when an update request is successfully verified. */
|
||||
readonly callback: types.CallbackZC;
|
||||
/** The number of oracles assigned to a VRF update request. */
|
||||
readonly batchSize: number;
|
||||
/** Struct containing the intermediate state between VRF crank actions. */
|
||||
readonly builders: Array<types.VrfBuilder>;
|
||||
/** The number of builders. */
|
||||
readonly buildersLen: number;
|
||||
readonly testMode: boolean;
|
||||
/** Oracle results from the current round of update request that has not been accepted as valid yet */
|
||||
readonly currentRound: types.VrfRound;
|
||||
/** Reserved for future info. */
|
||||
readonly ebuf: Array<number>;
|
||||
|
||||
static readonly discriminator = Buffer.from([
|
||||
|
|
|
@ -4,17 +4,23 @@ import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-
|
|||
import * as borsh from '@project-serum/borsh';
|
||||
|
||||
export interface AggregatorHistoryRowFields {
|
||||
/** The timestamp of the sample. */
|
||||
timestamp: BN;
|
||||
/** The value of the sample. */
|
||||
value: types.SwitchboardDecimalFields;
|
||||
}
|
||||
|
||||
export interface AggregatorHistoryRowJSON {
|
||||
/** The timestamp of the sample. */
|
||||
timestamp: string;
|
||||
/** The value of the sample. */
|
||||
value: types.SwitchboardDecimalJSON;
|
||||
}
|
||||
|
||||
export class AggregatorHistoryRow {
|
||||
/** The timestamp of the sample. */
|
||||
readonly timestamp: BN;
|
||||
/** The value of the sample. */
|
||||
readonly value: types.SwitchboardDecimal;
|
||||
|
||||
constructor(fields: AggregatorHistoryRowFields) {
|
||||
|
|
|
@ -4,53 +4,104 @@ import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-
|
|||
import * as borsh from '@project-serum/borsh';
|
||||
|
||||
export interface AggregatorRoundFields {
|
||||
/**
|
||||
* Maintains the number of successful responses received from nodes.
|
||||
* Nodes can submit one successful response per round.
|
||||
*/
|
||||
numSuccess: number;
|
||||
/** Number of error responses. */
|
||||
numError: number;
|
||||
/** Whether an update request round has ended. */
|
||||
isClosed: boolean;
|
||||
/** Maintains the `solana_program::clock::Slot` that the round was opened at. */
|
||||
roundOpenSlot: BN;
|
||||
/** Maintains the `solana_program::clock::UnixTimestamp;` the round was opened at. */
|
||||
roundOpenTimestamp: BN;
|
||||
/** Maintains the current median of all successful round responses. */
|
||||
result: types.SwitchboardDecimalFields;
|
||||
/** Standard deviation of the accepted results in the round. */
|
||||
stdDeviation: types.SwitchboardDecimalFields;
|
||||
/** Maintains the minimum node response this round. */
|
||||
minResponse: types.SwitchboardDecimalFields;
|
||||
/** Maintains the maximum node response this round. */
|
||||
maxResponse: types.SwitchboardDecimalFields;
|
||||
/** Pubkeys of the oracles fulfilling this round. */
|
||||
oraclePubkeysData: Array<PublicKey>;
|
||||
/** Represents all successful node responses this round. `NaN` if empty. */
|
||||
mediansData: Array<types.SwitchboardDecimalFields>;
|
||||
/** Current rewards/slashes oracles have received this round. */
|
||||
currentPayout: Array<BN>;
|
||||
/** Keep track of which responses are fulfilled here. */
|
||||
mediansFulfilled: Array<boolean>;
|
||||
/** Keeps track of which errors are fulfilled here. */
|
||||
errorsFulfilled: Array<boolean>;
|
||||
}
|
||||
|
||||
export interface AggregatorRoundJSON {
|
||||
/**
|
||||
* Maintains the number of successful responses received from nodes.
|
||||
* Nodes can submit one successful response per round.
|
||||
*/
|
||||
numSuccess: number;
|
||||
/** Number of error responses. */
|
||||
numError: number;
|
||||
/** Whether an update request round has ended. */
|
||||
isClosed: boolean;
|
||||
/** Maintains the `solana_program::clock::Slot` that the round was opened at. */
|
||||
roundOpenSlot: string;
|
||||
/** Maintains the `solana_program::clock::UnixTimestamp;` the round was opened at. */
|
||||
roundOpenTimestamp: string;
|
||||
/** Maintains the current median of all successful round responses. */
|
||||
result: types.SwitchboardDecimalJSON;
|
||||
/** Standard deviation of the accepted results in the round. */
|
||||
stdDeviation: types.SwitchboardDecimalJSON;
|
||||
/** Maintains the minimum node response this round. */
|
||||
minResponse: types.SwitchboardDecimalJSON;
|
||||
/** Maintains the maximum node response this round. */
|
||||
maxResponse: types.SwitchboardDecimalJSON;
|
||||
/** Pubkeys of the oracles fulfilling this round. */
|
||||
oraclePubkeysData: Array<string>;
|
||||
/** Represents all successful node responses this round. `NaN` if empty. */
|
||||
mediansData: Array<types.SwitchboardDecimalJSON>;
|
||||
/** Current rewards/slashes oracles have received this round. */
|
||||
currentPayout: Array<string>;
|
||||
/** Keep track of which responses are fulfilled here. */
|
||||
mediansFulfilled: Array<boolean>;
|
||||
/** Keeps track of which errors are fulfilled here. */
|
||||
errorsFulfilled: Array<boolean>;
|
||||
}
|
||||
|
||||
export class AggregatorRound {
|
||||
/**
|
||||
* Maintains the number of successful responses received from nodes.
|
||||
* Nodes can submit one successful response per round.
|
||||
*/
|
||||
readonly numSuccess: number;
|
||||
/** Number of error responses. */
|
||||
readonly numError: number;
|
||||
/** Whether an update request round has ended. */
|
||||
readonly isClosed: boolean;
|
||||
/** Maintains the `solana_program::clock::Slot` that the round was opened at. */
|
||||
readonly roundOpenSlot: BN;
|
||||
/** Maintains the `solana_program::clock::UnixTimestamp;` the round was opened at. */
|
||||
readonly roundOpenTimestamp: BN;
|
||||
/** Maintains the current median of all successful round responses. */
|
||||
readonly result: types.SwitchboardDecimal;
|
||||
/** Standard deviation of the accepted results in the round. */
|
||||
readonly stdDeviation: types.SwitchboardDecimal;
|
||||
/** Maintains the minimum node response this round. */
|
||||
readonly minResponse: types.SwitchboardDecimal;
|
||||
/** Maintains the maximum node response this round. */
|
||||
readonly maxResponse: types.SwitchboardDecimal;
|
||||
/** Pubkeys of the oracles fulfilling this round. */
|
||||
readonly oraclePubkeysData: Array<PublicKey>;
|
||||
/** Represents all successful node responses this round. `NaN` if empty. */
|
||||
readonly mediansData: Array<types.SwitchboardDecimal>;
|
||||
/** Current rewards/slashes oracles have received this round. */
|
||||
readonly currentPayout: Array<BN>;
|
||||
/** Keep track of which responses are fulfilled here. */
|
||||
readonly mediansFulfilled: Array<boolean>;
|
||||
/** Keeps track of which errors are fulfilled here. */
|
||||
readonly errorsFulfilled: Array<boolean>;
|
||||
|
||||
constructor(fields: AggregatorRoundFields) {
|
||||
|
|
|
@ -4,26 +4,41 @@ import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-
|
|||
import * as borsh from '@project-serum/borsh';
|
||||
|
||||
export interface BufferRelayerRoundFields {
|
||||
/** Number of successful responses. */
|
||||
numSuccess: number;
|
||||
/** Number of error responses. */
|
||||
numError: number;
|
||||
/** Slot when the buffer relayer round was opened. */
|
||||
roundOpenSlot: BN;
|
||||
/** Timestamp when the buffer relayer round was opened. */
|
||||
roundOpenTimestamp: BN;
|
||||
/** The public key of the oracle fulfilling the buffer relayer update request. */
|
||||
oraclePubkey: PublicKey;
|
||||
}
|
||||
|
||||
export interface BufferRelayerRoundJSON {
|
||||
/** Number of successful responses. */
|
||||
numSuccess: number;
|
||||
/** Number of error responses. */
|
||||
numError: number;
|
||||
/** Slot when the buffer relayer round was opened. */
|
||||
roundOpenSlot: string;
|
||||
/** Timestamp when the buffer relayer round was opened. */
|
||||
roundOpenTimestamp: string;
|
||||
/** The public key of the oracle fulfilling the buffer relayer update request. */
|
||||
oraclePubkey: string;
|
||||
}
|
||||
|
||||
export class BufferRelayerRound {
|
||||
/** Number of successful responses. */
|
||||
readonly numSuccess: number;
|
||||
/** Number of error responses. */
|
||||
readonly numError: number;
|
||||
/** Slot when the buffer relayer round was opened. */
|
||||
readonly roundOpenSlot: BN;
|
||||
/** Timestamp when the buffer relayer round was opened. */
|
||||
readonly roundOpenTimestamp: BN;
|
||||
/** The public key of the oracle fulfilling the buffer relayer update request. */
|
||||
readonly oraclePubkey: PublicKey;
|
||||
|
||||
constructor(fields: BufferRelayerRoundFields) {
|
||||
|
|
|
@ -4,26 +4,41 @@ import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-
|
|||
import * as borsh from '@project-serum/borsh';
|
||||
|
||||
export interface CallbackZCFields {
|
||||
/** The program ID of the callback program being invoked. */
|
||||
programId: PublicKey;
|
||||
/** The accounts being used in the callback instruction. */
|
||||
accounts: Array<types.AccountMetaZCFields>;
|
||||
/** The number of accounts used in the callback */
|
||||
accountsLen: number;
|
||||
/** The serialized instruction data. */
|
||||
ixData: Array<number>;
|
||||
/** The number of serialized bytes in the instruction data. */
|
||||
ixDataLen: number;
|
||||
}
|
||||
|
||||
export interface CallbackZCJSON {
|
||||
/** The program ID of the callback program being invoked. */
|
||||
programId: string;
|
||||
/** The accounts being used in the callback instruction. */
|
||||
accounts: Array<types.AccountMetaZCJSON>;
|
||||
/** The number of accounts used in the callback */
|
||||
accountsLen: number;
|
||||
/** The serialized instruction data. */
|
||||
ixData: Array<number>;
|
||||
/** The number of serialized bytes in the instruction data. */
|
||||
ixDataLen: number;
|
||||
}
|
||||
|
||||
export class CallbackZC {
|
||||
/** The program ID of the callback program being invoked. */
|
||||
readonly programId: PublicKey;
|
||||
/** The accounts being used in the callback instruction. */
|
||||
readonly accounts: Array<types.AccountMetaZC>;
|
||||
/** The number of accounts used in the callback */
|
||||
readonly accountsLen: number;
|
||||
/** The serialized instruction data. */
|
||||
readonly ixData: Array<number>;
|
||||
/** The number of serialized bytes in the instruction data. */
|
||||
readonly ixDataLen: number;
|
||||
|
||||
constructor(fields: CallbackZCFields) {
|
||||
|
|
|
@ -4,17 +4,23 @@ import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-
|
|||
import * as borsh from '@project-serum/borsh';
|
||||
|
||||
export interface CrankRowFields {
|
||||
/** The PublicKey of the AggregatorAccountData. */
|
||||
pubkey: PublicKey;
|
||||
/** The aggregator's next available update time. */
|
||||
nextTimestamp: BN;
|
||||
}
|
||||
|
||||
export interface CrankRowJSON {
|
||||
/** The PublicKey of the AggregatorAccountData. */
|
||||
pubkey: string;
|
||||
/** The aggregator's next available update time. */
|
||||
nextTimestamp: string;
|
||||
}
|
||||
|
||||
export class CrankRow {
|
||||
/** The PublicKey of the AggregatorAccountData. */
|
||||
readonly pubkey: PublicKey;
|
||||
/** The aggregator's next available update time. */
|
||||
readonly nextTimestamp: BN;
|
||||
|
||||
constructor(fields: CrankRowFields) {
|
||||
|
|
|
@ -4,14 +4,17 @@ import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-
|
|||
import * as borsh from '@project-serum/borsh';
|
||||
|
||||
export interface HashFields {
|
||||
/** The bytes used to derive the hash. */
|
||||
data: Array<number>;
|
||||
}
|
||||
|
||||
export interface HashJSON {
|
||||
/** The bytes used to derive the hash. */
|
||||
data: Array<number>;
|
||||
}
|
||||
|
||||
export class Hash {
|
||||
/** The bytes used to derive the hash. */
|
||||
readonly data: Array<number>;
|
||||
|
||||
constructor(fields: HashFields) {
|
||||
|
|
|
@ -162,6 +162,9 @@ export function fromDecoded(obj: any): types.LanesKind {
|
|||
if ('AD' in obj) {
|
||||
return new AD();
|
||||
}
|
||||
if ('BCD' in obj) {
|
||||
return new BCD();
|
||||
}
|
||||
|
||||
throw new Error('Invalid enum object');
|
||||
}
|
||||
|
@ -183,6 +186,9 @@ export function fromJSON(obj: types.LanesJSON): types.LanesKind {
|
|||
case 'AD': {
|
||||
return new AD();
|
||||
}
|
||||
case 'BCD': {
|
||||
return new BCD();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,6 +199,7 @@ export function layout(property?: string) {
|
|||
borsh.struct([], 'AB'),
|
||||
borsh.struct([], 'AC'),
|
||||
borsh.struct([], 'AD'),
|
||||
borsh.struct([], 'BCD'),
|
||||
]);
|
||||
if (property !== undefined) {
|
||||
return ret.replicate(property);
|
||||
|
|
|
@ -4,38 +4,65 @@ import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-
|
|||
import * as borsh from '@project-serum/borsh';
|
||||
|
||||
export interface OracleMetricsFields {
|
||||
/** Number of consecutive successful update request. */
|
||||
consecutiveSuccess: BN;
|
||||
/** Number of consecutive update request that resulted in an error. */
|
||||
consecutiveError: BN;
|
||||
/** Number of consecutive update request that resulted in a disagreement with the accepted median result. */
|
||||
consecutiveDisagreement: BN;
|
||||
/** Number of consecutive update request that were posted on-chain late and not included in an accepted result. */
|
||||
consecutiveLateResponse: BN;
|
||||
/** Number of consecutive update request that resulted in a failure. */
|
||||
consecutiveFailure: BN;
|
||||
/** Total number of successful update request. */
|
||||
totalSuccess: BN;
|
||||
/** Total number of update request that resulted in an error. */
|
||||
totalError: BN;
|
||||
/** Total number of update request that resulted in a disagreement with the accepted median result. */
|
||||
totalDisagreement: BN;
|
||||
/** Total number of update request that were posted on-chain late and not included in an accepted result. */
|
||||
totalLateResponse: BN;
|
||||
}
|
||||
|
||||
export interface OracleMetricsJSON {
|
||||
/** Number of consecutive successful update request. */
|
||||
consecutiveSuccess: string;
|
||||
/** Number of consecutive update request that resulted in an error. */
|
||||
consecutiveError: string;
|
||||
/** Number of consecutive update request that resulted in a disagreement with the accepted median result. */
|
||||
consecutiveDisagreement: string;
|
||||
/** Number of consecutive update request that were posted on-chain late and not included in an accepted result. */
|
||||
consecutiveLateResponse: string;
|
||||
/** Number of consecutive update request that resulted in a failure. */
|
||||
consecutiveFailure: string;
|
||||
/** Total number of successful update request. */
|
||||
totalSuccess: string;
|
||||
/** Total number of update request that resulted in an error. */
|
||||
totalError: string;
|
||||
/** Total number of update request that resulted in a disagreement with the accepted median result. */
|
||||
totalDisagreement: string;
|
||||
/** Total number of update request that were posted on-chain late and not included in an accepted result. */
|
||||
totalLateResponse: string;
|
||||
}
|
||||
|
||||
export class OracleMetrics {
|
||||
/** Number of consecutive successful update request. */
|
||||
readonly consecutiveSuccess: BN;
|
||||
/** Number of consecutive update request that resulted in an error. */
|
||||
readonly consecutiveError: BN;
|
||||
/** Number of consecutive update request that resulted in a disagreement with the accepted median result. */
|
||||
readonly consecutiveDisagreement: BN;
|
||||
/** Number of consecutive update request that were posted on-chain late and not included in an accepted result. */
|
||||
readonly consecutiveLateResponse: BN;
|
||||
/** Number of consecutive update request that resulted in a failure. */
|
||||
readonly consecutiveFailure: BN;
|
||||
/** Total number of successful update request. */
|
||||
readonly totalSuccess: BN;
|
||||
/** Total number of update request that resulted in an error. */
|
||||
readonly totalError: BN;
|
||||
/** Total number of update request that resulted in a disagreement with the accepted median result. */
|
||||
readonly totalDisagreement: BN;
|
||||
/** Total number of update request that were posted on-chain late and not included in an accepted result. */
|
||||
readonly totalLateResponse: BN;
|
||||
|
||||
constructor(fields: OracleMetricsFields) {
|
||||
|
|
|
@ -4,14 +4,51 @@ import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-
|
|||
import * as borsh from '@project-serum/borsh';
|
||||
|
||||
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>;
|
||||
}
|
||||
|
||||
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>;
|
||||
}
|
||||
|
||||
/**
|
||||
* The `Scalar` struct holds an integer \\(s < 2\^{255} \\) which
|
||||
* represents an element of \\(\mathbb Z / \ell\\).
|
||||
*/
|
||||
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>;
|
||||
|
||||
constructor(fields: ScalarFields) {
|
||||
|
|
|
@ -5,17 +5,32 @@ import * as borsh from '@project-serum/borsh';
|
|||
import Big from 'big.js';
|
||||
|
||||
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;
|
||||
/** The number of decimal places to move to the left to yield the actual value. */
|
||||
scale: number;
|
||||
}
|
||||
|
||||
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;
|
||||
/** The number of decimal places to move to the left to yield the actual value. */
|
||||
scale: number;
|
||||
}
|
||||
|
||||
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;
|
||||
/** The number of decimal places to move to the left to yield the actual value. */
|
||||
readonly scale: number;
|
||||
|
||||
constructor(fields: SwitchboardDecimalFields) {
|
||||
|
|
|
@ -4,8 +4,11 @@ import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-
|
|||
import * as borsh from '@project-serum/borsh';
|
||||
|
||||
export interface VrfBuilderFields {
|
||||
/** The OracleAccountData that is producing the randomness. */
|
||||
producer: PublicKey;
|
||||
/** The current status of the VRF verification. */
|
||||
status: types.VrfStatusKind;
|
||||
/** The VRF proof sourced from the producer. */
|
||||
reprProof: Array<number>;
|
||||
proof: types.EcvrfProofZCFields;
|
||||
yPoint: PublicKey;
|
||||
|
@ -39,14 +42,20 @@ export interface VrfBuilderFields {
|
|||
cPrimeHashbuf: Array<number>;
|
||||
m1: types.FieldElementZCFields;
|
||||
m2: types.FieldElementZCFields;
|
||||
/** The number of transactions remaining to verify the VRF proof. */
|
||||
txRemaining: number;
|
||||
/** Whether the VRF proof has been verified on-chain. */
|
||||
verified: boolean;
|
||||
/** The VRF proof verification result. Will be zeroized if still awaiting fulfillment. */
|
||||
result: Array<number>;
|
||||
}
|
||||
|
||||
export interface VrfBuilderJSON {
|
||||
/** The OracleAccountData that is producing the randomness. */
|
||||
producer: string;
|
||||
/** The current status of the VRF verification. */
|
||||
status: types.VrfStatusJSON;
|
||||
/** The VRF proof sourced from the producer. */
|
||||
reprProof: Array<number>;
|
||||
proof: types.EcvrfProofZCJSON;
|
||||
yPoint: string;
|
||||
|
@ -80,14 +89,20 @@ export interface VrfBuilderJSON {
|
|||
cPrimeHashbuf: Array<number>;
|
||||
m1: types.FieldElementZCJSON;
|
||||
m2: types.FieldElementZCJSON;
|
||||
/** The number of transactions remaining to verify the VRF proof. */
|
||||
txRemaining: number;
|
||||
/** Whether the VRF proof has been verified on-chain. */
|
||||
verified: boolean;
|
||||
/** The VRF proof verification result. Will be zeroized if still awaiting fulfillment. */
|
||||
result: Array<number>;
|
||||
}
|
||||
|
||||
export class VrfBuilder {
|
||||
/** The OracleAccountData that is producing the randomness. */
|
||||
readonly producer: PublicKey;
|
||||
/** The current status of the VRF verification. */
|
||||
readonly status: types.VrfStatusKind;
|
||||
/** The VRF proof sourced from the producer. */
|
||||
readonly reprProof: Array<number>;
|
||||
readonly proof: types.EcvrfProofZC;
|
||||
readonly yPoint: PublicKey;
|
||||
|
@ -121,8 +136,11 @@ export class VrfBuilder {
|
|||
readonly cPrimeHashbuf: Array<number>;
|
||||
readonly m1: types.FieldElementZC;
|
||||
readonly m2: types.FieldElementZC;
|
||||
/** The number of transactions remaining to verify the VRF proof. */
|
||||
readonly txRemaining: number;
|
||||
/** Whether the VRF proof has been verified on-chain. */
|
||||
readonly verified: boolean;
|
||||
/** The VRF proof verification result. Will be zeroized if still awaiting fulfillment. */
|
||||
readonly result: Array<number>;
|
||||
|
||||
constructor(fields: VrfBuilderFields) {
|
||||
|
|
|
@ -4,32 +4,53 @@ import * as types from '../types'; // eslint-disable-line @typescript-eslint/no-
|
|||
import * as borsh from '@project-serum/borsh';
|
||||
|
||||
export interface VrfRoundFields {
|
||||
/** The alpha bytes used to calculate the VRF proof. */
|
||||
alpha: Array<number>;
|
||||
/** The number of bytes in the alpha buffer. */
|
||||
alphaLen: number;
|
||||
/** The Slot when the VRF round was opened. */
|
||||
requestSlot: BN;
|
||||
/** The unix timestamp when the VRF round was opened. */
|
||||
requestTimestamp: BN;
|
||||
/** The VRF round result. Will be zeroized if still awaiting fulfillment. */
|
||||
result: Array<number>;
|
||||
/** The number of builders who verified the VRF proof. */
|
||||
numVerified: number;
|
||||
/** Reserved for future info. */
|
||||
ebuf: Array<number>;
|
||||
}
|
||||
|
||||
export interface VrfRoundJSON {
|
||||
/** The alpha bytes used to calculate the VRF proof. */
|
||||
alpha: Array<number>;
|
||||
/** The number of bytes in the alpha buffer. */
|
||||
alphaLen: number;
|
||||
/** The Slot when the VRF round was opened. */
|
||||
requestSlot: string;
|
||||
/** The unix timestamp when the VRF round was opened. */
|
||||
requestTimestamp: string;
|
||||
/** The VRF round result. Will be zeroized if still awaiting fulfillment. */
|
||||
result: Array<number>;
|
||||
/** The number of builders who verified the VRF proof. */
|
||||
numVerified: number;
|
||||
/** Reserved for future info. */
|
||||
ebuf: Array<number>;
|
||||
}
|
||||
|
||||
export class VrfRound {
|
||||
/** The alpha bytes used to calculate the VRF proof. */
|
||||
readonly alpha: Array<number>;
|
||||
/** The number of bytes in the alpha buffer. */
|
||||
readonly alphaLen: number;
|
||||
/** The Slot when the VRF round was opened. */
|
||||
readonly requestSlot: BN;
|
||||
/** The unix timestamp when the VRF round was opened. */
|
||||
readonly requestTimestamp: BN;
|
||||
/** The VRF round result. Will be zeroized if still awaiting fulfillment. */
|
||||
readonly result: Array<number>;
|
||||
/** The number of builders who verified the VRF proof. */
|
||||
readonly numVerified: number;
|
||||
/** Reserved for future info. */
|
||||
readonly ebuf: Array<number>;
|
||||
|
||||
constructor(fields: VrfRoundFields) {
|
||||
|
|
|
@ -316,14 +316,42 @@ export { Lanes };
|
|||
export { Shuffle };
|
||||
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 =
|
||||
| Lanes.CJSON
|
||||
| Lanes.DJSON
|
||||
| Lanes.ABJSON
|
||||
| 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 =
|
||||
| Shuffle.AAAA
|
||||
| Shuffle.BBBB
|
||||
|
|
Loading…
Reference in New Issue