Skip to content

Commit 28cf97f

Browse files
authored
feat: client integration for auxiliaryFunds + requiredAssets support (EIP-7682) (#19965)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** This PR consists in client integration of the `auxiliaryFunds` and `requiredAssets` capabilities defined under [ERC-7682](https://eips.ethereum.org/EIPS/eip-7682) to enable auxiliary funds flows. _Important: this capability isn't usable yet, but will later be wired up by @MetaMask/confirmations team._ <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: Add `auxiliaryFunds` + `requiredAssets` support defined under [ERC-7682](https://eips.ethereum.org/EIPS/eip-7682) ([#19965](#19965)) ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/WAPI-409 ## **Manual testing steps** ```gherkin Feature: auxiliaryFunds support Scenario: user has wallet permissions Given support for EIP 7682 is enabled When user requests `wallet_getCapabilities` (via https://metamask.github.io/test-dapp) Then `auxiliaryFunds` should be returned as a supported capability ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
1 parent 9ebf9e4 commit 28cf97f

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

app/core/BackgroundBridge/BackgroundBridge.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ import {
7171
getSessionScopes,
7272
KnownSessionProperties,
7373
} from '@metamask/chain-agnostic-permission';
74+
import { ALLOWED_BRIDGE_CHAIN_IDS } from '@metamask/bridge-controller';
7475
import {
7576
makeMethodMiddlewareMaker,
7677
UNSUPPORTED_RPC_METHODS,
@@ -813,6 +814,8 @@ export class BackgroundBridge extends EventEmitter {
813814
transactionMeta: { chainId },
814815
securityAlertId,
815816
}),
817+
isAuxiliaryFundsSupported: (chainId) =>
818+
ALLOWED_BRIDGE_CHAIN_IDS.includes(chainId),
816819
},
817820
Engine.controllerMessenger,
818821
),
@@ -848,6 +851,8 @@ export class BackgroundBridge extends EventEmitter {
848851
{},
849852
);
850853
},
854+
isAuxiliaryFundsSupported: (chainId) =>
855+
ALLOWED_BRIDGE_CHAIN_IDS.includes(chainId),
851856
},
852857
Engine.controllerMessenger,
853858
),

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@
239239
"@metamask/design-system-twrnc-preset": "^0.2.1",
240240
"@metamask/design-tokens": "^8.1.1",
241241
"@metamask/earn-controller": "^7.0.0",
242-
"@metamask/eip-5792-middleware": "^1.1.0",
242+
"@metamask/eip-5792-middleware": "^1.2.0",
243243
"@metamask/eip1193-permission-middleware": "^1.0.0",
244244
"@metamask/error-reporting-service": "^2.0.0",
245245
"@metamask/eth-hd-keyring": "^12.1.0",

yarn.lock

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5192,15 +5192,16 @@
51925192
"@metamask/stake-sdk" "^3.2.1"
51935193
reselect "^5.1.1"
51945194

5195-
"@metamask/eip-5792-middleware@^1.1.0":
5196-
version "1.1.0"
5197-
resolved "https://registry.yarnpkg.com/@metamask/eip-5792-middleware/-/eip-5792-middleware-1.1.0.tgz#3dc25e31711f0045766da9d473ae9306de75d2df"
5198-
integrity sha512-zgI9uLSwi+U2x2fkIFMViI/RFJQFGp2B38YoWSgIQ1L7kshy0p0eNYrkOXnNX5Y+oDfbZLTSJeeAYBQ+suSNcA==
5195+
"@metamask/eip-5792-middleware@^1.2.0":
5196+
version "1.2.0"
5197+
resolved "https://registry.yarnpkg.com/@metamask/eip-5792-middleware/-/eip-5792-middleware-1.2.0.tgz#c47d9e56caf103ae1c56f883b2e77b42826865cc"
5198+
integrity sha512-BWTxQlsZLNgCw8fgHH5AtSbNkwSnWSYQC5SndDpIp0byq0YXK8GK+0/DezbNRoAoPbf32QQ3bAYJPawMGcd0Bg==
51995199
dependencies:
52005200
"@metamask/eth-json-rpc-middleware" "^17.0.1"
52015201
"@metamask/superstruct" "^3.1.0"
5202-
"@metamask/transaction-controller" "^60.2.0"
5203-
"@metamask/utils" "^11.4.2"
5202+
"@metamask/transaction-controller" "^60.4.0"
5203+
"@metamask/utils" "^11.8.0"
5204+
lodash "^4.17.21"
52045205
uuid "^8.3.2"
52055206

52065207
"@metamask/eip1193-permission-middleware@^1.0.0":
@@ -6334,10 +6335,10 @@
63346335
"@toruslabs/http-helpers" "^8.1.1"
63356336
bn.js "^5.2.1"
63366337

6337-
"@metamask/transaction-controller@^60.2.0", "@metamask/transaction-controller@^60.3.0":
6338-
version "60.3.0"
6339-
resolved "https://registry.yarnpkg.com/@metamask/transaction-controller/-/transaction-controller-60.3.0.tgz#acb1f8bfae954e484c494bd631cb93db1e4dc067"
6340-
integrity sha512-dFgK72ckx98PkmxWQx+j3ODCB06uY0lj4hZxtW1Hx3szW0mmDb+tuqdY0Z+vbv8vyf0S1ZSFDD5CDxz7CMM69A==
6338+
"@metamask/transaction-controller@^60.3.0", "@metamask/transaction-controller@^60.4.0":
6339+
version "60.4.0"
6340+
resolved "https://registry.yarnpkg.com/@metamask/transaction-controller/-/transaction-controller-60.4.0.tgz#15b30016c324ee7b6f403b59206b40f1fdd6d516"
6341+
integrity sha512-sIV5cnt4pqgX0i7C7s7su1QOVO1d30Ldb7O14P5tWCHlDGZ/+XRBe7h7gOd9XeMweF1HJpYnhKfZJEgJ/XX6Eg==
63416342
dependencies:
63426343
"@ethereumjs/common" "^4.4.0"
63436344
"@ethereumjs/tx" "^5.4.0"
@@ -6346,13 +6347,13 @@
63466347
"@ethersproject/contracts" "^5.7.0"
63476348
"@ethersproject/providers" "^5.7.0"
63486349
"@ethersproject/wallet" "^5.7.0"
6349-
"@metamask/base-controller" "^8.3.0"
6350-
"@metamask/controller-utils" "^11.12.0"
6350+
"@metamask/base-controller" "^8.4.0"
6351+
"@metamask/controller-utils" "^11.14.0"
63516352
"@metamask/eth-query" "^4.0.0"
63526353
"@metamask/metamask-eth-abis" "^3.1.1"
63536354
"@metamask/nonce-tracker" "^6.0.0"
63546355
"@metamask/rpc-errors" "^7.0.2"
6355-
"@metamask/utils" "^11.4.2"
6356+
"@metamask/utils" "^11.8.0"
63566357
async-mutex "^0.5.0"
63576358
bn.js "^5.2.1"
63586359
eth-method-registry "^4.0.0"

0 commit comments

Comments
 (0)