diff --git a/src/ledger-keyring.test.ts b/src/ledger-keyring.test.ts index f457001f..5c0ca773 100644 --- a/src/ledger-keyring.test.ts +++ b/src/ledger-keyring.test.ts @@ -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; }); diff --git a/src/ledger-keyring.ts b/src/ledger-keyring.ts index 77392c5b..08bd6103 100644 --- a/src/ledger-keyring.ts +++ b/src/ledger-keyring.ts @@ -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