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

# Remote Gateway: Use Walley with the Canton dApp SDK

> Add Walley to a dApp built on the Canton dApp SDK 1.x using its built-in RemoteAdapter. Nothing extra to install.

If your dApp uses the Canton dApp SDK (`@canton-network/dapp-sdk`) 1.x, you can add Walley without installing anything else. Register Walley with the SDK's built-in `RemoteAdapter`, as described in Canton's [wallet discovery guide](https://docs.canton.network/sdks-tools/sdks/dapp-sdk/guides/wallet-discovery#add-a-custom-remote-wallet).

Users get the same Walley popups as with the [Walley adapter](https://docs.walley.cc/typescript-sdk/overview.md), and their keys never leave their browser.

## Gateway URLs

| Network | `rpcUrl` | Network ID |
| - | - | - |
| MainNet | `https://api.walley.cc/api/v0/dapp` | `canton:mainnet` |
| DevNet | `https://api.dev.walley.cc/api/v0/dapp` | `canton:devnet` |

## Add Walley to your wallet picker

```ts theme={null}
import { DappSDK, RemoteAdapter } from "@canton-network/dapp-sdk";

const sdk = new DappSDK();

await sdk.init({
  additionalAdapters: [
    new RemoteAdapter({
      name: "Walley",
      rpcUrl: "https://api.walley.cc/api/v0/dapp",
      icon: "https://walley.cc/icon.png",
    }),
  ],
});
```

This adds Walley next to the SDK's default wallets. To show Walley on its own, use `defaultAdapters` instead:

```ts theme={null}
await sdk.init({
  defaultAdapters: [
    new RemoteAdapter({
      name: "Walley",
      rpcUrl: "https://api.walley.cc/api/v0/dapp",
      icon: "https://walley.cc/icon.png",
    }),
  ],
});
```

| Option | What it does |
| - | - |
| `name` | The name shown in the wallet picker. |
| `rpcUrl` | The gateway URL for your network, from the table above. |
| `icon` | The icon shown in the wallet picker. Use `https://walley.cc/icon.png`. |
| `description` | Optional. A short line under the name. |
| `providerId` | Optional. Defaults to `remote:` plus the `rpcUrl`. |

## Connect and send a transaction

```ts theme={null}
await sdk.connect();
const [account] = await sdk.listAccounts();

const result = await sdk.prepareExecuteAndWait({
  commands: [
    {
      CreateCommand: {
        templateId: "<package-id>:<module>:<entity>",
        createArguments: { /* template fields */ },
      },
    },
  ],
});

await sdk.disconnect();
```

`connect`, `signMessage`, `prepareExecute` and `prepareExecuteAndWait` each open a Walley popup. Call them from a click or another user action, or the browser will block the popup.

Fees come out of the user's prepaid Walley balance, the same as everywhere else. Your dApp doesn't handle them. See [Transactions & Fees](https://docs.walley.cc/typescript-sdk/transactions.md#network-fees).

## Read ledger data

Use `ledgerApi` to read from the Canton JSON Ledger API as the connected user.

```ts theme={null}
const status = await sdk.status();

const rights = await sdk.ledgerApi({
  requestMethod: "get",
  resource: "/v2/users/{user-id}/rights",
  path: { "user-id": status.session?.userId ?? "" },
});
```

| Field | What it is |
| - | - |
| `requestMethod` | `"get"` or `"post"`. |
| `resource` | The Ledger API path. Must start with `/v2/`. |
| `path` | Values for any `{placeholders}` in `resource`. |
| `query` | Query string parameters. |
| `body` | The request body, as an object. |

You get the response back as parsed JSON.

## Sessions

Sessions last one hour. After that, the user has to connect again. Calling `disconnect` ends the session right away.

## How it differs from the Walley adapter

| | Walley adapter | Remote gateway |
| - | - | - |
| Canton dApp SDK version | 0.24.x | 1.x |
| What you install | `@k2flabs/walley-dapp-sdk` | Nothing |
| Sign a message while connecting | Yes, with `params: { signMessage }` | No, call `signMessage` after connecting |
| `ledgerApi` body | JSON string | Object |
| `ledgerApi` result | `{ response: string }` | Parsed JSON |
| `providerType` in `status` | `browser` | `remote` |
| Where the session is stored | The user's browser | Walley's servers |
| `allowedApiOrigins`, `requestTimeoutMs` | Supported | Not available |

## Next steps

> [card] [Provider API](https://docs.walley.cc/typescript-sdk/provider-api.md)
>
> Every method, with request and result shapes.

> [card] [Transactions & Fees](https://docs.walley.cc/typescript-sdk/transactions.md)
>
> Command formats and how fees work.


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