Caravan Documentation
    Preparing search index...

    Class HermitSignMultisigTransaction

    Displays a signature request for Hermit's sign command and reads the resulting signature.

    This interaction class works in tandem with the BCURDecoder class. The BCURDecoder parses data from Hermit, this class interprets it.

    const interaction = new HermitSignMultisigTransaction({psbt});
    const urParts = interaction.request();
    console.log(urParts);
    // [ "ur:...", "ur:...", ... ]

    // Some application function which knows how to display an animated
    // QR code sequence.
    displayQRCodeSequence(urParts);

    // Hermit returns a PSBT encoded as hex through BC-UR. Some
    // application function needs to work with the BCURDecoder class to
    // parse this data.
    const signedPSBTHex = readQRCodeSequence();

    // The interaction parses the data from Hermit.
    const signedPSBTBase64 = interaction.parse(signedPSBTHex);
    console.log(signedPSBTBase64);
    // "cHNidP8B..."

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    environment: Parser
    indirect: boolean
    psbt: string
    returnSignatureArray: boolean
    workflow: string[]

    Methods

    • 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"}
    • Parse the response into a result.

      Subclasses must override this function. It must accept an appropriate kind of response object and return the final result of this interaction.

      Parameters

      • signedPSBTHex: any

      Returns unknown

    • Provide the request.

      Subclasses may override this function. It can return any kind of object. Strings, data for QR codes, HTTP requests, command lines, functions, &c. are all allowed. Whatever is appropriate for the interaction.

      Returns string[]