Package-level declarations

Types

Link copied to clipboard
fun interface DappAccountsSource

The accounts a wallet could offer a dApp.

Link copied to clipboard
data class DappActivity(val peerId: String, val peerName: String, val at: Instant, val kind: DappActivity.Kind, val transfer: DappTransferSummary? = null, val detail: String? = null)

One thing a dApp did or tried to do, as the wallet's owner should see it.

Link copied to clipboard
fun interface DappActivityObserver

Receives every DappActivity a session produces, synchronously on the session's path. Implementations must be quick and must not throw; the session swallows observer exceptions, because a broken log must never break a payment. Hosts persist and render; a local notification for the kinds that never reach the approver (auto-approved, refused, rate-limited) is what keeps the policy honest.

Link copied to clipboard
sealed interface DappApproval

The user's answer. Anything other than Approved becomes a 4001.

Link copied to clipboard
fun interface DappApprovalDelegate

The wallet UI, from the engine's point of view.

Link copied to clipboard
sealed interface DappApprovalRequest

What the user is being asked to approve.

Link copied to clipboard

Recognises the Canton Token Standard transfer inside a dApp submission so an approver can show what moves where instead of an opaque "a transaction".

Link copied to clipboard
fun interface DappMessageSigner

Signs an arbitrary message on behalf of an approved account.

Link copied to clipboard
data class DappNetworkConfig(val networkId: String, val jsonApiBaseUrl: String? = null, val synchronizerId: String? = null, val accessTokenProvider: suspend () -> String? = null)

The network a session operates on, and how to reach its JSON Ledger API.

Link copied to clipboard
data class DappPeer(val id: String, val name: String, val url: String? = null, val iconUrl: String? = null, val verified: Boolean = false)

Who is asking. Built by the transport from what it can actually attest — a WalletConnect session's peer metadata, a LAN pairing's certificate, the host app itself for the in-process case.

Link copied to clipboard
class DappSession(peer: DappPeer, accounts: DappAccountsSource, approver: DappApprovalDelegate, network: DappNetworkConfig, provider: DappProvider = DEFAULT_PROVIDER, messageSigner: DappMessageSigner? = null, prepareExecute: PrepareExecutePipeline? = null, ledgerApi: LedgerApiProxy? = null, ledgerApiPolicy: LedgerApiPolicy = LedgerApiPolicy.ReadOnly, signMessageMinInterval: Duration = 1.seconds, timeSource: TimeSource = TimeSource.Monotonic, spendPolicy: () -> DappSpendPolicy? = { null }, spendLedger: SpendLedger = InMemorySpendLedger(), wallClock: () -> Instant = java.time.Instant::now, activityObserver: DappActivityObserver? = null) : DappRequestHandler

One dApp's session with the wallet: the CIP-0103 provider side.

Link copied to clipboard
data class DappSpendPolicy(val maxPerTransaction: BigDecimal? = null, val dailyCap: BigDecimal? = null, val allowedInstruments: Set<String>? = null, val allowedReceivers: Set<String>? = null, val minRequestInterval: Duration = Duration.ZERO, val autoApproveBelow: BigDecimal? = null)

Per-peer limits a wallet enforces on a dApp's transactions, checked before anything reaches the approver.

Link copied to clipboard
data class DappTransferSummary(val receiver: String, val amount: String, val instrumentId: String, val admin: String? = null, val memo: String? = null, val executeBefore: String? = null)

A dApp-authored transaction, summarised for the approver.

Link copied to clipboard
Link copied to clipboard

A process-lifetime SpendLedger, the default when a host wires a policy without persistence. Fine for tests and demos; a real wallet must persist, or every restart resets the daily cap.

Link copied to clipboard

Binds a DappClient straight to a DappSession in the same process.

Link copied to clipboard
class JsonLedgerApiClient(baseUrl: String, accessTokenProvider: suspend () -> String? = null, httpClient: OkHttpClient = OkHttpClient())

A minimal client for Canton's JSON Ledger API, used by the dApp provider for the two things that must go over JSON rather than gRPC: interactive-submission/prepare (see JsonPrepareExecutePipeline) and the ledgerApi proxy method.

Link copied to clipboard
class JsonPrepareExecutePipeline(ledgerApi: JsonLedgerApiClient, submission: InteractiveSubmissionClient, signer: SigningDriver, keyFingerprint: (DappWallet) -> String = { it.namespace }, userId: String? = null) : PrepareExecutePipeline

The prepareExecute pipeline: JSON prepare → verify → sign → gRPC execute.

Link copied to clipboard
fun interface LedgerApiPolicy

Which ledgerApi resources a dApp may reach through the wallet.

Link copied to clipboard
fun interface LedgerApiProxy

Performs an authenticated call against the JSON Ledger API.

Link copied to clipboard
data class PrepareExecuteContext(val commandId: String, val actAs: DappWallet, val submission: PrepareSubmission, val network: DappNetworkConfig, val emitEvent: suspend (TxChangedEvent) -> Unit = {})

Everything the prepare→verify→sign→execute pipeline needs for one submission.

Link copied to clipboard

Prepares, verifies, signs and executes one submission.

Link copied to clipboard
Link copied to clipboard
sealed interface SpendDecision

The policy's verdict on one transaction request.

Link copied to clipboard
interface SpendLedger

Where a wallet persists SpendReceipts.

Link copied to clipboard
data class SpendReceipt(val peerId: String, val at: Instant, val instrumentId: String, val amount: BigDecimal, val receiver: String, val autoApproved: Boolean, val commandId: String)

One approved, executed spend by one peer. The ledger's receipts are the source of truth for the rolling daily cap and for the app's receipts UI, which is why they are written only after execution succeeds.