@metamask-previews/ramps-controller 28.1.0-preview-313288d71 → 28.1.0-preview-72009a9
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 +16 -0
- package/dist/RampsService.d.ts +18 -47
- package/dist/RampsService.d.ts.map +1 -1
- package/dist/RampsService.js +160 -190
- package/dist/RampsService.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Add `RampsServiceInvalidateQueriesAction`, `RampsServiceCacheUpdatedEvent` and `RampsServiceGranularCacheUpdatedEvent`, also included in `RampsServiceActions` and `RampsServiceEvents` ([#11214](https://github.com/MetaMask/core/pull/11214))
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- **BREAKING:** `RampsService` now extends `BaseDataService` from `@metamask/base-data-service` ([#11214](https://github.com/MetaMask/core/pull/11214))
|
|
17
|
+
- `RampsServiceMessenger` now includes the `RampsService:invalidateQueries` action and the `RampsService:cacheUpdated` events. Messengers built from `RampsServiceActions` and `RampsServiceEvents` pick these up automatically.
|
|
18
|
+
- Concurrent calls to the same `RampsService` method with identical arguments now share one request. Sequential calls still always hit the API ([#11214](https://github.com/MetaMask/core/pull/11214))
|
|
19
|
+
- Responses that do not match the expected shape now throw `Query function for "RampsService:<method>" returned an unexpected response: ...`, instead of `Malformed response received from <api name>` ([#11214](https://github.com/MetaMask/core/pull/11214))
|
|
20
|
+
- Add dependencies `@metamask/base-data-service` and `@metamask/superstruct` ([#11214](https://github.com/MetaMask/core/pull/11214))
|
|
21
|
+
|
|
22
|
+
### Removed
|
|
23
|
+
|
|
24
|
+
- **BREAKING:** Remove `onRetry`, `onBreak` and `onDegraded` from `RampsService` ([#11214](https://github.com/MetaMask/core/pull/11214))
|
|
25
|
+
|
|
10
26
|
## [28.1.0]
|
|
11
27
|
|
|
12
28
|
### Added
|
package/dist/RampsService.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BaseDataService } from '@metamask/base-data-service';
|
|
2
|
+
import type { CreateServicePolicyOptions, DataServiceCacheUpdatedEvent, DataServiceGranularCacheUpdatedEvent, DataServiceInvalidateQueriesAction } from '@metamask/base-data-service';
|
|
2
3
|
import type { Messenger } from '@metamask/messenger';
|
|
3
4
|
import type { AuthenticationController } from '@metamask/profile-sync-controller';
|
|
4
5
|
import type { RampsServiceMethodActions } from './RampsService-method-action-types.js';
|
|
@@ -664,18 +665,31 @@ export declare enum RampsApiService {
|
|
|
664
665
|
Regions = "regions",
|
|
665
666
|
Orders = "orders"
|
|
666
667
|
}
|
|
668
|
+
/**
|
|
669
|
+
* Invalidates cached queries in the service. See
|
|
670
|
+
* {@link BaseDataService.invalidateQueries}.
|
|
671
|
+
*/
|
|
672
|
+
export type RampsServiceInvalidateQueriesAction = DataServiceInvalidateQueriesAction<typeof serviceName>;
|
|
667
673
|
/**
|
|
668
674
|
* Actions that {@link RampsService} exposes to other consumers.
|
|
669
675
|
*/
|
|
670
|
-
export type RampsServiceActions = RampsServiceMethodActions;
|
|
676
|
+
export type RampsServiceActions = RampsServiceMethodActions | RampsServiceInvalidateQueriesAction;
|
|
671
677
|
/**
|
|
672
678
|
* Actions from other messengers that {@link RampsService} calls.
|
|
673
679
|
*/
|
|
674
680
|
type AllowedActions = AuthenticationController.AuthenticationControllerGetBearerTokenAction;
|
|
681
|
+
/**
|
|
682
|
+
* Published when the service's cache is updated.
|
|
683
|
+
*/
|
|
684
|
+
export type RampsServiceCacheUpdatedEvent = DataServiceCacheUpdatedEvent<typeof serviceName>;
|
|
685
|
+
/**
|
|
686
|
+
* Published when a specific cache entry of the service is updated.
|
|
687
|
+
*/
|
|
688
|
+
export type RampsServiceGranularCacheUpdatedEvent = DataServiceGranularCacheUpdatedEvent<typeof serviceName>;
|
|
675
689
|
/**
|
|
676
690
|
* Events that {@link RampsService} exposes to other consumers.
|
|
677
691
|
*/
|
|
678
|
-
export type RampsServiceEvents =
|
|
692
|
+
export type RampsServiceEvents = RampsServiceCacheUpdatedEvent | RampsServiceGranularCacheUpdatedEvent;
|
|
679
693
|
/**
|
|
680
694
|
* Events from other messengers that {@link RampsService} subscribes to.
|
|
681
695
|
*/
|
|
@@ -752,12 +766,8 @@ export declare function getDefaultRedirectCallbackUrl(environment: RampsEnvironm
|
|
|
752
766
|
* // ... Do something with the geolocation ...
|
|
753
767
|
* ```
|
|
754
768
|
*/
|
|
755
|
-
export declare class RampsService {
|
|
769
|
+
export declare class RampsService extends BaseDataService<typeof serviceName, RampsServiceMessenger> {
|
|
756
770
|
#private;
|
|
757
|
-
/**
|
|
758
|
-
* The name of the service.
|
|
759
|
-
*/
|
|
760
|
-
readonly name: typeof serviceName;
|
|
761
771
|
/**
|
|
762
772
|
* Constructs a new RampsService object.
|
|
763
773
|
*
|
|
@@ -812,45 +822,6 @@ export declare class RampsService {
|
|
|
812
822
|
* @returns The default redirect callback URL for the configured environment.
|
|
813
823
|
*/
|
|
814
824
|
getDefaultRedirectCallbackUrl(): string;
|
|
815
|
-
/**
|
|
816
|
-
* Registers a handler that will be called after a request returns a non-500
|
|
817
|
-
* response, causing a retry. Primarily useful in tests where timers are being
|
|
818
|
-
* mocked.
|
|
819
|
-
*
|
|
820
|
-
* @param listener - The handler to be called.
|
|
821
|
-
* @returns An object that can be used to unregister the handler. See
|
|
822
|
-
* {@link CockatielEvent}.
|
|
823
|
-
* @see {@link createServicePolicy}
|
|
824
|
-
*/
|
|
825
|
-
onRetry(listener: Parameters<ServicePolicy['onRetry']>[0]): ReturnType<ServicePolicy['onRetry']>;
|
|
826
|
-
/**
|
|
827
|
-
* Registers a handler that will be called after a set number of retry rounds
|
|
828
|
-
* prove that requests to the API endpoint consistently return a 5xx response.
|
|
829
|
-
*
|
|
830
|
-
* @param listener - The handler to be called.
|
|
831
|
-
* @returns An object that can be used to unregister the handler. See
|
|
832
|
-
* {@link CockatielEvent}.
|
|
833
|
-
* @see {@link createServicePolicy}
|
|
834
|
-
*/
|
|
835
|
-
onBreak(listener: Parameters<ServicePolicy['onBreak']>[0]): ReturnType<ServicePolicy['onBreak']>;
|
|
836
|
-
/**
|
|
837
|
-
* Registers a handler that will be called under one of two circumstances:
|
|
838
|
-
*
|
|
839
|
-
* 1. After a set number of retries prove that requests to the API
|
|
840
|
-
* consistently result in one of the following failures:
|
|
841
|
-
* 1. A connection initiation error
|
|
842
|
-
* 2. A connection reset error
|
|
843
|
-
* 3. A timeout error
|
|
844
|
-
* 4. A non-JSON response
|
|
845
|
-
* 5. A 502, 503, or 504 response
|
|
846
|
-
* 2. After a successful request is made to the API, but the response takes
|
|
847
|
-
* longer than a set duration to return.
|
|
848
|
-
*
|
|
849
|
-
* @param listener - The handler to be called.
|
|
850
|
-
* @returns An object that can be used to unregister the handler. See
|
|
851
|
-
* {@link CockatielEvent}.
|
|
852
|
-
*/
|
|
853
|
-
onDegraded(listener: Parameters<ServicePolicy['onDegraded']>[0]): ReturnType<ServicePolicy['onDegraded']>;
|
|
854
825
|
/**
|
|
855
826
|
* Makes a request to the API in order to retrieve the user's geolocation
|
|
856
827
|
* based on their IP address.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RampsService.d.ts","sourceRoot":"","sources":["../src/RampsService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,aAAa,EACd,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAKlF,OAAO,KAAK,EAAE,yB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,MAAM,EAAE,CAAC;QAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;KAC9B,GACA,OAAO,CAAC,iBAAiB,CAAC,CA6C5B;IAED;;;;;;;;;;;;OAYG;IACG,iBAAiB,CAAC,OAAO,EAAE;QAC/B,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAsBlC;IAED;;;;;;;;;;;;;;;OAeG;IACG,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CA6ChE;IAED;;;;;;;OAOG;IACG,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAgBxD;IAaD;;;;;;;;;;OAUG;IACG,QAAQ,CACZ,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,UAAU,CAAC,CAoBrB;IAED;;;;;;;;;;;;;OAaG;IACG,oBAAoB,CACxB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,UAAU,CAAC,CA2CrB;CACF"}
|
package/dist/RampsService.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseDataService } from '@metamask/base-data-service';
|
|
2
|
+
import { HttpError } from '@metamask/controller-utils';
|
|
3
|
+
import { any, array, boolean, nonempty, nullable, optional, string, type as looseObject, } from '@metamask/superstruct';
|
|
2
4
|
import packageJson from '../package.json';
|
|
3
5
|
import { addRampsClientIdentityParams } from './client-identity.js';
|
|
4
6
|
// === ORDER TYPES ===
|
|
@@ -58,6 +60,35 @@ const MESSENGER_EXPOSED_METHODS = [
|
|
|
58
60
|
'getOrder',
|
|
59
61
|
'getOrderFromCallback',
|
|
60
62
|
];
|
|
63
|
+
// === API RESPONSE SCHEMAS ===
|
|
64
|
+
// The structs only check the parts of each response that the service relies on.
|
|
65
|
+
// Unknown properties are kept as is.
|
|
66
|
+
const GeolocationStruct = nonempty(string());
|
|
67
|
+
const CountriesResponseStruct = array(looseObject({
|
|
68
|
+
supported: looseObject({
|
|
69
|
+
buy: optional(boolean()),
|
|
70
|
+
sell: optional(boolean()),
|
|
71
|
+
}),
|
|
72
|
+
states: optional(nullable(array(any()))),
|
|
73
|
+
}));
|
|
74
|
+
const TokensResponseStruct = looseObject({
|
|
75
|
+
topTokens: array(any()),
|
|
76
|
+
allTokens: array(any()),
|
|
77
|
+
});
|
|
78
|
+
const ProvidersResponseStruct = looseObject({
|
|
79
|
+
providers: array(any()),
|
|
80
|
+
sorted: array(any()),
|
|
81
|
+
});
|
|
82
|
+
const PaymentMethodsResponseStruct = looseObject({ payments: array(any()) });
|
|
83
|
+
const QuotesResponseStruct = looseObject({
|
|
84
|
+
success: array(any()),
|
|
85
|
+
sorted: array(any()),
|
|
86
|
+
error: array(any()),
|
|
87
|
+
customActions: array(any()),
|
|
88
|
+
});
|
|
89
|
+
const BuyWidgetResponseStruct = looseObject({ url: nonempty(string()) });
|
|
90
|
+
const OrderResponseStruct = looseObject({});
|
|
91
|
+
const OrderCallbackResponseStruct = looseObject({ id: optional(string()) });
|
|
61
92
|
// === SERVICE DEFINITION ===
|
|
62
93
|
/**
|
|
63
94
|
* Gets the base URL for API requests based on the environment and service type.
|
|
@@ -181,25 +212,11 @@ function getApiPath(path, version = 'v2') {
|
|
|
181
212
|
* // ... Do something with the geolocation ...
|
|
182
213
|
* ```
|
|
183
214
|
*/
|
|
184
|
-
export class RampsService {
|
|
185
|
-
/**
|
|
186
|
-
* The name of the service.
|
|
187
|
-
*/
|
|
188
|
-
name;
|
|
189
|
-
/**
|
|
190
|
-
* The messenger suited for this service.
|
|
191
|
-
*/
|
|
192
|
-
#messenger;
|
|
215
|
+
export class RampsService extends BaseDataService {
|
|
193
216
|
/**
|
|
194
217
|
* A function that can be used to make an HTTP request.
|
|
195
218
|
*/
|
|
196
219
|
#fetch;
|
|
197
|
-
/**
|
|
198
|
-
* The policy that wraps the request.
|
|
199
|
-
*
|
|
200
|
-
* @see {@link createServicePolicy}
|
|
201
|
-
*/
|
|
202
|
-
#policy;
|
|
203
220
|
/**
|
|
204
221
|
* The environment used for API requests.
|
|
205
222
|
*/
|
|
@@ -231,10 +248,8 @@ export class RampsService {
|
|
|
231
248
|
* @param args.clientVersion - Optional app SemVer (not the ramps-controller package version).
|
|
232
249
|
*/
|
|
233
250
|
constructor({ messenger, environment = RampsEnvironment.Staging, context, fetch: fetchFunction, policyOptions = {}, baseUrlOverride, clientProduct, clientVersion, }) {
|
|
234
|
-
|
|
235
|
-
this.#messenger = messenger;
|
|
251
|
+
super({ name: serviceName, messenger, policyOptions });
|
|
236
252
|
this.#fetch = fetchFunction;
|
|
237
|
-
this.#policy = createServicePolicy(policyOptions);
|
|
238
253
|
this.#environment = environment;
|
|
239
254
|
this.#context = context;
|
|
240
255
|
this.#baseUrlOverride = baseUrlOverride;
|
|
@@ -242,7 +257,7 @@ export class RampsService {
|
|
|
242
257
|
clientProduct,
|
|
243
258
|
clientVersion,
|
|
244
259
|
};
|
|
245
|
-
this
|
|
260
|
+
this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
|
|
246
261
|
}
|
|
247
262
|
/**
|
|
248
263
|
* Gets the base URL for API requests, respecting the baseUrlOverride if set.
|
|
@@ -295,56 +310,11 @@ export class RampsService {
|
|
|
295
310
|
* @returns Headers containing the `Authorization: Bearer <token>` entry.
|
|
296
311
|
*/
|
|
297
312
|
async #getRequestHeaders() {
|
|
298
|
-
const bearerToken = await this
|
|
313
|
+
const bearerToken = await this.messenger.call('AuthenticationController:getBearerToken');
|
|
299
314
|
return {
|
|
300
315
|
Authorization: `Bearer ${bearerToken}`,
|
|
301
316
|
};
|
|
302
317
|
}
|
|
303
|
-
/**
|
|
304
|
-
* Registers a handler that will be called after a request returns a non-500
|
|
305
|
-
* response, causing a retry. Primarily useful in tests where timers are being
|
|
306
|
-
* mocked.
|
|
307
|
-
*
|
|
308
|
-
* @param listener - The handler to be called.
|
|
309
|
-
* @returns An object that can be used to unregister the handler. See
|
|
310
|
-
* {@link CockatielEvent}.
|
|
311
|
-
* @see {@link createServicePolicy}
|
|
312
|
-
*/
|
|
313
|
-
onRetry(listener) {
|
|
314
|
-
return this.#policy.onRetry(listener);
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Registers a handler that will be called after a set number of retry rounds
|
|
318
|
-
* prove that requests to the API endpoint consistently return a 5xx response.
|
|
319
|
-
*
|
|
320
|
-
* @param listener - The handler to be called.
|
|
321
|
-
* @returns An object that can be used to unregister the handler. See
|
|
322
|
-
* {@link CockatielEvent}.
|
|
323
|
-
* @see {@link createServicePolicy}
|
|
324
|
-
*/
|
|
325
|
-
onBreak(listener) {
|
|
326
|
-
return this.#policy.onBreak(listener);
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* Registers a handler that will be called under one of two circumstances:
|
|
330
|
-
*
|
|
331
|
-
* 1. After a set number of retries prove that requests to the API
|
|
332
|
-
* consistently result in one of the following failures:
|
|
333
|
-
* 1. A connection initiation error
|
|
334
|
-
* 2. A connection reset error
|
|
335
|
-
* 3. A timeout error
|
|
336
|
-
* 4. A non-JSON response
|
|
337
|
-
* 5. A 502, 503, or 504 response
|
|
338
|
-
* 2. After a successful request is made to the API, but the response takes
|
|
339
|
-
* longer than a set duration to return.
|
|
340
|
-
*
|
|
341
|
-
* @param listener - The handler to be called.
|
|
342
|
-
* @returns An object that can be used to unregister the handler. See
|
|
343
|
-
* {@link CockatielEvent}.
|
|
344
|
-
*/
|
|
345
|
-
onDegraded(listener) {
|
|
346
|
-
return this.#policy.onDegraded(listener);
|
|
347
|
-
}
|
|
348
318
|
/**
|
|
349
319
|
* Adds common request parameters to a URL.
|
|
350
320
|
*
|
|
@@ -363,28 +333,35 @@ export class RampsService {
|
|
|
363
333
|
addRampsClientIdentityParams(url, this.#clientIdentity);
|
|
364
334
|
}
|
|
365
335
|
/**
|
|
366
|
-
*
|
|
336
|
+
* Builds the URL for an API request, including the common parameters.
|
|
367
337
|
*
|
|
368
338
|
* @param service - The API service type (determines base URL).
|
|
369
339
|
* @param path - The endpoint path.
|
|
370
|
-
* @param
|
|
371
|
-
* @
|
|
372
|
-
* @param options.responseType - How to parse the response ('json' or 'text').
|
|
373
|
-
* @returns The parsed response data.
|
|
340
|
+
* @param action - The ramp action type (optional).
|
|
341
|
+
* @returns The request URL.
|
|
374
342
|
*/
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
343
|
+
#buildUrl(service, path, action) {
|
|
344
|
+
const url = new URL(path, this.#getBaseUrl(service));
|
|
345
|
+
this.#addCommonParams(url, action);
|
|
346
|
+
return url;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Makes a request and throws an `HttpError` for a non-2xx response. Only
|
|
350
|
+
* call this from inside a query function, so that the request goes through
|
|
351
|
+
* the service policy.
|
|
352
|
+
*
|
|
353
|
+
* @param url - The URL to request.
|
|
354
|
+
* @param init - Optional request options.
|
|
355
|
+
* @returns The response.
|
|
356
|
+
*/
|
|
357
|
+
async #fetchOk(url, init) {
|
|
358
|
+
const response = init
|
|
359
|
+
? await this.#fetch(url, init)
|
|
360
|
+
: await this.#fetch(url);
|
|
361
|
+
if (!response.ok) {
|
|
362
|
+
throw new HttpError(response.status, `Fetching '${url.toString()}' failed with status '${response.status}'`);
|
|
363
|
+
}
|
|
364
|
+
return response;
|
|
388
365
|
}
|
|
389
366
|
/**
|
|
390
367
|
* Makes a request to the API in order to retrieve the user's geolocation
|
|
@@ -393,12 +370,17 @@ export class RampsService {
|
|
|
393
370
|
* @returns The user's country/region code (e.g., "US-UT" for Utah, USA).
|
|
394
371
|
*/
|
|
395
372
|
async getGeolocation() {
|
|
396
|
-
const
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
373
|
+
const url = this.#buildUrl(RampsApiService.Orders, 'geolocation');
|
|
374
|
+
return this.fetchQuery({
|
|
375
|
+
queryKey: [`${this.name}:getGeolocation`, url.toString()],
|
|
376
|
+
staleTime: 0,
|
|
377
|
+
gcTime: 0,
|
|
378
|
+
responseStruct: GeolocationStruct,
|
|
379
|
+
queryFn: async () => {
|
|
380
|
+
const response = await this.#fetchOk(url);
|
|
381
|
+
return (await response.text()).trim();
|
|
382
|
+
},
|
|
383
|
+
});
|
|
402
384
|
}
|
|
403
385
|
/**
|
|
404
386
|
* Makes a request to the cached API to retrieve the list of supported countries.
|
|
@@ -408,10 +390,17 @@ export class RampsService {
|
|
|
408
390
|
* @returns An array of countries filtered by aggregator support.
|
|
409
391
|
*/
|
|
410
392
|
async getCountries() {
|
|
411
|
-
const
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
393
|
+
const url = this.#buildUrl(RampsApiService.Regions, getApiPath('regions/countries'));
|
|
394
|
+
const countries = (await this.fetchQuery({
|
|
395
|
+
queryKey: [`${this.name}:getCountries`, url.toString()],
|
|
396
|
+
staleTime: 0,
|
|
397
|
+
gcTime: 0,
|
|
398
|
+
responseStruct: CountriesResponseStruct,
|
|
399
|
+
queryFn: async () => {
|
|
400
|
+
const response = await this.#fetchOk(url);
|
|
401
|
+
return (await response.json());
|
|
402
|
+
},
|
|
403
|
+
}));
|
|
415
404
|
return countries.filter((country) => {
|
|
416
405
|
const isCountrySupported = country.supported.buy || country.supported.sell;
|
|
417
406
|
if (country.states && country.states.length > 0) {
|
|
@@ -435,29 +424,23 @@ export class RampsService {
|
|
|
435
424
|
*/
|
|
436
425
|
async getTokens(region, action = 'buy', options) {
|
|
437
426
|
const normalizedRegion = region.toLowerCase().trim();
|
|
438
|
-
const url =
|
|
439
|
-
this.#addCommonParams(url, action);
|
|
427
|
+
const url = this.#buildUrl(RampsApiService.Regions, getApiPath(`regions/${normalizedRegion}/topTokens`), action);
|
|
440
428
|
if (options?.provider) {
|
|
441
429
|
const providerIds = Array.isArray(options.provider)
|
|
442
430
|
? options.provider
|
|
443
431
|
: [options.provider];
|
|
444
432
|
providerIds.forEach((id) => url.searchParams.append('provider', id));
|
|
445
433
|
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
434
|
+
return this.fetchQuery({
|
|
435
|
+
queryKey: [`${this.name}:getTokens`, url.toString()],
|
|
436
|
+
staleTime: 0,
|
|
437
|
+
gcTime: 0,
|
|
438
|
+
responseStruct: TokensResponseStruct,
|
|
439
|
+
queryFn: async () => {
|
|
440
|
+
const response = await this.#fetchOk(url);
|
|
441
|
+
return (await response.json());
|
|
442
|
+
},
|
|
452
443
|
});
|
|
453
|
-
if (!response || typeof response !== 'object') {
|
|
454
|
-
throw new Error('Malformed response received from tokens API');
|
|
455
|
-
}
|
|
456
|
-
if (!Array.isArray(response.topTokens) ||
|
|
457
|
-
!Array.isArray(response.allTokens)) {
|
|
458
|
-
throw new Error('Malformed response received from tokens API');
|
|
459
|
-
}
|
|
460
|
-
return response;
|
|
461
444
|
}
|
|
462
445
|
/**
|
|
463
446
|
* Fetches the list of providers for a given region.
|
|
@@ -473,8 +456,7 @@ export class RampsService {
|
|
|
473
456
|
*/
|
|
474
457
|
async getProviders(regionCode, options) {
|
|
475
458
|
const normalizedRegion = regionCode.toLowerCase().trim();
|
|
476
|
-
const url =
|
|
477
|
-
this.#addCommonParams(url);
|
|
459
|
+
const url = this.#buildUrl(RampsApiService.Regions, getApiPath(`regions/${normalizedRegion}/providers`));
|
|
478
460
|
if (options?.provider) {
|
|
479
461
|
const providerIds = Array.isArray(options.provider)
|
|
480
462
|
? options.provider
|
|
@@ -493,23 +475,21 @@ export class RampsService {
|
|
|
493
475
|
: [options.payments];
|
|
494
476
|
paymentIds.forEach((id) => url.searchParams.append('payments', id));
|
|
495
477
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
478
|
+
return this.fetchQuery({
|
|
479
|
+
queryKey: [`${this.name}:getProviders`, url.toString()],
|
|
480
|
+
staleTime: 0,
|
|
481
|
+
gcTime: 0,
|
|
482
|
+
responseStruct: ProvidersResponseStruct,
|
|
483
|
+
queryFn: async () => {
|
|
484
|
+
const response = await this.#fetchOk(url);
|
|
485
|
+
const body = (await response.json());
|
|
486
|
+
// Keep the lenient handling of a missing `sorted` list.
|
|
487
|
+
if (body && typeof body === 'object' && !Array.isArray(body.sorted)) {
|
|
488
|
+
return { ...body, sorted: [] };
|
|
489
|
+
}
|
|
490
|
+
return body;
|
|
491
|
+
},
|
|
502
492
|
});
|
|
503
|
-
if (!response || typeof response !== 'object') {
|
|
504
|
-
throw new Error('Malformed response received from providers API');
|
|
505
|
-
}
|
|
506
|
-
if (!Array.isArray(response.providers)) {
|
|
507
|
-
throw new Error('Malformed response received from providers API');
|
|
508
|
-
}
|
|
509
|
-
return {
|
|
510
|
-
providers: response.providers,
|
|
511
|
-
sorted: Array.isArray(response.sorted) ? response.sorted : [],
|
|
512
|
-
};
|
|
513
493
|
}
|
|
514
494
|
/**
|
|
515
495
|
* Fetches the list of payment methods for a given region, asset, and provider.
|
|
@@ -526,24 +506,19 @@ export class RampsService {
|
|
|
526
506
|
*/
|
|
527
507
|
async getPaymentMethods(options) {
|
|
528
508
|
const normalizedRegion = options.region.toLowerCase().trim();
|
|
529
|
-
const url =
|
|
530
|
-
this.#addCommonParams(url);
|
|
509
|
+
const url = this.#buildUrl(RampsApiService.Regions, getApiPath(`regions/${normalizedRegion}/payments`));
|
|
531
510
|
url.searchParams.set('region', options.region.toLowerCase().trim());
|
|
532
511
|
url.searchParams.set('provider', options.provider);
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
512
|
+
return this.fetchQuery({
|
|
513
|
+
queryKey: [`${this.name}:getPaymentMethods`, url.toString()],
|
|
514
|
+
staleTime: 0,
|
|
515
|
+
gcTime: 0,
|
|
516
|
+
responseStruct: PaymentMethodsResponseStruct,
|
|
517
|
+
queryFn: async () => {
|
|
518
|
+
const response = await this.#fetchOk(url);
|
|
519
|
+
return (await response.json());
|
|
520
|
+
},
|
|
539
521
|
});
|
|
540
|
-
if (!response || typeof response !== 'object') {
|
|
541
|
-
throw new Error('Malformed response received from paymentMethods API');
|
|
542
|
-
}
|
|
543
|
-
if (!Array.isArray(response.payments)) {
|
|
544
|
-
throw new Error('Malformed response received from paymentMethods API');
|
|
545
|
-
}
|
|
546
|
-
return response;
|
|
547
522
|
}
|
|
548
523
|
/**
|
|
549
524
|
* Fetches quotes from all providers for a given set of parameters.
|
|
@@ -586,23 +561,16 @@ export class RampsService {
|
|
|
586
561
|
if (params.redirectUrl) {
|
|
587
562
|
url.searchParams.set('redirectUrl', params.redirectUrl);
|
|
588
563
|
}
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
564
|
+
return this.fetchQuery({
|
|
565
|
+
queryKey: [`${this.name}:getQuotes`, url.toString()],
|
|
566
|
+
staleTime: 0,
|
|
567
|
+
gcTime: 0,
|
|
568
|
+
responseStruct: QuotesResponseStruct,
|
|
569
|
+
queryFn: async () => {
|
|
570
|
+
const response = await this.#fetchOk(url, { headers });
|
|
571
|
+
return (await response.json());
|
|
572
|
+
},
|
|
595
573
|
});
|
|
596
|
-
if (!response || typeof response !== 'object') {
|
|
597
|
-
throw new Error('Malformed response received from quotes API');
|
|
598
|
-
}
|
|
599
|
-
if (!Array.isArray(response.success) ||
|
|
600
|
-
!Array.isArray(response.sorted) ||
|
|
601
|
-
!Array.isArray(response.error) ||
|
|
602
|
-
!Array.isArray(response.customActions)) {
|
|
603
|
-
throw new Error('Malformed response received from quotes API');
|
|
604
|
-
}
|
|
605
|
-
return response;
|
|
606
574
|
}
|
|
607
575
|
/**
|
|
608
576
|
* Fetches the buy widget data from a buy URL endpoint.
|
|
@@ -616,17 +584,16 @@ export class RampsService {
|
|
|
616
584
|
const url = new URL(buyUrl);
|
|
617
585
|
this.#addCommonParams(url);
|
|
618
586
|
const headers = await this.#getRequestHeaders();
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
587
|
+
return this.fetchQuery({
|
|
588
|
+
queryKey: [`${this.name}:getBuyWidgetUrl`, url.toString()],
|
|
589
|
+
staleTime: 0,
|
|
590
|
+
gcTime: 0,
|
|
591
|
+
responseStruct: BuyWidgetResponseStruct,
|
|
592
|
+
queryFn: async () => {
|
|
593
|
+
const response = await this.#fetchOk(url, { headers });
|
|
594
|
+
return (await response.json());
|
|
595
|
+
},
|
|
625
596
|
});
|
|
626
|
-
if (!response || typeof response !== 'object' || !response.url) {
|
|
627
|
-
throw new Error('Malformed response received from buy widget URL API');
|
|
628
|
-
}
|
|
629
|
-
return response;
|
|
630
597
|
}
|
|
631
598
|
/**
|
|
632
599
|
* Strips the `/providers/` prefix so the URL path uses the short form.
|
|
@@ -651,22 +618,20 @@ export class RampsService {
|
|
|
651
618
|
*/
|
|
652
619
|
async getOrder(providerCode, orderCode, wallet) {
|
|
653
620
|
const segment = this.#toProviderSegment(providerCode);
|
|
654
|
-
const url =
|
|
655
|
-
this.#addCommonParams(url);
|
|
621
|
+
const url = this.#buildUrl(RampsApiService.Orders, getApiPath(`providers/${segment}/orders/${orderCode}`));
|
|
656
622
|
if (wallet) {
|
|
657
623
|
url.searchParams.set('wallet', wallet);
|
|
658
624
|
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
625
|
+
return this.fetchQuery({
|
|
626
|
+
queryKey: [`${this.name}:getOrder`, url.toString()],
|
|
627
|
+
staleTime: 0,
|
|
628
|
+
gcTime: 0,
|
|
629
|
+
responseStruct: OrderResponseStruct,
|
|
630
|
+
queryFn: async () => {
|
|
631
|
+
const response = await this.#fetchOk(url);
|
|
632
|
+
return (await response.json());
|
|
633
|
+
},
|
|
665
634
|
});
|
|
666
|
-
if (!response || typeof response !== 'object') {
|
|
667
|
-
throw new Error('Malformed response received from order API');
|
|
668
|
-
}
|
|
669
|
-
return response;
|
|
670
635
|
}
|
|
671
636
|
/**
|
|
672
637
|
* Extracts an order from a provider callback URL.
|
|
@@ -686,17 +651,22 @@ export class RampsService {
|
|
|
686
651
|
const segment = this.#toProviderSegment(providerCode);
|
|
687
652
|
// Step 1: Send the callback URL to the backend to extract the order ID.
|
|
688
653
|
// The backend parses it using provider-specific logic.
|
|
689
|
-
const callbackApiUrl =
|
|
690
|
-
this.#addCommonParams(callbackApiUrl);
|
|
654
|
+
const callbackApiUrl = this.#buildUrl(RampsApiService.Orders, getApiPath(`providers/${segment}/callback`));
|
|
691
655
|
callbackApiUrl.searchParams.set('url', callbackUrl);
|
|
692
|
-
const callbackResponse = await this
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
656
|
+
const callbackResponse = await this.fetchQuery({
|
|
657
|
+
queryKey: [
|
|
658
|
+
`${this.name}:getOrderFromCallback`,
|
|
659
|
+
callbackApiUrl.toString(),
|
|
660
|
+
],
|
|
661
|
+
staleTime: 0,
|
|
662
|
+
gcTime: 0,
|
|
663
|
+
responseStruct: OrderCallbackResponseStruct,
|
|
664
|
+
queryFn: async () => {
|
|
665
|
+
const response = await this.#fetchOk(callbackApiUrl);
|
|
666
|
+
return (await response.json());
|
|
667
|
+
},
|
|
698
668
|
});
|
|
699
|
-
const rawOrderId = callbackResponse
|
|
669
|
+
const rawOrderId = callbackResponse.id;
|
|
700
670
|
if (!rawOrderId) {
|
|
701
671
|
throw new Error('Could not extract order ID from callback URL via provider');
|
|
702
672
|
}
|
package/dist/RampsService.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RampsService.js","sourceRoot":"","sources":["../src/RampsService.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAI5E,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AA2iBpE,sBAAsB;AAEtB;;GAEG;AACH,MAAM,CAAN,IAAY,gBASX;AATD,WAAY,gBAAgB;IAC1B,uCAAmB,CAAA;IACnB,6CAAyB,CAAA;IACzB,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;IACnB,qCAAiB,CAAA;IACjB,2CAAuB,CAAA;IACvB,2CAAuB,CAAA;IACvB,4CAAwB,CAAA;AAC1B,CAAC,EATW,gBAAgB,KAAhB,gBAAgB,QAS3B;AAoGD;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAOzC,kBAAkB;AAElB;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,6CAAyB,CAAA;IACzB,uCAAmB,CAAA;IACnB,+CAA2B,CAAA;IAC3B,mCAAe,CAAA;AACjB,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,oCAAiB,CAAA;AACnB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AAED,oBAAoB;AAEpB,MAAM,yBAAyB,GAAG;IAChC,+BAA+B;IAC/B,gBAAgB;IAChB,cAAc;IACd,WAAW;IACX,cAAc;IACd,mBAAmB;IACnB,WAAW;IACX,iBAAiB;IACjB,UAAU;IACV,sB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EAAE;YAC7D,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;YACxD,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC;gBACtB,MAAM,IAAI,SAAS,CACjB,aAAa,CAAC,MAAM,EACpB,aAAa,cAAc,CAAC,QAAQ,EAAE,yBAAyB,aAAa,CAAC,MAAM,GAAG,CACvF,CAAC;YACJ,CAAC;YACD,OAAO,aAAa,CAAC,IAAI,EAA6B,CAAC;QACzD,CAAC,CAAC,CAAC;QAEH,MAAM,UAAU,GAAG,gBAAgB,EAAE,EAAE,CAAC;QACxC,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;QACJ,CAAC;QAED,4DAA4D;QAC5D,oDAAoD;QACpD,iEAAiE;QACjE,wBAAwB;QACxB,MAAM,SAAS,GAAG,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC9C,MAAM,SAAS,GACb,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;QAEhE,+DAA+D;QAC/D,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACxD,CAAC;CACF","sourcesContent":["import type {\n CreateServicePolicyOptions,\n ServicePolicy,\n} from '@metamask/controller-utils';\nimport { createServicePolicy, HttpError } from '@metamask/controller-utils';\nimport type { Messenger } from '@metamask/messenger';\nimport type { AuthenticationController } from '@metamask/profile-sync-controller';\n\nimport packageJson from '../package.json';\nimport type { RampsClientIdentity } from './client-identity.js';\nimport { addRampsClientIdentityParams } from './client-identity.js';\nimport type { RampsServiceMethodActions } from './RampsService-method-action-types.js';\n\n/**\n * Represents phone number information for a country.\n */\nexport type CountryPhone = {\n prefix: string;\n placeholder: string;\n template: string;\n};\n\n/**\n * Indicates whether a region supports buy and/or sell actions.\n */\nexport type SupportedActions = {\n /**\n * Whether buy actions are supported.\n */\n buy: boolean;\n /**\n * Whether sell actions are supported.\n */\n sell: boolean;\n};\n\n/**\n * Represents a state/province within a country.\n */\nexport type State = {\n /**\n * State identifier. Can be in path format (e.g., \"/regions/us-ut\") or ISO code format (e.g., \"us-ut\").\n */\n id?: string;\n /**\n * State name.\n */\n name?: string;\n /**\n * ISO state code (e.g., \"UT\", \"NY\").\n */\n stateId?: string;\n /**\n * Whether this state is supported for buy and/or sell ramp actions.\n */\n supported?: SupportedActions;\n /**\n * Whether this state is recommended.\n */\n recommended?: boolean;\n};\n\n/**\n * Represents a provider link.\n */\nexport type ProviderLink = {\n name: string;\n url: string;\n};\n\n/**\n * Represents provider logos.\n */\nexport type ProviderLogos = {\n light: string;\n dark: string;\n height: number;\n width: number;\n};\n\n/**\n * Browser type for provider buy features.\n */\nexport type ProviderBrowserType = 'APP_BROWSER' | 'IN_APP_OS_BROWSER' | null;\n\n/**\n * Fiat amount limits for a provider and payment method.\n */\nexport type ProviderLimit = {\n minAmount: number;\n maxAmount: number;\n feeFixedRate: number;\n feeDynamicRate: number;\n};\n\n/**\n * Fiat buy limits keyed by lowercased fiat short code, then payment method id.\n */\nexport type ProviderFiatLimits = Record<string, Record<string, ProviderLimit>>;\n\n/**\n * Provider limits exposed by the regions providers endpoint.\n */\nexport type ProviderLimits = {\n fiat?: ProviderFiatLimits;\n};\n\n/**\n * Represents a ramp provider.\n */\nexport type Provider = {\n id: string;\n name: string;\n /**\n * Provider classification from the v2 API: 'native' (first-party\n * integration, e.g. Transak Native) or 'aggregator' (third-party redirect).\n * May be absent on responses that predate the v2 type field.\n */\n type?: 'aggregator' | 'native';\n environmentType: string;\n description: string;\n hqAddress: string;\n links: ProviderLink[];\n logos: ProviderLogos;\n supportedCryptoCurrencies?: Record<string, boolean>;\n supportedFiatCurrencies?: Record<string, boolean>;\n supportedPaymentMethods?: Record<string, boolean>;\n limits?: ProviderLimits;\n};\n\n/**\n * Backend-defined ordering for providers.\n */\nexport type ProviderSortOrder = {\n sortBy: string;\n ids: string[];\n};\n\n/**\n * Response from the region providers API.\n */\nexport type ProvidersResponse = {\n providers: Provider[];\n sorted?: ProviderSortOrder[];\n};\n\n/**\n * Represents a payment method for funding a purchase.\n */\nexport type PaymentMethod = {\n /**\n * Canonical payment method ID (e.g., \"/payments/debit-credit-card\").\n */\n id: string;\n /**\n * Payment type identifier (e.g., \"debit-credit-card\", \"bank-transfer\").\n */\n paymentType: string;\n /**\n * User-facing name for the payment method.\n */\n name: string;\n /**\n * Score for sorting payment methods (higher is better).\n */\n score: number;\n /**\n * Icon identifier for the payment method.\n */\n icon: string;\n /**\n * Localized disclaimer text (optional).\n */\n disclaimer?: string;\n /**\n * Delay in minutes (e.g., [5, 10]).\n */\n delay?: number[];\n /**\n * Localized pending order description (optional).\n */\n pendingOrderDescription?: string;\n /**\n * Whether this payment method is a manual bank transfer.\n */\n isManualBankTransfer?: boolean;\n};\n\n/**\n * Response from the paymentMethods API.\n */\nexport type PaymentMethodsResponse = {\n /**\n * List of available payment methods.\n */\n payments: PaymentMethod[];\n /**\n * Recommended sorting for payment methods.\n */\n sort?: {\n ids: string[];\n sortBy: string;\n };\n};\n\n// === QUOTES TYPES ===\n\n/**\n * Sort criteria for quotes.\n */\nexport type QuoteSortBy = 'price' | 'reliability';\n\n/**\n * Represents crypto translation info for a quote.\n */\nexport type QuoteCryptoTranslation = {\n /**\n * The crypto currency ID.\n */\n id?: string;\n /**\n * The crypto symbol.\n */\n symbol?: string;\n /**\n * The chain ID.\n */\n chainId?: string;\n};\n\n/**\n * Widget information for executing a buy order.\n */\nexport type BuyWidget = {\n /**\n * The widget URL to open for the user to complete the purchase.\n */\n url: string;\n /**\n * The browser type to use for opening the widget.\n */\n browser?: ProviderBrowserType;\n /**\n * Order ID if already created.\n */\n orderId?: string | null;\n /**\n * Hosted-flow entry to fall back to when the provider turns the user away\n * inside an embedded checkout (e.g. Coinbase guest limits).\n */\n fallback?: BuyWidgetFallback;\n};\n\n/**\n * Alternate buy-widget entry for the same provider and quote, attached by the\n * quotes API when the primary flow is an embedded checkout that may reject the\n * user. Resolve it with `RampsController:getFallbackBuyWidgetData`.\n */\nexport type BuyWidgetFallback = {\n /**\n * Buy-widget request URL (same shape as `buyURL`) that yields the hosted flow.\n */\n url: string;\n /**\n * The browser type to use for opening the hosted flow.\n */\n browser: ProviderBrowserType;\n};\n\n/**\n * Represents an individual quote from a provider.\n */\nexport type Quote = {\n /**\n * The provider ID (e.g., \"/providers/moonpay\").\n */\n provider: string;\n /**\n * The quote details.\n */\n quote: {\n /**\n * The amount the user is paying (in fiat for buy, crypto for sell).\n */\n amountIn: number | string;\n /**\n * The amount the user will receive (in crypto for buy, fiat for sell).\n */\n amountOut: number | string;\n /**\n * The payment method used for this quote.\n */\n paymentMethod: string;\n /**\n * The fiat value of the output amount (for buy actions).\n */\n amountOutInFiat?: number;\n /**\n * Crypto translation info for display.\n */\n cryptoTranslation?: QuoteCryptoTranslation;\n /**\n * Total fees in the source currency.\n */\n totalFees?: number | string;\n /**\n * Network fees.\n */\n networkFee?: number | string;\n /**\n * Provider fees.\n */\n providerFee?: number | string;\n /**\n * Buy URL endpoint that returns the actual provider widget URL.\n *\n * This is a MetaMask-hosted endpoint that, when fetched, returns JSON with the provider's widget URL.\n *\n * @deprecated Use buyWidget instead - it's embedded in the quote response.\n */\n buyURL?: string;\n /**\n * Widget information embedded in the quote response.\n * Contains the widget URL, browser type, and optional pre-order tracking ID.\n */\n buyWidget?: BuyWidget;\n };\n /**\n * Metadata about the quote.\n */\n metadata?: {\n /**\n * Reliability score for the provider (0-100).\n */\n reliability?: number;\n /**\n * Tags for the quote.\n */\n tags?: {\n /**\n * Whether this is the best rate quote.\n */\n isBestRate?: boolean;\n /**\n * Whether this is the most reliable provider.\n */\n isMostReliable?: boolean;\n };\n };\n};\n\n/**\n * Represents an error from a provider when fetching quotes.\n */\nexport type QuoteError = {\n /**\n * The provider ID that failed.\n */\n provider: string;\n /**\n * Error message.\n */\n error?: string;\n};\n\n/**\n * Sort order information for quotes.\n */\nexport type QuoteSortOrder = {\n /**\n * The sort criteria.\n */\n sortBy: QuoteSortBy;\n /**\n * Provider IDs in sorted order.\n */\n ids: string[];\n};\n\n/**\n * Custom action for a provider (e.g., Apple Pay).\n */\nexport type QuoteCustomAction = {\n /**\n * Buy action details.\n */\n buy: {\n /**\n * Provider ID.\n */\n providerId: string;\n };\n /**\n * Payment method ID this action applies to.\n */\n paymentMethodId: string;\n /**\n * Supported payment method IDs.\n */\n supportedPaymentMethodIds: string[];\n};\n\n/**\n * Response from the quotes API.\n */\nexport type QuotesResponse = {\n /**\n * Successfully retrieved quotes.\n */\n success: Quote[];\n /**\n * Sort orders for the quotes.\n */\n sorted: QuoteSortOrder[];\n /**\n * Errors from providers that failed to return quotes.\n */\n error: QuoteError[];\n /**\n * Custom actions available from providers.\n */\n customActions: QuoteCustomAction[];\n};\n\n/**\n * Parameters for fetching quotes.\n */\nexport type GetQuotesParams = {\n /**\n * The region code (e.g., \"us\", \"us-ca\").\n */\n region: string;\n /**\n * Array of payment method IDs to get quotes for.\n */\n paymentMethods: string[];\n /**\n * The CAIP-19 asset ID (e.g., \"eip155:1/erc20:0x...\").\n */\n assetId: string;\n /**\n * The fiat currency code (e.g., \"usd\").\n */\n fiat: string;\n /**\n * The amount (in fiat for buy, crypto for sell).\n */\n amount: number;\n /**\n * The destination wallet address.\n */\n walletAddress: string;\n /**\n * Optional redirect URL after order completion.\n */\n redirectUrl?: string;\n /**\n * Optional provider IDs to filter quotes.\n */\n providers?: string[];\n /**\n * The ramp action type. Defaults to 'buy'.\n */\n action?: RampAction;\n};\n\n/**\n * Represents a country returned from the regions/countries API.\n */\nexport type Country = {\n /**\n * ISO-2 country code (e.g., \"US\", \"GB\").\n */\n isoCode: string;\n /**\n * Country identifier. Can be in path format (e.g., \"/regions/us\") or ISO code format.\n * If not provided, defaults to isoCode.\n */\n id?: string;\n /**\n * Country flag emoji or code.\n */\n flag: string;\n /**\n * Country name.\n */\n name: string;\n /**\n * Phone number information.\n */\n phone: CountryPhone;\n /**\n * Default currency code.\n */\n currency: string;\n /**\n * Whether this country is supported for buy and/or sell ramp actions.\n */\n supported: SupportedActions;\n /**\n * Whether this country is recommended.\n */\n recommended?: boolean;\n /**\n * Array of state objects.\n */\n states?: State[];\n /**\n * Default amount for ramps transactions.\n */\n defaultAmount?: number;\n /**\n * Quick amount options for ramps transactions.\n */\n quickAmounts?: number[];\n};\n\n/**\n * Represents a token returned from the regions/{region}/tokens API.\n */\nexport type RampsToken = {\n /**\n * The asset identifier in CAIP-19 format (e.g., \"eip155:1/erc20:0x...\").\n */\n assetId: string;\n /**\n * The chain identifier in CAIP-2 format (e.g., \"eip155:1\").\n */\n chainId: string;\n /**\n * Token name (e.g., \"USD Coin\").\n */\n name: string;\n /**\n * Token symbol (e.g., \"USDC\").\n */\n symbol: string;\n /**\n * Number of decimals for the token.\n */\n decimals: number;\n /**\n * URL to the token icon.\n */\n iconUrl: string;\n /**\n * Whether this token is supported.\n */\n tokenSupported: boolean;\n};\n\n/**\n * Response from the regions/{region}/tokens API.\n */\nexport type TokensResponse = {\n /**\n * Top/popular tokens for the region.\n */\n topTokens: RampsToken[];\n /**\n * All available tokens for the region.\n */\n allTokens: RampsToken[];\n};\n\n// === ORDER TYPES ===\n\n/**\n * Possible statuses for a ramps order.\n */\nexport enum RampsOrderStatus {\n Unknown = 'UNKNOWN',\n Precreated = 'PRECREATED',\n Created = 'CREATED',\n Pending = 'PENDING',\n Failed = 'FAILED',\n Completed = 'COMPLETED',\n Cancelled = 'CANCELLED',\n IdExpired = 'ID_EXPIRED',\n}\n\n/**\n * Network information associated with an order.\n */\nexport type RampsOrderNetwork = {\n name: string;\n chainId: string;\n};\n\n/**\n * Crypto currency information associated with an order.\n */\nexport type RampsOrderCryptoCurrency = {\n assetId?: string;\n name?: string;\n chainId?: string;\n decimals?: number;\n iconUrl?: string;\n symbol: string;\n};\n\n/**\n * Payment method information associated with an order.\n */\nexport type RampsOrderPaymentMethod = {\n id: string;\n name?: string;\n shortName?: string;\n duration?: string;\n icon?: string;\n isManualBankTransfer?: boolean;\n};\n\n/**\n * Bank transfer instruction fields attached to an order by providers\n * that require manual payment (e.g. SEPA, wire transfer).\n */\nexport type OrderPaymentDetail = {\n fiatCurrency: string;\n paymentMethod: string;\n fields: { name: string; id: string; value: string }[];\n};\n\n/**\n * Fiat currency information associated with an order.\n */\nexport type RampsOrderFiatCurrency = {\n id?: string;\n symbol: string;\n name?: string;\n decimals?: number;\n denomSymbol?: string;\n};\n\n/**\n * A unified order type returned from the V2 API.\n * The V2 endpoint normalizes all provider responses into this shape.\n */\nexport type RampsOrder = {\n id?: string;\n isOnlyLink: boolean;\n provider?: Provider;\n success: boolean;\n cryptoAmount: string | number;\n fiatAmount: number;\n cryptoCurrency?: RampsOrderCryptoCurrency;\n fiatCurrency?: RampsOrderFiatCurrency;\n providerOrderId: string;\n providerOrderLink: string;\n createdAt: number;\n paymentMethod?: RampsOrderPaymentMethod;\n totalFeesFiat: number;\n txHash: string;\n walletAddress: string;\n status: RampsOrderStatus;\n network: RampsOrderNetwork;\n canBeUpdated: boolean;\n idHasExpired: boolean;\n idExpirationDate?: number;\n excludeFromPurchases: boolean;\n timeDescriptionPending: string;\n fiatAmountInUsd?: number;\n feesInUsd?: number;\n region?: string;\n orderType: string;\n exchangeRate?: number;\n pollingSecondsMinimum?: number;\n statusDescription?: string;\n partnerFees?: number;\n networkFees?: number;\n paymentDetails?: OrderPaymentDetail[];\n /**\n * Last-updated timestamp used by User Storage order sync for LWW conflict\n * resolution. Set locally by {@link RampsController}; not returned by the V2\n * ramps API.\n */\n lastUpdatedAt?: number;\n};\n\n/**\n * The SDK version to send with API requests. (backwards-compatibility)\n */\nexport const RAMPS_SDK_VERSION = '2.1.6';\n\n/**\n * The type of ramp action: 'buy' or 'sell'.\n */\nexport type RampAction = 'buy' | 'sell';\n\n// === GENERAL ===\n\n/**\n * The name of the {@link RampsService}, used to namespace the\n * service's actions and events.\n */\nexport const serviceName = 'RampsService';\n\n/**\n * The environment to use for API requests.\n */\nexport enum RampsEnvironment {\n Production = 'production',\n Staging = 'staging',\n Development = 'development',\n Local = 'local',\n}\n\n/**\n * The type of ramps API service.\n * Determines which base URL to use (cache vs standard).\n */\nexport enum RampsApiService {\n Regions = 'regions',\n Orders = 'orders',\n}\n\n// === MESSENGER ===\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'getDefaultRedirectCallbackUrl',\n 'getGeolocation',\n 'getCountries',\n 'getTokens',\n 'getProviders',\n 'getPaymentMethods',\n 'getQuotes',\n 'getBuyWidgetUrl',\n 'getOrder',\n 'getOrderFromCallback',\n] as const;\n\n/**\n * Actions that {@link RampsService} exposes to other consumers.\n */\nexport type RampsServiceActions = RampsServiceMethodActions;\n\n/**\n * Actions from other messengers that {@link RampsService} calls.\n */\ntype AllowedActions =\n AuthenticationController.AuthenticationControllerGetBearerTokenAction;\n\n/**\n * Events that {@link RampsService} exposes to other consumers.\n */\nexport type RampsServiceEvents = never;\n\n/**\n * Events from other messengers that {@link RampsService} subscribes to.\n */\ntype AllowedEvents = never;\n\n/**\n * The messenger which is restricted to actions and events accessed by\n * {@link RampsService}.\n */\nexport type RampsServiceMessenger = Messenger<\n typeof serviceName,\n RampsServiceActions | AllowedActions,\n RampsServiceEvents | AllowedEvents\n>;\n\n// === SERVICE DEFINITION ===\n\n/**\n * Gets the base URL for API requests based on the environment and service type.\n * The Regions service uses a cache hostname in production and staging only;\n * development serves regions from the same `on-ramp.dev-api` host (no `-cache`).\n *\n * @param environment - The environment to use.\n * @param service - The API service type (determines if cache URL is used).\n * @returns The base URL for API requests.\n */\nfunction getBaseUrl(\n environment: RampsEnvironment,\n service: RampsApiService,\n): string {\n const cache =\n service === RampsApiService.Regions &&\n environment !== RampsEnvironment.Development\n ? '-cache'\n : '';\n\n switch (environment) {\n case RampsEnvironment.Production:\n return `https://on-ramp${cache}.api.cx.metamask.io`;\n case RampsEnvironment.Staging:\n return `https://on-ramp${cache}.uat-api.cx.metamask.io`;\n case RampsEnvironment.Development:\n return `https://on-ramp${cache}.dev-api.cx.metamask.io`;\n case RampsEnvironment.Local:\n return 'http://localhost:3000';\n default:\n throw new Error(`Invalid environment: ${String(environment)}`);\n }\n}\n\n/**\n * The path served by the ramps content host that redirects back into the\n * client once a non-native provider's widget flow completes.\n */\nconst FAKE_CALLBACK_PATH = '/regions/fake-callback';\n\n/**\n * Derives the default redirect (\"fake callback\") URL for the widened Headless\n * Buy quote fetch from the ramps environment.\n *\n * The quotes API only embeds a `buyURL`/`buyWidget` (the WebView page a\n * non-native provider needs) when a `redirectUrl` is present, so the widened\n * aggregator path supplies this default when the caller omits one. Production\n * and staging serve the callback from the `on-ramp-content` CDN hosts;\n * development has no `on-ramp-content.dev-api` deployment, so it uses the\n * `on-ramp.dev-api` host (which serves `/regions/fake-callback` and returns\n * 200). This intentionally does not reuse {@link getBaseUrl}, whose Regions\n * host is `on-ramp{-cache}`, not `on-ramp-content`.\n *\n * This is the canonical environment-to-callback map for the whole package.\n * Prefer the `RampsService:getDefaultRedirectCallbackUrl` messenger action at\n * runtime so the value always follows the environment the service is actually\n * configured with. Call this function directly only where a synchronous,\n * messenger-free value is needed (for example client UI that matches the\n * callback URL in a WebView), and pass the same environment the service was\n * constructed with.\n *\n * @param environment - The environment to derive the callback URL for.\n * @returns The default redirect callback URL for that environment.\n */\nexport function getDefaultRedirectCallbackUrl(\n environment: RampsEnvironment,\n): string {\n switch (environment) {\n case RampsEnvironment.Production:\n return `https://on-ramp-content.api.cx.metamask.io${FAKE_CALLBACK_PATH}`;\n case RampsEnvironment.Staging:\n return `https://on-ramp-content.uat-api.cx.metamask.io${FAKE_CALLBACK_PATH}`;\n case RampsEnvironment.Development:\n return `https://on-ramp.dev-api.cx.metamask.io${FAKE_CALLBACK_PATH}`;\n case RampsEnvironment.Local:\n return `http://localhost:3000${FAKE_CALLBACK_PATH}`;\n default:\n throw new Error(`Invalid environment: ${String(environment)}`);\n }\n}\n\n/**\n * Constructs an API path with a version prefix.\n *\n * @param path - The API endpoint path.\n * @param version - The API version prefix. Defaults to 'v2'.\n * @returns The versioned API path.\n */\nfunction getApiPath(path: string, version: string = 'v2'): string {\n return `${version}/${path}`;\n}\n\n/**\n * This service object is responsible for interacting with the Ramps API.\n *\n * @example\n *\n * ``` ts\n * import { Messenger } from '@metamask/messenger';\n * import type {\n * RampsServiceActions,\n * RampsServiceEvents,\n * } from '@metamask/ramps-controller';\n *\n * const rootMessenger = new Messenger<\n * 'Root',\n * RampsServiceActions\n * RampsServiceEvents\n * >({ namespace: 'Root' });\n * const rampsServiceMessenger = new Messenger<\n * 'RampsService',\n * RampsServiceActions,\n * RampsServiceEvents,\n * typeof rootMessenger,\n * >({\n * namespace: 'RampsService',\n * parent: rootMessenger,\n * });\n * // Instantiate the service to register its actions on the messenger\n * new RampsService({\n * messenger: rampsServiceMessenger,\n * environment: RampsEnvironment.Production,\n * context: 'mobile-ios',\n * fetch,\n * });\n *\n * // Later...\n * // Get the user's geolocation\n * const geolocation = await rootMessenger.call(\n * 'RampsService:getGeolocation',\n * );\n * // ... Do something with the geolocation ...\n * ```\n */\nexport class RampsService {\n /**\n * The name of the service.\n */\n readonly name: typeof serviceName;\n\n /**\n * The messenger suited for this service.\n */\n readonly #messenger: ConstructorParameters<\n typeof RampsService\n >[0]['messenger'];\n\n /**\n * A function that can be used to make an HTTP request.\n */\n readonly #fetch: ConstructorParameters<typeof RampsService>[0]['fetch'];\n\n /**\n * The policy that wraps the request.\n *\n * @see {@link createServicePolicy}\n */\n readonly #policy: ServicePolicy;\n\n /**\n * The environment used for API requests.\n */\n readonly #environment: RampsEnvironment;\n\n /**\n * The context for API requests (e.g., 'mobile-ios', 'mobile-android').\n */\n readonly #context: string;\n\n /**\n * Optional base URL override for local development.\n */\n readonly #baseUrlOverride?: string;\n\n readonly #clientIdentity: RampsClientIdentity;\n\n /**\n * Constructs a new RampsService object.\n *\n * @param args - The constructor arguments.\n * @param args.messenger - The messenger suited for this service.\n * @param args.environment - The environment to use for API requests.\n * @param args.context - The context for API requests (e.g., 'mobile-ios', 'mobile-android').\n * @param args.fetch - A function that can be used to make an HTTP request. If\n * your JavaScript environment supports `fetch` natively, you'll probably want\n * to pass that; otherwise you can pass an equivalent (such as `fetch` via\n * `node-fetch`).\n * @param args.policyOptions - Options to pass to `createServicePolicy`, which\n * is used to wrap each request. See {@link CreateServicePolicyOptions}.\n * @param args.baseUrlOverride - Optional base URL override for local development.\n * @param args.clientProduct - Optional MetaMask product id (`metamask-mobile`).\n * @param args.clientVersion - Optional app SemVer (not the ramps-controller package version).\n */\n constructor({\n messenger,\n environment = RampsEnvironment.Staging,\n context,\n fetch: fetchFunction,\n policyOptions = {},\n baseUrlOverride,\n clientProduct,\n clientVersion,\n }: {\n messenger: RampsServiceMessenger;\n environment?: RampsEnvironment;\n context: string;\n fetch: typeof fetch;\n policyOptions?: CreateServicePolicyOptions;\n baseUrlOverride?: string;\n clientProduct?: string;\n clientVersion?: string;\n }) {\n this.name = serviceName;\n this.#messenger = messenger;\n this.#fetch = fetchFunction;\n this.#policy = createServicePolicy(policyOptions);\n this.#environment = environment;\n this.#context = context;\n this.#baseUrlOverride = baseUrlOverride;\n this.#clientIdentity = {\n clientProduct,\n clientVersion,\n };\n\n this.#messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n /**\n * Gets the base URL for API requests, respecting the baseUrlOverride if set.\n *\n * @param service - The API service type.\n * @returns The base URL to use.\n */\n #getBaseUrl(service: RampsApiService): string {\n if (this.#baseUrlOverride) {\n return this.#baseUrlOverride;\n }\n return getBaseUrl(this.#environment, service);\n }\n\n /**\n * Returns the default redirect (\"fake callback\") URL for this service's\n * environment.\n *\n * The quotes API only embeds a `buyURL`/`buyWidget` (the WebView page a\n * non-native provider needs) when a `redirectUrl` is present, so callers\n * that omit one (MM Pay's widened Headless Buy fetch) use this value.\n * Exposing it here makes the service's environment the single runtime source\n * of truth, so the callback can never point at a different environment than\n * the one the quotes themselves came from.\n *\n * `baseUrlOverride` deliberately does not apply. That option overrides the\n * ramps API base URL for local development. In production and staging the\n * callback lives on a different host (`on-ramp-content` versus\n * `on-ramp{-cache}`), so an API override says nothing about where\n * `/regions/fake-callback` lives. In development the callback already shares\n * the API host family (`on-ramp.dev-api`). The redirect URL is also handed\n * to the provider and matched by client UI to detect flow completion, so\n * returning an unrelated local API origin here would break completion\n * detection rather than help it. Point `environment` at\n * {@link RampsEnvironment.Local} for a localhost callback, noting that URL\n * is pinned to `http://localhost:3000` and does not follow a non-3000\n * `baseUrlOverride`.\n *\n * @returns The default redirect callback URL for the configured environment.\n */\n getDefaultRedirectCallbackUrl(): string {\n return getDefaultRedirectCallbackUrl(this.#environment);\n }\n\n /**\n * Builds the request headers for authenticated ramps API calls.\n *\n * Fetches a bearer token from `AuthenticationController` and returns it as\n * an `Authorization` header. Throws if the token is unavailable (e.g. the\n * wallet is locked or the user is signed out).\n *\n * @returns Headers containing the `Authorization: Bearer <token>` entry.\n */\n async #getRequestHeaders(): Promise<Record<string, string>> {\n const bearerToken = await this.#messenger.call(\n 'AuthenticationController:getBearerToken',\n );\n return {\n Authorization: `Bearer ${bearerToken}`,\n };\n }\n\n /**\n * Registers a handler that will be called after a request returns a non-500\n * response, causing a retry. Primarily useful in tests where timers are being\n * mocked.\n *\n * @param listener - The handler to be called.\n * @returns An object that can be used to unregister the handler. See\n * {@link CockatielEvent}.\n * @see {@link createServicePolicy}\n */\n onRetry(\n listener: Parameters<ServicePolicy['onRetry']>[0],\n ): ReturnType<ServicePolicy['onRetry']> {\n return this.#policy.onRetry(listener);\n }\n\n /**\n * Registers a handler that will be called after a set number of retry rounds\n * prove that requests to the API endpoint consistently return a 5xx response.\n *\n * @param listener - The handler to be called.\n * @returns An object that can be used to unregister the handler. See\n * {@link CockatielEvent}.\n * @see {@link createServicePolicy}\n */\n onBreak(\n listener: Parameters<ServicePolicy['onBreak']>[0],\n ): ReturnType<ServicePolicy['onBreak']> {\n return this.#policy.onBreak(listener);\n }\n\n /**\n * Registers a handler that will be called under one of two circumstances:\n *\n * 1. After a set number of retries prove that requests to the API\n * consistently result in one of the following failures:\n * 1. A connection initiation error\n * 2. A connection reset error\n * 3. A timeout error\n * 4. A non-JSON response\n * 5. A 502, 503, or 504 response\n * 2. After a successful request is made to the API, but the response takes\n * longer than a set duration to return.\n *\n * @param listener - The handler to be called.\n * @returns An object that can be used to unregister the handler. See\n * {@link CockatielEvent}.\n */\n onDegraded(\n listener: Parameters<ServicePolicy['onDegraded']>[0],\n ): ReturnType<ServicePolicy['onDegraded']> {\n return this.#policy.onDegraded(listener);\n }\n\n /**\n * Adds common request parameters to a URL.\n *\n * @param url - The URL to add parameters to.\n * @param action - The ramp action type (optional, not all endpoints require it).\n */\n #addCommonParams(url: URL, action?: RampAction): void {\n if (action) {\n url.searchParams.set('action', action);\n }\n url.searchParams.set('sdk', RAMPS_SDK_VERSION);\n url.searchParams.set('controller', packageJson.version);\n url.searchParams.set('context', this.#context);\n // In the query string (not headers) so CDN-cached responses vary per\n // client product / version.\n addRampsClientIdentityParams(url, this.#clientIdentity);\n }\n\n /**\n * Makes an API request with retry policy and error handling.\n *\n * @param service - The API service type (determines base URL).\n * @param path - The endpoint path.\n * @param options - Request options.\n * @param options.action - The ramp action type (optional).\n * @param options.responseType - How to parse the response ('json' or 'text').\n * @returns The parsed response data.\n */\n async #request<TResponse>(\n service: RampsApiService,\n path: string,\n options: {\n action?: RampAction;\n responseType: 'json' | 'text';\n },\n ): Promise<TResponse> {\n return this.#policy.execute(async () => {\n const baseUrl = this.#getBaseUrl(service);\n const url = new URL(path, baseUrl);\n this.#addCommonParams(url, options.action);\n\n const response = await this.#fetch(url);\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `Fetching '${url.toString()}' failed with status '${response.status}'`,\n );\n }\n\n return options.responseType === 'json'\n ? (response.json() as Promise<TResponse>)\n : (response.text() as Promise<TResponse>);\n });\n }\n\n /**\n * Makes a request to the API in order to retrieve the user's geolocation\n * based on their IP address.\n *\n * @returns The user's country/region code (e.g., \"US-UT\" for Utah, USA).\n */\n async getGeolocation(): Promise<string> {\n const textResponse = await this.#request<string>(\n RampsApiService.Orders,\n 'geolocation',\n { responseType: 'text' },\n );\n\n const trimmedResponse = textResponse.trim();\n if (trimmedResponse.length > 0) {\n return trimmedResponse;\n }\n\n throw new Error('Malformed response received from geolocation API');\n }\n\n /**\n * Makes a request to the cached API to retrieve the list of supported countries.\n * The API returns countries with support information for both buy and sell actions.\n * Filters countries based on aggregator support (preserves OnRampSDK logic).\n *\n * @returns An array of countries filtered by aggregator support.\n */\n async getCountries(): Promise<Country[]> {\n const countries = await this.#request<Country[]>(\n RampsApiService.Regions,\n getApiPath('regions/countries'),\n { responseType: 'json' },\n );\n\n if (!Array.isArray(countries)) {\n throw new Error('Malformed response received from countries API');\n }\n\n return countries.filter((country) => {\n const isCountrySupported =\n country.supported.buy || country.supported.sell;\n\n if (country.states && country.states.length > 0) {\n const hasSupportedState = country.states.some(\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- intentionally using || to treat false as unsupported\n (state) => state.supported?.buy || state.supported?.sell,\n );\n return isCountrySupported || hasSupportedState;\n }\n\n return isCountrySupported;\n });\n }\n\n /**\n * Fetches the list of available tokens for a given region and action.\n * Supports optional provider filter.\n *\n * @param region - The region code (e.g., \"us\", \"fr\", \"us-ny\").\n * @param action - The ramp action type ('buy' or 'sell').\n * @param options - Optional query parameters for filtering tokens.\n * @param options.provider - Provider ID(s) to filter by.\n * @returns The tokens response containing topTokens and allTokens.\n */\n async getTokens(\n region: string,\n action: RampAction = 'buy',\n options?: {\n provider?: string | string[];\n },\n ): Promise<TokensResponse> {\n const normalizedRegion = region.toLowerCase().trim();\n const url = new URL(\n getApiPath(`regions/${normalizedRegion}/topTokens`),\n this.#getBaseUrl(RampsApiService.Regions),\n );\n this.#addCommonParams(url, action);\n\n if (options?.provider) {\n const providerIds = Array.isArray(options.provider)\n ? options.provider\n : [options.provider];\n providerIds.forEach((id) => url.searchParams.append('provider', id));\n }\n\n const response = await this.#policy.execute(async () => {\n const fetchResponse = await this.#fetch(url);\n if (!fetchResponse.ok) {\n throw new HttpError(\n fetchResponse.status,\n `Fetching '${url.toString()}' failed with status '${fetchResponse.status}'`,\n );\n }\n return fetchResponse.json() as Promise<TokensResponse>;\n });\n\n if (!response || typeof response !== 'object') {\n throw new Error('Malformed response received from tokens API');\n }\n\n if (\n !Array.isArray(response.topTokens) ||\n !Array.isArray(response.allTokens)\n ) {\n throw new Error('Malformed response received from tokens API');\n }\n\n return response;\n }\n\n /**\n * Fetches the list of providers for a given region.\n * Supports optional query filters: provider, crypto, payments.\n * Region local fiat filtering is applied server-side when `fiat` is omitted.\n *\n * @param regionCode - The region code (e.g., \"us\", \"fr\", \"us-ny\").\n * @param options - Optional query parameters for filtering providers.\n * @param options.provider - Provider ID(s) to filter by.\n * @param options.crypto - Crypto currency ID(s) to filter by.\n * @param options.payments - Payment method ID(s) to filter by.\n * @returns The providers response containing providers array.\n */\n async getProviders(\n regionCode: string,\n options?: {\n provider?: string | string[];\n crypto?: string | string[];\n payments?: string | string[];\n },\n ): Promise<ProvidersResponse> {\n const normalizedRegion = regionCode.toLowerCase().trim();\n const url = new URL(\n getApiPath(`regions/${normalizedRegion}/providers`),\n this.#getBaseUrl(RampsApiService.Regions),\n );\n this.#addCommonParams(url);\n\n if (options?.provider) {\n const providerIds = Array.isArray(options.provider)\n ? options.provider\n : [options.provider];\n providerIds.forEach((id) => url.searchParams.append('provider', id));\n }\n\n if (options?.crypto) {\n const cryptoIds = Array.isArray(options.crypto)\n ? options.crypto\n : [options.crypto];\n cryptoIds.forEach((id) => url.searchParams.append('crypto', id));\n }\n\n if (options?.payments) {\n const paymentIds = Array.isArray(options.payments)\n ? options.payments\n : [options.payments];\n paymentIds.forEach((id) => url.searchParams.append('payments', id));\n }\n\n const response = await this.#policy.execute(async () => {\n const fetchResponse = await this.#fetch(url);\n if (!fetchResponse.ok) {\n throw new HttpError(\n fetchResponse.status,\n `Fetching '${url.toString()}' failed with status '${fetchResponse.status}'`,\n );\n }\n return fetchResponse.json() as Promise<Partial<ProvidersResponse>>;\n });\n\n if (!response || typeof response !== 'object') {\n throw new Error('Malformed response received from providers API');\n }\n\n if (!Array.isArray(response.providers)) {\n throw new Error('Malformed response received from providers API');\n }\n\n return {\n providers: response.providers,\n sorted: Array.isArray(response.sorted) ? response.sorted : [],\n };\n }\n\n /**\n * Fetches the list of payment methods for a given region, asset, and provider.\n *\n * Region local fiat filtering is applied server-side when `fiat` is omitted.\n *\n * @param options - Query parameters for filtering payment methods.\n * @param options.region - User's region code (e.g., \"us-al\").\n * @param options.assetId - CAIP-19 cryptocurrency identifier. Kept on the\n * caller contract for local cache/staleness; not sent — `/payments` is scoped\n * to provider + region (the API ignores `crypto`).\n * @param options.provider - Provider ID path.\n * @returns The payment methods response containing payments array.\n */\n async getPaymentMethods(options: {\n region: string;\n assetId: string;\n provider: string;\n }): Promise<PaymentMethodsResponse> {\n const normalizedRegion = options.region.toLowerCase().trim();\n const url = new URL(\n getApiPath(`regions/${normalizedRegion}/payments`),\n this.#getBaseUrl(RampsApiService.Regions),\n );\n this.#addCommonParams(url);\n\n url.searchParams.set('region', options.region.toLowerCase().trim());\n url.searchParams.set('provider', options.provider);\n\n const response = await this.#policy.execute(async () => {\n const fetchResponse = await this.#fetch(url);\n if (!fetchResponse.ok) {\n throw new HttpError(\n fetchResponse.status,\n `Fetching '${url.toString()}' failed with status '${fetchResponse.status}'`,\n );\n }\n return fetchResponse.json() as Promise<PaymentMethodsResponse>;\n });\n\n if (!response || typeof response !== 'object') {\n throw new Error('Malformed response received from paymentMethods API');\n }\n\n if (!Array.isArray(response.payments)) {\n throw new Error('Malformed response received from paymentMethods API');\n }\n\n return response;\n }\n\n /**\n * Fetches quotes from all providers for a given set of parameters.\n * Uses the V2 orders API to get quotes for multiple payment methods at once.\n *\n * @param params - The parameters for fetching quotes.\n * @param params.region - User's region code (e.g., \"us\", \"us-ca\").\n * @param params.paymentMethods - Array of payment method IDs.\n * @param params.assetId - CAIP-19 cryptocurrency identifier.\n * @param params.fiat - Fiat currency code (e.g., \"usd\").\n * @param params.amount - The amount (in fiat for buy, crypto for sell).\n * @param params.walletAddress - The destination wallet address.\n * @param params.redirectUrl - Optional redirect URL after order completion.\n * @param params.providers - Optional provider IDs to filter quotes.\n * @param params.action - The ramp action type. Defaults to 'buy'.\n * @returns The quotes response containing success, sorted, error, and customActions.\n */\n async getQuotes(params: GetQuotesParams): Promise<QuotesResponse> {\n const normalizedRegion = params.region.toLowerCase().trim();\n const normalizedFiat = params.fiat.toLowerCase().trim();\n const action = params.action ?? 'buy';\n\n const url = new URL(\n getApiPath('quotes'),\n getBaseUrl(this.#environment, RampsApiService.Orders),\n );\n this.#addCommonParams(url, action);\n\n // Build region ID in the format expected by the API\n url.searchParams.set('region', normalizedRegion);\n url.searchParams.set('fiat', normalizedFiat);\n url.searchParams.set('crypto', params.assetId);\n url.searchParams.set('amount', String(params.amount));\n url.searchParams.set('walletAddress', params.walletAddress);\n\n const headers = await this.#getRequestHeaders();\n\n // Add payment methods as array parameters\n params.paymentMethods.forEach((paymentMethod) => {\n url.searchParams.append('payments', paymentMethod);\n });\n\n // Add provider filter if specified\n params.providers?.forEach((provider) => {\n url.searchParams.append('providers', provider);\n });\n\n // Add redirect URL if specified\n if (params.redirectUrl) {\n url.searchParams.set('redirectUrl', params.redirectUrl);\n }\n\n const response = await this.#policy.execute(async () => {\n const fetchResponse = await this.#fetch(url, { headers });\n if (!fetchResponse.ok) {\n throw new HttpError(\n fetchResponse.status,\n `Fetching '${url.toString()}' failed with status '${fetchResponse.status}'`,\n );\n }\n return fetchResponse.json() as Promise<QuotesResponse>;\n });\n\n if (!response || typeof response !== 'object') {\n throw new Error('Malformed response received from quotes API');\n }\n\n if (\n !Array.isArray(response.success) ||\n !Array.isArray(response.sorted) ||\n !Array.isArray(response.error) ||\n !Array.isArray(response.customActions)\n ) {\n throw new Error('Malformed response received from quotes API');\n }\n\n return response;\n }\n\n /**\n * Fetches the buy widget data from a buy URL endpoint.\n * Makes a request to the buyURL (as provided in a quote) to get the actual\n * provider widget URL, browser type, and order ID.\n *\n * @param buyUrl - The full buy URL endpoint to fetch from.\n * @returns The buy widget data containing the provider widget URL.\n */\n async getBuyWidgetUrl(buyUrl: string): Promise<BuyWidget> {\n const url = new URL(buyUrl);\n this.#addCommonParams(url);\n\n const headers = await this.#getRequestHeaders();\n\n const response = await this.#policy.execute(async () => {\n const fetchResponse = await this.#fetch(url, { headers });\n if (!fetchResponse.ok) {\n throw new HttpError(\n fetchResponse.status,\n `Fetching '${url.toString()}' failed with status '${fetchResponse.status}'`,\n );\n }\n return fetchResponse.json() as Promise<BuyWidget>;\n });\n\n if (!response || typeof response !== 'object' || !response.url) {\n throw new Error('Malformed response received from buy widget URL API');\n }\n\n return response;\n }\n\n /**\n * Strips the `/providers/` prefix so the URL path uses the short form.\n * Accepts both `/providers/transak` and `transak`.\n *\n * @param providerId - Provider ID in either path or short format.\n * @returns The short provider code.\n */\n #toProviderSegment(providerId: string): string {\n return providerId.replace(/^\\/providers\\//u, '');\n }\n\n /**\n * Fetches an order from the unified V2 API endpoint.\n * This endpoint returns a normalized `RampsOrder` (DepositOrder shape)\n * for all provider types, including both aggregator and native providers.\n *\n * @param providerCode - The provider code (e.g., \"transak\", \"transak-native\", \"moonpay\"),\n * with or without the `/providers/` prefix.\n * @param orderCode - The order identifier.\n * @param wallet - The wallet address associated with the order.\n * @returns The unified order data.\n */\n async getOrder(\n providerCode: string,\n orderCode: string,\n wallet: string,\n ): Promise<RampsOrder> {\n const segment = this.#toProviderSegment(providerCode);\n const url = new URL(\n getApiPath(`providers/${segment}/orders/${orderCode}`),\n this.#getBaseUrl(RampsApiService.Orders),\n );\n this.#addCommonParams(url);\n if (wallet) {\n url.searchParams.set('wallet', wallet);\n }\n\n const response = await this.#policy.execute(async () => {\n const fetchResponse = await this.#fetch(url);\n if (!fetchResponse.ok) {\n throw new HttpError(\n fetchResponse.status,\n `Fetching '${url.toString()}' failed with status '${fetchResponse.status}'`,\n );\n }\n return fetchResponse.json() as Promise<RampsOrder>;\n });\n\n if (!response || typeof response !== 'object') {\n throw new Error('Malformed response received from order API');\n }\n\n return response;\n }\n\n /**\n * Extracts an order from a provider callback URL.\n * Sends the callback URL to the V2 API backend, which knows how to parse\n * each provider's callback format and extract the order ID. Then fetches\n * the full order using that ID.\n *\n * This is the V2 equivalent of the aggregator SDK's `getOrderFromCallback`.\n *\n * @param providerCode - The provider code (e.g., \"transak\", \"moonpay\"),\n * with or without the `/providers/` prefix.\n * @param callbackUrl - The full callback URL the provider redirected to.\n * @param wallet - The wallet address associated with the order.\n * @returns The unified order data.\n */\n async getOrderFromCallback(\n providerCode: string,\n callbackUrl: string,\n wallet: string,\n ): Promise<RampsOrder> {\n const segment = this.#toProviderSegment(providerCode);\n // Step 1: Send the callback URL to the backend to extract the order ID.\n // The backend parses it using provider-specific logic.\n const callbackApiUrl = new URL(\n getApiPath(`providers/${segment}/callback`),\n this.#getBaseUrl(RampsApiService.Orders),\n );\n this.#addCommonParams(callbackApiUrl);\n callbackApiUrl.searchParams.set('url', callbackUrl);\n\n const callbackResponse = await this.#policy.execute(async () => {\n const fetchResponse = await this.#fetch(callbackApiUrl);\n if (!fetchResponse.ok) {\n throw new HttpError(\n fetchResponse.status,\n `Fetching '${callbackApiUrl.toString()}' failed with status '${fetchResponse.status}'`,\n );\n }\n return fetchResponse.json() as Promise<{ id: string }>;\n });\n\n const rawOrderId = callbackResponse?.id;\n if (!rawOrderId) {\n throw new Error(\n 'Could not extract order ID from callback URL via provider',\n );\n }\n\n // The callback response id may be a full resource path like\n // \"/providers/transak-staging/orders/3ec2e8ac-...\".\n // Extract just the order code (last segment) so getOrder doesn't\n // build a doubled path.\n const lastSlash = rawOrderId.lastIndexOf('/');\n const orderCode =\n lastSlash >= 0 ? rawOrderId.slice(lastSlash + 1) : rawOrderId;\n\n // Step 2: Fetch the full order using the extracted order code.\n return this.getOrder(providerCode, orderCode, wallet);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"RampsService.js","sourceRoot":"","sources":["../src/RampsService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAO9D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAIvD,OAAO,EACL,GAAG,EACH,KAAK,EACL,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,IAAI,IAAI,WAAW,GACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AA2iBpE,sBAAsB;AAEtB;;GAEG;AACH,MAAM,CAAN,IAAY,gBASX;AATD,WAAY,gBAAgB;IAC1B,uCAAmB,CAAA;IACnB,6CAAyB,CAAA;IACzB,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;IACnB,qCAAiB,CAAA;IACjB,2CAAuB,CAAA;IACvB,2CAAuB,CAAA;IACvB,4CAAwB,CAAA;AAC1B,CAAC,EATW,gBAAgB,KAAhB,gBAAgB,QAS3B;AAoGD;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAOzC,kBAAkB;AAElB;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,6CAAyB,CAAA;IACzB,uCAAmB,CAAA;IACnB,+CAA2B,CAAA;IAC3B,mCAAe,CAAA;AACjB,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB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AC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;QAEhE,+DAA+D;QAC/D,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IACxD,CAAC;CACF","sourcesContent":["import { BaseDataService } from '@metamask/base-data-service';\nimport type {\n CreateServicePolicyOptions,\n DataServiceCacheUpdatedEvent,\n DataServiceGranularCacheUpdatedEvent,\n DataServiceInvalidateQueriesAction,\n} from '@metamask/base-data-service';\nimport { HttpError } from '@metamask/controller-utils';\nimport type { Messenger } from '@metamask/messenger';\nimport type { AuthenticationController } from '@metamask/profile-sync-controller';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n any,\n array,\n boolean,\n nonempty,\n nullable,\n optional,\n string,\n type as looseObject,\n} from '@metamask/superstruct';\n\nimport packageJson from '../package.json';\nimport type { RampsClientIdentity } from './client-identity.js';\nimport { addRampsClientIdentityParams } from './client-identity.js';\nimport type { RampsServiceMethodActions } from './RampsService-method-action-types.js';\n\n/**\n * Represents phone number information for a country.\n */\nexport type CountryPhone = {\n prefix: string;\n placeholder: string;\n template: string;\n};\n\n/**\n * Indicates whether a region supports buy and/or sell actions.\n */\nexport type SupportedActions = {\n /**\n * Whether buy actions are supported.\n */\n buy: boolean;\n /**\n * Whether sell actions are supported.\n */\n sell: boolean;\n};\n\n/**\n * Represents a state/province within a country.\n */\nexport type State = {\n /**\n * State identifier. Can be in path format (e.g., \"/regions/us-ut\") or ISO code format (e.g., \"us-ut\").\n */\n id?: string;\n /**\n * State name.\n */\n name?: string;\n /**\n * ISO state code (e.g., \"UT\", \"NY\").\n */\n stateId?: string;\n /**\n * Whether this state is supported for buy and/or sell ramp actions.\n */\n supported?: SupportedActions;\n /**\n * Whether this state is recommended.\n */\n recommended?: boolean;\n};\n\n/**\n * Represents a provider link.\n */\nexport type ProviderLink = {\n name: string;\n url: string;\n};\n\n/**\n * Represents provider logos.\n */\nexport type ProviderLogos = {\n light: string;\n dark: string;\n height: number;\n width: number;\n};\n\n/**\n * Browser type for provider buy features.\n */\nexport type ProviderBrowserType = 'APP_BROWSER' | 'IN_APP_OS_BROWSER' | null;\n\n/**\n * Fiat amount limits for a provider and payment method.\n */\nexport type ProviderLimit = {\n minAmount: number;\n maxAmount: number;\n feeFixedRate: number;\n feeDynamicRate: number;\n};\n\n/**\n * Fiat buy limits keyed by lowercased fiat short code, then payment method id.\n */\nexport type ProviderFiatLimits = Record<string, Record<string, ProviderLimit>>;\n\n/**\n * Provider limits exposed by the regions providers endpoint.\n */\nexport type ProviderLimits = {\n fiat?: ProviderFiatLimits;\n};\n\n/**\n * Represents a ramp provider.\n */\nexport type Provider = {\n id: string;\n name: string;\n /**\n * Provider classification from the v2 API: 'native' (first-party\n * integration, e.g. Transak Native) or 'aggregator' (third-party redirect).\n * May be absent on responses that predate the v2 type field.\n */\n type?: 'aggregator' | 'native';\n environmentType: string;\n description: string;\n hqAddress: string;\n links: ProviderLink[];\n logos: ProviderLogos;\n supportedCryptoCurrencies?: Record<string, boolean>;\n supportedFiatCurrencies?: Record<string, boolean>;\n supportedPaymentMethods?: Record<string, boolean>;\n limits?: ProviderLimits;\n};\n\n/**\n * Backend-defined ordering for providers.\n */\nexport type ProviderSortOrder = {\n sortBy: string;\n ids: string[];\n};\n\n/**\n * Response from the region providers API.\n */\nexport type ProvidersResponse = {\n providers: Provider[];\n sorted?: ProviderSortOrder[];\n};\n\n/**\n * Represents a payment method for funding a purchase.\n */\nexport type PaymentMethod = {\n /**\n * Canonical payment method ID (e.g., \"/payments/debit-credit-card\").\n */\n id: string;\n /**\n * Payment type identifier (e.g., \"debit-credit-card\", \"bank-transfer\").\n */\n paymentType: string;\n /**\n * User-facing name for the payment method.\n */\n name: string;\n /**\n * Score for sorting payment methods (higher is better).\n */\n score: number;\n /**\n * Icon identifier for the payment method.\n */\n icon: string;\n /**\n * Localized disclaimer text (optional).\n */\n disclaimer?: string;\n /**\n * Delay in minutes (e.g., [5, 10]).\n */\n delay?: number[];\n /**\n * Localized pending order description (optional).\n */\n pendingOrderDescription?: string;\n /**\n * Whether this payment method is a manual bank transfer.\n */\n isManualBankTransfer?: boolean;\n};\n\n/**\n * Response from the paymentMethods API.\n */\nexport type PaymentMethodsResponse = {\n /**\n * List of available payment methods.\n */\n payments: PaymentMethod[];\n /**\n * Recommended sorting for payment methods.\n */\n sort?: {\n ids: string[];\n sortBy: string;\n };\n};\n\n// === QUOTES TYPES ===\n\n/**\n * Sort criteria for quotes.\n */\nexport type QuoteSortBy = 'price' | 'reliability';\n\n/**\n * Represents crypto translation info for a quote.\n */\nexport type QuoteCryptoTranslation = {\n /**\n * The crypto currency ID.\n */\n id?: string;\n /**\n * The crypto symbol.\n */\n symbol?: string;\n /**\n * The chain ID.\n */\n chainId?: string;\n};\n\n/**\n * Widget information for executing a buy order.\n */\nexport type BuyWidget = {\n /**\n * The widget URL to open for the user to complete the purchase.\n */\n url: string;\n /**\n * The browser type to use for opening the widget.\n */\n browser?: ProviderBrowserType;\n /**\n * Order ID if already created.\n */\n orderId?: string | null;\n /**\n * Hosted-flow entry to fall back to when the provider turns the user away\n * inside an embedded checkout (e.g. Coinbase guest limits).\n */\n fallback?: BuyWidgetFallback;\n};\n\n/**\n * Alternate buy-widget entry for the same provider and quote, attached by the\n * quotes API when the primary flow is an embedded checkout that may reject the\n * user. Resolve it with `RampsController:getFallbackBuyWidgetData`.\n */\nexport type BuyWidgetFallback = {\n /**\n * Buy-widget request URL (same shape as `buyURL`) that yields the hosted flow.\n */\n url: string;\n /**\n * The browser type to use for opening the hosted flow.\n */\n browser: ProviderBrowserType;\n};\n\n/**\n * Represents an individual quote from a provider.\n */\nexport type Quote = {\n /**\n * The provider ID (e.g., \"/providers/moonpay\").\n */\n provider: string;\n /**\n * The quote details.\n */\n quote: {\n /**\n * The amount the user is paying (in fiat for buy, crypto for sell).\n */\n amountIn: number | string;\n /**\n * The amount the user will receive (in crypto for buy, fiat for sell).\n */\n amountOut: number | string;\n /**\n * The payment method used for this quote.\n */\n paymentMethod: string;\n /**\n * The fiat value of the output amount (for buy actions).\n */\n amountOutInFiat?: number;\n /**\n * Crypto translation info for display.\n */\n cryptoTranslation?: QuoteCryptoTranslation;\n /**\n * Total fees in the source currency.\n */\n totalFees?: number | string;\n /**\n * Network fees.\n */\n networkFee?: number | string;\n /**\n * Provider fees.\n */\n providerFee?: number | string;\n /**\n * Buy URL endpoint that returns the actual provider widget URL.\n *\n * This is a MetaMask-hosted endpoint that, when fetched, returns JSON with the provider's widget URL.\n *\n * @deprecated Use buyWidget instead - it's embedded in the quote response.\n */\n buyURL?: string;\n /**\n * Widget information embedded in the quote response.\n * Contains the widget URL, browser type, and optional pre-order tracking ID.\n */\n buyWidget?: BuyWidget;\n };\n /**\n * Metadata about the quote.\n */\n metadata?: {\n /**\n * Reliability score for the provider (0-100).\n */\n reliability?: number;\n /**\n * Tags for the quote.\n */\n tags?: {\n /**\n * Whether this is the best rate quote.\n */\n isBestRate?: boolean;\n /**\n * Whether this is the most reliable provider.\n */\n isMostReliable?: boolean;\n };\n };\n};\n\n/**\n * Represents an error from a provider when fetching quotes.\n */\nexport type QuoteError = {\n /**\n * The provider ID that failed.\n */\n provider: string;\n /**\n * Error message.\n */\n error?: string;\n};\n\n/**\n * Sort order information for quotes.\n */\nexport type QuoteSortOrder = {\n /**\n * The sort criteria.\n */\n sortBy: QuoteSortBy;\n /**\n * Provider IDs in sorted order.\n */\n ids: string[];\n};\n\n/**\n * Custom action for a provider (e.g., Apple Pay).\n */\nexport type QuoteCustomAction = {\n /**\n * Buy action details.\n */\n buy: {\n /**\n * Provider ID.\n */\n providerId: string;\n };\n /**\n * Payment method ID this action applies to.\n */\n paymentMethodId: string;\n /**\n * Supported payment method IDs.\n */\n supportedPaymentMethodIds: string[];\n};\n\n/**\n * Response from the quotes API.\n */\nexport type QuotesResponse = {\n /**\n * Successfully retrieved quotes.\n */\n success: Quote[];\n /**\n * Sort orders for the quotes.\n */\n sorted: QuoteSortOrder[];\n /**\n * Errors from providers that failed to return quotes.\n */\n error: QuoteError[];\n /**\n * Custom actions available from providers.\n */\n customActions: QuoteCustomAction[];\n};\n\n/**\n * Parameters for fetching quotes.\n */\nexport type GetQuotesParams = {\n /**\n * The region code (e.g., \"us\", \"us-ca\").\n */\n region: string;\n /**\n * Array of payment method IDs to get quotes for.\n */\n paymentMethods: string[];\n /**\n * The CAIP-19 asset ID (e.g., \"eip155:1/erc20:0x...\").\n */\n assetId: string;\n /**\n * The fiat currency code (e.g., \"usd\").\n */\n fiat: string;\n /**\n * The amount (in fiat for buy, crypto for sell).\n */\n amount: number;\n /**\n * The destination wallet address.\n */\n walletAddress: string;\n /**\n * Optional redirect URL after order completion.\n */\n redirectUrl?: string;\n /**\n * Optional provider IDs to filter quotes.\n */\n providers?: string[];\n /**\n * The ramp action type. Defaults to 'buy'.\n */\n action?: RampAction;\n};\n\n/**\n * Represents a country returned from the regions/countries API.\n */\nexport type Country = {\n /**\n * ISO-2 country code (e.g., \"US\", \"GB\").\n */\n isoCode: string;\n /**\n * Country identifier. Can be in path format (e.g., \"/regions/us\") or ISO code format.\n * If not provided, defaults to isoCode.\n */\n id?: string;\n /**\n * Country flag emoji or code.\n */\n flag: string;\n /**\n * Country name.\n */\n name: string;\n /**\n * Phone number information.\n */\n phone: CountryPhone;\n /**\n * Default currency code.\n */\n currency: string;\n /**\n * Whether this country is supported for buy and/or sell ramp actions.\n */\n supported: SupportedActions;\n /**\n * Whether this country is recommended.\n */\n recommended?: boolean;\n /**\n * Array of state objects.\n */\n states?: State[];\n /**\n * Default amount for ramps transactions.\n */\n defaultAmount?: number;\n /**\n * Quick amount options for ramps transactions.\n */\n quickAmounts?: number[];\n};\n\n/**\n * Represents a token returned from the regions/{region}/tokens API.\n */\nexport type RampsToken = {\n /**\n * The asset identifier in CAIP-19 format (e.g., \"eip155:1/erc20:0x...\").\n */\n assetId: string;\n /**\n * The chain identifier in CAIP-2 format (e.g., \"eip155:1\").\n */\n chainId: string;\n /**\n * Token name (e.g., \"USD Coin\").\n */\n name: string;\n /**\n * Token symbol (e.g., \"USDC\").\n */\n symbol: string;\n /**\n * Number of decimals for the token.\n */\n decimals: number;\n /**\n * URL to the token icon.\n */\n iconUrl: string;\n /**\n * Whether this token is supported.\n */\n tokenSupported: boolean;\n};\n\n/**\n * Response from the regions/{region}/tokens API.\n */\nexport type TokensResponse = {\n /**\n * Top/popular tokens for the region.\n */\n topTokens: RampsToken[];\n /**\n * All available tokens for the region.\n */\n allTokens: RampsToken[];\n};\n\n// === ORDER TYPES ===\n\n/**\n * Possible statuses for a ramps order.\n */\nexport enum RampsOrderStatus {\n Unknown = 'UNKNOWN',\n Precreated = 'PRECREATED',\n Created = 'CREATED',\n Pending = 'PENDING',\n Failed = 'FAILED',\n Completed = 'COMPLETED',\n Cancelled = 'CANCELLED',\n IdExpired = 'ID_EXPIRED',\n}\n\n/**\n * Network information associated with an order.\n */\nexport type RampsOrderNetwork = {\n name: string;\n chainId: string;\n};\n\n/**\n * Crypto currency information associated with an order.\n */\nexport type RampsOrderCryptoCurrency = {\n assetId?: string;\n name?: string;\n chainId?: string;\n decimals?: number;\n iconUrl?: string;\n symbol: string;\n};\n\n/**\n * Payment method information associated with an order.\n */\nexport type RampsOrderPaymentMethod = {\n id: string;\n name?: string;\n shortName?: string;\n duration?: string;\n icon?: string;\n isManualBankTransfer?: boolean;\n};\n\n/**\n * Bank transfer instruction fields attached to an order by providers\n * that require manual payment (e.g. SEPA, wire transfer).\n */\nexport type OrderPaymentDetail = {\n fiatCurrency: string;\n paymentMethod: string;\n fields: { name: string; id: string; value: string }[];\n};\n\n/**\n * Fiat currency information associated with an order.\n */\nexport type RampsOrderFiatCurrency = {\n id?: string;\n symbol: string;\n name?: string;\n decimals?: number;\n denomSymbol?: string;\n};\n\n/**\n * A unified order type returned from the V2 API.\n * The V2 endpoint normalizes all provider responses into this shape.\n */\nexport type RampsOrder = {\n id?: string;\n isOnlyLink: boolean;\n provider?: Provider;\n success: boolean;\n cryptoAmount: string | number;\n fiatAmount: number;\n cryptoCurrency?: RampsOrderCryptoCurrency;\n fiatCurrency?: RampsOrderFiatCurrency;\n providerOrderId: string;\n providerOrderLink: string;\n createdAt: number;\n paymentMethod?: RampsOrderPaymentMethod;\n totalFeesFiat: number;\n txHash: string;\n walletAddress: string;\n status: RampsOrderStatus;\n network: RampsOrderNetwork;\n canBeUpdated: boolean;\n idHasExpired: boolean;\n idExpirationDate?: number;\n excludeFromPurchases: boolean;\n timeDescriptionPending: string;\n fiatAmountInUsd?: number;\n feesInUsd?: number;\n region?: string;\n orderType: string;\n exchangeRate?: number;\n pollingSecondsMinimum?: number;\n statusDescription?: string;\n partnerFees?: number;\n networkFees?: number;\n paymentDetails?: OrderPaymentDetail[];\n /**\n * Last-updated timestamp used by User Storage order sync for LWW conflict\n * resolution. Set locally by {@link RampsController}; not returned by the V2\n * ramps API.\n */\n lastUpdatedAt?: number;\n};\n\n/**\n * The SDK version to send with API requests. (backwards-compatibility)\n */\nexport const RAMPS_SDK_VERSION = '2.1.6';\n\n/**\n * The type of ramp action: 'buy' or 'sell'.\n */\nexport type RampAction = 'buy' | 'sell';\n\n// === GENERAL ===\n\n/**\n * The name of the {@link RampsService}, used to namespace the\n * service's actions and events.\n */\nexport const serviceName = 'RampsService';\n\n/**\n * The environment to use for API requests.\n */\nexport enum RampsEnvironment {\n Production = 'production',\n Staging = 'staging',\n Development = 'development',\n Local = 'local',\n}\n\n/**\n * The type of ramps API service.\n * Determines which base URL to use (cache vs standard).\n */\nexport enum RampsApiService {\n Regions = 'regions',\n Orders = 'orders',\n}\n\n// === MESSENGER ===\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'getDefaultRedirectCallbackUrl',\n 'getGeolocation',\n 'getCountries',\n 'getTokens',\n 'getProviders',\n 'getPaymentMethods',\n 'getQuotes',\n 'getBuyWidgetUrl',\n 'getOrder',\n 'getOrderFromCallback',\n] as const;\n\n/**\n * Invalidates cached queries in the service. See\n * {@link BaseDataService.invalidateQueries}.\n */\nexport type RampsServiceInvalidateQueriesAction =\n DataServiceInvalidateQueriesAction<typeof serviceName>;\n\n/**\n * Actions that {@link RampsService} exposes to other consumers.\n */\nexport type RampsServiceActions =\n | RampsServiceMethodActions\n | RampsServiceInvalidateQueriesAction;\n\n/**\n * Actions from other messengers that {@link RampsService} calls.\n */\ntype AllowedActions =\n AuthenticationController.AuthenticationControllerGetBearerTokenAction;\n\n/**\n * Published when the service's cache is updated.\n */\nexport type RampsServiceCacheUpdatedEvent = DataServiceCacheUpdatedEvent<\n typeof serviceName\n>;\n\n/**\n * Published when a specific cache entry of the service is updated.\n */\nexport type RampsServiceGranularCacheUpdatedEvent =\n DataServiceGranularCacheUpdatedEvent<typeof serviceName>;\n\n/**\n * Events that {@link RampsService} exposes to other consumers.\n */\nexport type RampsServiceEvents =\n | RampsServiceCacheUpdatedEvent\n | RampsServiceGranularCacheUpdatedEvent;\n\n/**\n * Events from other messengers that {@link RampsService} subscribes to.\n */\ntype AllowedEvents = never;\n\n/**\n * The messenger which is restricted to actions and events accessed by\n * {@link RampsService}.\n */\nexport type RampsServiceMessenger = Messenger<\n typeof serviceName,\n RampsServiceActions | AllowedActions,\n RampsServiceEvents | AllowedEvents\n>;\n\n// === API RESPONSE SCHEMAS ===\n\n// The structs only check the parts of each response that the service relies on.\n// Unknown properties are kept as is.\n\nconst GeolocationStruct = nonempty(string());\n\nconst CountriesResponseStruct = array(\n looseObject({\n supported: looseObject({\n buy: optional(boolean()),\n sell: optional(boolean()),\n }),\n states: optional(nullable(array(any()))),\n }),\n);\n\nconst TokensResponseStruct = looseObject({\n topTokens: array(any()),\n allTokens: array(any()),\n});\n\nconst ProvidersResponseStruct = looseObject({\n providers: array(any()),\n sorted: array(any()),\n});\n\nconst PaymentMethodsResponseStruct = looseObject({ payments: array(any()) });\n\nconst QuotesResponseStruct = looseObject({\n success: array(any()),\n sorted: array(any()),\n error: array(any()),\n customActions: array(any()),\n});\n\nconst BuyWidgetResponseStruct = looseObject({ url: nonempty(string()) });\n\nconst OrderResponseStruct = looseObject({});\n\nconst OrderCallbackResponseStruct = looseObject({ id: optional(string()) });\n\n// === SERVICE DEFINITION ===\n\n/**\n * Gets the base URL for API requests based on the environment and service type.\n * The Regions service uses a cache hostname in production and staging only;\n * development serves regions from the same `on-ramp.dev-api` host (no `-cache`).\n *\n * @param environment - The environment to use.\n * @param service - The API service type (determines if cache URL is used).\n * @returns The base URL for API requests.\n */\nfunction getBaseUrl(\n environment: RampsEnvironment,\n service: RampsApiService,\n): string {\n const cache =\n service === RampsApiService.Regions &&\n environment !== RampsEnvironment.Development\n ? '-cache'\n : '';\n\n switch (environment) {\n case RampsEnvironment.Production:\n return `https://on-ramp${cache}.api.cx.metamask.io`;\n case RampsEnvironment.Staging:\n return `https://on-ramp${cache}.uat-api.cx.metamask.io`;\n case RampsEnvironment.Development:\n return `https://on-ramp${cache}.dev-api.cx.metamask.io`;\n case RampsEnvironment.Local:\n return 'http://localhost:3000';\n default:\n throw new Error(`Invalid environment: ${String(environment)}`);\n }\n}\n\n/**\n * The path served by the ramps content host that redirects back into the\n * client once a non-native provider's widget flow completes.\n */\nconst FAKE_CALLBACK_PATH = '/regions/fake-callback';\n\n/**\n * Derives the default redirect (\"fake callback\") URL for the widened Headless\n * Buy quote fetch from the ramps environment.\n *\n * The quotes API only embeds a `buyURL`/`buyWidget` (the WebView page a\n * non-native provider needs) when a `redirectUrl` is present, so the widened\n * aggregator path supplies this default when the caller omits one. Production\n * and staging serve the callback from the `on-ramp-content` CDN hosts;\n * development has no `on-ramp-content.dev-api` deployment, so it uses the\n * `on-ramp.dev-api` host (which serves `/regions/fake-callback` and returns\n * 200). This intentionally does not reuse {@link getBaseUrl}, whose Regions\n * host is `on-ramp{-cache}`, not `on-ramp-content`.\n *\n * This is the canonical environment-to-callback map for the whole package.\n * Prefer the `RampsService:getDefaultRedirectCallbackUrl` messenger action at\n * runtime so the value always follows the environment the service is actually\n * configured with. Call this function directly only where a synchronous,\n * messenger-free value is needed (for example client UI that matches the\n * callback URL in a WebView), and pass the same environment the service was\n * constructed with.\n *\n * @param environment - The environment to derive the callback URL for.\n * @returns The default redirect callback URL for that environment.\n */\nexport function getDefaultRedirectCallbackUrl(\n environment: RampsEnvironment,\n): string {\n switch (environment) {\n case RampsEnvironment.Production:\n return `https://on-ramp-content.api.cx.metamask.io${FAKE_CALLBACK_PATH}`;\n case RampsEnvironment.Staging:\n return `https://on-ramp-content.uat-api.cx.metamask.io${FAKE_CALLBACK_PATH}`;\n case RampsEnvironment.Development:\n return `https://on-ramp.dev-api.cx.metamask.io${FAKE_CALLBACK_PATH}`;\n case RampsEnvironment.Local:\n return `http://localhost:3000${FAKE_CALLBACK_PATH}`;\n default:\n throw new Error(`Invalid environment: ${String(environment)}`);\n }\n}\n\n/**\n * Constructs an API path with a version prefix.\n *\n * @param path - The API endpoint path.\n * @param version - The API version prefix. Defaults to 'v2'.\n * @returns The versioned API path.\n */\nfunction getApiPath(path: string, version: string = 'v2'): string {\n return `${version}/${path}`;\n}\n\n/**\n * This service object is responsible for interacting with the Ramps API.\n *\n * @example\n *\n * ``` ts\n * import { Messenger } from '@metamask/messenger';\n * import type {\n * RampsServiceActions,\n * RampsServiceEvents,\n * } from '@metamask/ramps-controller';\n *\n * const rootMessenger = new Messenger<\n * 'Root',\n * RampsServiceActions\n * RampsServiceEvents\n * >({ namespace: 'Root' });\n * const rampsServiceMessenger = new Messenger<\n * 'RampsService',\n * RampsServiceActions,\n * RampsServiceEvents,\n * typeof rootMessenger,\n * >({\n * namespace: 'RampsService',\n * parent: rootMessenger,\n * });\n * // Instantiate the service to register its actions on the messenger\n * new RampsService({\n * messenger: rampsServiceMessenger,\n * environment: RampsEnvironment.Production,\n * context: 'mobile-ios',\n * fetch,\n * });\n *\n * // Later...\n * // Get the user's geolocation\n * const geolocation = await rootMessenger.call(\n * 'RampsService:getGeolocation',\n * );\n * // ... Do something with the geolocation ...\n * ```\n */\nexport class RampsService extends BaseDataService<\n typeof serviceName,\n RampsServiceMessenger\n> {\n /**\n * A function that can be used to make an HTTP request.\n */\n readonly #fetch: typeof fetch;\n\n /**\n * The environment used for API requests.\n */\n readonly #environment: RampsEnvironment;\n\n /**\n * The context for API requests (e.g., 'mobile-ios', 'mobile-android').\n */\n readonly #context: string;\n\n /**\n * Optional base URL override for local development.\n */\n readonly #baseUrlOverride?: string;\n\n readonly #clientIdentity: RampsClientIdentity;\n\n /**\n * Constructs a new RampsService object.\n *\n * @param args - The constructor arguments.\n * @param args.messenger - The messenger suited for this service.\n * @param args.environment - The environment to use for API requests.\n * @param args.context - The context for API requests (e.g., 'mobile-ios', 'mobile-android').\n * @param args.fetch - A function that can be used to make an HTTP request. If\n * your JavaScript environment supports `fetch` natively, you'll probably want\n * to pass that; otherwise you can pass an equivalent (such as `fetch` via\n * `node-fetch`).\n * @param args.policyOptions - Options to pass to `createServicePolicy`, which\n * is used to wrap each request. See {@link CreateServicePolicyOptions}.\n * @param args.baseUrlOverride - Optional base URL override for local development.\n * @param args.clientProduct - Optional MetaMask product id (`metamask-mobile`).\n * @param args.clientVersion - Optional app SemVer (not the ramps-controller package version).\n */\n constructor({\n messenger,\n environment = RampsEnvironment.Staging,\n context,\n fetch: fetchFunction,\n policyOptions = {},\n baseUrlOverride,\n clientProduct,\n clientVersion,\n }: {\n messenger: RampsServiceMessenger;\n environment?: RampsEnvironment;\n context: string;\n fetch: typeof fetch;\n policyOptions?: CreateServicePolicyOptions;\n baseUrlOverride?: string;\n clientProduct?: string;\n clientVersion?: string;\n }) {\n super({ name: serviceName, messenger, policyOptions });\n this.#fetch = fetchFunction;\n this.#environment = environment;\n this.#context = context;\n this.#baseUrlOverride = baseUrlOverride;\n this.#clientIdentity = {\n clientProduct,\n clientVersion,\n };\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n /**\n * Gets the base URL for API requests, respecting the baseUrlOverride if set.\n *\n * @param service - The API service type.\n * @returns The base URL to use.\n */\n #getBaseUrl(service: RampsApiService): string {\n if (this.#baseUrlOverride) {\n return this.#baseUrlOverride;\n }\n return getBaseUrl(this.#environment, service);\n }\n\n /**\n * Returns the default redirect (\"fake callback\") URL for this service's\n * environment.\n *\n * The quotes API only embeds a `buyURL`/`buyWidget` (the WebView page a\n * non-native provider needs) when a `redirectUrl` is present, so callers\n * that omit one (MM Pay's widened Headless Buy fetch) use this value.\n * Exposing it here makes the service's environment the single runtime source\n * of truth, so the callback can never point at a different environment than\n * the one the quotes themselves came from.\n *\n * `baseUrlOverride` deliberately does not apply. That option overrides the\n * ramps API base URL for local development. In production and staging the\n * callback lives on a different host (`on-ramp-content` versus\n * `on-ramp{-cache}`), so an API override says nothing about where\n * `/regions/fake-callback` lives. In development the callback already shares\n * the API host family (`on-ramp.dev-api`). The redirect URL is also handed\n * to the provider and matched by client UI to detect flow completion, so\n * returning an unrelated local API origin here would break completion\n * detection rather than help it. Point `environment` at\n * {@link RampsEnvironment.Local} for a localhost callback, noting that URL\n * is pinned to `http://localhost:3000` and does not follow a non-3000\n * `baseUrlOverride`.\n *\n * @returns The default redirect callback URL for the configured environment.\n */\n getDefaultRedirectCallbackUrl(): string {\n return getDefaultRedirectCallbackUrl(this.#environment);\n }\n\n /**\n * Builds the request headers for authenticated ramps API calls.\n *\n * Fetches a bearer token from `AuthenticationController` and returns it as\n * an `Authorization` header. Throws if the token is unavailable (e.g. the\n * wallet is locked or the user is signed out).\n *\n * @returns Headers containing the `Authorization: Bearer <token>` entry.\n */\n async #getRequestHeaders(): Promise<Record<string, string>> {\n const bearerToken = await this.messenger.call(\n 'AuthenticationController:getBearerToken',\n );\n return {\n Authorization: `Bearer ${bearerToken}`,\n };\n }\n\n /**\n * Adds common request parameters to a URL.\n *\n * @param url - The URL to add parameters to.\n * @param action - The ramp action type (optional, not all endpoints require it).\n */\n #addCommonParams(url: URL, action?: RampAction): void {\n if (action) {\n url.searchParams.set('action', action);\n }\n url.searchParams.set('sdk', RAMPS_SDK_VERSION);\n url.searchParams.set('controller', packageJson.version);\n url.searchParams.set('context', this.#context);\n // In the query string (not headers) so CDN-cached responses vary per\n // client product / version.\n addRampsClientIdentityParams(url, this.#clientIdentity);\n }\n\n /**\n * Builds the URL for an API request, including the common parameters.\n *\n * @param service - The API service type (determines base URL).\n * @param path - The endpoint path.\n * @param action - The ramp action type (optional).\n * @returns The request URL.\n */\n #buildUrl(service: RampsApiService, path: string, action?: RampAction): URL {\n const url = new URL(path, this.#getBaseUrl(service));\n this.#addCommonParams(url, action);\n return url;\n }\n\n /**\n * Makes a request and throws an `HttpError` for a non-2xx response. Only\n * call this from inside a query function, so that the request goes through\n * the service policy.\n *\n * @param url - The URL to request.\n * @param init - Optional request options.\n * @returns The response.\n */\n async #fetchOk(url: URL, init?: RequestInit): Promise<Response> {\n const response = init\n ? await this.#fetch(url, init)\n : await this.#fetch(url);\n if (!response.ok) {\n throw new HttpError(\n response.status,\n `Fetching '${url.toString()}' failed with status '${response.status}'`,\n );\n }\n return response;\n }\n\n /**\n * Makes a request to the API in order to retrieve the user's geolocation\n * based on their IP address.\n *\n * @returns The user's country/region code (e.g., \"US-UT\" for Utah, USA).\n */\n async getGeolocation(): Promise<string> {\n const url = this.#buildUrl(RampsApiService.Orders, 'geolocation');\n\n return this.fetchQuery({\n queryKey: [`${this.name}:getGeolocation`, url.toString()],\n staleTime: 0,\n gcTime: 0,\n responseStruct: GeolocationStruct,\n queryFn: async () => {\n const response = await this.#fetchOk(url);\n return (await response.text()).trim();\n },\n });\n }\n\n /**\n * Makes a request to the cached API to retrieve the list of supported countries.\n * The API returns countries with support information for both buy and sell actions.\n * Filters countries based on aggregator support (preserves OnRampSDK logic).\n *\n * @returns An array of countries filtered by aggregator support.\n */\n async getCountries(): Promise<Country[]> {\n const url = this.#buildUrl(\n RampsApiService.Regions,\n getApiPath('regions/countries'),\n );\n\n const countries = (await this.fetchQuery({\n queryKey: [`${this.name}:getCountries`, url.toString()],\n staleTime: 0,\n gcTime: 0,\n responseStruct: CountriesResponseStruct,\n queryFn: async () => {\n const response = await this.#fetchOk(url);\n return (await response.json()) as Infer<typeof CountriesResponseStruct>;\n },\n })) as unknown as Country[];\n\n return countries.filter((country) => {\n const isCountrySupported =\n country.supported.buy || country.supported.sell;\n\n if (country.states && country.states.length > 0) {\n const hasSupportedState = country.states.some(\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- intentionally using || to treat false as unsupported\n (state) => state.supported?.buy || state.supported?.sell,\n );\n return isCountrySupported || hasSupportedState;\n }\n\n return isCountrySupported;\n });\n }\n\n /**\n * Fetches the list of available tokens for a given region and action.\n * Supports optional provider filter.\n *\n * @param region - The region code (e.g., \"us\", \"fr\", \"us-ny\").\n * @param action - The ramp action type ('buy' or 'sell').\n * @param options - Optional query parameters for filtering tokens.\n * @param options.provider - Provider ID(s) to filter by.\n * @returns The tokens response containing topTokens and allTokens.\n */\n async getTokens(\n region: string,\n action: RampAction = 'buy',\n options?: {\n provider?: string | string[];\n },\n ): Promise<TokensResponse> {\n const normalizedRegion = region.toLowerCase().trim();\n const url = this.#buildUrl(\n RampsApiService.Regions,\n getApiPath(`regions/${normalizedRegion}/topTokens`),\n action,\n );\n\n if (options?.provider) {\n const providerIds = Array.isArray(options.provider)\n ? options.provider\n : [options.provider];\n providerIds.forEach((id) => url.searchParams.append('provider', id));\n }\n\n return this.fetchQuery({\n queryKey: [`${this.name}:getTokens`, url.toString()],\n staleTime: 0,\n gcTime: 0,\n responseStruct: TokensResponseStruct,\n queryFn: async () => {\n const response = await this.#fetchOk(url);\n return (await response.json()) as Infer<typeof TokensResponseStruct>;\n },\n });\n }\n\n /**\n * Fetches the list of providers for a given region.\n * Supports optional query filters: provider, crypto, payments.\n * Region local fiat filtering is applied server-side when `fiat` is omitted.\n *\n * @param regionCode - The region code (e.g., \"us\", \"fr\", \"us-ny\").\n * @param options - Optional query parameters for filtering providers.\n * @param options.provider - Provider ID(s) to filter by.\n * @param options.crypto - Crypto currency ID(s) to filter by.\n * @param options.payments - Payment method ID(s) to filter by.\n * @returns The providers response containing providers array.\n */\n async getProviders(\n regionCode: string,\n options?: {\n provider?: string | string[];\n crypto?: string | string[];\n payments?: string | string[];\n },\n ): Promise<ProvidersResponse> {\n const normalizedRegion = regionCode.toLowerCase().trim();\n const url = this.#buildUrl(\n RampsApiService.Regions,\n getApiPath(`regions/${normalizedRegion}/providers`),\n );\n\n if (options?.provider) {\n const providerIds = Array.isArray(options.provider)\n ? options.provider\n : [options.provider];\n providerIds.forEach((id) => url.searchParams.append('provider', id));\n }\n\n if (options?.crypto) {\n const cryptoIds = Array.isArray(options.crypto)\n ? options.crypto\n : [options.crypto];\n cryptoIds.forEach((id) => url.searchParams.append('crypto', id));\n }\n\n if (options?.payments) {\n const paymentIds = Array.isArray(options.payments)\n ? options.payments\n : [options.payments];\n paymentIds.forEach((id) => url.searchParams.append('payments', id));\n }\n\n return this.fetchQuery({\n queryKey: [`${this.name}:getProviders`, url.toString()],\n staleTime: 0,\n gcTime: 0,\n responseStruct: ProvidersResponseStruct,\n queryFn: async () => {\n const response = await this.#fetchOk(url);\n const body = (await response.json()) as Infer<\n typeof ProvidersResponseStruct\n >;\n // Keep the lenient handling of a missing `sorted` list.\n if (body && typeof body === 'object' && !Array.isArray(body.sorted)) {\n return { ...body, sorted: [] };\n }\n return body;\n },\n });\n }\n\n /**\n * Fetches the list of payment methods for a given region, asset, and provider.\n *\n * Region local fiat filtering is applied server-side when `fiat` is omitted.\n *\n * @param options - Query parameters for filtering payment methods.\n * @param options.region - User's region code (e.g., \"us-al\").\n * @param options.assetId - CAIP-19 cryptocurrency identifier. Kept on the\n * caller contract for local cache/staleness; not sent — `/payments` is scoped\n * to provider + region (the API ignores `crypto`).\n * @param options.provider - Provider ID path.\n * @returns The payment methods response containing payments array.\n */\n async getPaymentMethods(options: {\n region: string;\n assetId: string;\n provider: string;\n }): Promise<PaymentMethodsResponse> {\n const normalizedRegion = options.region.toLowerCase().trim();\n const url = this.#buildUrl(\n RampsApiService.Regions,\n getApiPath(`regions/${normalizedRegion}/payments`),\n );\n\n url.searchParams.set('region', options.region.toLowerCase().trim());\n url.searchParams.set('provider', options.provider);\n\n return this.fetchQuery({\n queryKey: [`${this.name}:getPaymentMethods`, url.toString()],\n staleTime: 0,\n gcTime: 0,\n responseStruct: PaymentMethodsResponseStruct,\n queryFn: async () => {\n const response = await this.#fetchOk(url);\n return (await response.json()) as Infer<\n typeof PaymentMethodsResponseStruct\n >;\n },\n });\n }\n\n /**\n * Fetches quotes from all providers for a given set of parameters.\n * Uses the V2 orders API to get quotes for multiple payment methods at once.\n *\n * @param params - The parameters for fetching quotes.\n * @param params.region - User's region code (e.g., \"us\", \"us-ca\").\n * @param params.paymentMethods - Array of payment method IDs.\n * @param params.assetId - CAIP-19 cryptocurrency identifier.\n * @param params.fiat - Fiat currency code (e.g., \"usd\").\n * @param params.amount - The amount (in fiat for buy, crypto for sell).\n * @param params.walletAddress - The destination wallet address.\n * @param params.redirectUrl - Optional redirect URL after order completion.\n * @param params.providers - Optional provider IDs to filter quotes.\n * @param params.action - The ramp action type. Defaults to 'buy'.\n * @returns The quotes response containing success, sorted, error, and customActions.\n */\n async getQuotes(params: GetQuotesParams): Promise<QuotesResponse> {\n const normalizedRegion = params.region.toLowerCase().trim();\n const normalizedFiat = params.fiat.toLowerCase().trim();\n const action = params.action ?? 'buy';\n\n const url = new URL(\n getApiPath('quotes'),\n getBaseUrl(this.#environment, RampsApiService.Orders),\n );\n this.#addCommonParams(url, action);\n\n // Build region ID in the format expected by the API\n url.searchParams.set('region', normalizedRegion);\n url.searchParams.set('fiat', normalizedFiat);\n url.searchParams.set('crypto', params.assetId);\n url.searchParams.set('amount', String(params.amount));\n url.searchParams.set('walletAddress', params.walletAddress);\n\n const headers = await this.#getRequestHeaders();\n\n // Add payment methods as array parameters\n params.paymentMethods.forEach((paymentMethod) => {\n url.searchParams.append('payments', paymentMethod);\n });\n\n // Add provider filter if specified\n params.providers?.forEach((provider) => {\n url.searchParams.append('providers', provider);\n });\n\n // Add redirect URL if specified\n if (params.redirectUrl) {\n url.searchParams.set('redirectUrl', params.redirectUrl);\n }\n\n return this.fetchQuery({\n queryKey: [`${this.name}:getQuotes`, url.toString()],\n staleTime: 0,\n gcTime: 0,\n responseStruct: QuotesResponseStruct,\n queryFn: async () => {\n const response = await this.#fetchOk(url, { headers });\n return (await response.json()) as Infer<typeof QuotesResponseStruct>;\n },\n });\n }\n\n /**\n * Fetches the buy widget data from a buy URL endpoint.\n * Makes a request to the buyURL (as provided in a quote) to get the actual\n * provider widget URL, browser type, and order ID.\n *\n * @param buyUrl - The full buy URL endpoint to fetch from.\n * @returns The buy widget data containing the provider widget URL.\n */\n async getBuyWidgetUrl(buyUrl: string): Promise<BuyWidget> {\n const url = new URL(buyUrl);\n this.#addCommonParams(url);\n\n const headers = await this.#getRequestHeaders();\n\n return this.fetchQuery({\n queryKey: [`${this.name}:getBuyWidgetUrl`, url.toString()],\n staleTime: 0,\n gcTime: 0,\n responseStruct: BuyWidgetResponseStruct,\n queryFn: async () => {\n const response = await this.#fetchOk(url, { headers });\n return (await response.json()) as Infer<typeof BuyWidgetResponseStruct>;\n },\n });\n }\n\n /**\n * Strips the `/providers/` prefix so the URL path uses the short form.\n * Accepts both `/providers/transak` and `transak`.\n *\n * @param providerId - Provider ID in either path or short format.\n * @returns The short provider code.\n */\n #toProviderSegment(providerId: string): string {\n return providerId.replace(/^\\/providers\\//u, '');\n }\n\n /**\n * Fetches an order from the unified V2 API endpoint.\n * This endpoint returns a normalized `RampsOrder` (DepositOrder shape)\n * for all provider types, including both aggregator and native providers.\n *\n * @param providerCode - The provider code (e.g., \"transak\", \"transak-native\", \"moonpay\"),\n * with or without the `/providers/` prefix.\n * @param orderCode - The order identifier.\n * @param wallet - The wallet address associated with the order.\n * @returns The unified order data.\n */\n async getOrder(\n providerCode: string,\n orderCode: string,\n wallet: string,\n ): Promise<RampsOrder> {\n const segment = this.#toProviderSegment(providerCode);\n const url = this.#buildUrl(\n RampsApiService.Orders,\n getApiPath(`providers/${segment}/orders/${orderCode}`),\n );\n if (wallet) {\n url.searchParams.set('wallet', wallet);\n }\n\n return this.fetchQuery({\n queryKey: [`${this.name}:getOrder`, url.toString()],\n staleTime: 0,\n gcTime: 0,\n responseStruct: OrderResponseStruct,\n queryFn: async () => {\n const response = await this.#fetchOk(url);\n return (await response.json()) as Infer<typeof OrderResponseStruct>;\n },\n });\n }\n\n /**\n * Extracts an order from a provider callback URL.\n * Sends the callback URL to the V2 API backend, which knows how to parse\n * each provider's callback format and extract the order ID. Then fetches\n * the full order using that ID.\n *\n * This is the V2 equivalent of the aggregator SDK's `getOrderFromCallback`.\n *\n * @param providerCode - The provider code (e.g., \"transak\", \"moonpay\"),\n * with or without the `/providers/` prefix.\n * @param callbackUrl - The full callback URL the provider redirected to.\n * @param wallet - The wallet address associated with the order.\n * @returns The unified order data.\n */\n async getOrderFromCallback(\n providerCode: string,\n callbackUrl: string,\n wallet: string,\n ): Promise<RampsOrder> {\n const segment = this.#toProviderSegment(providerCode);\n // Step 1: Send the callback URL to the backend to extract the order ID.\n // The backend parses it using provider-specific logic.\n const callbackApiUrl = this.#buildUrl(\n RampsApiService.Orders,\n getApiPath(`providers/${segment}/callback`),\n );\n callbackApiUrl.searchParams.set('url', callbackUrl);\n\n const callbackResponse = await this.fetchQuery({\n queryKey: [\n `${this.name}:getOrderFromCallback`,\n callbackApiUrl.toString(),\n ],\n staleTime: 0,\n gcTime: 0,\n responseStruct: OrderCallbackResponseStruct,\n queryFn: async () => {\n const response = await this.#fetchOk(callbackApiUrl);\n return (await response.json()) as Infer<\n typeof OrderCallbackResponseStruct\n >;\n },\n });\n\n const rawOrderId = callbackResponse.id;\n if (!rawOrderId) {\n throw new Error(\n 'Could not extract order ID from callback URL via provider',\n );\n }\n\n // The callback response id may be a full resource path like\n // \"/providers/transak-staging/orders/3ec2e8ac-...\".\n // Extract just the order code (last segment) so getOrder doesn't\n // build a doubled path.\n const lastSlash = rawOrderId.lastIndexOf('/');\n const orderCode =\n lastSlash >= 0 ? rawOrderId.slice(lastSlash + 1) : rawOrderId;\n\n // Step 2: Fetch the full order using the extracted order code.\n return this.getOrder(providerCode, orderCode, wallet);\n }\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type { RampsControllerActions, RampsControllerEvents, RampsControllerGetStateAction, RampsControllerMessenger, RampsControllerState, RampsControllerStateChangeEvent, RampsControllerOrderStatusChangedEvent, RampsControllerAutorampStatusChangedEvent, AutorampTransactionStatusChangedPayload, RampsControllerOptions, PaymentMethodsForContextResponse, UserRegion, ResourceState, TransakState, NativeProvidersState, MoneyAccountWalletRegistration, MoneyAccountWalletRegistrationResult, KeyringControllerSignPersonalMessageAction, VbaAutorampStatus, VbaKycStatus, VbaOnboardingSnapshot, VbaProviderFlowStatus, } from './RampsController.js';
|
|
2
2
|
export type { RampsControllerExecuteRequestAction, RampsControllerAbortRequestAction, RampsControllerGetRequestStateAction, RampsControllerSetUserRegionAction, RampsControllerSetSelectedProviderAction, RampsControllerSetSelectedProviderForAssetAction, RampsControllerInitAction, RampsControllerGetCountriesAction, RampsControllerGetTokensAction, RampsControllerSetSelectedTokenAction, RampsControllerGetProvidersAction, RampsControllerGetPaymentMethodsAction, RampsControllerGetPaymentMethodsForContextAction, RampsControllerSetSelectedPaymentMethodAction, RampsControllerGetQuotesAction, RampsControllerGetQuoteWithFeesAction, RampsControllerAddOrderAction, RampsControllerRemoveOrderAction, RampsControllerAddAutorampAction, RampsControllerCreateAutorampAction, RampsControllerHydrateVbaOnboardingAction, RampsControllerRemoveAutorampAction, RampsControllerRegisterMoneyAccountWalletAction, RampsControllerMarkAutorampAsNotifiedAction, RampsControllerApplyAutorampStatusFromPushAction, RampsControllerRefreshAutorampAction, RampsControllerRefreshAutorampsAction, RampsControllerRefreshAutorampTransactionsAction, RampsControllerStartOrderPollingAction, RampsControllerStopOrderPollingAction, RampsControllerGetBuyWidgetDataAction, RampsControllerGetFallbackBuyWidgetDataAction, RampsControllerAddPrecreatedOrderAction, RampsControllerGetOrderAction, RampsControllerGetOrderFromCallbackAction, RampsControllerTransakSetApiKeyAction, RampsControllerTransakSetAccessTokenAction, RampsControllerTransakClearAccessTokenAction, RampsControllerTransakSetAuthenticatedAction, RampsControllerTransakResetStateAction, RampsControllerTransakSendUserOtpAction, RampsControllerTransakVerifyUserOtpAction, RampsControllerTransakLogoutAction, RampsControllerTransakGetUserDetailsAction, RampsControllerTransakGetBuyQuoteAction, RampsControllerTransakGetKycRequirementAction, RampsControllerTransakGetAdditionalRequirementsAction, RampsControllerTransakCreateOrderAction, RampsControllerTransakGetOrderAction, RampsControllerTransakGetUserLimitsAction, RampsControllerTransakRequestOttAction, RampsControllerTransakGeneratePaymentWidgetUrlAction, RampsControllerTransakSubmitPurposeOfUsageFormAction, RampsControllerTransakPatchUserAction, RampsControllerTransakSubmitSsnDetailsAction, RampsControllerTransakConfirmPaymentAction, RampsControllerTransakGetTranslationAction, RampsControllerTransakGetIdProofStatusAction, RampsControllerTransakCancelOrderAction, RampsControllerTransakCancelAllActiveOrdersAction, RampsControllerTransakGetActiveOrdersAction, RampsControllerSyncOrdersWithUserStorageAction, } from './RampsController-method-action-types.js';
|
|
3
3
|
export { RampsController, VBA_AUTORAMP_STATUSES, VBA_KYC_STATUSES, VBA_PROVIDER_FLOW_STATUSES, getDefaultRampsControllerState, getInternalOrderCode, RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS, RAMPS_CONTROLLER_REQUIRED_CONTROLLER_ACTIONS, } from './RampsController.js';
|
|
4
|
-
export type { RampsServiceActions, RampsServiceEvents, RampsServiceMessenger, Country, State, SupportedActions, CountryPhone, Provider, ProviderLink, ProviderLogos, ProviderBrowserType, ProviderLimit, ProviderFiatLimits, ProviderLimits, ProviderSortOrder, ProvidersResponse, RampAction, PaymentMethod, PaymentMethodsResponse, Quote, QuoteError, QuoteSortBy, QuoteSortOrder, QuoteCryptoTranslation, QuoteCustomAction, QuotesResponse, GetQuotesParams, RampsToken, TokensResponse, BuyWidget, BuyWidgetFallback, RampsOrder, RampsOrderNetwork, RampsOrderCryptoCurrency, RampsOrderFiatCurrency, RampsOrderPaymentMethod, OrderPaymentDetail, } from './RampsService.js';
|
|
4
|
+
export type { RampsServiceActions, RampsServiceEvents, RampsServiceMessenger, RampsServiceInvalidateQueriesAction, RampsServiceCacheUpdatedEvent, RampsServiceGranularCacheUpdatedEvent, Country, State, SupportedActions, CountryPhone, Provider, ProviderLink, ProviderLogos, ProviderBrowserType, ProviderLimit, ProviderFiatLimits, ProviderLimits, ProviderSortOrder, ProvidersResponse, RampAction, PaymentMethod, PaymentMethodsResponse, Quote, QuoteError, QuoteSortBy, QuoteSortOrder, QuoteCryptoTranslation, QuoteCustomAction, QuotesResponse, GetQuotesParams, RampsToken, TokensResponse, BuyWidget, BuyWidgetFallback, RampsOrder, RampsOrderNetwork, RampsOrderCryptoCurrency, RampsOrderFiatCurrency, RampsOrderPaymentMethod, OrderPaymentDetail, } from './RampsService.js';
|
|
5
5
|
export { RampsService, RampsEnvironment, RampsApiService, RampsOrderStatus, RAMPS_SDK_VERSION, getDefaultRedirectCallbackUrl, } from './RampsService.js';
|
|
6
6
|
export type { RampsClientIdentity } from './client-identity.js';
|
|
7
7
|
export { addRampsClientIdentityParams, RAMPS_CLIENT_PRODUCT_PARAM, RAMPS_CLIENT_VERSION_PARAM, } from './client-identity.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,6BAA6B,EAC7B,wBAAwB,EACxB,oBAAoB,EACpB,+BAA+B,EAC/B,sCAAsC,EACtC,yCAAyC,EACzC,uCAAuC,EACvC,sBAAsB,EACtB,gCAAgC,EAChC,UAAU,EACV,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,8BAA8B,EAC9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,+CAA+C,EAC/C,uCAAuC,EACvC,2CAA2C,EAC3C,wCAAwC,EACxC,oCAAoC,EACpC,+CAA+C,EAC/C,4CAA4C,GAC7C,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,cAAc,EACd,WAAW,IAAI,kBAAkB,EACjC,kCAAkC,EAClC,6BAA6B,EAC7B,gCAAgC,GACjC,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwFA,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,0BAA0B,EAC1B,8BAA8B,EAC9B,oBAAoB,EACpB,yCAAyC,EACzC,4CAA4C,GAC7C,MAAM,sBAAsB,CAAC;AAwC9B,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,6BAA6B,GAC9B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAmB9B,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,8BAA8B,EAC9B,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EACL,sCAAsC,EACtC,qCAAqC,EACrC,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,mBAAmB,CA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esContent":["export type {\n RampsControllerActions,\n RampsControllerEvents,\n RampsControllerGetStateAction,\n RampsControllerMessenger,\n RampsControllerState,\n RampsControllerStateChangeEvent,\n RampsControllerOrderStatusChangedEvent,\n RampsControllerAutorampStatusChangedEvent,\n AutorampTransactionStatusChangedPayload,\n RampsControllerOptions,\n PaymentMethodsForContextResponse,\n UserRegion,\n ResourceState,\n TransakState,\n NativeProvidersState,\n MoneyAccountWalletRegistration,\n MoneyAccountWalletRegistrationResult,\n KeyringControllerSignPersonalMessageAction,\n VbaAutorampStatus,\n VbaKycStatus,\n VbaOnboardingSnapshot,\n VbaProviderFlowStatus,\n} from './RampsController.js';\nexport type {\n RampsControllerExecuteRequestAction,\n RampsControllerAbortRequestAction,\n RampsControllerGetRequestStateAction,\n RampsControllerSetUserRegionAction,\n RampsControllerSetSelectedProviderAction,\n RampsControllerSetSelectedProviderForAssetAction,\n RampsControllerInitAction,\n RampsControllerGetCountriesAction,\n RampsControllerGetTokensAction,\n RampsControllerSetSelectedTokenAction,\n RampsControllerGetProvidersAction,\n RampsControllerGetPaymentMethodsAction,\n RampsControllerGetPaymentMethodsForContextAction,\n RampsControllerSetSelectedPaymentMethodAction,\n RampsControllerGetQuotesAction,\n RampsControllerGetQuoteWithFeesAction,\n RampsControllerAddOrderAction,\n RampsControllerRemoveOrderAction,\n RampsControllerAddAutorampAction,\n RampsControllerCreateAutorampAction,\n RampsControllerHydrateVbaOnboardingAction,\n RampsControllerRemoveAutorampAction,\n RampsControllerRegisterMoneyAccountWalletAction,\n RampsControllerMarkAutorampAsNotifiedAction,\n RampsControllerApplyAutorampStatusFromPushAction,\n RampsControllerRefreshAutorampAction,\n RampsControllerRefreshAutorampsAction,\n RampsControllerRefreshAutorampTransactionsAction,\n RampsControllerStartOrderPollingAction,\n RampsControllerStopOrderPollingAction,\n RampsControllerGetBuyWidgetDataAction,\n RampsControllerGetFallbackBuyWidgetDataAction,\n RampsControllerAddPrecreatedOrderAction,\n RampsControllerGetOrderAction,\n RampsControllerGetOrderFromCallbackAction,\n RampsControllerTransakSetApiKeyAction,\n RampsControllerTransakSetAccessTokenAction,\n RampsControllerTransakClearAccessTokenAction,\n RampsControllerTransakSetAuthenticatedAction,\n RampsControllerTransakResetStateAction,\n RampsControllerTransakSendUserOtpAction,\n RampsControllerTransakVerifyUserOtpAction,\n RampsControllerTransakLogoutAction,\n RampsControllerTransakGetUserDetailsAction,\n RampsControllerTransakGetBuyQuoteAction,\n RampsControllerTransakGetKycRequirementAction,\n RampsControllerTransakGetAdditionalRequirementsAction,\n RampsControllerTransakCreateOrderAction,\n RampsControllerTransakGetOrderAction,\n RampsControllerTransakGetUserLimitsAction,\n RampsControllerTransakRequestOttAction,\n RampsControllerTransakGeneratePaymentWidgetUrlAction,\n RampsControllerTransakSubmitPurposeOfUsageFormAction,\n RampsControllerTransakPatchUserAction,\n RampsControllerTransakSubmitSsnDetailsAction,\n RampsControllerTransakConfirmPaymentAction,\n RampsControllerTransakGetTranslationAction,\n RampsControllerTransakGetIdProofStatusAction,\n RampsControllerTransakCancelOrderAction,\n RampsControllerTransakCancelAllActiveOrdersAction,\n RampsControllerTransakGetActiveOrdersAction,\n RampsControllerSyncOrdersWithUserStorageAction,\n} from './RampsController-method-action-types.js';\nexport {\n RampsController,\n VBA_AUTORAMP_STATUSES,\n VBA_KYC_STATUSES,\n VBA_PROVIDER_FLOW_STATUSES,\n getDefaultRampsControllerState,\n getInternalOrderCode,\n RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS,\n RAMPS_CONTROLLER_REQUIRED_CONTROLLER_ACTIONS,\n} from './RampsController.js';\nexport type {\n RampsServiceActions,\n RampsServiceEvents,\n RampsServiceMessenger,\n Country,\n State,\n SupportedActions,\n CountryPhone,\n Provider,\n ProviderLink,\n ProviderLogos,\n ProviderBrowserType,\n ProviderLimit,\n ProviderFiatLimits,\n ProviderLimits,\n ProviderSortOrder,\n ProvidersResponse,\n RampAction,\n PaymentMethod,\n PaymentMethodsResponse,\n Quote,\n QuoteError,\n QuoteSortBy,\n QuoteSortOrder,\n QuoteCryptoTranslation,\n QuoteCustomAction,\n QuotesResponse,\n GetQuotesParams,\n RampsToken,\n TokensResponse,\n BuyWidget,\n BuyWidgetFallback,\n RampsOrder,\n RampsOrderNetwork,\n RampsOrderCryptoCurrency,\n RampsOrderFiatCurrency,\n RampsOrderPaymentMethod,\n OrderPaymentDetail,\n} from './RampsService.js';\nexport {\n RampsService,\n RampsEnvironment,\n RampsApiService,\n RampsOrderStatus,\n RAMPS_SDK_VERSION,\n getDefaultRedirectCallbackUrl,\n} from './RampsService.js';\nexport type { RampsClientIdentity } from './client-identity.js';\nexport {\n addRampsClientIdentityParams,\n RAMPS_CLIENT_PRODUCT_PARAM,\n RAMPS_CLIENT_VERSION_PARAM,\n} from './client-identity.js';\nexport type {\n RampsServiceGetDefaultRedirectCallbackUrlAction,\n RampsServiceGetGeolocationAction,\n RampsServiceGetCountriesAction,\n RampsServiceGetPaymentMethodsAction,\n RampsServiceGetQuotesAction,\n RampsServiceGetBuyWidgetUrlAction,\n RampsServiceGetOrderAction,\n RampsServiceGetOrderFromCallbackAction,\n} from './RampsService-method-action-types.js';\nexport type {\n RequestCache,\n RequestState,\n ExecuteRequestOptions,\n PendingRequest,\n ResourceType,\n} from './RequestCache.js';\nexport type { RampsErrorCode } from './rampsErrorCodes.js';\nexport {\n RequestStatus,\n DEFAULT_REQUEST_CACHE_TTL,\n DEFAULT_REQUEST_CACHE_MAX_SIZE,\n createCacheKey,\n isCacheExpired,\n createLoadingState,\n createSuccessState,\n createErrorState,\n} from './RequestCache.js';\nexport { RAMPS_ERROR_CODES } from './rampsErrorCodes.js';\nexport type { RequestSelectorResult } from './selectors.js';\nexport { createRequestSelector } from './selectors.js';\nexport type { HeadlessFeatureFlagsLookup } from './featureFlags.js';\nexport {\n HEADLESS_ALL_PROVIDERS_FEATURE_VERSION,\n MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY,\n getHeadlessProviderAllowlist,\n isHeadlessAllProvidersEnabled,\n} from './featureFlags.js';\nexport {\n normalizeRampsAssetId,\n providerServesAsset,\n getProvidersServingAsset,\n regionHasProviderForAsset,\n isFiatDepositAvailable,\n} from './providerAvailability.js';\nexport {\n isExternalBrowserQuote,\n isCustomActionQuote,\n isInAppOnlyQuote,\n getBuyWidgetFallback,\n} from './quoteClassification.js';\nexport {\n TERMINAL_ORDER_STATUSES,\n isTerminalOrderStatus,\n} from './orderStatus.js';\nexport type { TypedError } from './errorNormalization.js';\nexport {\n getErrorMessage,\n extractExplicitTypedError,\n normalizeToTypedError,\n} from './errorNormalization.js';\nexport type {\n UserStorageRampsOrderEntry,\n SyncRampsOrder,\n OrderSyncingController,\n OrderSyncingOptions,\n SyncOrdersWithUserStorageConfig,\n} from './order-syncing/index.js';\nexport {\n USER_STORAGE_RAMPS_ORDERS_FEATURE,\n USER_STORAGE_VERSION,\n USER_STORAGE_VERSION_KEY,\n createOrderStorageKey,\n isSyncableOrder,\n mapRampsOrderToUserStorageEntry,\n mapUserStorageEntryToRampsOrder,\n stripPaymentDetailsForRemoteStorage,\n stripSyncMetadata,\n stripDeletedAt,\n areOrdersEqual,\n canPerformOrderSyncing,\n syncOrdersWithUserStorage,\n updateOrderInUserStorage,\n deleteOrderInUserStorage,\n} from './order-syncing/index.js';\nexport type {\n TransakServiceActions,\n TransakServiceEvents,\n TransakServiceMessenger,\n TransakAccessToken,\n TransakUserDetails,\n TransakUserDetailsAddress,\n TransakUserDetailsKycDetails,\n TransakBuyQuote,\n TransakKycRequirement,\n TransakAdditionalRequirement,\n TransakAdditionalRequirementsResponse,\n TransakOttResponse,\n TransakOrderPaymentMethod,\n TransakDepositOrder,\n TransakDepositNetwork,\n TransakDepositCryptoCurrency,\n TransakDepositPaymentMethod,\n TransakDepositRegion,\n TransakOrder,\n TransakQuoteTranslation,\n TransakTranslationRequest,\n TransakUserLimits,\n TransakIdProofStatus,\n PatchUserRequestBody as TransakPatchUserRequestBody,\n} from './TransakService.js';\nexport {\n TransakApiError,\n TransakService,\n TransakEnvironment,\n TransakOrderIdTransformer,\n} from './TransakService.js';\nexport {\n getTransakApiMessage,\n isTransakPhoneRegisteredError,\n} from './transakApiErrorUtils.js';\nexport type {\n TransakServiceMethodActions,\n TransakServiceSendUserOtpAction,\n TransakServiceVerifyUserOtpAction,\n TransakServiceGetUserDetailsAction,\n TransakServiceGetBuyQuoteAction,\n TransakServiceGetKycRequirementAction,\n TransakServiceCreateOrderAction,\n TransakServiceGetOrderAction,\n TransakServiceRequestOttAction,\n TransakServiceGeneratePaymentWidgetUrlAction,\n TransakServiceCreateWidgetUrlAction,\n} from './TransakService-method-action-types.js';\nexport type {\n AutorampAccount,\n ApplyAutorampRemoteStatusResult,\n CreateAutorampRequest,\n} from './autorampAccount.js';\nexport {\n AutorampStatus,\n TERMINAL_AUTORAMP_STATUSES,\n NOTABLE_AUTORAMP_STATUSES,\n isTerminalAutorampStatus,\n normalizeAutorampStatus,\n createAutorampAccount,\n applyAutorampRemoteStatus,\n markAutorampNotified,\n buildMusdAutorampRequest,\n buildBrazilMusdAutorampRequest,\n} from './autorampAccount.js';\nexport { buildOwnershipMessage } from './ownership-message.js';\nexport type {\n AutorampTransactionRecord,\n AutorampTransactionRecords,\n AutorampTransactionChange,\n} from './diffAutorampTransactions.js';\nexport { diffAutorampTransactions } from './diffAutorampTransactions.js';\nexport type {\n AutorampDepositInstructions,\n AutorampDepositRailsSummary,\n AutorampRemoteSnapshot,\n AutorampTransactionSummary,\n PixDepositInstructions,\n UsBankDepositInstructions,\n UsBankDepositRail,\n} from './autoramp-types.js';\nexport type {\n NeoBankServiceActions,\n NeoBankServiceEvents,\n NeoBankServiceMessenger,\n NeoBankAutorampResponse,\n NeoBankMicrodeposit,\n NeoBankRequestOptions,\n NeoBankQueryParams,\n GetWalletRegistrationStatusParams,\n RegisterSelfHostedWalletParams,\n} from './NeoBankService.js';\nexport type {\n NeoBankServiceGetAutorampAction,\n NeoBankServiceGetAutorampsAction,\n NeoBankServiceGetPixDepositInstructionsAction,\n NeoBankServiceGetDepositInstructionsAction,\n NeoBankServiceListAutorampTransactionsAction,\n NeoBankServiceRegisterPixAddressAction,\n NeoBankServiceGetAutorampQuoteAction,\n NeoBankServiceCreateAutorampAction,\n NeoBankServiceGetAutorampQuoteForAutorampAction,\n NeoBankServiceAttachAutorampQuoteAction,\n NeoBankServiceGetCustomerByExternalIdAction,\n NeoBankServiceGetMoonpayCustomerIdAction,\n NeoBankServiceGetMicrodepositsAction,\n NeoBankServiceGetWalletRegistrationStatusAction,\n NeoBankServiceRegisterSelfHostedWalletAction,\n} from './NeoBankService-method-action-types.js';\nexport {\n NeoBankService,\n serviceName as neoBankServiceName,\n mapNeoBankAutorampToRemoteSnapshot,\n extractPixDepositInstructions,\n extractUsBankDepositInstructions,\n} from './NeoBankService.js';\nexport type {\n Blockchain,\n RegistrationOutcome,\n RegistrationStatus,\n SelfHostedRegistration,\n WalletRegistrationErrorKind,\n} from './wallet-registration-service.js';\nexport { WalletRegistrationError } from './wallet-registration-service.js';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwFA,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,0BAA0B,EAC1B,8BAA8B,EAC9B,oBAAoB,EACpB,yCAAyC,EACzC,4CAA4C,GAC7C,MAAM,sBAAsB,CAAC;AA2C9B,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,6BAA6B,GAC9B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAmB9B,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,8BAA8B,EAC9B,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAA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AA+B,CAAC;AAsCzE,OAAO,EACL,cAAc,EACd,WAAW,IAAI,kBAAkB,EACjC,kCAAkC,EAClC,6BAA6B,EAC7B,gCAAgC,GACjC,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC","sourcesContent":["export type {\n RampsControllerActions,\n RampsControllerEvents,\n RampsControllerGetStateAction,\n RampsControllerMessenger,\n RampsControllerState,\n RampsControllerStateChangeEvent,\n RampsControllerOrderStatusChangedEvent,\n RampsControllerAutorampStatusChangedEvent,\n AutorampTransactionStatusChangedPayload,\n RampsControllerOptions,\n PaymentMethodsForContextResponse,\n UserRegion,\n ResourceState,\n TransakState,\n NativeProvidersState,\n MoneyAccountWalletRegistration,\n MoneyAccountWalletRegistrationResult,\n KeyringControllerSignPersonalMessageAction,\n VbaAutorampStatus,\n VbaKycStatus,\n VbaOnboardingSnapshot,\n VbaProviderFlowStatus,\n} from './RampsController.js';\nexport type {\n RampsControllerExecuteRequestAction,\n RampsControllerAbortRequestAction,\n RampsControllerGetRequestStateAction,\n RampsControllerSetUserRegionAction,\n RampsControllerSetSelectedProviderAction,\n RampsControllerSetSelectedProviderForAssetAction,\n RampsControllerInitAction,\n RampsControllerGetCountriesAction,\n RampsControllerGetTokensAction,\n RampsControllerSetSelectedTokenAction,\n RampsControllerGetProvidersAction,\n RampsControllerGetPaymentMethodsAction,\n RampsControllerGetPaymentMethodsForContextAction,\n RampsControllerSetSelectedPaymentMethodAction,\n RampsControllerGetQuotesAction,\n RampsControllerGetQuoteWithFeesAction,\n RampsControllerAddOrderAction,\n RampsControllerRemoveOrderAction,\n RampsControllerAddAutorampAction,\n RampsControllerCreateAutorampAction,\n RampsControllerHydrateVbaOnboardingAction,\n RampsControllerRemoveAutorampAction,\n RampsControllerRegisterMoneyAccountWalletAction,\n RampsControllerMarkAutorampAsNotifiedAction,\n RampsControllerApplyAutorampStatusFromPushAction,\n RampsControllerRefreshAutorampAction,\n RampsControllerRefreshAutorampsAction,\n RampsControllerRefreshAutorampTransactionsAction,\n RampsControllerStartOrderPollingAction,\n RampsControllerStopOrderPollingAction,\n RampsControllerGetBuyWidgetDataAction,\n RampsControllerGetFallbackBuyWidgetDataAction,\n RampsControllerAddPrecreatedOrderAction,\n RampsControllerGetOrderAction,\n RampsControllerGetOrderFromCallbackAction,\n RampsControllerTransakSetApiKeyAction,\n RampsControllerTransakSetAccessTokenAction,\n RampsControllerTransakClearAccessTokenAction,\n RampsControllerTransakSetAuthenticatedAction,\n RampsControllerTransakResetStateAction,\n RampsControllerTransakSendUserOtpAction,\n RampsControllerTransakVerifyUserOtpAction,\n RampsControllerTransakLogoutAction,\n RampsControllerTransakGetUserDetailsAction,\n RampsControllerTransakGetBuyQuoteAction,\n RampsControllerTransakGetKycRequirementAction,\n RampsControllerTransakGetAdditionalRequirementsAction,\n RampsControllerTransakCreateOrderAction,\n RampsControllerTransakGetOrderAction,\n RampsControllerTransakGetUserLimitsAction,\n RampsControllerTransakRequestOttAction,\n RampsControllerTransakGeneratePaymentWidgetUrlAction,\n RampsControllerTransakSubmitPurposeOfUsageFormAction,\n RampsControllerTransakPatchUserAction,\n RampsControllerTransakSubmitSsnDetailsAction,\n RampsControllerTransakConfirmPaymentAction,\n RampsControllerTransakGetTranslationAction,\n RampsControllerTransakGetIdProofStatusAction,\n RampsControllerTransakCancelOrderAction,\n RampsControllerTransakCancelAllActiveOrdersAction,\n RampsControllerTransakGetActiveOrdersAction,\n RampsControllerSyncOrdersWithUserStorageAction,\n} from './RampsController-method-action-types.js';\nexport {\n RampsController,\n VBA_AUTORAMP_STATUSES,\n VBA_KYC_STATUSES,\n VBA_PROVIDER_FLOW_STATUSES,\n getDefaultRampsControllerState,\n getInternalOrderCode,\n RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS,\n RAMPS_CONTROLLER_REQUIRED_CONTROLLER_ACTIONS,\n} from './RampsController.js';\nexport type {\n RampsServiceActions,\n RampsServiceEvents,\n RampsServiceMessenger,\n RampsServiceInvalidateQueriesAction,\n RampsServiceCacheUpdatedEvent,\n RampsServiceGranularCacheUpdatedEvent,\n Country,\n State,\n SupportedActions,\n CountryPhone,\n Provider,\n ProviderLink,\n ProviderLogos,\n ProviderBrowserType,\n ProviderLimit,\n ProviderFiatLimits,\n ProviderLimits,\n ProviderSortOrder,\n ProvidersResponse,\n RampAction,\n PaymentMethod,\n PaymentMethodsResponse,\n Quote,\n QuoteError,\n QuoteSortBy,\n QuoteSortOrder,\n QuoteCryptoTranslation,\n QuoteCustomAction,\n QuotesResponse,\n GetQuotesParams,\n RampsToken,\n TokensResponse,\n BuyWidget,\n BuyWidgetFallback,\n RampsOrder,\n RampsOrderNetwork,\n RampsOrderCryptoCurrency,\n RampsOrderFiatCurrency,\n RampsOrderPaymentMethod,\n OrderPaymentDetail,\n} from './RampsService.js';\nexport {\n RampsService,\n RampsEnvironment,\n RampsApiService,\n RampsOrderStatus,\n RAMPS_SDK_VERSION,\n getDefaultRedirectCallbackUrl,\n} from './RampsService.js';\nexport type { RampsClientIdentity } from './client-identity.js';\nexport {\n addRampsClientIdentityParams,\n RAMPS_CLIENT_PRODUCT_PARAM,\n RAMPS_CLIENT_VERSION_PARAM,\n} from './client-identity.js';\nexport type {\n RampsServiceGetDefaultRedirectCallbackUrlAction,\n RampsServiceGetGeolocationAction,\n RampsServiceGetCountriesAction,\n RampsServiceGetPaymentMethodsAction,\n RampsServiceGetQuotesAction,\n RampsServiceGetBuyWidgetUrlAction,\n RampsServiceGetOrderAction,\n RampsServiceGetOrderFromCallbackAction,\n} from './RampsService-method-action-types.js';\nexport type {\n RequestCache,\n RequestState,\n ExecuteRequestOptions,\n PendingRequest,\n ResourceType,\n} from './RequestCache.js';\nexport type { RampsErrorCode } from './rampsErrorCodes.js';\nexport {\n RequestStatus,\n DEFAULT_REQUEST_CACHE_TTL,\n DEFAULT_REQUEST_CACHE_MAX_SIZE,\n createCacheKey,\n isCacheExpired,\n createLoadingState,\n createSuccessState,\n createErrorState,\n} from './RequestCache.js';\nexport { RAMPS_ERROR_CODES } from './rampsErrorCodes.js';\nexport type { RequestSelectorResult } from './selectors.js';\nexport { createRequestSelector } from './selectors.js';\nexport type { HeadlessFeatureFlagsLookup } from './featureFlags.js';\nexport {\n HEADLESS_ALL_PROVIDERS_FEATURE_VERSION,\n MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY,\n getHeadlessProviderAllowlist,\n isHeadlessAllProvidersEnabled,\n} from './featureFlags.js';\nexport {\n normalizeRampsAssetId,\n providerServesAsset,\n getProvidersServingAsset,\n regionHasProviderForAsset,\n isFiatDepositAvailable,\n} from './providerAvailability.js';\nexport {\n isExternalBrowserQuote,\n isCustomActionQuote,\n isInAppOnlyQuote,\n getBuyWidgetFallback,\n} from './quoteClassification.js';\nexport {\n TERMINAL_ORDER_STATUSES,\n isTerminalOrderStatus,\n} from './orderStatus.js';\nexport type { TypedError } from './errorNormalization.js';\nexport {\n getErrorMessage,\n extractExplicitTypedError,\n normalizeToTypedError,\n} from './errorNormalization.js';\nexport type {\n UserStorageRampsOrderEntry,\n SyncRampsOrder,\n OrderSyncingController,\n OrderSyncingOptions,\n SyncOrdersWithUserStorageConfig,\n} from './order-syncing/index.js';\nexport {\n USER_STORAGE_RAMPS_ORDERS_FEATURE,\n USER_STORAGE_VERSION,\n USER_STORAGE_VERSION_KEY,\n createOrderStorageKey,\n isSyncableOrder,\n mapRampsOrderToUserStorageEntry,\n mapUserStorageEntryToRampsOrder,\n stripPaymentDetailsForRemoteStorage,\n stripSyncMetadata,\n stripDeletedAt,\n areOrdersEqual,\n canPerformOrderSyncing,\n syncOrdersWithUserStorage,\n updateOrderInUserStorage,\n deleteOrderInUserStorage,\n} from './order-syncing/index.js';\nexport type {\n TransakServiceActions,\n TransakServiceEvents,\n TransakServiceMessenger,\n TransakAccessToken,\n TransakUserDetails,\n TransakUserDetailsAddress,\n TransakUserDetailsKycDetails,\n TransakBuyQuote,\n TransakKycRequirement,\n TransakAdditionalRequirement,\n TransakAdditionalRequirementsResponse,\n TransakOttResponse,\n TransakOrderPaymentMethod,\n TransakDepositOrder,\n TransakDepositNetwork,\n TransakDepositCryptoCurrency,\n TransakDepositPaymentMethod,\n TransakDepositRegion,\n TransakOrder,\n TransakQuoteTranslation,\n TransakTranslationRequest,\n TransakUserLimits,\n TransakIdProofStatus,\n PatchUserRequestBody as TransakPatchUserRequestBody,\n} from './TransakService.js';\nexport {\n TransakApiError,\n TransakService,\n TransakEnvironment,\n TransakOrderIdTransformer,\n} from './TransakService.js';\nexport {\n getTransakApiMessage,\n isTransakPhoneRegisteredError,\n} from './transakApiErrorUtils.js';\nexport type {\n TransakServiceMethodActions,\n TransakServiceSendUserOtpAction,\n TransakServiceVerifyUserOtpAction,\n TransakServiceGetUserDetailsAction,\n TransakServiceGetBuyQuoteAction,\n TransakServiceGetKycRequirementAction,\n TransakServiceCreateOrderAction,\n TransakServiceGetOrderAction,\n TransakServiceRequestOttAction,\n TransakServiceGeneratePaymentWidgetUrlAction,\n TransakServiceCreateWidgetUrlAction,\n} from './TransakService-method-action-types.js';\nexport type {\n AutorampAccount,\n ApplyAutorampRemoteStatusResult,\n CreateAutorampRequest,\n} from './autorampAccount.js';\nexport {\n AutorampStatus,\n TERMINAL_AUTORAMP_STATUSES,\n NOTABLE_AUTORAMP_STATUSES,\n isTerminalAutorampStatus,\n normalizeAutorampStatus,\n createAutorampAccount,\n applyAutorampRemoteStatus,\n markAutorampNotified,\n buildMusdAutorampRequest,\n buildBrazilMusdAutorampRequest,\n} from './autorampAccount.js';\nexport { buildOwnershipMessage } from './ownership-message.js';\nexport type {\n AutorampTransactionRecord,\n AutorampTransactionRecords,\n AutorampTransactionChange,\n} from './diffAutorampTransactions.js';\nexport { diffAutorampTransactions } from './diffAutorampTransactions.js';\nexport type {\n AutorampDepositInstructions,\n AutorampDepositRailsSummary,\n AutorampRemoteSnapshot,\n AutorampTransactionSummary,\n PixDepositInstructions,\n UsBankDepositInstructions,\n UsBankDepositRail,\n} from './autoramp-types.js';\nexport type {\n NeoBankServiceActions,\n NeoBankServiceEvents,\n NeoBankServiceMessenger,\n NeoBankAutorampResponse,\n NeoBankMicrodeposit,\n NeoBankRequestOptions,\n NeoBankQueryParams,\n GetWalletRegistrationStatusParams,\n RegisterSelfHostedWalletParams,\n} from './NeoBankService.js';\nexport type {\n NeoBankServiceGetAutorampAction,\n NeoBankServiceGetAutorampsAction,\n NeoBankServiceGetPixDepositInstructionsAction,\n NeoBankServiceGetDepositInstructionsAction,\n NeoBankServiceListAutorampTransactionsAction,\n NeoBankServiceRegisterPixAddressAction,\n NeoBankServiceGetAutorampQuoteAction,\n NeoBankServiceCreateAutorampAction,\n NeoBankServiceGetAutorampQuoteForAutorampAction,\n NeoBankServiceAttachAutorampQuoteAction,\n NeoBankServiceGetCustomerByExternalIdAction,\n NeoBankServiceGetMoonpayCustomerIdAction,\n NeoBankServiceGetMicrodepositsAction,\n NeoBankServiceGetWalletRegistrationStatusAction,\n NeoBankServiceRegisterSelfHostedWalletAction,\n} from './NeoBankService-method-action-types.js';\nexport {\n NeoBankService,\n serviceName as neoBankServiceName,\n mapNeoBankAutorampToRemoteSnapshot,\n extractPixDepositInstructions,\n extractUsBankDepositInstructions,\n} from './NeoBankService.js';\nexport type {\n Blockchain,\n RegistrationOutcome,\n RegistrationStatus,\n SelfHostedRegistration,\n WalletRegistrationErrorKind,\n} from './wallet-registration-service.js';\nexport { WalletRegistrationError } from './wallet-registration-service.js';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/ramps-controller",
|
|
3
|
-
"version": "28.1.0-preview-
|
|
3
|
+
"version": "28.1.0-preview-72009a9",
|
|
4
4
|
"description": "A controller for managing cryptocurrency on/off ramps functionality",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ethereum",
|
|
@@ -52,10 +52,12 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@metamask/base-controller": "^10.1.0",
|
|
55
|
+
"@metamask/base-data-service": "^2.1.0",
|
|
55
56
|
"@metamask/controller-utils": "^13.0.0",
|
|
56
57
|
"@metamask/messenger": "^3.0.0",
|
|
57
58
|
"@metamask/profile-sync-controller": "^36.0.0",
|
|
58
59
|
"@metamask/remote-feature-flag-controller": "^7.0.0",
|
|
60
|
+
"@metamask/superstruct": "^3.4.1",
|
|
59
61
|
"@metamask/utils": "^12.0.1",
|
|
60
62
|
"bignumber.js": "^9.1.2",
|
|
61
63
|
"fast-deep-equal": "^3.1.3"
|