getTransactionHistory() returns the wallet’s onchain and offchain transactions, newest first:
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. TheTxType 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.
amount: the net amount in satoshis, without changeintent: thelabel,kind,outcome, andmetadataof the group, only when a resolver labeled ittxs: the transactions in the activity, oldest firstcreatedAt: the time of the first transaction, in milliseconds since the epochsettled:trueonce every transaction in the activity is settled
Labeling Your App’s Transactions
Resolvers onwallet.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.