Skip to main content

create_store

Function create_store 

Source
pub fn create_store(
    parent_coin: Coin,
    owner: StoreOwner,
    owner_puzzle_hash: Bytes32,
    params: CreateStoreParams,
) -> DigStoreResult<MerkleCoinSpend>
Expand description

Launches a new store coin from a funding parent, anchoring the first root (SPEC §3.1).

parent_coin funds + parents the launcher, so launcher_id == store_id derives from its coin_id. owner authorizes the parent spend; owner_puzzle_hash is the store owner recorded in the singleton (and the target of the owner-discovery hint + any change). params carries the first root, the required size bucket, and optional metadata. The store is minted with the file launcher discriminator (StoreKind::File), byte-identical to existing on-chain DIG stores.

Returns the UNSIGNED launch spend.

§This builder mints from an ORDINARY funding coin, never a DID

A DID is a singleton, so it cannot parent the odd-amount launcher directly — it must interpose an even-amount intermediate coin, and the resulting launcher is built by the CALLER and handed to dig_merkle::mint_datastore_launch_with_kind (which also returns the parent conditions the DID spend must emit). create_store composes the simple funding-coin path only, so it cannot mint a DID-rooted store; a caller needing one drives that dig-merkle API directly until dig-store exposes a builder for it. crate::get_store_did_owner still READS the owning DID of any store minted that way.

§Errors

Returns a DigStoreResult error if the spend cannot be constructed (invalid metadata / size / fee overflow).