From a1ce705d1534127c890ed86b375452c21e65ad99 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Wed, 8 May 2019 17:41:07 -0700 Subject: [PATCH] fix: adapt to GetRecentBlockhash RPC API signature change --- web3.js/src/connection.js | 5 +++-- web3.js/test/mockrpc/get-recent-blockhash.js | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/web3.js/src/connection.js b/web3.js/src/connection.js index 1381f8a7e..da06416b3 100644 --- a/web3.js/src/connection.js +++ b/web3.js/src/connection.js @@ -173,7 +173,7 @@ const GetTransactionCountRpcResult = jsonRpcResult('number'); /** * Expected JSON RPC response for the "getRecentBlockhash" message */ -const GetRecentBlockhash = jsonRpcResult('string'); +const GetRecentBlockhash = jsonRpcResult(['string', 'object']); /** * Expected JSON RPC response for the "requestAirdrop" message @@ -435,7 +435,8 @@ export class Connection { throw new Error(res.error.message); } assert(typeof res.result !== 'undefined'); - return res.result; + // TODO: deserialize and expose FeeCalculator in res.result[1] + return res.result[0]; } /** diff --git a/web3.js/test/mockrpc/get-recent-blockhash.js b/web3.js/test/mockrpc/get-recent-blockhash.js index 068900294..f6a4f5f4a 100644 --- a/web3.js/test/mockrpc/get-recent-blockhash.js +++ b/web3.js/test/mockrpc/get-recent-blockhash.js @@ -15,7 +15,10 @@ export function mockGetRecentBlockhash() { }, { error: null, - result: recentBlockhash.publicKey.toBase58(), + result: [ + recentBlockhash.publicKey.toBase58(), + { /* empty fee calculator */} + ] }, ]); }