Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/wallet/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Add `Wallet` class with a bundled controller ensemble (AccountsController, ApprovalController, ConnectivityController, KeyringController, NetworkController, RemoteFeatureFlagController, TransactionController) ([#XXXX](https://github.com/MetaMask/core/pull/XXXX))
- Pass `state` keyed by controller name to the constructor to hydrate from a stored snapshot. Subscribe to `${ControllerName}:stateChanged` events on `wallet.messenger` to write changes back to your storage backend. See the README for details.
- Add optional `prevClientVersion` field to `WalletOptions` ([#XXXX](https://github.com/MetaMask/core/pull/XXXX))
- Passed to `RemoteFeatureFlagController` to trigger cache invalidation when the client version changes.
- Add optional `fetch` field to `WalletOptions` ([#XXXX](https://github.com/MetaMask/core/pull/XXXX))
- Overrides the `fetch` implementation used by `NetworkController`'s RPC service. Defaults to `globalThis.fetch`. Allows platform-specific fetch implementations (e.g. React Native) to be injected.

[Unreleased]: https://github.com/MetaMask/core/
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const networkController: InitializationConfiguration<
> = {
name: 'NetworkController',
init: ({ state, messenger, options }) => {
const fetchFn = globalThis.fetch.bind(globalThis);
const fetchFn = options.fetch ?? globalThis.fetch.bind(globalThis);

const getRpcServiceOptions: NetworkControllerOptions['getRpcServiceOptions'] =
() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const remoteFeatureFlagController: InitializationConfiguration<
state,
messenger,
clientVersion: options.clientVersion,
prevClientVersion: options.prevClientVersion,
clientConfigApiService: options.clientConfigApiService,
getMetaMetricsId: options.getMetaMetricsId,
});
Expand Down
2 changes: 2 additions & 0 deletions packages/wallet/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export type WalletOptions = {
state?: Record<string, Record<string, Json>>;
infuraProjectId: string;
clientVersion: string;
prevClientVersion?: string;
fetch?: typeof globalThis.fetch;
showApprovalRequest: () => void;
clientConfigApiService: ClientConfigApiService;
getMetaMetricsId: () => string;
Expand Down
Loading