@metamask/ramps-controller 20.2.0 → 21.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/dist/NeoBankService-method-action-types.d.ts +126 -0
  3. package/dist/NeoBankService-method-action-types.d.ts.map +1 -0
  4. package/dist/{TransakService-method-action-types.mjs → NeoBankService-method-action-types.js} +1 -1
  5. package/dist/NeoBankService-method-action-types.js.map +1 -0
  6. package/dist/NeoBankService.d.ts +191 -0
  7. package/dist/NeoBankService.d.ts.map +1 -0
  8. package/dist/NeoBankService.js +380 -0
  9. package/dist/NeoBankService.js.map +1 -0
  10. package/dist/{RampsController-method-action-types.d.mts → RampsController-method-action-types.d.ts} +93 -3
  11. package/dist/RampsController-method-action-types.d.ts.map +1 -0
  12. package/dist/{RampsController-method-action-types.mjs → RampsController-method-action-types.js} +1 -1
  13. package/dist/RampsController-method-action-types.js.map +1 -0
  14. package/dist/{RampsController.d.cts → RampsController.d.ts} +164 -17
  15. package/dist/RampsController.d.ts.map +1 -0
  16. package/dist/{RampsController.mjs → RampsController.js} +1064 -582
  17. package/dist/RampsController.js.map +1 -0
  18. package/dist/{RampsService-method-action-types.d.cts → RampsService-method-action-types.d.ts} +2 -2
  19. package/dist/RampsService-method-action-types.d.ts.map +1 -0
  20. package/dist/{RampsService-method-action-types.mjs → RampsService-method-action-types.js} +1 -1
  21. package/dist/RampsService-method-action-types.js.map +1 -0
  22. package/dist/{RampsService.d.mts → RampsService.d.ts} +5 -5
  23. package/dist/RampsService.d.ts.map +1 -0
  24. package/dist/{RampsService.mjs → RampsService.js} +159 -147
  25. package/dist/RampsService.js.map +1 -0
  26. package/dist/{RequestCache.d.cts → RequestCache.d.ts} +3 -3
  27. package/dist/RequestCache.d.ts.map +1 -0
  28. package/dist/{RequestCache.mjs → RequestCache.js} +1 -1
  29. package/dist/RequestCache.js.map +1 -0
  30. package/dist/{TransakService-method-action-types.d.cts → TransakService-method-action-types.d.ts} +2 -2
  31. package/dist/TransakService-method-action-types.d.ts.map +1 -0
  32. package/dist/TransakService-method-action-types.js +6 -0
  33. package/dist/TransakService-method-action-types.js.map +1 -0
  34. package/dist/{TransakService.d.mts → TransakService.d.ts} +6 -6
  35. package/dist/TransakService.d.ts.map +1 -0
  36. package/dist/TransakService.js +746 -0
  37. package/dist/TransakService.js.map +1 -0
  38. package/dist/autoramp-types.d.ts +22 -0
  39. package/dist/autoramp-types.d.ts.map +1 -0
  40. package/dist/autoramp-types.js +2 -0
  41. package/dist/autoramp-types.js.map +1 -0
  42. package/dist/autorampAccount.d.ts +126 -0
  43. package/dist/autorampAccount.d.ts.map +1 -0
  44. package/dist/autorampAccount.js +147 -0
  45. package/dist/autorampAccount.js.map +1 -0
  46. package/dist/{client-identity.d.cts → client-identity.d.ts} +1 -1
  47. package/dist/client-identity.d.ts.map +1 -0
  48. package/dist/{client-identity.mjs → client-identity.js} +1 -1
  49. package/dist/client-identity.js.map +1 -0
  50. package/dist/{errorNormalization.d.mts → errorNormalization.d.ts} +1 -1
  51. package/dist/errorNormalization.d.ts.map +1 -0
  52. package/dist/{errorNormalization.mjs → errorNormalization.js} +1 -1
  53. package/dist/errorNormalization.js.map +1 -0
  54. package/dist/{featureFlags.d.mts → featureFlags.d.ts} +2 -2
  55. package/dist/featureFlags.d.ts.map +1 -0
  56. package/dist/{featureFlags.mjs → featureFlags.js} +1 -1
  57. package/dist/featureFlags.js.map +1 -0
  58. package/dist/index.d.ts +35 -0
  59. package/dist/index.d.ts.map +1 -0
  60. package/dist/index.js +18 -0
  61. package/dist/index.js.map +1 -0
  62. package/dist/{orderStatus.d.mts → orderStatus.d.ts} +2 -2
  63. package/dist/orderStatus.d.ts.map +1 -0
  64. package/dist/{orderStatus.mjs → orderStatus.js} +2 -2
  65. package/dist/orderStatus.js.map +1 -0
  66. package/dist/ownership-message.d.ts +22 -0
  67. package/dist/ownership-message.d.ts.map +1 -0
  68. package/dist/ownership-message.js +22 -0
  69. package/dist/ownership-message.js.map +1 -0
  70. package/dist/{paymentMethodMerge.d.cts → paymentMethodMerge.d.ts} +2 -2
  71. package/dist/paymentMethodMerge.d.ts.map +1 -0
  72. package/dist/{paymentMethodMerge.mjs → paymentMethodMerge.js} +1 -1
  73. package/dist/paymentMethodMerge.js.map +1 -0
  74. package/dist/{providerAvailability.d.mts → providerAvailability.d.ts} +2 -2
  75. package/dist/providerAvailability.d.ts.map +1 -0
  76. package/dist/{providerAvailability.mjs → providerAvailability.js} +1 -1
  77. package/dist/providerAvailability.js.map +1 -0
  78. package/dist/{quoteClassification.d.cts → quoteClassification.d.ts} +2 -2
  79. package/dist/quoteClassification.d.ts.map +1 -0
  80. package/dist/{quoteClassification.mjs → quoteClassification.js} +1 -1
  81. package/dist/quoteClassification.js.map +1 -0
  82. package/dist/{rampsErrorCodes.d.cts → rampsErrorCodes.d.ts} +2 -2
  83. package/dist/rampsErrorCodes.d.ts.map +1 -0
  84. package/dist/{rampsErrorCodes.mjs → rampsErrorCodes.js} +1 -1
  85. package/dist/rampsErrorCodes.js.map +1 -0
  86. package/dist/{selectors.d.mts → selectors.d.ts} +3 -3
  87. package/dist/selectors.d.ts.map +1 -0
  88. package/dist/{selectors.mjs → selectors.js} +2 -2
  89. package/dist/selectors.js.map +1 -0
  90. package/dist/{transakApiErrorUtils.d.cts → transakApiErrorUtils.d.ts} +1 -1
  91. package/dist/transakApiErrorUtils.d.ts.map +1 -0
  92. package/dist/{transakApiErrorUtils.mjs → transakApiErrorUtils.js} +3 -3
  93. package/dist/transakApiErrorUtils.js.map +1 -0
  94. package/dist/{transakErrorCodes.d.cts → transakErrorCodes.d.ts} +3 -3
  95. package/dist/transakErrorCodes.d.ts.map +1 -0
  96. package/dist/{transakErrorCodes.mjs → transakErrorCodes.js} +1 -1
  97. package/dist/transakErrorCodes.js.map +1 -0
  98. package/dist/wallet-registration-machine.d.ts +81 -0
  99. package/dist/wallet-registration-machine.d.ts.map +1 -0
  100. package/dist/wallet-registration-machine.js +139 -0
  101. package/dist/wallet-registration-machine.js.map +1 -0
  102. package/dist/wallet-registration-service.d.ts +144 -0
  103. package/dist/wallet-registration-service.d.ts.map +1 -0
  104. package/dist/wallet-registration-service.js +335 -0
  105. package/dist/wallet-registration-service.js.map +1 -0
  106. package/package.json +17 -21
  107. package/dist/RampsController-method-action-types.cjs +0 -7
  108. package/dist/RampsController-method-action-types.cjs.map +0 -1
  109. package/dist/RampsController-method-action-types.d.cts +0 -668
  110. package/dist/RampsController-method-action-types.d.cts.map +0 -1
  111. package/dist/RampsController-method-action-types.d.mts.map +0 -1
  112. package/dist/RampsController-method-action-types.mjs.map +0 -1
  113. package/dist/RampsController.cjs +0 -2429
  114. package/dist/RampsController.cjs.map +0 -1
  115. package/dist/RampsController.d.cts.map +0 -1
  116. package/dist/RampsController.d.mts +0 -821
  117. package/dist/RampsController.d.mts.map +0 -1
  118. package/dist/RampsController.mjs.map +0 -1
  119. package/dist/RampsService-method-action-types.cjs +0 -7
  120. package/dist/RampsService-method-action-types.cjs.map +0 -1
  121. package/dist/RampsService-method-action-types.d.cts.map +0 -1
  122. package/dist/RampsService-method-action-types.d.mts +0 -171
  123. package/dist/RampsService-method-action-types.d.mts.map +0 -1
  124. package/dist/RampsService-method-action-types.mjs.map +0 -1
  125. package/dist/RampsService.cjs +0 -708
  126. package/dist/RampsService.cjs.map +0 -1
  127. package/dist/RampsService.d.cts +0 -944
  128. package/dist/RampsService.d.cts.map +0 -1
  129. package/dist/RampsService.d.mts.map +0 -1
  130. package/dist/RampsService.mjs.map +0 -1
  131. package/dist/RequestCache.cjs +0 -103
  132. package/dist/RequestCache.cjs.map +0 -1
  133. package/dist/RequestCache.d.cts.map +0 -1
  134. package/dist/RequestCache.d.mts +0 -110
  135. package/dist/RequestCache.d.mts.map +0 -1
  136. package/dist/RequestCache.mjs.map +0 -1
  137. package/dist/TransakService-method-action-types.cjs +0 -7
  138. package/dist/TransakService-method-action-types.cjs.map +0 -1
  139. package/dist/TransakService-method-action-types.d.cts.map +0 -1
  140. package/dist/TransakService-method-action-types.d.mts +0 -140
  141. package/dist/TransakService-method-action-types.d.mts.map +0 -1
  142. package/dist/TransakService-method-action-types.mjs.map +0 -1
  143. package/dist/TransakService.cjs +0 -743
  144. package/dist/TransakService.cjs.map +0 -1
  145. package/dist/TransakService.d.cts +0 -370
  146. package/dist/TransakService.d.cts.map +0 -1
  147. package/dist/TransakService.d.mts.map +0 -1
  148. package/dist/TransakService.mjs +0 -734
  149. package/dist/TransakService.mjs.map +0 -1
  150. package/dist/client-identity.cjs +0 -28
  151. package/dist/client-identity.cjs.map +0 -1
  152. package/dist/client-identity.d.cts.map +0 -1
  153. package/dist/client-identity.d.mts +0 -24
  154. package/dist/client-identity.d.mts.map +0 -1
  155. package/dist/client-identity.mjs.map +0 -1
  156. package/dist/errorNormalization.cjs +0 -84
  157. package/dist/errorNormalization.cjs.map +0 -1
  158. package/dist/errorNormalization.d.cts +0 -56
  159. package/dist/errorNormalization.d.cts.map +0 -1
  160. package/dist/errorNormalization.d.mts.map +0 -1
  161. package/dist/errorNormalization.mjs.map +0 -1
  162. package/dist/featureFlags.cjs +0 -144
  163. package/dist/featureFlags.cjs.map +0 -1
  164. package/dist/featureFlags.d.cts +0 -82
  165. package/dist/featureFlags.d.cts.map +0 -1
  166. package/dist/featureFlags.d.mts.map +0 -1
  167. package/dist/featureFlags.mjs.map +0 -1
  168. package/dist/index.cjs +0 -63
  169. package/dist/index.cjs.map +0 -1
  170. package/dist/index.d.cts +0 -26
  171. package/dist/index.d.cts.map +0 -1
  172. package/dist/index.d.mts +0 -26
  173. package/dist/index.d.mts.map +0 -1
  174. package/dist/index.mjs +0 -14
  175. package/dist/index.mjs.map +0 -1
  176. package/dist/orderStatus.cjs +0 -34
  177. package/dist/orderStatus.cjs.map +0 -1
  178. package/dist/orderStatus.d.cts +0 -18
  179. package/dist/orderStatus.d.cts.map +0 -1
  180. package/dist/orderStatus.d.mts.map +0 -1
  181. package/dist/orderStatus.mjs.map +0 -1
  182. package/dist/paymentMethodMerge.cjs +0 -51
  183. package/dist/paymentMethodMerge.cjs.map +0 -1
  184. package/dist/paymentMethodMerge.d.cts.map +0 -1
  185. package/dist/paymentMethodMerge.d.mts +0 -26
  186. package/dist/paymentMethodMerge.d.mts.map +0 -1
  187. package/dist/paymentMethodMerge.mjs.map +0 -1
  188. package/dist/providerAvailability.cjs +0 -134
  189. package/dist/providerAvailability.cjs.map +0 -1
  190. package/dist/providerAvailability.d.cts +0 -101
  191. package/dist/providerAvailability.d.cts.map +0 -1
  192. package/dist/providerAvailability.d.mts.map +0 -1
  193. package/dist/providerAvailability.mjs.map +0 -1
  194. package/dist/quoteClassification.cjs +0 -44
  195. package/dist/quoteClassification.cjs.map +0 -1
  196. package/dist/quoteClassification.d.cts.map +0 -1
  197. package/dist/quoteClassification.d.mts +0 -33
  198. package/dist/quoteClassification.d.mts.map +0 -1
  199. package/dist/quoteClassification.mjs.map +0 -1
  200. package/dist/rampsErrorCodes.cjs +0 -11
  201. package/dist/rampsErrorCodes.cjs.map +0 -1
  202. package/dist/rampsErrorCodes.d.cts.map +0 -1
  203. package/dist/rampsErrorCodes.d.mts +0 -9
  204. package/dist/rampsErrorCodes.d.mts.map +0 -1
  205. package/dist/rampsErrorCodes.mjs.map +0 -1
  206. package/dist/selectors.cjs +0 -85
  207. package/dist/selectors.cjs.map +0 -1
  208. package/dist/selectors.d.cts +0 -78
  209. package/dist/selectors.d.cts.map +0 -1
  210. package/dist/selectors.d.mts.map +0 -1
  211. package/dist/selectors.mjs.map +0 -1
  212. package/dist/transakApiErrorUtils.cjs +0 -15
  213. package/dist/transakApiErrorUtils.cjs.map +0 -1
  214. package/dist/transakApiErrorUtils.d.cts.map +0 -1
  215. package/dist/transakApiErrorUtils.d.mts +0 -3
  216. package/dist/transakApiErrorUtils.d.mts.map +0 -1
  217. package/dist/transakApiErrorUtils.mjs.map +0 -1
  218. package/dist/transakErrorCodes.cjs +0 -14
  219. package/dist/transakErrorCodes.cjs.map +0 -1
  220. package/dist/transakErrorCodes.d.cts.map +0 -1
  221. package/dist/transakErrorCodes.d.mts +0 -12
  222. package/dist/transakErrorCodes.d.mts.map +0 -1
  223. package/dist/transakErrorCodes.mjs.map +0 -1
@@ -1,821 +0,0 @@
1
- import type { ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
2
- import { BaseController } from "@metamask/base-controller";
3
- import type { Messenger } from "@metamask/messenger";
4
- import type { RemoteFeatureFlagControllerGetStateAction } from "@metamask/remote-feature-flag-controller";
5
- import type { RampsControllerMethodActions } from "./RampsController-method-action-types.mjs";
6
- import type { RampsErrorCode } from "./rampsErrorCodes.mjs";
7
- import type { RampsServiceGetDefaultRedirectCallbackUrlAction, RampsServiceGetGeolocationAction, RampsServiceGetCountriesAction, RampsServiceGetTokensAction, RampsServiceGetProvidersAction, RampsServiceGetPaymentMethodsAction, RampsServiceGetQuotesAction, RampsServiceGetBuyWidgetUrlAction, RampsServiceGetOrderAction, RampsServiceGetOrderFromCallbackAction } from "./RampsService-method-action-types.mjs";
8
- import type { BuyWidget, Country, TokensResponse, Provider, State, RampAction, PaymentMethod, PaymentMethodsResponse, QuotesResponse, Quote, RampsToken, RampsServiceActions, RampsOrder, ProvidersResponse } from "./RampsService.mjs";
9
- import { RampsOrderStatus } from "./RampsService.mjs";
10
- import type { RequestCache as RequestCacheType, RequestState, ExecuteRequestOptions } from "./RequestCache.mjs";
11
- import type { TransakServiceSetApiKeyAction, TransakServiceSetAccessTokenAction, TransakServiceClearAccessTokenAction, TransakServiceSendUserOtpAction, TransakServiceVerifyUserOtpAction, TransakServiceLogoutAction, TransakServiceGetUserDetailsAction, TransakServiceGetBuyQuoteAction, TransakServiceGetKycRequirementAction, TransakServiceGetAdditionalRequirementsAction, TransakServiceCreateOrderAction, TransakServiceGetOrderAction, TransakServiceGetUserLimitsAction, TransakServiceRequestOttAction, TransakServiceGeneratePaymentWidgetUrlAction, TransakServiceCreateWidgetUrlAction, TransakServiceSubmitPurposeOfUsageFormAction, TransakServicePatchUserAction, TransakServiceSubmitSsnDetailsAction, TransakServiceConfirmPaymentAction, TransakServiceGetTranslationAction, TransakServiceGetIdProofStatusAction, TransakServiceCancelOrderAction, TransakServiceCancelAllActiveOrdersAction, TransakServiceGetActiveOrdersAction } from "./TransakService-method-action-types.mjs";
12
- import type { TransakAccessToken, TransakUserDetails, TransakBuyQuote, TransakKycRequirement, TransakAdditionalRequirementsResponse, TransakDepositOrder, TransakUserLimits, TransakOttResponse, TransakQuoteTranslation, TransakTranslationRequest, TransakIdProofStatus, TransakOrderPaymentMethod, PatchUserRequestBody, TransakOrder } from "./TransakService.mjs";
13
- import type { TransakServiceActions } from "./TransakService.mjs";
14
- /**
15
- * The name of the {@link RampsController}, used to namespace the
16
- * controller's actions and events and to namespace the controller's state data
17
- * when composed with other controllers.
18
- */
19
- export declare const controllerName = "RampsController";
20
- /**
21
- * RampsService action types that RampsController calls via the messenger.
22
- * Any host (e.g. mobile) that creates a RampsController messenger must delegate
23
- * these actions from the root messenger so the controller can function.
24
- */
25
- export declare const RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS: readonly (RampsServiceActions['type'] | TransakServiceActions['type'])[];
26
- /**
27
- * Represents the user's selected region with full country and state objects.
28
- */
29
- export type UserRegion = {
30
- /**
31
- * The country object for the selected region.
32
- */
33
- country: Country;
34
- /**
35
- * The state object if a state was selected, null if only country was selected.
36
- */
37
- state: State | null;
38
- /**
39
- * The region code string (e.g., "us-ut" or "fr") used for API calls.
40
- */
41
- regionCode: string;
42
- };
43
- /**
44
- * Generic type for resource state that bundles data with loading/error states.
45
- *
46
- * @template TData - The type of the resource data
47
- * @template TSelected - The type of the selected item (defaults to null for resources without selection)
48
- */
49
- export type ResourceState<TData, TSelected = null> = {
50
- /**
51
- * The resource data.
52
- */
53
- data: TData;
54
- /**
55
- * The currently selected item, or null if none selected.
56
- */
57
- selected: TSelected;
58
- /**
59
- * Whether the resource is currently being fetched.
60
- */
61
- isLoading: boolean;
62
- /**
63
- * Error message if the fetch failed, or null.
64
- */
65
- error: string | null;
66
- /**
67
- * Stable error key for client-side localization, if available.
68
- */
69
- errorKey?: RampsErrorCode | null;
70
- };
71
- /**
72
- * Describes the transak-specific state managed by the RampsController.
73
- * This state is used by the unified V2 native flow.
74
- */
75
- export type TransakState = {
76
- isAuthenticated: boolean;
77
- userDetails: ResourceState<TransakUserDetails | null>;
78
- buyQuote: ResourceState<TransakBuyQuote | null>;
79
- kycRequirement: ResourceState<TransakKycRequirement | null>;
80
- };
81
- /**
82
- * Describes the state for all native providers managed by the RampsController.
83
- * Each native provider has its own nested state object.
84
- */
85
- export type NativeProvidersState = {
86
- transak: TransakState;
87
- };
88
- /**
89
- * Response from {@link RampsController.getPaymentMethodsForContext}.
90
- *
91
- * Methods are request-eligible for the resolved provider set; they are not a
92
- * guarantee that every amount will produce a quote (provider fiat limits still
93
- * apply at quote time).
94
- */
95
- export type PaymentMethodsForContextResponse = {
96
- /**
97
- * Deduped payment methods contributed by the resolved provider set.
98
- */
99
- methods: PaymentMethod[];
100
- /**
101
- * Suggested selection for this request only. Written to controller state only
102
- * when `updateState` was true on the call.
103
- */
104
- selected: PaymentMethod | null;
105
- /**
106
- * Provider IDs whose methods were requested (after resolution / allowlist
107
- * filtering).
108
- */
109
- providerIds: string[];
110
- };
111
- /**
112
- * Describes the shape of the state object for {@link RampsController}.
113
- */
114
- export type RampsControllerState = {
115
- /**
116
- * The user's region (full country and state objects).
117
- * Initially set via geolocation fetch, but can be manually changed by the user.
118
- */
119
- userRegion: UserRegion | null;
120
- /**
121
- * Countries resource state with data, loading, and error.
122
- * Data contains the list of countries available for ramp actions.
123
- */
124
- countries: ResourceState<Country[]>;
125
- /**
126
- * Providers resource state with data, selected, loading, and error.
127
- * Data contains the list of providers available for the current region.
128
- */
129
- providers: ResourceState<Provider[], Provider | null>;
130
- /**
131
- * Tokens resource state with data, selected, loading, and error.
132
- * Data contains topTokens and allTokens arrays.
133
- */
134
- tokens: ResourceState<TokensResponse | null, RampsToken | null>;
135
- /**
136
- * Payment methods resource state with data, selected, loading, and error.
137
- * Data contains payment methods filtered by region, fiat, asset, and provider.
138
- */
139
- paymentMethods: ResourceState<PaymentMethod[], PaymentMethod | null>;
140
- /**
141
- * Cache of request states, keyed by cache key.
142
- * This stores loading, success, and error states for API requests.
143
- */
144
- requests: RequestCacheType;
145
- /**
146
- * State for native providers in the unified V2 flow.
147
- * Each provider has its own nested state containing authentication,
148
- * user details, quote, and KYC data.
149
- */
150
- nativeProviders: NativeProvidersState;
151
- /**
152
- * The controller is the authority for V2 orders — it polls, updates,
153
- * and persists them.
154
- */
155
- orders: RampsOrder[];
156
- /**
157
- * Whether the currently selected provider was auto-selected by the system
158
- * (no order history, no Transak) rather than chosen by the user or derived
159
- * from order history. When true, the UI should silently switch providers on
160
- * token conflict instead of showing the "Token Not Available" modal.
161
- */
162
- providerAutoSelected: boolean;
163
- };
164
- /**
165
- * Constructs the default {@link RampsController} state. This allows
166
- * consumers to provide a partial state object when initializing the controller
167
- * and also helps in constructing complete state objects for this controller in
168
- * tests.
169
- *
170
- * @returns The default {@link RampsController} state.
171
- */
172
- export declare function getDefaultRampsControllerState(): RampsControllerState;
173
- /**
174
- * Retrieves the state of the {@link RampsController}.
175
- */
176
- export type RampsControllerGetStateAction = ControllerGetStateAction<typeof controllerName, RampsControllerState>;
177
- /**
178
- * Actions that {@link RampsControllerMessenger} exposes to other consumers.
179
- */
180
- export type RampsControllerActions = RampsControllerGetStateAction | RampsControllerMethodActions;
181
- /**
182
- * Actions from other messengers that {@link RampsController} calls.
183
- */
184
- type AllowedActions = RemoteFeatureFlagControllerGetStateAction | RampsServiceGetDefaultRedirectCallbackUrlAction | RampsServiceGetGeolocationAction | RampsServiceGetCountriesAction | RampsServiceGetTokensAction | RampsServiceGetProvidersAction | RampsServiceGetPaymentMethodsAction | RampsServiceGetQuotesAction | RampsServiceGetBuyWidgetUrlAction | RampsServiceGetOrderAction | RampsServiceGetOrderFromCallbackAction | TransakServiceSetApiKeyAction | TransakServiceSetAccessTokenAction | TransakServiceClearAccessTokenAction | TransakServiceSendUserOtpAction | TransakServiceVerifyUserOtpAction | TransakServiceLogoutAction | TransakServiceGetUserDetailsAction | TransakServiceGetBuyQuoteAction | TransakServiceGetKycRequirementAction | TransakServiceGetAdditionalRequirementsAction | TransakServiceCreateOrderAction | TransakServiceGetOrderAction | TransakServiceGetUserLimitsAction | TransakServiceRequestOttAction | TransakServiceGeneratePaymentWidgetUrlAction | TransakServiceCreateWidgetUrlAction | TransakServiceSubmitPurposeOfUsageFormAction | TransakServicePatchUserAction | TransakServiceSubmitSsnDetailsAction | TransakServiceConfirmPaymentAction | TransakServiceGetTranslationAction | TransakServiceGetIdProofStatusAction | TransakServiceCancelOrderAction | TransakServiceCancelAllActiveOrdersAction | TransakServiceGetActiveOrdersAction;
185
- /**
186
- * Published when the state of {@link RampsController} changes.
187
- */
188
- export type RampsControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, RampsControllerState>;
189
- /**
190
- * Published when a V2 order's status transitions.
191
- * Consumed by mobile's init layer for notifications and analytics.
192
- */
193
- export type RampsControllerOrderStatusChangedEvent = {
194
- type: `${typeof controllerName}:orderStatusChanged`;
195
- payload: [{
196
- order: RampsOrder;
197
- previousStatus: RampsOrderStatus;
198
- }];
199
- };
200
- /**
201
- * Events that {@link RampsControllerMessenger} exposes to other consumers.
202
- */
203
- export type RampsControllerEvents = RampsControllerStateChangeEvent | RampsControllerOrderStatusChangedEvent;
204
- /**
205
- * Events from other messengers that {@link RampsController} subscribes to.
206
- */
207
- type AllowedEvents = never;
208
- /**
209
- * The messenger restricted to actions and events accessed by
210
- * {@link RampsController}.
211
- */
212
- export type RampsControllerMessenger = Messenger<typeof controllerName, RampsControllerActions | AllowedActions, RampsControllerEvents | AllowedEvents>;
213
- /**
214
- * Configuration options for the RampsController.
215
- */
216
- export type RampsControllerOptions = {
217
- /** The messenger suited for this controller. */
218
- messenger: RampsControllerMessenger;
219
- /** The desired state with which to initialize this controller. */
220
- state?: Partial<RampsControllerState>;
221
- /** Time to live for cached requests in milliseconds. Defaults to 15 minutes. */
222
- requestCacheTTL?: number;
223
- /** Maximum number of entries in the request cache. Defaults to 250. */
224
- requestCacheMaxSize?: number;
225
- };
226
- /**
227
- * Returns the internal MetaMask order code used for state lookups and polling.
228
- * Prefers the code embedded in the canonical order `id` path over `providerOrderId`,
229
- * which may contain the provider's native order identifier.
230
- *
231
- * @param orderOrId - Order fields or a full order id / order code string.
232
- * @returns The internal order code.
233
- */
234
- export declare function getInternalOrderCode(orderOrId: Pick<RampsOrder, 'id' | 'providerOrderId'> | string): string;
235
- export declare class RampsController extends BaseController<typeof controllerName, RampsControllerState, RampsControllerMessenger> {
236
- #private;
237
- /**
238
- * Clears the pending resource count map. Used only in tests to exercise the
239
- * defensive path when get() returns undefined in the finally block.
240
- *
241
- * @internal
242
- */
243
- clearPendingResourceCountForTest(): void;
244
- /**
245
- * Constructs a new {@link RampsController}.
246
- *
247
- * @param args - The constructor arguments.
248
- * @param args.messenger - The messenger suited for this controller.
249
- * @param args.state - The desired state with which to initialize this
250
- * controller. Missing properties will be filled in with defaults.
251
- * @param args.requestCacheTTL - Time to live for cached requests in milliseconds.
252
- * @param args.requestCacheMaxSize - Maximum number of entries in the request cache.
253
- */
254
- constructor({ messenger, state, requestCacheTTL, requestCacheMaxSize, }: RampsControllerOptions);
255
- /**
256
- * Executes a request with caching, deduplication, and at most one in-flight
257
- * request per resource type.
258
- *
259
- * 1. **Same cache key in flight** – If a request with this cache key is
260
- * already pending, returns that promise (deduplication; no second request).
261
- *
262
- * 2. **Cache hit** – If valid, non-expired data exists in state.requests for
263
- * this key and forceRefresh is not set, returns that data without fetching.
264
- *
265
- * 3. **New request** – Creates an AbortController and fires the fetcher.
266
- * If options.resourceType is set, tags the pending request with that
267
- * resource type (so #abortDependentRequests can cancel it on region
268
- * change or cleanup) and ref-counts resource-level loading state.
269
- * On success or error, updates request state and resource error;
270
- * in finally, clears resource loading only if this request was not
271
- * aborted.
272
- *
273
- * @param cacheKey - Unique identifier for this request (e.g. from createCacheKey).
274
- * @param fetcher - Async function that performs the fetch. Receives an AbortSignal
275
- * that is aborted when this request is superseded by another for the same resource.
276
- * @param options - Optional forceRefresh, ttl, and resourceType for loading/error state.
277
- * @returns The result of the request (from cache, joined promise, or fetcher).
278
- */
279
- executeRequest<TResult>(cacheKey: string, fetcher: (signal: AbortSignal) => Promise<TResult>, options?: ExecuteRequestOptions): Promise<TResult>;
280
- /**
281
- * Aborts a pending request if one exists.
282
- *
283
- * @param cacheKey - The cache key of the request to abort.
284
- * @returns True if a request was aborted.
285
- */
286
- abortRequest(cacheKey: string): boolean;
287
- /**
288
- * Gets the state of a specific cached request.
289
- *
290
- * @param cacheKey - The cache key to look up.
291
- * @returns The request state, or undefined if not cached.
292
- */
293
- getRequestState(cacheKey: string): RequestState | undefined;
294
- /**
295
- * Sets the user's region manually (without fetching geolocation).
296
- * This allows users to override the detected region.
297
- *
298
- * @param region - The region code to set (e.g., "US-CA").
299
- * @param options - Options for cache behavior.
300
- * @returns The user region object.
301
- */
302
- setUserRegion(region: string, options?: ExecuteRequestOptions): Promise<UserRegion>;
303
- /**
304
- * Sets the user's selected provider.
305
- *
306
- * Accepts either a Provider object (stored directly) or a provider ID
307
- * string (looked up from state). The object form is preferred when the
308
- * caller already has the full data (e.g. from React Query cache).
309
- *
310
- * @param providerOrId - A Provider object, a provider ID string (e.g., "/providers/moonpay"), or null to clear.
311
- * @param options - Optional settings for the selection.
312
- * @param options.autoSelected - When true, marks the provider as system-guessed
313
- * (soft selection). The UI will silently auto-switch on token conflict instead
314
- * of showing the "Token Not Available" modal. Defaults to false.
315
- */
316
- setSelectedProvider(providerOrId: string | Provider | null, options?: {
317
- autoSelected?: boolean;
318
- }): void;
319
- /**
320
- * Switches to the first provider in state that serves the given asset,
321
- * when the currently selected provider does not.
322
- *
323
- * This is the controller-level equivalent of UB2's BuildQuote tier-1
324
- * silent-switch effect and MMPay's `useEnsureCompatibleProvider` hook: it
325
- * keeps provider-asset compatibility logic in one place rather than
326
- * duplicating `providerServesAsset` + find-and-switch across multiple UI
327
- * layers.
328
- *
329
- * The compatibility check prefers the current provider's entry in
330
- * `providers.data` over the `providers.selected` copy, which can be stale
331
- * once a fresh providers list arrives.
332
- *
333
- * No-op when:
334
- * - `providers.data` is empty (providers not yet loaded)
335
- * - the currently selected provider already serves the asset
336
- * - no provider in the list serves the asset (no safe fallback)
337
- *
338
- * @param assetId - CAIP-19 asset id of the deposit asset.
339
- * @param options - Optional settings forwarded to `setSelectedProvider`.
340
- * @param options.autoSelected - When true, marks the new selection as
341
- * system-guessed (soft selection). Defaults to true.
342
- * @returns `true` if the selected provider was changed, `false` otherwise.
343
- */
344
- setSelectedProviderForAsset(assetId: string, options?: {
345
- autoSelected?: boolean;
346
- }): boolean;
347
- /**
348
- * Initializes the controller by fetching the user's region from geolocation.
349
- * This should be called once at app startup to set up the initial region.
350
- *
351
- * Idempotent: subsequent calls return the same promise unless forceRefresh is set.
352
- * Force-refetches the countries catalog on startup (bypassing the in-session
353
- * request cache) so region preset amounts stay current. The catalog is not
354
- * persisted, so a cold start always re-fetches it regardless. Skips
355
- * geolocation when userRegion already exists.
356
- *
357
- * @param options - Options for cache behavior. forceRefresh bypasses idempotency and re-runs the full flow.
358
- * @returns Promise that resolves when initialization is complete.
359
- */
360
- init(options?: ExecuteRequestOptions): Promise<void>;
361
- /**
362
- * Fetches the list of supported countries.
363
- * The API returns countries with support information for both buy and sell actions.
364
- * The countries are saved in the controller state once fetched.
365
- *
366
- * @param options - Options for cache behavior.
367
- * @returns An array of countries.
368
- */
369
- getCountries(options?: ExecuteRequestOptions): Promise<Country[]>;
370
- /**
371
- * Fetches the list of available tokens for a given region and action.
372
- * The tokens are saved in the controller state once fetched.
373
- *
374
- * @param region - The region code (e.g., "us", "fr", "us-ny"). If not provided, uses the user's region from controller state.
375
- * @param action - The ramp action type ('buy' or 'sell').
376
- * @param options - Options for cache behavior and query filters.
377
- * @param options.provider - Provider ID(s) to filter by.
378
- * @returns The tokens response containing topTokens and allTokens.
379
- */
380
- getTokens(region?: string, action?: RampAction, options?: ExecuteRequestOptions & {
381
- provider?: string | string[];
382
- }): Promise<TokensResponse>;
383
- /**
384
- * Sets the user's selected token by asset ID.
385
- * Looks up the token from the current tokens in state and automatically
386
- * fetches payment methods for that token.
387
- *
388
- * @param assetId - The asset identifier in CAIP-19 format (e.g., "eip155:1/erc20:0x..."), or undefined to clear.
389
- * @throws If region is not set, tokens are not loaded, or token is not found.
390
- */
391
- setSelectedToken(assetId?: string): void;
392
- /**
393
- * Fetches the list of providers for a given region.
394
- * The providers are saved in the controller state once fetched.
395
- *
396
- * @param region - The region code (e.g., "us", "fr", "us-ny"). If not provided, uses the user's region from controller state.
397
- * @param options - Options for cache behavior and query filters.
398
- * @param options.provider - Provider ID(s) to filter by.
399
- * @param options.crypto - Crypto currency ID(s) to filter by.
400
- * @param options.payments - Payment method ID(s) to filter by.
401
- * @returns The providers response containing providers array.
402
- */
403
- getProviders(region?: string, options?: ExecuteRequestOptions & {
404
- provider?: string | string[];
405
- crypto?: string | string[];
406
- payments?: string | string[];
407
- }): Promise<ProvidersResponse>;
408
- /**
409
- * Fetches the list of payment methods for a given context.
410
- * The payment methods are saved in the controller state once fetched.
411
- *
412
- * @param region - User's region code (e.g. "fr", "us-ny").
413
- * @param options - Query parameters for filtering payment methods.
414
- * @param options.assetId - CAIP-19 cryptocurrency identifier.
415
- * @param options.provider - Provider ID path.
416
- * @returns The payment methods response containing payments array.
417
- */
418
- getPaymentMethods(region?: string, options?: ExecuteRequestOptions & {
419
- assetId?: string;
420
- provider?: string;
421
- }): Promise<PaymentMethodsResponse>;
422
- /**
423
- * Fetches payment methods for a quoting context without coupling callers to
424
- * the Buy flow's globally selected provider/token catalog.
425
- *
426
- * Provider contribution mirrors {@link getQuotes}:
427
- * - explicit `providers` (optionally filtered when
428
- * `restrictToKnownOrNativeProviders` is set)
429
- * - auto-select / restrict path, including `moneyHeadlessAllProviders`
430
- * widening: flag off uses the restricted/native resolver; flag on uses
431
- * supporting providers, intersected with the flag allowlist when that
432
- * allowlist is non-empty (pick-survivor set for picker methods)
433
- * - when those resolution flags and `providers` are omitted, uses only
434
- * `providers.selected` (UB2 selected-provider context)
435
- *
436
- * By default this is request-only: it does **not** mutate
437
- * `paymentMethods.data` or `paymentMethods.selected`. Pass `updateState:
438
- * true` only when the caller explicitly wants Buy-catalog write semantics
439
- * (UB2). Headless / MM Pay selection stays TPC-owned. `updateState: true`
440
- * throws when the resolved provider set holds more than one provider, because
441
- * the write guards cannot tell two such requests apart.
442
- *
443
- * Methods are request-eligible for the resolved provider set; they are not
444
- * guaranteed to produce a quote for every amount (provider fiat limits still
445
- * apply at quote time).
446
- *
447
- * @param options - Context for the payment-method fetch.
448
- * @param options.region - Region code. Defaults to `userRegion`.
449
- * @param options.assetId - Required CAIP-19 quoting asset.
450
- * @param options.providers - Explicit provider ids.
451
- * @param options.autoSelectProvider - Resolve providers like `getQuotes`.
452
- * @param options.preferredProviderIds - Preferred ids for auto-selection.
453
- * @param options.restrictToKnownOrNativeProviders - Headless gating.
454
- * @param options.updateState - When true, write `paymentMethods` state.
455
- * @param options.preferPaymentMethodId - Preserve this id when still present.
456
- * @param options.forceRefresh - Bypass request cache for provider fetches.
457
- * @param options.ttl - Custom TTL for provider payment-method fetches.
458
- * @returns Deduped methods, a request-only suggested selection, and the
459
- * provider ids that contributed.
460
- */
461
- getPaymentMethodsForContext(options: {
462
- region?: string;
463
- assetId: string;
464
- providers?: string[];
465
- autoSelectProvider?: boolean;
466
- preferredProviderIds?: string[];
467
- restrictToKnownOrNativeProviders?: boolean;
468
- updateState?: boolean;
469
- preferPaymentMethodId?: string;
470
- forceRefresh?: boolean;
471
- ttl?: number;
472
- }): Promise<PaymentMethodsForContextResponse>;
473
- /**
474
- * Sets the user's selected payment method.
475
- *
476
- * Accepts either a payment method ID (looked up from state) or a full
477
- * PaymentMethod object (stored directly). The object form is preferred
478
- * when the caller already has the full data (e.g. from React Query cache),
479
- * as it avoids depending on controller state being populated.
480
- *
481
- * @param paymentMethodOrId - A PaymentMethod object, a payment method ID string, or undefined/null to clear.
482
- */
483
- setSelectedPaymentMethod(paymentMethodOrId?: string | PaymentMethod | null): void;
484
- /**
485
- * Fetches quotes from all providers for a given set of parameters.
486
- * Uses the controller's request cache; callers manage the response in local state.
487
- *
488
- * @param options - The parameters for fetching quotes.
489
- * @param options.region - User's region code. If not provided, uses userRegion from state.
490
- * @param options.fiat - Fiat currency code. If not provided, uses userRegion currency.
491
- * @param options.assetId - CAIP-19 cryptocurrency identifier.
492
- * @param options.amount - The amount (in fiat for buy, crypto for sell).
493
- * @param options.walletAddress - The destination wallet address.
494
- * @param options.paymentMethods - Array of payment method IDs. If not provided, uses paymentMethods from state.
495
- * @param options.providers - Optional provider IDs to filter quotes.
496
- * @param options.autoSelectProvider - When true and `providers` is omitted,
497
- * resolves a provider that supports `assetId` for this request only (no
498
- * state mutation). Ignored when `providers` is passed.
499
- * @param options.preferredProviderIds - Optional provider IDs to prefer
500
- * during auto-selection, in priority order (e.g. derived by the caller
501
- * from completed-order history). Only used when `autoSelectProvider` is
502
- * true and `providers` is omitted.
503
- * @param options.restrictToKnownOrNativeProviders - Headless-buy v0 gating. When
504
- * true, auto-selection resolves only a native provider, and an explicitly
505
- * passed `providers` list is filtered to those supporting the region and
506
- * asset. If nothing qualifies, `getQuotes` returns an empty response
507
- * instead of quoting other providers.
508
- * @param options.redirectUrl - Optional redirect URL after order completion.
509
- * @param options.action - The ramp action type. Defaults to 'buy'.
510
- * @param options.forceRefresh - Whether to bypass cache.
511
- * @param options.ttl - Custom TTL for this request.
512
- * @returns The quotes response containing success, sorted, error, and customActions.
513
- */
514
- getQuotes(options: {
515
- region?: string;
516
- fiat?: string;
517
- assetId?: string;
518
- amount: number;
519
- walletAddress: string;
520
- paymentMethods?: string[];
521
- providers?: string[];
522
- autoSelectProvider?: boolean;
523
- preferredProviderIds?: string[];
524
- restrictToKnownOrNativeProviders?: boolean;
525
- redirectUrl?: string;
526
- action?: RampAction;
527
- forceRefresh?: boolean;
528
- ttl?: number;
529
- }): Promise<QuotesResponse>;
530
- /**
531
- * Adds or updates a V2 order in controller state.
532
- * If an order with the same internal order code already exists, the incoming
533
- * fields are merged on top of the existing order so that fields not present
534
- * in the update (e.g. paymentDetails from the Transak API) are preserved.
535
- *
536
- * @param order - The RampsOrder to add or update.
537
- */
538
- addOrder(order: RampsOrder): void;
539
- /**
540
- * Removes a V2 order from controller state by providerOrderId.
541
- *
542
- * @param providerOrderId - The provider order ID to remove.
543
- */
544
- removeOrder(providerOrderId: string): void;
545
- /**
546
- * Starts polling all pending V2 orders at a fixed interval.
547
- * Each poll cycle iterates orders with non-terminal statuses,
548
- * respects pollingSecondsMinimum and backoff from error count.
549
- */
550
- startOrderPolling(): void;
551
- /**
552
- * Stops order polling and clears the interval.
553
- */
554
- stopOrderPolling(): void;
555
- /**
556
- * Cleans up controller resources.
557
- * Should be called when the controller is no longer needed.
558
- */
559
- destroy(): void;
560
- /**
561
- * Fetches the widget data from a quote for redirect providers.
562
- * Makes a request to the buyURL endpoint via the RampsService to get the
563
- * actual provider widget URL and optional order ID for polling.
564
- *
565
- * @param quote - The quote to fetch the widget URL from.
566
- * @returns Promise resolving to the full BuyWidget (url, browser, orderId), or null if not available (missing buyURL or empty url in response).
567
- * @throws Rethrows errors from the RampsService (e.g. HttpError, network failures) so clients can react to fetch failures.
568
- */
569
- getBuyWidgetData(quote: Quote): Promise<BuyWidget | null>;
570
- /**
571
- * Registers an order ID for polling until the order is created or resolved.
572
- * Adds a minimal stub order to controller state; the existing order polling
573
- * will fetch the full order when the provider has created it.
574
- *
575
- * @param params - Object containing order identifiers and wallet info.
576
- * @param params.orderId - Full order ID (e.g. "/providers/paypal/orders/abc123") or order code.
577
- * @param params.providerCode - Canonical provider code (e.g. "paypal", "transak").
578
- * @param params.walletAddress - Wallet address for the order.
579
- * @param params.chainId - Chain ID for the order (decimal, hex, or CAIP-2). Must be non-empty.
580
- */
581
- addPrecreatedOrder(params: {
582
- orderId: string;
583
- providerCode: string;
584
- walletAddress: string;
585
- chainId: string;
586
- }): void;
587
- /**
588
- * Fetches an order from the unified V2 API endpoint.
589
- * Returns a normalized RampsOrder for all provider types (aggregator and native).
590
- *
591
- * @param providerCode - The provider code (e.g., "transak", "transak-native", "moonpay").
592
- * @param orderCode - The order identifier.
593
- * @param wallet - The wallet address associated with the order.
594
- * @returns The unified order data.
595
- */
596
- getOrder(providerCode: string, orderCode: string, wallet: string): Promise<RampsOrder>;
597
- /**
598
- * Extracts an order from a provider callback URL.
599
- * Sends the callback URL to the V2 backend for provider-specific parsing,
600
- * then fetches the full order. This is the V2 equivalent of the aggregator
601
- * SDK's `getOrderFromCallback`.
602
- *
603
- * @param providerCode - The provider code (e.g., "transak", "moonpay").
604
- * @param callbackUrl - The full callback URL the provider redirected to.
605
- * @param wallet - The wallet address associated with the order.
606
- * @returns The unified order data.
607
- */
608
- getOrderFromCallback(providerCode: string, callbackUrl: string, wallet: string): Promise<RampsOrder>;
609
- /**
610
- * Sets the Transak API key used for all Transak API requests.
611
- *
612
- * @param apiKey - The Transak API key.
613
- */
614
- transakSetApiKey(apiKey: string): void;
615
- /**
616
- * Sets the Transak access token and marks the user as authenticated.
617
- *
618
- * @param token - The access token received from Transak auth.
619
- */
620
- transakSetAccessToken(token: TransakAccessToken): void;
621
- /**
622
- * Clears the Transak access token and marks the user as unauthenticated.
623
- */
624
- transakClearAccessToken(): void;
625
- /**
626
- * Updates the Transak authentication flag in controller state.
627
- *
628
- * @param isAuthenticated - Whether the user is authenticated with Transak.
629
- */
630
- transakSetAuthenticated(isAuthenticated: boolean): void;
631
- /**
632
- * Resets all Transak state back to defaults (unauthenticated, no data).
633
- */
634
- transakResetState(): void;
635
- /**
636
- * Sends a one-time password to the user's email for Transak authentication.
637
- *
638
- * @param email - The user's email address.
639
- * @returns The OTP response containing a state token for verification.
640
- */
641
- transakSendUserOtp(email: string): Promise<{
642
- isTncAccepted: boolean;
643
- stateToken: string;
644
- email: string;
645
- expiresIn: number;
646
- }>;
647
- /**
648
- * Verifies a one-time password and authenticates the user with Transak.
649
- * Updates the controller's authentication state on success.
650
- *
651
- * @param email - The user's email address.
652
- * @param verificationCode - The OTP code entered by the user.
653
- * @param stateToken - The state token from the sendUserOtp response.
654
- * @returns The access token for subsequent authenticated requests.
655
- */
656
- transakVerifyUserOtp(email: string, verificationCode: string, stateToken: string): Promise<TransakAccessToken>;
657
- /**
658
- * Logs the user out of Transak. Clears authentication state and user details
659
- * regardless of whether the API call succeeds or fails.
660
- *
661
- * @returns A message indicating the logout result.
662
- */
663
- transakLogout(): Promise<string>;
664
- /**
665
- * Fetches the authenticated user's details from Transak.
666
- * Updates the userDetails resource state with loading/success/error states.
667
- *
668
- * @returns The user's profile and KYC details.
669
- */
670
- transakGetUserDetails(): Promise<TransakUserDetails>;
671
- /**
672
- * Fetches a buy quote from Transak for the given parameters.
673
- * Updates the buyQuote resource state with loading/success/error states.
674
- *
675
- * @param fiatCurrency - The fiat currency code (e.g., "USD").
676
- * @param cryptoCurrency - The cryptocurrency identifier.
677
- * @param network - The blockchain network identifier.
678
- * @param paymentMethod - The payment method identifier.
679
- * @param fiatAmount - The fiat amount as a string.
680
- * @returns The buy quote with pricing and fee details.
681
- */
682
- transakGetBuyQuote(fiatCurrency: string, cryptoCurrency: string, network: string, paymentMethod: string, fiatAmount: string): Promise<TransakBuyQuote>;
683
- /**
684
- * Fetches the KYC requirement for a given quote.
685
- * Updates the kycRequirement resource state with loading/success/error states.
686
- *
687
- * @param quoteId - The quote ID to check KYC requirements for.
688
- * @returns The KYC requirement status and whether the user can place an order.
689
- */
690
- transakGetKycRequirement(quoteId: string): Promise<TransakKycRequirement>;
691
- /**
692
- * Fetches additional KYC requirements (e.g., ID proof, address proof) for a quote.
693
- *
694
- * @param quoteId - The quote ID to check additional requirements for.
695
- * @returns The list of additional forms required.
696
- */
697
- transakGetAdditionalRequirements(quoteId: string): Promise<TransakAdditionalRequirementsResponse>;
698
- /**
699
- * Creates a new order on Transak. If an existing order conflicts (HTTP 409),
700
- * active orders are cancelled and the creation is retried.
701
- *
702
- * @param quoteId - The quote ID to create an order from.
703
- * @param walletAddress - The destination wallet address.
704
- * @param paymentMethodId - The payment method to use.
705
- * @returns The created deposit order.
706
- */
707
- transakCreateOrder(quoteId: string, walletAddress: string, paymentMethodId: string): Promise<TransakDepositOrder>;
708
- /**
709
- * Fetches an existing order from Transak by order ID.
710
- *
711
- * @param orderId - The order ID (deposit format or raw Transak format).
712
- * @param wallet - The wallet address associated with the order.
713
- * @param paymentDetails - Optional payment details to attach to the order.
714
- * @returns The deposit order details.
715
- */
716
- transakGetOrder(orderId: string, wallet: string, paymentDetails?: TransakOrderPaymentMethod[]): Promise<TransakDepositOrder>;
717
- /**
718
- * Fetches the user's spending limits for a given currency and payment method.
719
- *
720
- * @param fiatCurrency - The fiat currency code.
721
- * @param paymentMethod - The payment method identifier.
722
- * @param kycType - The KYC level type.
723
- * @returns The user's limits, spending, and remaining amounts.
724
- */
725
- transakGetUserLimits(fiatCurrency: string, paymentMethod: string, kycType: string): Promise<TransakUserLimits>;
726
- /**
727
- * Requests a one-time token (OTT) for the Transak payment widget.
728
- *
729
- * @returns The OTT response containing the token.
730
- */
731
- transakRequestOtt(): Promise<TransakOttResponse>;
732
- /**
733
- * Generates a URL for the Transak payment widget with pre-filled parameters.
734
- *
735
- * @param ottToken - The one-time token for widget authentication.
736
- * @param quote - The buy quote to pre-fill in the widget.
737
- * @param walletAddress - The destination wallet address.
738
- * @param extraParams - Optional additional URL parameters.
739
- * @returns The fully constructed widget URL string.
740
- */
741
- transakGeneratePaymentWidgetUrl(ottToken: string, quote: TransakBuyQuote, walletAddress: string, extraParams?: Record<string, string>): string;
742
- /**
743
- * Creates a Transak payment widget URL via the ramps API proxy, which
744
- * injects the partner API key server-side. Replaces the OTT flow
745
- * ({@link transakRequestOtt} + {@link transakGeneratePaymentWidgetUrl}).
746
- *
747
- * @param quote - The buy quote to pre-fill in the widget.
748
- * @param walletAddress - The destination wallet address.
749
- * @param extraParams - Optional additional widget parameters (e.g. theming).
750
- * @returns The single-use widget URL.
751
- */
752
- transakCreateWidgetUrl(quote: TransakBuyQuote, walletAddress: string, extraParams?: Record<string, string>): Promise<string>;
753
- /**
754
- * Submits the user's purpose of usage form for KYC compliance.
755
- *
756
- * @param purpose - Array of purpose strings selected by the user.
757
- * @returns A promise that resolves when the form is submitted.
758
- */
759
- transakSubmitPurposeOfUsageForm(purpose: string[]): Promise<void>;
760
- /**
761
- * Updates the user's personal or address details on Transak.
762
- *
763
- * @param data - The user data fields to update.
764
- * @returns The API response data.
765
- */
766
- transakPatchUser(data: PatchUserRequestBody): Promise<unknown>;
767
- /**
768
- * Submits the user's SSN for identity verification.
769
- *
770
- * @param ssn - The Social Security Number.
771
- * @param quoteId - The quote ID associated with the order requiring SSN.
772
- * @returns The API response data.
773
- */
774
- transakSubmitSsnDetails(ssn: string, quoteId: string): Promise<unknown>;
775
- /**
776
- * Confirms payment for an order after the user has completed payment.
777
- *
778
- * @param orderId - The order ID to confirm payment for.
779
- * @param paymentMethodId - The payment method used.
780
- * @returns Whether the payment confirmation was successful.
781
- */
782
- transakConfirmPayment(orderId: string, paymentMethodId: string): Promise<{
783
- success: boolean;
784
- }>;
785
- /**
786
- * Translates generic ramps identifiers to Transak-specific identifiers.
787
- *
788
- * @param request - The translation request with optional identifiers to translate.
789
- * @returns The translated Transak-specific identifiers.
790
- */
791
- transakGetTranslation(request: TransakTranslationRequest): Promise<TransakQuoteTranslation>;
792
- /**
793
- * Checks the status of an ID proof submission for KYC.
794
- *
795
- * @param workFlowRunId - The workflow run ID to check status for.
796
- * @returns The current ID proof status.
797
- */
798
- transakGetIdProofStatus(workFlowRunId: string): Promise<TransakIdProofStatus>;
799
- /**
800
- * Cancels a specific Transak order.
801
- *
802
- * @param depositOrderId - The deposit order ID to cancel.
803
- * @returns A promise that resolves when the order is cancelled.
804
- */
805
- transakCancelOrder(depositOrderId: string): Promise<void>;
806
- /**
807
- * Cancels all active Transak orders. Individual cancellation failures
808
- * are collected and returned rather than thrown.
809
- *
810
- * @returns An array of errors from any failed cancellations (empty if all succeeded).
811
- */
812
- transakCancelAllActiveOrders(): Promise<Error[]>;
813
- /**
814
- * Fetches all active Transak orders for the authenticated user.
815
- *
816
- * @returns The list of active orders.
817
- */
818
- transakGetActiveOrders(): Promise<TransakOrder[]>;
819
- }
820
- export {};
821
- //# sourceMappingURL=RampsController.d.mts.map