converted to macro for feature specific functions
This commit is contained in:
parent
5527c87045
commit
0b6e3c5b99
|
@ -1,4 +1,5 @@
|
|||
use crate::prelude::*;
|
||||
use crate::*;
|
||||
use anchor_lang::{Discriminator, Owner, ZeroCopy};
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use std::cell::Ref;
|
||||
|
@ -107,8 +108,7 @@ impl AttestationPermissionAccountData {
|
|||
self.permissions & p as u32 != 0
|
||||
}
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "client")))]
|
||||
cfg_client! {
|
||||
pub async fn fetch(
|
||||
client: &solana_client::rpc_client::RpcClient,
|
||||
pubkey: Pubkey,
|
||||
|
@ -116,3 +116,4 @@ impl AttestationPermissionAccountData {
|
|||
crate::client::load_account(client, pubkey).await
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::prelude::*;
|
||||
use crate::*;
|
||||
use anchor_lang::{Discriminator, Owner, ZeroCopy};
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use std::cell::Ref;
|
||||
|
@ -114,8 +115,7 @@ impl AttestationQueueAccountData {
|
|||
.any(|x| x.to_vec() == mr_enclave.to_vec())
|
||||
}
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "client")))]
|
||||
cfg_client! {
|
||||
pub async fn fetch(
|
||||
client: &solana_client::rpc_client::RpcClient,
|
||||
pubkey: Pubkey,
|
||||
|
@ -123,3 +123,4 @@ impl AttestationQueueAccountData {
|
|||
crate::client::load_account(client, pubkey).await
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::prelude::*;
|
||||
use crate::*;
|
||||
use anchor_lang::{Discriminator, Owner, ZeroCopy};
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use std::cell::Ref;
|
||||
|
@ -146,8 +147,7 @@ impl QuoteAccountData {
|
|||
true
|
||||
}
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "client")))]
|
||||
cfg_client! {
|
||||
pub async fn fetch(
|
||||
client: &solana_client::rpc_client::RpcClient,
|
||||
pubkey: Pubkey,
|
||||
|
@ -155,3 +155,4 @@ impl QuoteAccountData {
|
|||
crate::client::load_account(client, pubkey).await
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use super::super::accounts::*;
|
||||
use crate::prelude::*;
|
||||
use crate::*;
|
||||
use anchor_lang::solana_program::entrypoint::ProgramResult;
|
||||
use anchor_lang::solana_program::instruction::Instruction;
|
||||
use anchor_lang::solana_program::program::{invoke, invoke_signed};
|
||||
|
@ -202,8 +202,7 @@ impl<'info> FunctionVerify<'info> {
|
|||
]
|
||||
}
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "client")))]
|
||||
cfg_client! {
|
||||
pub async fn build(
|
||||
client: &solana_client::rpc_client::RpcClient,
|
||||
fn_signer: std::sync::Arc<solana_sdk::signer::keypair::Keypair>,
|
||||
|
@ -284,8 +283,7 @@ impl<'info> FunctionVerify<'info> {
|
|||
))
|
||||
}
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "client")))]
|
||||
|
||||
fn build_ix(
|
||||
accounts: FunctionVerifyAccounts,
|
||||
observed_time: i64,
|
||||
|
@ -306,9 +304,9 @@ impl<'info> FunctionVerify<'info> {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "client")))]
|
||||
cfg_client! {
|
||||
pub struct FunctionVerifyAccounts {
|
||||
pub function: Pubkey,
|
||||
pub fn_signer: Pubkey,
|
||||
|
@ -325,8 +323,7 @@ pub struct FunctionVerifyAccounts {
|
|||
pub payer: Pubkey,
|
||||
pub system_program: Pubkey,
|
||||
}
|
||||
#[cfg(feature = "client")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "client")))]
|
||||
|
||||
impl ToAccountMetas for FunctionVerifyAccounts {
|
||||
fn to_account_metas(&self, _: Option<bool>) -> Vec<AccountMeta> {
|
||||
vec![
|
||||
|
@ -403,3 +400,4 @@ impl ToAccountMetas for FunctionVerifyAccounts {
|
|||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,8 +123,7 @@ impl OracleAccountData {
|
|||
))
|
||||
}
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "client")))]
|
||||
cfg_client! {
|
||||
pub async fn fetch(
|
||||
client: &solana_client::rpc_client::RpcClient,
|
||||
pubkey: Pubkey,
|
||||
|
@ -132,3 +131,4 @@ impl OracleAccountData {
|
|||
crate::client::load_account(client, pubkey).await
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,12 +156,13 @@ impl OracleQueueAccountData {
|
|||
))
|
||||
}
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "client")))]
|
||||
cfg_client! {
|
||||
pub async fn fetch(
|
||||
client: &solana_client::rpc_client::RpcClient,
|
||||
pubkey: Pubkey,
|
||||
) -> std::result::Result<Self, switchboard_common::Error> {
|
||||
crate::client::load_account(client, pubkey).await
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,8 +124,7 @@ impl VrfAccountData {
|
|||
Ok(self.current_round.result)
|
||||
}
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "client")))]
|
||||
cfg_client! {
|
||||
pub async fn fetch(
|
||||
client: &solana_client::rpc_client::RpcClient,
|
||||
pubkey: Pubkey,
|
||||
|
@ -133,3 +132,4 @@ impl VrfAccountData {
|
|||
crate::client::load_account(client, pubkey).await
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,8 +134,7 @@ impl VrfLiteAccountData {
|
|||
Ok(self.result)
|
||||
}
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "client")))]
|
||||
cfg_client! {
|
||||
pub async fn fetch(
|
||||
client: &solana_client::rpc_client::RpcClient,
|
||||
pubkey: Pubkey,
|
||||
|
@ -143,3 +142,4 @@ impl VrfLiteAccountData {
|
|||
crate::client::load_account(client, pubkey).await
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,8 +97,7 @@ impl VrfPoolAccountData {
|
|||
))
|
||||
}
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
#[cfg_attr(doc_cfg, doc(cfg(feature = "client")))]
|
||||
cfg_client! {
|
||||
pub async fn fetch(
|
||||
client: &solana_client::rpc_client::RpcClient,
|
||||
pubkey: Pubkey,
|
||||
|
@ -106,6 +105,7 @@ impl VrfPoolAccountData {
|
|||
crate::client::load_account(client, pubkey).await
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// impl Discriminator for VrfPoolAccountData {
|
||||
// const DISCRIMINATOR: [u8; 8] = [86, 67, 58, 9, 46, 21, 101, 248];
|
||||
|
|
Loading…
Reference in New Issue