CCC Docs
    Preparing search index...

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

    interface Provider {
        signPsbt(psbtHex: string, options?: SignPsbtOptions): Promise<string>;
        signPsbt(psbtHex: string): Promise<string>;
        pushPsbt(psbtHex: string): Promise<string>;
        pushPsbt(psbtHex: string): Promise<string>;
        pushTx(tx: { rawtx: string }): Promise<string>;
        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

    • Signs a PSBT using UniSat wallet.

      Parameters

      • psbtHex: string

        The hex string of PSBT to sign

      • Optionaloptions: SignPsbtOptions

        Options for signing the PSBT

      Returns Promise<string>

      A promise that resolves to the signed PSBT hex string

    • Signs a PSBT using UniSat wallet.

      Parameters

      • psbtHex: string

        The hex string of PSBT to sign

      Returns Promise<string>

      A promise that resolves to the signed PSBT hex string

      Add support for Taproot signing options (useTweakedSigner, etc.)

    • Parameters

      • psbtHex: string

      Returns Promise<string>

    • Broadcasts a signed PSBT to the Bitcoin network.

      Parameters

      • psbtHex: string

        The hex string of signed PSBT to broadcast

      Returns Promise<string>

      A promise that resolves to the transaction ID

    • Parameters

      • tx: { rawtx: string }

      Returns Promise<string>

    • 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.