Skip to main content

LightconePinocchioClient

Struct LightconePinocchioClient 

Source
pub struct LightconePinocchioClient {
    pub rpc_client: RpcClient,
    pub program_id: Pubkey,
}
Expand description

Client for interacting with the Lightcone Pinocchio program.

Fields§

§rpc_client: RpcClient

RPC client for Solana

§program_id: Pubkey

Program ID

Implementations§

Source§

impl LightconePinocchioClient

Source

pub fn new(rpc_url: &str) -> Self

Create a new client with default program ID.

Source

pub fn with_program_id(rpc_url: &str, program_id: Pubkey) -> Self

Create a new client with custom program ID.

Source

pub fn from_rpc_client(rpc_client: RpcClient) -> Self

Create a new client with existing RpcClient.

Source

pub fn pda(&self) -> &Pda

Get PDA derivation helpers.

Source

pub async fn get_exchange(&self) -> SdkResult<Exchange>

Fetch the Exchange account.

Source

pub async fn get_market(&self, market_id: u64) -> SdkResult<Market>

Fetch a Market account by ID.

Source

pub async fn get_market_by_pubkey(&self, market: &Pubkey) -> SdkResult<Market>

Fetch a Market account by pubkey.

Source

pub async fn get_position( &self, owner: &Pubkey, market: &Pubkey, ) -> SdkResult<Option<Position>>

Fetch a Position account (returns None if not found).

Source

pub async fn get_order_status( &self, order_hash: &[u8; 32], ) -> SdkResult<Option<OrderStatus>>

Fetch an OrderStatus account (returns None if not found).

Source

pub async fn get_user_nonce(&self, user: &Pubkey) -> SdkResult<u64>

Fetch a user’s current nonce (returns 0 if not initialized).

Source

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.

Source

pub async fn get_next_market_id(&self) -> SdkResult<u64>

Get the next available market ID.

Source

pub async fn get_latest_blockhash(&self) -> SdkResult<Hash>

Get the latest blockhash for transaction building.

Source

pub async fn initialize(&self, authority: &Pubkey) -> SdkResult<Transaction>

Build Initialize transaction.

Source

pub async fn create_market( &self, params: CreateMarketParams, ) -> SdkResult<Transaction>

Build CreateMarket transaction.

Source

pub async fn add_deposit_mint( &self, params: AddDepositMintParams, market: &Pubkey, num_outcomes: u8, ) -> SdkResult<Transaction>

Build AddDepositMint transaction.

Source

pub async fn mint_complete_set( &self, params: MintCompleteSetParams, num_outcomes: u8, ) -> SdkResult<Transaction>

Build MintCompleteSet transaction.

Source

pub async fn merge_complete_set( &self, params: MergeCompleteSetParams, num_outcomes: u8, ) -> SdkResult<Transaction>

Build MergeCompleteSet transaction.

Source

pub async fn cancel_order( &self, maker: &Pubkey, order: &FullOrder, ) -> SdkResult<Transaction>

Build CancelOrder transaction.

Source

pub async fn increment_nonce(&self, user: &Pubkey) -> SdkResult<Transaction>

Build IncrementNonce transaction.

Source

pub async fn settle_market( &self, params: SettleMarketParams, ) -> SdkResult<Transaction>

Build SettleMarket transaction.

Source

pub async fn redeem_winnings( &self, params: RedeemWinningsParams, winning_outcome: u8, ) -> SdkResult<Transaction>

Build RedeemWinnings transaction.

Source

pub async fn set_paused( &self, authority: &Pubkey, paused: bool, ) -> SdkResult<Transaction>

Build SetPaused transaction.

Source

pub async fn set_operator( &self, authority: &Pubkey, new_operator: &Pubkey, ) -> SdkResult<Transaction>

Build SetOperator transaction.

Source

pub async fn withdraw_from_position( &self, params: WithdrawFromPositionParams, is_token_2022: bool, ) -> SdkResult<Transaction>

Build WithdrawFromPosition transaction.

Source

pub async fn activate_market( &self, params: ActivateMarketParams, ) -> SdkResult<Transaction>

Build ActivateMarket transaction.

Source

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.

Source

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).

Source

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.

Source

pub fn create_bid_order(&self, params: BidOrderParams) -> FullOrder

Create an unsigned bid order.

Source

pub fn create_ask_order(&self, params: AskOrderParams) -> FullOrder

Create an unsigned ask order.

Source

pub fn create_signed_bid_order( &self, params: BidOrderParams, keypair: &Keypair, ) -> FullOrder

Create and sign a bid order.

Source

pub fn create_signed_ask_order( &self, params: AskOrderParams, keypair: &Keypair, ) -> FullOrder

Create and sign an ask order.

Source

pub fn hash_order(&self, order: &FullOrder) -> [u8; 32]

Compute the hash of an order.

Source

pub fn sign_order(&self, order: &mut FullOrder, keypair: &Keypair)

Sign an order with the given keypair.

Source

pub fn derive_condition_id( &self, oracle: &Pubkey, question_id: &[u8; 32], num_outcomes: u8, ) -> [u8; 32]

Derive the condition ID for a market.

Source

pub fn get_conditional_mints( &self, market: &Pubkey, deposit_mint: &Pubkey, num_outcomes: u8, ) -> Vec<Pubkey>

Get all conditional mint pubkeys for a market.

Source

pub fn get_exchange_pda(&self) -> Pubkey

Get the Exchange PDA.

Source

pub fn get_market_pda(&self, market_id: u64) -> Pubkey

Get a Market PDA.

Source

pub fn get_position_pda(&self, owner: &Pubkey, market: &Pubkey) -> Pubkey

Get a Position PDA.

Source

pub fn get_order_status_pda(&self, order_hash: &[u8; 32]) -> Pubkey

Get an Order Status PDA.

Source

pub fn get_user_nonce_pda(&self, user: &Pubkey) -> Pubkey

Get a User Nonce PDA.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more