-
probeDevice
probeDevice(): Promise. If device available and ready, Promise returned true.
const canIUse = async () => {
return await ledger.probeDevice();
}
-
tryConnect
tryConnect(): Promise<>. reconnect to Transport and init ledger libs.
const isLedgerReady = async () => {
try {
return await ledger.tryConnect();
} catch (e) {
}
};
-
getUserDataById
getUserDataById(id): Promise. Get user from ledger, where user is:
{ id: number, path: string, wavesAddress: string, publicKey: string }
id - is number from 0
path - is string in internal ledger format
wavesAddress - is string in base58 format
publicKey - is string in base58 format
ledger.getUserDataById(id)
.then(
(user) => {...},
(err) => {...}
);
-
signTransaction
Sign waves transaction bytes (ledger show detailed transaction info)
ledger.signTransaction(userId, asset, data)
userId - number
data - Array number form 0 to 255
asset - {precision: number, ...}
Result is Promise with signature string in base58 format
-
signSomeData
Sign any bytes (ledger can't show detail info)
ledger.signSomeData(userId, data)
userId - number
data - Array number form 0 to 255
Result is Promise with signature string in base58 format
-
signRequest
Sign any bytes (ledger can't show detail info)
ledger.signRequest(userId, data)
userId - number
data - Array number form 0 to 255
Result is Promise with signature string in base58 format
-
signMessage
Sign any string (ledger can't show detail info)
ledger.signMessage(userId, data)
userId - number
data - string
Result is Promise with signature string in base58 format