Skip to content

Commit

Permalink
fix: invalid rlp data for legacy transactions (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesposito authored Dec 2, 2023
1 parent 2f0da8f commit 4f24e1d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/ledger-keyring.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,9 @@ describe('LedgerKeyring', function () {
.mockImplementation(async (params) => {
expect(params).toStrictEqual({
hdPath: "m/44'/60'/0'/0",
tx: RLP.encode(newFakeTx.getMessageToSign(false)).toString(),
tx: Buffer.from(
RLP.encode(newFakeTx.getMessageToSign(false)),
).toString('hex'),
});
return expectedRSV;
});
Expand Down
2 changes: 1 addition & 1 deletion src/ledger-keyring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ export class LedgerKeyring extends EventEmitter {

rawTxHex = Buffer.isBuffer(messageToSign)
? messageToSign.toString('hex')
: RLP.encode(messageToSign).toString();
: Buffer.from(RLP.encode(messageToSign)).toString('hex');

return this.#signTransaction(address, rawTxHex, (payload) => {
// Because tx will be immutable, first get a plain javascript object that
Expand Down

0 comments on commit 4f24e1d

Please sign in to comment.