CantonWalletConnect

class CantonWalletConnect(handler: DappRequestHandler, networkId: String)

The wallet side of the WalletConnect transport for CIP-0103.

WalletConnect is not a new capability — it is a transport for the same CIP-0103 JSON-RPC the wallet already answers over the in-process and LAN transports. So this is the io.github.vsima.canton.dapp.lan.LanGrpcDappServer of WalletConnect: it wraps a DappRequestHandler (a DappSession satisfies it) and turns a session's traffic into handle calls.

It depends on no WalletConnect client library. A wallet's job here has exactly two touch-points, and both are pure:

  • sessionNamespaces — at proposal time, the CAIP-2 chain, CAIP-10 accounts, and CIP-0103 methods to approve a session with.

  • handle — at request time, route one session_request into the engine and map its reply back.

A Reown WalletKit delegate in the app (or an Android add-on module) does the relay I/O: on onSessionProposal it approves with sessionNamespaces; on onSessionRequest it calls handle and responds with the result. Keeping the client out means this adapter is plain JVM and is unit-tested against a real DappSession, with no relay.

The approval, signing and prepare→sign→execute all happen inside the engine; this class adds no policy. Over a WalletConnect session the Canton ecosystem (the official @canton-network/dapp-sdk, PartyLayer) names CIP-0103 methods with a canton_ prefix — the convention EVM uses with eth_ — so this advertises the canton_ wire names and normalizes each inbound method back to the bare CIP-0103 name the engine answers. Bare names are still accepted, so a peer that speaks CIP-0103 verbatim (the reference dApp server) keeps working. See WcMethod.

Constructors

Link copied to clipboard
constructor(handler: DappRequestHandler, networkId: String)

Types

Link copied to clipboard
object Companion

Namespace building without an adapter instance, for proposal time.

Properties

Link copied to clipboard

The CAIP-2 chain this session advertises (validated from networkId).

Link copied to clipboard

The events a canton_ dApp subscribes to. Advertised for interop; proactive emission is a follow-up.

Link copied to clipboard

The canton_ request methods advertised over a session.

Functions

Link copied to clipboard
suspend fun handle(request: WcRequest): WcResponse

Routes one inbound session_request into the engine and maps the reply.

Link copied to clipboard

The namespaces to approve a session with, sharing accounts. Which accounts to share is the wallet's decision (its connect-approval UI); this only projects them into CAIP-10 form under the canton namespace.