From 1064bcbf72b7e6a0734dc7258d0cc07d37874eb6 Mon Sep 17 00:00:00 2001 From: Steven Luscher Date: Mon, 30 Jan 2023 23:10:38 -0800 Subject: [PATCH] fix: correct return type of getFeeForMessage (#30004) * fix: correct return type of getFeeForMessage * chore: get rid of useless typecast --- web3.js/src/connection.ts | 4 ++-- web3.js/src/transaction/legacy.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web3.js/src/connection.ts b/web3.js/src/connection.ts index 3ad11570d5..e4efa497ea 100644 --- a/web3.js/src/connection.ts +++ b/web3.js/src/connection.ts @@ -4452,7 +4452,7 @@ export class Connection { async getFeeForMessage( message: VersionedMessage, commitment?: Commitment, - ): Promise> { + ): Promise> { const wireMessage = toBuffer(message.serialize()).toString('base64'); const args = this._buildArgs([wireMessage], commitment); const unsafeRes = await this._rpcRequest('getFeeForMessage', args); @@ -4464,7 +4464,7 @@ export class Connection { if (res.result === null) { throw new Error('invalid blockhash'); } - return res.result as unknown as RpcResponseAndContext; + return res.result; } /** diff --git a/web3.js/src/transaction/legacy.ts b/web3.js/src/transaction/legacy.ts index 998d6a568d..eee1c80ab8 100644 --- a/web3.js/src/transaction/legacy.ts +++ b/web3.js/src/transaction/legacy.ts @@ -585,7 +585,7 @@ export class Transaction { /** * Get the estimated fee associated with a transaction */ - async getEstimatedFee(connection: Connection): Promise { + async getEstimatedFee(connection: Connection): Promise { return (await connection.getFeeForMessage(this.compileMessage())).value; }