Skip to content

Commit 56d13db

Browse files
authored
Merge branch 'main' into swaps-sse-follow-up
2 parents 0bbcbf1 + c50e35a commit 56d13db

File tree

55 files changed

+652
-627
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+652
-627
lines changed

.storybook/test-data.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,7 @@ const state = {
690690
],
691691
accountsAssets: {},
692692
assetsMetadata: {},
693+
allIgnoredAssets: {},
693694
balances: {},
694695
conversionRates: {},
695696
networkConfigurationsByChainId: {},

.yarn/patches/@metamask-controller-utils-npm-11.14.1-15745fecdc.patch

Lines changed: 0 additions & 261 deletions
This file was deleted.

app/_locales/en/messages.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/_locales/en_GB/messages.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/scripts/constants/sentry-state.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export const SENTRY_BACKGROUND_STATE = {
102102
MultichainAssetsController: {
103103
accountsAssets: false,
104104
assetsMetadata: false,
105+
allIgnoredAssets: false,
105106
},
106107
MultichainAssetsRatesController: {
107108
assetsRates: false,

app/scripts/controller-init/currency-rate-controller-init.test.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { CurrencyRateController } from '@metamask/assets-controllers';
1+
import {
2+
CodefiTokenPricesServiceV2,
3+
CurrencyRateController,
4+
} from '@metamask/assets-controllers';
25
import { getRootMessenger } from '../lib/messenger';
36
import { ControllerInitRequest } from './types';
47
import { buildControllerInitRequestMock } from './test/utils';
@@ -15,6 +18,15 @@ jest.mock('@metamask/assets-controllers', () => ({
1518
// This is needed since the controller init tries to override this function.
1619
fetchMultiExchangeRate = jest.fn();
1720
},
21+
CodefiTokenPricesServiceV2: class {
22+
fetchTokenPrices = jest.fn();
23+
24+
fetchExchangeRates = jest.fn();
25+
26+
validateChainIdSupported = jest.fn();
27+
28+
validateCurrencySupported = jest.fn();
29+
},
1830
}));
1931

2032
function getInitRequestMock(): jest.Mocked<
@@ -29,6 +41,7 @@ function getInitRequestMock(): jest.Mocked<
2941
...buildControllerInitRequestMock(),
3042
controllerMessenger: getCurrencyRateControllerMessenger(baseMessenger),
3143
initMessenger: getCurrencyRateControllerInitMessenger(baseMessenger),
44+
tokenPricesService: new CodefiTokenPricesServiceV2(),
3245
};
3346

3447
return requestMock;

app/scripts/controller-init/currency-rate-controller-init.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { CurrencyRateController } from '@metamask/assets-controllers';
1+
import {
2+
CodefiTokenPricesServiceV2,
3+
CurrencyRateController,
4+
} from '@metamask/assets-controllers';
25
import {
36
CurrencyRateControllerInitMessenger,
47
CurrencyRateControllerMessenger,
@@ -28,6 +31,7 @@ export const CurrencyRateControllerInit: ControllerInitFunction<
2831
includeUsdRate: true,
2932
useExternalServices: () =>
3033
initMessenger.call('PreferencesController:getState').useExternalServices,
34+
tokenPricesService: new CodefiTokenPricesServiceV2(),
3135
});
3236

3337
// TODO: This logic should be ported to `CurrencyRateController` directly.

app/scripts/lib/smart-transaction/smart-transactions.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,31 @@ describe('submitSmartTransactionHook', () => {
285285
throw new Error('Backend call to /getFees failed');
286286
});
287287
const result = await submitSmartTransactionHook(request);
288+
expect(request.smartTransactionsController.getFees).toHaveBeenCalled();
288289
expect(endFlowSpy).toHaveBeenCalledWith({
289290
id: 'approvalId',
290291
});
291292
expect(result).toEqual({ transactionHash: undefined });
292293
});
293294
});
294295

296+
it('skips getting fees if the transaction is signed and sponsored', async () => {
297+
withRequest(async ({ request }) => {
298+
request.transactionMeta.isGasFeeSponsored = true;
299+
request.featureFlags.smartTransactions.extensionReturnTxHashAsap = true;
300+
301+
const result = await submitSmartTransactionHook(request);
302+
303+
expect(
304+
request.smartTransactionsController.getFees,
305+
).not.toHaveBeenCalled();
306+
expect(
307+
request.smartTransactionsController.submitSignedTransactions,
308+
).toHaveBeenCalled();
309+
expect(result).toEqual({ transactionHash: txHash });
310+
});
311+
});
312+
295313
it('returns a txHash asap if the feature flag requires it', async () => {
296314
withRequest(async ({ request }) => {
297315
request.featureFlags.smartTransactions.extensionReturnTxHashAsap = true;

0 commit comments

Comments
 (0)