Package Exports
- @emurgo/ledger-connect-handler
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@emurgo/ledger-connect-handler) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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:
Yoroirequestsyoroi-extension-ledger-connect-handler(Using function call).yoroi-extension-ledger-connect-handleropens target Website.yoroi-extension-ledger-connect-handlersends request message tocontent-script(Using extension port).content-scriptpasses request to the target Website app(UsingpostMessage()).- Target Website app processes the request and send response to
content-script(UsingpostMessage()). content-scriptpasses response toyoroi-extension-ledger-connect-handler(Using extension port).- Finally,
yoroi-extension-ledger-connect-handlerpasses response toYoroi(Using function return).
Supported Functions
getExtendedPublicKey
Inputs
{
serial: ?string,
params: {
path: BIP32Path
},
}Outputs
{
deriveSerial: {
serial: string
},
deviceVersion: {
flags: Flags,
major: string,
minor: string,
patch: string
},
response: {
chainCodeHex: string,
publicKeyHex: string
}
}signTransaction
Inputs
{
serial: ?string,
params: {
networkId: number,
protocolMagic: number,
inputs: Array<InputTypeUTxO>,
outputs: Array<OutputTypeAddress | OutputTypeAddressParams>,
feeStr: string,
ttlStr: string,
certificates: Array<Certificate>,
withdrawals: Array<Withdrawal>,
metadataHashHex: ?string
},
}Outputs
{
txHashHex: string,
witnesses: Array<Witness>
}showAddress
Inputs
{|
serial: ?string,
params: {
address: string,
addressTypeNibble: $Values<typeof AddressTypeNibbles>,
networkIdOrProtocolMagic: number,
spendingPath: BIP32Path,
stakingPath: ?BIP32Path,
stakingKeyHashHex: ?string,
stakingBlockchainPointer: ?StakingBlockchainPointer
},
|}Outputs
undefinedderiveAddress
Inputs
{
serial: ?string,
params: {
addressTypeNibble: $Values<typeof AddressTypeNibbles>,
networkIdOrProtocolMagic: number,
spendingPath: BIP32Path,
stakingPath: ?BIP32Path,
stakingKeyHashHex: ?string,
stakingBlockchainPointer: ?StakingBlockchainPointer,
},
}Outputs
{
addressHex: string
}getVersion
Inputs
{
serial: ?string,
params: undefined,
}Outputs
{
flags: Flags,
major: string,
minor: string,
patch: string
}getSerial
Inputs
{
serial: ?string,
params: undefined,
}Outputs
{
serial: string
}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