spark-proxy-sdk

Crates.iospark-proxy-sdk
lib.rsspark-proxy-sdk
version0.0.2
sourcesrc
created_at2024-11-06 10:11:02.419513
updated_at2024-11-06 10:11:02.419513
descriptionSDK for interacting with the Spark Proxy
homepage
repositoryhttps://github.com/compolabs/orderbook-contract
max_upload_size
id1438067
size27,416
Alexey Nagorny (chlenc)

documentation

README

Spark PROXY Contract Rust SDK

The Spark Proxy Contract SDK designed for Spark Market contract communication.

SparkProxyContract Type

The sdk object as contract instance wrapper.

pub struct SparkProxyContract {
    instance: SparkProxy<WalletUnlocked>,
}

Transactional SparkProxyContract Common Methods

Proxy Deploy

pub async fn deploy(target: ContractId, owner: WalletUnlocked) -> anyhow::Result<Self>

Deploys proxy with market target.

target The SparkMarketContract instance owner The Wallet object

Returns a SparkProxyContract instance

Set Proxy Target

pub async fn set_proxy_target(
        &self,
        new_target: ContractId,
    ) -> anyhow::Result<CallResponse<()>>

Sets a new target(implementation) for proxy. Only proxy owner can call.

self The SparkProxyContract instance new_target The SparkMarketContract instance

Returns a call result

Get Proxy Target

async fn proxy_target(&self) -> anyhow::Result<CallResponse<Option<ContractId>>>

Withdraws assets from market caller account.

self The SparkProxyContract instance

Returns an optional market contract id

Set Proxy Owner

pub async fn set_proxy_owner(
        &self,
        new_proxy_owner: State,
    ) -> anyhow::Result<CallResponse<()>>

Sets a new proxy owner. Ony proxy owner can call.

self The SparkProxyContract instance new_proxy_owner A new proxy owner

Returns a call result

Get Proxy Owner

pub async fn proxy_owner(&self) -> anyhow::Result<CallResponse<State>>

Retrieves a proxy owner.

self The SparkProxyContract instance

Returns a proxy owner

Commit count: 417

cargo fmt