Transport: {
    connect: (() => Promise<boolean>);
    disconnect: (() => Promise<void>);
    isConnected: (() => boolean);
    onNotification: ((callback: ((data: unknown) => void)) => (() => void));
    request: (<T, M>(params: {
        method: M;
        params?: MultichainApiParams<T, M>;
    }) => Promise<MultichainApiReturn<T, M>>);
}

Interface for transport layer that handles communication with the wallet

The transport layer is responsible for:

  • Establishing and maintaining a connection to the wallet
  • Sending requests to the wallet
  • Receiving responses from the wallet
  • Handling notifications from the wallet

Type declaration

  • connect: (() => Promise<boolean>)

    Establishes a connection to the wallet

      • (): Promise<boolean>
      • Returns Promise<boolean>

        A promise that resolves to true if the connection was successful, false otherwise

  • disconnect: (() => Promise<void>)

    Disconnects from the wallet

      • (): Promise<void>
      • Returns Promise<void>

        A promise that resolves when the disconnection is complete

  • isConnected: (() => boolean)

    Checks if the transport is currently connected to the wallet

      • (): boolean
      • Returns boolean

        True if connected, false otherwise

  • onNotification: ((callback: ((data: unknown) => void)) => (() => void))

    Registers a callback for notifications from the wallet

      • (callback): (() => void)
      • Parameters

        • callback: ((data: unknown) => void)

          Function to call when a notification is received

            • (data): void
            • Parameters

              • data: unknown

              Returns void

        Returns (() => void)

        A function to remove the callback

          • (): void
          • Returns void

  • request: (<T, M>(params: {
        method: M;
        params?: MultichainApiParams<T, M>;
    }) => Promise<MultichainApiReturn<T, M>>)

    Sends a request to the wallet