diff --git a/__tests__/rpcProvider.test.ts b/__tests__/rpcProvider.test.ts index 3a825b35e..fe9ebdcf3 100644 --- a/__tests__/rpcProvider.test.ts +++ b/__tests__/rpcProvider.test.ts @@ -48,13 +48,15 @@ describe('RPCProvider', () => { }); test('estimate fee', async () => { - const { overall_fee } = await account.estimateFee({ + const { overall_fee, gas_consumed, gas_price } = await account.estimateFee({ contractAddress: erc20Address, entrypoint: 'transfer', calldata: [erc20.address, '10'], }); expect(isBN(overall_fee)).toBe(true); + expect(isBN(gas_consumed)).toBe(true); + expect(isBN(gas_price)).toBe(true); }); test('execute by wallet owner', async () => { diff --git a/src/types/provider.ts b/src/types/provider.ts index f49a1e8ef..6a42f6fa0 100644 --- a/src/types/provider.ts +++ b/src/types/provider.ts @@ -83,6 +83,8 @@ export type DeclareTransactionReceiptResponse = CommonTransactionReceiptResponse export interface EstimateFeeResponse { overall_fee: BigNumberish; + gas_consumed?: BigNumberish; + gas_price?: BigNumberish; } export interface InvokeFunctionResponse { diff --git a/src/utils/responseParser/rpc.ts b/src/utils/responseParser/rpc.ts index 896182d44..4194d429f 100644 --- a/src/utils/responseParser/rpc.ts +++ b/src/utils/responseParser/rpc.ts @@ -70,6 +70,8 @@ export class RPCResponseParser extends ResponseParser { public parseFeeEstimateResponse(res: RPC.EstimateFeeResponse): EstimateFeeResponse { return { overall_fee: toBN(res.overall_fee), + gas_consumed: toBN(res.gas_consumed), + gas_price: toBN(res.gas_price), }; }