chore: pull monorepo changes (#130)

* Project import generated by Copybara.

GitOrigin-RevId: 38e6be703616d1edafd421b9939003ad03c96a7a

* chore: Update pnpm lockfile

---------

Co-authored-by: Copybara <copybara@example.com>
Co-authored-by: gallynaut <gallynaut@users.noreply.github.com>
This commit is contained in:
gallynaut 2023-09-14 09:34:57 -06:00 committed by GitHub
parent c955d0a547
commit a99fe5a45d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 2593 additions and 386 deletions

View File

@ -19,6 +19,6 @@ cpi = ["no-entrypoint"]
default = [] default = []
[dependencies] [dependencies]
switchboard-solana = "=0.28.6" switchboard-solana = { version = "=0.28.15", features = [ ] }
# switchboard-solana = { version = "0.28.4", path = "../../../rust/switchboard-solana" } # switchboard-solana = { version = "0.28.4", path = "../../../rust/switchboard-solana" }
bytemuck = "^1" bytemuck = "^1"

View File

@ -15,7 +15,7 @@
"@coral-xyz/anchor": "^0.28.0", "@coral-xyz/anchor": "^0.28.0",
"@solana/spl-token": "^0.3.6", "@solana/spl-token": "^0.3.6",
"@solana/web3.js": "^1.78.0", "@solana/web3.js": "^1.78.0",
"@switchboard-xyz/solana.js": "workspace:^" "@switchboard-xyz/solana.js": "workspace:*"
}, },
"devDependencies": { "devDependencies": {
"@types/bn.js": "^5.1.0", "@types/bn.js": "^5.1.0",

View File

@ -16,6 +16,6 @@ futures = "0.3"
serde = "^1" serde = "^1"
serde_json = "^1" serde_json = "^1"
switchboard-utils = "0.8.0" switchboard-utils = "0.8.0"
switchboard-solana = "=0.28.6" switchboard-solana = { version = "=0.28.15", features = [ "client" ] }
# switchboard-solana = { version = "0.28.4", path = "../../../../rust/switchboard-solana" } # switchboard-solana = { version = "0.28.4", path = "../../../../rust/switchboard-solana" }
# switchboard-utils = { version = "0.8.0", path = "../../../../../../rust/switchboard-utils" } # switchboard-utils = { version = "0.8.0", path = "../../../../../../rust/switchboard-utils" }

View File

@ -37,9 +37,9 @@ impl TriggerFunction<'_> {
_params: &TriggerFunctionParams, _params: &TriggerFunctionParams,
) -> anchor_lang::Result<()> { ) -> anchor_lang::Result<()> {
FunctionTrigger { FunctionTrigger {
function: ctx.accounts.function.clone(), function: ctx.accounts.function.to_account_info(),
authority: ctx.accounts.authority.clone(), authority: ctx.accounts.authority.to_account_info(),
attestation_queue: ctx.accounts.attestation_queue.clone(), attestation_queue: ctx.accounts.attestation_queue.to_account_info(),
} }
.invoke(ctx.accounts.attestation_program.clone())?; .invoke(ctx.accounts.attestation_program.clone())?;
Ok(()) Ok(())

View File

@ -3794,4 +3794,4 @@
"msg": "The FunctionRequestAccount is not ready to be verified" "msg": "The FunctionRequestAccount is not ready to be verified"
} }
] ]
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "@switchboard-xyz/solana.js", "name": "@switchboard-xyz/solana.js",
"version": "2.5.6", "version": "2.6.2",
"author": "", "author": "",
"license": "MIT", "license": "MIT",
"description": "A Typescript client to interact with Switchboard on Solana.", "description": "A Typescript client to interact with Switchboard on Solana.",
@ -29,7 +29,7 @@
"@coral-xyz/borsh": "^0.28.0", "@coral-xyz/borsh": "^0.28.0",
"@solana/spl-token": "^0.3.8", "@solana/spl-token": "^0.3.8",
"@solana/web3.js": "^1.78.3", "@solana/web3.js": "^1.78.3",
"@switchboard-xyz/common": "^2.3.3", "@switchboard-xyz/common": "^2.3.6",
"cron-validator": "^1.3.1", "cron-validator": "^1.3.1",
"dotenv": "^16.3.1", "dotenv": "^16.3.1",
"lodash": "^4.17.21" "lodash": "^4.17.21"

View File

@ -9,6 +9,7 @@ import type {
} from "../TransactionObject.js"; } from "../TransactionObject.js";
import { TransactionObject } from "../TransactionObject.js"; import { TransactionObject } from "../TransactionObject.js";
import { import {
containsMrEnclave,
handleOptionalPubkeys, handleOptionalPubkeys,
numToBN, numToBN,
parseCronSchedule, parseCronSchedule,
@ -225,10 +226,14 @@ export class FunctionAccount extends Account<types.FunctionAccountData> {
creatorSeed: Uint8Array, creatorSeed: Uint8Array,
recentSlot: BN recentSlot: BN
): FunctionAccount { ): FunctionAccount {
if (creatorSeed.length > 32) {
throw new Error("Creator seed must be 32 bytes or less");
}
const functionPubkey = anchor.web3.PublicKey.findProgramAddressSync( const functionPubkey = anchor.web3.PublicKey.findProgramAddressSync(
[ [
Buffer.from("FunctionAccountData"), Buffer.from("FunctionAccountData"),
creatorSeed, creatorSeed.length < 32 ? parseRawBuffer(creatorSeed, 32) : creatorSeed,
recentSlot.toBuffer("le", 8), recentSlot.toBuffer("le", 8),
], ],
program.attestationProgramId program.attestationProgramId
@ -284,10 +289,12 @@ export class FunctionAccount extends Account<types.FunctionAccountData> {
throw new errors.AccountNotFoundError("Function", PublicKey.default); throw new errors.AccountNotFoundError("Function", PublicKey.default);
} }
assert(data.creatorSeed.length === 32);
const functionAccount = FunctionAccount.fromSeed( const functionAccount = FunctionAccount.fromSeed(
program, program,
new Uint8Array(data.creatorSeed), new Uint8Array(data.creatorSeed),
data.createdAt data.createdAtSlot
); );
functionAccount._wallet = Promise.resolve( functionAccount._wallet = Promise.resolve(
@ -556,6 +563,138 @@ export class FunctionAccount extends Account<types.FunctionAccountData> {
).then((txn) => this.program.signAndSend(txn, options)); ).then((txn) => this.program.signAndSend(txn, options));
} }
public static hasMrEnclave(
mrEnclaves: Array<number[]>,
targetMrEnclave: number[] | Uint8Array
): boolean {
return containsMrEnclave(mrEnclaves, targetMrEnclave);
}
public async addMrEnclaveInstruction(
payer: PublicKey,
mrEnclave: number[] | Uint8Array,
params?: {
// Optional authority if needing to change config and payer is not the authority
authority?: Keypair;
// Pre-fetched account state to reduce network calls
functionState?: types.FunctionAccountData;
// Force remove a MrEnclave if full
force?: boolean;
},
options?: TransactionObjectOptions
): Promise<TransactionObject> {
const force = params?.force ?? false;
const functionState = params?.functionState ?? (await this.loadData());
if (FunctionAccount.hasMrEnclave(functionState.mrEnclaves, mrEnclave)) {
throw new errors.FunctionMrEnclaveAlreadySet();
}
const filteredMrEnclaves = functionState.mrEnclaves.filter(
(arr) => !arr.every((num) => num === 0)
);
if (filteredMrEnclaves.length >= 32 && !force) {
throw new errors.FunctionMrEnclavesFull();
}
const newMrEnclaves = [
...(filteredMrEnclaves.length >= 32
? filteredMrEnclaves.slice(filteredMrEnclaves.length - 32 + 1)
: filteredMrEnclaves),
Array.from(mrEnclave),
];
if (params?.authority) {
if (!params.authority.publicKey.equals(functionState.authority)) {
throw new errors.IncorrectAuthority(
functionState.authority,
params.authority.publicKey
);
}
} else {
if (!payer.equals(functionState.authority)) {
throw new errors.IncorrectAuthority(functionState.authority, payer);
}
}
const setConfigIxn = types.functionSetConfig(
this.program,
{
params: {
name: null,
metadata: null,
container: null,
containerRegistry: null,
version: null,
schedule: null,
mrEnclaves: newMrEnclaves,
requestsDisabled: null,
requestsRequireAuthorization: null,
requestsFee: null,
},
},
{
function: this.publicKey,
authority: functionState.authority,
}
);
return new TransactionObject(
payer,
[setConfigIxn],
params?.authority ? [params.authority] : [],
options
);
}
public async addMrEnclave(
mrEnclave: number[] | Uint8Array,
params?: {
// Optional authority if needing to change config and payer is not the authority
authority?: Keypair;
// Pre-fetched account state to reduce network calls
functionState?: types.FunctionAccountData;
// Force remove a MrEnclave if full
force?: boolean;
},
options?: SendTransactionObjectOptions
): Promise<TransactionSignature> {
return await this.addMrEnclaveInstruction(
this.program.walletPubkey,
mrEnclave,
params,
options
).then((txn) => this.program.signAndSend(txn, options));
}
/**
* Try to add a MrEnclave to the function config, if it is not already present. Returns undefined
* if MrEnclave is already in the config.
*/
public async tryAddMrEnclave(
mrEnclave: number[] | Uint8Array,
params?: {
// Optional authority if needing to change config and payer is not the authority
authority?: Keypair;
// Pre-fetched account state to reduce network calls
functionState?: types.FunctionAccountData;
// Force remove a MrEnclave if full
force?: boolean;
},
options?: SendTransactionObjectOptions
): Promise<TransactionSignature | undefined> {
const functionState = params?.functionState ?? (await this.loadData());
if (FunctionAccount.hasMrEnclave(functionState.mrEnclaves, mrEnclave)) {
return undefined;
}
return await this.addMrEnclaveInstruction(
this.program.walletPubkey,
mrEnclave,
params,
options
).then((txn) => this.program.signAndSend(txn, options));
}
public async setEscrowInstruction( public async setEscrowInstruction(
payer: PublicKey, payer: PublicKey,
params: FunctionSetEscrowParams, params: FunctionSetEscrowParams,

View File

@ -106,6 +106,24 @@ export class InvalidCronSchedule extends Error {
super( super(
`invalid cron schedule, expected format: '* * * * * *', received: ${schedule}` `invalid cron schedule, expected format: '* * * * * *', received: ${schedule}`
); );
Object.setPrototypeOf(this, IncorrectOwner.prototype); Object.setPrototypeOf(this, InvalidCronSchedule.prototype);
}
}
export class FunctionMrEnclaveAlreadySet extends Error {
constructor() {
super(
`Function already has this mrEnclave in its config, no action needed`
);
Object.setPrototypeOf(this, FunctionMrEnclaveAlreadySet.prototype);
}
}
export class FunctionMrEnclavesFull extends Error {
constructor() {
super(
`Function already has the maximum number of mrEnclaves in its config - try removing one or using force to remove the first MrEnclave in its config`
);
Object.setPrototypeOf(this, FunctionMrEnclavesFull.prototype);
} }
} }

View File

@ -74,14 +74,37 @@ export class NonExecutable {
} }
} }
export interface None3JSON {
kind: "None3";
}
export class None3 {
static readonly discriminator = 3;
static readonly kind = "None3";
readonly discriminator = 3;
readonly kind = "None3";
toJSON(): None3JSON {
return {
kind: "None3",
};
}
toEncodable() {
return {
None3: {},
};
}
}
export interface ExpiredJSON { export interface ExpiredJSON {
kind: "Expired"; kind: "Expired";
} }
export class Expired { export class Expired {
static readonly discriminator = 3; static readonly discriminator = 4;
static readonly kind = "Expired"; static readonly kind = "Expired";
readonly discriminator = 3; readonly discriminator = 4;
readonly kind = "Expired"; readonly kind = "Expired";
toJSON(): ExpiredJSON { toJSON(): ExpiredJSON {
@ -97,14 +120,83 @@ export class Expired {
} }
} }
export interface None5JSON {
kind: "None5";
}
export class None5 {
static readonly discriminator = 5;
static readonly kind = "None5";
readonly discriminator = 5;
readonly kind = "None5";
toJSON(): None5JSON {
return {
kind: "None5",
};
}
toEncodable() {
return {
None5: {},
};
}
}
export interface None6JSON {
kind: "None6";
}
export class None6 {
static readonly discriminator = 6;
static readonly kind = "None6";
readonly discriminator = 6;
readonly kind = "None6";
toJSON(): None6JSON {
return {
kind: "None6",
};
}
toEncodable() {
return {
None6: {},
};
}
}
export interface None7JSON {
kind: "None7";
}
export class None7 {
static readonly discriminator = 7;
static readonly kind = "None7";
readonly discriminator = 7;
readonly kind = "None7";
toJSON(): None7JSON {
return {
kind: "None7",
};
}
toEncodable() {
return {
None7: {},
};
}
}
export interface OutOfFundsJSON { export interface OutOfFundsJSON {
kind: "OutOfFunds"; kind: "OutOfFunds";
} }
export class OutOfFunds { export class OutOfFunds {
static readonly discriminator = 4; static readonly discriminator = 8;
static readonly kind = "OutOfFunds"; static readonly kind = "OutOfFunds";
readonly discriminator = 4; readonly discriminator = 8;
readonly kind = "OutOfFunds"; readonly kind = "OutOfFunds";
toJSON(): OutOfFundsJSON { toJSON(): OutOfFundsJSON {
@ -120,14 +212,175 @@ export class OutOfFunds {
} }
} }
export interface None9JSON {
kind: "None9";
}
export class None9 {
static readonly discriminator = 9;
static readonly kind = "None9";
readonly discriminator = 9;
readonly kind = "None9";
toJSON(): None9JSON {
return {
kind: "None9",
};
}
toEncodable() {
return {
None9: {},
};
}
}
export interface None10JSON {
kind: "None10";
}
export class None10 {
static readonly discriminator = 10;
static readonly kind = "None10";
readonly discriminator = 10;
readonly kind = "None10";
toJSON(): None10JSON {
return {
kind: "None10",
};
}
toEncodable() {
return {
None10: {},
};
}
}
export interface None11JSON {
kind: "None11";
}
export class None11 {
static readonly discriminator = 11;
static readonly kind = "None11";
readonly discriminator = 11;
readonly kind = "None11";
toJSON(): None11JSON {
return {
kind: "None11",
};
}
toEncodable() {
return {
None11: {},
};
}
}
export interface None12JSON {
kind: "None12";
}
export class None12 {
static readonly discriminator = 12;
static readonly kind = "None12";
readonly discriminator = 12;
readonly kind = "None12";
toJSON(): None12JSON {
return {
kind: "None12",
};
}
toEncodable() {
return {
None12: {},
};
}
}
export interface None13JSON {
kind: "None13";
}
export class None13 {
static readonly discriminator = 13;
static readonly kind = "None13";
readonly discriminator = 13;
readonly kind = "None13";
toJSON(): None13JSON {
return {
kind: "None13",
};
}
toEncodable() {
return {
None13: {},
};
}
}
export interface None14JSON {
kind: "None14";
}
export class None14 {
static readonly discriminator = 14;
static readonly kind = "None14";
readonly discriminator = 14;
readonly kind = "None14";
toJSON(): None14JSON {
return {
kind: "None14",
};
}
toEncodable() {
return {
None14: {},
};
}
}
export interface None15JSON {
kind: "None15";
}
export class None15 {
static readonly discriminator = 15;
static readonly kind = "None15";
readonly discriminator = 15;
readonly kind = "None15";
toJSON(): None15JSON {
return {
kind: "None15",
};
}
toEncodable() {
return {
None15: {},
};
}
}
export interface InvalidPermissionsJSON { export interface InvalidPermissionsJSON {
kind: "InvalidPermissions"; kind: "InvalidPermissions";
} }
export class InvalidPermissions { export class InvalidPermissions {
static readonly discriminator = 5; static readonly discriminator = 16;
static readonly kind = "InvalidPermissions"; static readonly kind = "InvalidPermissions";
readonly discriminator = 5; readonly discriminator = 16;
readonly kind = "InvalidPermissions"; readonly kind = "InvalidPermissions";
toJSON(): InvalidPermissionsJSON { toJSON(): InvalidPermissionsJSON {
@ -158,12 +411,45 @@ export function fromDecoded(obj: any): types.FunctionStatusKind {
if ("NonExecutable" in obj) { if ("NonExecutable" in obj) {
return new NonExecutable(); return new NonExecutable();
} }
if ("None3" in obj) {
return new None3();
}
if ("Expired" in obj) { if ("Expired" in obj) {
return new Expired(); return new Expired();
} }
if ("None5" in obj) {
return new None5();
}
if ("None6" in obj) {
return new None6();
}
if ("None7" in obj) {
return new None7();
}
if ("OutOfFunds" in obj) { if ("OutOfFunds" in obj) {
return new OutOfFunds(); return new OutOfFunds();
} }
if ("None9" in obj) {
return new None9();
}
if ("None10" in obj) {
return new None10();
}
if ("None11" in obj) {
return new None11();
}
if ("None12" in obj) {
return new None12();
}
if ("None13" in obj) {
return new None13();
}
if ("None14" in obj) {
return new None14();
}
if ("None15" in obj) {
return new None15();
}
if ("InvalidPermissions" in obj) { if ("InvalidPermissions" in obj) {
return new InvalidPermissions(); return new InvalidPermissions();
} }
@ -184,12 +470,45 @@ export function fromJSON(
case "NonExecutable": { case "NonExecutable": {
return new NonExecutable(); return new NonExecutable();
} }
case "None3": {
return new None3();
}
case "Expired": { case "Expired": {
return new Expired(); return new Expired();
} }
case "None5": {
return new None5();
}
case "None6": {
return new None6();
}
case "None7": {
return new None7();
}
case "OutOfFunds": { case "OutOfFunds": {
return new OutOfFunds(); return new OutOfFunds();
} }
case "None9": {
return new None9();
}
case "None10": {
return new None10();
}
case "None11": {
return new None11();
}
case "None12": {
return new None12();
}
case "None13": {
return new None13();
}
case "None14": {
return new None14();
}
case "None15": {
return new None15();
}
case "InvalidPermissions": { case "InvalidPermissions": {
return new InvalidPermissions(); return new InvalidPermissions();
} }
@ -201,8 +520,19 @@ export function layout(property?: string) {
borsh.struct([], "None"), borsh.struct([], "None"),
borsh.struct([], "Active"), borsh.struct([], "Active"),
borsh.struct([], "NonExecutable"), borsh.struct([], "NonExecutable"),
borsh.struct([], "None3"),
borsh.struct([], "Expired"), borsh.struct([], "Expired"),
borsh.struct([], "None5"),
borsh.struct([], "None6"),
borsh.struct([], "None7"),
borsh.struct([], "OutOfFunds"), borsh.struct([], "OutOfFunds"),
borsh.struct([], "None9"),
borsh.struct([], "None10"),
borsh.struct([], "None11"),
borsh.struct([], "None12"),
borsh.struct([], "None13"),
borsh.struct([], "None14"),
borsh.struct([], "None15"),
borsh.struct([], "InvalidPermissions"), borsh.struct([], "InvalidPermissions"),
]); ]);
if (property !== undefined) { if (property !== undefined) {

View File

@ -1,10 +1,6 @@
import { SwitchboardProgram } from "../../../SwitchboardProgram.js"; import type * as types from "./index.js";
import type * as types from "./index.js"; // eslint-disable-line @typescript-eslint/no-unused-vars
import * as borsh from "@coral-xyz/borsh"; import * as borsh from "@coral-xyz/borsh";
import { PublicKey } from "@solana/web3.js"; // eslint-disable-line @typescript-eslint/no-unused-vars
import { BN } from "@switchboard-xyz/common"; // eslint-disable-line @typescript-eslint/no-unused-vars
export interface NoneJSON { export interface NoneJSON {
kind: "None"; kind: "None";
@ -75,6 +71,29 @@ export class VerificationFailure {
} }
} }
export interface None3JSON {
kind: "None3";
}
export class None3 {
static readonly discriminator = 3;
static readonly kind = "None3";
readonly discriminator = 3;
readonly kind = "None3";
toJSON(): None3JSON {
return {
kind: "None3",
};
}
toEncodable() {
return {
None3: {},
};
}
}
export interface VerificationSuccessJSON { export interface VerificationSuccessJSON {
kind: "VerificationSuccess"; kind: "VerificationSuccess";
} }
@ -98,6 +117,75 @@ export class VerificationSuccess {
} }
} }
export interface None5JSON {
kind: "None5";
}
export class None5 {
static readonly discriminator = 5;
static readonly kind = "None5";
readonly discriminator = 5;
readonly kind = "None5";
toJSON(): None5JSON {
return {
kind: "None5",
};
}
toEncodable() {
return {
None5: {},
};
}
}
export interface None6JSON {
kind: "None6";
}
export class None6 {
static readonly discriminator = 6;
static readonly kind = "None6";
readonly discriminator = 6;
readonly kind = "None6";
toJSON(): None6JSON {
return {
kind: "None6",
};
}
toEncodable() {
return {
None6: {},
};
}
}
export interface None7JSON {
kind: "None7";
}
export class None7 {
static readonly discriminator = 7;
static readonly kind = "None7";
readonly discriminator = 7;
readonly kind = "None7";
toJSON(): None7JSON {
return {
kind: "None7",
};
}
toEncodable() {
return {
None7: {},
};
}
}
export interface VerificationOverrideJSON { export interface VerificationOverrideJSON {
kind: "VerificationOverride"; kind: "VerificationOverride";
} }
@ -136,9 +224,21 @@ export function fromDecoded(obj: any): types.VerificationStatusKind {
if ("VerificationFailure" in obj) { if ("VerificationFailure" in obj) {
return new VerificationFailure(); return new VerificationFailure();
} }
if ("None3" in obj) {
return new None3();
}
if ("VerificationSuccess" in obj) { if ("VerificationSuccess" in obj) {
return new VerificationSuccess(); return new VerificationSuccess();
} }
if ("None5" in obj) {
return new None5();
}
if ("None6" in obj) {
return new None6();
}
if ("None7" in obj) {
return new None7();
}
if ("VerificationOverride" in obj) { if ("VerificationOverride" in obj) {
return new VerificationOverride(); return new VerificationOverride();
} }
@ -159,9 +259,21 @@ export function fromJSON(
case "VerificationFailure": { case "VerificationFailure": {
return new VerificationFailure(); return new VerificationFailure();
} }
case "None3": {
return new None3();
}
case "VerificationSuccess": { case "VerificationSuccess": {
return new VerificationSuccess(); return new VerificationSuccess();
} }
case "None5": {
return new None5();
}
case "None6": {
return new None6();
}
case "None7": {
return new None7();
}
case "VerificationOverride": { case "VerificationOverride": {
return new VerificationOverride(); return new VerificationOverride();
} }
@ -173,7 +285,11 @@ export function layout(property?: string) {
borsh.struct([], "None"), borsh.struct([], "None"),
borsh.struct([], "VerificationPending"), borsh.struct([], "VerificationPending"),
borsh.struct([], "VerificationFailure"), borsh.struct([], "VerificationFailure"),
borsh.struct([], "None3"),
borsh.struct([], "VerificationSuccess"), borsh.struct([], "VerificationSuccess"),
borsh.struct([], "None5"),
borsh.struct([], "None6"),
borsh.struct([], "None7"),
borsh.struct([], "VerificationOverride"), borsh.struct([], "VerificationOverride"),
]); ]);
if (property !== undefined) { if (property !== undefined) {

View File

@ -162,15 +162,37 @@ export type FunctionStatusKind =
| FunctionStatus.None | FunctionStatus.None
| FunctionStatus.Active | FunctionStatus.Active
| FunctionStatus.NonExecutable | FunctionStatus.NonExecutable
| FunctionStatus.None3
| FunctionStatus.Expired | FunctionStatus.Expired
| FunctionStatus.None5
| FunctionStatus.None6
| FunctionStatus.None7
| FunctionStatus.OutOfFunds | FunctionStatus.OutOfFunds
| FunctionStatus.None9
| FunctionStatus.None10
| FunctionStatus.None11
| FunctionStatus.None12
| FunctionStatus.None13
| FunctionStatus.None14
| FunctionStatus.None15
| FunctionStatus.InvalidPermissions; | FunctionStatus.InvalidPermissions;
export type FunctionStatusJSON = export type FunctionStatusJSON =
| FunctionStatus.NoneJSON | FunctionStatus.NoneJSON
| FunctionStatus.ActiveJSON | FunctionStatus.ActiveJSON
| FunctionStatus.NonExecutableJSON | FunctionStatus.NonExecutableJSON
| FunctionStatus.None3JSON
| FunctionStatus.ExpiredJSON | FunctionStatus.ExpiredJSON
| FunctionStatus.None5JSON
| FunctionStatus.None6JSON
| FunctionStatus.None7JSON
| FunctionStatus.OutOfFundsJSON | FunctionStatus.OutOfFundsJSON
| FunctionStatus.None9JSON
| FunctionStatus.None10JSON
| FunctionStatus.None11JSON
| FunctionStatus.None12JSON
| FunctionStatus.None13JSON
| FunctionStatus.None14JSON
| FunctionStatus.None15JSON
| FunctionStatus.InvalidPermissionsJSON; | FunctionStatus.InvalidPermissionsJSON;
export { FundingStatus }; export { FundingStatus };
@ -203,13 +225,21 @@ export type VerificationStatusKind =
| VerificationStatus.None | VerificationStatus.None
| VerificationStatus.VerificationPending | VerificationStatus.VerificationPending
| VerificationStatus.VerificationFailure | VerificationStatus.VerificationFailure
| VerificationStatus.None3
| VerificationStatus.VerificationSuccess | VerificationStatus.VerificationSuccess
| VerificationStatus.None5
| VerificationStatus.None6
| VerificationStatus.None7
| VerificationStatus.VerificationOverride; | VerificationStatus.VerificationOverride;
export type VerificationStatusJSON = export type VerificationStatusJSON =
| VerificationStatus.NoneJSON | VerificationStatus.NoneJSON
| VerificationStatus.VerificationPendingJSON | VerificationStatus.VerificationPendingJSON
| VerificationStatus.VerificationFailureJSON | VerificationStatus.VerificationFailureJSON
| VerificationStatus.None3JSON
| VerificationStatus.VerificationSuccessJSON | VerificationStatus.VerificationSuccessJSON
| VerificationStatus.None5JSON
| VerificationStatus.None6JSON
| VerificationStatus.None7JSON
| VerificationStatus.VerificationOverrideJSON; | VerificationStatus.VerificationOverrideJSON;
export { SwitchboardAttestationPermission }; export { SwitchboardAttestationPermission };

View File

@ -244,6 +244,19 @@ export function parseRawBuffer(rawBuffer: RawBuffer, size = 32): Uint8Array {
); );
} }
export function containsMrEnclave(
mrEnclaves: number[][],
targetMrEnclave: number[] | Uint8Array
): boolean {
return mrEnclaves.some((arr) => {
if (arr.length !== targetMrEnclave.length) return false;
for (let i = 0; i < arr.length; i++) {
if (arr[i] !== targetMrEnclave[i]) return false;
}
return true;
});
}
/** /**
* Validate a cron schedule and return a valid 6 element cron string which includes seconds * Validate a cron schedule and return a valid 6 element cron string which includes seconds
* @param cronSchedule - the cron string to validate * @param cronSchedule - the cron string to validate

View File

@ -149,7 +149,7 @@ importers:
specifier: ^1.78.0 specifier: ^1.78.0
version: 1.78.3 version: 1.78.3
'@switchboard-xyz/solana.js': '@switchboard-xyz/solana.js':
specifier: workspace:^ specifier: workspace:*
version: link:../../../javascript/solana.js version: link:../../../javascript/solana.js
devDependencies: devDependencies:
'@types/bn.js': '@types/bn.js':
@ -476,8 +476,8 @@ importers:
specifier: ^1.78.3 specifier: ^1.78.3
version: 1.78.3 version: 1.78.3
'@switchboard-xyz/common': '@switchboard-xyz/common':
specifier: ^2.3.3 specifier: ^2.3.6
version: 2.3.3(@solana/web3.js@1.78.3) version: 2.3.6
cron-validator: cron-validator:
specifier: ^1.3.1 specifier: ^1.3.1
version: 1.3.1 version: 1.3.1
@ -1661,15 +1661,28 @@ packages:
- '@solana/web3.js' - '@solana/web3.js'
dev: false dev: false
/@switchboard-xyz/common@2.3.6:
resolution: {integrity: sha512-q5cAw9VLbnPdjOPKvzlQzYWdmR8zXip9GvUr8mSaKs2x59ZtSmufpPoMw555vbW6HdfyA18Ix/A1Bboyzj/cXA==}
engines: {node: '>=12'}
dependencies:
big.js: 6.2.1
bn.js: 5.2.1
bs58: 5.0.0
decimal.js: 10.4.3
lodash: 4.17.21
protobufjs: 7.2.4
yaml: 2.2.1
dev: false
/@switchboard-xyz/eslint-config@0.1.9: /@switchboard-xyz/eslint-config@0.1.9:
resolution: {integrity: sha512-ZvCAsXn4NsBCECWvew/GIrkvDGzPhhDzT77jkEKQ7Xd2ftrjFJOeYoREDQIOhD88uN3qBl0cIKHbS4t0amkzGw==} resolution: {integrity: sha512-ZvCAsXn4NsBCECWvew/GIrkvDGzPhhDzT77jkEKQ7Xd2ftrjFJOeYoREDQIOhD88uN3qBl0cIKHbS4t0amkzGw==}
dependencies: dependencies:
'@typescript-eslint/eslint-plugin': 6.6.0(@typescript-eslint/parser@6.6.0)(eslint@8.49.0)(typescript@5.1.6) '@typescript-eslint/eslint-plugin': 6.7.0(@typescript-eslint/parser@6.7.0)(eslint@8.49.0)(typescript@5.1.6)
'@typescript-eslint/parser': 6.6.0(eslint@8.49.0)(typescript@5.0.4) '@typescript-eslint/parser': 6.7.0(eslint@8.49.0)(typescript@5.0.4)
'@typescript-eslint/type-utils': 6.6.0(eslint@8.49.0)(typescript@5.1.6) '@typescript-eslint/type-utils': 6.7.0(eslint@8.49.0)(typescript@5.1.6)
eslint: 8.49.0 eslint: 8.49.0
eslint-config-prettier: 9.0.0(eslint@8.49.0) eslint-config-prettier: 9.0.0(eslint@8.49.0)
eslint-plugin-import: 2.28.1(@typescript-eslint/parser@6.6.0)(eslint@8.49.0) eslint-plugin-import: 2.28.1(@typescript-eslint/parser@6.7.0)(eslint@8.49.0)
eslint-plugin-node: 11.1.0(eslint@8.49.0) eslint-plugin-node: 11.1.0(eslint@8.49.0)
eslint-plugin-prettier: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@2.8.8) eslint-plugin-prettier: 5.0.0(eslint-config-prettier@9.0.0)(eslint@8.49.0)(prettier@2.8.8)
eslint-plugin-simple-import-sort: 10.0.0(eslint@8.49.0) eslint-plugin-simple-import-sort: 10.0.0(eslint@8.49.0)
@ -1876,8 +1889,8 @@ packages:
'@types/node': 20.4.2 '@types/node': 20.4.2
optional: true optional: true
/@typescript-eslint/eslint-plugin@6.6.0(@typescript-eslint/parser@6.6.0)(eslint@8.49.0)(typescript@5.1.6): /@typescript-eslint/eslint-plugin@6.7.0(@typescript-eslint/parser@6.7.0)(eslint@8.49.0)(typescript@5.1.6):
resolution: {integrity: sha512-CW9YDGTQnNYMIo5lMeuiIG08p4E0cXrXTbcZ2saT/ETE7dWUrNxlijsQeU04qAAKkILiLzdQz+cGFxCJjaZUmA==} resolution: {integrity: sha512-gUqtknHm0TDs1LhY12K2NA3Rmlmp88jK9Tx8vGZMfHeNMLE3GH2e9TRub+y+SOjuYgtOmok+wt1AyDPZqxbNag==}
engines: {node: ^16.0.0 || >=18.0.0} engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies: peerDependencies:
'@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha
@ -1888,11 +1901,11 @@ packages:
optional: true optional: true
dependencies: dependencies:
'@eslint-community/regexpp': 4.6.2 '@eslint-community/regexpp': 4.6.2
'@typescript-eslint/parser': 6.6.0(eslint@8.49.0)(typescript@5.0.4) '@typescript-eslint/parser': 6.7.0(eslint@8.49.0)(typescript@5.0.4)
'@typescript-eslint/scope-manager': 6.6.0 '@typescript-eslint/scope-manager': 6.7.0
'@typescript-eslint/type-utils': 6.6.0(eslint@8.49.0)(typescript@5.1.6) '@typescript-eslint/type-utils': 6.7.0(eslint@8.49.0)(typescript@5.1.6)
'@typescript-eslint/utils': 6.6.0(eslint@8.49.0)(typescript@5.1.6) '@typescript-eslint/utils': 6.7.0(eslint@8.49.0)(typescript@5.1.6)
'@typescript-eslint/visitor-keys': 6.6.0 '@typescript-eslint/visitor-keys': 6.7.0
debug: 4.3.4(supports-color@8.1.1) debug: 4.3.4(supports-color@8.1.1)
eslint: 8.49.0 eslint: 8.49.0
graphemer: 1.4.0 graphemer: 1.4.0
@ -1905,8 +1918,8 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/parser@6.6.0(eslint@8.49.0)(typescript@5.0.4): /@typescript-eslint/parser@6.7.0(eslint@8.49.0)(typescript@5.0.4):
resolution: {integrity: sha512-setq5aJgUwtzGrhW177/i+DMLqBaJbdwGj2CPIVFFLE0NCliy5ujIdLHd2D1ysmlmsjdL2GWW+hR85neEfc12w==} resolution: {integrity: sha512-jZKYwqNpNm5kzPVP5z1JXAuxjtl2uG+5NpaMocFPTNC2EdYIgbXIPImObOkhbONxtFTTdoZstLZefbaK+wXZng==}
engines: {node: ^16.0.0 || >=18.0.0} engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies: peerDependencies:
eslint: ^7.0.0 || ^8.0.0 eslint: ^7.0.0 || ^8.0.0
@ -1915,10 +1928,10 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/scope-manager': 6.6.0 '@typescript-eslint/scope-manager': 6.7.0
'@typescript-eslint/types': 6.6.0 '@typescript-eslint/types': 6.7.0
'@typescript-eslint/typescript-estree': 6.6.0(typescript@5.0.4) '@typescript-eslint/typescript-estree': 6.7.0(typescript@5.0.4)
'@typescript-eslint/visitor-keys': 6.6.0 '@typescript-eslint/visitor-keys': 6.7.0
debug: 4.3.4(supports-color@8.1.1) debug: 4.3.4(supports-color@8.1.1)
eslint: 8.49.0 eslint: 8.49.0
typescript: 5.0.4 typescript: 5.0.4
@ -1926,16 +1939,16 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/scope-manager@6.6.0: /@typescript-eslint/scope-manager@6.7.0:
resolution: {integrity: sha512-pT08u5W/GT4KjPUmEtc2kSYvrH8x89cVzkA0Sy2aaOUIw6YxOIjA8ilwLr/1fLjOedX1QAuBpG9XggWqIIfERw==} resolution: {integrity: sha512-lAT1Uau20lQyjoLUQ5FUMSX/dS07qux9rYd5FGzKz/Kf8W8ccuvMyldb8hadHdK/qOI7aikvQWqulnEq2nCEYA==}
engines: {node: ^16.0.0 || >=18.0.0} engines: {node: ^16.0.0 || >=18.0.0}
dependencies: dependencies:
'@typescript-eslint/types': 6.6.0 '@typescript-eslint/types': 6.7.0
'@typescript-eslint/visitor-keys': 6.6.0 '@typescript-eslint/visitor-keys': 6.7.0
dev: true dev: true
/@typescript-eslint/type-utils@6.6.0(eslint@8.49.0)(typescript@5.1.6): /@typescript-eslint/type-utils@6.7.0(eslint@8.49.0)(typescript@5.1.6):
resolution: {integrity: sha512-8m16fwAcEnQc69IpeDyokNO+D5spo0w1jepWWY2Q6y5ZKNuj5EhVQXjtVAeDDqvW6Yg7dhclbsz6rTtOvcwpHg==} resolution: {integrity: sha512-f/QabJgDAlpSz3qduCyQT0Fw7hHpmhOzY/Rv6zO3yO+HVIdPfIWhrQoAyG+uZVtWAIS85zAyzgAFfyEr+MgBpg==}
engines: {node: ^16.0.0 || >=18.0.0} engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies: peerDependencies:
eslint: ^7.0.0 || ^8.0.0 eslint: ^7.0.0 || ^8.0.0
@ -1944,8 +1957,8 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/typescript-estree': 6.6.0(typescript@5.1.6) '@typescript-eslint/typescript-estree': 6.7.0(typescript@5.1.6)
'@typescript-eslint/utils': 6.6.0(eslint@8.49.0)(typescript@5.1.6) '@typescript-eslint/utils': 6.7.0(eslint@8.49.0)(typescript@5.1.6)
debug: 4.3.4(supports-color@8.1.1) debug: 4.3.4(supports-color@8.1.1)
eslint: 8.49.0 eslint: 8.49.0
ts-api-utils: 1.0.1(typescript@5.1.6) ts-api-utils: 1.0.1(typescript@5.1.6)
@ -1954,13 +1967,13 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/types@6.6.0: /@typescript-eslint/types@6.7.0:
resolution: {integrity: sha512-CB6QpJQ6BAHlJXdwUmiaXDBmTqIE2bzGTDLADgvqtHWuhfNP3rAOK7kAgRMAET5rDRr9Utt+qAzRBdu3AhR3sg==} resolution: {integrity: sha512-ihPfvOp7pOcN/ysoj0RpBPOx3HQTJTrIN8UZK+WFd3/iDeFHHqeyYxa4hQk4rMhsz9H9mXpR61IzwlBVGXtl9Q==}
engines: {node: ^16.0.0 || >=18.0.0} engines: {node: ^16.0.0 || >=18.0.0}
dev: true dev: true
/@typescript-eslint/typescript-estree@6.6.0(typescript@5.0.4): /@typescript-eslint/typescript-estree@6.7.0(typescript@5.0.4):
resolution: {integrity: sha512-hMcTQ6Al8MP2E6JKBAaSxSVw5bDhdmbCEhGW/V8QXkb9oNsFkA4SBuOMYVPxD3jbtQ4R/vSODBsr76R6fP3tbA==} resolution: {integrity: sha512-dPvkXj3n6e9yd/0LfojNU8VMUGHWiLuBZvbM6V6QYD+2qxqInE7J+J/ieY2iGwR9ivf/R/haWGkIj04WVUeiSQ==}
engines: {node: ^16.0.0 || >=18.0.0} engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies: peerDependencies:
typescript: '*' typescript: '*'
@ -1968,8 +1981,8 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/types': 6.6.0 '@typescript-eslint/types': 6.7.0
'@typescript-eslint/visitor-keys': 6.6.0 '@typescript-eslint/visitor-keys': 6.7.0
debug: 4.3.4(supports-color@8.1.1) debug: 4.3.4(supports-color@8.1.1)
globby: 11.1.0 globby: 11.1.0
is-glob: 4.0.3 is-glob: 4.0.3
@ -1980,8 +1993,8 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/typescript-estree@6.6.0(typescript@5.1.6): /@typescript-eslint/typescript-estree@6.7.0(typescript@5.1.6):
resolution: {integrity: sha512-hMcTQ6Al8MP2E6JKBAaSxSVw5bDhdmbCEhGW/V8QXkb9oNsFkA4SBuOMYVPxD3jbtQ4R/vSODBsr76R6fP3tbA==} resolution: {integrity: sha512-dPvkXj3n6e9yd/0LfojNU8VMUGHWiLuBZvbM6V6QYD+2qxqInE7J+J/ieY2iGwR9ivf/R/haWGkIj04WVUeiSQ==}
engines: {node: ^16.0.0 || >=18.0.0} engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies: peerDependencies:
typescript: '*' typescript: '*'
@ -1989,8 +2002,8 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/types': 6.6.0 '@typescript-eslint/types': 6.7.0
'@typescript-eslint/visitor-keys': 6.6.0 '@typescript-eslint/visitor-keys': 6.7.0
debug: 4.3.4(supports-color@8.1.1) debug: 4.3.4(supports-color@8.1.1)
globby: 11.1.0 globby: 11.1.0
is-glob: 4.0.3 is-glob: 4.0.3
@ -2001,8 +2014,8 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/utils@6.6.0(eslint@8.49.0)(typescript@5.1.6): /@typescript-eslint/utils@6.7.0(eslint@8.49.0)(typescript@5.1.6):
resolution: {integrity: sha512-mPHFoNa2bPIWWglWYdR0QfY9GN0CfvvXX1Sv6DlSTive3jlMTUy+an67//Gysc+0Me9pjitrq0LJp0nGtLgftw==} resolution: {integrity: sha512-MfCq3cM0vh2slSikQYqK2Gq52gvOhe57vD2RM3V4gQRZYX4rDPnKLu5p6cm89+LJiGlwEXU8hkYxhqqEC/V3qA==}
engines: {node: ^16.0.0 || >=18.0.0} engines: {node: ^16.0.0 || >=18.0.0}
peerDependencies: peerDependencies:
eslint: ^7.0.0 || ^8.0.0 eslint: ^7.0.0 || ^8.0.0
@ -2010,9 +2023,9 @@ packages:
'@eslint-community/eslint-utils': 4.4.0(eslint@8.49.0) '@eslint-community/eslint-utils': 4.4.0(eslint@8.49.0)
'@types/json-schema': 7.0.12 '@types/json-schema': 7.0.12
'@types/semver': 7.5.0 '@types/semver': 7.5.0
'@typescript-eslint/scope-manager': 6.6.0 '@typescript-eslint/scope-manager': 6.7.0
'@typescript-eslint/types': 6.6.0 '@typescript-eslint/types': 6.7.0
'@typescript-eslint/typescript-estree': 6.6.0(typescript@5.1.6) '@typescript-eslint/typescript-estree': 6.7.0(typescript@5.1.6)
eslint: 8.49.0 eslint: 8.49.0
semver: 7.5.4 semver: 7.5.4
transitivePeerDependencies: transitivePeerDependencies:
@ -2020,11 +2033,11 @@ packages:
- typescript - typescript
dev: true dev: true
/@typescript-eslint/visitor-keys@6.6.0: /@typescript-eslint/visitor-keys@6.7.0:
resolution: {integrity: sha512-L61uJT26cMOfFQ+lMZKoJNbAEckLe539VhTxiGHrWl5XSKQgA0RTBZJW2HFPy5T0ZvPVSD93QsrTKDkfNwJGyQ==} resolution: {integrity: sha512-/C1RVgKFDmGMcVGeD8HjKv2bd72oI1KxQDeY8uc66gw9R0OK0eMq48cA+jv9/2Ag6cdrsUGySm1yzYmfz0hxwQ==}
engines: {node: ^16.0.0 || >=18.0.0} engines: {node: ^16.0.0 || >=18.0.0}
dependencies: dependencies:
'@typescript-eslint/types': 6.6.0 '@typescript-eslint/types': 6.7.0
eslint-visitor-keys: 3.4.3 eslint-visitor-keys: 3.4.3
dev: true dev: true
@ -3146,7 +3159,7 @@ packages:
- supports-color - supports-color
dev: true dev: true
/eslint-module-utils@2.8.0(@typescript-eslint/parser@6.6.0)(eslint-import-resolver-node@0.3.7)(eslint@8.49.0): /eslint-module-utils@2.8.0(@typescript-eslint/parser@6.7.0)(eslint-import-resolver-node@0.3.7)(eslint@8.49.0):
resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==}
engines: {node: '>=4'} engines: {node: '>=4'}
peerDependencies: peerDependencies:
@ -3167,7 +3180,7 @@ packages:
eslint-import-resolver-webpack: eslint-import-resolver-webpack:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/parser': 6.6.0(eslint@8.49.0)(typescript@5.0.4) '@typescript-eslint/parser': 6.7.0(eslint@8.49.0)(typescript@5.0.4)
debug: 3.2.7 debug: 3.2.7
eslint: 8.49.0 eslint: 8.49.0
eslint-import-resolver-node: 0.3.7 eslint-import-resolver-node: 0.3.7
@ -3186,7 +3199,7 @@ packages:
regexpp: 3.2.0 regexpp: 3.2.0
dev: true dev: true
/eslint-plugin-import@2.28.1(@typescript-eslint/parser@6.6.0)(eslint@8.49.0): /eslint-plugin-import@2.28.1(@typescript-eslint/parser@6.7.0)(eslint@8.49.0):
resolution: {integrity: sha512-9I9hFlITvOV55alzoKBI+K9q74kv0iKMeY6av5+umsNwayt59fz692daGyjR+oStBQgx6nwR9rXldDev3Clw+A==} resolution: {integrity: sha512-9I9hFlITvOV55alzoKBI+K9q74kv0iKMeY6av5+umsNwayt59fz692daGyjR+oStBQgx6nwR9rXldDev3Clw+A==}
engines: {node: '>=4'} engines: {node: '>=4'}
peerDependencies: peerDependencies:
@ -3196,7 +3209,7 @@ packages:
'@typescript-eslint/parser': '@typescript-eslint/parser':
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/parser': 6.6.0(eslint@8.49.0)(typescript@5.0.4) '@typescript-eslint/parser': 6.7.0(eslint@8.49.0)(typescript@5.0.4)
array-includes: 3.1.6 array-includes: 3.1.6
array.prototype.findlastindex: 1.2.2 array.prototype.findlastindex: 1.2.2
array.prototype.flat: 1.3.1 array.prototype.flat: 1.3.1
@ -3205,7 +3218,7 @@ packages:
doctrine: 2.1.0 doctrine: 2.1.0
eslint: 8.49.0 eslint: 8.49.0
eslint-import-resolver-node: 0.3.7 eslint-import-resolver-node: 0.3.7
eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.6.0)(eslint-import-resolver-node@0.3.7)(eslint@8.49.0) eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.7.0)(eslint-import-resolver-node@0.3.7)(eslint@8.49.0)
has: 1.0.3 has: 1.0.3
is-core-module: 2.13.0 is-core-module: 2.13.0
is-glob: 4.0.3 is-glob: 4.0.3
@ -4061,12 +4074,6 @@ packages:
ci-info: 3.8.0 ci-info: 3.8.0
dev: true dev: true
/is-core-module@2.12.1:
resolution: {integrity: sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==}
dependencies:
has: 1.0.3
dev: true
/is-core-module@2.13.0: /is-core-module@2.13.0:
resolution: {integrity: sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==} resolution: {integrity: sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==}
dependencies: dependencies:
@ -5364,7 +5371,7 @@ packages:
resolution: {integrity: sha512-P8ur/gp/AmbEzjr729bZnLjXK5Z+4P0zhIJgBgzqRih7hL7BOukHGtSTA3ACMY467GRFz3duQsi0bDZdR7DKdw==} resolution: {integrity: sha512-P8ur/gp/AmbEzjr729bZnLjXK5Z+4P0zhIJgBgzqRih7hL7BOukHGtSTA3ACMY467GRFz3duQsi0bDZdR7DKdw==}
hasBin: true hasBin: true
dependencies: dependencies:
is-core-module: 2.12.1 is-core-module: 2.13.0
path-parse: 1.0.7 path-parse: 1.0.7
supports-preserve-symlinks-flag: 1.0.0 supports-preserve-symlinks-flag: 1.0.0
dev: true dev: true

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
[package] [package]
name = "switchboard-solana" name = "switchboard-solana"
version = "0.27.8" version = "0.27.18"
edition = "2021" edition = "2021"
description = "A Rust library to interact with Switchboard accounts." description = "A Rust library to interact with Switchboard accounts."
readme = "README.md" readme = "README.md"
@ -18,6 +18,7 @@ doctest = false
default = ["cpi"] default = ["cpi"]
no-entrypoint = [] no-entrypoint = []
cpi = ["no-entrypoint"] cpi = ["no-entrypoint"]
secrets = ["rand", "rsa", "reqwest", "serde", "serde_json"]
[dependencies] [dependencies]
anchor-spl = "0.27.0" anchor-spl = "0.27.0"
@ -28,11 +29,11 @@ bytemuck = "^1"
superslice = "1" superslice = "1"
[target.'cfg(target_os = "solana")'.dependencies] [target.'cfg(target_os = "solana")'.dependencies]
switchboard-common = { version = "0.8.7", path = "../switchboard-common" } switchboard-common = { version = "0.8.15", path = "../switchboard-common" }
anchor-lang = { version = "0.27.0" } anchor-lang = { version = "0.27.0" }
[target.'cfg(not(target_os = "solana"))'.dependencies] [target.'cfg(not(target_os = "solana"))'.dependencies]
switchboard-common = { version = "0.8.7", path = "../switchboard-common", features = [ switchboard-common = { version = "0.8.15", path = "../switchboard-common", features = [
"client", "client",
"solana", "solana",
] } ] }
@ -46,5 +47,12 @@ hex = "0.4.3"
tokio = "1" tokio = "1"
url = "2.4" url = "2.4"
# Secrets Dependencies
rsa = { version = "0.5.0", optional = true }
reqwest = { version = "0.11", features = ["json"], optional = true }
rand = { version = "0.8.5", optional = true }
serde = { version = "^1", features = ["derive"], optional = true }
serde_json = { version = "^1", optional = true }
[package.metadata.docs.rs] [package.metadata.docs.rs]
rustdoc-args = ["--cfg", "doc_cfg"] rustdoc-args = ["--cfg", "doc_cfg"]

View File

@ -4439,13 +4439,11 @@ checksum = "ab16ced94dbd8a46c82fd81e3ed9a8727dac2977ea869d217bcc4ea1f122e81f"
[[package]] [[package]]
name = "switchboard-common" name = "switchboard-common"
version = "0.8.15" version = "0.8.18"
dependencies = [ dependencies = [
"envy", "envy",
"getrandom 0.2.10", "getrandom 0.2.10",
"hex", "hex",
"rand 0.8.5",
"reqwest",
"serde", "serde",
"serde_json", "serde_json",
"sgx-quote", "sgx-quote",
@ -4454,7 +4452,7 @@ dependencies = [
[[package]] [[package]]
name = "switchboard-solana" name = "switchboard-solana"
version = "0.28.11" version = "0.28.18"
dependencies = [ dependencies = [
"anchor-client", "anchor-client",
"anchor-lang", "anchor-lang",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "switchboard-solana" name = "switchboard-solana"
version = "0.28.12" version = "0.28.18"
edition = "2021" edition = "2021"
description = "A Rust library to interact with Switchboard accounts." description = "A Rust library to interact with Switchboard accounts."
readme = "README.md" readme = "README.md"
@ -18,7 +18,7 @@ doctest = false
default = ["cpi"] default = ["cpi"]
no-entrypoint = [] no-entrypoint = []
cpi = ["no-entrypoint"] cpi = ["no-entrypoint"]
secrets = ["rand", "rsa", "reqwest", "serde", "serde_json"]
[dependencies] [dependencies]
anchor-spl = "0.28.0" anchor-spl = "0.28.0"
@ -29,11 +29,11 @@ bytemuck = "^1"
superslice = "1" superslice = "1"
[target.'cfg(target_os = "solana")'.dependencies] [target.'cfg(target_os = "solana")'.dependencies]
switchboard-common = { version = "0.8.14" } switchboard-common = { version = "0.8.18" }
anchor-lang = { version = "0.28.0" } anchor-lang = { version = "0.28.0" }
[target.'cfg(not(target_os = "solana"))'.dependencies] [target.'cfg(not(target_os = "solana"))'.dependencies]
switchboard-common = { version = "0.8.15", features = [ switchboard-common = { version = "0.8.18", features = [
"client", "client",
"solana", "solana",
] } ] }
@ -46,11 +46,13 @@ chrono = { version = "0.4.25" }
hex = "0.4.3" hex = "0.4.3"
tokio = "1" tokio = "1"
url = "2.4" url = "2.4"
rsa = { version = "0.5.0" }
serde = { version = "^1", features = ["derive"] } # Secrets Dependencies
serde_json = "^1" rsa = { version = "0.5.0", optional = true }
reqwest = { version = "0.11", features = ["json"] } reqwest = { version = "0.11", features = ["json"], optional = true }
rand = { version = "0.8.5" } rand = { version = "0.8.5", optional = true }
serde = { version = "^1", features = ["derive"], optional = true }
serde_json = { version = "^1", optional = true }
[package.metadata.docs.rs] [package.metadata.docs.rs]
rustdoc-args = ["--cfg", "doc_cfg"] rustdoc-args = ["--cfg", "doc_cfg"]

View File

@ -125,8 +125,12 @@ pub mod prelude;
cfg_client! { cfg_client! {
pub mod client; pub mod client;
pub use client::*; pub use client::*;
pub mod secrets;
pub use secrets::*; // Only enable this feature if client is already enabled
cfg_secrets! {
pub mod secrets;
pub use secrets::*;
}
} }
/// Program id for the Switchboard oracle program /// Program id for the Switchboard oracle program

View File

@ -12,6 +12,17 @@ macro_rules! cfg_client {
} }
} }
#[macro_export]
macro_rules! cfg_secrets {
($($item:item)*) => {
$(
#[cfg(feature = "secrets")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "secrets")))]
$item
)*
}
}
#[macro_export] #[macro_export]
macro_rules! cfg_program { macro_rules! cfg_program {
($($item:item)*) => { ($($item:item)*) => {