@metamask/ramps-controller 16.0.0 → 17.1.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 +34 -1
- package/dist/RampsController-method-action-types.cjs.map +1 -1
- package/dist/RampsController-method-action-types.d.cts +15 -1
- package/dist/RampsController-method-action-types.d.cts.map +1 -1
- package/dist/RampsController-method-action-types.d.mts +15 -1
- package/dist/RampsController-method-action-types.d.mts.map +1 -1
- package/dist/RampsController-method-action-types.mjs.map +1 -1
- package/dist/RampsController.cjs +90 -97
- package/dist/RampsController.cjs.map +1 -1
- package/dist/RampsController.d.cts +22 -28
- package/dist/RampsController.d.cts.map +1 -1
- package/dist/RampsController.d.mts +22 -28
- package/dist/RampsController.d.mts.map +1 -1
- package/dist/RampsController.mjs +63 -70
- package/dist/RampsController.mjs.map +1 -1
- package/dist/RampsService-method-action-types.cjs.map +1 -1
- package/dist/RampsService-method-action-types.d.cts.map +1 -1
- package/dist/RampsService-method-action-types.d.mts.map +1 -1
- package/dist/RampsService-method-action-types.mjs.map +1 -1
- package/dist/RampsService.cjs.map +1 -1
- package/dist/RampsService.d.cts.map +1 -1
- package/dist/RampsService.d.mts.map +1 -1
- package/dist/RampsService.mjs.map +1 -1
- package/dist/RequestCache.cjs.map +1 -1
- package/dist/RequestCache.d.cts.map +1 -1
- package/dist/RequestCache.d.mts.map +1 -1
- package/dist/RequestCache.mjs.map +1 -1
- package/dist/TransakService-method-action-types.cjs.map +1 -1
- package/dist/TransakService-method-action-types.d.cts +35 -1
- package/dist/TransakService-method-action-types.d.cts.map +1 -1
- package/dist/TransakService-method-action-types.d.mts +35 -1
- package/dist/TransakService-method-action-types.d.mts.map +1 -1
- package/dist/TransakService-method-action-types.mjs.map +1 -1
- package/dist/TransakService.cjs +128 -12
- package/dist/TransakService.cjs.map +1 -1
- package/dist/TransakService.d.cts +41 -3
- package/dist/TransakService.d.cts.map +1 -1
- package/dist/TransakService.d.mts +41 -3
- package/dist/TransakService.d.mts.map +1 -1
- package/dist/TransakService.mjs +123 -10
- package/dist/TransakService.mjs.map +1 -1
- package/dist/errorNormalization.cjs +84 -0
- package/dist/errorNormalization.cjs.map +1 -0
- package/dist/errorNormalization.d.cts +56 -0
- package/dist/errorNormalization.d.cts.map +1 -0
- package/dist/errorNormalization.d.mts +56 -0
- package/dist/errorNormalization.d.mts.map +1 -0
- package/dist/errorNormalization.mjs +78 -0
- package/dist/errorNormalization.mjs.map +1 -0
- package/dist/featureFlags.cjs +39 -0
- package/dist/featureFlags.cjs.map +1 -0
- package/dist/featureFlags.d.cts +40 -0
- package/dist/featureFlags.d.cts.map +1 -0
- package/dist/featureFlags.d.mts +40 -0
- package/dist/featureFlags.d.mts.map +1 -0
- package/dist/featureFlags.mjs +35 -0
- package/dist/featureFlags.mjs.map +1 -0
- package/dist/index.cjs +49 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +8 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +4 -0
- package/dist/index.mjs.map +1 -1
- package/dist/providerAvailability.cjs +103 -0
- package/dist/providerAvailability.cjs.map +1 -0
- package/dist/providerAvailability.d.cts +76 -0
- package/dist/providerAvailability.d.cts.map +1 -0
- package/dist/providerAvailability.d.mts +76 -0
- package/dist/providerAvailability.d.mts.map +1 -0
- package/dist/providerAvailability.mjs +96 -0
- package/dist/providerAvailability.mjs.map +1 -0
- package/dist/quoteClassification.cjs +44 -0
- package/dist/quoteClassification.cjs.map +1 -0
- package/dist/quoteClassification.d.cts +33 -0
- package/dist/quoteClassification.d.cts.map +1 -0
- package/dist/quoteClassification.d.mts +33 -0
- package/dist/quoteClassification.d.mts.map +1 -0
- package/dist/quoteClassification.mjs +38 -0
- package/dist/quoteClassification.mjs.map +1 -0
- package/dist/selectors.cjs +3 -3
- package/dist/selectors.cjs.map +1 -1
- package/dist/selectors.d.cts.map +1 -1
- package/dist/selectors.d.mts.map +1 -1
- package/dist/selectors.mjs.map +1 -1
- package/dist/transakApiErrorUtils.cjs +5 -5
- package/dist/transakApiErrorUtils.cjs.map +1 -1
- package/dist/transakApiErrorUtils.mjs.map +1 -1
- package/package.json +10 -7
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import type { ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
|
|
2
2
|
import { BaseController } from "@metamask/base-controller";
|
|
3
3
|
import type { Messenger } from "@metamask/messenger";
|
|
4
|
+
import type { RemoteFeatureFlagControllerGetStateAction } from "@metamask/remote-feature-flag-controller";
|
|
4
5
|
import type { RampsControllerMethodActions } from "./RampsController-method-action-types.cjs";
|
|
5
6
|
import type { RampsErrorCode } from "./rampsErrorCodes.cjs";
|
|
7
|
+
import type { RampsServiceGetGeolocationAction, RampsServiceGetCountriesAction, RampsServiceGetTokensAction, RampsServiceGetProvidersAction, RampsServiceGetPaymentMethodsAction, RampsServiceGetQuotesAction, RampsServiceGetBuyWidgetUrlAction, RampsServiceGetOrderAction, RampsServiceGetOrderFromCallbackAction } from "./RampsService-method-action-types.cjs";
|
|
6
8
|
import type { BuyWidget, Country, TokensResponse, Provider, State, RampAction, PaymentMethod, PaymentMethodsResponse, QuotesResponse, Quote, RampsToken, RampsServiceActions, RampsOrder } from "./RampsService.cjs";
|
|
7
9
|
import { RampsOrderStatus } from "./RampsService.cjs";
|
|
8
|
-
import type { RampsServiceGetGeolocationAction, RampsServiceGetCountriesAction, RampsServiceGetTokensAction, RampsServiceGetProvidersAction, RampsServiceGetPaymentMethodsAction, RampsServiceGetQuotesAction, RampsServiceGetBuyWidgetUrlAction, RampsServiceGetOrderAction, RampsServiceGetOrderFromCallbackAction } from "./RampsService-method-action-types.cjs";
|
|
9
10
|
import type { RequestCache as RequestCacheType, RequestState, ExecuteRequestOptions } from "./RequestCache.cjs";
|
|
11
|
+
import type { TransakServiceSetApiKeyAction, TransakServiceSetAccessTokenAction, TransakServiceClearAccessTokenAction, TransakServiceSendUserOtpAction, TransakServiceVerifyUserOtpAction, TransakServiceLogoutAction, TransakServiceGetUserDetailsAction, TransakServiceGetBuyQuoteAction, TransakServiceGetKycRequirementAction, TransakServiceGetAdditionalRequirementsAction, TransakServiceCreateOrderAction, TransakServiceGetOrderAction, TransakServiceGetUserLimitsAction, TransakServiceRequestOttAction, TransakServiceGeneratePaymentWidgetUrlAction, TransakServiceCreateWidgetUrlAction, TransakServiceSubmitPurposeOfUsageFormAction, TransakServicePatchUserAction, TransakServiceSubmitSsnDetailsAction, TransakServiceConfirmPaymentAction, TransakServiceGetTranslationAction, TransakServiceGetIdProofStatusAction, TransakServiceCancelOrderAction, TransakServiceCancelAllActiveOrdersAction, TransakServiceGetActiveOrdersAction } from "./TransakService-method-action-types.cjs";
|
|
10
12
|
import type { TransakAccessToken, TransakUserDetails, TransakBuyQuote, TransakKycRequirement, TransakAdditionalRequirementsResponse, TransakDepositOrder, TransakUserLimits, TransakOttResponse, TransakQuoteTranslation, TransakTranslationRequest, TransakIdProofStatus, TransakOrderPaymentMethod, PatchUserRequestBody, TransakOrder } from "./TransakService.cjs";
|
|
11
13
|
import type { TransakServiceActions } from "./TransakService.cjs";
|
|
12
|
-
import type { TransakServiceSetApiKeyAction, TransakServiceSetAccessTokenAction, TransakServiceClearAccessTokenAction, TransakServiceSendUserOtpAction, TransakServiceVerifyUserOtpAction, TransakServiceLogoutAction, TransakServiceGetUserDetailsAction, TransakServiceGetBuyQuoteAction, TransakServiceGetKycRequirementAction, TransakServiceGetAdditionalRequirementsAction, TransakServiceCreateOrderAction, TransakServiceGetOrderAction, TransakServiceGetUserLimitsAction, TransakServiceRequestOttAction, TransakServiceGeneratePaymentWidgetUrlAction, TransakServiceSubmitPurposeOfUsageFormAction, TransakServicePatchUserAction, TransakServiceSubmitSsnDetailsAction, TransakServiceConfirmPaymentAction, TransakServiceGetTranslationAction, TransakServiceGetIdProofStatusAction, TransakServiceCancelOrderAction, TransakServiceCancelAllActiveOrdersAction, TransakServiceGetActiveOrdersAction } from "./TransakService-method-action-types.cjs";
|
|
13
14
|
/**
|
|
14
15
|
* The name of the {@link RampsController}, used to namespace the
|
|
15
16
|
* controller's actions and events and to namespace the controller's state data
|
|
@@ -157,7 +158,7 @@ export type RampsControllerActions = RampsControllerGetStateAction | RampsContro
|
|
|
157
158
|
/**
|
|
158
159
|
* Actions from other messengers that {@link RampsController} calls.
|
|
159
160
|
*/
|
|
160
|
-
type AllowedActions = RampsServiceGetGeolocationAction | RampsServiceGetCountriesAction | RampsServiceGetTokensAction | RampsServiceGetProvidersAction | RampsServiceGetPaymentMethodsAction | RampsServiceGetQuotesAction | RampsServiceGetBuyWidgetUrlAction | RampsServiceGetOrderAction | RampsServiceGetOrderFromCallbackAction | TransakServiceSetApiKeyAction | TransakServiceSetAccessTokenAction | TransakServiceClearAccessTokenAction | TransakServiceSendUserOtpAction | TransakServiceVerifyUserOtpAction | TransakServiceLogoutAction | TransakServiceGetUserDetailsAction | TransakServiceGetBuyQuoteAction | TransakServiceGetKycRequirementAction | TransakServiceGetAdditionalRequirementsAction | TransakServiceCreateOrderAction | TransakServiceGetOrderAction | TransakServiceGetUserLimitsAction | TransakServiceRequestOttAction | TransakServiceGeneratePaymentWidgetUrlAction | TransakServiceSubmitPurposeOfUsageFormAction | TransakServicePatchUserAction | TransakServiceSubmitSsnDetailsAction | TransakServiceConfirmPaymentAction | TransakServiceGetTranslationAction | TransakServiceGetIdProofStatusAction | TransakServiceCancelOrderAction | TransakServiceCancelAllActiveOrdersAction | TransakServiceGetActiveOrdersAction;
|
|
161
|
+
type AllowedActions = RemoteFeatureFlagControllerGetStateAction | RampsServiceGetGeolocationAction | RampsServiceGetCountriesAction | RampsServiceGetTokensAction | RampsServiceGetProvidersAction | RampsServiceGetPaymentMethodsAction | RampsServiceGetQuotesAction | RampsServiceGetBuyWidgetUrlAction | RampsServiceGetOrderAction | RampsServiceGetOrderFromCallbackAction | TransakServiceSetApiKeyAction | TransakServiceSetAccessTokenAction | TransakServiceClearAccessTokenAction | TransakServiceSendUserOtpAction | TransakServiceVerifyUserOtpAction | TransakServiceLogoutAction | TransakServiceGetUserDetailsAction | TransakServiceGetBuyQuoteAction | TransakServiceGetKycRequirementAction | TransakServiceGetAdditionalRequirementsAction | TransakServiceCreateOrderAction | TransakServiceGetOrderAction | TransakServiceGetUserLimitsAction | TransakServiceRequestOttAction | TransakServiceGeneratePaymentWidgetUrlAction | TransakServiceCreateWidgetUrlAction | TransakServiceSubmitPurposeOfUsageFormAction | TransakServicePatchUserAction | TransakServiceSubmitSsnDetailsAction | TransakServiceConfirmPaymentAction | TransakServiceGetTranslationAction | TransakServiceGetIdProofStatusAction | TransakServiceCancelOrderAction | TransakServiceCancelAllActiveOrdersAction | TransakServiceGetActiveOrdersAction;
|
|
161
162
|
/**
|
|
162
163
|
* Published when the state of {@link RampsController} changes.
|
|
163
164
|
*/
|
|
@@ -189,16 +190,6 @@ export type RampsControllerMessenger = Messenger<typeof controllerName, RampsCon
|
|
|
189
190
|
/**
|
|
190
191
|
* Configuration options for the RampsController.
|
|
191
192
|
*/
|
|
192
|
-
/**
|
|
193
|
-
* Provider-class scope for fiat quote widening, resolved per `getQuotes` call.
|
|
194
|
-
*
|
|
195
|
-
* - `off`: native-only auto-selection (default; preserves prior behaviour).
|
|
196
|
-
* - `in-app`: also quote in-app WebView aggregator providers and select the
|
|
197
|
-
* best in-app quote.
|
|
198
|
-
* - `all`: additionally allow external-browser / custom-action providers
|
|
199
|
-
* (Phase 2).
|
|
200
|
-
*/
|
|
201
|
-
export type ProviderScope = 'off' | 'in-app' | 'all';
|
|
202
193
|
export type RampsControllerOptions = {
|
|
203
194
|
/** The messenger suited for this controller. */
|
|
204
195
|
messenger: RampsControllerMessenger;
|
|
@@ -208,21 +199,15 @@ export type RampsControllerOptions = {
|
|
|
208
199
|
requestCacheTTL?: number;
|
|
209
200
|
/** Maximum number of entries in the request cache. Defaults to 250. */
|
|
210
201
|
requestCacheMaxSize?: number;
|
|
211
|
-
/**
|
|
212
|
-
* Optional callback returning the current provider-class scope for fiat quote
|
|
213
|
-
* widening. Read per `getQuotes` call so a host-side toggle takes effect at
|
|
214
|
-
* runtime without reconstructing the controller. Defaults to `off`
|
|
215
|
-
* (native-only) when omitted.
|
|
216
|
-
*/
|
|
217
|
-
getProviderScope?: () => ProviderScope;
|
|
218
202
|
/**
|
|
219
203
|
* Optional callback returning the default redirect URL to use for the widened
|
|
220
|
-
*
|
|
204
|
+
* quote fetch when the caller omits `redirectUrl`. The quotes API only
|
|
221
205
|
* embeds a `buyURL`/`buyWidget` (the WebView page a non-native provider needs)
|
|
222
206
|
* when a `redirectUrl` is present, so supplying this default lets widened
|
|
223
|
-
*
|
|
224
|
-
* widened path; an explicit caller `redirectUrl` always wins and
|
|
225
|
-
* never injects. Defaults to a callback returning
|
|
207
|
+
* aggregator quotes carry a usable widget URL. Only applied on the
|
|
208
|
+
* widened path; an explicit caller `redirectUrl` always wins and the
|
|
209
|
+
* native-only default never injects. Defaults to a callback returning
|
|
210
|
+
* `undefined` when omitted.
|
|
226
211
|
*/
|
|
227
212
|
getDefaultRedirectUrl?: () => string | undefined;
|
|
228
213
|
};
|
|
@@ -256,13 +241,11 @@ export declare class RampsController extends BaseController<typeof controllerNam
|
|
|
256
241
|
* controller. Missing properties will be filled in with defaults.
|
|
257
242
|
* @param args.requestCacheTTL - Time to live for cached requests in milliseconds.
|
|
258
243
|
* @param args.requestCacheMaxSize - Maximum number of entries in the request cache.
|
|
259
|
-
* @param args.getProviderScope - Optional callback returning the current
|
|
260
|
-
* provider-class scope for fiat quote widening. Defaults to `off`.
|
|
261
244
|
* @param args.getDefaultRedirectUrl - Optional callback returning the default
|
|
262
|
-
* redirect URL used for the widened
|
|
245
|
+
* redirect URL used for the widened quote fetch when the caller omits
|
|
263
246
|
* `redirectUrl`. Defaults to a callback returning `undefined`.
|
|
264
247
|
*/
|
|
265
|
-
constructor({ messenger, state, requestCacheTTL, requestCacheMaxSize,
|
|
248
|
+
constructor({ messenger, state, requestCacheTTL, requestCacheMaxSize, getDefaultRedirectUrl, }: RampsControllerOptions);
|
|
266
249
|
/**
|
|
267
250
|
* Executes a request with caching, deduplication, and at most one in-flight
|
|
268
251
|
* request per resource type.
|
|
@@ -673,6 +656,17 @@ export declare class RampsController extends BaseController<typeof controllerNam
|
|
|
673
656
|
* @returns The fully constructed widget URL string.
|
|
674
657
|
*/
|
|
675
658
|
transakGeneratePaymentWidgetUrl(ottToken: string, quote: TransakBuyQuote, walletAddress: string, extraParams?: Record<string, string>): string;
|
|
659
|
+
/**
|
|
660
|
+
* Creates a Transak payment widget URL via the ramps API proxy, which
|
|
661
|
+
* injects the partner API key server-side. Replaces the OTT flow
|
|
662
|
+
* ({@link transakRequestOtt} + {@link transakGeneratePaymentWidgetUrl}).
|
|
663
|
+
*
|
|
664
|
+
* @param quote - The buy quote to pre-fill in the widget.
|
|
665
|
+
* @param walletAddress - The destination wallet address.
|
|
666
|
+
* @param extraParams - Optional additional widget parameters (e.g. theming).
|
|
667
|
+
* @returns The single-use widget URL.
|
|
668
|
+
*/
|
|
669
|
+
transakCreateWidgetUrl(quote: TransakBuyQuote, walletAddress: string, extraParams?: Record<string, string>): Promise<string>;
|
|
676
670
|
/**
|
|
677
671
|
* Submits the user's purpose of usage form for KYC compliance.
|
|
678
672
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RampsController.d.cts","sourceRoot":"","sources":["../src/RampsController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAE3B,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAE3D,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;
|
|
1
|
+
{"version":3,"file":"RampsController.d.cts","sourceRoot":"","sources":["../src/RampsController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAE3B,kCAAkC;AACnC,OAAO,EAAE,cA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C;;;;;OAKG;IACG,kBAAkB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY/D;;;;;OAKG;IACG,4BAA4B,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;IAStD;;;;OAIG;IACG,sBAAsB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;CAQxD"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import type { ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
|
|
2
2
|
import { BaseController } from "@metamask/base-controller";
|
|
3
3
|
import type { Messenger } from "@metamask/messenger";
|
|
4
|
+
import type { RemoteFeatureFlagControllerGetStateAction } from "@metamask/remote-feature-flag-controller";
|
|
4
5
|
import type { RampsControllerMethodActions } from "./RampsController-method-action-types.mjs";
|
|
5
6
|
import type { RampsErrorCode } from "./rampsErrorCodes.mjs";
|
|
7
|
+
import type { RampsServiceGetGeolocationAction, RampsServiceGetCountriesAction, RampsServiceGetTokensAction, RampsServiceGetProvidersAction, RampsServiceGetPaymentMethodsAction, RampsServiceGetQuotesAction, RampsServiceGetBuyWidgetUrlAction, RampsServiceGetOrderAction, RampsServiceGetOrderFromCallbackAction } from "./RampsService-method-action-types.mjs";
|
|
6
8
|
import type { BuyWidget, Country, TokensResponse, Provider, State, RampAction, PaymentMethod, PaymentMethodsResponse, QuotesResponse, Quote, RampsToken, RampsServiceActions, RampsOrder } from "./RampsService.mjs";
|
|
7
9
|
import { RampsOrderStatus } from "./RampsService.mjs";
|
|
8
|
-
import type { RampsServiceGetGeolocationAction, RampsServiceGetCountriesAction, RampsServiceGetTokensAction, RampsServiceGetProvidersAction, RampsServiceGetPaymentMethodsAction, RampsServiceGetQuotesAction, RampsServiceGetBuyWidgetUrlAction, RampsServiceGetOrderAction, RampsServiceGetOrderFromCallbackAction } from "./RampsService-method-action-types.mjs";
|
|
9
10
|
import type { RequestCache as RequestCacheType, RequestState, ExecuteRequestOptions } from "./RequestCache.mjs";
|
|
11
|
+
import type { TransakServiceSetApiKeyAction, TransakServiceSetAccessTokenAction, TransakServiceClearAccessTokenAction, TransakServiceSendUserOtpAction, TransakServiceVerifyUserOtpAction, TransakServiceLogoutAction, TransakServiceGetUserDetailsAction, TransakServiceGetBuyQuoteAction, TransakServiceGetKycRequirementAction, TransakServiceGetAdditionalRequirementsAction, TransakServiceCreateOrderAction, TransakServiceGetOrderAction, TransakServiceGetUserLimitsAction, TransakServiceRequestOttAction, TransakServiceGeneratePaymentWidgetUrlAction, TransakServiceCreateWidgetUrlAction, TransakServiceSubmitPurposeOfUsageFormAction, TransakServicePatchUserAction, TransakServiceSubmitSsnDetailsAction, TransakServiceConfirmPaymentAction, TransakServiceGetTranslationAction, TransakServiceGetIdProofStatusAction, TransakServiceCancelOrderAction, TransakServiceCancelAllActiveOrdersAction, TransakServiceGetActiveOrdersAction } from "./TransakService-method-action-types.mjs";
|
|
10
12
|
import type { TransakAccessToken, TransakUserDetails, TransakBuyQuote, TransakKycRequirement, TransakAdditionalRequirementsResponse, TransakDepositOrder, TransakUserLimits, TransakOttResponse, TransakQuoteTranslation, TransakTranslationRequest, TransakIdProofStatus, TransakOrderPaymentMethod, PatchUserRequestBody, TransakOrder } from "./TransakService.mjs";
|
|
11
13
|
import type { TransakServiceActions } from "./TransakService.mjs";
|
|
12
|
-
import type { TransakServiceSetApiKeyAction, TransakServiceSetAccessTokenAction, TransakServiceClearAccessTokenAction, TransakServiceSendUserOtpAction, TransakServiceVerifyUserOtpAction, TransakServiceLogoutAction, TransakServiceGetUserDetailsAction, TransakServiceGetBuyQuoteAction, TransakServiceGetKycRequirementAction, TransakServiceGetAdditionalRequirementsAction, TransakServiceCreateOrderAction, TransakServiceGetOrderAction, TransakServiceGetUserLimitsAction, TransakServiceRequestOttAction, TransakServiceGeneratePaymentWidgetUrlAction, TransakServiceSubmitPurposeOfUsageFormAction, TransakServicePatchUserAction, TransakServiceSubmitSsnDetailsAction, TransakServiceConfirmPaymentAction, TransakServiceGetTranslationAction, TransakServiceGetIdProofStatusAction, TransakServiceCancelOrderAction, TransakServiceCancelAllActiveOrdersAction, TransakServiceGetActiveOrdersAction } from "./TransakService-method-action-types.mjs";
|
|
13
14
|
/**
|
|
14
15
|
* The name of the {@link RampsController}, used to namespace the
|
|
15
16
|
* controller's actions and events and to namespace the controller's state data
|
|
@@ -157,7 +158,7 @@ export type RampsControllerActions = RampsControllerGetStateAction | RampsContro
|
|
|
157
158
|
/**
|
|
158
159
|
* Actions from other messengers that {@link RampsController} calls.
|
|
159
160
|
*/
|
|
160
|
-
type AllowedActions = RampsServiceGetGeolocationAction | RampsServiceGetCountriesAction | RampsServiceGetTokensAction | RampsServiceGetProvidersAction | RampsServiceGetPaymentMethodsAction | RampsServiceGetQuotesAction | RampsServiceGetBuyWidgetUrlAction | RampsServiceGetOrderAction | RampsServiceGetOrderFromCallbackAction | TransakServiceSetApiKeyAction | TransakServiceSetAccessTokenAction | TransakServiceClearAccessTokenAction | TransakServiceSendUserOtpAction | TransakServiceVerifyUserOtpAction | TransakServiceLogoutAction | TransakServiceGetUserDetailsAction | TransakServiceGetBuyQuoteAction | TransakServiceGetKycRequirementAction | TransakServiceGetAdditionalRequirementsAction | TransakServiceCreateOrderAction | TransakServiceGetOrderAction | TransakServiceGetUserLimitsAction | TransakServiceRequestOttAction | TransakServiceGeneratePaymentWidgetUrlAction | TransakServiceSubmitPurposeOfUsageFormAction | TransakServicePatchUserAction | TransakServiceSubmitSsnDetailsAction | TransakServiceConfirmPaymentAction | TransakServiceGetTranslationAction | TransakServiceGetIdProofStatusAction | TransakServiceCancelOrderAction | TransakServiceCancelAllActiveOrdersAction | TransakServiceGetActiveOrdersAction;
|
|
161
|
+
type AllowedActions = RemoteFeatureFlagControllerGetStateAction | RampsServiceGetGeolocationAction | RampsServiceGetCountriesAction | RampsServiceGetTokensAction | RampsServiceGetProvidersAction | RampsServiceGetPaymentMethodsAction | RampsServiceGetQuotesAction | RampsServiceGetBuyWidgetUrlAction | RampsServiceGetOrderAction | RampsServiceGetOrderFromCallbackAction | TransakServiceSetApiKeyAction | TransakServiceSetAccessTokenAction | TransakServiceClearAccessTokenAction | TransakServiceSendUserOtpAction | TransakServiceVerifyUserOtpAction | TransakServiceLogoutAction | TransakServiceGetUserDetailsAction | TransakServiceGetBuyQuoteAction | TransakServiceGetKycRequirementAction | TransakServiceGetAdditionalRequirementsAction | TransakServiceCreateOrderAction | TransakServiceGetOrderAction | TransakServiceGetUserLimitsAction | TransakServiceRequestOttAction | TransakServiceGeneratePaymentWidgetUrlAction | TransakServiceCreateWidgetUrlAction | TransakServiceSubmitPurposeOfUsageFormAction | TransakServicePatchUserAction | TransakServiceSubmitSsnDetailsAction | TransakServiceConfirmPaymentAction | TransakServiceGetTranslationAction | TransakServiceGetIdProofStatusAction | TransakServiceCancelOrderAction | TransakServiceCancelAllActiveOrdersAction | TransakServiceGetActiveOrdersAction;
|
|
161
162
|
/**
|
|
162
163
|
* Published when the state of {@link RampsController} changes.
|
|
163
164
|
*/
|
|
@@ -189,16 +190,6 @@ export type RampsControllerMessenger = Messenger<typeof controllerName, RampsCon
|
|
|
189
190
|
/**
|
|
190
191
|
* Configuration options for the RampsController.
|
|
191
192
|
*/
|
|
192
|
-
/**
|
|
193
|
-
* Provider-class scope for fiat quote widening, resolved per `getQuotes` call.
|
|
194
|
-
*
|
|
195
|
-
* - `off`: native-only auto-selection (default; preserves prior behaviour).
|
|
196
|
-
* - `in-app`: also quote in-app WebView aggregator providers and select the
|
|
197
|
-
* best in-app quote.
|
|
198
|
-
* - `all`: additionally allow external-browser / custom-action providers
|
|
199
|
-
* (Phase 2).
|
|
200
|
-
*/
|
|
201
|
-
export type ProviderScope = 'off' | 'in-app' | 'all';
|
|
202
193
|
export type RampsControllerOptions = {
|
|
203
194
|
/** The messenger suited for this controller. */
|
|
204
195
|
messenger: RampsControllerMessenger;
|
|
@@ -208,21 +199,15 @@ export type RampsControllerOptions = {
|
|
|
208
199
|
requestCacheTTL?: number;
|
|
209
200
|
/** Maximum number of entries in the request cache. Defaults to 250. */
|
|
210
201
|
requestCacheMaxSize?: number;
|
|
211
|
-
/**
|
|
212
|
-
* Optional callback returning the current provider-class scope for fiat quote
|
|
213
|
-
* widening. Read per `getQuotes` call so a host-side toggle takes effect at
|
|
214
|
-
* runtime without reconstructing the controller. Defaults to `off`
|
|
215
|
-
* (native-only) when omitted.
|
|
216
|
-
*/
|
|
217
|
-
getProviderScope?: () => ProviderScope;
|
|
218
202
|
/**
|
|
219
203
|
* Optional callback returning the default redirect URL to use for the widened
|
|
220
|
-
*
|
|
204
|
+
* quote fetch when the caller omits `redirectUrl`. The quotes API only
|
|
221
205
|
* embeds a `buyURL`/`buyWidget` (the WebView page a non-native provider needs)
|
|
222
206
|
* when a `redirectUrl` is present, so supplying this default lets widened
|
|
223
|
-
*
|
|
224
|
-
* widened path; an explicit caller `redirectUrl` always wins and
|
|
225
|
-
* never injects. Defaults to a callback returning
|
|
207
|
+
* aggregator quotes carry a usable widget URL. Only applied on the
|
|
208
|
+
* widened path; an explicit caller `redirectUrl` always wins and the
|
|
209
|
+
* native-only default never injects. Defaults to a callback returning
|
|
210
|
+
* `undefined` when omitted.
|
|
226
211
|
*/
|
|
227
212
|
getDefaultRedirectUrl?: () => string | undefined;
|
|
228
213
|
};
|
|
@@ -256,13 +241,11 @@ export declare class RampsController extends BaseController<typeof controllerNam
|
|
|
256
241
|
* controller. Missing properties will be filled in with defaults.
|
|
257
242
|
* @param args.requestCacheTTL - Time to live for cached requests in milliseconds.
|
|
258
243
|
* @param args.requestCacheMaxSize - Maximum number of entries in the request cache.
|
|
259
|
-
* @param args.getProviderScope - Optional callback returning the current
|
|
260
|
-
* provider-class scope for fiat quote widening. Defaults to `off`.
|
|
261
244
|
* @param args.getDefaultRedirectUrl - Optional callback returning the default
|
|
262
|
-
* redirect URL used for the widened
|
|
245
|
+
* redirect URL used for the widened quote fetch when the caller omits
|
|
263
246
|
* `redirectUrl`. Defaults to a callback returning `undefined`.
|
|
264
247
|
*/
|
|
265
|
-
constructor({ messenger, state, requestCacheTTL, requestCacheMaxSize,
|
|
248
|
+
constructor({ messenger, state, requestCacheTTL, requestCacheMaxSize, getDefaultRedirectUrl, }: RampsControllerOptions);
|
|
266
249
|
/**
|
|
267
250
|
* Executes a request with caching, deduplication, and at most one in-flight
|
|
268
251
|
* request per resource type.
|
|
@@ -673,6 +656,17 @@ export declare class RampsController extends BaseController<typeof controllerNam
|
|
|
673
656
|
* @returns The fully constructed widget URL string.
|
|
674
657
|
*/
|
|
675
658
|
transakGeneratePaymentWidgetUrl(ottToken: string, quote: TransakBuyQuote, walletAddress: string, extraParams?: Record<string, string>): string;
|
|
659
|
+
/**
|
|
660
|
+
* Creates a Transak payment widget URL via the ramps API proxy, which
|
|
661
|
+
* injects the partner API key server-side. Replaces the OTT flow
|
|
662
|
+
* ({@link transakRequestOtt} + {@link transakGeneratePaymentWidgetUrl}).
|
|
663
|
+
*
|
|
664
|
+
* @param quote - The buy quote to pre-fill in the widget.
|
|
665
|
+
* @param walletAddress - The destination wallet address.
|
|
666
|
+
* @param extraParams - Optional additional widget parameters (e.g. theming).
|
|
667
|
+
* @returns The single-use widget URL.
|
|
668
|
+
*/
|
|
669
|
+
transakCreateWidgetUrl(quote: TransakBuyQuote, walletAddress: string, extraParams?: Record<string, string>): Promise<string>;
|
|
676
670
|
/**
|
|
677
671
|
* Submits the user's purpose of usage form for KYC compliance.
|
|
678
672
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RampsController.d.mts","sourceRoot":"","sources":["../src/RampsController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAE3B,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAE3D,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;
|
|
1
|
+
{"version":3,"file":"RampsController.d.mts","sourceRoot":"","sources":["../src/RampsController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,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,CAC3B,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,oBAAoB,CAAC;IAYhC;;;;;OAKG;IACG,kBAAkB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY/D;;;;;OAKG;IACG,4BAA4B,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;IAStD;;;;OAIG;IACG,sBAAsB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;CAQxD"}
|
package/dist/RampsController.mjs
CHANGED
|
@@ -9,9 +9,11 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
|
-
var _RampsController_instances, _RampsController_requestCacheTTL, _RampsController_requestCacheMaxSize,
|
|
12
|
+
var _RampsController_instances, _RampsController_requestCacheTTL, _RampsController_requestCacheMaxSize, _RampsController_getDefaultRedirectUrl, _RampsController_pendingRequests, _RampsController_pendingResourceCount, _RampsController_pendingResourceGeneration, _RampsController_orderPollingMeta, _RampsController_orderPollingTimer, _RampsController_isPolling, _RampsController_initPromise, _RampsController_clearPendingResourceCountForDependentResources, _RampsController_abortDependentRequests, _RampsController_isAllProvidersEnabled, _RampsController_mutateRequests, _RampsController_removeRequestState, _RampsController_cleanupState, _RampsController_requireRegion, _RampsController_isRegionCurrent, _RampsController_isTokenCurrent, _RampsController_isProviderCurrent, _RampsController_updateResourceField, _RampsController_setResourceLoading, _RampsController_setResourceError, _RampsController_updateRequestState, _RampsController_runInit, _RampsController_syncUserRegionFromCountriesCatalog, _RampsController_pickWidenedQuote, _RampsController_getSupportingProvidersForRegion, _RampsController_filterProviderIdsBySupport, _RampsController_resolveProviderIdsForQuote, _RampsController_getPreferredProviderIdsFromOrders, _RampsController_refreshOrder, _RampsController_pollPendingOrders, _RampsController_syncTransakAuthOnError, _RampsController_getNormalizedTransakError;
|
|
13
13
|
import { BaseController } from "@metamask/base-controller";
|
|
14
14
|
import { BrokenCircuitError } from "@metamask/controller-utils";
|
|
15
|
+
import { isHeadlessAllProvidersEnabled } from "./featureFlags.mjs";
|
|
16
|
+
import { getProvidersServingAsset } from "./providerAvailability.mjs";
|
|
15
17
|
import { RAMPS_ERROR_CODES } from "./rampsErrorCodes.mjs";
|
|
16
18
|
import { RampsOrderStatus } from "./RampsService.mjs";
|
|
17
19
|
import { DEFAULT_REQUEST_CACHE_TTL, DEFAULT_REQUEST_CACHE_MAX_SIZE, createCacheKey, isCacheExpired, createLoadingState, createSuccessState, createErrorState, RequestStatus } from "./RequestCache.mjs";
|
|
@@ -52,6 +54,7 @@ export const RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS = [
|
|
|
52
54
|
'TransakService:getUserLimits',
|
|
53
55
|
'TransakService:requestOtt',
|
|
54
56
|
'TransakService:generatePaymentWidgetUrl',
|
|
57
|
+
'TransakService:createWidgetUrl',
|
|
55
58
|
'TransakService:submitPurposeOfUsageForm',
|
|
56
59
|
'TransakService:patchUser',
|
|
57
60
|
'TransakService:submitSsnDetails',
|
|
@@ -400,6 +403,7 @@ const MESSENGER_EXPOSED_METHODS = [
|
|
|
400
403
|
'transakGetUserLimits',
|
|
401
404
|
'transakRequestOtt',
|
|
402
405
|
'transakGeneratePaymentWidgetUrl',
|
|
406
|
+
'transakCreateWidgetUrl',
|
|
403
407
|
'transakSubmitPurposeOfUsageForm',
|
|
404
408
|
'transakPatchUser',
|
|
405
409
|
'transakSubmitSsnDetails',
|
|
@@ -432,13 +436,11 @@ export class RampsController extends BaseController {
|
|
|
432
436
|
* controller. Missing properties will be filled in with defaults.
|
|
433
437
|
* @param args.requestCacheTTL - Time to live for cached requests in milliseconds.
|
|
434
438
|
* @param args.requestCacheMaxSize - Maximum number of entries in the request cache.
|
|
435
|
-
* @param args.getProviderScope - Optional callback returning the current
|
|
436
|
-
* provider-class scope for fiat quote widening. Defaults to `off`.
|
|
437
439
|
* @param args.getDefaultRedirectUrl - Optional callback returning the default
|
|
438
|
-
* redirect URL used for the widened
|
|
440
|
+
* redirect URL used for the widened quote fetch when the caller omits
|
|
439
441
|
* `redirectUrl`. Defaults to a callback returning `undefined`.
|
|
440
442
|
*/
|
|
441
|
-
constructor({ messenger, state = {}, requestCacheTTL = DEFAULT_REQUEST_CACHE_TTL, requestCacheMaxSize = DEFAULT_REQUEST_CACHE_MAX_SIZE,
|
|
443
|
+
constructor({ messenger, state = {}, requestCacheTTL = DEFAULT_REQUEST_CACHE_TTL, requestCacheMaxSize = DEFAULT_REQUEST_CACHE_MAX_SIZE, getDefaultRedirectUrl, }) {
|
|
442
444
|
super({
|
|
443
445
|
messenger,
|
|
444
446
|
metadata: rampsControllerMetadata,
|
|
@@ -460,12 +462,7 @@ export class RampsController extends BaseController {
|
|
|
460
462
|
*/
|
|
461
463
|
_RampsController_requestCacheMaxSize.set(this, void 0);
|
|
462
464
|
/**
|
|
463
|
-
* Resolves the
|
|
464
|
-
* to `() => 'off'` (native-only) when no callback is injected.
|
|
465
|
-
*/
|
|
466
|
-
_RampsController_getProviderScope.set(this, void 0);
|
|
467
|
-
/**
|
|
468
|
-
* Resolves the default redirect URL for the widened in-app quote fetch when
|
|
465
|
+
* Resolves the default redirect URL for the widened quote fetch when
|
|
469
466
|
* the caller omits `redirectUrl`. Defaults to `() => undefined` when no
|
|
470
467
|
* callback is injected.
|
|
471
468
|
*/
|
|
@@ -491,7 +488,6 @@ export class RampsController extends BaseController {
|
|
|
491
488
|
_RampsController_initPromise.set(this, null);
|
|
492
489
|
__classPrivateFieldSet(this, _RampsController_requestCacheTTL, requestCacheTTL, "f");
|
|
493
490
|
__classPrivateFieldSet(this, _RampsController_requestCacheMaxSize, requestCacheMaxSize, "f");
|
|
494
|
-
__classPrivateFieldSet(this, _RampsController_getProviderScope, getProviderScope ?? (() => 'off'), "f");
|
|
495
491
|
__classPrivateFieldSet(this, _RampsController_getDefaultRedirectUrl, getDefaultRedirectUrl ?? (() => undefined), "f");
|
|
496
492
|
this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
|
|
497
493
|
}
|
|
@@ -1007,19 +1003,17 @@ export class RampsController extends BaseController {
|
|
|
1007
1003
|
if (normalizedAssetIdForValidation === '') {
|
|
1008
1004
|
throw new Error('assetId is required.');
|
|
1009
1005
|
}
|
|
1010
|
-
// When
|
|
1011
|
-
// auto-selection path to every supporting provider and pick the best
|
|
1012
|
-
// quote from the results
|
|
1013
|
-
// `buyWidget.browser`). Only the auto-select/restrict path that MM Pay's
|
|
1006
|
+
// When the all-providers feature flag is enabled, widen the native-only
|
|
1007
|
+
// auto-selection path to every supporting provider and pick the best
|
|
1008
|
+
// quote from the results. Only the auto-select/restrict path that MM Pay's
|
|
1014
1009
|
// `getRampsQuote` uses is affected; explicit-`providers` callers and the
|
|
1015
|
-
// plain all-provider path are untouched.
|
|
1016
|
-
const
|
|
1017
|
-
const widenToInAppProviders = providerScope !== 'off' &&
|
|
1018
|
-
!options.providers &&
|
|
1010
|
+
// plain all-provider path are untouched (and never read the flag).
|
|
1011
|
+
const wantsAutoSelection = !options.providers &&
|
|
1019
1012
|
(options.autoSelectProvider === true ||
|
|
1020
1013
|
options.restrictToKnownOrNativeProviders === true);
|
|
1014
|
+
const widenToAllProviders = wantsAutoSelection && __classPrivateFieldGet(this, _RampsController_instances, "m", _RampsController_isAllProvidersEnabled).call(this);
|
|
1021
1015
|
let providersToUse;
|
|
1022
|
-
let
|
|
1016
|
+
let widenedProviderCatalog = this.state.providers.data;
|
|
1023
1017
|
if (options.providers) {
|
|
1024
1018
|
providersToUse = options.restrictToKnownOrNativeProviders
|
|
1025
1019
|
? await __classPrivateFieldGet(this, _RampsController_instances, "m", _RampsController_filterProviderIdsBySupport).call(this, {
|
|
@@ -1029,7 +1023,7 @@ export class RampsController extends BaseController {
|
|
|
1029
1023
|
})
|
|
1030
1024
|
: options.providers;
|
|
1031
1025
|
}
|
|
1032
|
-
else if (
|
|
1026
|
+
else if (widenToAllProviders) {
|
|
1033
1027
|
// `#getSupportingProvidersForRegion` also hydrates the provider catalog
|
|
1034
1028
|
// when controller state is empty, so all-provider quoting cannot silently
|
|
1035
1029
|
// return zero providers here.
|
|
@@ -1037,7 +1031,7 @@ export class RampsController extends BaseController {
|
|
|
1037
1031
|
assetId: normalizedAssetIdForValidation,
|
|
1038
1032
|
region: regionToUse,
|
|
1039
1033
|
});
|
|
1040
|
-
|
|
1034
|
+
widenedProviderCatalog = supporting;
|
|
1041
1035
|
providersToUse = supporting.map((provider) => provider.id);
|
|
1042
1036
|
}
|
|
1043
1037
|
else if (options.autoSelectProvider ||
|
|
@@ -1069,12 +1063,12 @@ export class RampsController extends BaseController {
|
|
|
1069
1063
|
// Under headless-buy gating, an empty resolved provider list means no
|
|
1070
1064
|
// eligible (native/supporting) provider exists. Return an empty response
|
|
1071
1065
|
// rather than passing `[]` to the service, which omits the provider filter
|
|
1072
|
-
// and would quote every provider. This also guards the widened
|
|
1066
|
+
// and would quote every provider. This also guards the widened path:
|
|
1073
1067
|
// a caller may trigger widening with `autoSelectProvider` alone (no
|
|
1074
1068
|
// `restrictToKnownOrNativeProviders`), and an empty supporting set must not
|
|
1075
1069
|
// fall through to unfiltered quotes from providers that do not support the
|
|
1076
1070
|
// asset.
|
|
1077
|
-
if ((options.restrictToKnownOrNativeProviders ||
|
|
1071
|
+
if ((options.restrictToKnownOrNativeProviders || widenToAllProviders) &&
|
|
1078
1072
|
providersToUse.length === 0) {
|
|
1079
1073
|
return { success: [], sorted: [], error: [], customActions: [] };
|
|
1080
1074
|
}
|
|
@@ -1083,11 +1077,12 @@ export class RampsController extends BaseController {
|
|
|
1083
1077
|
const normalizedAssetId = normalizedAssetIdForValidation;
|
|
1084
1078
|
const normalizedWalletAddress = options.walletAddress.trim();
|
|
1085
1079
|
// The quotes API only embeds a `buyURL`/`buyWidget` when a `redirectUrl` is
|
|
1086
|
-
// present, so on the widened
|
|
1080
|
+
// present, so on the widened path (where MM Pay omits one) supply the
|
|
1087
1081
|
// injected default so aggregator quotes carry a usable widget URL. An
|
|
1088
|
-
// explicit caller `redirectUrl` always wins, and
|
|
1082
|
+
// explicit caller `redirectUrl` always wins, and the native-only path
|
|
1083
|
+
// (flag off) never injects.
|
|
1089
1084
|
const effectiveRedirectUrl = options.redirectUrl ??
|
|
1090
|
-
(
|
|
1085
|
+
(widenToAllProviders ? __classPrivateFieldGet(this, _RampsController_getDefaultRedirectUrl, "f").call(this) : undefined);
|
|
1091
1086
|
const cacheKey = createCacheKey('getQuotes', [
|
|
1092
1087
|
normalizedRegion,
|
|
1093
1088
|
normalizedFiat,
|
|
@@ -1116,22 +1111,21 @@ export class RampsController extends BaseController {
|
|
|
1116
1111
|
forceRefresh: options.forceRefresh,
|
|
1117
1112
|
ttl: options.ttl ?? DEFAULT_QUOTES_TTL,
|
|
1118
1113
|
});
|
|
1119
|
-
if (!
|
|
1114
|
+
if (!widenToAllProviders) {
|
|
1120
1115
|
return response;
|
|
1121
1116
|
}
|
|
1122
|
-
// Reduce the widened multi-provider result to the single best
|
|
1117
|
+
// Reduce the widened multi-provider result to the single best quote
|
|
1123
1118
|
// and place it at `success[0]`, since single-pick consumers
|
|
1124
1119
|
// (`getRampsQuote` -> `success?.[0]`) rely on index 0 while `success[]`
|
|
1125
1120
|
// order is server-defined rather than ranked.
|
|
1126
|
-
const selectedQuote = __classPrivateFieldGet(this, _RampsController_instances, "m",
|
|
1127
|
-
scope: providerScope,
|
|
1121
|
+
const selectedQuote = __classPrivateFieldGet(this, _RampsController_instances, "m", _RampsController_pickWidenedQuote).call(this, response, {
|
|
1128
1122
|
amount: options.amount,
|
|
1129
1123
|
fiat: normalizedFiat,
|
|
1130
|
-
providers:
|
|
1124
|
+
providers: widenedProviderCatalog,
|
|
1131
1125
|
});
|
|
1132
1126
|
if (!selectedQuote) {
|
|
1133
|
-
// No
|
|
1134
|
-
//
|
|
1127
|
+
// No quote fits the published provider limits: surface "no quote"
|
|
1128
|
+
// rather than handing the single-pick consumer an out-of-limits quote.
|
|
1135
1129
|
return {
|
|
1136
1130
|
success: [],
|
|
1137
1131
|
sorted: response.sorted,
|
|
@@ -1624,6 +1618,25 @@ export class RampsController extends BaseController {
|
|
|
1624
1618
|
transakGeneratePaymentWidgetUrl(ottToken, quote, walletAddress, extraParams) {
|
|
1625
1619
|
return this.messenger.call('TransakService:generatePaymentWidgetUrl', ottToken, quote, walletAddress, extraParams);
|
|
1626
1620
|
}
|
|
1621
|
+
/**
|
|
1622
|
+
* Creates a Transak payment widget URL via the ramps API proxy, which
|
|
1623
|
+
* injects the partner API key server-side. Replaces the OTT flow
|
|
1624
|
+
* ({@link transakRequestOtt} + {@link transakGeneratePaymentWidgetUrl}).
|
|
1625
|
+
*
|
|
1626
|
+
* @param quote - The buy quote to pre-fill in the widget.
|
|
1627
|
+
* @param walletAddress - The destination wallet address.
|
|
1628
|
+
* @param extraParams - Optional additional widget parameters (e.g. theming).
|
|
1629
|
+
* @returns The single-use widget URL.
|
|
1630
|
+
*/
|
|
1631
|
+
async transakCreateWidgetUrl(quote, walletAddress, extraParams) {
|
|
1632
|
+
try {
|
|
1633
|
+
return await this.messenger.call('TransakService:createWidgetUrl', quote, walletAddress, extraParams);
|
|
1634
|
+
}
|
|
1635
|
+
catch (error) {
|
|
1636
|
+
throw __classPrivateFieldGet(this, _RampsController_instances, "m", _RampsController_getNormalizedTransakError).call(this, error, { syncAuth: true })
|
|
1637
|
+
.normalizedError;
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1627
1640
|
/**
|
|
1628
1641
|
* Submits the user's purpose of usage form for KYC compliance.
|
|
1629
1642
|
*
|
|
@@ -1760,7 +1773,7 @@ export class RampsController extends BaseController {
|
|
|
1760
1773
|
}
|
|
1761
1774
|
}
|
|
1762
1775
|
}
|
|
1763
|
-
_RampsController_requestCacheTTL = new WeakMap(), _RampsController_requestCacheMaxSize = new WeakMap(),
|
|
1776
|
+
_RampsController_requestCacheTTL = new WeakMap(), _RampsController_requestCacheMaxSize = new WeakMap(), _RampsController_getDefaultRedirectUrl = new WeakMap(), _RampsController_pendingRequests = new WeakMap(), _RampsController_pendingResourceCount = new WeakMap(), _RampsController_pendingResourceGeneration = new WeakMap(), _RampsController_orderPollingMeta = new WeakMap(), _RampsController_orderPollingTimer = new WeakMap(), _RampsController_isPolling = new WeakMap(), _RampsController_initPromise = new WeakMap(), _RampsController_instances = new WeakSet(), _RampsController_clearPendingResourceCountForDependentResources = function _RampsController_clearPendingResourceCountForDependentResources() {
|
|
1764
1777
|
for (const resourceType of DEPENDENT_RESOURCE_KEYS) {
|
|
1765
1778
|
__classPrivateFieldGet(this, _RampsController_pendingResourceCount, "f").delete(resourceType);
|
|
1766
1779
|
const generation = __classPrivateFieldGet(this, _RampsController_pendingResourceGeneration, "f").get(resourceType) ?? 0;
|
|
@@ -1775,6 +1788,14 @@ _RampsController_requestCacheTTL = new WeakMap(), _RampsController_requestCacheM
|
|
|
1775
1788
|
__classPrivateFieldGet(this, _RampsController_instances, "m", _RampsController_removeRequestState).call(this, cacheKey);
|
|
1776
1789
|
}
|
|
1777
1790
|
}
|
|
1791
|
+
}, _RampsController_isAllProvidersEnabled = function _RampsController_isAllProvidersEnabled() {
|
|
1792
|
+
try {
|
|
1793
|
+
const remoteFeatureFlagState = this.messenger.call('RemoteFeatureFlagController:getState');
|
|
1794
|
+
return isHeadlessAllProvidersEnabled(remoteFeatureFlagState);
|
|
1795
|
+
}
|
|
1796
|
+
catch {
|
|
1797
|
+
return false;
|
|
1798
|
+
}
|
|
1778
1799
|
}, _RampsController_mutateRequests = function _RampsController_mutateRequests(fn) {
|
|
1779
1800
|
this.update((state) => {
|
|
1780
1801
|
const requests = state.requests;
|
|
@@ -1886,9 +1907,8 @@ _RampsController_requestCacheTTL = new WeakMap(), _RampsController_requestCacheM
|
|
|
1886
1907
|
this.update((state) => {
|
|
1887
1908
|
state.userRegion = userRegion;
|
|
1888
1909
|
});
|
|
1889
|
-
},
|
|
1910
|
+
}, _RampsController_pickWidenedQuote = function _RampsController_pickWidenedQuote(response, { amount, fiat, providers, }) {
|
|
1890
1911
|
const providerByCode = new Map(providers.map((provider) => [provider.id, provider]));
|
|
1891
|
-
const customActionProviderCodes = new Set(response.customActions.map((action) => action.buy.providerId));
|
|
1892
1912
|
const fitsProviderLimits = (quote) => {
|
|
1893
1913
|
const provider = providerByCode.get(quote.provider);
|
|
1894
1914
|
const limit = provider?.limits?.fiat?.[fiat]?.[quote.quote.paymentMethod];
|
|
@@ -1899,26 +1919,7 @@ _RampsController_requestCacheTTL = new WeakMap(), _RampsController_requestCacheM
|
|
|
1899
1919
|
}
|
|
1900
1920
|
return amount >= limit.minAmount && amount <= limit.maxAmount;
|
|
1901
1921
|
};
|
|
1902
|
-
const
|
|
1903
|
-
// `all` (Phase 2) skips the in-app-only exclusions; both scopes still
|
|
1904
|
-
// enforce provider limits up front.
|
|
1905
|
-
if (scope !== 'all') {
|
|
1906
|
-
const providerCode = quote.provider;
|
|
1907
|
-
if (customActionProviderCodes.has(providerCode)) {
|
|
1908
|
-
return false;
|
|
1909
|
-
}
|
|
1910
|
-
// Defensive: the wire may carry an inline `isCustomAction` flag that is
|
|
1911
|
-
// absent from the published `Quote` type.
|
|
1912
|
-
if (quote.quote.isCustomAction === true) {
|
|
1913
|
-
return false;
|
|
1914
|
-
}
|
|
1915
|
-
if (quote.quote.buyWidget?.browser === 'IN_APP_OS_BROWSER') {
|
|
1916
|
-
return false;
|
|
1917
|
-
}
|
|
1918
|
-
}
|
|
1919
|
-
return fitsProviderLimits(quote);
|
|
1920
|
-
};
|
|
1921
|
-
const candidates = response.success.filter(isEligible);
|
|
1922
|
+
const candidates = response.success.filter(fitsProviderLimits);
|
|
1922
1923
|
if (candidates.length === 0) {
|
|
1923
1924
|
return undefined;
|
|
1924
1925
|
}
|
|
@@ -1963,18 +1964,10 @@ async function _RampsController_getSupportingProvidersForRegion({ assetId, regio
|
|
|
1963
1964
|
else {
|
|
1964
1965
|
({ providers } = await this.getProviders(normalizedRegion));
|
|
1965
1966
|
}
|
|
1966
|
-
//
|
|
1967
|
-
//
|
|
1968
|
-
//
|
|
1969
|
-
|
|
1970
|
-
const normalizedAssetId = assetId.toLowerCase();
|
|
1971
|
-
const supporting = providers.filter((provider) => {
|
|
1972
|
-
const map = provider?.supportedCryptoCurrencies;
|
|
1973
|
-
if (!map) {
|
|
1974
|
-
return false;
|
|
1975
|
-
}
|
|
1976
|
-
return Object.keys(map).some((key) => key.toLowerCase() === normalizedAssetId);
|
|
1977
|
-
});
|
|
1967
|
+
// Case-insensitive CAIP-19 matching is shared with headless-buy consumers
|
|
1968
|
+
// via `getProvidersServingAsset`, so the controller and the UI region gate
|
|
1969
|
+
// cannot disagree about which providers serve the asset.
|
|
1970
|
+
const supporting = getProvidersServingAsset(providers, assetId);
|
|
1978
1971
|
return { supporting, all: providers };
|
|
1979
1972
|
}, _RampsController_filterProviderIdsBySupport =
|
|
1980
1973
|
/**
|