Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/bridge-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- **BREAKING:** `appendFeesToQuotes` interface now requires a chainId parameter, but still accepts both V1 and V2 quotes
- **BREAKING:** Use QuoteResponse V2 within the BridgeController; this affects the batch-sell, unified swap/bridge and quickBuy experiences ([#9085](https://github.com/MetaMask/core/pull/9085))
- convert quotes to QuoteResponse v2 in `fetchBridgeQuoteStream`
- store quotes as QuoteResponse v2 in the BridgeController
- `QuoteResponse` export now means v2; v1 is still exported as `QuoteResponseV1`
- `fetchBridgeQuoteStream` and `fetchBatchSellTrades` now return `QuoteResponse` v2
- `fetchBatchSellTrades` expects V2 quotes, then transforms them to V1 for backend compatibility

- Bump `@metamask/assets-controllers` from `^110.0.0` to `^110.0.1` ([#9693](https://github.com/MetaMask/core/pull/9693), [#9706](https://github.com/MetaMask/core/pull/9706))
- Bump `@metamask/transaction-controller` from `^69.2.1` to `^69.3.0` ([#9693](https://github.com/MetaMask/core/pull/9693))
- Bump `@metamask/assets-controller` from `^11.2.1` to `^11.3.1` ([#9693](https://github.com/MetaMask/core/pull/9693), [#9706](https://github.com/MetaMask/core/pull/9706))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,15 @@ exports[`BridgeController SSE should publish validation failures 4`] = `
"chain_id_destination": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
"chain_id_source": "eip155:1",
"failures": [
"lifi|trade",
"lifi|trade.chainId",
"lifi|trade.to",
"lifi|trade.from",
"lifi|trade.value",
"lifi|trade.data",
"lifi|trade.gasLimit",
"lifi|trade.unsignedPsbtBase64",
"lifi|trade.inputsToSign",
"lifi|trade.raw_data_hex",
"lifi|trade.xdrBase64",
"lifi|trade.xdr",
"lifi|quote.src",
"lifi|quote.dest",
"lifi|quote.feeData.metabridge",
"lifi|quote.aggregator",
"lifi|quote.protocols",
"lifi|quote.steps.0.src",
"lifi|quote.steps.0.dest",
"lifi|quote.steps.1.src",
"lifi|quote.steps.1.dest",
],
"feature_id": "unified_swap_bridge",
"location": "Unknown",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ import type {
} from '@metamask/messenger';

import { flushPromises } from '../../../tests/helpers.js';
import { mockBridgeQuotesErc20Erc20V1 } from '../tests/mock-quotes-erc20-erc20.js';
import { mockBridgeQuotesNativeErc20V1 } from '../tests/mock-quotes-native-erc20.js';
import {
getMockBridgeQuotesErc20Erc20V2,
mockBridgeQuotesErc20Erc20V1,
} from '../tests/mock-quotes-erc20-erc20.js';
import {
getMockBridgeQuotesNativeErc20V2,
mockBridgeQuotesNativeErc20V1,
} from '../tests/mock-quotes-native-erc20.js';
import {
advanceToNthTimerThenFlush,
mockSseBatchSellEventSource,
Expand Down Expand Up @@ -419,7 +425,7 @@ describe('BridgeController BatchSell (multiple quote requests) SSE', function ()
resetApproval: false,
},
],
quotes: mockBridgeQuotesNativeErc20V1
quotes: getMockBridgeQuotesNativeErc20V2()
.map((quote) => ({
...quote,
l1GasFeesInHexWei: '0x1',
Expand All @@ -428,13 +434,15 @@ describe('BridgeController BatchSell (multiple quote requests) SSE', function ()
featureId: FeatureId.BATCH_SELL,
}))
.concat(
mockBridgeQuotesErc20Erc20V1.map((quote) => ({
...quote,
l1GasFeesInHexWei: '0x2',
resetApproval: undefined,
quoteRequestIndex: 1,
featureId: FeatureId.BATCH_SELL,
})),
getMockBridgeQuotesErc20Erc20V2({ quoteRequestIndex: 1 }).map(
(quote) => ({
...quote,
l1GasFeesInHexWei: '0x2',
resetApproval: undefined,
quoteRequestIndex: 1,
featureId: FeatureId.BATCH_SELL,
}),
),
),
quotesRefreshCount: 1,
quotesLoadingStatus: 1,
Expand Down Expand Up @@ -642,7 +650,7 @@ describe('BridgeController BatchSell (multiple quote requests) SSE', function ()
);
await rootMessenger.call(
'BridgeController:updateBatchSellTrades',
mockBridgeQuotesErc20Erc20V1,
getMockBridgeQuotesErc20Erc20V2(),
false,
);

Expand Down Expand Up @@ -682,7 +690,7 @@ describe('BridgeController BatchSell (multiple quote requests) SSE', function ()
'13.8.0',
]);
expect(fetchBatchSellTradesSpy.mock.calls[1]).toStrictEqual([
mockBridgeQuotesErc20Erc20V1,
getMockBridgeQuotesErc20Erc20V2(),
false,
expect.any(AbortSignal),
'extension',
Expand Down Expand Up @@ -879,7 +887,7 @@ describe('BridgeController BatchSell (multiple quote requests) SSE', function ()
// 2nd fetch
await rootMessenger.call(
'BridgeController:updateBatchSellTrades',
mockBridgeQuotesErc20Erc20V1,
getMockBridgeQuotesErc20Erc20V2(),
false,
);

Expand All @@ -889,7 +897,7 @@ describe('BridgeController BatchSell (multiple quote requests) SSE', function ()
expect(stopAllPollingSpy).toHaveBeenCalledTimes(0);
expect(abortControllerSpy).toHaveBeenCalledTimes(1);
expect(fetchBatchSellTradesSpy.mock.calls[1][0]).toStrictEqual(
mockBridgeQuotesErc20Erc20V1,
getMockBridgeQuotesErc20Erc20V2(),
);
expect(startPollingSpy).not.toHaveBeenCalled();
expect(bridgeController.state.batchSellTrades).toBeNull();
Expand Down
Loading
Loading