DappRequestHandler

The wallet-side counterpart of DappTransport: something that answers JSON-RPC frames and emits events.

This is what a server transport routes inbound frames into. It lives here, in canton-dapp, rather than in the wallet module on purpose: a transport that carries both roles (LAN gRPC, later WalletConnect) depends only on canton-dapp, so it must be able to name the provider without reaching into canton-dapp-wallet. The provider engine there satisfies this structurally.

The mirror of DappTransport — send answers a request, this is the thing being sent to.

Properties

Link copied to clipboard
abstract val events: Flow<DappEvent>

Events to forward to the connected dApp as JSON-RPC notifications.

Functions

Link copied to clipboard
abstract suspend fun handle(request: JsonRpcRequest): JsonRpcResponse

Handle one request and return its response. Must not throw for protocol-level failures — return a JSON-RPC error response instead.

open suspend fun handle(request: JsonRpcRequest, context: DappRequestContext): JsonRpcResponse

handle with what the transport knew about the request. A transport that carries a deadline calls this; the default ignores the context, so a handler with no use for it implements only the other.