Skip to content

Commit

Permalink
chore(ledger): log transaction payload prior to sending to ledger
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Oct 3, 2024
1 parent e0bdec9 commit cd47f56
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/app/features/ledger/utils/stacks-ledger-utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import Transport from '@ledgerhq/hw-transport-webusb';
import {
AddressVersion,
Expand Down Expand Up @@ -60,8 +61,14 @@ export const prepareLedgerDeviceStacksAppConnection = prepareLedgerDeviceForAppF
) as (args: PrepareLedgerDeviceConnectionArgs) => Promise<StacksApp>;

export function signLedgerStacksTransaction(app: StacksApp) {
return async (payload: Buffer, accountIndex: number) =>
app.sign(stxDerivationWithAccount.replace('{account}', accountIndex.toString()), payload);
return async (payload: Buffer, accountIndex: number) => {
console.log('Logging serialised stacks transaction');
console.log(payload.toString('hex'));
return app.sign(
stxDerivationWithAccount.replace('{account}', accountIndex.toString()),
payload
);
};
}

export function signLedgerStacksUtf8Message(app: StacksApp) {
Expand Down

0 comments on commit cd47f56

Please sign in to comment.