diff --git a/web3.js/src/transaction.js b/web3.js/src/transaction.js index dd12e5f222..08086e042a 100644 --- a/web3.js/src/transaction.js +++ b/web3.js/src/transaction.js @@ -537,7 +537,7 @@ export class Transaction { numReadonlySignedAccounts, numReadonlyUnsignedAccounts, }, - recentBlockhash: bs58.encode(Buffer.from(recentBlockhash)), + recentBlockhash, accountKeys: accounts.map(account => new PublicKey(account)), instructions, }; diff --git a/web3.js/test/transaction.test.js b/web3.js/test/transaction.test.js index ece8961bc6..5abab196f3 100644 --- a/web3.js/test/transaction.test.js +++ b/web3.js/test/transaction.test.js @@ -160,7 +160,7 @@ test('parse wire format and serialize', () => { }); test('transaction from rpc result', () => { - const rawBlockhash = new PublicKey(0).toBuffer(); + const recentBlockhash = new PublicKey(1).toString(); const rpcResult = { message: { accountKeys: [ @@ -182,7 +182,7 @@ test('transaction from rpc result', () => { programIdIndex: 4, }, ], - recentBlockhash: rawBlockhash, + recentBlockhash, }, signatures: [ bs58.encode(Buffer.alloc(64).fill(1)), @@ -190,7 +190,6 @@ test('transaction from rpc result', () => { ], }; - const recentBlockhash = new PublicKey(rawBlockhash).toBase58(); const transaction = Transaction.fromRpcResult(rpcResult); expect(transaction.instructions.length).toEqual(1); expect(transaction.signatures.length).toEqual(2);