Skip to content
This repository has been archived by the owner on Jul 7, 2021. It is now read-only.

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Faust committed May 15, 2020
1 parent f2f5ca9 commit 4602b49
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/platform-sdk-lsk/src/services/ledger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,39 +25,39 @@ export class LedgerService implements Contracts.LedgerService {
}

public async getPublicKey(path: string): Promise<string> {
const { publicKey } = await this.#transport.getPubKey(this.getLedgerAccount());
const { publicKey } = await this.#transport.getPubKey(this.getLedgerAccount(path));

return publicKey;
}

public async signTransaction(path: string, payload: Buffer): Promise<string> {
const signature: Buffer = await this.#transport.signTX(
this.getLedgerAccount(),
this.getLedgerAccount(path),
Lisk.transaction.utils.getTransactionBytes(payload),
false,
);

return signature.toString('hex');
return signature.toString("hex");
}

public async signTransactionWithSchnorr(path: string, payload: Buffer): Promise<string> {
throw new Exceptions.NotImplemented(this.constructor.name, "signTransactionWithSchnorr");
}

public async signMessage(path: string, payload: Buffer): Promise<string> {
const signature: Buffer = await this.#transport.signMSG(this.getLedgerAccount(), payload);
const signature: Buffer = await this.#transport.signMSG(this.getLedgerAccount(path), payload);

return signature.slice(0, 64).toString('hex');
return signature.slice(0, 64).toString("hex");
}

public async signMessageWithSchnorr(path: string, payload: Buffer): Promise<string> {
throw new Exceptions.NotImplemented(this.constructor.name, "signMessageWithSchnorr");
}

private getLedgerAccount(index = 0) {
private getLedgerAccount(path: string): LedgerAccount {
const account: LedgerAccount = new LedgerAccount();
account.coinIndex(SupportedCoin.LISK);
account.account(index);
account.account(path); // todo: parse account index from path

return account;
}
Expand Down

0 comments on commit 4602b49

Please sign in to comment.