pub struct OnchainClient { /* private fields */ }Expand description
On-chain client for Predict.fun operations
Implementations§
Source§impl OnchainClient
impl OnchainClient
Sourcepub fn new(chain_id: ChainId, signer: PrivateKeySigner) -> Self
pub fn new(chain_id: ChainId, signer: PrivateKeySigner) -> Self
Create a new OnchainClient for direct EOA operations
Sourcepub fn with_predict_account(
chain_id: ChainId,
signer: PrivateKeySigner,
predict_account: &str,
) -> Result<Self>
pub fn with_predict_account( chain_id: ChainId, signer: PrivateKeySigner, predict_account: &str, ) -> Result<Self>
Create a new OnchainClient for Predict Account (smart wallet) operations
Sourcepub fn signer_address(&self) -> Address
pub fn signer_address(&self) -> Address
Get the signer address
Sourcepub fn trading_address(&self) -> Address
pub fn trading_address(&self) -> Address
Get the trading address (predict_account if set, otherwise signer)
Sourcepub fn is_smart_wallet(&self) -> bool
pub fn is_smart_wallet(&self) -> bool
Check if using smart wallet
Sourcepub async fn set_approvals(
&self,
is_neg_risk: bool,
is_yield_bearing: bool,
) -> Result<()>
pub async fn set_approvals( &self, is_neg_risk: bool, is_yield_bearing: bool, ) -> Result<()>
Set all necessary approvals for trading on the CTF Exchange.
This sets:
- ERC-1155
setApprovalForAllon Conditional Tokens → CTF Exchange (allows exchange to move outcome tokens on behalf of the trader) - ERC-20
approveon USDT → CTF Exchange (allows exchange to take USDT collateral)
For neg-risk markets, also approves the Neg Risk Adapter.
Sourcepub async fn split_positions(&self, options: SplitOptions) -> Result<String>
pub async fn split_positions(&self, options: SplitOptions) -> Result<String>
Auto Trait Implementations§
impl Freeze for OnchainClient
impl RefUnwindSafe for OnchainClient
impl Send for OnchainClient
impl Sync for OnchainClient
impl Unpin for OnchainClient
impl UnwindSafe for OnchainClient
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
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>
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 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>
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