@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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet-registration-service.js","sourceRoot":"","sources":["../src/wallet-registration-service.ts"],"names":[],"mappings":"AAmDA,iEAAiE;AACjE,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IACvC,IAAI,CAA8B;IAElC,UAAU,CAAU;IAEpB,IAAI,CAAU;IAEvB,YACE,IAAiC,EACjC,OAIC;QAED,KAAK,CAAC,OAAO,CAAC,OAAO,IAAI,+BAA+B,IAAI,EAAE,CAAC,CAAC;QAChE,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;CACF;AA0CD;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,OAAe;IACvC,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC;AAC/B,CAAC;AAED;;;;;GAKG;AACH,SAAS,eAAe,CAAC,MAAc;IACrC,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,GAAG;YACN,OAAO,YAAY,CAAC;QACtB,KAAK,GAAG;YACN,OAAO,cAAc,CAAC;QACxB,KAAK,GAAG;YACN,OAAO,WAAW,CAAC;QACrB,KAAK,GAAG;YACN,OAAO,UAAU,CAAC;QACpB,KAAK,GAAG;YACN,OAAO,UAAU,CAAC;QACpB,KAAK,GAAG;YACN,OAAO,aAAa,CAAC;QACvB;YACE,OAAO,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC;IACtD,CAAC;AACH,CAAC;AAED;;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AI,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QACrC,MAAM,IAAI,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;QACnC,OAAO,IAAI,uBAAuB,CAAC,IAAI,EAAE;YACvC,UAAU,EAAE,MAAM;YAClB,IAAI;YACJ,OAAO,EAAE,IAAI,IAAI,SAAS;SAC3B,CAAC,CAAC;IACL,CAAC;IAED,eAAe,CAAC,MAA+B;QAC7C,IAAI,OAAO,MAAM,CAAC,EAAE,KAAK,QAAQ,IAAI,MAAM,CAAC,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5D,MAAM,IAAI,uBAAuB,CAAC,mBAAmB,EAAE;gBACrD,OAAO,EAAE,+BAA+B;aACzC,CAAC,CAAC;QACL,CAAC;QACD,IAAI,OAAO,MAAM,CAAC,cAAc,KAAK,QAAQ,EAAE,CAAC;YAC9C,MAAM,IAAI,uBAAuB,CAAC,mBAAmB,EAAE;gBACrD,OAAO,EAAE,2CAA2C;aACrD,CAAC,CAAC;QACL,CAAC;QACD,OAAO;YACL,EAAE,EAAE,MAAM,CAAC,EAAE;YACb,OAAO,EAAE,MAAM,CAAC,cAAc;YAC9B,UAAU,EAAE,OAAO;YACnB,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;YAClC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;SAChC,CAAC;IACJ,CAAC;CACF","sourcesContent":["/** The only blockchain supported by the Money Account POC. */\nexport type Blockchain = 'Monad';\n\n/** Normalized view of a single registered self-hosted address. */\nexport type SelfHostedRegistration = {\n id: string;\n address: string;\n blockchain: Blockchain;\n disabled: boolean;\n isSelf: boolean;\n};\n\n/** Result of reconciling a wallet against the customer's registered addresses. */\nexport type RegistrationStatus =\n | { type: 'active'; registration: SelfHostedRegistration }\n | { type: 'disabled'; registration: SelfHostedRegistration }\n | { type: 'absent' };\n\n/**\n * Discriminated error kinds surfaced to the state machine. Every non-success\n * path maps to exactly one of these so the machine can decide deterministically.\n */\nexport type WalletRegistrationErrorKind =\n | 'validation'\n | 'unauthorized'\n | 'forbidden'\n | 'notFound'\n | 'conflict'\n | 'rateLimited'\n | 'transient'\n | 'lookupUnavailable'\n | 'malformedResponse';\n\n/** Minimal HTTP response shape, so the service is environment-agnostic. */\ntype HttpResponse = {\n ok: boolean;\n status: number;\n json: () => Promise<unknown>;\n text: () => Promise<string>;\n};\n\n/** Minimal `fetch`-like function the service depends on. */\ntype FetchLike = (\n url: string,\n init?: {\n method?: string;\n headers?: Record<string, string>;\n body?: string;\n },\n) => Promise<HttpResponse>;\n\n/** Typed error carrying enough context for state transitions. */\nexport class WalletRegistrationError extends Error {\n readonly kind: WalletRegistrationErrorKind;\n\n readonly httpStatus?: number;\n\n readonly body?: string;\n\n constructor(\n kind: WalletRegistrationErrorKind,\n options: {\n message?: string;\n httpStatus?: number;\n body?: string;\n },\n ) {\n super(options.message ?? `wallet registration failed: ${kind}`);\n this.name = 'WalletRegistrationError';\n this.kind = kind;\n this.httpStatus = options.httpStatus;\n this.body = options.body;\n }\n}\n\nexport type WalletRegistrationServiceOptions = {\n fetch: FetchLike;\n /**\n * Base URL of the Money Movement neobank-proxy host\n * (e.g. `https://on-ramp.dev-api.cx.metamask.io`). Paths are under `/neobank`.\n */\n baseUrl: string;\n getAuthToken: () => Promise<string>;\n /**\n * MetaMask profile / partner external id used as MoonPay `external_id`\n * (typically `AuthenticationController:getSessionProfile().canonicalProfileId`).\n */\n getExternalId: () => Promise<string>;\n};\n\nexport type GetRegistrationStatusRequest = {\n customerId: string;\n address: string;\n blockchain: Blockchain;\n};\n\nexport type RegisterSelfHostedWalletRequest = {\n customerId: string;\n address: string;\n blockchain: Blockchain;\n message: string;\n signature: string;\n /**\n * Stable key reused across retries of the same ownership proof. Generated\n * when omitted.\n */\n idempotencyKey?: string;\n};\n\n/** Successful registration outcome. */\nexport type RegistrationOutcome = {\n type: 'registered';\n registration: SelfHostedRegistration;\n};\n\n/**\n * Normalizes a Monad EVM address for case-insensitive comparison.\n *\n * @param address - Raw address string.\n * @returns The comparison key for the address.\n */\nfunction normalizeAddress(address: string): string {\n return address.toLowerCase();\n}\n\n/**\n * Maps an HTTP status to the typed error kind the state machine reacts to.\n *\n * @param status - HTTP status code from the proxy/Iron response.\n * @returns The corresponding error kind.\n */\nfunction mapStatusToKind(status: number): WalletRegistrationErrorKind {\n switch (status) {\n case 400:\n return 'validation';\n case 401:\n return 'unauthorized';\n case 403:\n return 'forbidden';\n case 404:\n return 'notFound';\n case 409:\n return 'conflict';\n case 429:\n return 'rateLimited';\n default:\n return status >= 500 ? 'transient' : 'validation';\n }\n}\n\n/**\n * Builds a client-side Idempotency-Key for MoonPay POSTs. Prefer a stable\n * caller-supplied key across retries of the same proof.\n *\n * @returns A random UUID when available, otherwise a timestamped fallback.\n */\nexport function createIdempotencyKey(): string {\n const cryptoObj = globalThis.crypto as\n | { randomUUID?: () => string }\n | undefined;\n if (typeof cryptoObj?.randomUUID === 'function') {\n return cryptoObj.randomUUID();\n }\n return `wallet-reg-${Date.now()}-${Math.random().toString(16).slice(2)}`;\n}\n\n/**\n * Extracts a human-readable error body from a transparent neobank-proxy\n * response. Upstream may return a plain string or a JSON value; both are\n * mirrored 1:1 (no `{ code: 'iron_error' }` envelope).\n *\n * @param raw - Raw response text.\n * @returns Normalized body string for {@link WalletRegistrationError}.\n */\nexport function extractErrorBody(raw: string): string {\n const trimmed = raw.trim();\n if (!trimmed) {\n return raw;\n }\n try {\n const parsed: unknown = JSON.parse(trimmed);\n if (typeof parsed === 'string') {\n return parsed;\n }\n if (parsed && typeof parsed === 'object') {\n const { message } = parsed as { message?: unknown };\n if (typeof message === 'string') {\n return message;\n }\n }\n return trimmed;\n } catch {\n return trimmed;\n }\n}\n\n/**\n * Data service that talks to the Money Movement neobank-proxy for MoonPay Iron\n * self-hosted wallet registration. It never calls Iron directly, so the Iron\n * API key never ships in the client.\n */\nexport class WalletRegistrationService {\n readonly #fetch: FetchLike;\n\n readonly #baseUrl: string;\n\n readonly #getAuthToken: () => Promise<string>;\n\n readonly #getExternalId: () => Promise<string>;\n\n constructor(options: WalletRegistrationServiceOptions) {\n this.#fetch = options.fetch;\n this.#baseUrl = options.baseUrl.replace(/\\/$/u, '');\n this.#getAuthToken = options.getAuthToken;\n this.#getExternalId = options.getExternalId;\n }\n\n /**\n * Resolves Iron's internal customer id via\n * `GET /neobank/customers/{external_id}/external`, using the MetaMask\n * profile/canonical id as `external_id`.\n *\n * @returns Iron's internal customer id.\n */\n async getMoonpayCustomerId(): Promise<string> {\n const [token, externalId] = await Promise.all([\n this.#getAuthToken(),\n this.#getExternalId(),\n ]);\n if (!externalId) {\n throw new WalletRegistrationError('malformedResponse', {\n message: 'MetaMask external id (canonical profile id) is empty',\n });\n }\n\n const response = await this.#fetch(\n `${this.#baseUrl}/neobank/customers/${encodeURIComponent(externalId)}/external`,\n {\n method: 'GET',\n headers: {\n accept: 'application/json',\n authorization: `Bearer ${token}`,\n },\n },\n );\n\n if (!response.ok) {\n throw await this.#toHttpError(response);\n }\n\n let payload: unknown;\n try {\n payload = await response.json();\n } catch {\n throw new WalletRegistrationError('malformedResponse', {\n message: 'MoonPay customer body was not valid JSON',\n });\n }\n\n const { id } = payload as { id?: unknown };\n if (typeof id !== 'string' || id.length === 0) {\n throw new WalletRegistrationError('malformedResponse', {\n message: 'MoonPay customer body missing id',\n });\n }\n return id;\n }\n\n /**\n * Reconciles a wallet against the customer's registered self-hosted addresses\n * via `GET /neobank/addresses/crypto/{customer_id}?filter=SelfHosted`.\n * Upstream returns all self-hosted chains; Monad filtering stays client-side\n * for the POC. Transport failures are reported as `lookupUnavailable`;\n * malformed successful responses are reported as `malformedResponse`.\n * Neither is downgraded to `absent`.\n *\n * @param request - Customer id and Monad address to reconcile.\n * @returns The active / disabled / absent status for the address.\n */\n async getRegistrationStatus(\n request: GetRegistrationStatusRequest,\n ): Promise<RegistrationStatus> {\n const { customerId, address, blockchain } = request;\n\n let response: HttpResponse;\n try {\n const token = await this.#getAuthToken();\n const url = new URL(\n `${this.#baseUrl}/neobank/addresses/crypto/${encodeURIComponent(customerId)}`,\n );\n url.searchParams.set('filter', 'SelfHosted');\n response = await this.#fetch(url.toString(), {\n method: 'GET',\n headers: {\n accept: 'application/json',\n authorization: `Bearer ${token}`,\n },\n });\n } catch (error) {\n throw new WalletRegistrationError('lookupUnavailable', {\n message: 'self-hosted address lookup failed',\n body: error instanceof Error ? error.message : undefined,\n });\n }\n\n if (!response.ok) {\n let body: string;\n try {\n body = extractErrorBody(await response.text());\n } catch (error) {\n body = error instanceof Error ? error.message : '';\n }\n throw new WalletRegistrationError('lookupUnavailable', {\n httpStatus: response.status,\n body,\n });\n }\n\n let payload: unknown;\n try {\n payload = await response.json();\n } catch {\n throw new WalletRegistrationError('malformedResponse', {\n message: 'self-hosted address list body was not valid JSON',\n });\n }\n if (!Array.isArray(payload)) {\n throw new WalletRegistrationError('malformedResponse', {\n message: 'expected an array of registered addresses',\n });\n }\n\n const target = normalizeAddress(address);\n const match = payload.find((entry) => {\n const record = entry as Record<string, unknown>;\n const walletAddress = record.wallet_address;\n if (typeof walletAddress !== 'string') {\n return false;\n }\n return (\n normalizeAddress(walletAddress) === target &&\n record.blockchain === blockchain\n );\n }) as Record<string, unknown> | undefined;\n\n if (!match) {\n return { type: 'absent' };\n }\n\n const registration = this.#toRegistration(match);\n return registration.disabled\n ? { type: 'disabled', registration }\n : { type: 'active', registration };\n }\n\n /**\n * Registers a self-hosted wallet through neobank-proxy\n * `POST /neobank/addresses/crypto/selfhosted`. The client supplies\n * `customer_id` and an `Idempotency-Key` (generated when omitted). Every\n * non-2xx response is mapped to a typed error; `409` is deliberately\n * surfaced as an ambiguous `conflict` that the caller must reconcile with a\n * follow-up status lookup.\n *\n * @param request - Customer id, address, blockchain, message, and signature.\n * @returns The registered outcome on success.\n */\n async registerSelfHostedWallet(\n request: RegisterSelfHostedWalletRequest,\n ): Promise<RegistrationOutcome> {\n const idempotencyKey = request.idempotencyKey ?? createIdempotencyKey();\n let response: HttpResponse;\n try {\n const token = await this.#getAuthToken();\n response = await this.#fetch(\n `${this.#baseUrl}/neobank/addresses/crypto/selfhosted`,\n {\n method: 'POST',\n headers: {\n accept: 'application/json',\n 'content-type': 'application/json',\n authorization: `Bearer ${token}`,\n 'Idempotency-Key': idempotencyKey,\n },\n body: JSON.stringify({\n customer_id: request.customerId,\n address: request.address,\n blockchain: request.blockchain,\n message: request.message,\n signature: request.signature,\n }),\n },\n );\n } catch (error) {\n throw new WalletRegistrationError('transient', {\n message: 'self-hosted registration request failed',\n body: error instanceof Error ? error.message : undefined,\n });\n }\n\n if (!response.ok) {\n throw await this.#toHttpError(response);\n }\n\n let payload: unknown;\n try {\n payload = await response.json();\n } catch {\n throw new WalletRegistrationError('malformedResponse', {\n message: 'registration success body was not valid JSON',\n });\n }\n\n const record = payload as Record<string, unknown>;\n if (typeof record.id !== 'string' || typeof record.address !== 'string') {\n throw new WalletRegistrationError('malformedResponse', {\n message: 'registration success body missing id/address',\n });\n }\n\n return {\n type: 'registered',\n registration: {\n id: record.id,\n address: record.address,\n blockchain: request.blockchain,\n disabled: Boolean(record.disabled),\n isSelf: true,\n },\n };\n }\n\n async #toHttpError(response: HttpResponse): Promise<WalletRegistrationError> {\n let raw = '';\n try {\n raw = await response.text();\n } catch {\n return new WalletRegistrationError('malformedResponse', {\n httpStatus: response.status,\n message: 'error body could not be read',\n });\n }\n\n const { status } = response;\n const kind = mapStatusToKind(status);\n const body = extractErrorBody(raw);\n return new WalletRegistrationError(kind, {\n httpStatus: status,\n body,\n message: body || undefined,\n });\n }\n\n #toRegistration(record: Record<string, unknown>): SelfHostedRegistration {\n if (typeof record.id !== 'string' || record.id.length === 0) {\n throw new WalletRegistrationError('malformedResponse', {\n message: 'registered address missing id',\n });\n }\n if (typeof record.wallet_address !== 'string') {\n throw new WalletRegistrationError('malformedResponse', {\n message: 'registered address missing wallet_address',\n });\n }\n return {\n id: record.id,\n address: record.wallet_address,\n blockchain: 'Monad',\n disabled: Boolean(record.disabled),\n isSelf: Boolean(record.is_self),\n };\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/ramps-controller",
3
- "version": "20.2.0",
3
+ "version": "21.0.0",
4
4
  "description": "A controller for managing cryptocurrency on/off ramps functionality",
5
5
  "keywords": [
6
6
  "Ethereum",
@@ -18,19 +18,12 @@
18
18
  "files": [
19
19
  "dist/"
20
20
  ],
21
+ "type": "module",
21
22
  "sideEffects": false,
22
- "main": "./dist/index.cjs",
23
- "types": "./dist/index.d.cts",
24
23
  "exports": {
25
24
  ".": {
26
- "import": {
27
- "types": "./dist/index.d.mts",
28
- "default": "./dist/index.mjs"
29
- },
30
- "require": {
31
- "types": "./dist/index.d.cts",
32
- "default": "./dist/index.cjs"
33
- }
25
+ "types": "./dist/index.d.ts",
26
+ "default": "./dist/index.js"
34
27
  },
35
28
  "./package.json": "./package.json"
36
29
  },
@@ -39,9 +32,11 @@
39
32
  "registry": "https://registry.npmjs.org/"
40
33
  },
41
34
  "scripts": {
42
- "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
43
- "build:all": "ts-bridge --project tsconfig.build.json --verbose --clean",
35
+ "build": "tsc --project tsconfig.build.json",
36
+ "build:all": "tsc --build tsconfig.build.json --verbose",
37
+ "build:clean": "yarn build:only-clean && yarn build",
44
38
  "build:docs": "typedoc",
39
+ "build:only-clean": "rimraf './dist' './tsconfig.build.tsbuildinfo'",
45
40
  "changelog:update": "../../scripts/update-changelog.sh @metamask/ramps-controller",
46
41
  "changelog:validate": "../../scripts/validate-changelog.sh @metamask/ramps-controller",
47
42
  "dev": "node dev-watch.js",
@@ -56,26 +51,27 @@
56
51
  "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
57
52
  },
58
53
  "dependencies": {
59
- "@metamask/base-controller": "^9.1.0",
60
- "@metamask/controller-utils": "^12.3.0",
61
- "@metamask/messenger": "^2.0.0",
62
- "@metamask/profile-sync-controller": "^29.0.0",
63
- "@metamask/remote-feature-flag-controller": "^6.1.0"
54
+ "@metamask/base-controller": "^10.0.0",
55
+ "@metamask/controller-utils": "^13.0.0",
56
+ "@metamask/messenger": "^3.0.0",
57
+ "@metamask/profile-sync-controller": "^31.0.0",
58
+ "@metamask/remote-feature-flag-controller": "^7.0.0"
64
59
  },
65
60
  "devDependencies": {
66
61
  "@metamask/auto-changelog": "^6.1.0",
67
- "@ts-bridge/cli": "^0.6.4",
68
62
  "@types/jest": "^30.0.0",
63
+ "@typescript/native": "npm:typescript@^7.0.2",
69
64
  "deepmerge": "^4.2.2",
70
65
  "jest": "^30.4.2",
71
66
  "nock": "^13.3.1",
67
+ "rimraf": "^5.0.5",
72
68
  "ts-jest": "^29.4.11",
73
69
  "tsx": "^4.20.5",
74
70
  "typedoc": "^0.25.13",
75
71
  "typedoc-plugin-missing-exports": "^2.0.0",
76
- "typescript": "~5.3.3"
72
+ "typescript": "npm:@typescript/typescript6@^6.0.2"
77
73
  },
78
74
  "engines": {
79
- "node": "^18.18 || >=20"
75
+ "node": "^22.14.0 || ^24"
80
76
  }
81
77
  }
@@ -1,7 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file is auto generated.
4
- * Do not edit manually.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- //# sourceMappingURL=RampsController-method-action-types.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RampsController-method-action-types.cjs","sourceRoot":"","sources":["../src/RampsController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { RampsController } from './RampsController.js';\n\n/**\n * Executes a request with caching, deduplication, and at most one in-flight\n * request per resource type.\n *\n * 1. **Same cache key in flight** – If a request with this cache key is\n * already pending, returns that promise (deduplication; no second request).\n *\n * 2. **Cache hit** – If valid, non-expired data exists in state.requests for\n * this key and forceRefresh is not set, returns that data without fetching.\n *\n * 3. **New request** – Creates an AbortController and fires the fetcher.\n * If options.resourceType is set, tags the pending request with that\n * resource type (so #abortDependentRequests can cancel it on region\n * change or cleanup) and ref-counts resource-level loading state.\n * On success or error, updates request state and resource error;\n * in finally, clears resource loading only if this request was not\n * aborted.\n *\n * @param cacheKey - Unique identifier for this request (e.g. from createCacheKey).\n * @param fetcher - Async function that performs the fetch. Receives an AbortSignal\n * that is aborted when this request is superseded by another for the same resource.\n * @param options - Optional forceRefresh, ttl, and resourceType for loading/error state.\n * @returns The result of the request (from cache, joined promise, or fetcher).\n */\nexport type RampsControllerExecuteRequestAction = {\n type: `RampsController:executeRequest`;\n handler: RampsController['executeRequest'];\n};\n\n/**\n * Aborts a pending request if one exists.\n *\n * @param cacheKey - The cache key of the request to abort.\n * @returns True if a request was aborted.\n */\nexport type RampsControllerAbortRequestAction = {\n type: `RampsController:abortRequest`;\n handler: RampsController['abortRequest'];\n};\n\n/**\n * Gets the state of a specific cached request.\n *\n * @param cacheKey - The cache key to look up.\n * @returns The request state, or undefined if not cached.\n */\nexport type RampsControllerGetRequestStateAction = {\n type: `RampsController:getRequestState`;\n handler: RampsController['getRequestState'];\n};\n\n/**\n * Sets the user's region manually (without fetching geolocation).\n * This allows users to override the detected region.\n *\n * @param region - The region code to set (e.g., \"US-CA\").\n * @param options - Options for cache behavior.\n * @returns The user region object.\n */\nexport type RampsControllerSetUserRegionAction = {\n type: `RampsController:setUserRegion`;\n handler: RampsController['setUserRegion'];\n};\n\n/**\n * Sets the user's selected provider.\n *\n * Accepts either a Provider object (stored directly) or a provider ID\n * string (looked up from state). The object form is preferred when the\n * caller already has the full data (e.g. from React Query cache).\n *\n * @param providerOrId - A Provider object, a provider ID string (e.g., \"/providers/moonpay\"), or null to clear.\n * @param options - Optional settings for the selection.\n * @param options.autoSelected - When true, marks the provider as system-guessed\n * (soft selection). The UI will silently auto-switch on token conflict instead\n * of showing the \"Token Not Available\" modal. Defaults to false.\n */\nexport type RampsControllerSetSelectedProviderAction = {\n type: `RampsController:setSelectedProvider`;\n handler: RampsController['setSelectedProvider'];\n};\n\n/**\n * Switches to the first provider in state that serves the given asset,\n * when the currently selected provider does not.\n *\n * This is the controller-level equivalent of UB2's BuildQuote tier-1\n * silent-switch effect and MMPay's `useEnsureCompatibleProvider` hook: it\n * keeps provider-asset compatibility logic in one place rather than\n * duplicating `providerServesAsset` + find-and-switch across multiple UI\n * layers.\n *\n * The compatibility check prefers the current provider's entry in\n * `providers.data` over the `providers.selected` copy, which can be stale\n * once a fresh providers list arrives.\n *\n * No-op when:\n * - `providers.data` is empty (providers not yet loaded)\n * - the currently selected provider already serves the asset\n * - no provider in the list serves the asset (no safe fallback)\n *\n * @param assetId - CAIP-19 asset id of the deposit asset.\n * @param options - Optional settings forwarded to `setSelectedProvider`.\n * @param options.autoSelected - When true, marks the new selection as\n * system-guessed (soft selection). Defaults to true.\n * @returns `true` if the selected provider was changed, `false` otherwise.\n */\nexport type RampsControllerSetSelectedProviderForAssetAction = {\n type: `RampsController:setSelectedProviderForAsset`;\n handler: RampsController['setSelectedProviderForAsset'];\n};\n\n/**\n * Initializes the controller by fetching the user's region from geolocation.\n * This should be called once at app startup to set up the initial region.\n *\n * Idempotent: subsequent calls return the same promise unless forceRefresh is set.\n * Force-refetches the countries catalog on startup (bypassing the in-session\n * request cache) so region preset amounts stay current. The catalog is not\n * persisted, so a cold start always re-fetches it regardless. Skips\n * geolocation when userRegion already exists.\n *\n * @param options - Options for cache behavior. forceRefresh bypasses idempotency and re-runs the full flow.\n * @returns Promise that resolves when initialization is complete.\n */\nexport type RampsControllerInitAction = {\n type: `RampsController:init`;\n handler: RampsController['init'];\n};\n\n/**\n * Fetches the list of supported countries.\n * The API returns countries with support information for both buy and sell actions.\n * The countries are saved in the controller state once fetched.\n *\n * @param options - Options for cache behavior.\n * @returns An array of countries.\n */\nexport type RampsControllerGetCountriesAction = {\n type: `RampsController:getCountries`;\n handler: RampsController['getCountries'];\n};\n\n/**\n * Fetches the list of available tokens for a given region and action.\n * The tokens are saved in the controller state once fetched.\n *\n * @param region - The region code (e.g., \"us\", \"fr\", \"us-ny\"). If not provided, uses the user's region from controller state.\n * @param action - The ramp action type ('buy' or 'sell').\n * @param options - Options for cache behavior and query filters.\n * @param options.provider - Provider ID(s) to filter by.\n * @returns The tokens response containing topTokens and allTokens.\n */\nexport type RampsControllerGetTokensAction = {\n type: `RampsController:getTokens`;\n handler: RampsController['getTokens'];\n};\n\n/**\n * Sets the user's selected token by asset ID.\n * Looks up the token from the current tokens in state and automatically\n * fetches payment methods for that token.\n *\n * @param assetId - The asset identifier in CAIP-19 format (e.g., \"eip155:1/erc20:0x...\"), or undefined to clear.\n * @throws If region is not set, tokens are not loaded, or token is not found.\n */\nexport type RampsControllerSetSelectedTokenAction = {\n type: `RampsController:setSelectedToken`;\n handler: RampsController['setSelectedToken'];\n};\n\n/**\n * Fetches the list of providers for a given region.\n * The providers are saved in the controller state once fetched.\n *\n * @param region - The region code (e.g., \"us\", \"fr\", \"us-ny\"). If not provided, uses the user's region from controller state.\n * @param options - Options for cache behavior and query filters.\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 */\nexport type RampsControllerGetProvidersAction = {\n type: `RampsController:getProviders`;\n handler: RampsController['getProviders'];\n};\n\n/**\n * Fetches the list of payment methods for a given context.\n * The payment methods are saved in the controller state once fetched.\n *\n * @param region - User's region code (e.g. \"fr\", \"us-ny\").\n * @param options - Query parameters for filtering payment methods.\n * @param options.assetId - CAIP-19 cryptocurrency identifier.\n * @param options.provider - Provider ID path.\n * @returns The payment methods response containing payments array.\n */\nexport type RampsControllerGetPaymentMethodsAction = {\n type: `RampsController:getPaymentMethods`;\n handler: RampsController['getPaymentMethods'];\n};\n\n/**\n * Fetches payment methods for a quoting context without coupling callers to\n * the Buy flow's globally selected provider/token catalog.\n *\n * Provider contribution mirrors {@link getQuotes}:\n * - explicit `providers` (optionally filtered when\n * `restrictToKnownOrNativeProviders` is set)\n * - auto-select / restrict path, including `moneyHeadlessAllProviders`\n * widening: flag off uses the restricted/native resolver; flag on uses\n * supporting providers, intersected with the flag allowlist when that\n * allowlist is non-empty (pick-survivor set for picker methods)\n * - when those resolution flags and `providers` are omitted, uses only\n * `providers.selected` (UB2 selected-provider context)\n *\n * By default this is request-only: it does **not** mutate\n * `paymentMethods.data` or `paymentMethods.selected`. Pass `updateState:\n * true` only when the caller explicitly wants Buy-catalog write semantics\n * (UB2). Headless / MM Pay selection stays TPC-owned. `updateState: true`\n * throws when the resolved provider set holds more than one provider, because\n * the write guards cannot tell two such requests apart.\n *\n * Methods are request-eligible for the resolved provider set; they are not\n * guaranteed to produce a quote for every amount (provider fiat limits still\n * apply at quote time).\n *\n * @param options - Context for the payment-method fetch.\n * @param options.region - Region code. Defaults to `userRegion`.\n * @param options.assetId - Required CAIP-19 quoting asset.\n * @param options.providers - Explicit provider ids.\n * @param options.autoSelectProvider - Resolve providers like `getQuotes`.\n * @param options.preferredProviderIds - Preferred ids for auto-selection.\n * @param options.restrictToKnownOrNativeProviders - Headless gating.\n * @param options.updateState - When true, write `paymentMethods` state.\n * @param options.preferPaymentMethodId - Preserve this id when still present.\n * @param options.forceRefresh - Bypass request cache for provider fetches.\n * @param options.ttl - Custom TTL for provider payment-method fetches.\n * @returns Deduped methods, a request-only suggested selection, and the\n * provider ids that contributed.\n */\nexport type RampsControllerGetPaymentMethodsForContextAction = {\n type: `RampsController:getPaymentMethodsForContext`;\n handler: RampsController['getPaymentMethodsForContext'];\n};\n\n/**\n * Sets the user's selected payment method.\n *\n * Accepts either a payment method ID (looked up from state) or a full\n * PaymentMethod object (stored directly). The object form is preferred\n * when the caller already has the full data (e.g. from React Query cache),\n * as it avoids depending on controller state being populated.\n *\n * @param paymentMethodOrId - A PaymentMethod object, a payment method ID string, or undefined/null to clear.\n */\nexport type RampsControllerSetSelectedPaymentMethodAction = {\n type: `RampsController:setSelectedPaymentMethod`;\n handler: RampsController['setSelectedPaymentMethod'];\n};\n\n/**\n * Fetches quotes from all providers for a given set of parameters.\n * Uses the controller's request cache; callers manage the response in local state.\n *\n * @param options - The parameters for fetching quotes.\n * @param options.region - User's region code. If not provided, uses userRegion from state.\n * @param options.fiat - Fiat currency code. If not provided, uses userRegion currency.\n * @param options.assetId - CAIP-19 cryptocurrency identifier.\n * @param options.amount - The amount (in fiat for buy, crypto for sell).\n * @param options.walletAddress - The destination wallet address.\n * @param options.paymentMethods - Array of payment method IDs. If not provided, uses paymentMethods from state.\n * @param options.providers - Optional provider IDs to filter quotes.\n * @param options.autoSelectProvider - When true and `providers` is omitted,\n * resolves a provider that supports `assetId` for this request only (no\n * state mutation). Ignored when `providers` is passed.\n * @param options.preferredProviderIds - Optional provider IDs to prefer\n * during auto-selection, in priority order (e.g. derived by the caller\n * from completed-order history). Only used when `autoSelectProvider` is\n * true and `providers` is omitted.\n * @param options.restrictToKnownOrNativeProviders - Headless-buy v0 gating. When\n * true, auto-selection resolves only a native provider, and an explicitly\n * passed `providers` list is filtered to those supporting the region and\n * asset. If nothing qualifies, `getQuotes` returns an empty response\n * instead of quoting other providers.\n * @param options.redirectUrl - Optional redirect URL after order completion.\n * @param options.action - The ramp action type. Defaults to 'buy'.\n * @param options.forceRefresh - Whether to bypass cache.\n * @param options.ttl - Custom TTL for this request.\n * @returns The quotes response containing success, sorted, error, and customActions.\n */\nexport type RampsControllerGetQuotesAction = {\n type: `RampsController:getQuotes`;\n handler: RampsController['getQuotes'];\n};\n\n/**\n * Adds or updates a V2 order in controller state.\n * If an order with the same internal order code already exists, the incoming\n * fields are merged on top of the existing order so that fields not present\n * in the update (e.g. paymentDetails from the Transak API) are preserved.\n *\n * @param order - The RampsOrder to add or update.\n */\nexport type RampsControllerAddOrderAction = {\n type: `RampsController:addOrder`;\n handler: RampsController['addOrder'];\n};\n\n/**\n * Removes a V2 order from controller state by providerOrderId.\n *\n * @param providerOrderId - The provider order ID to remove.\n */\nexport type RampsControllerRemoveOrderAction = {\n type: `RampsController:removeOrder`;\n handler: RampsController['removeOrder'];\n};\n\n/**\n * Starts polling all pending V2 orders at a fixed interval.\n * Each poll cycle iterates orders with non-terminal statuses,\n * respects pollingSecondsMinimum and backoff from error count.\n */\nexport type RampsControllerStartOrderPollingAction = {\n type: `RampsController:startOrderPolling`;\n handler: RampsController['startOrderPolling'];\n};\n\n/**\n * Stops order polling and clears the interval.\n */\nexport type RampsControllerStopOrderPollingAction = {\n type: `RampsController:stopOrderPolling`;\n handler: RampsController['stopOrderPolling'];\n};\n\n/**\n * Fetches the widget data from a quote for redirect providers.\n * Makes a request to the buyURL endpoint via the RampsService to get the\n * actual provider widget URL and optional order ID for polling.\n *\n * @param quote - The quote to fetch the widget URL from.\n * @returns Promise resolving to the full BuyWidget (url, browser, orderId), or null if not available (missing buyURL or empty url in response).\n * @throws Rethrows errors from the RampsService (e.g. HttpError, network failures) so clients can react to fetch failures.\n */\nexport type RampsControllerGetBuyWidgetDataAction = {\n type: `RampsController:getBuyWidgetData`;\n handler: RampsController['getBuyWidgetData'];\n};\n\n/**\n * Registers an order ID for polling until the order is created or resolved.\n * Adds a minimal stub order to controller state; the existing order polling\n * will fetch the full order when the provider has created it.\n *\n * @param params - Object containing order identifiers and wallet info.\n * @param params.orderId - Full order ID (e.g. \"/providers/paypal/orders/abc123\") or order code.\n * @param params.providerCode - Canonical provider code (e.g. \"paypal\", \"transak\").\n * @param params.walletAddress - Wallet address for the order.\n * @param params.chainId - Chain ID for the order (decimal, hex, or CAIP-2). Must be non-empty.\n */\nexport type RampsControllerAddPrecreatedOrderAction = {\n type: `RampsController:addPrecreatedOrder`;\n handler: RampsController['addPrecreatedOrder'];\n};\n\n/**\n * Fetches an order from the unified V2 API endpoint.\n * Returns a normalized RampsOrder for all provider types (aggregator and native).\n *\n * @param providerCode - The provider code (e.g., \"transak\", \"transak-native\", \"moonpay\").\n * @param orderCode - The order identifier.\n * @param wallet - The wallet address associated with the order.\n * @returns The unified order data.\n */\nexport type RampsControllerGetOrderAction = {\n type: `RampsController:getOrder`;\n handler: RampsController['getOrder'];\n};\n\n/**\n * Extracts an order from a provider callback URL.\n * Sends the callback URL to the V2 backend for provider-specific parsing,\n * then fetches the full order. This is the V2 equivalent of the aggregator\n * SDK's `getOrderFromCallback`.\n *\n * @param providerCode - The provider code (e.g., \"transak\", \"moonpay\").\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 */\nexport type RampsControllerGetOrderFromCallbackAction = {\n type: `RampsController:getOrderFromCallback`;\n handler: RampsController['getOrderFromCallback'];\n};\n\n/**\n * Sets the Transak API key used for all Transak API requests.\n *\n * @param apiKey - The Transak API key.\n */\nexport type RampsControllerTransakSetApiKeyAction = {\n type: `RampsController:transakSetApiKey`;\n handler: RampsController['transakSetApiKey'];\n};\n\n/**\n * Sets the Transak access token and marks the user as authenticated.\n *\n * @param token - The access token received from Transak auth.\n */\nexport type RampsControllerTransakSetAccessTokenAction = {\n type: `RampsController:transakSetAccessToken`;\n handler: RampsController['transakSetAccessToken'];\n};\n\n/**\n * Clears the Transak access token and marks the user as unauthenticated.\n */\nexport type RampsControllerTransakClearAccessTokenAction = {\n type: `RampsController:transakClearAccessToken`;\n handler: RampsController['transakClearAccessToken'];\n};\n\n/**\n * Updates the Transak authentication flag in controller state.\n *\n * @param isAuthenticated - Whether the user is authenticated with Transak.\n */\nexport type RampsControllerTransakSetAuthenticatedAction = {\n type: `RampsController:transakSetAuthenticated`;\n handler: RampsController['transakSetAuthenticated'];\n};\n\n/**\n * Resets all Transak state back to defaults (unauthenticated, no data).\n */\nexport type RampsControllerTransakResetStateAction = {\n type: `RampsController:transakResetState`;\n handler: RampsController['transakResetState'];\n};\n\n/**\n * Sends a one-time password to the user's email for Transak authentication.\n *\n * @param email - The user's email address.\n * @returns The OTP response containing a state token for verification.\n */\nexport type RampsControllerTransakSendUserOtpAction = {\n type: `RampsController:transakSendUserOtp`;\n handler: RampsController['transakSendUserOtp'];\n};\n\n/**\n * Verifies a one-time password and authenticates the user with Transak.\n * Updates the controller's authentication state on success.\n *\n * @param email - The user's email address.\n * @param verificationCode - The OTP code entered by the user.\n * @param stateToken - The state token from the sendUserOtp response.\n * @returns The access token for subsequent authenticated requests.\n */\nexport type RampsControllerTransakVerifyUserOtpAction = {\n type: `RampsController:transakVerifyUserOtp`;\n handler: RampsController['transakVerifyUserOtp'];\n};\n\n/**\n * Logs the user out of Transak. Clears authentication state and user details\n * regardless of whether the API call succeeds or fails.\n *\n * @returns A message indicating the logout result.\n */\nexport type RampsControllerTransakLogoutAction = {\n type: `RampsController:transakLogout`;\n handler: RampsController['transakLogout'];\n};\n\n/**\n * Fetches the authenticated user's details from Transak.\n * Updates the userDetails resource state with loading/success/error states.\n *\n * @returns The user's profile and KYC details.\n */\nexport type RampsControllerTransakGetUserDetailsAction = {\n type: `RampsController:transakGetUserDetails`;\n handler: RampsController['transakGetUserDetails'];\n};\n\n/**\n * Fetches a buy quote from Transak for the given parameters.\n * Updates the buyQuote resource state with loading/success/error states.\n *\n * @param fiatCurrency - The fiat currency code (e.g., \"USD\").\n * @param cryptoCurrency - The cryptocurrency identifier.\n * @param network - The blockchain network identifier.\n * @param paymentMethod - The payment method identifier.\n * @param fiatAmount - The fiat amount as a string.\n * @returns The buy quote with pricing and fee details.\n */\nexport type RampsControllerTransakGetBuyQuoteAction = {\n type: `RampsController:transakGetBuyQuote`;\n handler: RampsController['transakGetBuyQuote'];\n};\n\n/**\n * Fetches the KYC requirement for a given quote.\n * Updates the kycRequirement resource state with loading/success/error states.\n *\n * @param quoteId - The quote ID to check KYC requirements for.\n * @returns The KYC requirement status and whether the user can place an order.\n */\nexport type RampsControllerTransakGetKycRequirementAction = {\n type: `RampsController:transakGetKycRequirement`;\n handler: RampsController['transakGetKycRequirement'];\n};\n\n/**\n * Fetches additional KYC requirements (e.g., ID proof, address proof) for a quote.\n *\n * @param quoteId - The quote ID to check additional requirements for.\n * @returns The list of additional forms required.\n */\nexport type RampsControllerTransakGetAdditionalRequirementsAction = {\n type: `RampsController:transakGetAdditionalRequirements`;\n handler: RampsController['transakGetAdditionalRequirements'];\n};\n\n/**\n * Creates a new order on Transak. If an existing order conflicts (HTTP 409),\n * active orders are cancelled and the creation is retried.\n *\n * @param quoteId - The quote ID to create an order from.\n * @param walletAddress - The destination wallet address.\n * @param paymentMethodId - The payment method to use.\n * @returns The created deposit order.\n */\nexport type RampsControllerTransakCreateOrderAction = {\n type: `RampsController:transakCreateOrder`;\n handler: RampsController['transakCreateOrder'];\n};\n\n/**\n * Fetches an existing order from Transak by order ID.\n *\n * @param orderId - The order ID (deposit format or raw Transak format).\n * @param wallet - The wallet address associated with the order.\n * @param paymentDetails - Optional payment details to attach to the order.\n * @returns The deposit order details.\n */\nexport type RampsControllerTransakGetOrderAction = {\n type: `RampsController:transakGetOrder`;\n handler: RampsController['transakGetOrder'];\n};\n\n/**\n * Fetches the user's spending limits for a given currency and payment method.\n *\n * @param fiatCurrency - The fiat currency code.\n * @param paymentMethod - The payment method identifier.\n * @param kycType - The KYC level type.\n * @returns The user's limits, spending, and remaining amounts.\n */\nexport type RampsControllerTransakGetUserLimitsAction = {\n type: `RampsController:transakGetUserLimits`;\n handler: RampsController['transakGetUserLimits'];\n};\n\n/**\n * Requests a one-time token (OTT) for the Transak payment widget.\n *\n * @returns The OTT response containing the token.\n */\nexport type RampsControllerTransakRequestOttAction = {\n type: `RampsController:transakRequestOtt`;\n handler: RampsController['transakRequestOtt'];\n};\n\n/**\n * Generates a URL for the Transak payment widget with pre-filled parameters.\n *\n * @param ottToken - The one-time token for widget authentication.\n * @param quote - The buy quote to pre-fill in the widget.\n * @param walletAddress - The destination wallet address.\n * @param extraParams - Optional additional URL parameters.\n * @returns The fully constructed widget URL string.\n */\nexport type RampsControllerTransakGeneratePaymentWidgetUrlAction = {\n type: `RampsController:transakGeneratePaymentWidgetUrl`;\n handler: RampsController['transakGeneratePaymentWidgetUrl'];\n};\n\n/**\n * Creates a Transak payment widget URL via the ramps API proxy, which\n * injects the partner API key server-side. Replaces the OTT flow\n * ({@link transakRequestOtt} + {@link transakGeneratePaymentWidgetUrl}).\n *\n * @param quote - The buy quote to pre-fill in the widget.\n * @param walletAddress - The destination wallet address.\n * @param extraParams - Optional additional widget parameters (e.g. theming).\n * @returns The single-use widget URL.\n */\nexport type RampsControllerTransakCreateWidgetUrlAction = {\n type: `RampsController:transakCreateWidgetUrl`;\n handler: RampsController['transakCreateWidgetUrl'];\n};\n\n/**\n * Submits the user's purpose of usage form for KYC compliance.\n *\n * @param purpose - Array of purpose strings selected by the user.\n * @returns A promise that resolves when the form is submitted.\n */\nexport type RampsControllerTransakSubmitPurposeOfUsageFormAction = {\n type: `RampsController:transakSubmitPurposeOfUsageForm`;\n handler: RampsController['transakSubmitPurposeOfUsageForm'];\n};\n\n/**\n * Updates the user's personal or address details on Transak.\n *\n * @param data - The user data fields to update.\n * @returns The API response data.\n */\nexport type RampsControllerTransakPatchUserAction = {\n type: `RampsController:transakPatchUser`;\n handler: RampsController['transakPatchUser'];\n};\n\n/**\n * Submits the user's SSN for identity verification.\n *\n * @param ssn - The Social Security Number.\n * @param quoteId - The quote ID associated with the order requiring SSN.\n * @returns The API response data.\n */\nexport type RampsControllerTransakSubmitSsnDetailsAction = {\n type: `RampsController:transakSubmitSsnDetails`;\n handler: RampsController['transakSubmitSsnDetails'];\n};\n\n/**\n * Confirms payment for an order after the user has completed payment.\n *\n * @param orderId - The order ID to confirm payment for.\n * @param paymentMethodId - The payment method used.\n * @returns Whether the payment confirmation was successful.\n */\nexport type RampsControllerTransakConfirmPaymentAction = {\n type: `RampsController:transakConfirmPayment`;\n handler: RampsController['transakConfirmPayment'];\n};\n\n/**\n * Translates generic ramps identifiers to Transak-specific identifiers.\n *\n * @param request - The translation request with optional identifiers to translate.\n * @returns The translated Transak-specific identifiers.\n */\nexport type RampsControllerTransakGetTranslationAction = {\n type: `RampsController:transakGetTranslation`;\n handler: RampsController['transakGetTranslation'];\n};\n\n/**\n * Checks the status of an ID proof submission for KYC.\n *\n * @param workFlowRunId - The workflow run ID to check status for.\n * @returns The current ID proof status.\n */\nexport type RampsControllerTransakGetIdProofStatusAction = {\n type: `RampsController:transakGetIdProofStatus`;\n handler: RampsController['transakGetIdProofStatus'];\n};\n\n/**\n * Cancels a specific Transak order.\n *\n * @param depositOrderId - The deposit order ID to cancel.\n * @returns A promise that resolves when the order is cancelled.\n */\nexport type RampsControllerTransakCancelOrderAction = {\n type: `RampsController:transakCancelOrder`;\n handler: RampsController['transakCancelOrder'];\n};\n\n/**\n * Cancels all active Transak orders. Individual cancellation failures\n * are collected and returned rather than thrown.\n *\n * @returns An array of errors from any failed cancellations (empty if all succeeded).\n */\nexport type RampsControllerTransakCancelAllActiveOrdersAction = {\n type: `RampsController:transakCancelAllActiveOrders`;\n handler: RampsController['transakCancelAllActiveOrders'];\n};\n\n/**\n * Fetches all active Transak orders for the authenticated user.\n *\n * @returns The list of active orders.\n */\nexport type RampsControllerTransakGetActiveOrdersAction = {\n type: `RampsController:transakGetActiveOrders`;\n handler: RampsController['transakGetActiveOrders'];\n};\n\n/**\n * Union of all RampsController action types.\n */\nexport type RampsControllerMethodActions =\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 | RampsControllerAddOrderAction\n | RampsControllerRemoveOrderAction\n | RampsControllerStartOrderPollingAction\n | RampsControllerStopOrderPollingAction\n | RampsControllerGetBuyWidgetDataAction\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 | RampsControllerTransakCreateWidgetUrlAction\n | RampsControllerTransakSubmitPurposeOfUsageFormAction\n | RampsControllerTransakPatchUserAction\n | RampsControllerTransakSubmitSsnDetailsAction\n | RampsControllerTransakConfirmPaymentAction\n | RampsControllerTransakGetTranslationAction\n | RampsControllerTransakGetIdProofStatusAction\n | RampsControllerTransakCancelOrderAction\n | RampsControllerTransakCancelAllActiveOrdersAction\n | RampsControllerTransakGetActiveOrdersAction;\n"]}