@metamask-previews/ramps-controller 28.1.0-preview-375cee475 → 28.1.0-preview-015df72e5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Added
11
+
12
+ - Add `NeoBankService.getCustomerAbilities`, exposed on the messenger, which returns the customer's rail abilities from neobank-proxy unmodified, and the `NeoBankCustomerAbilities`, `NeoBankFiatAbilities`, `NeoBankAbilityStatus`, `NeoBankCurrencyAbility` and `NeoBankAbilityCurrency` types ([#11225](https://github.com/MetaMask/core/pull/11225))
13
+ - MoonPay rejects an autoramp create with a 422 when the rail it needs is not `Active`, so clients can check the rail first. Any non-2xx response throws an `HttpError`.
14
+ - It resolves the MoonPay customer through `AuthenticationController:getSessionProfile`, so hosts must delegate that action to the `NeoBankService` messenger as well as `AuthenticationController:getBearerToken`. `getMicrodeposits` needs it too.
15
+ - Add `RampsController.refreshCustomerAbilities`, exposed on the messenger, which stores the result in the new `vbaCustomerAbilities` state ([#11225](https://github.com/MetaMask/core/pull/11225))
16
+ - The state is not persisted. A failed fetch throws and keeps the stored value. Discarding a VBA session owned by another profile clears it.
17
+ - Add `getMusdAutorampDepositRailReadiness` and the `MusdAutorampDepositRailReadiness` type, which read from customer abilities whether the deposit rails a fiat → mUSD autoramp needs are `active`, `pending` or `blocked` ([#11225](https://github.com/MetaMask/core/pull/11225))
18
+ - BRL needs `pix` and `pix_thirdparty`, USD needs `ach` and `ach_thirdparty`. Other fiats report `active`.
19
+
20
+ ### Changed
21
+
22
+ - **BREAKING:** `RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS` now includes `NeoBankService:getCustomerAbilities`. Hosts must delegate that action to `RampsController` ([#11225](https://github.com/MetaMask/core/pull/11225))
23
+
24
+ ### Fixed
25
+
26
+ - Require provider-side `finalStatus` approval before `hydrateVbaOnboarding` reports KYC as approved; relay `kycStatus` approval alone remains pending and does not start account setup ([#11243](https://github.com/MetaMask/core/pull/11243))
27
+ - `NeoBankService.getMicrodeposits` now looks the MoonPay customer up again when the session profile changes, instead of reusing the first profile's customer id for the life of the service ([#11225](https://github.com/MetaMask/core/pull/11225))
28
+
10
29
  ## [28.1.0]
11
30
 
12
31
  ### Added
@@ -176,6 +176,22 @@ export type NeoBankServiceGetMicrodepositsAction = {
176
176
  type: `NeoBankService:getMicrodeposits`;
177
177
  handler: NeoBankService['getMicrodeposits'];
178
178
  };
179
+ /**
180
+ * Reads the customer's rail abilities via neobank-proxy
181
+ * `GET /neobank/customers/{customer_id}/abilities` (MoonPay
182
+ * `GET /api/customers/{id}/abilities`).
183
+ *
184
+ * MoonPay rejects an autoramp create with a 422 when the rail it needs is not
185
+ * `Active`, even for an `Active` customer. The customer id is resolved the
186
+ * same way as in {@link getMicrodeposits}. Any non-2xx response, including a
187
+ * 404 when there is no customer yet, throws an {@link HttpError}.
188
+ *
189
+ * @returns MoonPay customer abilities, unmodified.
190
+ */
191
+ export type NeoBankServiceGetCustomerAbilitiesAction = {
192
+ type: `NeoBankService:getCustomerAbilities`;
193
+ handler: NeoBankService['getCustomerAbilities'];
194
+ };
179
195
  /**
180
196
  * Checks whether a Monad Money Account address is already registered for the
181
197
  * given Iron customer.
@@ -203,5 +219,5 @@ export type NeoBankServiceRegisterSelfHostedWalletAction = {
203
219
  /**
204
220
  * Union of all NeoBankService action types.
205
221
  */
206
- export type NeoBankServiceMethodActions = NeoBankServiceGetAutorampAction | NeoBankServiceGetAutorampsAction | NeoBankServiceGetPixDepositInstructionsAction | NeoBankServiceGetDepositInstructionsAction | NeoBankServiceListAutorampTransactionsAction | NeoBankServiceRegisterPixAddressAction | NeoBankServiceGetAutorampQuoteAction | NeoBankServiceCreateAutorampAction | NeoBankServiceGetAutorampQuoteForAutorampAction | NeoBankServiceAttachAutorampQuoteAction | NeoBankServiceGetCustomerByExternalIdAction | NeoBankServiceGetMoonpayCustomerIdAction | NeoBankServiceGetMicrodepositsAction | NeoBankServiceGetWalletRegistrationStatusAction | NeoBankServiceRegisterSelfHostedWalletAction;
222
+ export type NeoBankServiceMethodActions = NeoBankServiceGetAutorampAction | NeoBankServiceGetAutorampsAction | NeoBankServiceGetPixDepositInstructionsAction | NeoBankServiceGetDepositInstructionsAction | NeoBankServiceListAutorampTransactionsAction | NeoBankServiceRegisterPixAddressAction | NeoBankServiceGetAutorampQuoteAction | NeoBankServiceCreateAutorampAction | NeoBankServiceGetAutorampQuoteForAutorampAction | NeoBankServiceAttachAutorampQuoteAction | NeoBankServiceGetCustomerByExternalIdAction | NeoBankServiceGetMoonpayCustomerIdAction | NeoBankServiceGetMicrodepositsAction | NeoBankServiceGetCustomerAbilitiesAction | NeoBankServiceGetWalletRegistrationStatusAction | NeoBankServiceRegisterSelfHostedWalletAction;
207
223
  //# sourceMappingURL=NeoBankService-method-action-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NeoBankService-method-action-types.d.ts","sourceRoot":"","sources":["../src/NeoBankService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;;;;;GAOG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAC7C,IAAI,EAAE,6BAA6B,CAAC;IACpC,OAAO,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;CACzC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,cAAc,CAAC,2BAA2B,CAAC,CAAC;CACtD,CAAC;AA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D,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,cAAc,CAAC,sBAAsB,CAAC,CAAC;CACjD,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,cAAc,CAAC,kBAAkB,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,+CAA+C,GAAG;IAC5D,IAAI,EAAE,4CAA4C,CAAC;IACnD,OAAO,EAAE,cAAc,CAAC,6BAA6B,CAAC,CAAC;CACxD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,cAAc,CAAC,0BAA0B,CAAC,CAAC;CACrD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,2BAA2B,GACnC,+BAA+B,GAC/B,gCAAgC,GAChC,6CAA6C,GAC7C,0CAA0C,GAC1C,4CAA4C,GAC5C,sCAAsC,GACtC,oCAAoC,GACpC,kCAAkC,GAClC,+CAA+C,GAC/C,uCAAuC,GACvC,2CAA2C,GAC3C,wCAAwC,GACxC,oCAAoC,GACpC,+CAA+C,GAC/C,4CAA4C,CAAC"}
1
+ {"version":3,"file":"NeoBankService-method-action-types.d.ts","sourceRoot":"","sources":["../src/NeoBankService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;;;;;GAOG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAC7C,IAAI,EAAE,6BAA6B,CAAC;IACpC,OAAO,EAAE,cAAc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/NeoBankService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { NeoBankService } from './NeoBankService.js';\n\n/**\n * Fetches an autoramp account via neobank-proxy\n * `GET /neobank/autoramps/{autoramp_id}` (MoonPay\n * `GET /api/autoramps/{autoramp_id}`).\n *\n * @param autorampId - MoonPay / Ramp API autoramp id.\n * @returns Remote snapshot for controller apply/refresh.\n */\nexport type NeoBankServiceGetAutorampAction = {\n type: `NeoBankService:getAutoramp`;\n handler: NeoBankService['getAutoramp'];\n};\n\n/**\n * Fetches autoramp accounts, following MoonPay `cursor` pages until the\n * list is complete.\n *\n * Pass `customerId` to scope the list to one MoonPay customer. Omitting it\n * asks the proxy for the partner-wide list. Each request uses MoonPay's\n * maximum `page_size`.\n *\n * @param params - Optional filters.\n * @param params.customerId - MoonPay customer id.\n * @returns Remote snapshots for every page.\n */\nexport type NeoBankServiceGetAutorampsAction = {\n type: `NeoBankService:getAutoramps`;\n handler: NeoBankService['getAutoramps'];\n};\n\n/**\n * Loads PIX deposit instructions for an autoramp.\n *\n * Calls `GET /neobank/autoramps/{id}` and reads the `type: Pix` rail\n * (`br_code`, `instruction`, optional `pix_key`). Returns null until MoonPay\n * has attached deposit rails (typically once the autoramp is Approved).\n *\n * @param autorampId - MoonPay autoramp id.\n * @returns PIX instructions, or null when the rail is not ready.\n */\nexport type NeoBankServiceGetPixDepositInstructionsAction = {\n type: `NeoBankService:getPixDepositInstructions`;\n handler: NeoBankService['getPixDepositInstructions'];\n};\n\n/**\n * Loads deposit details for an autoramp, whichever rail it has.\n *\n * Calls `GET /neobank/autoramps/{id}` and reads the PIX rail, or else a US\n * bank rail (`ACH`, `Wire`, `RTP`, or `FedNow`). Returns null until MoonPay\n * has attached a supported rail. MoonPay only verifies the rail at\n * `Approved`, so callers should not show these details before then.\n *\n * @param autorampId - MoonPay autoramp id.\n * @returns Deposit details discriminated by `type`, or null.\n */\nexport type NeoBankServiceGetDepositInstructionsAction = {\n type: `NeoBankService:getDepositInstructions`;\n handler: NeoBankService['getDepositInstructions'];\n};\n\n/**\n * Lists the newest page of transactions for one autoramp via\n * `GET /neobank/autoramp-transactions?autoramp_id=&sort_order=desc`.\n *\n * This is the first page only, not the full history. Poll `status`\n * (`Completed`, `Failed`, …). The deprecated `state` field is ignored.\n *\n * @param autorampId - MoonPay autoramp id.\n * @param options - Optional page size. Omitted requests use the API default.\n * @param options.pageSize - `page_size` query value. Callers that diff\n * status pass 50.\n * @returns Transaction summaries from the newest page.\n */\nexport type NeoBankServiceListAutorampTransactionsAction = {\n type: `NeoBankService:listAutorampTransactions`;\n handler: NeoBankService['listAutorampTransactions'];\n};\n\n/**\n * Registers a Pix address via neobank-proxy `POST /neobank/addresses/pix`.\n * Body is forwarded as opaque JSON (MoonPay address schema).\n *\n * @param body - Pix address registration payload.\n * @param options - Optional idempotency key.\n * @returns Parsed proxy JSON response.\n */\nexport type NeoBankServiceRegisterPixAddressAction = {\n type: `NeoBankService:registerPixAddress`;\n handler: NeoBankService['registerPixAddress'];\n};\n\n/**\n * Fetches an autoramp quote via neobank-proxy `GET /neobank/autoramps/quote`.\n *\n * @param query - Quote query params (forwarded as-is).\n * @returns Parsed proxy JSON response.\n */\nexport type NeoBankServiceGetAutorampQuoteAction = {\n type: `NeoBankService:getAutorampQuote`;\n handler: NeoBankService['getAutorampQuote'];\n};\n\n/**\n * Creates an autoramp from a signed quote via neobank-proxy\n * `POST /neobank/autoramps` (MoonPay `POST /api/autoramps`).\n *\n * @param body - CreateAutoramp / signed-quote payload (forwarded as-is).\n * @param options - Optional idempotency key.\n * @returns Remote snapshot for controller apply/refresh.\n */\nexport type NeoBankServiceCreateAutorampAction = {\n type: `NeoBankService:createAutoramp`;\n handler: NeoBankService['createAutoramp'];\n};\n\n/**\n * Fetches a quote for an existing autoramp via neobank-proxy\n * `GET /neobank/autoramps/{autoramp_id}/quote`.\n *\n * @param autorampId - Autoramp id.\n * @param query - Quote query params (forwarded as-is).\n * @returns Parsed proxy JSON response.\n */\nexport type NeoBankServiceGetAutorampQuoteForAutorampAction = {\n type: `NeoBankService:getAutorampQuoteForAutoramp`;\n handler: NeoBankService['getAutorampQuoteForAutoramp'];\n};\n\n/**\n * Attaches a signed quote to an autoramp via neobank-proxy\n * `POST /neobank/autoramps/{autoramp_id}/quotes`.\n *\n * @param autorampId - Autoramp id.\n * @param body - Quote attachment payload (forwarded as-is).\n * @param options - Optional idempotency key.\n * @returns Parsed proxy JSON response.\n */\nexport type NeoBankServiceAttachAutorampQuoteAction = {\n type: `NeoBankService:attachAutorampQuote`;\n handler: NeoBankService['attachAutorampQuote'];\n};\n\n/**\n * Fetches a customer by partner external id via neobank-proxy\n * `GET /neobank/customers/{external_id}/external`.\n *\n * @param externalId - Partner-assigned external customer id.\n * @returns Parsed proxy JSON response.\n */\nexport type NeoBankServiceGetCustomerByExternalIdAction = {\n type: `NeoBankService:getCustomerByExternalId`;\n handler: NeoBankService['getCustomerByExternalId'];\n};\n\n/**\n * Resolves Iron's internal customer id via neobank-proxy customer lookup,\n * using the MetaMask canonical profile id as the partner `external_id`.\n *\n * @returns Iron's internal customer id.\n */\nexport type NeoBankServiceGetMoonpayCustomerIdAction = {\n type: `NeoBankService:getMoonpayCustomerId`;\n handler: NeoBankService['getMoonpayCustomerId'];\n};\n\n/**\n * Lists the customer's bank-link microdeposits via neobank-proxy\n * `GET /neobank/customers/{customer_id}/microdeposits` (MoonPay\n * `GET /api/customers/{id}/microdeposits`).\n *\n * The customer id is resolved through {@link getMoonpayCustomerId} at most\n * once per service instance; concurrent callers share the in-flight lookup\n * and a failed lookup is retried by the next call. A 404 (from the customer\n * lookup or the list) means there is no customer or no deposits yet and\n * resolves `[]`. Any other non-2xx response throws an {@link HttpError}. The\n * customer lookup is a single attempt: it does not go through the retry\n * policy.\n *\n * @returns MoonPay microdeposits, unmodified.\n */\nexport type NeoBankServiceGetMicrodepositsAction = {\n type: `NeoBankService:getMicrodeposits`;\n handler: NeoBankService['getMicrodeposits'];\n};\n\n/**\n * Checks whether a Monad Money Account address is already registered for the\n * given Iron customer.\n *\n * @param params - Customer id and address to check.\n * @param params.customerId - Iron / MoonPay customer UUID.\n * @param params.address - Money Account address.\n * @returns Active, disabled, or absent registration status.\n */\nexport type NeoBankServiceGetWalletRegistrationStatusAction = {\n type: `NeoBankService:getWalletRegistrationStatus`;\n handler: NeoBankService['getWalletRegistrationStatus'];\n};\n\n/**\n * Submits a signed Monad Money Account ownership proof via neobank-proxy\n * `POST /neobank/addresses/crypto/selfhosted`.\n *\n * @param params - Signed ownership proof.\n * @returns Registered wallet record.\n */\nexport type NeoBankServiceRegisterSelfHostedWalletAction = {\n type: `NeoBankService:registerSelfHostedWallet`;\n handler: NeoBankService['registerSelfHostedWallet'];\n};\n\n/**\n * Union of all NeoBankService action types.\n */\nexport type NeoBankServiceMethodActions =\n | NeoBankServiceGetAutorampAction\n | NeoBankServiceGetAutorampsAction\n | NeoBankServiceGetPixDepositInstructionsAction\n | NeoBankServiceGetDepositInstructionsAction\n | NeoBankServiceListAutorampTransactionsAction\n | NeoBankServiceRegisterPixAddressAction\n | NeoBankServiceGetAutorampQuoteAction\n | NeoBankServiceCreateAutorampAction\n | NeoBankServiceGetAutorampQuoteForAutorampAction\n | NeoBankServiceAttachAutorampQuoteAction\n | NeoBankServiceGetCustomerByExternalIdAction\n | NeoBankServiceGetMoonpayCustomerIdAction\n | NeoBankServiceGetMicrodepositsAction\n | NeoBankServiceGetWalletRegistrationStatusAction\n | NeoBankServiceRegisterSelfHostedWalletAction;\n"]}
1
+ {"version":3,"file":"NeoBankService-method-action-types.js","sourceRoot":"","sources":["../src/NeoBankService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { NeoBankService } from './NeoBankService.js';\n\n/**\n * Fetches an autoramp account via neobank-proxy\n * `GET /neobank/autoramps/{autoramp_id}` (MoonPay\n * `GET /api/autoramps/{autoramp_id}`).\n *\n * @param autorampId - MoonPay / Ramp API autoramp id.\n * @returns Remote snapshot for controller apply/refresh.\n */\nexport type NeoBankServiceGetAutorampAction = {\n type: `NeoBankService:getAutoramp`;\n handler: NeoBankService['getAutoramp'];\n};\n\n/**\n * Fetches autoramp accounts, following MoonPay `cursor` pages until the\n * list is complete.\n *\n * Pass `customerId` to scope the list to one MoonPay customer. Omitting it\n * asks the proxy for the partner-wide list. Each request uses MoonPay's\n * maximum `page_size`.\n *\n * @param params - Optional filters.\n * @param params.customerId - MoonPay customer id.\n * @returns Remote snapshots for every page.\n */\nexport type NeoBankServiceGetAutorampsAction = {\n type: `NeoBankService:getAutoramps`;\n handler: NeoBankService['getAutoramps'];\n};\n\n/**\n * Loads PIX deposit instructions for an autoramp.\n *\n * Calls `GET /neobank/autoramps/{id}` and reads the `type: Pix` rail\n * (`br_code`, `instruction`, optional `pix_key`). Returns null until MoonPay\n * has attached deposit rails (typically once the autoramp is Approved).\n *\n * @param autorampId - MoonPay autoramp id.\n * @returns PIX instructions, or null when the rail is not ready.\n */\nexport type NeoBankServiceGetPixDepositInstructionsAction = {\n type: `NeoBankService:getPixDepositInstructions`;\n handler: NeoBankService['getPixDepositInstructions'];\n};\n\n/**\n * Loads deposit details for an autoramp, whichever rail it has.\n *\n * Calls `GET /neobank/autoramps/{id}` and reads the PIX rail, or else a US\n * bank rail (`ACH`, `Wire`, `RTP`, or `FedNow`). Returns null until MoonPay\n * has attached a supported rail. MoonPay only verifies the rail at\n * `Approved`, so callers should not show these details before then.\n *\n * @param autorampId - MoonPay autoramp id.\n * @returns Deposit details discriminated by `type`, or null.\n */\nexport type NeoBankServiceGetDepositInstructionsAction = {\n type: `NeoBankService:getDepositInstructions`;\n handler: NeoBankService['getDepositInstructions'];\n};\n\n/**\n * Lists the newest page of transactions for one autoramp via\n * `GET /neobank/autoramp-transactions?autoramp_id=&sort_order=desc`.\n *\n * This is the first page only, not the full history. Poll `status`\n * (`Completed`, `Failed`, …). The deprecated `state` field is ignored.\n *\n * @param autorampId - MoonPay autoramp id.\n * @param options - Optional page size. Omitted requests use the API default.\n * @param options.pageSize - `page_size` query value. Callers that diff\n * status pass 50.\n * @returns Transaction summaries from the newest page.\n */\nexport type NeoBankServiceListAutorampTransactionsAction = {\n type: `NeoBankService:listAutorampTransactions`;\n handler: NeoBankService['listAutorampTransactions'];\n};\n\n/**\n * Registers a Pix address via neobank-proxy `POST /neobank/addresses/pix`.\n * Body is forwarded as opaque JSON (MoonPay address schema).\n *\n * @param body - Pix address registration payload.\n * @param options - Optional idempotency key.\n * @returns Parsed proxy JSON response.\n */\nexport type NeoBankServiceRegisterPixAddressAction = {\n type: `NeoBankService:registerPixAddress`;\n handler: NeoBankService['registerPixAddress'];\n};\n\n/**\n * Fetches an autoramp quote via neobank-proxy `GET /neobank/autoramps/quote`.\n *\n * @param query - Quote query params (forwarded as-is).\n * @returns Parsed proxy JSON response.\n */\nexport type NeoBankServiceGetAutorampQuoteAction = {\n type: `NeoBankService:getAutorampQuote`;\n handler: NeoBankService['getAutorampQuote'];\n};\n\n/**\n * Creates an autoramp from a signed quote via neobank-proxy\n * `POST /neobank/autoramps` (MoonPay `POST /api/autoramps`).\n *\n * @param body - CreateAutoramp / signed-quote payload (forwarded as-is).\n * @param options - Optional idempotency key.\n * @returns Remote snapshot for controller apply/refresh.\n */\nexport type NeoBankServiceCreateAutorampAction = {\n type: `NeoBankService:createAutoramp`;\n handler: NeoBankService['createAutoramp'];\n};\n\n/**\n * Fetches a quote for an existing autoramp via neobank-proxy\n * `GET /neobank/autoramps/{autoramp_id}/quote`.\n *\n * @param autorampId - Autoramp id.\n * @param query - Quote query params (forwarded as-is).\n * @returns Parsed proxy JSON response.\n */\nexport type NeoBankServiceGetAutorampQuoteForAutorampAction = {\n type: `NeoBankService:getAutorampQuoteForAutoramp`;\n handler: NeoBankService['getAutorampQuoteForAutoramp'];\n};\n\n/**\n * Attaches a signed quote to an autoramp via neobank-proxy\n * `POST /neobank/autoramps/{autoramp_id}/quotes`.\n *\n * @param autorampId - Autoramp id.\n * @param body - Quote attachment payload (forwarded as-is).\n * @param options - Optional idempotency key.\n * @returns Parsed proxy JSON response.\n */\nexport type NeoBankServiceAttachAutorampQuoteAction = {\n type: `NeoBankService:attachAutorampQuote`;\n handler: NeoBankService['attachAutorampQuote'];\n};\n\n/**\n * Fetches a customer by partner external id via neobank-proxy\n * `GET /neobank/customers/{external_id}/external`.\n *\n * @param externalId - Partner-assigned external customer id.\n * @returns Parsed proxy JSON response.\n */\nexport type NeoBankServiceGetCustomerByExternalIdAction = {\n type: `NeoBankService:getCustomerByExternalId`;\n handler: NeoBankService['getCustomerByExternalId'];\n};\n\n/**\n * Resolves Iron's internal customer id via neobank-proxy customer lookup,\n * using the MetaMask canonical profile id as the partner `external_id`.\n *\n * @returns Iron's internal customer id.\n */\nexport type NeoBankServiceGetMoonpayCustomerIdAction = {\n type: `NeoBankService:getMoonpayCustomerId`;\n handler: NeoBankService['getMoonpayCustomerId'];\n};\n\n/**\n * Lists the customer's bank-link microdeposits via neobank-proxy\n * `GET /neobank/customers/{customer_id}/microdeposits` (MoonPay\n * `GET /api/customers/{id}/microdeposits`).\n *\n * The customer id is resolved through {@link getMoonpayCustomerId} at most\n * once per service instance; concurrent callers share the in-flight lookup\n * and a failed lookup is retried by the next call. A 404 (from the customer\n * lookup or the list) means there is no customer or no deposits yet and\n * resolves `[]`. Any other non-2xx response throws an {@link HttpError}. The\n * customer lookup is a single attempt: it does not go through the retry\n * policy.\n *\n * @returns MoonPay microdeposits, unmodified.\n */\nexport type NeoBankServiceGetMicrodepositsAction = {\n type: `NeoBankService:getMicrodeposits`;\n handler: NeoBankService['getMicrodeposits'];\n};\n\n/**\n * Reads the customer's rail abilities via neobank-proxy\n * `GET /neobank/customers/{customer_id}/abilities` (MoonPay\n * `GET /api/customers/{id}/abilities`).\n *\n * MoonPay rejects an autoramp create with a 422 when the rail it needs is not\n * `Active`, even for an `Active` customer. The customer id is resolved the\n * same way as in {@link getMicrodeposits}. Any non-2xx response, including a\n * 404 when there is no customer yet, throws an {@link HttpError}.\n *\n * @returns MoonPay customer abilities, unmodified.\n */\nexport type NeoBankServiceGetCustomerAbilitiesAction = {\n type: `NeoBankService:getCustomerAbilities`;\n handler: NeoBankService['getCustomerAbilities'];\n};\n\n/**\n * Checks whether a Monad Money Account address is already registered for the\n * given Iron customer.\n *\n * @param params - Customer id and address to check.\n * @param params.customerId - Iron / MoonPay customer UUID.\n * @param params.address - Money Account address.\n * @returns Active, disabled, or absent registration status.\n */\nexport type NeoBankServiceGetWalletRegistrationStatusAction = {\n type: `NeoBankService:getWalletRegistrationStatus`;\n handler: NeoBankService['getWalletRegistrationStatus'];\n};\n\n/**\n * Submits a signed Monad Money Account ownership proof via neobank-proxy\n * `POST /neobank/addresses/crypto/selfhosted`.\n *\n * @param params - Signed ownership proof.\n * @returns Registered wallet record.\n */\nexport type NeoBankServiceRegisterSelfHostedWalletAction = {\n type: `NeoBankService:registerSelfHostedWallet`;\n handler: NeoBankService['registerSelfHostedWallet'];\n};\n\n/**\n * Union of all NeoBankService action types.\n */\nexport type NeoBankServiceMethodActions =\n | NeoBankServiceGetAutorampAction\n | NeoBankServiceGetAutorampsAction\n | NeoBankServiceGetPixDepositInstructionsAction\n | NeoBankServiceGetDepositInstructionsAction\n | NeoBankServiceListAutorampTransactionsAction\n | NeoBankServiceRegisterPixAddressAction\n | NeoBankServiceGetAutorampQuoteAction\n | NeoBankServiceCreateAutorampAction\n | NeoBankServiceGetAutorampQuoteForAutorampAction\n | NeoBankServiceAttachAutorampQuoteAction\n | NeoBankServiceGetCustomerByExternalIdAction\n | NeoBankServiceGetMoonpayCustomerIdAction\n | NeoBankServiceGetMicrodepositsAction\n | NeoBankServiceGetCustomerAbilitiesAction\n | NeoBankServiceGetWalletRegistrationStatusAction\n | NeoBankServiceRegisterSelfHostedWalletAction;\n"]}
@@ -51,6 +51,48 @@ export type NeoBankMicrodeposit = {
51
51
  created_at: string;
52
52
  counterparty_name?: string;
53
53
  };
54
+ /**
55
+ * Status of one MoonPay rail ability. Only `Active` lets the customer use the
56
+ * rail.
57
+ */
58
+ export type NeoBankAbilityStatus = 'Active' | 'Pending' | 'Unavailable' | 'Blocked' | 'Maintenance';
59
+ /**
60
+ * Rail statuses keyed by lowercase fiat code, then rail name, e.g. `usd.ach`
61
+ * or `brl.pix_thirdparty`.
62
+ */
63
+ export type NeoBankFiatAbilities = Record<string, Record<string, NeoBankAbilityStatus>>;
64
+ /**
65
+ * A MoonPay currency, as it appears in a customer's currency abilities.
66
+ */
67
+ export type NeoBankAbilityCurrency = {
68
+ type: 'Fiat';
69
+ code: string;
70
+ } | {
71
+ type: 'Crypto';
72
+ token: string;
73
+ blockchain: string;
74
+ };
75
+ /**
76
+ * What a MoonPay customer can do with one currency.
77
+ */
78
+ export type NeoBankCurrencyAbility = {
79
+ currency: NeoBankAbilityCurrency;
80
+ flows: ('Onramp' | 'Offramp' | 'Swap' | 'Mint' | 'Redeem')[];
81
+ /** Mint/redeem counterparts. Empty except for mint-only brand tokens. */
82
+ counterparts: NeoBankAbilityCurrency[];
83
+ };
84
+ /**
85
+ * A MoonPay customer's rail abilities. Shape mirrors MoonPay
86
+ * `GET /api/customers/{id}/abilities` and is returned unmodified.
87
+ */
88
+ export type NeoBankCustomerAbilities = {
89
+ fiat_deposit: NeoBankFiatAbilities;
90
+ fiat_payout: NeoBankFiatAbilities;
91
+ /** What the customer can do with each currency it can currently use. */
92
+ currencies: NeoBankCurrencyAbility[];
93
+ /** Why a rail is `Unavailable`, keyed by rail name (e.g. `ach`). */
94
+ blocking_abilities: Record<string, string>;
95
+ };
54
96
  /**
55
97
  * Optional headers for neo-bank mutating requests.
56
98
  */
@@ -272,6 +314,19 @@ export declare class NeoBankService {
272
314
  * @returns MoonPay microdeposits, unmodified.
273
315
  */
274
316
  getMicrodeposits(): Promise<NeoBankMicrodeposit[]>;
317
+ /**
318
+ * Reads the customer's rail abilities via neobank-proxy
319
+ * `GET /neobank/customers/{customer_id}/abilities` (MoonPay
320
+ * `GET /api/customers/{id}/abilities`).
321
+ *
322
+ * MoonPay rejects an autoramp create with a 422 when the rail it needs is not
323
+ * `Active`, even for an `Active` customer. The customer id is resolved the
324
+ * same way as in {@link getMicrodeposits}. Any non-2xx response, including a
325
+ * 404 when there is no customer yet, throws an {@link HttpError}.
326
+ *
327
+ * @returns MoonPay customer abilities, unmodified.
328
+ */
329
+ getCustomerAbilities(): Promise<NeoBankCustomerAbilities>;
275
330
  /**
276
331
  * Checks whether a Monad Money Account address is already registered for the
277
332
  * given Iron customer.
@@ -1 +1 @@
1
- {"version":3,"file":"NeoBankService.d.ts","sourceRoot":"","sources":["../src/NeoBankService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,aAAa,EACd,MAAM,4BAA4B,CAAC;AAMpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAGlF,OAAO,KAAK,EACV,2BAA2B,EAE3B,sBAAsB,EACtB,0BAA0B,EAC1B,sBAAsB,EACtB,yBAAyB,EAE1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAC3F,OAAO,EAAqB,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAKxE,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kCAAkC,CAAC;AAE1C;;GAEG;AACH,eAAO,MAAM,WAAW,mBAAmB,CAAC;AAuB5C;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,MAAM,CAAC;IAEX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IAEH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,iBAAiB,CAAC,EA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AO,GACR,EAAE,iCAAiC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAMjE;IAED;;;;;;OAMG;IACG,wBAAwB,CAC5B,MAAM,EAAE,8BAA8B,GACrC,OAAO,CAAC,mBAAmB,CAAC,CAK9B;IAyBD,OAAO,CACL,QAAQ,EAAE,UAAU,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAChD,UAAU,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAEtC;IAED,OAAO,CACL,QAAQ,EAAE,UAAU,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAChD,UAAU,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAEtC;IAED,UAAU,CACR,QAAQ,EAAE,UAAU,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,GACnD,UAAU,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAEzC;CACF"}
@@ -37,6 +37,7 @@ const MESSENGER_EXPOSED_METHODS = [
37
37
  'getCustomerByExternalId',
38
38
  'getMoonpayCustomerId',
39
39
  'getMicrodeposits',
40
+ 'getCustomerAbilities',
40
41
  'getWalletRegistrationStatus',
41
42
  'registerSelfHostedWallet',
42
43
  'getPixDepositInstructions',
@@ -313,7 +314,7 @@ export class NeoBankService {
313
314
  #context;
314
315
  #baseUrlOverride;
315
316
  #walletRegistrationService;
316
- #customerIdPromise;
317
+ #customerIdLookup;
317
318
  constructor({ messenger, environment = RampsEnvironment.Staging, context, fetch: fetchFunction, policyOptions = {}, baseUrlOverride, }) {
318
319
  this.name = serviceName;
319
320
  this.#messenger = messenger;
@@ -657,17 +658,7 @@ export class NeoBankService {
657
658
  async getMicrodeposits() {
658
659
  let response;
659
660
  try {
660
- this.#customerIdPromise ??= this.getMoonpayCustomerId().catch((error) => {
661
- this.#customerIdPromise = undefined;
662
- // The lookup runs outside the service policy and throws
663
- // WalletRegistrationError; surface HTTP failures as HttpError like
664
- // every other method.
665
- if (error instanceof WalletRegistrationError && error.httpStatus) {
666
- throw new HttpError(error.httpStatus, `Fetching neo-bank customer lookup failed with status '${error.httpStatus}'${error.body ? ` - ${error.body}` : ''}`);
667
- }
668
- throw error;
669
- });
670
- const customerId = await this.#customerIdPromise;
661
+ const customerId = await this.#resolveCustomerId();
671
662
  response = await this.#getJson(`customers/${encodeURIComponent(customerId)}/microdeposits`);
672
663
  }
673
664
  catch (error) {
@@ -681,6 +672,58 @@ export class NeoBankService {
681
672
  }
682
673
  return response;
683
674
  }
675
+ /**
676
+ * Reads the customer's rail abilities via neobank-proxy
677
+ * `GET /neobank/customers/{customer_id}/abilities` (MoonPay
678
+ * `GET /api/customers/{id}/abilities`).
679
+ *
680
+ * MoonPay rejects an autoramp create with a 422 when the rail it needs is not
681
+ * `Active`, even for an `Active` customer. The customer id is resolved the
682
+ * same way as in {@link getMicrodeposits}. Any non-2xx response, including a
683
+ * 404 when there is no customer yet, throws an {@link HttpError}.
684
+ *
685
+ * @returns MoonPay customer abilities, unmodified.
686
+ */
687
+ async getCustomerAbilities() {
688
+ const customerId = await this.#resolveCustomerId();
689
+ const response = await this.#getJson(`customers/${encodeURIComponent(customerId)}/abilities`);
690
+ if (!response ||
691
+ typeof response !== 'object' ||
692
+ !('fiat_deposit' in response) ||
693
+ !response.fiat_deposit ||
694
+ typeof response.fiat_deposit !== 'object') {
695
+ throw new Error('Malformed response received from neo-bank abilities API');
696
+ }
697
+ return response;
698
+ }
699
+ /**
700
+ * Resolves the MoonPay customer id through {@link getMoonpayCustomerId} at
701
+ * most once per session profile, so a profile switch looks the customer up
702
+ * again. Concurrent callers share the in-flight lookup and a failed lookup
703
+ * is retried by the next call. The lookup is a single attempt: it does not
704
+ * go through the retry policy.
705
+ *
706
+ * @returns Iron's internal customer id.
707
+ */
708
+ async #resolveCustomerId() {
709
+ const externalId = await this.#getCanonicalExternalId();
710
+ if (this.#customerIdLookup?.externalId !== externalId) {
711
+ const customerId = this.getMoonpayCustomerId().catch((error) => {
712
+ if (this.#customerIdLookup?.externalId === externalId) {
713
+ this.#customerIdLookup = undefined;
714
+ }
715
+ // The lookup runs outside the service policy and throws
716
+ // WalletRegistrationError; surface HTTP failures as HttpError like
717
+ // every other method.
718
+ if (error instanceof WalletRegistrationError && error.httpStatus) {
719
+ throw new HttpError(error.httpStatus, `Fetching neo-bank customer lookup failed with status '${error.httpStatus}'${error.body ? ` - ${error.body}` : ''}`);
720
+ }
721
+ throw error;
722
+ });
723
+ this.#customerIdLookup = { externalId, customerId };
724
+ }
725
+ return await this.#customerIdLookup.customerId;
726
+ }
684
727
  /**
685
728
  * Checks whether a Monad Money Account address is already registered for the
686
729
  * given Iron customer.
@@ -1 +1 @@
1
- {"version":3,"file":"NeoBankService.js","sourceRoot":"","sources":["../src/NeoBankService.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,SAAS,GACV,MAAM,4BAA4B,CAAC;AAIpC,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAW1C,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EACL,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,kCAAkC,CAAC;AAM1C;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,SAAS,gBAAgB,CAAC,KAAc;IACtC,IAAI,KAAK,YAAY,SAAS,EAAE,CAAC;QAC/B,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC,UAAU,GAAG,GAAG,IAAI,KAAK,CAAC,UAAU,IAAI,GAAG,CAAC;IAC3D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAyFD,MAAM,yBAAyB,GAAG;IAChC,aAAa;IACb,cAAc;IACd,oBAAoB;IACpB,kBAAkB;I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AC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["import type {\n CreateServicePolicyOptions,\n ServicePolicy,\n} from '@metamask/controller-utils';\nimport {\n createServicePolicy,\n handleWhen,\n HttpError,\n} from '@metamask/controller-utils';\nimport type { Messenger } from '@metamask/messenger';\nimport type { AuthenticationController } from '@metamask/profile-sync-controller';\n\nimport packageJson from '../package.json';\nimport type {\n AutorampDepositInstructions,\n AutorampDepositRailsSummary,\n AutorampRemoteSnapshot,\n AutorampTransactionSummary,\n PixDepositInstructions,\n UsBankDepositInstructions,\n UsBankDepositRail,\n} from './autoramp-types.js';\nimport type { NeoBankServiceMethodActions } from './NeoBankService-method-action-types.js';\nimport { RAMPS_SDK_VERSION, RampsEnvironment } from './RampsService.js';\nimport {\n WalletRegistrationError,\n WalletRegistrationService,\n} from './wallet-registration-service.js';\nimport type {\n RegistrationOutcome,\n RegistrationStatus,\n} from './wallet-registration-service.js';\n\n/**\n * Name of the NeoBankService messenger namespace.\n */\nexport const serviceName = 'NeoBankService';\n\n/**\n * Determines whether a failed neo-bank request is worth re-issuing.\n *\n * 4xx responses describe the request or the account's state (e.g. 403\n * \"Customer is not active\", 422 validation), so repeating them only multiplies\n * the same rejection. 429 stays retryable alongside 5xx and non-HTTP\n * network/timeout errors.\n *\n * @param error - Error thrown while performing the request.\n * @returns `true` when the error is worth retrying.\n */\nfunction isRetryableError(error: unknown): boolean {\n if (error instanceof HttpError) {\n if (error.httpStatus === 429) {\n return true;\n }\n return error.httpStatus < 400 || error.httpStatus >= 500;\n }\n return true;\n}\n\n/**\n * Raw autoramp payload from the MetaMask Ramp API neo-bank proxy.\n * Shape mirrors MoonPay Enterprise `GET /api/autoramps/{autoramp_id}`.\n * The Ramp API handles partner auth / headers; the client only sends the\n * MetaMask bearer token.\n */\nexport type NeoBankAutorampResponse = {\n id: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention -- MoonPay API field\n customer_id?: string;\n status: string;\n /**\n * Destination wallet when present on the proxy response.\n * Field name may evolve with the Ramp API contract.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention -- MoonPay API field\n wallet_address?: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention -- MoonPay API field\n recipient_account?: {\n address?: string;\n };\n /**\n * Some MoonPay autoramp responses put the destination under `recipient`\n * instead of `recipient_account`.\n */\n recipient?: {\n address?: string;\n };\n // eslint-disable-next-line @typescript-eslint/naming-convention -- MoonPay API field\n deposit_rails?: unknown[];\n};\n\n/**\n * A MoonPay microdeposit: a small test credit a bank sends when a user links\n * their account. Shape mirrors MoonPay `GET /api/customers/{id}/microdeposits`\n * and is returned unmodified. There is no id field, so consumers derive their\n * own key.\n */\nexport type NeoBankMicrodeposit = {\n /** Decimal string, e.g. `\"0.34\"`. */\n amount: string;\n /** Currency code, e.g. `\"USD\"`. */\n // eslint-disable-next-line @typescript-eslint/naming-convention -- MoonPay API field\n currency_code: string;\n /** ISO-8601 datetime. */\n // eslint-disable-next-line @typescript-eslint/naming-convention -- MoonPay API field\n created_at: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention -- MoonPay API field\n counterparty_name?: string;\n};\n\n/**\n * Optional headers for neo-bank mutating requests.\n */\nexport type NeoBankRequestOptions = {\n /**\n * Forwarded as `Idempotency-Key` when set (MoonPay requires it on some POSTs;\n * neobank-proxy generates one when omitted).\n */\n idempotencyKey?: string;\n};\n\n/**\n * Query string values accepted by neo-bank GET helpers.\n */\nexport type NeoBankQueryParams = Record<\n string,\n string | number | boolean | undefined | null\n>;\n\nexport type GetWalletRegistrationStatusParams = {\n customerId: string;\n address: string;\n};\n\nexport type RegisterSelfHostedWalletParams = {\n customerId: string;\n address: string;\n message: string;\n signature: string;\n /**\n * Forwarded as `Idempotency-Key` on the neobank-proxy POST. Prefer a stable\n * key across retries of the same ownership body.\n */\n idempotencyKey?: string;\n};\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'getAutoramp',\n 'getAutoramps',\n 'registerPixAddress',\n 'getAutorampQuote',\n 'createAutoramp',\n 'getAutorampQuoteForAutoramp',\n 'attachAutorampQuote',\n 'getCustomerByExternalId',\n 'getMoonpayCustomerId',\n 'getMicrodeposits',\n 'getWalletRegistrationStatus',\n 'registerSelfHostedWallet',\n 'getPixDepositInstructions',\n 'getDepositInstructions',\n 'listAutorampTransactions',\n] as const;\n\n/**\n * MoonPay's maximum `page_size` for `GET /api/autoramps`.\n */\nconst AUTORAMP_LIST_PAGE_SIZE = 100;\n\n/**\n * Actions that {@link NeoBankService} exposes to other consumers.\n */\nexport type NeoBankServiceActions = NeoBankServiceMethodActions;\n\ntype AllowedActions =\n | AuthenticationController.AuthenticationControllerGetBearerTokenAction\n | AuthenticationController.AuthenticationControllerGetSessionProfileAction;\n\nexport type NeoBankServiceEvents = never;\n\ntype AllowedEvents = never;\n\n/**\n * The messenger restricted to actions and events accessed by\n * {@link NeoBankService}.\n */\nexport type NeoBankServiceMessenger = Messenger<\n typeof serviceName,\n NeoBankServiceActions | AllowedActions,\n NeoBankServiceEvents | AllowedEvents\n>;\n\n/**\n * Builds a path under the neobank-proxy global prefix.\n *\n * Live neobank-proxy (#1124) mounts routes at `/neobank` on the on-ramp.api\n * host (ALB path routing, no rewrite). Prefer this over `/api/v2/...` so Core\n * matches the proxy that ships.\n *\n * @param path - Path under `/neobank` (no leading slash).\n * @returns Absolute path segment for URL join against the Ramp API host.\n */\nfunction getNeoBankPath(path: string): string {\n return `neobank/${path.replace(/^\\//u, '')}`;\n}\n\n/**\n * Resolves the Ramp API host for neo-bank calls (same hosts as {@link RampsService}).\n *\n * @param environment - Ramp environment.\n * @returns Base URL.\n */\nfunction getBaseUrl(environment: RampsEnvironment): string {\n switch (environment) {\n case RampsEnvironment.Production:\n return 'https://on-ramp.api.cx.metamask.io';\n case RampsEnvironment.Staging:\n return 'https://on-ramp.uat-api.cx.metamask.io';\n case RampsEnvironment.Development:\n return 'https://on-ramp.dev-api.cx.metamask.io';\n case RampsEnvironment.Local:\n return 'http://localhost:3000';\n default:\n throw new Error(`Invalid environment: ${String(environment)}`);\n }\n}\n\n/**\n * Maps a Ramp API / MoonPay-shaped autoramp response into the local remote snapshot.\n *\n * @param response - Proxy response body.\n * @returns Snapshot for the controller last-seen cursor.\n */\nexport function mapNeoBankAutorampToRemoteSnapshot(\n response: NeoBankAutorampResponse,\n): AutorampRemoteSnapshot {\n const depositRails = response.deposit_rails;\n const hasDepositRails =\n Array.isArray(depositRails) && depositRails.length > 0;\n const currency = readDepositRailCurrency(depositRails);\n const depositRailsSummary: AutorampDepositRailsSummary | undefined =\n hasDepositRails || response.status === 'Approved'\n ? {\n ready: response.status === 'Approved' && hasDepositRails,\n ...(currency ? { currency } : {}),\n }\n : undefined;\n\n return {\n id: response.id,\n customerId: response.customer_id,\n walletAddress:\n response.wallet_address !== undefined &&\n response.wallet_address.length > 0\n ? response.wallet_address\n : (response.recipient_account?.address ?? response.recipient?.address),\n status: response.status,\n depositRailsSummary,\n };\n}\n\n/**\n * Reads a MoonPay paged list (an object with an items array) or a raw array.\n *\n * @param response - Proxy JSON body.\n * @param malformedMessage - Error when the body is neither shape.\n * @returns Item list.\n */\nfunction readPagedItems(\n response: unknown,\n malformedMessage: string,\n): unknown[] {\n if (Array.isArray(response)) {\n return response;\n }\n if (\n response !== null &&\n typeof response === 'object' &&\n Array.isArray((response as { items?: unknown }).items)\n ) {\n return (response as { items: unknown[] }).items;\n }\n throw new Error(malformedMessage);\n}\n\n/**\n * Reads the next-page cursor from a MoonPay paged list.\n * A raw array has no further page.\n *\n * @param response - Proxy JSON body.\n * @returns Next cursor, or undefined when this page is the last.\n */\nfunction readNextCursor(response: unknown): string | undefined {\n if (\n response === null ||\n typeof response !== 'object' ||\n Array.isArray(response)\n ) {\n return undefined;\n }\n const { cursor } = response as { cursor?: unknown };\n return typeof cursor === 'string' && cursor.length > 0 ? cursor : undefined;\n}\n\n/**\n * Pulls the PIX deposit rail out of an autoramp `deposit_rails` array.\n *\n * @param depositRails - MoonPay `deposit_rails` value.\n * @returns PIX instructions, or null when no usable PIX rail is present.\n */\nexport function extractPixDepositInstructions(\n depositRails: unknown,\n): PixDepositInstructions | null {\n if (!Array.isArray(depositRails)) {\n return null;\n }\n for (const rail of depositRails) {\n if (rail === null || typeof rail !== 'object') {\n continue;\n }\n const record = rail as Record<string, unknown>;\n if (record.type !== 'Pix') {\n continue;\n }\n if (\n typeof record.br_code !== 'string' ||\n record.br_code.length === 0 ||\n typeof record.instruction !== 'string' ||\n record.instruction.length === 0\n ) {\n continue;\n }\n const instructions: PixDepositInstructions = {\n brCode: record.br_code,\n instruction: record.instruction,\n };\n if (typeof record.pix_key === 'string' && record.pix_key.length > 0) {\n instructions.pixKey = record.pix_key;\n }\n if (typeof record.expires_at === 'string' && record.expires_at.length > 0) {\n instructions.expiresAt = record.expires_at;\n }\n return instructions;\n }\n return null;\n}\n\n/**\n * US rails in the order to prefer when an autoramp lists more than one.\n */\nconst US_BANK_DEPOSIT_RAILS: readonly UsBankDepositRail[] = [\n 'ACH',\n 'Wire',\n 'RTP',\n 'FedNow',\n];\n\n/**\n * Fiat code implied by each MoonPay `deposit_rails` type that the app reads.\n */\nconst DEPOSIT_RAIL_CURRENCIES: Readonly<Record<string, string>> = {\n Pix: 'BRL',\n SEPA: 'EUR',\n ACH: 'USD',\n Wire: 'USD',\n RTP: 'USD',\n FedNow: 'USD',\n};\n\n/**\n * Reads a non-empty string field from a deposit rail.\n *\n * @param record - Deposit rail object.\n * @param key - MoonPay field name.\n * @returns The value, or undefined when missing or empty.\n */\nfunction readRailString(\n record: Record<string, unknown>,\n key: string,\n): string | undefined {\n const value = record[key];\n return typeof value === 'string' && value.length > 0 ? value : undefined;\n}\n\n/**\n * Lists the object entries of a MoonPay `deposit_rails` value.\n *\n * @param depositRails - MoonPay `deposit_rails` value.\n * @returns Rail objects, skipping anything that is not an object.\n */\nfunction readDepositRails(depositRails: unknown): Record<string, unknown>[] {\n if (!Array.isArray(depositRails)) {\n return [];\n }\n return depositRails.filter(\n (rail): rail is Record<string, unknown> =>\n rail !== null && typeof rail === 'object',\n );\n}\n\n/**\n * Fiat of the rail {@link NeoBankService.getDepositInstructions} would return.\n * Incomplete rails do not count, so a stub PIX entry cannot label an ACH account\n * as BRL. SEPA is included when it has an IBAN, which is the EUR equivalent.\n *\n * @param depositRails - MoonPay `deposit_rails` value.\n * @returns Uppercase fiat code, or undefined when no rail is complete.\n */\nfunction readDepositRailCurrency(depositRails: unknown): string | undefined {\n if (extractPixDepositInstructions(depositRails)) {\n return DEPOSIT_RAIL_CURRENCIES.Pix;\n }\n if (extractUsBankDepositInstructions(depositRails)) {\n return DEPOSIT_RAIL_CURRENCIES.ACH;\n }\n const sepa = readDepositRails(depositRails).find(\n (rail) => rail.type === 'SEPA' && readRailString(rail, 'iban'),\n );\n return sepa ? DEPOSIT_RAIL_CURRENCIES.SEPA : undefined;\n}\n\n/**\n * Pulls US bank transfer details out of an autoramp `deposit_rails` array.\n * ACH is preferred, then Wire, RTP, and FedNow.\n *\n * @param depositRails - MoonPay `deposit_rails` value.\n * @returns US bank details, or null when no complete US rail is present.\n */\nexport function extractUsBankDepositInstructions(\n depositRails: unknown,\n): UsBankDepositInstructions | null {\n const rails = readDepositRails(depositRails);\n for (const railType of US_BANK_DEPOSIT_RAILS) {\n for (const record of rails) {\n if (record.type !== railType) {\n continue;\n }\n const accountHolder = readRailString(record, 'recipient_name');\n const routingNumber = readRailString(record, 'routing_number');\n const accountNumber = readRailString(record, 'account_number');\n const bankName = readRailString(record, 'bank_name');\n if (!accountHolder || !routingNumber || !accountNumber || !bankName) {\n continue;\n }\n const instructions: UsBankDepositInstructions = {\n rail: railType,\n accountHolder,\n routingNumber,\n accountNumber,\n bankName,\n };\n const bankAddress = readRailString(record, 'bank_address');\n if (bankAddress) {\n instructions.bankAddress = bankAddress;\n }\n const accountHolderAddress = readRailString(record, 'recipient_address');\n if (accountHolderAddress) {\n instructions.accountHolderAddress = accountHolderAddress;\n }\n return instructions;\n }\n }\n return null;\n}\n\n/**\n * Reads a decimal amount from a MoonPay `Amount` object.\n *\n * @param value - `source_amount` or `destination_amount`.\n * @returns Decimal string, or undefined.\n */\nfunction readAmount(value: unknown): string | undefined {\n if (value === null || typeof value !== 'object') {\n return undefined;\n }\n const { amount } = value as { amount?: unknown };\n return typeof amount === 'string' && amount.length > 0 ? amount : undefined;\n}\n\n/**\n * Client for MetaMask Ramp API neo-bank endpoints (MoonPay Enterprise proxy).\n *\n * Lives alongside {@link RampsService} and {@link TransakService}. Authentication\n * and MoonPay partner headers are handled by the Ramp API; this service only\n * attaches the MetaMask user bearer token.\n *\n * Paths use the neobank-proxy `/neobank` prefix on the on-ramp.api host.\n */\nexport class NeoBankService {\n readonly name: typeof serviceName;\n\n readonly #messenger: NeoBankServiceMessenger;\n\n readonly #fetch: typeof fetch;\n\n readonly #policy: ServicePolicy;\n\n readonly #noRetryPolicy: ServicePolicy;\n\n readonly #environment: RampsEnvironment;\n\n readonly #context: string;\n\n readonly #baseUrlOverride?: string;\n\n #walletRegistrationService: WalletRegistrationService | undefined;\n\n #customerIdPromise: Promise<string> | undefined;\n\n constructor({\n messenger,\n environment = RampsEnvironment.Staging,\n context,\n fetch: fetchFunction,\n policyOptions = {},\n baseUrlOverride,\n }: {\n messenger: NeoBankServiceMessenger;\n environment?: RampsEnvironment;\n context: string;\n fetch: typeof fetch;\n policyOptions?: CreateServicePolicyOptions;\n baseUrlOverride?: string;\n }) {\n this.name = serviceName;\n this.#messenger = messenger;\n this.#fetch = fetchFunction;\n this.#policy = createServicePolicy({\n retryFilterPolicy: handleWhen(isRetryableError),\n ...policyOptions,\n });\n this.#noRetryPolicy = createServicePolicy({\n retryFilterPolicy: handleWhen(isRetryableError),\n ...policyOptions,\n maxRetries: 0,\n });\n this.#environment = environment;\n this.#context = context;\n this.#baseUrlOverride = baseUrlOverride;\n\n this.#messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n #getBaseUrl(): string {\n if (this.#baseUrlOverride) {\n return this.#baseUrlOverride;\n }\n return getBaseUrl(this.#environment);\n }\n\n /**\n * Lazily builds the wallet registration client. Deferred so constructing the\n * service never resolves the base URL eagerly (an invalid environment only\n * throws when a request is made, matching the other neo-bank methods).\n *\n * @returns The wallet registration client.\n */\n #getWalletRegistrationService(): WalletRegistrationService {\n this.#walletRegistrationService ??= new WalletRegistrationService({\n fetch: this.#fetch,\n baseUrl: this.#getBaseUrl(),\n getAuthToken: async (): Promise<string> =>\n this.#messenger.call('AuthenticationController:getBearerToken'),\n getExternalId: async (): Promise<string> =>\n this.#getCanonicalExternalId(),\n });\n return this.#walletRegistrationService;\n }\n\n async #getRequestHeaders(\n options: NeoBankRequestOptions = {},\n ): Promise<Record<string, string>> {\n const bearerToken = await this.#messenger.call(\n 'AuthenticationController:getBearerToken',\n );\n const headers: Record<string, string> = {\n Authorization: `Bearer ${bearerToken}`,\n };\n if (options.idempotencyKey) {\n headers['Idempotency-Key'] = options.idempotencyKey;\n }\n return headers;\n }\n\n #buildUrl(path: string, query?: NeoBankQueryParams): URL {\n const url = new URL(getNeoBankPath(path), this.#getBaseUrl());\n url.searchParams.set('sdk', RAMPS_SDK_VERSION);\n url.searchParams.set('controller', packageJson.version);\n url.searchParams.set('context', this.#context);\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined && value !== null) {\n url.searchParams.set(key, String(value));\n }\n }\n }\n return url;\n }\n\n /**\n * Throws an {@link HttpError} that carries the upstream response body.\n *\n * The neobank-proxy mirrors MoonPay's status *and* body verbatim, so the\n * body is usually the only place that explains a 4xx (e.g. which field or\n * permission was rejected). Dropping it makes failures undiagnosable.\n *\n * @param url - Request URL, for context in the message.\n * @param response - Non-OK fetch response.\n */\n async #throwHttpError(url: URL, response: Response): Promise<never> {\n let detail = '';\n try {\n const body = (await response.text()).trim();\n if (body) {\n detail = ` - ${body.slice(0, 500)}`;\n }\n } catch {\n // Body already consumed or unreadable; the status alone still helps.\n }\n throw new HttpError(\n response.status,\n `Fetching '${url.toString()}' failed with status '${response.status}'${detail}`,\n );\n }\n\n async #getJson<ResponseBody>(\n path: string,\n query?: NeoBankQueryParams,\n ): Promise<ResponseBody> {\n const url = this.#buildUrl(path, query);\n return this.#policy.execute(async () => {\n const headers = await this.#getRequestHeaders();\n const fetchResponse = await this.#fetch(url, { headers });\n if (!fetchResponse.ok) {\n await this.#throwHttpError(url, fetchResponse);\n }\n return fetchResponse.json() as Promise<ResponseBody>;\n });\n }\n\n async #postJson<ResponseBody>(\n path: string,\n body: Record<string, unknown>,\n options: NeoBankRequestOptions,\n ): Promise<ResponseBody> {\n const url = this.#buildUrl(path);\n return this.#noRetryPolicy.execute(async () => {\n const headers = await this.#getRequestHeaders(options);\n headers['Content-Type'] = 'application/json';\n const fetchResponse = await this.#fetch(url, {\n method: 'POST',\n headers,\n body: JSON.stringify(body),\n });\n if (!fetchResponse.ok) {\n await this.#throwHttpError(url, fetchResponse);\n }\n return fetchResponse.json() as Promise<ResponseBody>;\n });\n }\n\n #mapAutorampResponse(\n response: NeoBankAutorampResponse,\n ): AutorampRemoteSnapshot {\n if (!response || typeof response !== 'object' || !response.id) {\n throw new Error('Malformed response received from neo-bank autoramp API');\n }\n return mapNeoBankAutorampToRemoteSnapshot(response);\n }\n\n /**\n * Fetches an autoramp account via neobank-proxy\n * `GET /neobank/autoramps/{autoramp_id}` (MoonPay\n * `GET /api/autoramps/{autoramp_id}`).\n *\n * @param autorampId - MoonPay / Ramp API autoramp id.\n * @returns Remote snapshot for controller apply/refresh.\n */\n async getAutoramp(autorampId: string): Promise<AutorampRemoteSnapshot> {\n const response = await this.#getJson<NeoBankAutorampResponse>(\n `autoramps/${encodeURIComponent(autorampId)}`,\n );\n return this.#mapAutorampResponse(response);\n }\n\n /**\n * Fetches autoramp accounts, following MoonPay `cursor` pages until the\n * list is complete.\n *\n * Pass `customerId` to scope the list to one MoonPay customer. Omitting it\n * asks the proxy for the partner-wide list. Each request uses MoonPay's\n * maximum `page_size`.\n *\n * @param params - Optional filters.\n * @param params.customerId - MoonPay customer id.\n * @returns Remote snapshots for every page.\n */\n async getAutoramps(\n params: { customerId?: string } = {},\n ): Promise<AutorampRemoteSnapshot[]> {\n const autoramps: unknown[] = [];\n const seenCursors = new Set<string>();\n let cursor: string | undefined;\n\n do {\n const response = await this.#getJson<unknown>('autoramps', {\n customer_id: params.customerId,\n page_size: AUTORAMP_LIST_PAGE_SIZE,\n cursor,\n });\n autoramps.push(\n ...readPagedItems(\n response,\n 'Malformed response received from neo-bank autoramps API',\n ),\n );\n const nextCursor = readNextCursor(response);\n if (nextCursor === undefined || seenCursors.has(nextCursor)) {\n break;\n }\n seenCursors.add(nextCursor);\n cursor = nextCursor;\n } while (cursor !== undefined);\n\n return autoramps.map((autoramp) =>\n this.#mapAutorampResponse(autoramp as NeoBankAutorampResponse),\n );\n }\n\n /**\n * Loads PIX deposit instructions for an autoramp.\n *\n * Calls `GET /neobank/autoramps/{id}` and reads the `type: Pix` rail\n * (`br_code`, `instruction`, optional `pix_key`). Returns null until MoonPay\n * has attached deposit rails (typically once the autoramp is Approved).\n *\n * @param autorampId - MoonPay autoramp id.\n * @returns PIX instructions, or null when the rail is not ready.\n */\n async getPixDepositInstructions(\n autorampId: string,\n ): Promise<PixDepositInstructions | null> {\n const response = await this.#getJson<NeoBankAutorampResponse>(\n `autoramps/${encodeURIComponent(autorampId)}`,\n );\n if (!response || typeof response !== 'object') {\n throw new Error('Malformed response received from neo-bank autoramp API');\n }\n return extractPixDepositInstructions(response.deposit_rails);\n }\n\n /**\n * Loads deposit details for an autoramp, whichever rail it has.\n *\n * Calls `GET /neobank/autoramps/{id}` and reads the PIX rail, or else a US\n * bank rail (`ACH`, `Wire`, `RTP`, or `FedNow`). Returns null until MoonPay\n * has attached a supported rail. MoonPay only verifies the rail at\n * `Approved`, so callers should not show these details before then.\n *\n * @param autorampId - MoonPay autoramp id.\n * @returns Deposit details discriminated by `type`, or null.\n */\n async getDepositInstructions(\n autorampId: string,\n ): Promise<AutorampDepositInstructions | null> {\n const response = await this.#getJson<NeoBankAutorampResponse>(\n `autoramps/${encodeURIComponent(autorampId)}`,\n );\n if (!response || typeof response !== 'object') {\n throw new Error('Malformed response received from neo-bank autoramp API');\n }\n const pix = extractPixDepositInstructions(response.deposit_rails);\n if (pix) {\n return { type: 'Pix', ...pix };\n }\n const usBank = extractUsBankDepositInstructions(response.deposit_rails);\n return usBank ? { type: 'UsBank', ...usBank } : null;\n }\n\n /**\n * Lists the newest page of transactions for one autoramp via\n * `GET /neobank/autoramp-transactions?autoramp_id=&sort_order=desc`.\n *\n * This is the first page only, not the full history. Poll `status`\n * (`Completed`, `Failed`, …). The deprecated `state` field is ignored.\n *\n * @param autorampId - MoonPay autoramp id.\n * @param options - Optional page size. Omitted requests use the API default.\n * @param options.pageSize - `page_size` query value. Callers that diff\n * status pass 50.\n * @returns Transaction summaries from the newest page.\n */\n async listAutorampTransactions(\n autorampId: string,\n options?: { pageSize?: number },\n ): Promise<AutorampTransactionSummary[]> {\n const response = await this.#getJson<unknown>('autoramp-transactions', {\n autoramp_id: autorampId,\n sort_order: 'desc',\n ...(options?.pageSize === undefined\n ? {}\n : { page_size: options.pageSize }),\n });\n const transactions = readPagedItems(\n response,\n 'Malformed response received from neo-bank autoramp transactions API',\n );\n return transactions.map((transaction) => {\n if (\n transaction === null ||\n typeof transaction !== 'object' ||\n typeof (transaction as { id?: unknown }).id !== 'string'\n ) {\n throw new Error(\n 'Malformed response received from neo-bank autoramp transactions API',\n );\n }\n const record = transaction as {\n id: string;\n autoramp_id?: unknown;\n status?: unknown;\n source_amount?: unknown;\n destination_amount?: unknown;\n created_at?: unknown;\n };\n if (typeof record.status !== 'string') {\n throw new Error(\n 'Malformed response received from neo-bank autoramp transactions API',\n );\n }\n const createdAt =\n typeof record.created_at === 'string' && record.created_at.length > 0\n ? record.created_at\n : undefined;\n return {\n id: record.id,\n autorampId:\n typeof record.autoramp_id === 'string'\n ? record.autoramp_id\n : autorampId,\n status: record.status,\n sourceAmount: readAmount(record.source_amount),\n destinationAmount: readAmount(record.destination_amount),\n createdAt,\n };\n });\n }\n\n /**\n * Registers a Pix address via neobank-proxy `POST /neobank/addresses/pix`.\n * Body is forwarded as opaque JSON (MoonPay address schema).\n *\n * @param body - Pix address registration payload.\n * @param options - Optional idempotency key.\n * @returns Parsed proxy JSON response.\n */\n async registerPixAddress(\n body: Record<string, unknown>,\n options: NeoBankRequestOptions = {},\n ): Promise<unknown> {\n return this.#postJson('addresses/pix', body, options);\n }\n\n /**\n * Fetches an autoramp quote via neobank-proxy `GET /neobank/autoramps/quote`.\n *\n * @param query - Quote query params (forwarded as-is).\n * @returns Parsed proxy JSON response.\n */\n async getAutorampQuote(query: NeoBankQueryParams = {}): Promise<unknown> {\n return this.#getJson('autoramps/quote', query);\n }\n\n /**\n * Creates an autoramp from a signed quote via neobank-proxy\n * `POST /neobank/autoramps` (MoonPay `POST /api/autoramps`).\n *\n * @param body - CreateAutoramp / signed-quote payload (forwarded as-is).\n * @param options - Optional idempotency key.\n * @returns Remote snapshot for controller apply/refresh.\n */\n async createAutoramp(\n body: Record<string, unknown>,\n options: NeoBankRequestOptions = {},\n ): Promise<AutorampRemoteSnapshot> {\n const response = await this.#postJson<NeoBankAutorampResponse>(\n 'autoramps',\n body,\n options,\n );\n return this.#mapAutorampResponse(response);\n }\n\n /**\n * Fetches a quote for an existing autoramp via neobank-proxy\n * `GET /neobank/autoramps/{autoramp_id}/quote`.\n *\n * @param autorampId - Autoramp id.\n * @param query - Quote query params (forwarded as-is).\n * @returns Parsed proxy JSON response.\n */\n async getAutorampQuoteForAutoramp(\n autorampId: string,\n query: NeoBankQueryParams = {},\n ): Promise<unknown> {\n return this.#getJson(\n `autoramps/${encodeURIComponent(autorampId)}/quote`,\n query,\n );\n }\n\n /**\n * Attaches a signed quote to an autoramp via neobank-proxy\n * `POST /neobank/autoramps/{autoramp_id}/quotes`.\n *\n * @param autorampId - Autoramp id.\n * @param body - Quote attachment payload (forwarded as-is).\n * @param options - Optional idempotency key.\n * @returns Parsed proxy JSON response.\n */\n async attachAutorampQuote(\n autorampId: string,\n body: Record<string, unknown>,\n options: NeoBankRequestOptions = {},\n ): Promise<unknown> {\n return this.#postJson(\n `autoramps/${encodeURIComponent(autorampId)}/quotes`,\n body,\n options,\n );\n }\n\n /**\n * Fetches a customer by partner external id via neobank-proxy\n * `GET /neobank/customers/{external_id}/external`.\n *\n * @param externalId - Partner-assigned external customer id.\n * @returns Parsed proxy JSON response.\n */\n async getCustomerByExternalId(externalId: string): Promise<unknown> {\n return this.#getJson(\n `customers/${encodeURIComponent(externalId)}/external`,\n );\n }\n\n /**\n * Resolves Iron's internal customer id via neobank-proxy customer lookup,\n * using the MetaMask canonical profile id as the partner `external_id`.\n *\n * @returns Iron's internal customer id.\n */\n async getMoonpayCustomerId(): Promise<string> {\n return await this.#getWalletRegistrationService().getMoonpayCustomerId();\n }\n\n /**\n * Lists the customer's bank-link microdeposits via neobank-proxy\n * `GET /neobank/customers/{customer_id}/microdeposits` (MoonPay\n * `GET /api/customers/{id}/microdeposits`).\n *\n * The customer id is resolved through {@link getMoonpayCustomerId} at most\n * once per service instance; concurrent callers share the in-flight lookup\n * and a failed lookup is retried by the next call. A 404 (from the customer\n * lookup or the list) means there is no customer or no deposits yet and\n * resolves `[]`. Any other non-2xx response throws an {@link HttpError}. The\n * customer lookup is a single attempt: it does not go through the retry\n * policy.\n *\n * @returns MoonPay microdeposits, unmodified.\n */\n async getMicrodeposits(): Promise<NeoBankMicrodeposit[]> {\n let response: unknown;\n try {\n this.#customerIdPromise ??= this.getMoonpayCustomerId().catch(\n (error: unknown) => {\n this.#customerIdPromise = undefined;\n // The lookup runs outside the service policy and throws\n // WalletRegistrationError; surface HTTP failures as HttpError like\n // every other method.\n if (error instanceof WalletRegistrationError && error.httpStatus) {\n throw new HttpError(\n error.httpStatus,\n `Fetching neo-bank customer lookup failed with status '${error.httpStatus}'${error.body ? ` - ${error.body}` : ''}`,\n );\n }\n throw error;\n },\n );\n const customerId = await this.#customerIdPromise;\n response = await this.#getJson<unknown>(\n `customers/${encodeURIComponent(customerId)}/microdeposits`,\n );\n } catch (error) {\n if ((error as { httpStatus?: unknown }).httpStatus === 404) {\n return [];\n }\n throw error;\n }\n if (!Array.isArray(response)) {\n throw new Error(\n 'Malformed response received from neo-bank microdeposits API',\n );\n }\n return response as NeoBankMicrodeposit[];\n }\n\n /**\n * Checks whether a Monad Money Account address is already registered for the\n * given Iron customer.\n *\n * @param params - Customer id and address to check.\n * @param params.customerId - Iron / MoonPay customer UUID.\n * @param params.address - Money Account address.\n * @returns Active, disabled, or absent registration status.\n */\n async getWalletRegistrationStatus({\n customerId,\n address,\n }: GetWalletRegistrationStatusParams): Promise<RegistrationStatus> {\n return await this.#getWalletRegistrationService().getRegistrationStatus({\n customerId,\n address,\n blockchain: 'Monad',\n });\n }\n\n /**\n * Submits a signed Monad Money Account ownership proof via neobank-proxy\n * `POST /neobank/addresses/crypto/selfhosted`.\n *\n * @param params - Signed ownership proof.\n * @returns Registered wallet record.\n */\n async registerSelfHostedWallet(\n params: RegisterSelfHostedWalletParams,\n ): Promise<RegistrationOutcome> {\n return await this.#getWalletRegistrationService().registerSelfHostedWallet({\n ...params,\n blockchain: 'Monad',\n });\n }\n\n /**\n * Resolves the MetaMask canonical profile id used as MoonPay's partner\n * `external_id` for neobank customer lookup.\n *\n * @returns Canonical profile id.\n */\n async #getCanonicalExternalId(): Promise<string> {\n const profile = await this.#messenger.call(\n 'AuthenticationController:getSessionProfile',\n );\n const canonical = profile?.canonicalProfileId;\n const externalId =\n typeof canonical === 'string' && canonical.length > 0\n ? canonical\n : profile?.profileId;\n if (typeof externalId !== 'string' || externalId.length === 0) {\n throw new Error(\n 'Unable to resolve MetaMask canonical profile id for MoonPay customer lookup',\n );\n }\n return externalId;\n }\n\n onRetry(\n listener: Parameters<ServicePolicy['onRetry']>[0],\n ): ReturnType<ServicePolicy['onRetry']> {\n return this.#policy.onRetry(listener);\n }\n\n onBreak(\n listener: Parameters<ServicePolicy['onBreak']>[0],\n ): ReturnType<ServicePolicy['onBreak']> {\n return this.#policy.onBreak(listener);\n }\n\n onDegraded(\n listener: Parameters<ServicePolicy['onDegraded']>[0],\n ): ReturnType<ServicePolicy['onDegraded']> {\n return this.#policy.onDegraded(listener);\n }\n}\n"]}
1
+ {"version":3,"file":"NeoBankService.js","sourceRoot":"","sources":["../src/NeoBankService.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,SAAS,GACV,MAAM,4BAA4B,CAAC;AAIpC,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAW1C,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EACL,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,kCAAkC,CAAC;AAM1C;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,SAAS,gBAAgB,CAAC,KAAc;IACtC,IAAI,KAAK,YAAY,SAAS,EAAE,CAAC;QAC/B,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC,UAAU,GAAG,GAAG,IAAI,KAAK,CAAC,UAAU,IAAI,GAAG,CAAC;IAC3D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AA8ID,MAAM,yBAAyB,GAAG;IAChC,aAAa;IACb,cAAc;IACd,oBAAoB;IACpB,kBAAkB;IAClB,gBAAgB;IAChB,6BAA6B;IAC7B,qBAAqB;IACrB,yBAAyB;IACzB,sBAAsB;IACtB,kBAAkB;IAClB,sBAAsB;IACtB,6BAA6B;IAC7B,0BAA0B;IAC1B,2BAA2B;IAC3B,wBAAwB;IACxB,0BAA0B;CAClB,CAAC;AAEX;;GAEG;AACH,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAyBpC;;;;;;;;;GASG;AACH,SAAS,cAAc,C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,kBAAkB,CAAC;QAC9C,MAAM,UAAU,GACd,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;YACnD,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC;QACzB,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC9D,MAAM,IAAI,KAAK,CACb,6EAA6E,CAC9E,CAAC;QACJ,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,OAAO,CACL,QAAiD;QAEjD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,CACL,QAAiD;QAEjD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAED,UAAU,CACR,QAAoD;QAEpD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;CACF","sourcesContent":["import type {\n CreateServicePolicyOptions,\n ServicePolicy,\n} from '@metamask/controller-utils';\nimport {\n createServicePolicy,\n handleWhen,\n HttpError,\n} from '@metamask/controller-utils';\nimport type { Messenger } from '@metamask/messenger';\nimport type { AuthenticationController } from '@metamask/profile-sync-controller';\n\nimport packageJson from '../package.json';\nimport type {\n AutorampDepositInstructions,\n AutorampDepositRailsSummary,\n AutorampRemoteSnapshot,\n AutorampTransactionSummary,\n PixDepositInstructions,\n UsBankDepositInstructions,\n UsBankDepositRail,\n} from './autoramp-types.js';\nimport type { NeoBankServiceMethodActions } from './NeoBankService-method-action-types.js';\nimport { RAMPS_SDK_VERSION, RampsEnvironment } from './RampsService.js';\nimport {\n WalletRegistrationError,\n WalletRegistrationService,\n} from './wallet-registration-service.js';\nimport type {\n RegistrationOutcome,\n RegistrationStatus,\n} from './wallet-registration-service.js';\n\n/**\n * Name of the NeoBankService messenger namespace.\n */\nexport const serviceName = 'NeoBankService';\n\n/**\n * Determines whether a failed neo-bank request is worth re-issuing.\n *\n * 4xx responses describe the request or the account's state (e.g. 403\n * \"Customer is not active\", 422 validation), so repeating them only multiplies\n * the same rejection. 429 stays retryable alongside 5xx and non-HTTP\n * network/timeout errors.\n *\n * @param error - Error thrown while performing the request.\n * @returns `true` when the error is worth retrying.\n */\nfunction isRetryableError(error: unknown): boolean {\n if (error instanceof HttpError) {\n if (error.httpStatus === 429) {\n return true;\n }\n return error.httpStatus < 400 || error.httpStatus >= 500;\n }\n return true;\n}\n\n/**\n * Raw autoramp payload from the MetaMask Ramp API neo-bank proxy.\n * Shape mirrors MoonPay Enterprise `GET /api/autoramps/{autoramp_id}`.\n * The Ramp API handles partner auth / headers; the client only sends the\n * MetaMask bearer token.\n */\nexport type NeoBankAutorampResponse = {\n id: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention -- MoonPay API field\n customer_id?: string;\n status: string;\n /**\n * Destination wallet when present on the proxy response.\n * Field name may evolve with the Ramp API contract.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention -- MoonPay API field\n wallet_address?: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention -- MoonPay API field\n recipient_account?: {\n address?: string;\n };\n /**\n * Some MoonPay autoramp responses put the destination under `recipient`\n * instead of `recipient_account`.\n */\n recipient?: {\n address?: string;\n };\n // eslint-disable-next-line @typescript-eslint/naming-convention -- MoonPay API field\n deposit_rails?: unknown[];\n};\n\n/**\n * A MoonPay microdeposit: a small test credit a bank sends when a user links\n * their account. Shape mirrors MoonPay `GET /api/customers/{id}/microdeposits`\n * and is returned unmodified. There is no id field, so consumers derive their\n * own key.\n */\nexport type NeoBankMicrodeposit = {\n /** Decimal string, e.g. `\"0.34\"`. */\n amount: string;\n /** Currency code, e.g. `\"USD\"`. */\n // eslint-disable-next-line @typescript-eslint/naming-convention -- MoonPay API field\n currency_code: string;\n /** ISO-8601 datetime. */\n // eslint-disable-next-line @typescript-eslint/naming-convention -- MoonPay API field\n created_at: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention -- MoonPay API field\n counterparty_name?: string;\n};\n\n/**\n * Status of one MoonPay rail ability. Only `Active` lets the customer use the\n * rail.\n */\nexport type NeoBankAbilityStatus =\n | 'Active'\n | 'Pending'\n | 'Unavailable'\n | 'Blocked'\n | 'Maintenance';\n\n/**\n * Rail statuses keyed by lowercase fiat code, then rail name, e.g. `usd.ach`\n * or `brl.pix_thirdparty`.\n */\nexport type NeoBankFiatAbilities = Record<\n string,\n Record<string, NeoBankAbilityStatus>\n>;\n\n/**\n * A MoonPay currency, as it appears in a customer's currency abilities.\n */\nexport type NeoBankAbilityCurrency =\n | { type: 'Fiat'; code: string }\n | { type: 'Crypto'; token: string; blockchain: string };\n\n/**\n * What a MoonPay customer can do with one currency.\n */\nexport type NeoBankCurrencyAbility = {\n currency: NeoBankAbilityCurrency;\n flows: ('Onramp' | 'Offramp' | 'Swap' | 'Mint' | 'Redeem')[];\n /** Mint/redeem counterparts. Empty except for mint-only brand tokens. */\n counterparts: NeoBankAbilityCurrency[];\n};\n\n/**\n * A MoonPay customer's rail abilities. Shape mirrors MoonPay\n * `GET /api/customers/{id}/abilities` and is returned unmodified.\n */\nexport type NeoBankCustomerAbilities = {\n // eslint-disable-next-line @typescript-eslint/naming-convention -- MoonPay API field\n fiat_deposit: NeoBankFiatAbilities;\n // eslint-disable-next-line @typescript-eslint/naming-convention -- MoonPay API field\n fiat_payout: NeoBankFiatAbilities;\n /** What the customer can do with each currency it can currently use. */\n currencies: NeoBankCurrencyAbility[];\n /** Why a rail is `Unavailable`, keyed by rail name (e.g. `ach`). */\n // eslint-disable-next-line @typescript-eslint/naming-convention -- MoonPay API field\n blocking_abilities: Record<string, string>;\n};\n\n/**\n * Optional headers for neo-bank mutating requests.\n */\nexport type NeoBankRequestOptions = {\n /**\n * Forwarded as `Idempotency-Key` when set (MoonPay requires it on some POSTs;\n * neobank-proxy generates one when omitted).\n */\n idempotencyKey?: string;\n};\n\n/**\n * Query string values accepted by neo-bank GET helpers.\n */\nexport type NeoBankQueryParams = Record<\n string,\n string | number | boolean | undefined | null\n>;\n\nexport type GetWalletRegistrationStatusParams = {\n customerId: string;\n address: string;\n};\n\nexport type RegisterSelfHostedWalletParams = {\n customerId: string;\n address: string;\n message: string;\n signature: string;\n /**\n * Forwarded as `Idempotency-Key` on the neobank-proxy POST. Prefer a stable\n * key across retries of the same ownership body.\n */\n idempotencyKey?: string;\n};\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'getAutoramp',\n 'getAutoramps',\n 'registerPixAddress',\n 'getAutorampQuote',\n 'createAutoramp',\n 'getAutorampQuoteForAutoramp',\n 'attachAutorampQuote',\n 'getCustomerByExternalId',\n 'getMoonpayCustomerId',\n 'getMicrodeposits',\n 'getCustomerAbilities',\n 'getWalletRegistrationStatus',\n 'registerSelfHostedWallet',\n 'getPixDepositInstructions',\n 'getDepositInstructions',\n 'listAutorampTransactions',\n] as const;\n\n/**\n * MoonPay's maximum `page_size` for `GET /api/autoramps`.\n */\nconst AUTORAMP_LIST_PAGE_SIZE = 100;\n\n/**\n * Actions that {@link NeoBankService} exposes to other consumers.\n */\nexport type NeoBankServiceActions = NeoBankServiceMethodActions;\n\ntype AllowedActions =\n | AuthenticationController.AuthenticationControllerGetBearerTokenAction\n | AuthenticationController.AuthenticationControllerGetSessionProfileAction;\n\nexport type NeoBankServiceEvents = never;\n\ntype AllowedEvents = never;\n\n/**\n * The messenger restricted to actions and events accessed by\n * {@link NeoBankService}.\n */\nexport type NeoBankServiceMessenger = Messenger<\n typeof serviceName,\n NeoBankServiceActions | AllowedActions,\n NeoBankServiceEvents | AllowedEvents\n>;\n\n/**\n * Builds a path under the neobank-proxy global prefix.\n *\n * Live neobank-proxy (#1124) mounts routes at `/neobank` on the on-ramp.api\n * host (ALB path routing, no rewrite). Prefer this over `/api/v2/...` so Core\n * matches the proxy that ships.\n *\n * @param path - Path under `/neobank` (no leading slash).\n * @returns Absolute path segment for URL join against the Ramp API host.\n */\nfunction getNeoBankPath(path: string): string {\n return `neobank/${path.replace(/^\\//u, '')}`;\n}\n\n/**\n * Resolves the Ramp API host for neo-bank calls (same hosts as {@link RampsService}).\n *\n * @param environment - Ramp environment.\n * @returns Base URL.\n */\nfunction getBaseUrl(environment: RampsEnvironment): string {\n switch (environment) {\n case RampsEnvironment.Production:\n return 'https://on-ramp.api.cx.metamask.io';\n case RampsEnvironment.Staging:\n return 'https://on-ramp.uat-api.cx.metamask.io';\n case RampsEnvironment.Development:\n return 'https://on-ramp.dev-api.cx.metamask.io';\n case RampsEnvironment.Local:\n return 'http://localhost:3000';\n default:\n throw new Error(`Invalid environment: ${String(environment)}`);\n }\n}\n\n/**\n * Maps a Ramp API / MoonPay-shaped autoramp response into the local remote snapshot.\n *\n * @param response - Proxy response body.\n * @returns Snapshot for the controller last-seen cursor.\n */\nexport function mapNeoBankAutorampToRemoteSnapshot(\n response: NeoBankAutorampResponse,\n): AutorampRemoteSnapshot {\n const depositRails = response.deposit_rails;\n const hasDepositRails =\n Array.isArray(depositRails) && depositRails.length > 0;\n const currency = readDepositRailCurrency(depositRails);\n const depositRailsSummary: AutorampDepositRailsSummary | undefined =\n hasDepositRails || response.status === 'Approved'\n ? {\n ready: response.status === 'Approved' && hasDepositRails,\n ...(currency ? { currency } : {}),\n }\n : undefined;\n\n return {\n id: response.id,\n customerId: response.customer_id,\n walletAddress:\n response.wallet_address !== undefined &&\n response.wallet_address.length > 0\n ? response.wallet_address\n : (response.recipient_account?.address ?? response.recipient?.address),\n status: response.status,\n depositRailsSummary,\n };\n}\n\n/**\n * Reads a MoonPay paged list (an object with an items array) or a raw array.\n *\n * @param response - Proxy JSON body.\n * @param malformedMessage - Error when the body is neither shape.\n * @returns Item list.\n */\nfunction readPagedItems(\n response: unknown,\n malformedMessage: string,\n): unknown[] {\n if (Array.isArray(response)) {\n return response;\n }\n if (\n response !== null &&\n typeof response === 'object' &&\n Array.isArray((response as { items?: unknown }).items)\n ) {\n return (response as { items: unknown[] }).items;\n }\n throw new Error(malformedMessage);\n}\n\n/**\n * Reads the next-page cursor from a MoonPay paged list.\n * A raw array has no further page.\n *\n * @param response - Proxy JSON body.\n * @returns Next cursor, or undefined when this page is the last.\n */\nfunction readNextCursor(response: unknown): string | undefined {\n if (\n response === null ||\n typeof response !== 'object' ||\n Array.isArray(response)\n ) {\n return undefined;\n }\n const { cursor } = response as { cursor?: unknown };\n return typeof cursor === 'string' && cursor.length > 0 ? cursor : undefined;\n}\n\n/**\n * Pulls the PIX deposit rail out of an autoramp `deposit_rails` array.\n *\n * @param depositRails - MoonPay `deposit_rails` value.\n * @returns PIX instructions, or null when no usable PIX rail is present.\n */\nexport function extractPixDepositInstructions(\n depositRails: unknown,\n): PixDepositInstructions | null {\n if (!Array.isArray(depositRails)) {\n return null;\n }\n for (const rail of depositRails) {\n if (rail === null || typeof rail !== 'object') {\n continue;\n }\n const record = rail as Record<string, unknown>;\n if (record.type !== 'Pix') {\n continue;\n }\n if (\n typeof record.br_code !== 'string' ||\n record.br_code.length === 0 ||\n typeof record.instruction !== 'string' ||\n record.instruction.length === 0\n ) {\n continue;\n }\n const instructions: PixDepositInstructions = {\n brCode: record.br_code,\n instruction: record.instruction,\n };\n if (typeof record.pix_key === 'string' && record.pix_key.length > 0) {\n instructions.pixKey = record.pix_key;\n }\n if (typeof record.expires_at === 'string' && record.expires_at.length > 0) {\n instructions.expiresAt = record.expires_at;\n }\n return instructions;\n }\n return null;\n}\n\n/**\n * US rails in the order to prefer when an autoramp lists more than one.\n */\nconst US_BANK_DEPOSIT_RAILS: readonly UsBankDepositRail[] = [\n 'ACH',\n 'Wire',\n 'RTP',\n 'FedNow',\n];\n\n/**\n * Fiat code implied by each MoonPay `deposit_rails` type that the app reads.\n */\nconst DEPOSIT_RAIL_CURRENCIES: Readonly<Record<string, string>> = {\n Pix: 'BRL',\n SEPA: 'EUR',\n ACH: 'USD',\n Wire: 'USD',\n RTP: 'USD',\n FedNow: 'USD',\n};\n\n/**\n * Reads a non-empty string field from a deposit rail.\n *\n * @param record - Deposit rail object.\n * @param key - MoonPay field name.\n * @returns The value, or undefined when missing or empty.\n */\nfunction readRailString(\n record: Record<string, unknown>,\n key: string,\n): string | undefined {\n const value = record[key];\n return typeof value === 'string' && value.length > 0 ? value : undefined;\n}\n\n/**\n * Lists the object entries of a MoonPay `deposit_rails` value.\n *\n * @param depositRails - MoonPay `deposit_rails` value.\n * @returns Rail objects, skipping anything that is not an object.\n */\nfunction readDepositRails(depositRails: unknown): Record<string, unknown>[] {\n if (!Array.isArray(depositRails)) {\n return [];\n }\n return depositRails.filter(\n (rail): rail is Record<string, unknown> =>\n rail !== null && typeof rail === 'object',\n );\n}\n\n/**\n * Fiat of the rail {@link NeoBankService.getDepositInstructions} would return.\n * Incomplete rails do not count, so a stub PIX entry cannot label an ACH account\n * as BRL. SEPA is included when it has an IBAN, which is the EUR equivalent.\n *\n * @param depositRails - MoonPay `deposit_rails` value.\n * @returns Uppercase fiat code, or undefined when no rail is complete.\n */\nfunction readDepositRailCurrency(depositRails: unknown): string | undefined {\n if (extractPixDepositInstructions(depositRails)) {\n return DEPOSIT_RAIL_CURRENCIES.Pix;\n }\n if (extractUsBankDepositInstructions(depositRails)) {\n return DEPOSIT_RAIL_CURRENCIES.ACH;\n }\n const sepa = readDepositRails(depositRails).find(\n (rail) => rail.type === 'SEPA' && readRailString(rail, 'iban'),\n );\n return sepa ? DEPOSIT_RAIL_CURRENCIES.SEPA : undefined;\n}\n\n/**\n * Pulls US bank transfer details out of an autoramp `deposit_rails` array.\n * ACH is preferred, then Wire, RTP, and FedNow.\n *\n * @param depositRails - MoonPay `deposit_rails` value.\n * @returns US bank details, or null when no complete US rail is present.\n */\nexport function extractUsBankDepositInstructions(\n depositRails: unknown,\n): UsBankDepositInstructions | null {\n const rails = readDepositRails(depositRails);\n for (const railType of US_BANK_DEPOSIT_RAILS) {\n for (const record of rails) {\n if (record.type !== railType) {\n continue;\n }\n const accountHolder = readRailString(record, 'recipient_name');\n const routingNumber = readRailString(record, 'routing_number');\n const accountNumber = readRailString(record, 'account_number');\n const bankName = readRailString(record, 'bank_name');\n if (!accountHolder || !routingNumber || !accountNumber || !bankName) {\n continue;\n }\n const instructions: UsBankDepositInstructions = {\n rail: railType,\n accountHolder,\n routingNumber,\n accountNumber,\n bankName,\n };\n const bankAddress = readRailString(record, 'bank_address');\n if (bankAddress) {\n instructions.bankAddress = bankAddress;\n }\n const accountHolderAddress = readRailString(record, 'recipient_address');\n if (accountHolderAddress) {\n instructions.accountHolderAddress = accountHolderAddress;\n }\n return instructions;\n }\n }\n return null;\n}\n\n/**\n * Reads a decimal amount from a MoonPay `Amount` object.\n *\n * @param value - `source_amount` or `destination_amount`.\n * @returns Decimal string, or undefined.\n */\nfunction readAmount(value: unknown): string | undefined {\n if (value === null || typeof value !== 'object') {\n return undefined;\n }\n const { amount } = value as { amount?: unknown };\n return typeof amount === 'string' && amount.length > 0 ? amount : undefined;\n}\n\n/**\n * Client for MetaMask Ramp API neo-bank endpoints (MoonPay Enterprise proxy).\n *\n * Lives alongside {@link RampsService} and {@link TransakService}. Authentication\n * and MoonPay partner headers are handled by the Ramp API; this service only\n * attaches the MetaMask user bearer token.\n *\n * Paths use the neobank-proxy `/neobank` prefix on the on-ramp.api host.\n */\nexport class NeoBankService {\n readonly name: typeof serviceName;\n\n readonly #messenger: NeoBankServiceMessenger;\n\n readonly #fetch: typeof fetch;\n\n readonly #policy: ServicePolicy;\n\n readonly #noRetryPolicy: ServicePolicy;\n\n readonly #environment: RampsEnvironment;\n\n readonly #context: string;\n\n readonly #baseUrlOverride?: string;\n\n #walletRegistrationService: WalletRegistrationService | undefined;\n\n #customerIdLookup:\n | { externalId: string; customerId: Promise<string> }\n | undefined;\n\n constructor({\n messenger,\n environment = RampsEnvironment.Staging,\n context,\n fetch: fetchFunction,\n policyOptions = {},\n baseUrlOverride,\n }: {\n messenger: NeoBankServiceMessenger;\n environment?: RampsEnvironment;\n context: string;\n fetch: typeof fetch;\n policyOptions?: CreateServicePolicyOptions;\n baseUrlOverride?: string;\n }) {\n this.name = serviceName;\n this.#messenger = messenger;\n this.#fetch = fetchFunction;\n this.#policy = createServicePolicy({\n retryFilterPolicy: handleWhen(isRetryableError),\n ...policyOptions,\n });\n this.#noRetryPolicy = createServicePolicy({\n retryFilterPolicy: handleWhen(isRetryableError),\n ...policyOptions,\n maxRetries: 0,\n });\n this.#environment = environment;\n this.#context = context;\n this.#baseUrlOverride = baseUrlOverride;\n\n this.#messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n #getBaseUrl(): string {\n if (this.#baseUrlOverride) {\n return this.#baseUrlOverride;\n }\n return getBaseUrl(this.#environment);\n }\n\n /**\n * Lazily builds the wallet registration client. Deferred so constructing the\n * service never resolves the base URL eagerly (an invalid environment only\n * throws when a request is made, matching the other neo-bank methods).\n *\n * @returns The wallet registration client.\n */\n #getWalletRegistrationService(): WalletRegistrationService {\n this.#walletRegistrationService ??= new WalletRegistrationService({\n fetch: this.#fetch,\n baseUrl: this.#getBaseUrl(),\n getAuthToken: async (): Promise<string> =>\n this.#messenger.call('AuthenticationController:getBearerToken'),\n getExternalId: async (): Promise<string> =>\n this.#getCanonicalExternalId(),\n });\n return this.#walletRegistrationService;\n }\n\n async #getRequestHeaders(\n options: NeoBankRequestOptions = {},\n ): Promise<Record<string, string>> {\n const bearerToken = await this.#messenger.call(\n 'AuthenticationController:getBearerToken',\n );\n const headers: Record<string, string> = {\n Authorization: `Bearer ${bearerToken}`,\n };\n if (options.idempotencyKey) {\n headers['Idempotency-Key'] = options.idempotencyKey;\n }\n return headers;\n }\n\n #buildUrl(path: string, query?: NeoBankQueryParams): URL {\n const url = new URL(getNeoBankPath(path), this.#getBaseUrl());\n url.searchParams.set('sdk', RAMPS_SDK_VERSION);\n url.searchParams.set('controller', packageJson.version);\n url.searchParams.set('context', this.#context);\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined && value !== null) {\n url.searchParams.set(key, String(value));\n }\n }\n }\n return url;\n }\n\n /**\n * Throws an {@link HttpError} that carries the upstream response body.\n *\n * The neobank-proxy mirrors MoonPay's status *and* body verbatim, so the\n * body is usually the only place that explains a 4xx (e.g. which field or\n * permission was rejected). Dropping it makes failures undiagnosable.\n *\n * @param url - Request URL, for context in the message.\n * @param response - Non-OK fetch response.\n */\n async #throwHttpError(url: URL, response: Response): Promise<never> {\n let detail = '';\n try {\n const body = (await response.text()).trim();\n if (body) {\n detail = ` - ${body.slice(0, 500)}`;\n }\n } catch {\n // Body already consumed or unreadable; the status alone still helps.\n }\n throw new HttpError(\n response.status,\n `Fetching '${url.toString()}' failed with status '${response.status}'${detail}`,\n );\n }\n\n async #getJson<ResponseBody>(\n path: string,\n query?: NeoBankQueryParams,\n ): Promise<ResponseBody> {\n const url = this.#buildUrl(path, query);\n return this.#policy.execute(async () => {\n const headers = await this.#getRequestHeaders();\n const fetchResponse = await this.#fetch(url, { headers });\n if (!fetchResponse.ok) {\n await this.#throwHttpError(url, fetchResponse);\n }\n return fetchResponse.json() as Promise<ResponseBody>;\n });\n }\n\n async #postJson<ResponseBody>(\n path: string,\n body: Record<string, unknown>,\n options: NeoBankRequestOptions,\n ): Promise<ResponseBody> {\n const url = this.#buildUrl(path);\n return this.#noRetryPolicy.execute(async () => {\n const headers = await this.#getRequestHeaders(options);\n headers['Content-Type'] = 'application/json';\n const fetchResponse = await this.#fetch(url, {\n method: 'POST',\n headers,\n body: JSON.stringify(body),\n });\n if (!fetchResponse.ok) {\n await this.#throwHttpError(url, fetchResponse);\n }\n return fetchResponse.json() as Promise<ResponseBody>;\n });\n }\n\n #mapAutorampResponse(\n response: NeoBankAutorampResponse,\n ): AutorampRemoteSnapshot {\n if (!response || typeof response !== 'object' || !response.id) {\n throw new Error('Malformed response received from neo-bank autoramp API');\n }\n return mapNeoBankAutorampToRemoteSnapshot(response);\n }\n\n /**\n * Fetches an autoramp account via neobank-proxy\n * `GET /neobank/autoramps/{autoramp_id}` (MoonPay\n * `GET /api/autoramps/{autoramp_id}`).\n *\n * @param autorampId - MoonPay / Ramp API autoramp id.\n * @returns Remote snapshot for controller apply/refresh.\n */\n async getAutoramp(autorampId: string): Promise<AutorampRemoteSnapshot> {\n const response = await this.#getJson<NeoBankAutorampResponse>(\n `autoramps/${encodeURIComponent(autorampId)}`,\n );\n return this.#mapAutorampResponse(response);\n }\n\n /**\n * Fetches autoramp accounts, following MoonPay `cursor` pages until the\n * list is complete.\n *\n * Pass `customerId` to scope the list to one MoonPay customer. Omitting it\n * asks the proxy for the partner-wide list. Each request uses MoonPay's\n * maximum `page_size`.\n *\n * @param params - Optional filters.\n * @param params.customerId - MoonPay customer id.\n * @returns Remote snapshots for every page.\n */\n async getAutoramps(\n params: { customerId?: string } = {},\n ): Promise<AutorampRemoteSnapshot[]> {\n const autoramps: unknown[] = [];\n const seenCursors = new Set<string>();\n let cursor: string | undefined;\n\n do {\n const response = await this.#getJson<unknown>('autoramps', {\n customer_id: params.customerId,\n page_size: AUTORAMP_LIST_PAGE_SIZE,\n cursor,\n });\n autoramps.push(\n ...readPagedItems(\n response,\n 'Malformed response received from neo-bank autoramps API',\n ),\n );\n const nextCursor = readNextCursor(response);\n if (nextCursor === undefined || seenCursors.has(nextCursor)) {\n break;\n }\n seenCursors.add(nextCursor);\n cursor = nextCursor;\n } while (cursor !== undefined);\n\n return autoramps.map((autoramp) =>\n this.#mapAutorampResponse(autoramp as NeoBankAutorampResponse),\n );\n }\n\n /**\n * Loads PIX deposit instructions for an autoramp.\n *\n * Calls `GET /neobank/autoramps/{id}` and reads the `type: Pix` rail\n * (`br_code`, `instruction`, optional `pix_key`). Returns null until MoonPay\n * has attached deposit rails (typically once the autoramp is Approved).\n *\n * @param autorampId - MoonPay autoramp id.\n * @returns PIX instructions, or null when the rail is not ready.\n */\n async getPixDepositInstructions(\n autorampId: string,\n ): Promise<PixDepositInstructions | null> {\n const response = await this.#getJson<NeoBankAutorampResponse>(\n `autoramps/${encodeURIComponent(autorampId)}`,\n );\n if (!response || typeof response !== 'object') {\n throw new Error('Malformed response received from neo-bank autoramp API');\n }\n return extractPixDepositInstructions(response.deposit_rails);\n }\n\n /**\n * Loads deposit details for an autoramp, whichever rail it has.\n *\n * Calls `GET /neobank/autoramps/{id}` and reads the PIX rail, or else a US\n * bank rail (`ACH`, `Wire`, `RTP`, or `FedNow`). Returns null until MoonPay\n * has attached a supported rail. MoonPay only verifies the rail at\n * `Approved`, so callers should not show these details before then.\n *\n * @param autorampId - MoonPay autoramp id.\n * @returns Deposit details discriminated by `type`, or null.\n */\n async getDepositInstructions(\n autorampId: string,\n ): Promise<AutorampDepositInstructions | null> {\n const response = await this.#getJson<NeoBankAutorampResponse>(\n `autoramps/${encodeURIComponent(autorampId)}`,\n );\n if (!response || typeof response !== 'object') {\n throw new Error('Malformed response received from neo-bank autoramp API');\n }\n const pix = extractPixDepositInstructions(response.deposit_rails);\n if (pix) {\n return { type: 'Pix', ...pix };\n }\n const usBank = extractUsBankDepositInstructions(response.deposit_rails);\n return usBank ? { type: 'UsBank', ...usBank } : null;\n }\n\n /**\n * Lists the newest page of transactions for one autoramp via\n * `GET /neobank/autoramp-transactions?autoramp_id=&sort_order=desc`.\n *\n * This is the first page only, not the full history. Poll `status`\n * (`Completed`, `Failed`, …). The deprecated `state` field is ignored.\n *\n * @param autorampId - MoonPay autoramp id.\n * @param options - Optional page size. Omitted requests use the API default.\n * @param options.pageSize - `page_size` query value. Callers that diff\n * status pass 50.\n * @returns Transaction summaries from the newest page.\n */\n async listAutorampTransactions(\n autorampId: string,\n options?: { pageSize?: number },\n ): Promise<AutorampTransactionSummary[]> {\n const response = await this.#getJson<unknown>('autoramp-transactions', {\n autoramp_id: autorampId,\n sort_order: 'desc',\n ...(options?.pageSize === undefined\n ? {}\n : { page_size: options.pageSize }),\n });\n const transactions = readPagedItems(\n response,\n 'Malformed response received from neo-bank autoramp transactions API',\n );\n return transactions.map((transaction) => {\n if (\n transaction === null ||\n typeof transaction !== 'object' ||\n typeof (transaction as { id?: unknown }).id !== 'string'\n ) {\n throw new Error(\n 'Malformed response received from neo-bank autoramp transactions API',\n );\n }\n const record = transaction as {\n id: string;\n autoramp_id?: unknown;\n status?: unknown;\n source_amount?: unknown;\n destination_amount?: unknown;\n created_at?: unknown;\n };\n if (typeof record.status !== 'string') {\n throw new Error(\n 'Malformed response received from neo-bank autoramp transactions API',\n );\n }\n const createdAt =\n typeof record.created_at === 'string' && record.created_at.length > 0\n ? record.created_at\n : undefined;\n return {\n id: record.id,\n autorampId:\n typeof record.autoramp_id === 'string'\n ? record.autoramp_id\n : autorampId,\n status: record.status,\n sourceAmount: readAmount(record.source_amount),\n destinationAmount: readAmount(record.destination_amount),\n createdAt,\n };\n });\n }\n\n /**\n * Registers a Pix address via neobank-proxy `POST /neobank/addresses/pix`.\n * Body is forwarded as opaque JSON (MoonPay address schema).\n *\n * @param body - Pix address registration payload.\n * @param options - Optional idempotency key.\n * @returns Parsed proxy JSON response.\n */\n async registerPixAddress(\n body: Record<string, unknown>,\n options: NeoBankRequestOptions = {},\n ): Promise<unknown> {\n return this.#postJson('addresses/pix', body, options);\n }\n\n /**\n * Fetches an autoramp quote via neobank-proxy `GET /neobank/autoramps/quote`.\n *\n * @param query - Quote query params (forwarded as-is).\n * @returns Parsed proxy JSON response.\n */\n async getAutorampQuote(query: NeoBankQueryParams = {}): Promise<unknown> {\n return this.#getJson('autoramps/quote', query);\n }\n\n /**\n * Creates an autoramp from a signed quote via neobank-proxy\n * `POST /neobank/autoramps` (MoonPay `POST /api/autoramps`).\n *\n * @param body - CreateAutoramp / signed-quote payload (forwarded as-is).\n * @param options - Optional idempotency key.\n * @returns Remote snapshot for controller apply/refresh.\n */\n async createAutoramp(\n body: Record<string, unknown>,\n options: NeoBankRequestOptions = {},\n ): Promise<AutorampRemoteSnapshot> {\n const response = await this.#postJson<NeoBankAutorampResponse>(\n 'autoramps',\n body,\n options,\n );\n return this.#mapAutorampResponse(response);\n }\n\n /**\n * Fetches a quote for an existing autoramp via neobank-proxy\n * `GET /neobank/autoramps/{autoramp_id}/quote`.\n *\n * @param autorampId - Autoramp id.\n * @param query - Quote query params (forwarded as-is).\n * @returns Parsed proxy JSON response.\n */\n async getAutorampQuoteForAutoramp(\n autorampId: string,\n query: NeoBankQueryParams = {},\n ): Promise<unknown> {\n return this.#getJson(\n `autoramps/${encodeURIComponent(autorampId)}/quote`,\n query,\n );\n }\n\n /**\n * Attaches a signed quote to an autoramp via neobank-proxy\n * `POST /neobank/autoramps/{autoramp_id}/quotes`.\n *\n * @param autorampId - Autoramp id.\n * @param body - Quote attachment payload (forwarded as-is).\n * @param options - Optional idempotency key.\n * @returns Parsed proxy JSON response.\n */\n async attachAutorampQuote(\n autorampId: string,\n body: Record<string, unknown>,\n options: NeoBankRequestOptions = {},\n ): Promise<unknown> {\n return this.#postJson(\n `autoramps/${encodeURIComponent(autorampId)}/quotes`,\n body,\n options,\n );\n }\n\n /**\n * Fetches a customer by partner external id via neobank-proxy\n * `GET /neobank/customers/{external_id}/external`.\n *\n * @param externalId - Partner-assigned external customer id.\n * @returns Parsed proxy JSON response.\n */\n async getCustomerByExternalId(externalId: string): Promise<unknown> {\n return this.#getJson(\n `customers/${encodeURIComponent(externalId)}/external`,\n );\n }\n\n /**\n * Resolves Iron's internal customer id via neobank-proxy customer lookup,\n * using the MetaMask canonical profile id as the partner `external_id`.\n *\n * @returns Iron's internal customer id.\n */\n async getMoonpayCustomerId(): Promise<string> {\n return await this.#getWalletRegistrationService().getMoonpayCustomerId();\n }\n\n /**\n * Lists the customer's bank-link microdeposits via neobank-proxy\n * `GET /neobank/customers/{customer_id}/microdeposits` (MoonPay\n * `GET /api/customers/{id}/microdeposits`).\n *\n * The customer id is resolved through {@link getMoonpayCustomerId} at most\n * once per service instance; concurrent callers share the in-flight lookup\n * and a failed lookup is retried by the next call. A 404 (from the customer\n * lookup or the list) means there is no customer or no deposits yet and\n * resolves `[]`. Any other non-2xx response throws an {@link HttpError}. The\n * customer lookup is a single attempt: it does not go through the retry\n * policy.\n *\n * @returns MoonPay microdeposits, unmodified.\n */\n async getMicrodeposits(): Promise<NeoBankMicrodeposit[]> {\n let response: unknown;\n try {\n const customerId = await this.#resolveCustomerId();\n response = await this.#getJson<unknown>(\n `customers/${encodeURIComponent(customerId)}/microdeposits`,\n );\n } catch (error) {\n if ((error as { httpStatus?: unknown }).httpStatus === 404) {\n return [];\n }\n throw error;\n }\n if (!Array.isArray(response)) {\n throw new Error(\n 'Malformed response received from neo-bank microdeposits API',\n );\n }\n return response as NeoBankMicrodeposit[];\n }\n\n /**\n * Reads the customer's rail abilities via neobank-proxy\n * `GET /neobank/customers/{customer_id}/abilities` (MoonPay\n * `GET /api/customers/{id}/abilities`).\n *\n * MoonPay rejects an autoramp create with a 422 when the rail it needs is not\n * `Active`, even for an `Active` customer. The customer id is resolved the\n * same way as in {@link getMicrodeposits}. Any non-2xx response, including a\n * 404 when there is no customer yet, throws an {@link HttpError}.\n *\n * @returns MoonPay customer abilities, unmodified.\n */\n async getCustomerAbilities(): Promise<NeoBankCustomerAbilities> {\n const customerId = await this.#resolveCustomerId();\n const response = await this.#getJson<unknown>(\n `customers/${encodeURIComponent(customerId)}/abilities`,\n );\n if (\n !response ||\n typeof response !== 'object' ||\n !('fiat_deposit' in response) ||\n !response.fiat_deposit ||\n typeof response.fiat_deposit !== 'object'\n ) {\n throw new Error(\n 'Malformed response received from neo-bank abilities API',\n );\n }\n return response as NeoBankCustomerAbilities;\n }\n\n /**\n * Resolves the MoonPay customer id through {@link getMoonpayCustomerId} at\n * most once per session profile, so a profile switch looks the customer up\n * again. Concurrent callers share the in-flight lookup and a failed lookup\n * is retried by the next call. The lookup is a single attempt: it does not\n * go through the retry policy.\n *\n * @returns Iron's internal customer id.\n */\n async #resolveCustomerId(): Promise<string> {\n const externalId = await this.#getCanonicalExternalId();\n if (this.#customerIdLookup?.externalId !== externalId) {\n const customerId = this.getMoonpayCustomerId().catch((error: unknown) => {\n if (this.#customerIdLookup?.externalId === externalId) {\n this.#customerIdLookup = undefined;\n }\n // The lookup runs outside the service policy and throws\n // WalletRegistrationError; surface HTTP failures as HttpError like\n // every other method.\n if (error instanceof WalletRegistrationError && error.httpStatus) {\n throw new HttpError(\n error.httpStatus,\n `Fetching neo-bank customer lookup failed with status '${error.httpStatus}'${error.body ? ` - ${error.body}` : ''}`,\n );\n }\n throw error;\n });\n this.#customerIdLookup = { externalId, customerId };\n }\n return await this.#customerIdLookup.customerId;\n }\n\n /**\n * Checks whether a Monad Money Account address is already registered for the\n * given Iron customer.\n *\n * @param params - Customer id and address to check.\n * @param params.customerId - Iron / MoonPay customer UUID.\n * @param params.address - Money Account address.\n * @returns Active, disabled, or absent registration status.\n */\n async getWalletRegistrationStatus({\n customerId,\n address,\n }: GetWalletRegistrationStatusParams): Promise<RegistrationStatus> {\n return await this.#getWalletRegistrationService().getRegistrationStatus({\n customerId,\n address,\n blockchain: 'Monad',\n });\n }\n\n /**\n * Submits a signed Monad Money Account ownership proof via neobank-proxy\n * `POST /neobank/addresses/crypto/selfhosted`.\n *\n * @param params - Signed ownership proof.\n * @returns Registered wallet record.\n */\n async registerSelfHostedWallet(\n params: RegisterSelfHostedWalletParams,\n ): Promise<RegistrationOutcome> {\n return await this.#getWalletRegistrationService().registerSelfHostedWallet({\n ...params,\n blockchain: 'Monad',\n });\n }\n\n /**\n * Resolves the MetaMask canonical profile id used as MoonPay's partner\n * `external_id` for neobank customer lookup.\n *\n * @returns Canonical profile id.\n */\n async #getCanonicalExternalId(): Promise<string> {\n const profile = await this.#messenger.call(\n 'AuthenticationController:getSessionProfile',\n );\n const canonical = profile?.canonicalProfileId;\n const externalId =\n typeof canonical === 'string' && canonical.length > 0\n ? canonical\n : profile?.profileId;\n if (typeof externalId !== 'string' || externalId.length === 0) {\n throw new Error(\n 'Unable to resolve MetaMask canonical profile id for MoonPay customer lookup',\n );\n }\n return externalId;\n }\n\n onRetry(\n listener: Parameters<ServicePolicy['onRetry']>[0],\n ): ReturnType<ServicePolicy['onRetry']> {\n return this.#policy.onRetry(listener);\n }\n\n onBreak(\n listener: Parameters<ServicePolicy['onBreak']>[0],\n ): ReturnType<ServicePolicy['onBreak']> {\n return this.#policy.onBreak(listener);\n }\n\n onDegraded(\n listener: Parameters<ServicePolicy['onDegraded']>[0],\n ): ReturnType<ServicePolicy['onDegraded']> {\n return this.#policy.onDegraded(listener);\n }\n}\n"]}
@@ -488,6 +488,17 @@ export type RampsControllerRefreshAutorampAction = {
488
488
  type: `RampsController:refreshAutoramp`;
489
489
  handler: RampsController['refreshAutoramp'];
490
490
  };
491
+ /**
492
+ * Fetches the MoonPay customer's rail abilities from the neo-bank proxy and
493
+ * stores them in `vbaCustomerAbilities`. A failed fetch throws and leaves the
494
+ * stored value unchanged.
495
+ *
496
+ * @returns The fetched abilities.
497
+ */
498
+ export type RampsControllerRefreshCustomerAbilitiesAction = {
499
+ type: `RampsController:refreshCustomerAbilities`;
500
+ handler: RampsController['refreshCustomerAbilities'];
501
+ };
491
502
  /**
492
503
  * Refreshes all known local autoramps from MoonPay.
493
504
  * Intended for app resume / unlock catch-up when webhooks were missed.
@@ -895,5 +906,5 @@ export type RampsControllerTransakGetActiveOrdersAction = {
895
906
  /**
896
907
  * Union of all RampsController action types.
897
908
  */
898
- export type RampsControllerMethodActions = RampsControllerExecuteRequestAction | RampsControllerAbortRequestAction | RampsControllerGetRequestStateAction | RampsControllerSetUserRegionAction | RampsControllerSetSelectedProviderAction | RampsControllerSetSelectedProviderForAssetAction | RampsControllerInitAction | RampsControllerGetCountriesAction | RampsControllerGetTokensAction | RampsControllerSetSelectedTokenAction | RampsControllerGetProvidersAction | RampsControllerGetPaymentMethodsAction | RampsControllerGetPaymentMethodsForContextAction | RampsControllerSetSelectedPaymentMethodAction | RampsControllerGetQuotesAction | RampsControllerGetQuoteWithFeesAction | RampsControllerAddOrderAction | RampsControllerRemoveOrderAction | RampsControllerSyncOrdersWithUserStorageAction | RampsControllerAddAutorampAction | RampsControllerCreateAutorampAction | RampsControllerRegisterMoneyAccountWalletAction | RampsControllerHydrateVbaOnboardingAction | RampsControllerRemoveAutorampAction | RampsControllerMarkAutorampAsNotifiedAction | RampsControllerApplyAutorampStatusFromPushAction | RampsControllerRefreshAutorampAction | RampsControllerRefreshAutorampsAction | RampsControllerRefreshAutorampTransactionsAction | RampsControllerStartOrderPollingAction | RampsControllerStopOrderPollingAction | RampsControllerGetBuyWidgetDataAction | RampsControllerGetFallbackBuyWidgetDataAction | RampsControllerAddPrecreatedOrderAction | RampsControllerGetOrderAction | RampsControllerGetOrderFromCallbackAction | RampsControllerTransakSetApiKeyAction | RampsControllerTransakSetAccessTokenAction | RampsControllerTransakClearAccessTokenAction | RampsControllerTransakSetAuthenticatedAction | RampsControllerTransakResetStateAction | RampsControllerTransakSendUserOtpAction | RampsControllerTransakVerifyUserOtpAction | RampsControllerTransakLogoutAction | RampsControllerTransakGetUserDetailsAction | RampsControllerTransakGetBuyQuoteAction | RampsControllerTransakGetKycRequirementAction | RampsControllerTransakGetAdditionalRequirementsAction | RampsControllerTransakCreateOrderAction | RampsControllerTransakGetOrderAction | RampsControllerTransakGetUserLimitsAction | RampsControllerTransakRequestOttAction | RampsControllerTransakGeneratePaymentWidgetUrlAction | RampsControllerTransakCreateWidgetUrlAction | RampsControllerTransakSubmitPurposeOfUsageFormAction | RampsControllerTransakPatchUserAction | RampsControllerTransakSubmitSsnDetailsAction | RampsControllerTransakConfirmPaymentAction | RampsControllerTransakGetTranslationAction | RampsControllerTransakGetIdProofStatusAction | RampsControllerTransakCancelOrderAction | RampsControllerTransakCancelAllActiveOrdersAction | RampsControllerTransakGetActiveOrdersAction;
909
+ export type RampsControllerMethodActions = RampsControllerExecuteRequestAction | RampsControllerAbortRequestAction | RampsControllerGetRequestStateAction | RampsControllerSetUserRegionAction | RampsControllerSetSelectedProviderAction | RampsControllerSetSelectedProviderForAssetAction | RampsControllerInitAction | RampsControllerGetCountriesAction | RampsControllerGetTokensAction | RampsControllerSetSelectedTokenAction | RampsControllerGetProvidersAction | RampsControllerGetPaymentMethodsAction | RampsControllerGetPaymentMethodsForContextAction | RampsControllerSetSelectedPaymentMethodAction | RampsControllerGetQuotesAction | RampsControllerGetQuoteWithFeesAction | RampsControllerAddOrderAction | RampsControllerRemoveOrderAction | RampsControllerSyncOrdersWithUserStorageAction | RampsControllerAddAutorampAction | RampsControllerCreateAutorampAction | RampsControllerRegisterMoneyAccountWalletAction | RampsControllerHydrateVbaOnboardingAction | RampsControllerRemoveAutorampAction | RampsControllerMarkAutorampAsNotifiedAction | RampsControllerApplyAutorampStatusFromPushAction | RampsControllerRefreshAutorampAction | RampsControllerRefreshCustomerAbilitiesAction | RampsControllerRefreshAutorampsAction | RampsControllerRefreshAutorampTransactionsAction | RampsControllerStartOrderPollingAction | RampsControllerStopOrderPollingAction | RampsControllerGetBuyWidgetDataAction | RampsControllerGetFallbackBuyWidgetDataAction | RampsControllerAddPrecreatedOrderAction | RampsControllerGetOrderAction | RampsControllerGetOrderFromCallbackAction | RampsControllerTransakSetApiKeyAction | RampsControllerTransakSetAccessTokenAction | RampsControllerTransakClearAccessTokenAction | RampsControllerTransakSetAuthenticatedAction | RampsControllerTransakResetStateAction | RampsControllerTransakSendUserOtpAction | RampsControllerTransakVerifyUserOtpAction | RampsControllerTransakLogoutAction | RampsControllerTransakGetUserDetailsAction | RampsControllerTransakGetBuyQuoteAction | RampsControllerTransakGetKycRequirementAction | RampsControllerTransakGetAdditionalRequirementsAction | RampsControllerTransakCreateOrderAction | RampsControllerTransakGetOrderAction | RampsControllerTransakGetUserLimitsAction | RampsControllerTransakRequestOttAction | RampsControllerTransakGeneratePaymentWidgetUrlAction | RampsControllerTransakCreateWidgetUrlAction | RampsControllerTransakSubmitPurposeOfUsageFormAction | RampsControllerTransakPatchUserAction | RampsControllerTransakSubmitSsnDetailsAction | RampsControllerTransakConfirmPaymentAction | RampsControllerTransakGetTranslationAction | RampsControllerTransakGetIdProofStatusAction | RampsControllerTransakCancelOrderAction | RampsControllerTransakCancelAllActiveOrdersAction | RampsControllerTransakGetActiveOrdersAction;
899
910
  //# sourceMappingURL=RampsController-method-action-types.d.ts.map