feat(wallet): add opt-in ramps initialization configs#9290
feat(wallet): add opt-in ramps initialization configs#9290georgeweiler wants to merge 6 commits into
Conversation
Export RampsService, RampsController, and TransakService wallet init configurations for clients that opt in, bumping @metamask/wallet to 4.1.0. Co-authored-by: Cursor <cursoragent@cursor.com>
ff63aca to
5ad0e0f
Compare
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
- Remove rampsController/rampsService/transakService slots from
InstanceSpecificOptions — opt-in configs are self-contained and
should not leak into the default options surface
- Use indexed access into RampsControllerOptions for requestCacheTTL
and requestCacheMaxSize to stay coupled to the upstream type
- Document AuthenticationController:getBearerToken prerequisite on
the rampsService export so consumers know what must be registered
- Replace client-specific context strings ('extension', 'mobile-ios')
with 'test' in unit tests
- Add ramps instance directory to CODEOWNERS under money-movement
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Restore rampsController/rampsService/transakService slots in InstanceSpecificOptions — the InitializationConfiguration type derives options typing from this map, removing them makes options unknown throughout all three init functions - Add type casts (as never) for parent and actions in ramps messenger construction — ramps messenger types require parent actions (RampsService:*, TransakService:*, AuthenticationController:getBearerToken) not present in DefaultActions, since these are opt-in configs - Bump @metamask/ramps-controller dep from ^14.3.0 to ^15.0.0 to satisfy yarn constraints - Bump @metamask/wallet dep in wallet-cli from ^5.0.0 to ^5.1.0 - Bump root monorepo version from 1077.0.0 to 1078.0.0 - Add [5.1.0] CHANGELOG section with footer links Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Run readme-content:update to regenerate dependency graph after adding @metamask/ramps-controller to wallet's dependencies - Add PR link and dep bump entry to wallet [5.1.0] changelog section - Update wallet-cli changelog to reflect @metamask/wallet ^5.1.0 bump Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The test files are nested at ramps/<name>/ so the path to initialization/defaults.ts is ../../../defaults, not ../../defaults. Fixes lint:dependencies unresolved import failures. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| { | ||
| "name": "@metamask/core-monorepo", | ||
| "version": "1077.0.0", | ||
| "version": "1078.0.0", |
There was a problem hiding this comment.
| "version": "1078.0.0", | |
| "version": "1077.0.0", |
Revert the root + wallet version bumps, move the two entries back under ## [Unreleased] (keep 5.0.0 section verbatim, no [5.1.0] link/section), and drop the wallet-cli dep bump. Touching the root package.json version is exclusively create-release-branch's job, no feature PR should do it.
| rampsController?: RampsControllerInstanceOptions; | ||
| rampsService?: RampsServiceInstanceOptions; | ||
| remoteFeatureFlagController: RemoteFeatureFlagControllerInstanceOptions; | ||
| storageService: StorageServiceInstanceOptions; | ||
| transakService?: TransakServiceInstanceOptions; |
There was a problem hiding this comment.
Here these are typed as optional but RampsServiceInstanceOptions.context/fetch and TransakServiceInstanceOptions.context/fetch are required. Consider validating the required options in init and throwing a clear error.
There was a problem hiding this comment.
If any of the underlying instance options are required, please mark them as required here too.
| parent: parent as never, | ||
| }); | ||
|
|
||
| parent.delegate({ | ||
| messenger, | ||
| actions: ['AuthenticationController:getBearerToken'] as never[], |
There was a problem hiding this comment.
The as never[] casts seem like an acceptable unavoidable workaround, but please contain them in a shared createOptInMessenger helper so the delegated action names stay type-checked, as written, a typo in an action string compiles and only fails at runtime (AuthenticationController:getBererToken typo now compiles and only fails at runtime)
| environment: options.environment, | ||
| context: options.context, | ||
| fetch: options.fetch, | ||
| policyOptions: options.policyOptions, | ||
| baseUrlOverride: options.baseUrlOverride, |
There was a problem hiding this comment.
Are none of these able to be standardized across clients?
| context: options.context, | ||
| fetch: options.fetch, | ||
| apiKey: options.apiKey, | ||
| policyOptions: options.policyOptions, | ||
| orderRetryDelayMs: options.orderRetryDelayMs, |
There was a problem hiding this comment.
Same question here, can none of these be standardized?
| import { InitializationConfiguration } from '../../../types'; | ||
|
|
||
| /** | ||
| * Opt-in initialization config for `RampsService`. |
There was a problem hiding this comment.
Why would we not want all of these initialization configs to be included by default?
Summary
@metamask/walletinitialization configs forRampsService,RampsController, andTransakServiceunder@metamask/wallet/initialization/instances/ramps.@metamask/walletto 4.1.0 and add@metamask/ramps-controlleras a dependency.@metamask/ramps-controllerpackage itself.Test plan
yarn workspace @metamask/wallet run jest --no-coverage --testPathPattern=ramps --watchman=falseyarn workspace @metamask/wallet run buildMade with Cursor