Skip to main content
getTransactionHistory() returns the wallet’s onchain and offchain transactions, newest first:
Each transaction record has the following shape:

Transaction Types

type gives the direction of a transaction: SENT or RECEIVED. tag gives the kind of movement: gated tells your own escrow apart from a payment to someone else. The history treats the contract as another party. Funding a swap shows as SENT with the tag gated, and a payout from the contract shows as RECEIVED with the tag gated. While the funds stay in the contract, getBalance() counts them in contractLocked.

Filtering Transactions

The history is an array, so filter it directly. The TxType enum names the SENT and RECEIVED values:

Grouping Transactions into Activities

One user action can span several transactions. getActivityHistory() groups the transactions into activities, such as a deposit, a collaborative exit, or an asset mint. It groups transactions that no resolver claims by transaction ID, so a send and its change stay together.
Activities come newest first. Each one has:
  • amount: the net amount in satoshis, without change
  • intent: the label, kind, outcome, and metadata of the group, only when a resolver labeled it
  • txs: the transactions in the activity, oldest first
  • createdAt: the time of the first transaction, in milliseconds since the epoch
  • settled: true once every transaction in the activity is settled

Labeling Your App’s Transactions

Resolvers on wallet.activity decide the groups. The SDK registers three: boarding, collab-exit, and asset-mint. To add your own labels, add a resolver with wallet.activity.use(). Give it a namespaced id, because use() replaces any resolver with the same id. This resolver labels every gated transaction as escrow:
resolve runs once for each transaction and must be synchronous. It returns the groups of the transaction, or undefined to leave the transaction unlabeled. Transactions with the same groupId form one activity.