Skip to main content
@thru/chain-interfaces is the shared type contract used by Thru wallet-adjacent SDKs. It defines the common shapes for connection state, wallet accounts, app metadata, and signing results without tying you to a concrete provider.

Install

npm install @thru/chain-interfaces
The package exposes a single root entrypoint:
import type {
  IThruChain,
  WalletAccount,
  ConnectResult,
  ConnectedApp,
  AppMetadata,
  SignMessageParams,
  SignMessageResult,
  AddressType,
} from '@thru/chain-interfaces';

Use it when

Use @thru/chain-interfaces when you are building a custom wallet adapter, an embedded provider, or another SDK that needs to agree on Thru account and signing types. It is also the package to import from when you want to share these types across multiple web packages without depending on a browser-specific implementation. Use @thru/helpers if you only need address and signature encoding utilities, and use @thru/browser-sdk or @thru/embedded-provider when you need a concrete runtime implementation instead of shared types.

Core types

TypeWhat it represents
IThruChainThe minimal wallet chain interface used by SDK consumers.
WalletAccountA connected wallet account with address, label, and account type.
ConnectResultThe result shape returned by connect flows.
ConnectedAppMetadata about an app connected to a wallet account.
AppMetadataShared app identity metadata used during connection.
SignMessageParams / SignMessageResultMessage signing request and response shapes.
AddressTypeThe address type enum used across connection flows.

IThruChain

The minimal chain interface exposed to SDK consumers. It provides:
  • connected: whether the wallet has approved a Thru connection
  • connect(): starts the connection flow and resolves with the connected public key
  • disconnect(): disconnects the current account
  • signTransaction(serializedTransaction): signs a base64-encoded transaction payload and returns the signed payload

WalletAccount

Represents a wallet account exposed through Thru connection flows. It includes:
  • accountType
  • address
  • label

ConnectResult

Returned by connect flows. It includes:
  • accounts
  • walletId?
  • status?
  • metadata?

ConnectedApp

Represents an app connected to a wallet account. It includes:
  • accountId
  • appId
  • origin
  • metadata
  • connectedAt
  • updatedAt

AppMetadata

Shared app identity metadata used during connect flows:
  • appId
  • appName
  • appUrl
  • imageUrl?

Signing types

  • SignMessageParams carries a message and networkId
  • SignMessageResult returns a signature and publicKey

AddressType

The current address type enum includes THRU.

Example

import type { IThruChain, WalletAccount } from '@thru/chain-interfaces';

function describeAccount( account: WalletAccount ) {
  return account.address;
}

function attachChain( chain: IThruChain ) {
  if( chain.connected ) {
    return chain.disconnect();
  }
}