Skip to main content
This guide takes you from an empty project to a working Walley connection, then a signed transaction. It assumes a browser-based dApp using the official Canton dApp SDK.

Install

npm install @k2flabs/walley-dapp-sdk @canton-network/dapp-sdk
@canton-network/dapp-sdk is a peer dependency — install it alongside the adapter.

Register the adapter

Create a WalleyAdapter and register it with the dApp SDK’s DiscoveryRegistry. This makes Walley discoverable as a wallet provider.
import { WalleyAdapter } from "@k2flabs/walley-dapp-sdk";
import { DiscoveryRegistry } from "@canton-network/dapp-sdk";

const registry = new DiscoveryRegistry();
registry.register(new WalleyAdapter());
To point at a non-default Walley host — for example a local instance during development — pass a host:
registry.register(new WalleyAdapter({ host: "http://localhost:5173" }));
The adapter defaults to https://walley.cc. It reports itself as inactive during server-side rendering and in Node, so it is safe to construct in universal/SSR codebases — it only becomes usable in a real browser environment.

Connect a wallet

Get the provider from the adapter and call connect. This opens a Walley popup where the user approves the connection. Always trigger it from a user gesture so the popup is not blocked.
const provider = new WalleyAdapter().provider();

async function onConnectClick() {
  const result = await provider.request({ method: "connect" });
  // { isConnected: true, isNetworkConnected: true }
}
The session is persisted to localStorage and restored automatically on the next page load, so users stay connected across reloads until you call disconnect.

Read the connected account

Once connected, read the user’s wallet and network without opening a popup:
const wallet = await provider.request({ method: "getPrimaryAccount" });
// {
//   primary: true,
//   partyId: "walley-alice::1220ab...",
//   status: "allocated",
//   hint: "walley-alice",
//   publicKey: "<base64>",
//   namespace: "<fingerprint>",
//   networkId: "...",
//   signingProviderId: "walley"
// }

const network = await provider.request({ method: "getActiveNetwork" });
// { networkId: "..." }

Submit a transaction

Use prepareExecuteAndWait to have the user review and sign a set of Daml commands, then wait for the transaction to commit:
const result = await provider.request({
  method: "prepareExecuteAndWait",
  params: {
    commands: [
      { type: "create", templateId: "<package>:<module>:<entity>", argument: { /* ... */ } },
    ],
  },
});
Walley opens a popup showing the commands, the user signs, and the wallet submits them to the ledger. See Transactions & Fees for the difference between prepareExecute and prepareExecuteAndWait, and how network fees are handled.

Disconnect

When the user signs out, clear the session:
await provider.request({ method: "disconnect" });

Next steps

Provider API

The full list of methods and their request/result shapes.

Transactions & Fees

Command submission patterns and the deferred fee model.