canton-network-docs/SDKsWallet SDKUsing the SDK
Registering Plugins
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 theSDKPlugin class and implement your custom functionality. Plugins are registered using the registerPlugins method, which accepts a record of plugin constructors keyed by their desired property names.
Key Points
- Plugin Constructor: Plugin classes must accept
SDKContextas a constructor parameter and pass it to thesuper()call along with the plugin name. - Type Safety: The
registerPluginsmethod 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
ctxproperty. - Multiple Plugins: You can register multiple plugins at once by passing them in a single object to
registerPlugins.