package ledgerwallet

  1. Overview
  2. Docs

Module Ledgerwallet.TransportSource

Sourcemodule Status : sig ... end
Sourcemodule Header : sig ... end
Sourcetype transport_error =
  1. | Hidapi of string
  2. | Incomplete_write of int
  3. | Incomplete_read of int
Sourcetype error =
  1. | AppError of {
    1. status : Status.t;
    2. msg : string;
    }
  2. | ApduError of Header.Error.t
  3. | TransportError of transport_error
Sourceval app_error : msg:string -> ('a, Status.t) result -> ('a, error) result
Sourceval pp_error : Format.formatter -> error -> unit
Sourceval write_apdu : ?pp:Format.formatter -> ?buf:Cstruct.t -> Hidapi.t -> Apdu.t -> (unit, error) result

write_apdu ?pp ?buf ledger apdu writes apdu to ledger.

read ?pp ?buf ledger reads from ledger a status response and a payload.

Sourceval ping : ?pp:Format.formatter -> ?buf:Cstruct.t -> Hidapi.t -> (unit, error) result

ping ?pp ?buf ledger writes a ping packet to ledger, optionally containing buf.

Sourceval apdu : ?pp:Format.formatter -> ?msg:string -> ?buf:Cstruct.t -> Hidapi.t -> Apdu.t -> (Cstruct.t, error) result

apdu ?pp ?msg ?buf ledger apdu writes apdu to ledger and returns the response.

Sourceval write_payload : ?pp:Format.formatter -> ?msg:string -> ?buf:Cstruct.t -> ?mark_last:bool -> cmd:Apdu.cmd -> ?p1:int -> ?p2:int -> Hidapi.t -> Cstruct.t -> (Cstruct.t, error) result

write_payload ?pp ?msg ?buf ?mark_last ~cmd ?p1 ?p2 ledger payload writes the payload of cmd into ledger and returns the response.