Skip to content

Commit

Permalink
Merge branch 'main' into jc/caip25-permission-refactor-main
Browse files Browse the repository at this point in the history
  • Loading branch information
ffmcgee725 committed Jan 23, 2025
2 parents cea8fa8 + 17928df commit f771a58
Show file tree
Hide file tree
Showing 34 changed files with 500 additions and 105 deletions.
24 changes: 23 additions & 1 deletion .github/workflows/update-lavamoat-policies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,33 @@ jobs:
git config --global user.email '[email protected]'
git commit -am "Update LavaMoat policies"
git push
## Yes, it would be nice to use the local diff before the commit is made, but we need to include potential multiple updates in the history of the PR
- name: Compare policy changes
run: |
if [[ $HAS_CHANGES == 'true' ]]
then
git fetch origin ${{ github.base_ref }}
main_diff=$(git diff origin/${{ github.base_ref }} lavamoat/browserify/main/policy.json | md5sum | cut -d' ' -f1)
for folder in lavamoat/browserify/*/; do
if [ "$folder" != "lavamoat/browserify/main/" ]; then
file="${folder}policy.json"
if [ -f "$file" ]; then
diff=$(git diff origin/${{ github.base_ref }} "$file" | md5sum | cut -d' ' -f1)
if [ "$diff" = "$main_diff" ]; then
echo "✅ ${folder}policy.json changes match main/policy.json policy changes"
else
echo "👀 ${folder}policy.json changes **differ from** main/policy.json policy changes"
fi
fi
fi
done > does_diff_diff.txt
fi
## Note the use of `cat -` to include the file contents and the echo in the comment
- name: Post comment
run: |
if [[ $HAS_CHANGES == 'true' ]]
then
echo -e 'Policies updated. \n👀 Please review the diff for suspicious new powers. \n\n🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff' | gh pr comment "${PR_NUMBER}" --body-file -
echo -e 'Policies updated. \n👀 Please review the diff for suspicious new powers. \n\n🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff \n\n' | cat - does_diff_diff.txt | gh pr comment "${PR_NUMBER}" --body-file -
else
gh pr comment "${PR_NUMBER}" --body 'No policy changes'
fi
Expand Down
3 changes: 0 additions & 3 deletions app/_locales/de/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/el/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/en_GB/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/es/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/fr/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/hi/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/id/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/ja/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/ko/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/pt/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/ru/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/tl/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/tr/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/vi/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/zh_CN/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions app/images/mode-sepolia.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions app/images/mode.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ import {
setEthAccounts,
addPermittedEthChainId,
} from '@metamask/multichain';
///: BEGIN:ONLY_INCLUDE_IF(build-flask)
import { MultichainTransactionsController } from '@metamask/multichain-transactions-controller';
///: END:ONLY_INCLUDE_IF
import {
methodsRequiringNetworkSwitch,
methodsThatCanSwitchNetworkWithoutApproval,
Expand Down Expand Up @@ -990,6 +993,27 @@ export default class MetamaskController extends EventEmitter {
state: initState.AnnouncementController,
});

///: BEGIN:ONLY_INCLUDE_IF(build-flask)
const multichainTransactionsControllerMessenger =
this.controllerMessenger.getRestricted({
name: 'MultichainTransactionsController',
allowedEvents: [
'AccountsController:accountAdded',
'AccountsController:accountRemoved',
],
allowedActions: [
'AccountsController:listMultichainAccounts',
'SnapController:handleRequest',
],
});

this.multichainTransactionsController =
new MultichainTransactionsController({
messenger: multichainTransactionsControllerMessenger,
state: initState.MultichainTransactionsController,
});
///: END:ONLY_INCLUDE_IF

const networkOrderMessenger = this.controllerMessenger.getRestricted({
name: 'NetworkOrderController',
allowedEvents: ['NetworkController:stateChange'],
Expand Down Expand Up @@ -2539,6 +2563,9 @@ export default class MetamaskController extends EventEmitter {
AppStateController: this.appStateController,
AppMetadataController: this.appMetadataController,
MultichainBalancesController: this.multichainBalancesController,
///: BEGIN:ONLY_INCLUDE_IF(build-flask)
MultichainTransactionsController: this.multichainTransactionsController,
///: END:ONLY_INCLUDE_IF
TransactionController: this.txController,
KeyringController: this.keyringController,
PreferencesController: this.preferencesController,
Expand Down Expand Up @@ -2595,6 +2622,9 @@ export default class MetamaskController extends EventEmitter {
AppStateController: this.appStateController,
AppMetadataController: this.appMetadataController,
MultichainBalancesController: this.multichainBalancesController,
///: BEGIN:ONLY_INCLUDE_IF(build-flask)
MultichainTransactionsController: this.multichainTransactionsController,
///: END:ONLY_INCLUDE_IF
NetworkController: this.networkController,
KeyringController: this.keyringController,
PreferencesController: this.preferencesController,
Expand Down Expand Up @@ -3292,6 +3322,11 @@ export default class MetamaskController extends EventEmitter {
this.multichainBalancesController.start();
this.multichainBalancesController.updateBalances();

///: BEGIN:ONLY_INCLUDE_IF(build-flask)
this.multichainTransactionsController.start();
this.multichainTransactionsController.updateTransactions();
///: END:ONLY_INCLUDE_IF

this.controllerMessenger.subscribe(
'CurrencyRateController:stateChange',
({ currentCurrency }) => {
Expand Down Expand Up @@ -4413,6 +4448,11 @@ export default class MetamaskController extends EventEmitter {
multichainUpdateBalances: () =>
this.multichainBalancesController.updateBalances(),

///: BEGIN:ONLY_INCLUDE_IF(build-flask)
// MultichainTransactionsController
multichainUpdateTransactions: () =>
this.multichainTransactionsController.updateTransactions(),
///: END:ONLY_INCLUDE_IF
// Transaction Decode
decodeTransactionData: (request) =>
decodeTransactionData({
Expand Down
49 changes: 49 additions & 0 deletions lavamoat/browserify/flask/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,14 @@
"@metamask/keyring-api>bech32": true
}
},
"@metamask/multichain-transactions-controller>@metamask/keyring-api": {
"packages": {
"@metamask/keyring-api>@metamask/keyring-utils": true,
"@metamask/utils>@metamask/superstruct": true,
"@metamask/multichain-transactions-controller>@metamask/utils": true,
"@metamask/keyring-api>bech32": true
}
},
"@metamask/keyring-controller": {
"packages": {
"@ethereumjs/tx>@ethereumjs/util": true,
Expand All @@ -1397,6 +1405,14 @@
"@metamask/keyring-snap-client>uuid": true
}
},
"@metamask/multichain-transactions-controller>@metamask/keyring-snap-client": {
"packages": {
"@metamask/multichain-transactions-controller>@metamask/keyring-api": true,
"@metamask/keyring-api>@metamask/keyring-utils": true,
"@metamask/utils>@metamask/superstruct": true,
"@metamask/multichain-transactions-controller>@metamask/keyring-snap-client>uuid": true
}
},
"@metamask/keyring-api>@metamask/keyring-utils": {
"globals": {
"URL": true
Expand Down Expand Up @@ -1455,6 +1471,19 @@
"lodash": true
}
},
"@metamask/multichain-transactions-controller": {
"globals": {
"clearInterval": true,
"console.error": true,
"setInterval": true
},
"packages": {
"@metamask/base-controller": true,
"@metamask/multichain-transactions-controller>@metamask/keyring-api": true,
"@metamask/multichain-transactions-controller>@metamask/keyring-snap-client": true,
"@metamask/snaps-utils": true
}
},
"@metamask/name-controller": {
"globals": {
"fetch": true
Expand Down Expand Up @@ -2295,6 +2324,21 @@
"semver": true
}
},
"@metamask/multichain-transactions-controller>@metamask/utils": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/utils>@metamask/superstruct": true,
"@noble/hashes": true,
"@metamask/utils>@scure/base": true,
"browserify>buffer": true,
"nock>debug": true,
"@metamask/utils>pony-cause": true,
"semver": true
}
},
"@metamask/name-controller>@metamask/utils": {
"globals": {
"TextDecoder": true,
Expand Down Expand Up @@ -5744,6 +5788,11 @@
"crypto": true
}
},
"@metamask/multichain-transactions-controller>@metamask/keyring-snap-client>uuid": {
"globals": {
"crypto": true
}
},
"eth-lattice-keyring>gridplus-sdk>uuid": {
"globals": {
"crypto": true
Expand Down
Loading

0 comments on commit f771a58

Please sign in to comment.