Caravan Documentation
    Preparing search index...

    Returns metadata about Ledger device.

    Includes model name, firmware & MCU versions.

    import {LedgerGetMetadata} from "@caravan/wallets";
    const interaction = new LedgerGetMetadata();
    const result = await interaction.run();
    console.log(result);
    {
    spec: "Nano S v1.4.2 (MCU v1.7)",
    model: "Nano S",
    version: {
    major: "1",
    minor: "4",
    patch: "2",
    string: "1.4.2",
    },
    mcuVersion: {
    major: "1",
    minor: "7",
    string: "1.7",
    }
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    appName?: string
    appVersion?: string
    direct: boolean
    environment: Parser

    Methods

    • Close the Transport to free the interface (E.g. could be used in another tab now that the interaction is over)

      The way the pubkey/xpub/fingerprints are grabbed makes this a little tricky. Instead of re-writing how that works, let's just add a way to explicitly close the transport.

      Returns Promise<any>

    • Subclasses can override this method to indicate they are not supported.

      This method has access to whatever options may have been passed in by the constructor as well as the ability to interact with this.environment to determine whether the functionality is supported. See the Bowser documentation for more details: https://github.com/lancedikson/bowser

      Returns boolean

      isSupported() {
      return this.environment.satisfies({
      * declare browsers per OS
      windows: {
      "internet explorer": ">10",
      },
      macos: {
      safari: ">10.1"
      },

      * per platform (mobile, desktop or tablet)
      mobile: {
      safari: '>=9',
      'android browser': '>3.10'
      },

      * or in general
      chrome: "~20.1.1432",
      firefox: ">31",
      opera: ">=22",

      * also supports equality operator
      chrome: "=20.1.1432", * will match particular build only

      * and loose-equality operator
      chrome: "~20", * will match any 20.* sub-version
      chrome: "~20.1" * will match any 20.1.* sub-version (20.1.19 as well as 20.1.12.42-alpha.1)
      });
      }
    • Return messages filtered by the given options.

      Multiple options can be given at once to filter along multiple dimensions.

      Parameters

      • __namedParameters: MessageMethodArgs

      Returns Message[]

      import {PENDING, ACTIVE} from "@caravan/bitcoin";
      // Create any interaction instance
      interaction.messages().forEach(msg => console.log(msg));
      { code: "device.connect", state: "pending", level: "info", text: "Please plug in your device."}
      { code: "device.active", state: "active", level: "info", text: "Communicating with your device..."}
      { code: "device.active.warning", state: "active", level: "warning", text: "Your device will warn you about...", version: "2.x"}
      interaction.messagesFor({state: PENDING}).forEach(msg => console.log(msg));
      { code: "device.connect", state: "pending", level: "info", text: "Please plug in your device."}
      interaction.messagesFor({code: ACTIVE}).forEach(msg => console.log(msg));
      { code: "device.active", state: "active", level: "info", text: "Communicating with your device..."}
      { code: "device.active.warning", state: "active", level: "warning", text: "Your device will warn you about...", version: "2.x"}
      interaction.messagesFor({version: /^2/}).forEach(msg => console.log(msg));
      { code: "device.active", state: "active", level: "warning", text: "Your device will warn you about...", version: "2.x"}
    • Parses the binary data returned from the Ledger API call into a metadata object.

      Parameters

      • response: any[]

      Returns {
          mcuVersion: { major: string; minor: string; string: string };
          model: string;
          spec: string;
          version: { major: string; minor: string; patch: string; string: string };
      }