Skip to content

Commit 7845482

Browse files
address feedback
1 parent 4cc210a commit 7845482

File tree

5 files changed

+32
-5
lines changed

5 files changed

+32
-5
lines changed

packages/transaction-controller/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12-
- Add `isGasFeeIncluded` to `TransactionMeta`, `TransactionBatchRequest` and `addTransaction` options so that the client can signal that the gas fee is included in the transaction. ([#6428](https://github.com/MetaMask/core/pull/6428))
12+
- Add `isGasFeeIncluded` to `TransactionMeta`, `TransactionBatchRequest` and `addTransaction` options so the client can signal that MetaMask is compensated for the gas fee by the transaction ([#6428](https://github.com/MetaMask/core/pull/6428))
1313

1414
## [60.1.0]
1515

packages/transaction-controller/src/TransactionController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,7 @@ export class TransactionController extends BaseController<
11241124
* @param options.batchId - A custom ID for the batch this transaction belongs to.
11251125
* @param options.deviceConfirmedOn - An enum to indicate what device confirmed the transaction.
11261126
* @param options.disableGasBuffer - Whether to disable the gas estimation buffer.
1127-
* @param options.isGasFeeIncluded - Whether the gas fee is included in the transaction.
1127+
* @param options.isGasFeeIncluded - Whether MetaMask will be compensated for the gas fee by the transaction.
11281128
* @param options.method - RPC method that requested the transaction.
11291129
* @param options.nestedTransactions - Params for any nested transactions encoded in the data.
11301130
* @param options.origin - The origin of the transaction request, such as a dApp hostname.

packages/transaction-controller/src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ export type TransactionMeta = {
260260
*/
261261
isExternalSign?: boolean;
262262

263-
/** Whether the gas fee is included in the transaction. */
263+
/** Whether MetaMask will be compensated for the gas fee by the transaction. */
264264
isGasFeeIncluded?: boolean;
265265

266266
/**
@@ -1678,7 +1678,7 @@ export type TransactionBatchRequest = {
16781678
/** Address of the account to submit the transaction batch. */
16791679
from: Hex;
16801680

1681-
/** Whether the gas fee is included in the transaction. */
1681+
/** Whether MetaMask will be compensated for the gas fee by the transaction. */
16821682
isGasFeeIncluded?: boolean;
16831683

16841684
/** ID of the network client to submit the transaction. */

packages/transaction-controller/src/utils/batch.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,33 @@ describe('Batch Utils', () => {
775775
);
776776
});
777777

778+
it.each([true, false])(
779+
'passes isGasFeeIncluded flag (%s) through to addTransaction when provided (EIP-7702 path)',
780+
async (isGasFeeIncluded) => {
781+
isAccountUpgradedToEIP7702Mock.mockResolvedValueOnce({
782+
delegationAddress: undefined,
783+
isSupported: true,
784+
});
785+
786+
addTransactionMock.mockResolvedValueOnce({
787+
transactionMeta: TRANSACTION_META_MOCK,
788+
result: Promise.resolve(''),
789+
});
790+
791+
request.request.isGasFeeIncluded = isGasFeeIncluded;
792+
793+
await addTransactionBatch(request);
794+
795+
expect(addTransactionMock).toHaveBeenCalledTimes(1);
796+
expect(addTransactionMock).toHaveBeenCalledWith(
797+
expect.any(Object),
798+
expect.objectContaining({
799+
isGasFeeIncluded,
800+
}),
801+
);
802+
},
803+
);
804+
778805
describe('validates security', () => {
779806
it('using transaction params', async () => {
780807
isAccountUpgradedToEIP7702Mock.mockResolvedValueOnce({

packages/transaction-controller/src/utils/batch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ async function addTransactionBatchWith7702(
389389

390390
const { result } = await addTransaction(txParams, {
391391
batchId,
392-
isGasFeeIncluded: request.request.isGasFeeIncluded,
392+
isGasFeeIncluded: userRequest.isGasFeeIncluded,
393393
nestedTransactions,
394394
networkClientId,
395395
origin,

0 commit comments

Comments
 (0)