Setting up the SDK
The core package exposes an SDK builder DeviceSdkBuilder
which will be used to initialise the SDK with your configuration.
For now it allows you to add one or more custom loggers.
In the following example, we add a console logger (.addLogger(new ConsoleLogger())
). Then we build the SDK with .build()
.
The returned object will be the entrypoint for all your interactions with the SDK. You should keep it as a SINGLETON.
The SDK should be built only once in your application runtime so keep a reference of this object somewhere.
import {
ConsoleLogger,
DeviceSdk,
DeviceSdkBuilder,
} from "@ledgerhq/device-management-kit";
export const sdk = new DeviceSdkBuilder()
.addLogger(new ConsoleLogger())
.build();