CCC Docs
    Preparing search index...

    Interface representing a provider for interacting with accounts and signing messages.

    interface Provider {
        requestAccounts(): Promise<string[]>;
        getNetwork(): Promise<"livenet" | "testnet">;
        switchNetwork(chain: "livenet" | "testnet"): Promise<void>;
        getChain(): Promise<{ enum: string; name: string; network: string }>;
        switchChain(
            chain: string,
        ): Promise<{ enum: string; name: string; network: string }>;
        getAccounts(): Promise<string[]>;
        getPublicKey(): Promise<string>;
        signMessage(msg: string, type: "ecdsa" | "bip322-simple"): Promise<string>;
        on: UniSatA.OnMethod;
        removeListener(
            eventName: string,
            listener: (...args: unknown[]) => unknown,
        ): UniSatA.Provider;
    }
    Index

    Properties

    Adds an event listener to the provider.

    Methods

    • Requests user accounts.

      Returns Promise<string[]>

      A promise that resolves to an array of account addresses.

    • Gets the current network.

      Returns Promise<"livenet" | "testnet">

      current network.

    • Switch the current network.

      Parameters

      • chain: "livenet" | "testnet"

      Returns Promise<void>

    • Gets the current chain.

      Returns Promise<{ enum: string; name: string; network: string }>

      current chain.

    • Switch the current chain.

      Parameters

      • chain: string

      Returns Promise<{ enum: string; name: string; network: string }>

    • Gets the current accounts.

      Returns Promise<string[]>

      A promise that resolves to an array of account addresses.

    • Gets the public key of the account.

      Returns Promise<string>

      A promise that resolves to the public key.

    • Signs a message with the specified type.

      Parameters

      • msg: string

        The message to sign.

      • type: "ecdsa" | "bip322-simple"

        The type of signature.

      Returns Promise<string>

      A promise that resolves to the signed message.

    • Removes an event listener from the provider.

      Parameters

      • eventName: string

        The name of the event to remove the listener from.

      • listener: (...args: unknown[]) => unknown

        The listener function to remove.

      Returns UniSatA.Provider

      The provider instance.