pub struct LightconePinocchioClient {
pub rpc_client: RpcClient,
pub program_id: Pubkey,
}Expand description
Client for interacting with the Lightcone Pinocchio program.
Fields§
§rpc_client: RpcClientRPC client for Solana
program_id: PubkeyProgram ID
Implementations§
Source§impl LightconePinocchioClient
impl LightconePinocchioClient
Sourcepub fn with_program_id(rpc_url: &str, program_id: Pubkey) -> Self
pub fn with_program_id(rpc_url: &str, program_id: Pubkey) -> Self
Create a new client with custom program ID.
Sourcepub fn from_rpc_client(rpc_client: RpcClient) -> Self
pub fn from_rpc_client(rpc_client: RpcClient) -> Self
Create a new client with existing RpcClient.
Sourcepub async fn get_exchange(&self) -> SdkResult<Exchange>
pub async fn get_exchange(&self) -> SdkResult<Exchange>
Fetch the Exchange account.
Sourcepub async fn get_market(&self, market_id: u64) -> SdkResult<Market>
pub async fn get_market(&self, market_id: u64) -> SdkResult<Market>
Fetch a Market account by ID.
Sourcepub async fn get_market_by_pubkey(&self, market: &Pubkey) -> SdkResult<Market>
pub async fn get_market_by_pubkey(&self, market: &Pubkey) -> SdkResult<Market>
Fetch a Market account by pubkey.
Sourcepub async fn get_position(
&self,
owner: &Pubkey,
market: &Pubkey,
) -> SdkResult<Option<Position>>
pub async fn get_position( &self, owner: &Pubkey, market: &Pubkey, ) -> SdkResult<Option<Position>>
Fetch a Position account (returns None if not found).
Sourcepub async fn get_order_status(
&self,
order_hash: &[u8; 32],
) -> SdkResult<Option<OrderStatus>>
pub async fn get_order_status( &self, order_hash: &[u8; 32], ) -> SdkResult<Option<OrderStatus>>
Fetch an OrderStatus account (returns None if not found).
Sourcepub async fn get_user_nonce(&self, user: &Pubkey) -> SdkResult<u64>
pub async fn get_user_nonce(&self, user: &Pubkey) -> SdkResult<u64>
Fetch a user’s current nonce (returns 0 if not initialized).
Sourcepub async fn get_next_nonce(&self, user: &Pubkey) -> SdkResult<u64>
pub async fn get_next_nonce(&self, user: &Pubkey) -> SdkResult<u64>
Get the next available nonce for a user (the current stored nonce value).
Orders should be signed with this nonce value.
Call increment_nonce to invalidate orders with the current nonce.
Sourcepub async fn get_next_market_id(&self) -> SdkResult<u64>
pub async fn get_next_market_id(&self) -> SdkResult<u64>
Get the next available market ID.
Sourcepub async fn get_latest_blockhash(&self) -> SdkResult<Hash>
pub async fn get_latest_blockhash(&self) -> SdkResult<Hash>
Get the latest blockhash for transaction building.
Sourcepub async fn initialize(&self, authority: &Pubkey) -> SdkResult<Transaction>
pub async fn initialize(&self, authority: &Pubkey) -> SdkResult<Transaction>
Build Initialize transaction.
Sourcepub async fn create_market(
&self,
params: CreateMarketParams,
) -> SdkResult<Transaction>
pub async fn create_market( &self, params: CreateMarketParams, ) -> SdkResult<Transaction>
Build CreateMarket transaction.
Sourcepub async fn add_deposit_mint(
&self,
params: AddDepositMintParams,
market: &Pubkey,
num_outcomes: u8,
) -> SdkResult<Transaction>
pub async fn add_deposit_mint( &self, params: AddDepositMintParams, market: &Pubkey, num_outcomes: u8, ) -> SdkResult<Transaction>
Build AddDepositMint transaction.
Sourcepub async fn mint_complete_set(
&self,
params: MintCompleteSetParams,
num_outcomes: u8,
) -> SdkResult<Transaction>
pub async fn mint_complete_set( &self, params: MintCompleteSetParams, num_outcomes: u8, ) -> SdkResult<Transaction>
Build MintCompleteSet transaction.
Sourcepub async fn merge_complete_set(
&self,
params: MergeCompleteSetParams,
num_outcomes: u8,
) -> SdkResult<Transaction>
pub async fn merge_complete_set( &self, params: MergeCompleteSetParams, num_outcomes: u8, ) -> SdkResult<Transaction>
Build MergeCompleteSet transaction.
Sourcepub async fn cancel_order(
&self,
maker: &Pubkey,
order: &FullOrder,
) -> SdkResult<Transaction>
pub async fn cancel_order( &self, maker: &Pubkey, order: &FullOrder, ) -> SdkResult<Transaction>
Build CancelOrder transaction.
Sourcepub async fn increment_nonce(&self, user: &Pubkey) -> SdkResult<Transaction>
pub async fn increment_nonce(&self, user: &Pubkey) -> SdkResult<Transaction>
Build IncrementNonce transaction.
Sourcepub async fn settle_market(
&self,
params: SettleMarketParams,
) -> SdkResult<Transaction>
pub async fn settle_market( &self, params: SettleMarketParams, ) -> SdkResult<Transaction>
Build SettleMarket transaction.
Sourcepub async fn redeem_winnings(
&self,
params: RedeemWinningsParams,
winning_outcome: u8,
) -> SdkResult<Transaction>
pub async fn redeem_winnings( &self, params: RedeemWinningsParams, winning_outcome: u8, ) -> SdkResult<Transaction>
Build RedeemWinnings transaction.
Sourcepub async fn set_paused(
&self,
authority: &Pubkey,
paused: bool,
) -> SdkResult<Transaction>
pub async fn set_paused( &self, authority: &Pubkey, paused: bool, ) -> SdkResult<Transaction>
Build SetPaused transaction.
Sourcepub async fn set_operator(
&self,
authority: &Pubkey,
new_operator: &Pubkey,
) -> SdkResult<Transaction>
pub async fn set_operator( &self, authority: &Pubkey, new_operator: &Pubkey, ) -> SdkResult<Transaction>
Build SetOperator transaction.
Sourcepub async fn withdraw_from_position(
&self,
params: WithdrawFromPositionParams,
is_token_2022: bool,
) -> SdkResult<Transaction>
pub async fn withdraw_from_position( &self, params: WithdrawFromPositionParams, is_token_2022: bool, ) -> SdkResult<Transaction>
Build WithdrawFromPosition transaction.
Sourcepub async fn activate_market(
&self,
params: ActivateMarketParams,
) -> SdkResult<Transaction>
pub async fn activate_market( &self, params: ActivateMarketParams, ) -> SdkResult<Transaction>
Build ActivateMarket transaction.
Sourcepub async fn match_orders_multi(
&self,
params: MatchOrdersMultiParams,
) -> SdkResult<Transaction>
pub async fn match_orders_multi( &self, params: MatchOrdersMultiParams, ) -> SdkResult<Transaction>
Build MatchOrdersMulti transaction without Ed25519 verify instructions.
Note: This requires Ed25519 verification instructions to be added separately before the match instruction.
Sourcepub async fn match_orders_multi_with_verify(
&self,
params: MatchOrdersMultiParams,
) -> SdkResult<Transaction>
pub async fn match_orders_multi_with_verify( &self, params: MatchOrdersMultiParams, ) -> SdkResult<Transaction>
Build MatchOrdersMulti transaction with Ed25519 verify instructions.
Uses individual Ed25519 verify instructions (one per signature).
Sourcepub async fn match_orders_multi_cross_ref(
&self,
params: MatchOrdersMultiParams,
) -> SdkResult<Transaction>
pub async fn match_orders_multi_cross_ref( &self, params: MatchOrdersMultiParams, ) -> SdkResult<Transaction>
Build MatchOrdersMulti transaction with cross-reference Ed25519 verification.
This is the most space-efficient approach - Ed25519 instructions reference data in the match instruction instead of duplicating it.
Sourcepub fn create_bid_order(&self, params: BidOrderParams) -> FullOrder
pub fn create_bid_order(&self, params: BidOrderParams) -> FullOrder
Create an unsigned bid order.
Sourcepub fn create_ask_order(&self, params: AskOrderParams) -> FullOrder
pub fn create_ask_order(&self, params: AskOrderParams) -> FullOrder
Create an unsigned ask order.
Sourcepub fn create_signed_bid_order(
&self,
params: BidOrderParams,
keypair: &Keypair,
) -> FullOrder
pub fn create_signed_bid_order( &self, params: BidOrderParams, keypair: &Keypair, ) -> FullOrder
Create and sign a bid order.
Sourcepub fn create_signed_ask_order(
&self,
params: AskOrderParams,
keypair: &Keypair,
) -> FullOrder
pub fn create_signed_ask_order( &self, params: AskOrderParams, keypair: &Keypair, ) -> FullOrder
Create and sign an ask order.
Sourcepub fn hash_order(&self, order: &FullOrder) -> [u8; 32]
pub fn hash_order(&self, order: &FullOrder) -> [u8; 32]
Compute the hash of an order.
Sourcepub fn sign_order(&self, order: &mut FullOrder, keypair: &Keypair)
pub fn sign_order(&self, order: &mut FullOrder, keypair: &Keypair)
Sign an order with the given keypair.
Sourcepub fn derive_condition_id(
&self,
oracle: &Pubkey,
question_id: &[u8; 32],
num_outcomes: u8,
) -> [u8; 32]
pub fn derive_condition_id( &self, oracle: &Pubkey, question_id: &[u8; 32], num_outcomes: u8, ) -> [u8; 32]
Derive the condition ID for a market.
Sourcepub fn get_conditional_mints(
&self,
market: &Pubkey,
deposit_mint: &Pubkey,
num_outcomes: u8,
) -> Vec<Pubkey>
pub fn get_conditional_mints( &self, market: &Pubkey, deposit_mint: &Pubkey, num_outcomes: u8, ) -> Vec<Pubkey>
Get all conditional mint pubkeys for a market.
Sourcepub fn get_exchange_pda(&self) -> Pubkey
pub fn get_exchange_pda(&self) -> Pubkey
Get the Exchange PDA.
Sourcepub fn get_market_pda(&self, market_id: u64) -> Pubkey
pub fn get_market_pda(&self, market_id: u64) -> Pubkey
Get a Market PDA.
Sourcepub fn get_position_pda(&self, owner: &Pubkey, market: &Pubkey) -> Pubkey
pub fn get_position_pda(&self, owner: &Pubkey, market: &Pubkey) -> Pubkey
Get a Position PDA.
Sourcepub fn get_order_status_pda(&self, order_hash: &[u8; 32]) -> Pubkey
pub fn get_order_status_pda(&self, order_hash: &[u8; 32]) -> Pubkey
Get an Order Status PDA.
Sourcepub fn get_user_nonce_pda(&self, user: &Pubkey) -> Pubkey
pub fn get_user_nonce_pda(&self, user: &Pubkey) -> Pubkey
Get a User Nonce PDA.
Auto Trait Implementations§
impl Freeze for LightconePinocchioClient
impl !RefUnwindSafe for LightconePinocchioClient
impl Send for LightconePinocchioClient
impl Sync for LightconePinocchioClient
impl Unpin for LightconePinocchioClient
impl !UnwindSafe for LightconePinocchioClient
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more