Skip to content

Commit a45a34a

Browse files
authored
Merge branch 'develop' into salim/ignore-tokens-non-current-network
2 parents 9787615 + 2e2edb5 commit a45a34a

File tree

105 files changed

+3824
-1002
lines changed

Some content is hidden

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

105 files changed

+3824
-1002
lines changed

.circleci/config.yml

+10-5
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,11 @@ workflows:
103103
test_and_release:
104104
when:
105105
not:
106-
matches:
107-
pattern: /^l10n_crowdin_action$/
108-
value: << pipeline.git.branch >>
106+
or:
107+
- matches:
108+
pattern: /^l10n_crowdin_action$/
109+
value: << pipeline.git.branch >>
110+
- equal: [rerun-from-failed, << pipeline.schedule.name >>]
109111
jobs:
110112
- create_release_pull_request:
111113
<<: *rc_branch_only
@@ -176,6 +178,7 @@ workflows:
176178
- prep-build-test-mmi:
177179
requires:
178180
- prep-deps
181+
- check-mmi-trigger
179182
- prep-build-test-mmi-playwright:
180183
requires:
181184
- prep-deps
@@ -358,8 +361,7 @@ workflows:
358361

359362
rerun-from-failed:
360363
when:
361-
condition:
362-
equal: ["<< pipeline.schedule.name >>", "rerun-from-failed"]
364+
equal: [rerun-from-failed, << pipeline.schedule.name >>]
363365
jobs:
364366
- prep-deps
365367
- rerun-workflows-from-failed:
@@ -802,6 +804,7 @@ jobs:
802804
- run: corepack enable
803805
- attach_workspace:
804806
at: .
807+
- run: *check-mmi-trigger
805808
- run:
806809
name: Build extension for testing
807810
command: yarn build:test:mmi
@@ -1196,6 +1199,7 @@ jobs:
11961199
- run: sudo corepack enable
11971200
- attach_workspace:
11981201
at: .
1202+
- run: *check-mmi-trigger
11991203
- run:
12001204
name: Move test build to dist
12011205
command: mv ./dist-test-mmi ./dist
@@ -1285,6 +1289,7 @@ jobs:
12851289
- run: sudo corepack enable
12861290
- attach_workspace:
12871291
at: .
1292+
- run: *check-mmi-trigger
12881293
- run:
12891294
name: Move test build to dist
12901295
command: mv ./dist-test-mmi ./dist

.github/workflows/sonarcloud.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ name: SonarCloud
88
on:
99
workflow_run:
1010
workflows:
11-
- Run tests
11+
- Main
1212
types:
1313
- completed
1414

app/_locales/de/messages.json

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/_locales/el/messages.json

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/_locales/en/messages.json

+13-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/_locales/es/messages.json

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/_locales/fr/messages.json

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/_locales/hi/messages.json

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/_locales/id/messages.json

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/_locales/ja/messages.json

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/_locales/ko/messages.json

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/_locales/pt/messages.json

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/_locales/ru/messages.json

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/_locales/tl/messages.json

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/_locales/tr/messages.json

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/_locales/vi/messages.json

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/_locales/zh_CN/messages.json

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/scripts/controllers/swaps/index.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -383,12 +383,11 @@ export default class SwapsController extends BaseController<
383383
const [firstQuote] = Object.values(newQuotes);
384384

385385
// For a user to be able to swap a token, they need to have approved the MetaSwap contract to withdraw that token.
386-
// _getERC20Allowance() returns the amount of the token they have approved for withdrawal. If that amount is greater
387-
// than 0, it means that approval has already occurred and is not needed. Otherwise, for tokens to be swapped, a new
388-
// call of the ERC-20 approve method is required.
386+
// _getERC20Allowance() returns the amount of the token they have approved for withdrawal. If that amount is either
387+
// zero or less than the soucreAmount of the swap, a new call of the ERC-20 approve method is required.
389388
approvalRequired =
390389
firstQuote.approvalNeeded &&
391-
allowance.eq(0) &&
390+
(allowance.eq(0) || allowance.lt(firstQuote.sourceAmount)) &&
392391
firstQuote.aggregator !== 'wrappedNative';
393392
if (!approvalRequired) {
394393
newQuotes = mapValues(newQuotes, (quote) => ({

app/scripts/lib/manifestFlags.ts

+9
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export type ManifestFlags = {
1111
};
1212
sentry?: {
1313
tracesSampleRate?: number;
14+
lazyLoadSubSampleRate?: number; // multiply by tracesSampleRate to get the actual probability
1415
forceEnable?: boolean;
1516
};
1617
};
@@ -27,6 +28,14 @@ interface WebExtensionManifestWithFlags
2728
* @returns flags if they exist, otherwise an empty object
2829
*/
2930
export function getManifestFlags(): ManifestFlags {
31+
// If this is running in a unit test, there's no manifest, so just return an empty object
32+
if (
33+
process.env.JEST_WORKER_ID === undefined ||
34+
!browser.runtime.getManifest
35+
) {
36+
return {};
37+
}
38+
3039
return (
3140
(browser.runtime.getManifest() as WebExtensionManifestWithFlags)._flags ||
3241
{}

0 commit comments

Comments
 (0)