> ## 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, so install it alongside the adapter.

> [!NOTE]
>
> This adapter works with `@canton-network/dapp-sdk` 0.24.x. On 1.x, skip it and follow the [Remote Gateway](https://docs.walley.cc/typescript-sdk/remote-gateway.md) guide instead.

## Register the adapter

Create a `WalleyAdapter` and pass it to the dApp SDK's `init()`. Walley then shows up in the wallet picker.

```ts theme={null}
import * as sdk from "@canton-network/dapp-sdk";
import { WalleyAdapter } from "@k2flabs/walley-dapp-sdk";

const walley = new WalleyAdapter();
await sdk.init({ additionalAdapters: [walley] });
```

To point at a different Walley host, for example a local instance during development, pass a `host`:

```ts theme={null}
const walley = new WalleyAdapter({ host: "http://localhost:5173" });
```

`WalleyAdapter` accepts:

| Option | Type | Description |
| - | - | - |
| `host` | string | Wallet origin. Defaults to `https://walley.cc`. |
| `icon` | string | Icon shown in the wallet picker. |
| `allowedApiOrigins` | string\[] \| (url: URL) => boolean | Restricts which [ledger-proxy origins](https://docs.walley.cc/typescript-sdk/ledger-api.md#proxy-origin) may receive the session token. |
| `requestTimeoutMs` | number | Bound on a single popup request, including approval time. Defaults to 5 minutes. |

> [!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.

## 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 = walley.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 it expires or 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](https://docs.walley.cc/typescript-sdk/transactions.md) 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

> [card] [Provider API](https://docs.walley.cc/typescript-sdk/provider-api.md)
>
> The full list of methods and their request/result shapes.

> [card] [Transactions & Fees](https://docs.walley.cc/typescript-sdk/transactions.md)
>
> Command submission patterns and the prepaid fee model.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.