@arkade-os/sdk Documentation - v0.4.21
    Preparing search index...

    Interface IContractManager

    interface IContractManager {
        annotateVtxos(vtxos: VirtualCoin[]): Promise<ExtendedVirtualCoin[]>;
        createContract(params: CreateContractParams): Promise<Contract>;
        deleteContract(script: string): Promise<void>;
        dispose(): void;
        getAllSpendingPaths(
            options: GetAllSpendingPathsOptions,
        ): Promise<PathSelection[]>;
        getContracts(filter?: ContractFilter): Promise<Contract[]>;
        getContractsWithVtxos(
            filter?: ContractFilter,
        ): Promise<ContractWithVtxos[]>;
        getSpendablePaths(
            options: GetSpendablePathsOptions,
        ): Promise<PathSelection[]>;
        isWatching(): Promise<boolean>;
        onContractEvent(callback: ContractEventCallback): () => void;
        refreshVtxos(opts?: RefreshVtxosOptions): Promise<void>;
        setContractState(script: string, state: ContractState): Promise<void>;
        updateContract(
            script: string,
            updates: Partial<Omit<Contract, "script" | "createdAt">>,
        ): Promise<Contract>;
    }

    Hierarchy

    • Disposable
      • IContractManager

    Implemented by

    Index

    Methods

    • Stamp raw virtual outputs with the correct per-contract tapscripts (forfeit, intent, tap tree).

      Resolves each vtxo's script to its owning contract via the contract repository and attaches the matching tapscripts. Throws when any vtxo references a script with no registered contract — callers are expected to register the contract before asking for annotation. This is the single shared path that replaces scattered extendVirtualCoin* calls in wallet/handler code, and keeps the wallet from silently stamping the default tapscript onto a non-default vtxo.

      Parameters

      Returns Promise<ExtendedVirtualCoin[]>

    • Delete a contract by script and stop watching it (if applicable).

      Parameters

      • script: string

      Returns Promise<void>

    • Get all possible spending paths for a contract.

      Returns an empty array if the contract or its handler cannot be found.

      Parameters

      • options: GetAllSpendingPathsOptions

      Returns Promise<PathSelection[]>

    • List contracts with optional filters.

      Parameters

      • Optionalfilter: ContractFilter

      Returns Promise<Contract[]>

      const vhtlcs = await manager.getContracts({ type: "vhtlc" });
      const active = await manager.getContracts({ state: "active" });
    • Get all currently spendable paths for a contract.

      Returns an empty array if the contract or its handler cannot be found.

      Parameters

      • options: GetSpendablePathsOptions

      Returns Promise<PathSelection[]>

    • Force a virtual output refresh from the indexer.

      Without options, refreshes all contracts from scratch. With options, narrows the refresh to specific scripts and/or a time window.

      Parameters

      • Optionalopts: RefreshVtxosOptions

      Returns Promise<void>

    • Update mutable contract fields.

      script and createdAt are immutable.

      Parameters

      • script: string
      • updates: Partial<Omit<Contract, "script" | "createdAt">>

      Returns Promise<Contract>