@metamask/ramps-controller 10.1.0 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -1
- package/dist/RampsController.cjs +11 -1
- package/dist/RampsController.cjs.map +1 -1
- package/dist/RampsController.d.cts.map +1 -1
- package/dist/RampsController.d.mts.map +1 -1
- package/dist/RampsController.mjs +11 -1
- package/dist/RampsController.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [10.2.0]
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- `setSelectedProvider` no longer fetches payment methods when the selected token is explicitly not supported by the new provider, preventing empty payment method state with no user feedback ([#8103](https://github.com/MetaMask/core/pull/8103))
|
|
15
|
+
|
|
10
16
|
## [10.1.0]
|
|
11
17
|
|
|
12
18
|
### Added
|
|
@@ -192,7 +198,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
192
198
|
- Add `OnRampService` for interacting with the OnRamp API
|
|
193
199
|
- Add geolocation detection via IP address lookup
|
|
194
200
|
|
|
195
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/ramps-controller@10.
|
|
201
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/ramps-controller@10.2.0...HEAD
|
|
202
|
+
[10.2.0]: https://github.com/MetaMask/core/compare/@metamask/ramps-controller@10.1.0...@metamask/ramps-controller@10.2.0
|
|
196
203
|
[10.1.0]: https://github.com/MetaMask/core/compare/@metamask/ramps-controller@10.0.0...@metamask/ramps-controller@10.1.0
|
|
197
204
|
[10.0.0]: https://github.com/MetaMask/core/compare/@metamask/ramps-controller@9.0.0...@metamask/ramps-controller@10.0.0
|
|
198
205
|
[9.0.0]: https://github.com/MetaMask/core/compare/@metamask/ramps-controller@8.1.0...@metamask/ramps-controller@9.0.0
|
package/dist/RampsController.cjs
CHANGED
|
@@ -545,11 +545,21 @@ class RampsController extends base_controller_1.BaseController {
|
|
|
545
545
|
if (!provider) {
|
|
546
546
|
throw new Error(`Provider with ID "${providerId}" not found in available providers.`);
|
|
547
547
|
}
|
|
548
|
+
const selectedToken = this.state.tokens.selected;
|
|
549
|
+
const supportedCryptos = provider.supportedCryptoCurrencies;
|
|
550
|
+
// Only fetch payment methods if the selected token is supported by the new
|
|
551
|
+
// provider. If it isn't, the payment methods request would fail or return
|
|
552
|
+
// empty for the wrong reason; the UI will show the Token Not Available modal
|
|
553
|
+
// so the user can change token or pick a different provider.
|
|
554
|
+
const assetId = selectedToken?.assetId;
|
|
555
|
+
const tokenSupportedByProvider = !(assetId && supportedCryptos?.[assetId] === false);
|
|
548
556
|
this.update((state) => {
|
|
549
557
|
state.providers.selected = provider;
|
|
550
558
|
resetResource(state, 'paymentMethods');
|
|
551
559
|
});
|
|
552
|
-
|
|
560
|
+
if (tokenSupportedByProvider) {
|
|
561
|
+
__classPrivateFieldGet(this, _RampsController_instances, "m", _RampsController_fireAndForget).call(this, this.getPaymentMethods(regionCode, { provider: provider.id }));
|
|
562
|
+
}
|
|
553
563
|
}
|
|
554
564
|
/**
|
|
555
565
|
* Initializes the controller by fetching the user's region from geolocation.
|