Skip to content

Commit 07be0be

Browse files
committed
Merge branch 'main' into release/687.0.0
2 parents b9fc614 + 3ef1b23 commit 07be0be

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

packages/transaction-pay-controller/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121
- **BREAKING:** Bump `@metamask/bridge-controller` from `^61.0.0` to `^62.0.0` ([#7190](https://github.com/MetaMask/core/pull/7190))
2222
- **BREAKING:** Bump `@metamask/assets-controllers` from `^89.0.0` to `^90.0.0` ([#7190](https://github.com/MetaMask/core/pull/7190))
2323

24+
### Fixed
25+
26+
- Ensure source network fee for Relay quotes includes all items and steps ([#7191](https://github.com/MetaMask/core/pull/7191))
27+
2428
## [8.0.0]
2529

2630
### Changed

packages/transaction-pay-controller/src/strategy/relay/relay-quotes.test.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,28 @@ describe('Relay Quotes Utils', () => {
397397

398398
it('includes source network fee using gas total from multiple transactions', async () => {
399399
const quoteMock = cloneDeep(QUOTE_MOCK);
400+
400401
quoteMock.steps[0].items.push({
401402
data: {
402403
gas: '480000',
403404
},
404405
} as never);
405406

407+
quoteMock.steps.push({
408+
items: [
409+
{
410+
data: {
411+
gas: '1000',
412+
},
413+
},
414+
{
415+
data: {
416+
gas: '2000',
417+
},
418+
},
419+
],
420+
} as never);
421+
406422
successfulFetchMock.mockResolvedValue({
407423
json: async () => quoteMock,
408424
} as never);
@@ -414,7 +430,7 @@ describe('Relay Quotes Utils', () => {
414430
});
415431

416432
expect(calculateGasCostMock).toHaveBeenCalledWith(
417-
expect.objectContaining({ gas: 501000 }),
433+
expect.objectContaining({ gas: 504000 }),
418434
);
419435
});
420436

packages/transaction-pay-controller/src/strategy/relay/relay-quotes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ function calculateSourceNetworkCost(
382382
quote: RelayQuote,
383383
messenger: TransactionPayControllerMessenger,
384384
): TransactionPayQuote<RelayQuote>['fees']['sourceNetwork'] {
385-
const allParams = quote.steps[0].items.map((i) => i.data);
385+
const allParams = quote.steps.flatMap((s) => s.items).map((i) => i.data);
386386
const { chainId } = allParams[0];
387387
const totalGasLimit = calculateSourceNetworkGasLimit(allParams);
388388

0 commit comments

Comments
 (0)