yoroi-extension-ledger-connect-handler v2.0.4
yoroi-extension-ledger-connect-handler
This library enables Yoroi extension to communicate with Ledger device, in process this library needs one web page that directly communicates with Ledger device. This library is responsible for opening, sendind resquest, passing back response to Yoroi and closing the target web page.
Message Passing

Flow:
1. Yoroi requests yoroi-extension-ledger-connect-handler(Using function call).
2. yoroi-extension-ledger-connect-handler opens target Website.
3. yoroi-extension-ledger-connect-handler sends request message to content-script(Using extension port).
4. content-script passes request to the target Website app(Using postMessage()).
5. Target Website app processes the request and send response to content-script(Using postMessage()).
6. content-script passes response to yoroi-extension-ledger-connect-handler(Using extension port).
7. Finally, yoroi-extension-ledger-connect-handler passes response to Yoroi(Using function return).
Supported Functions
getExtendedPublicKey = (hdPath: BIP32Path): Promise\<ExtendedPublicKeyResp>
params:
- hdPath: BIP32Path HARDENED = 0x80000000; PURPOSE = 44; COIN_TYPE = 1815; // Cardano BIP32Path = HARDENED + PURPOSE, HARDENED + COIN_TYPE, HARDENED + account, chain, address
returns:
- Promise\<ExtendedPublicKeyResp> type ExtendedPublicKeyResp = { ePublicKey: GetExtendedPublicKeyResponse, deviceVersion: GetVersionResponse, }
signTransaction = (inputs: Array\, outputs: Array<OutputTypeAddress | OutputTypeChange>): Promise\<SignTransactionResponse>
params:
- inputs: Array[InputTypeUTxO](https://github.com/cardano-foundation/ledgerjs-hw-app-cardano/blob/ac3ee1345506ab343a7159ebbcec8e616f8ac5d9/src/Ada.js#L40)
- outputs: Array<OutputTypeAddress | OutputTypeChange>
returns:
showAddress = (hdPath: BIP32Path, address: string): Promise\<void>
params:
- hdPath: BIP32Path
- address: string
returns:
- Promise\<void>
deriveAddress = (hdPath: BIP32Path): Promise\<DeriveAddressResponse>
params:
- hdPath: BIP32Path
returns:
getVersion = (): Promise\<GetVersionResponse>
params:
void
returns:
Example
Import
import LedgerConnect from 'yoroi-extension-ledger-connect-handler';Create new instance
const ledgerConnect = new LedgerConnect(config);config is type of: Config
Calling function
const deviceVersionResp = await ledgerConnect.getVersion();Supported Ledger Transport
- @ledgerhq/hw-transport-webauthn Default
- @ledgerhq/hw-transport-u2f
- Has issues on
Windows 10 Version: >= 1903. Refer.
- Has issues on
- @ledgerhq/hw-transport-webusb Incomplete
Building up
nvm iyarnyarn run build
Publishing
Make sure you have followed Building up steps before publishing.
npm publish