fix: correct return type of getFeeForMessage (#30004)
* fix: correct return type of getFeeForMessage * chore: get rid of useless typecast
This commit is contained in:
parent
6489c20de5
commit
1064bcbf72
|
@ -4452,7 +4452,7 @@ export class Connection {
|
|||
async getFeeForMessage(
|
||||
message: VersionedMessage,
|
||||
commitment?: Commitment,
|
||||
): Promise<RpcResponseAndContext<number>> {
|
||||
): Promise<RpcResponseAndContext<number | null>> {
|
||||
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<number>;
|
||||
return res.result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -585,7 +585,7 @@ export class Transaction {
|
|||
/**
|
||||
* Get the estimated fee associated with a transaction
|
||||
*/
|
||||
async getEstimatedFee(connection: Connection): Promise<number> {
|
||||
async getEstimatedFee(connection: Connection): Promise<number | null> {
|
||||
return (await connection.getFeeForMessage(this.compileMessage())).value;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue