#spark #registry #orderbook #fuel #sdk

spark-registry-sdk

SDK for interacting with the Spark Registry

3 unstable releases

new 0.4.0 Sep 13, 2024
0.3.1 Sep 5, 2024
0.3.0 Sep 5, 2024

#1073 in Development tools

Download history 244/week @ 2024-09-01 131/week @ 2024-09-08

375 downloads per month
Used in spark-cli

Apache-2.0

13KB
134 lines

Spark MarketRegistry Contract Rust SDK

The Spark MarketRegistry Contract SDK is designed for interacting with the Spark MarketRegistry contract. There are a set of transactional methods such as deploy, register/unregister owner methods and markets getter method. Given below a detailed explanation of every contract method.

SparkRegistryContract Type

pub struct SparkRegistryContract {
    instance: MarketRegistry<WalletUnlocked>,
}

Transactional SparkMarketContract Owner Methods

Contract Deployment

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

Deploys a new market registry contract with given owner.

owner The owner of the market registry contract that manages market list.

Returns a new instance of SparkRegistryContract type.

Register new Market

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

Registers a new market by owner.

self The SparkMarketContract instance. market The market contract id.

Returns a call result

Unregister Market

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

Unregisters a market by owner.

self The SparkMarketContract instance. market The market contract id.

Returns a call result

SparkRegistryContract Getter Methods

Markets Info

pub async fn markets(
        &self,
        assets: Vec<(AssetId, AssetId)>,
    ) -> anyhow::Result<CallResponse<Vec<(AssetId, AssetId, Option<ContractId>)

Retrieves user account inforamtion.

self The SparkMarketContract instance. assets The asset pair array [(base_asst_id, quote_asset_id)].

Returns an asset pair and optional market contract id array

Dependencies

~71–110MB
~2M SLoC