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

> ## Agent Instructions
> If you are building a Canton Network application, start from https://docs.canton.network/appdev/quickstart.md. To run only a local network for your own Daml code, without building the QuickStart demo, see https://docs.canton.network/sdks-tools/development-tools/localnet.md.

# SDK v0 to v1 Migration Guide

> Migrate the Wallet SDK from v0 to v1.

Wallet SDK v1 is not backwards compatible with v0.

**Quick links**

* [Configuration](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/using-the-sdk/configuration.md) — Detailed configuration guide
* [Preparing and signing a transaction](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/guides/preparing-and-signing-a-transaction.md) — Preparing and signing transactions
* [Migration cheat sheet](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/using-the-sdk/v0-to-v1-migration/migration-cheat-sheet.md) — Full v0 → v1 method lookup

We have removed the configure() and connect() pattern in favor of passing in a static configuration or a provider with ledger api capabilities.

Static configuration initialization where we supply an auth config and a ledgerClientUrl:

```typescript theme={"theme":{"light":"github-light","dark":"github-dark"}}
import { SDK, localNetStaticConfig } from '@canton-network/wallet-sdk'

export default async function () {
    const sdk = await SDK.create({
        auth: {
            method: 'self_signed',
            issuer: 'unsafe-auth',
            credentials: {
                clientId: 'ledger-api-user',
                clientSecret: 'unsafe',
                audience: 'https://canton.network.global',
                scope: '',
            },
        },
        ledgerClientUrl: new URL('http://localhost:2975'),
        synchronizerId: global.LOCALNET_GLOBAL_SYNCHRONIZER,
        token: {
            registries: [
                new URL('http://localhost:2000/api/validator/v0/scan-proxy'),
            ],
            auth: global.TOKEN_PROVIDER_CONFIG_DEFAULT,
        },
        amulet: {
            scanApiUrl: localNetStaticConfig.LOCALNET_SCAN_API_URL,
            auth: TOKEN_PROVIDER_CONFIG_DEFAULT,
            registryUrl: localNetStaticConfig.LOCALNET_REGISTRY_API_URL,
        },
        asset: {
            registries: [localNetStaticConfig.LOCALNET_REGISTRY_API_URL],
            auth: TOKEN_PROVIDER_CONFIG_DEFAULT,
        },
    })

    // OR, you can defer loading config by calling .extend()

    const basicSDK = await SDK.create({
        auth: {
            method: 'self_signed',
            issuer: 'unsafe-auth',
            credentials: {
                clientId: 'ledger-api-user',
                clientSecret: 'unsafe',
                audience: 'https://canton.network.global',
                scope: '',
            },
        },
        ledgerClientUrl: new URL('http://localhost:2975'),
        synchronizerId: global.LOCALNET_GLOBAL_SYNCHRONIZER,
    })

    // Extend with token namespace
    const tokenExtendedSDK = await basicSDK.extend({
        token: {
            validatorUrl: new URL('http://localhost:2000/api/validator'),
            registries: [
                new URL('http://localhost:2000/api/validator/v0/scan-proxy'),
            ],
            auth: global.TOKEN_PROVIDER_CONFIG_DEFAULT,
        },
    })

    // Can extend further with more namespaces
    const fullyExtendedSDK = await tokenExtendedSDK.extend({
        amulet: {
            validatorUrl: localNetStaticConfig.LOCALNET_APP_VALIDATOR_URL,
            scanApiUrl: localNetStaticConfig.LOCALNET_SCAN_API_URL,
            auth: global.TOKEN_PROVIDER_CONFIG_DEFAULT,
            registryUrl: localNetStaticConfig.LOCALNET_REGISTRY_API_URL,
        },
    })
}
```

Provider initialization: The provider is an abstraction that ultimately interacts with the Ledger (JSON LAPI). This can be implemented for either a dApp consumer, direct ledger user, or alternative transport channels such as Wallet Connect.

```typescript theme={"theme":{"light":"github-light","dark":"github-dark"}}
// Notice that `auth` and `ledgerClientUrl` are no longer needed
// when supplying sdk with custom provider
const sdk = await SDK.create(config, provider);
```

## Namespace changes

We have removed the controllers and replaced them with namespaces to appropriately segregate the service layer in terms of business context. When the sdk is initialized, it has access to the users, keys, ledger, and party namespaces. The amulet, token, asset, and events namespaces can be initialized with a separate config via the `.extend()` method.

## Find your migration path

Jump to the page that matches the work you are migrating:

> [card] [Allocate or list parties](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/using-the-sdk/v0-to-v1-migration/party.md)
>
> Internal and external parties, offline signing, and replacing `setPartyId`.

> [card] [Transfers, holdings, UTXOs, allocations](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/using-the-sdk/v0-to-v1-migration/token.md)
>
> Replace `tokenStandard` transfer, holding, UTXO, and allocation APIs.

> [card] [Users and rights](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/using-the-sdk/v0-to-v1-migration/user.md)
>
> Create users and grant rights without separate admin/user ledger
> controllers.

> [card] [Canton Coin, traffic, preapprovals, tap](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/using-the-sdk/v0-to-v1-migration/amulet.md)
>
> Migrate amulet-specific traffic, preapproval, featured-app, and tap flows.

> [card] [Prepare, sign, execute, ACS, DARs](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/using-the-sdk/v0-to-v1-migration/ledger.md)
>
> Replace `prepareSignExecuteAndWaitFor` with the prepare/sign/execute chain.

> [card] [Discover assets and instruments](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/using-the-sdk/v0-to-v1-migration/asset.md)
>
> List and find instruments through the dedicated asset namespace.

> [card] [Keys and events](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/using-the-sdk/v0-to-v1-migration.md#keys-and-events)
>
> Key generation and ledger update/completion subscriptions.

> [card] [Full method cheat sheet](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/using-the-sdk/v0-to-v1-migration/migration-cheat-sheet.md)
>
> Searchable v0 controller → v1 namespace method mapping table.

## Removed functionality

The following methods have been removed:

`sdk.connect()` No longer needed, SDK is connected on creation `sdk.connectAdmin()` No longer needed, admin operations are available in the ledger namespace and rights are extracted from the token. `sdk.connectTopology()` No longer needed, the grpc endpoints have been removed and replaced with ledger api endpoints. `sdk.setPartyId()` Pass `partyId` explicitly to each operation

```typescript theme={"theme":{"light":"github-light","dark":"github-dark"}}
sdk.setPartyId(myPartyId);
const holdingTransactionsmyPartyId =
  await sdk.tokenStandard?.listHoldingTransactions();
sdk.setPartyId(myPartyId2);
const holdingTransactionsmyPartyId2 =
  await sdk.tokenStandard?.listHoldingTransactions();
```

***

```typescript theme={"theme":{"light":"github-light","dark":"github-dark"}}
const holdingTransactionsmyPartyId = await token.holdings(myPartyId);
const holdingTransactionsmyPartyId2 = await token.holdings(myPartyId2);
```

In v0, the controllers and sdk were stateful. In v1, party information should be passed explicitly to each function. This enables acting as multiple parties and allows for thread safety in concurrent use.

## Keys and events

The **keys** namespace is always available on the basic SDK. Use it instead of standalone key-pair helpers:

| v0 | v1 |
| - | - |
| `createKeyPair()` | `sdk.keys.generate()` |

The **events** namespace replaces ledger update and completion subscriptions from `userLedger`. Like `amulet`, `token`, and `asset`, it is an extended namespace that you configure at creation time or via `.extend()`:

| v0 | v1 |
| - | - |
| `sdk.userLedger.subscribeToUpdates` | `sdk.events.updates` |
| `sdk.userLedger.subscribeToCompletions` | `sdk.events.completions` |

For the complete method map across all namespaces, see the [migration cheat sheet](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/using-the-sdk/v0-to-v1-migration/migration-cheat-sheet.md).

## See also

* [Configuration](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/using-the-sdk/configuration.md)
* [User management](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/guides/user-management.md)
* [Preparing and signing a transaction](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/guides/preparing-and-signing-a-transaction.md)
* [Creating an external party](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/guides/creating-an-external-party.md)
