@ledgerhq/device-transport-kit-speculos

0.0.1 • Public • Published

Transport Device Kit Speculos

Description

This transport is used to communicate with the speculos device simulator developped by Ledger through http.

Installation

To install the core package, run the following command:

npm install @ledgerhq/device-transport-kit-speculos

Usage

Compatibility

  • Node.js >= 20
  • Internet browsers (should work on any modern brower)

Pre-requisites

To use this transport, ensure you have the Device Management Kit installed in your project.

Main Features

  • Exposing a transport factory to be injected into the DeviceManagementKit
  • Exposing the transport directly for a custom configuration

How To

To use the transport, you need to inject it in the DeviceManagementKitBuilder before the build. This will allow the Device Management Kit to find and interact with speculos devices trhough http

import { DeviceManagementKitBuilder } from "@ledgerhq/device-management-kit";
import {
  speculosTransportFactory,
  SpeculosTransport,
} from "@ledgerhq/device-transport-speculos";

// Easy setup with the factory
const dmk = new DeviceManagementKitBuilder()
  .addTransport(speculosTransportFactory()) // Defaults to the default speculos port http://localhost:5000
  .addTransport(speculosTransportFactory("http://localhost:5001")) // With custom server
  .build();

// With custom config
const dmk = new DeviceManagementKitBuilder()
  .addTransport(
    ({
      loggerServiceFactory,
      config,
    }: {
      loggerServiceFactory: (tag: string) => LoggerPublisherService;
      config: DmkConfig;
    }) => {
      // custom code
      const speculosUrl = "http://localhost:3333";

      return new SpeculosTransport(loggerServiceFactory, config, speculosUrl);
    },
  )
  .build();

// You can then make use of the Device Management Kit

Readme

Keywords

none

Package Sidebar

Install

npm i @ledgerhq/device-transport-kit-speculos

Weekly Downloads

775

Version

0.0.1

License

Apache-2.0

Unpacked Size

178 kB

Total Files

36

Last publish

Collaborators

  • phenry-ledger
  • sergii-shkolin
  • gbrahm-ledger
  • thomas.coudray
  • ldg-github-ci
  • vbouzon
  • ledger-releaser