Skip to content

Commit 0458e05

Browse files
authored
Merge branch 'main' into feat/ondo-rwa-data
2 parents eccba41 + a76be1a commit 0458e05

18 files changed

Lines changed: 1044 additions & 11 deletions

eslint-suppressions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@
687687
},
688688
"packages/bridge-controller/src/utils/metrics/types.ts": {
689689
"@typescript-eslint/naming-convention": {
690-
"count": 81
690+
"count": 83
691691
}
692692
},
693693
"packages/bridge-controller/src/utils/quote-fees.ts": {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@metamask/core-monorepo",
3-
"version": "748.0.0",
3+
"version": "749.0.0",
44
"private": true,
55
"description": "Monorepo for packages shared between MetaMask clients",
66
"repository": {

packages/bridge-controller/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Add `has_gas_included_quote` property to `QuoteFetchData` type and compute it in `QuotesReceived` event to indicate if any received quote has gas included ([#7611](https://github.com/MetaMask/core/pull/7611))
13+
- Add optional `usd_balance_source` property to `QuotesReceived` event and `getQuotesReceivedProperties` utility to allow clients to pass the source token balance in USD ([#7611](https://github.com/MetaMask/core/pull/7611))
14+
1015
## [64.4.1]
1116

1217
### Changed

packages/bridge-controller/src/__snapshots__/bridge-controller.test.ts.snap

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ Array [
105105
"error_message": "error_message",
106106
"gas_included": false,
107107
"gas_included_7702": false,
108+
"has_gas_included_quote": false,
108109
"initial_load_time_all_quotes": 0,
109110
"is_hardware_wallet": false,
110111
"price_impact": 0,
@@ -141,6 +142,7 @@ Array [
141142
"error_message": "Failed to submit tx",
142143
"gas_included": false,
143144
"gas_included_7702": false,
145+
"has_gas_included_quote": false,
144146
"initial_load_time_all_quotes": 0,
145147
"is_hardware_wallet": false,
146148
"price_impact": 12,
@@ -219,6 +221,7 @@ Array [
219221
"chain_id_source": "eip155:1",
220222
"custom_slippage": false,
221223
"gas_included": false,
224+
"has_gas_included_quote": false,
222225
"initial_load_time_all_quotes": 0,
223226
"is_hardware_wallet": false,
224227
"price_impact": 6,
@@ -248,6 +251,7 @@ Array [
248251
"chain_id_source": "eip155:1",
249252
"custom_slippage": false,
250253
"gas_included": false,
254+
"has_gas_included_quote": false,
251255
"initial_load_time_all_quotes": 0,
252256
"is_hardware_wallet": false,
253257
"price_impact": 6,
@@ -349,6 +353,7 @@ Array [
349353
"custom_slippage": false,
350354
"gas_included": false,
351355
"gas_included_7702": false,
356+
"has_gas_included_quote": false,
352357
"initial_load_time_all_quotes": 0,
353358
"is_best_quote": true,
354359
"is_hardware_wallet": false,
@@ -390,6 +395,7 @@ Array [
390395
"custom_slippage": false,
391396
"gas_included": false,
392397
"gas_included_7702": false,
398+
"has_gas_included_quote": false,
393399
"initial_load_time_all_quotes": 0,
394400
"is_hardware_wallet": false,
395401
"price_impact": 0,
@@ -402,6 +408,7 @@ Array [
402408
"swap_type": "crosschain",
403409
"token_address_destination": null,
404410
"token_address_source": "eip155:1/slip44:60",
411+
"usd_balance_source": 0,
405412
"usd_quoted_gas": 0,
406413
"usd_quoted_return": 100,
407414
"warnings": Array [
@@ -478,6 +485,7 @@ Array [
478485
"custom_slippage": true,
479486
"gas_included": false,
480487
"gas_included_7702": false,
488+
"has_gas_included_quote": false,
481489
"initial_load_time_all_quotes": 11000,
482490
"is_hardware_wallet": false,
483491
"price_impact": 0,
@@ -493,6 +501,7 @@ Array [
493501
"swap_type": "crosschain",
494502
"token_address_destination": "eip155:10/erc20:0x123",
495503
"token_address_source": "eip155:1/slip44:60",
504+
"usd_balance_source": 0,
496505
"usd_quoted_gas": 0,
497506
"usd_quoted_return": 100,
498507
"warnings": Array [

packages/bridge-controller/src/bridge-controller.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,7 @@ describe('BridgeController', function () {
11161116
provider: 'provider_bridge',
11171117
best_quote_provider: 'provider_bridge2',
11181118
can_submit: true,
1119+
usd_balance_source: 0,
11191120
},
11201121
);
11211122

@@ -2366,6 +2367,7 @@ describe('BridgeController', function () {
23662367
provider: 'provider_bridge',
23672368
best_quote_provider: 'provider_bridge2',
23682369
can_submit: true,
2370+
usd_balance_source: 0,
23692371
},
23702372
);
23712373
expect(messengerMock.call.mock.calls).toMatchSnapshot();
@@ -2669,6 +2671,7 @@ describe('BridgeController', function () {
26692671
provider: 'provider_bridge',
26702672
best_quote_provider: 'provider_bridge2',
26712673
can_submit: true,
2674+
usd_balance_source: 0,
26722675
},
26732676
);
26742677
expect(trackMetaMetricsFn).toHaveBeenCalledTimes(0);

packages/bridge-controller/src/bridge-controller.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,9 @@ export class BridgeController extends StaticIntervalPollingController<BridgePoll
867867
formatProviderLabel(quote),
868868
),
869869
initial_load_time_all_quotes: this.state.quotesInitialLoadTime ?? 0,
870+
has_gas_included_quote: this.state.quotes.some(
871+
({ quote }) => quote.gasIncluded,
872+
),
870873
};
871874
};
872875

packages/bridge-controller/src/utils/metrics/properties.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ describe('properties', () => {
368368
"price_impact": 0,
369369
"provider": "bridge1_bridge1",
370370
"quoted_time_minutes": 1,
371+
"usd_balance_source": 0,
371372
"usd_quoted_gas": 0,
372373
"usd_quoted_return": 0,
373374
"warnings": Array [],

packages/bridge-controller/src/utils/metrics/properties.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ export const getQuotesReceivedProperties = (
127127
warnings: QuoteWarning[] = [],
128128
isSubmittable: boolean = true,
129129
recommendedQuote?: null | (QuoteResponse & Partial<QuoteMetadata>),
130+
usdBalanceSource?: number,
130131
) => {
131132
const provider = activeQuote ? formatProviderLabel(activeQuote.quote) : '_';
132133
return {
@@ -138,6 +139,7 @@ export const getQuotesReceivedProperties = (
138139
: 0,
139140
usd_quoted_gas: Number(activeQuote?.gasFee?.effective?.usd ?? 0),
140141
usd_quoted_return: Number(activeQuote?.toTokenAmount?.usd ?? 0),
142+
usd_balance_source: usdBalanceSource ?? 0,
141143
best_quote_provider: recommendedQuote
142144
? formatProviderLabel(recommendedQuote.quote)
143145
: provider,

packages/bridge-controller/src/utils/metrics/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export type QuoteFetchData = {
3737
quotes_list: `${string}_${string}`[];
3838
initial_load_time_all_quotes: number;
3939
price_impact: number;
40+
has_gas_included_quote: boolean;
4041
};
4142

4243
export type TradeData = {
@@ -117,6 +118,7 @@ export type RequiredEventContextFromClient = {
117118
best_quote_provider: QuoteFetchData['best_quote_provider'];
118119
price_impact: QuoteFetchData['price_impact'];
119120
can_submit: QuoteFetchData['can_submit'];
121+
usd_balance_source?: number;
120122
};
121123
[UnifiedSwapBridgeEventName.QuotesError]: Pick<
122124
RequestMetadata,

packages/bridge-status-controller/src/__snapshots__/bridge-status-controller.test.ts.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,6 +1304,7 @@ Array [
13041304
"price_impact": 0,
13051305
"provider": "lifi_across",
13061306
"quoted_time_minutes": 0.25,
1307+
"usd_balance_source": 0,
13071308
"usd_quoted_gas": 2.5778,
13081309
"usd_quoted_return": 0.134214,
13091310
"warnings": Array [

0 commit comments

Comments
 (0)