Skip to content
CCPEDIAby Unity Nodes
Canton Network docsSDKs › Wallet SDK › Using the SDK

Registering Plugins

Updated 27-10-2026

The Wallet SDK supports extending its functionality through a plugin system. Plugins allow you to add custom methods and functionality to the SDK instance while maintaining access to the SDK context and logger.

Creating and Registering a Plugin

To create a plugin, extend the SDKPlugin class and implement your custom functionality. Plugins are registered using the registerPlugins method, which accepts an array of plugin constructors.
import {
    SDK,
    SDKPlugin,
    type SDKPluginContext,
} 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: 'http://localhost:2975',
            synchronizerId: global.LOCALNET_GLOBAL_SYNCHRONIZER,
        })
    ).registerPlugins([
        class MyPlugin extends SDKPlugin<'myPlugin'> {
            // wallet-sdk plugin should always accept SDKPluginContext
            constructor(protected readonly ctx: SDKPluginContext) {
                super('myPlugin', ctx)
            }

            myMethod() {
                // do some logic
                return
            }
        },
    ])

    sdk.myPlugin.myMethod()
}

Key Points

  • Plugin Constructor: Plugin classes must accept SDKPluginContext as a constructor parameter and pass it to the super() call along with the plugin name.
  • Type Safety: The registerPlugins method provides full type safety, ensuring that registered plugins are accessible with proper autocompletion and type checking.
  • Access to SDK Context: Plugins have access to the SDK’s context, logger, and other internal utilities through the ctx property.
  • Multiple Plugins: You can register multiple plugins at once by passing them in a single array to registerPlugins.