Skip to content

Commit a55e260

Browse files
authored
fix: correct return type of getFeeForMessage (#30004)
* fix: correct return type of getFeeForMessage * chore: get rid of useless typecast
1 parent f0edd1a commit a55e260

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/connection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4452,7 +4452,7 @@ export class Connection {
44524452
async getFeeForMessage(
44534453
message: VersionedMessage,
44544454
commitment?: Commitment,
4455-
): Promise<RpcResponseAndContext<number>> {
4455+
): Promise<RpcResponseAndContext<number | null>> {
44564456
const wireMessage = toBuffer(message.serialize()).toString('base64');
44574457
const args = this._buildArgs([wireMessage], commitment);
44584458
const unsafeRes = await this._rpcRequest('getFeeForMessage', args);
@@ -4464,7 +4464,7 @@ export class Connection {
44644464
if (res.result === null) {
44654465
throw new Error('invalid blockhash');
44664466
}
4467-
return res.result as unknown as RpcResponseAndContext<number>;
4467+
return res.result;
44684468
}
44694469

44704470
/**

src/transaction/legacy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ export class Transaction {
585585
/**
586586
* Get the estimated fee associated with a transaction
587587
*/
588-
async getEstimatedFee(connection: Connection): Promise<number> {
588+
async getEstimatedFee(connection: Connection): Promise<number | null> {
589589
return (await connection.getFeeForMessage(this.compileMessage())).value;
590590
}
591591

0 commit comments

Comments
 (0)