@arkade-os/sdk Documentation - v0.4.0-next.8
    Preparing search index...

    Interface Contract

    Represents a contract that can receive and manage VTXOs.

    A contract is defined by its type and parameters, which together determine the VtxoScript (spending paths). The wallet's default receiving address is itself a contract of type "default".

    External services (Boltz swaps, atomic swaps, etc.) create additional contracts with their own types and parameters.

    const vhtlcContract: Contract = {
    type: "vhtlc",
    params: {
    sender: "ab12...",
    receiver: "cd34...",
    server: "ef56...",
    hash: "1234...",
    refundLocktime: "800000",
    // ... timelocks
    },
    script: "5120...",
    address: "tark1...",
    state: "active",
    createdAt: 1704067200000,
    };
    interface Contract {
        address: string;
        createdAt: number;
        expiresAt?: number;
        label?: string;
        metadata?: Record<string, unknown>;
        params: Record<string, string>;
        script: string;
        state: ContractState;
        type: string;
    }
    Index

    Properties

    address: string

    The address derived from the script

    createdAt: number

    Unix timestamp (ms) when this contract was created

    expiresAt?: number

    Unix timestamp (ms) when this contract expires (optional)

    label?: string

    Human-readable label for display purposes

    metadata?: Record<string, unknown>

    Optional metadata for external integrations.

    params: Record<string, string>

    Type-specific parameters for constructing the VtxoScript. All values are serialized as strings (hex for bytes, string for bigint). The ContractHandler for this type knows how to interpret these.

    script: string

    The pkScript hex - unique identifier and primary key for contracts

    Current state of the contract

    type: string

    Contract type identifier. Built-in types: "default", "vhtlc" Custom types can be registered via ContractHandler.