Parties

The party namespace provides methods to manage wallet parties on the Canton Network. In v1, the party namespace replaces the stateful party management from v0.

Availability

The party namespace is always available as part of the basic SDK interface. It’s initialized automatically when you create an SDK instance and doesn’t require additional configuration via extend().

import { SDK, localNetStaticConfig } from '@canton-network/wallet-sdk'

export default async function () {
    const sdk = await SDK.create({
        auth: global.TOKEN_PROVIDER_CONFIG_DEFAULT,
        ledgerClientUrl: localNetStaticConfig.LOCALNET_APP_USER_LEDGER_URL,
    })

    // party namespace is immediately available
    await sdk.party.list()
}

Key changes from v0 to v1

v0 used a stateful approach where you set a party context once with sdk.setPartyId(). All subsequent operations acted on that party.

v1 uses an explicit approach where you pass the party ID to each operation. This enables:

  • Thread-safe concurrent operations

  • Multi-party transactions within the same application

  • Clearer code intent

Refer to Preparing and Signing Transactions Using External Party for more information.

Party types

Internal parties

The below example demonstrates the full usage of the feature:

External parties

An external party uses an external key pair for signing. You provide the public key, and the SDK generates the topology. You then sign the topology transaction with your private key and execute it on the ledger.

Note

We recommend always providing a partyHint when creating a party. Refer to Choosing a party hint for more details.

Listing parties

This method returns all parties where the user has CanActAs, CanReadAs, or CanExecuteAs rights. If the user has admin rights, all local parties are returned.

Offline signing workflow

Migration reference

Party-related method migration

v0 method

v1 method

sdk.setPartyId(partyId)

Pass partyId explicitly to each operation

sdk.userLedger.listWallets()

sdk.party.list()

sdk.userLedger.signAndAllocateExternalParty(privateKey, partyHint)

sdk.party.external.create(publicKey, {partyHint}).sign(privateKey).execute()

sdk.topology?.prepareExternalPartyTopology()

sdk.party.external.create().prepare() (implicit on create)

sdk.topology?.submitExternalPartyTopology()

sdk.party.external.create().sign().execute()

See also