> ## Documentation Index
> Fetch the complete documentation index at: https://docs.walley.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# Walley dApp SDK Quickstart: Connect a Wallet in Minutes

> Install @k2flabs/walley-dapp-sdk, register the Walley adapter with the Canton dApp SDK, connect a user's wallet, and submit your first transaction.

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

```sh theme={null}
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.

```ts theme={null}
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`:

```ts theme={null}
registry.register(new WalleyAdapter({ host: "http://localhost:5173" }));
```

<Note>
  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.
</Note>

## 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.

```ts theme={null}
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:

```ts theme={null}
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:

```ts theme={null}
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](/build/transactions) for the difference between `prepareExecute` and `prepareExecuteAndWait`, and how network fees are handled.

## Disconnect

When the user signs out, clear the session:

```ts theme={null}
await provider.request({ method: "disconnect" });
```

## Next steps

<CardGroup cols={2}>
  <Card title="Provider API" icon="code" href="/build/provider-api">
    The full list of methods and their request/result shapes.
  </Card>

  <Card title="Transactions & Fees" icon="arrow-right-arrow-left" href="/build/transactions">
    Command submission patterns and the deferred fee model.
  </Card>
</CardGroup>
