Crates.io | spark-registry-sdk |
lib.rs | spark-registry-sdk |
version | 0.6.4 |
source | src |
created_at | 2024-09-05 13:31:33.910832 |
updated_at | 2024-11-05 13:59:43.553994 |
description | SDK for interacting with the Spark Registry |
homepage | |
repository | https://github.com/compolabs/orderbook-contract |
max_upload_size | |
id | 1364611 |
size | 76,734 |
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.
pub struct SparkRegistryContract {
instance: MarketRegistry<WalletUnlocked>,
}
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.
pub async fn register_market(&self, market: ContractId) -> anyhow::Result<CallResponse<()>>
Registers a new market by owner.
self
The SparkRegistryContract instance.
market
The market contract id.
Returns a call result
pub async fn unregister_market(&self, market: ContractId) -> anyhow::Result<CallResponse<()>>
Unregisters a market by owner.
self
The SparkRegistryContract instance.
market
The market contract id.
Returns a call result
pub async fn transfer_ownership(
&self,
new_owner: Identity,
) -> anyhow::Result<CallResponse<()>>
Transfers ownership of regsitry.
self
The SparkRegistryContract instance.
new_owner
The new owner identity.
Returns a call result
pub async fn markets(
&self,
assets: Vec<(AssetId, AssetId)>,
) -> anyhow::Result<CallResponse<Vec<(AssetId, AssetId, Option<ContractId>)
Retrieves user account inforamtion.
self
The SparkRegistryContract instance.
assets
The asset pair array [(base_asst_id, quote_asset_id)].
Returns an asset pair and optional market contract id array
pub async fn owner(&self) -> anyhow::Result<CallResponse<State>>
Retrieves contract owner.
self
The SparkRegistryContract instance.
Returns a State of contract owner
pub fn config(&self) -> (Option<Identity>, u32);
Retrieves contract configurables.
self
The SparkRegistryContract instance.
Returns an Option of owner identity and contract version