Skip to content

Commit 942f4f2

Browse files
committed
feat: change estimate fee response on rpc provider
1 parent 591caf6 commit 942f4f2

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

__tests__/rpcProvider.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,15 @@ describe('RPCProvider', () => {
4848
});
4949

5050
test('estimate fee', async () => {
51-
const { overall_fee } = await account.estimateFee({
51+
const { overall_fee, gas_consumed, gas_price } = await account.estimateFee({
5252
contractAddress: erc20Address,
5353
entrypoint: 'transfer',
5454
calldata: [erc20.address, '10'],
5555
});
5656

5757
expect(isBN(overall_fee)).toBe(true);
58+
expect(isBN(gas_consumed)).toBe(true);
59+
expect(isBN(gas_price)).toBe(true);
5860
});
5961

6062
test('execute by wallet owner', async () => {

src/types/provider.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ export type DeclareTransactionReceiptResponse = CommonTransactionReceiptResponse
8383

8484
export interface EstimateFeeResponse {
8585
overall_fee: BigNumberish;
86+
gas_consumed?: BigNumberish;
87+
gas_price?: BigNumberish;
8688
}
8789

8890
export interface InvokeFunctionResponse {

src/utils/responseParser/rpc.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ export class RPCResponseParser extends ResponseParser {
7070
public parseFeeEstimateResponse(res: RPC.EstimateFeeResponse): EstimateFeeResponse {
7171
return {
7272
overall_fee: toBN(res.overall_fee),
73+
gas_consumed: toBN(res.gas_consumed),
74+
gas_price: toBN(res.gas_price),
7375
};
7476
}
7577

0 commit comments

Comments
 (0)