Skip to content

Commit abf87d1

Browse files
dhruvkelawalapenovicp
authored andcommitted
chore: expose data gas consumed and data gas price for 0.7 rpc
1 parent 4b83943 commit abf87d1

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

src/account/default.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,8 @@ export class Account extends Provider implements AccountInterface {
628628
unit: 'FRI',
629629
suggestedMaxFee: ZERO,
630630
resourceBounds: estimateFeeToBounds(ZERO),
631+
data_gas_consumed: 0n,
632+
data_gas_price: 0n,
631633
};
632634
break;
633635
}

src/types/provider/response.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ export interface EstimateFeeResponse {
121121
unit: PRICE_UNIT;
122122
suggestedMaxFee: bigint;
123123
resourceBounds: ResourceBounds;
124+
data_gas_consumed: bigint;
125+
data_gas_price: bigint;
124126
}
125127

126128
export type EstimateFeeResponseBulk = Array<EstimateFeeResponse>;

src/utils/responseParser/rpc.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ import {
66
BlockWithTxHashes,
77
ContractClassPayload,
88
ContractClassResponse,
9-
TransactionReceipt,
109
EstimateFeeResponse,
1110
EstimateFeeResponseBulk,
12-
GetBlockResponse,
1311
FeeEstimate,
12+
GetBlockResponse,
13+
GetTxReceiptResponseWithoutHelper,
14+
RpcProviderOptions,
1415
SimulateTransactionResponse,
1516
SimulatedTransaction,
16-
RpcProviderOptions,
17-
GetTxReceiptResponseWithoutHelper,
17+
TransactionReceipt,
1818
} from '../../types/provider';
1919
import { toBigInt } from '../num';
20+
import { isString } from '../shortString';
2021
import { estimateFeeToBounds, estimatedFeeToMaxFee } from '../stark';
2122
import { ResponseParser } from '.';
22-
import { isString } from '../shortString';
2323

2424
export class RPCResponseParser
2525
implements
@@ -80,6 +80,8 @@ export class RPCResponseParser
8080
unit: val.unit,
8181
suggestedMaxFee: this.estimatedFeeToMaxFee(val.overall_fee),
8282
resourceBounds: this.estimateFeeToBounds(val),
83+
data_gas_consumed: val.data_gas_consumed ? toBigInt(val.data_gas_consumed) : 0n,
84+
data_gas_price: val.data_gas_price ? toBigInt(val.data_gas_price) : 0n,
8385
};
8486
}
8587

@@ -91,6 +93,8 @@ export class RPCResponseParser
9193
unit: val.unit,
9294
suggestedMaxFee: this.estimatedFeeToMaxFee(val.overall_fee),
9395
resourceBounds: this.estimateFeeToBounds(val),
96+
data_gas_consumed: val.data_gas_consumed ? toBigInt(val.data_gas_consumed) : 0n,
97+
data_gas_price: val.data_gas_price ? toBigInt(val.data_gas_price) : 0n,
9498
}));
9599
}
96100

0 commit comments

Comments
 (0)