@metamask-previews/ramps-controller 29.0.0-preview-622cd8571 → 29.0.0-preview-9dfb538be

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
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
12
12
  - Add `TransakServiceInvalidateQueriesAction`, `TransakServiceCacheUpdatedEvent` and `TransakServiceGranularCacheUpdatedEvent` types, and include them in `TransakServiceActions` and `TransakServiceEvents` ([#11216](https://github.com/MetaMask/core/pull/11216))
13
13
  - Add `RampsServiceInvalidateQueriesAction`, `RampsServiceCacheUpdatedEvent` and `RampsServiceGranularCacheUpdatedEvent`, also included in `RampsServiceActions` and `RampsServiceEvents` ([#11214](https://github.com/MetaMask/core/pull/11214))
14
14
  - Add `NeoBankServiceInvalidateQueriesAction`, `NeoBankServiceCacheUpdatedEvent` and `NeoBankServiceGranularCacheUpdatedEvent`, also included in `NeoBankServiceActions` and `NeoBankServiceEvents` ([#10882](https://github.com/MetaMask/core/pull/10882))
15
+ - Add `SepaDepositInstructions` and `extractSepaDepositInstructions`; `NeoBankService.getDepositInstructions` now returns `{ type: 'Sepa' }` for an EUR autoramp with a SEPA deposit rail, including `paymentReference` from the autoramp's `inbound_payment_reference` when MoonPay uses pay-by-reference ([#XXXXX](https://github.com/MetaMask/core/pull/XXXXX))
15
16
 
16
17
  ### Changed
17
18
 
@@ -23,6 +24,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
23
24
  - `RampsServiceMessenger` now includes the `RampsService:invalidateQueries` action and the `RampsService:cacheUpdated` events. Messengers built from `RampsServiceActions` and `RampsServiceEvents` pick these up automatically.
24
25
  - **BREAKING:** `NeoBankService` now extends `BaseDataService` from `@metamask/base-data-service`, so reads and writes share one circuit breaker (previously each had its own) and repeated read failures can now block writes ([#10882](https://github.com/MetaMask/core/pull/10882))
25
26
  - `NeoBankServiceMessenger` now includes the `NeoBankService:invalidateQueries` action and `NeoBankService:cacheUpdated` events. Messengers built from `NeoBankServiceActions` / `NeoBankServiceEvents` pick these up automatically.
27
+ - **BREAKING:** `AutorampDepositInstructions` now includes a `Sepa` variant, so exhaustive switches on its `type` must handle it ([#XXXXX](https://github.com/MetaMask/core/pull/XXXXX))
28
+ - `NeoBankService.getDepositInstructions` returns `{ type: 'Sepa', iban, ... }` when the autoramp has a SEPA rail with an IBAN, after PIX and US bank rails. The result includes `paymentReference` when MoonPay returns an `inbound_payment_reference` for a pay-by-reference autoramp.
29
+ - `getMusdAutorampDepositRailReadiness` now checks the `sepa` rail for EUR ([#XXXXX](https://github.com/MetaMask/core/pull/XXXXX))
26
30
  - Concurrent identical `TransakService` reads are now deduplicated: while one request is in flight, identical calls reuse it instead of sending another. Reads still always hit the API ([#11216](https://github.com/MetaMask/core/pull/11216))
27
31
  - Responses are now validated, and a malformed response throws `Query function for "TransakService:<method>" returned an unexpected response: ...` for reads or `Mutation function for "TransakService:<method>" returned an unexpected response: ...` for writes. Previously the response was returned unchecked ([#11216](https://github.com/MetaMask/core/pull/11216))
28
32
  - Writes (every POST, PATCH and DELETE request) are no longer retried. Previously only `verifyUserOtp` was exempt from retries ([#11216](https://github.com/MetaMask/core/pull/11216))
@@ -49,9 +49,12 @@ export type NeoBankServiceGetPixDepositInstructionsAction = {
49
49
  * Loads deposit details for an autoramp, whichever rail it has.
50
50
  *
51
51
  * Calls `GET /neobank/autoramps/{id}` and reads the PIX rail, or else a US
52
- * bank rail (`ACH`, `Wire`, `RTP`, or `FedNow`). Returns null until MoonPay
53
- * has attached a supported rail. MoonPay only verifies the rail at
54
- * `Approved`, so callers should not show these details before then.
52
+ * bank rail (`ACH`, `Wire`, `RTP`, or `FedNow`), or else the SEPA rail.
53
+ * SEPA details also carry the autoramp's `inbound_payment_reference` as
54
+ * `paymentReference` when MoonPay uses pay-by-reference.
55
+ * Returns null until MoonPay has attached a supported rail. MoonPay only
56
+ * verifies the rail at `Approved`, so callers should not show these details
57
+ * before then.
55
58
  *
56
59
  * @param autorampId - MoonPay autoramp id.
57
60
  * @returns Deposit details discriminated by `type`, or null.
@@ -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;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,0CAA0C,GAAG;IACvD,IAAI,EAAE,uCAAuC,CAAC;IAC9C,OAAO,EAAE,cAAc,CAAC,wBAAwB,CAAC,CAAC;CACnD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,cAAc,CAAC,0BAA0B,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,cAAc,CAAC,oBAAoB,CAAC,CAAC;CAC/C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iC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BAA6B,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,wCAAwC,GACxC,+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,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;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,0CAA0C,GAAG;IACvD,IAAI,EAAE,uCAAuC,CAAC;IAC9C,OAAO,EAAE,cAAc,CAAC,wBAAwB,CAAC,CAAC;CACnD,CAAC;AAEF;;;;;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AAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,cAAc,CAAC,kBAAkB,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,cAAc,CAAC,sBAAsB,CAAC,CAAC;CACjD,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,wCAAwC,GACxC,+CAA+C,GAC/C,4CAA4C,CAAC"}
@@ -1 +1 @@
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"]}
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`), or else the SEPA rail.\n * SEPA details also carry the autoramp's `inbound_payment_reference` as\n * `paymentReference` when MoonPay uses pay-by-reference.\n * Returns null until MoonPay has attached a supported rail. MoonPay only\n * verifies the rail at `Approved`, so callers should not show these details\n * 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"]}
@@ -3,7 +3,7 @@ import type { CreateServicePolicyOptions, DataServiceCacheUpdatedEvent, DataServ
3
3
  import type { Messenger } from '@metamask/messenger';
4
4
  import type { AuthenticationController } from '@metamask/profile-sync-controller';
5
5
  import type { Json } from '@metamask/utils';
6
- import type { AutorampDepositInstructions, AutorampRemoteSnapshot, AutorampTransactionSummary, PixDepositInstructions, UsBankDepositInstructions } from './autoramp-types.js';
6
+ import type { AutorampDepositInstructions, AutorampRemoteSnapshot, AutorampTransactionSummary, PixDepositInstructions, SepaDepositInstructions, UsBankDepositInstructions } from './autoramp-types.js';
7
7
  import type { NeoBankServiceMethodActions } from './NeoBankService-method-action-types.js';
8
8
  import { RampsEnvironment } from './RampsService.js';
9
9
  import type { RegistrationOutcome, RegistrationStatus } from './wallet-registration-service.js';
@@ -37,6 +37,11 @@ export type NeoBankAutorampResponse = {
37
37
  address?: string;
38
38
  };
39
39
  deposit_rails?: unknown[];
40
+ /**
41
+ * Reference senders must include on transfers when the autoramp uses
42
+ * pay-by-reference. Absent or null otherwise.
43
+ */
44
+ inbound_payment_reference?: string | null;
40
45
  };
41
46
  /**
42
47
  * A MoonPay microdeposit: a small test credit a bank sends when a user links
@@ -173,6 +178,13 @@ export declare function extractPixDepositInstructions(depositRails: unknown): Pi
173
178
  * @returns US bank details, or null when no complete US rail is present.
174
179
  */
175
180
  export declare function extractUsBankDepositInstructions(depositRails: unknown): UsBankDepositInstructions | null;
181
+ /**
182
+ * Pulls SEPA transfer details out of an autoramp `deposit_rails` array.
183
+ *
184
+ * @param depositRails - MoonPay `deposit_rails` value.
185
+ * @returns SEPA details, or null when no usable SEPA rail is present.
186
+ */
187
+ export declare function extractSepaDepositInstructions(depositRails: unknown): SepaDepositInstructions | null;
176
188
  /**
177
189
  * Client for MetaMask Ramp API neo-bank endpoints (MoonPay Enterprise proxy).
178
190
  *
@@ -231,9 +243,12 @@ export declare class NeoBankService extends BaseDataService<typeof serviceName,
231
243
  * Loads deposit details for an autoramp, whichever rail it has.
232
244
  *
233
245
  * Calls `GET /neobank/autoramps/{id}` and reads the PIX rail, or else a US
234
- * bank rail (`ACH`, `Wire`, `RTP`, or `FedNow`). Returns null until MoonPay
235
- * has attached a supported rail. MoonPay only verifies the rail at
236
- * `Approved`, so callers should not show these details before then.
246
+ * bank rail (`ACH`, `Wire`, `RTP`, or `FedNow`), or else the SEPA rail.
247
+ * SEPA details also carry the autoramp's `inbound_payment_reference` as
248
+ * `paymentReference` when MoonPay uses pay-by-reference.
249
+ * Returns null until MoonPay has attached a supported rail. MoonPay only
250
+ * verifies the rail at `Approved`, so callers should not show these details
251
+ * before then.
237
252
  *
238
253
  * @param autorampId - MoonPay autoramp id.
239
254
  * @returns Deposit details discriminated by `type`, or null.
@@ -1 +1 @@
1
- {"version":3,"file":"NeoBankService.d.ts","sourceRoot":"","sources":["../src/NeoBankService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAc,MAAM,6BAA6B,CAAC;AAC1E,OAAO,KAAK,EACV,0BAA0B,EAC1B,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EACnC,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAGlF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAG5C,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,kB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O,CAAC,IAAI,CAAC,CAef;IAED;;;;;;;;OAQG;IACG,mBAAmB,CACvB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,IAAI,CAAC,CAUf;IAED;;;;;;OAMG;IACG,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ/D;IAED;;;;;OAKG;IACG,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,CAE5C;IAED;;;;;;;;;;;;;;OAcG;IACG,gBAAgB,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAqBvD;IAED;;;;;;;;;;;OAWG;IACG,oBAAoB,IAAI,OAAO,CAAC,wBAAwB,CAAC,CAa9D;IAkCD;;;;;;;;OAQG;IACG,2BAA2B,CAAC,EAChC,UAAU,EACV,OAAO,GACR,EAAE,iCAAiC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAMjE;IAED;;;;;;OAMG;IACG,wBAAwB,CAC5B,MAAM,EAAE,8BAA8B,GACrC,OAAO,CAAC,mBAAmB,CAAC,CAK9B;CAwBF"}
@@ -244,6 +244,15 @@ const DEPOSIT_RAIL_CURRENCIES = {
244
244
  RTP: 'USD',
245
245
  FedNow: 'USD',
246
246
  };
247
+ /**
248
+ * Reads a non-empty string.
249
+ *
250
+ * @param value - Candidate value.
251
+ * @returns The value, or undefined when missing, not a string, or empty.
252
+ */
253
+ function readNonEmptyString(value) {
254
+ return typeof value === 'string' && value.length > 0 ? value : undefined;
255
+ }
247
256
  /**
248
257
  * Reads a non-empty string field from a deposit rail.
249
258
  *
@@ -252,8 +261,7 @@ const DEPOSIT_RAIL_CURRENCIES = {
252
261
  * @returns The value, or undefined when missing or empty.
253
262
  */
254
263
  function readRailString(record, key) {
255
- const value = record[key];
256
- return typeof value === 'string' && value.length > 0 ? value : undefined;
264
+ return readNonEmptyString(record[key]);
257
265
  }
258
266
  /**
259
267
  * Lists the object entries of a MoonPay `deposit_rails` value.
@@ -282,8 +290,10 @@ function readDepositRailCurrency(depositRails) {
282
290
  if (extractUsBankDepositInstructions(depositRails)) {
283
291
  return DEPOSIT_RAIL_CURRENCIES.ACH;
284
292
  }
285
- const sepa = readDepositRails(depositRails).find((rail) => rail.type === 'SEPA' && readRailString(rail, 'iban'));
286
- return sepa ? DEPOSIT_RAIL_CURRENCIES.SEPA : undefined;
293
+ if (extractSepaDepositInstructions(depositRails)) {
294
+ return DEPOSIT_RAIL_CURRENCIES.SEPA;
295
+ }
296
+ return undefined;
287
297
  }
288
298
  /**
289
299
  * Pulls US bank transfer details out of an autoramp `deposit_rails` array.
@@ -326,6 +336,42 @@ export function extractUsBankDepositInstructions(depositRails) {
326
336
  }
327
337
  return null;
328
338
  }
339
+ /**
340
+ * Pulls SEPA transfer details out of an autoramp `deposit_rails` array.
341
+ *
342
+ * @param depositRails - MoonPay `deposit_rails` value.
343
+ * @returns SEPA details, or null when no usable SEPA rail is present.
344
+ */
345
+ export function extractSepaDepositInstructions(depositRails) {
346
+ for (const record of readDepositRails(depositRails)) {
347
+ if (record.type !== 'SEPA') {
348
+ continue;
349
+ }
350
+ const iban = readRailString(record, 'iban')?.replace(/\s+/gu, '');
351
+ if (!iban) {
352
+ continue;
353
+ }
354
+ const instructions = { iban };
355
+ const bic = readRailString(record, 'bic');
356
+ if (bic) {
357
+ instructions.bic = bic;
358
+ }
359
+ const accountHolder = readRailString(record, 'beneficiary_name');
360
+ if (accountHolder) {
361
+ instructions.accountHolder = accountHolder;
362
+ }
363
+ const bankName = readRailString(record, 'name');
364
+ if (bankName) {
365
+ instructions.bankName = bankName;
366
+ }
367
+ const bankAddress = readRailString(record, 'address');
368
+ if (bankAddress) {
369
+ instructions.bankAddress = bankAddress;
370
+ }
371
+ return instructions;
372
+ }
373
+ return null;
374
+ }
329
375
  /**
330
376
  * Reads a decimal amount from a MoonPay `Amount` object.
331
377
  *
@@ -559,9 +605,12 @@ export class NeoBankService extends BaseDataService {
559
605
  * Loads deposit details for an autoramp, whichever rail it has.
560
606
  *
561
607
  * Calls `GET /neobank/autoramps/{id}` and reads the PIX rail, or else a US
562
- * bank rail (`ACH`, `Wire`, `RTP`, or `FedNow`). Returns null until MoonPay
563
- * has attached a supported rail. MoonPay only verifies the rail at
564
- * `Approved`, so callers should not show these details before then.
608
+ * bank rail (`ACH`, `Wire`, `RTP`, or `FedNow`), or else the SEPA rail.
609
+ * SEPA details also carry the autoramp's `inbound_payment_reference` as
610
+ * `paymentReference` when MoonPay uses pay-by-reference.
611
+ * Returns null until MoonPay has attached a supported rail. MoonPay only
612
+ * verifies the rail at `Approved`, so callers should not show these details
613
+ * before then.
565
614
  *
566
615
  * @param autorampId - MoonPay autoramp id.
567
616
  * @returns Deposit details discriminated by `type`, or null.
@@ -574,13 +623,25 @@ export class NeoBankService extends BaseDataService {
574
623
  responseStruct: PixAutorampResponseStruct,
575
624
  queryFn: async () => this.#getJson(`autoramps/${encodeURIComponent(autorampId)}`),
576
625
  });
577
- const { deposit_rails: depositRails } = response;
626
+ const { deposit_rails: depositRails, inbound_payment_reference: inboundPaymentReference, } = response;
578
627
  const pix = extractPixDepositInstructions(depositRails);
579
628
  if (pix) {
580
629
  return { type: 'Pix', ...pix };
581
630
  }
582
631
  const usBank = extractUsBankDepositInstructions(depositRails);
583
- return usBank ? { type: 'UsBank', ...usBank } : null;
632
+ if (usBank) {
633
+ return { type: 'UsBank', ...usBank };
634
+ }
635
+ const sepa = extractSepaDepositInstructions(depositRails);
636
+ if (!sepa) {
637
+ return null;
638
+ }
639
+ const paymentReference = readNonEmptyString(inboundPaymentReference);
640
+ return {
641
+ type: 'Sepa',
642
+ ...sepa,
643
+ ...(paymentReference ? { paymentReference } : {}),
644
+ };
584
645
  }
585
646
  /**
586
647
  * Lists the newest page of transactions for one autoramp via
@@ -1 +1 @@
1
- {"version":3,"file":"NeoBankService.js","sourceRoot":"","sources":["../src/NeoBankService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AI,CAAC,iBAAiB,GAAG,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;QACtD,CAAC;QACD,OAAO,MAAM,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC;IACjD,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,2BAA2B,CAAC,EAChC,UAAU,EACV,OAAO,GAC2B;QAClC,OAAO,MAAM,IAAI,CAAC,6BAA6B,EAAE,CAAC,qBAAqB,CAAC;YACtE,UAAU;YACV,OAAO;YACP,UAAU,EAAE,OAAO;SACpB,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,wBAAwB,CAC5B,MAAsC;QAEtC,OAAO,MAAM,IAAI,CAAC,6BAA6B,EAAE,CAAC,wBAAwB,CAAC;YACzE,GAAG,MAAM;YACT,UAAU,EAAE,OAAO;SACpB,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,uBAAuB;QAC3B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CACvC,4CAA4C,CAC7C,CAAC;QACF,MAAM,SAAS,GAAG,OAAO,EAAE,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;CACF","sourcesContent":["import { BaseDataService, handleWhen } from '@metamask/base-data-service';\nimport type {\n CreateServicePolicyOptions,\n DataServiceCacheUpdatedEvent,\n DataServiceGranularCacheUpdatedEvent,\n DataServiceInvalidateQueriesAction,\n} from '@metamask/base-data-service';\nimport { HttpError } from '@metamask/controller-utils';\nimport type { Messenger } from '@metamask/messenger';\nimport type { AuthenticationController } from '@metamask/profile-sync-controller';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport { array, size, string, type, union } from '@metamask/superstruct';\nimport type { Json } from '@metamask/utils';\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 * Minimal shape check for an autoramp payload: it must carry a non-empty `id`.\n * The full mapping is done by {@link mapNeoBankAutorampToRemoteSnapshot}.\n */\nconst AutorampResponseStruct = type({ id: size(string(), 1, Infinity) });\n\n/**\n * The validated body of an autoramp response.\n */\ntype AutorampResponseBody = Infer<typeof AutorampResponseStruct>;\n\n/**\n * An autoramp payload read only for its `deposit_rails`: any object is\n * accepted, and {@link extractPixDepositInstructions} tolerates anything in\n * `deposit_rails`.\n */\nconst PixAutorampResponseStruct = type({});\n\n/**\n * Minimal shape check for the microdeposits list: an array of objects. The\n * items are returned unmodified.\n */\nconst MicrodepositListResponseStruct = array(type({}));\n\n/**\n * Minimal shape check for the customer abilities response: an object with a\n * `fiat_deposit` object. The rest is returned unmodified.\n */\nconst CustomerAbilitiesResponseStruct = type({ fiat_deposit: type({}) });\n\n/**\n * Minimal shape check for one autoramp transaction. Other fields are read\n * leniently when mapping.\n */\nconst AutorampTransactionResponseStruct = type({\n id: string(),\n status: string(),\n});\n\n/**\n * Builds a struct for a MoonPay list: either a paged object with an `items`\n * array or a raw array.\n *\n * @param itemStruct - Struct for each list item.\n * @returns Struct for the list response.\n */\nfunction pagedListStruct<Item>(\n itemStruct: Struct<Item>,\n): Struct<Item[] | { items: Item[] }> {\n return union([array(itemStruct), type({ items: array(itemStruct) })]);\n}\n\nconst AutorampListResponseStruct = pagedListStruct(AutorampResponseStruct);\n\nconst AutorampTransactionListResponseStruct = pagedListStruct(\n AutorampTransactionResponseStruct,\n);\n\n/**\n * Drops `undefined` values so query params can be used in a query key.\n *\n * @param query - Query params as passed by the caller.\n * @returns The same params without `undefined` values.\n */\nfunction toQueryKeyParams(query: NeoBankQueryParams): Record<string, Json> {\n return Object.fromEntries(\n Object.entries(query).filter(([, value]) => value !== undefined),\n ) as Record<string, Json>;\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 * Invalidates cached queries for {@link NeoBankService}.\n */\nexport type NeoBankServiceInvalidateQueriesAction =\n DataServiceInvalidateQueriesAction<typeof serviceName>;\n\n/**\n * Actions that {@link NeoBankService} exposes to other consumers.\n */\nexport type NeoBankServiceActions =\n | NeoBankServiceMethodActions\n | NeoBankServiceInvalidateQueriesAction;\n\ntype AllowedActions =\n | AuthenticationController.AuthenticationControllerGetBearerTokenAction\n | AuthenticationController.AuthenticationControllerGetSessionProfileAction;\n\n/**\n * Published when {@link NeoBankService}'s cache is updated.\n */\nexport type NeoBankServiceCacheUpdatedEvent = DataServiceCacheUpdatedEvent<\n typeof serviceName\n>;\n\n/**\n * Published when a key within {@link NeoBankService}'s cache is updated.\n */\nexport type NeoBankServiceGranularCacheUpdatedEvent =\n DataServiceGranularCacheUpdatedEvent<typeof serviceName>;\n\n/**\n * Events that {@link NeoBankService} exposes to other consumers.\n */\nexport type NeoBankServiceEvents =\n | NeoBankServiceCacheUpdatedEvent\n | NeoBankServiceGranularCacheUpdatedEvent;\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 the items of a validated MoonPay list (a paged object with an `items`\n * array, or a raw array).\n *\n * @param response - Validated proxy JSON body.\n * @returns Item list.\n */\nfunction readPagedItems<Item>(response: Item[] | { items: Item[] }): Item[] {\n return Array.isArray(response) ? response : response.items;\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 extends BaseDataService<\n typeof serviceName,\n NeoBankServiceMessenger\n> {\n readonly #fetch: typeof fetch;\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 super({\n name: serviceName,\n messenger,\n policyOptions: {\n retryFilterPolicy: handleWhen(isRetryableError),\n ...policyOptions,\n },\n });\n this.#fetch = fetchFunction;\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 /**\n * Performs one authenticated GET.\n *\n * @param path - Path under `/neobank`.\n * @param query - Optional query params.\n * @returns Parsed JSON body.\n */\n async #getJson<ResponseBody extends Json = Json>(\n path: string,\n query?: NeoBankQueryParams,\n ): Promise<ResponseBody> {\n const url = this.#buildUrl(path, query);\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 * Performs one authenticated JSON POST.\n *\n * @param path - Path under `/neobank`.\n * @param body - JSON request body.\n * @param options - Optional idempotency key.\n * @returns Parsed JSON body.\n */\n async #postJson<ResponseBody extends Json = Json>(\n path: string,\n body: Record<string, unknown>,\n options: NeoBankRequestOptions,\n ): Promise<ResponseBody> {\n const url = this.#buildUrl(path);\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 * 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.fetchQuery({\n queryKey: [`${this.name}:getAutoramp`, autorampId],\n staleTime: 0,\n gcTime: 0,\n responseStruct: AutorampResponseStruct,\n queryFn: async () =>\n this.#getJson<AutorampResponseBody>(\n `autoramps/${encodeURIComponent(autorampId)}`,\n ),\n });\n return mapNeoBankAutorampToRemoteSnapshot(\n response as NeoBankAutorampResponse,\n );\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: AutorampResponseBody[] = [];\n const seenCursors = new Set<string>();\n let cursor: string | undefined;\n\n do {\n const query: NeoBankQueryParams = {\n customer_id: params.customerId,\n page_size: AUTORAMP_LIST_PAGE_SIZE,\n cursor,\n };\n const response = await this.fetchQuery({\n queryKey: [`${this.name}:getAutoramps`, toQueryKeyParams(query)],\n staleTime: 0,\n gcTime: 0,\n responseStruct: AutorampListResponseStruct,\n queryFn: async () =>\n this.#getJson<Infer<typeof AutorampListResponseStruct>>(\n 'autoramps',\n query,\n ),\n });\n autoramps.push(...readPagedItems(response));\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 mapNeoBankAutorampToRemoteSnapshot(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.fetchQuery({\n queryKey: [`${this.name}:getPixDepositInstructions`, autorampId],\n staleTime: 0,\n gcTime: 0,\n responseStruct: PixAutorampResponseStruct,\n queryFn: async () =>\n this.#getJson<Infer<typeof PixAutorampResponseStruct>>(\n `autoramps/${encodeURIComponent(autorampId)}`,\n ),\n });\n return extractPixDepositInstructions(\n (response as Pick<NeoBankAutorampResponse, 'deposit_rails'>)\n .deposit_rails,\n );\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.fetchQuery({\n queryKey: [`${this.name}:getDepositInstructions`, autorampId],\n staleTime: 0,\n gcTime: 0,\n responseStruct: PixAutorampResponseStruct,\n queryFn: async () =>\n this.#getJson<Infer<typeof PixAutorampResponseStruct>>(\n `autoramps/${encodeURIComponent(autorampId)}`,\n ),\n });\n const { deposit_rails: depositRails } = response as Pick<\n NeoBankAutorampResponse,\n 'deposit_rails'\n >;\n const pix = extractPixDepositInstructions(depositRails);\n if (pix) {\n return { type: 'Pix', ...pix };\n }\n const usBank = extractUsBankDepositInstructions(depositRails);\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 query: NeoBankQueryParams = {\n autoramp_id: autorampId,\n sort_order: 'desc',\n ...(options?.pageSize === undefined\n ? {}\n : { page_size: options.pageSize }),\n };\n const response = await this.fetchQuery({\n queryKey: [\n `${this.name}:listAutorampTransactions`,\n toQueryKeyParams(query),\n ],\n staleTime: 0,\n gcTime: 0,\n responseStruct: AutorampTransactionListResponseStruct,\n queryFn: async () =>\n this.#getJson<Infer<typeof AutorampTransactionListResponseStruct>>(\n 'autoramp-transactions',\n query,\n ),\n });\n return readPagedItems(response).map((transaction) => {\n const record = transaction as typeof transaction & {\n autoramp_id?: unknown;\n source_amount?: unknown;\n destination_amount?: unknown;\n created_at?: unknown;\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<Json> {\n return this.executeMutation({\n mutationKey: [`${this.name}:registerPixAddress`],\n mutationFn: async () => this.#postJson('addresses/pix', body, options),\n });\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<Json> {\n return this.fetchQuery({\n queryKey: [`${this.name}:getAutorampQuote`, toQueryKeyParams(query)],\n staleTime: 0,\n gcTime: 0,\n queryFn: async () => this.#getJson('autoramps/quote', query),\n });\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.executeMutation({\n mutationKey: [`${this.name}:createAutoramp`],\n responseStruct: AutorampResponseStruct,\n mutationFn: async () =>\n this.#postJson<AutorampResponseBody>('autoramps', body, options),\n });\n return mapNeoBankAutorampToRemoteSnapshot(\n response as NeoBankAutorampResponse,\n );\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<Json> {\n return this.fetchQuery({\n queryKey: [\n `${this.name}:getAutorampQuoteForAutoramp`,\n autorampId,\n toQueryKeyParams(query),\n ],\n staleTime: 0,\n gcTime: 0,\n queryFn: async () =>\n this.#getJson(\n `autoramps/${encodeURIComponent(autorampId)}/quote`,\n query,\n ),\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<Json> {\n return this.executeMutation({\n mutationKey: [`${this.name}:attachAutorampQuote`, autorampId],\n mutationFn: async () =>\n this.#postJson(\n `autoramps/${encodeURIComponent(autorampId)}/quotes`,\n body,\n options,\n ),\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<Json> {\n return this.fetchQuery({\n queryKey: [`${this.name}:getCustomerByExternalId`, externalId],\n staleTime: 0,\n gcTime: 0,\n queryFn: async () =>\n this.#getJson(`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: Infer<typeof MicrodepositListResponseStruct>;\n try {\n const customerId = await this.#resolveCustomerId();\n response = await this.fetchQuery({\n queryKey: [`${this.name}:getMicrodeposits`, customerId],\n staleTime: 0,\n gcTime: 0,\n responseStruct: MicrodepositListResponseStruct,\n queryFn: async () =>\n this.#getJson<Infer<typeof MicrodepositListResponseStruct>>(\n `customers/${encodeURIComponent(customerId)}/microdeposits`,\n ),\n });\n } catch (error) {\n if ((error as { httpStatus?: unknown }).httpStatus === 404) {\n return [];\n }\n throw error;\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.fetchQuery({\n queryKey: [`${this.name}:getCustomerAbilities`, customerId],\n staleTime: 0,\n gcTime: 0,\n responseStruct: CustomerAbilitiesResponseStruct,\n queryFn: async () =>\n this.#getJson<Infer<typeof CustomerAbilitiesResponseStruct>>(\n `customers/${encodeURIComponent(customerId)}/abilities`,\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"]}
1
+ {"version":3,"file":"NeoBankService.js","sourceRoot":"","sources":["../src/NeoBankService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAO1E,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAIvD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGzE,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAY1C,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,KAA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G;IACH,KAAK,CAAC,uBAAuB;QAC3B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CACvC,4CAA4C,CAC7C,CAAC;QACF,MAAM,SAAS,GAAG,OAAO,EAAE,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;CACF","sourcesContent":["import { BaseDataService, handleWhen } from '@metamask/base-data-service';\nimport type {\n CreateServicePolicyOptions,\n DataServiceCacheUpdatedEvent,\n DataServiceGranularCacheUpdatedEvent,\n DataServiceInvalidateQueriesAction,\n} from '@metamask/base-data-service';\nimport { HttpError } from '@metamask/controller-utils';\nimport type { Messenger } from '@metamask/messenger';\nimport type { AuthenticationController } from '@metamask/profile-sync-controller';\nimport type { Infer, Struct } from '@metamask/superstruct';\nimport { array, size, string, type, union } from '@metamask/superstruct';\nimport type { Json } from '@metamask/utils';\n\nimport packageJson from '../package.json';\nimport type {\n AutorampDepositInstructions,\n AutorampDepositRailsSummary,\n AutorampRemoteSnapshot,\n AutorampTransactionSummary,\n PixDepositInstructions,\n SepaDepositInstructions,\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 * Minimal shape check for an autoramp payload: it must carry a non-empty `id`.\n * The full mapping is done by {@link mapNeoBankAutorampToRemoteSnapshot}.\n */\nconst AutorampResponseStruct = type({ id: size(string(), 1, Infinity) });\n\n/**\n * The validated body of an autoramp response.\n */\ntype AutorampResponseBody = Infer<typeof AutorampResponseStruct>;\n\n/**\n * An autoramp payload read only for its `deposit_rails`: any object is\n * accepted, and {@link extractPixDepositInstructions} tolerates anything in\n * `deposit_rails`.\n */\nconst PixAutorampResponseStruct = type({});\n\n/**\n * Minimal shape check for the microdeposits list: an array of objects. The\n * items are returned unmodified.\n */\nconst MicrodepositListResponseStruct = array(type({}));\n\n/**\n * Minimal shape check for the customer abilities response: an object with a\n * `fiat_deposit` object. The rest is returned unmodified.\n */\nconst CustomerAbilitiesResponseStruct = type({ fiat_deposit: type({}) });\n\n/**\n * Minimal shape check for one autoramp transaction. Other fields are read\n * leniently when mapping.\n */\nconst AutorampTransactionResponseStruct = type({\n id: string(),\n status: string(),\n});\n\n/**\n * Builds a struct for a MoonPay list: either a paged object with an `items`\n * array or a raw array.\n *\n * @param itemStruct - Struct for each list item.\n * @returns Struct for the list response.\n */\nfunction pagedListStruct<Item>(\n itemStruct: Struct<Item>,\n): Struct<Item[] | { items: Item[] }> {\n return union([array(itemStruct), type({ items: array(itemStruct) })]);\n}\n\nconst AutorampListResponseStruct = pagedListStruct(AutorampResponseStruct);\n\nconst AutorampTransactionListResponseStruct = pagedListStruct(\n AutorampTransactionResponseStruct,\n);\n\n/**\n * Drops `undefined` values so query params can be used in a query key.\n *\n * @param query - Query params as passed by the caller.\n * @returns The same params without `undefined` values.\n */\nfunction toQueryKeyParams(query: NeoBankQueryParams): Record<string, Json> {\n return Object.fromEntries(\n Object.entries(query).filter(([, value]) => value !== undefined),\n ) as Record<string, Json>;\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 * Reference senders must include on transfers when the autoramp uses\n * pay-by-reference. Absent or null otherwise.\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention -- MoonPay API field\n inbound_payment_reference?: string | null;\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 * Invalidates cached queries for {@link NeoBankService}.\n */\nexport type NeoBankServiceInvalidateQueriesAction =\n DataServiceInvalidateQueriesAction<typeof serviceName>;\n\n/**\n * Actions that {@link NeoBankService} exposes to other consumers.\n */\nexport type NeoBankServiceActions =\n | NeoBankServiceMethodActions\n | NeoBankServiceInvalidateQueriesAction;\n\ntype AllowedActions =\n | AuthenticationController.AuthenticationControllerGetBearerTokenAction\n | AuthenticationController.AuthenticationControllerGetSessionProfileAction;\n\n/**\n * Published when {@link NeoBankService}'s cache is updated.\n */\nexport type NeoBankServiceCacheUpdatedEvent = DataServiceCacheUpdatedEvent<\n typeof serviceName\n>;\n\n/**\n * Published when a key within {@link NeoBankService}'s cache is updated.\n */\nexport type NeoBankServiceGranularCacheUpdatedEvent =\n DataServiceGranularCacheUpdatedEvent<typeof serviceName>;\n\n/**\n * Events that {@link NeoBankService} exposes to other consumers.\n */\nexport type NeoBankServiceEvents =\n | NeoBankServiceCacheUpdatedEvent\n | NeoBankServiceGranularCacheUpdatedEvent;\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 the items of a validated MoonPay list (a paged object with an `items`\n * array, or a raw array).\n *\n * @param response - Validated proxy JSON body.\n * @returns Item list.\n */\nfunction readPagedItems<Item>(response: Item[] | { items: Item[] }): Item[] {\n return Array.isArray(response) ? response : response.items;\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.\n *\n * @param value - Candidate value.\n * @returns The value, or undefined when missing, not a string, or empty.\n */\nfunction readNonEmptyString(value: unknown): string | undefined {\n return typeof value === 'string' && value.length > 0 ? value : undefined;\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 return readNonEmptyString(record[key]);\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 if (extractSepaDepositInstructions(depositRails)) {\n return DEPOSIT_RAIL_CURRENCIES.SEPA;\n }\n return 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 * Pulls SEPA transfer details out of an autoramp `deposit_rails` array.\n *\n * @param depositRails - MoonPay `deposit_rails` value.\n * @returns SEPA details, or null when no usable SEPA rail is present.\n */\nexport function extractSepaDepositInstructions(\n depositRails: unknown,\n): SepaDepositInstructions | null {\n for (const record of readDepositRails(depositRails)) {\n if (record.type !== 'SEPA') {\n continue;\n }\n const iban = readRailString(record, 'iban')?.replace(/\\s+/gu, '');\n if (!iban) {\n continue;\n }\n const instructions: SepaDepositInstructions = { iban };\n const bic = readRailString(record, 'bic');\n if (bic) {\n instructions.bic = bic;\n }\n const accountHolder = readRailString(record, 'beneficiary_name');\n if (accountHolder) {\n instructions.accountHolder = accountHolder;\n }\n const bankName = readRailString(record, 'name');\n if (bankName) {\n instructions.bankName = bankName;\n }\n const bankAddress = readRailString(record, 'address');\n if (bankAddress) {\n instructions.bankAddress = bankAddress;\n }\n return instructions;\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 extends BaseDataService<\n typeof serviceName,\n NeoBankServiceMessenger\n> {\n readonly #fetch: typeof fetch;\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 super({\n name: serviceName,\n messenger,\n policyOptions: {\n retryFilterPolicy: handleWhen(isRetryableError),\n ...policyOptions,\n },\n });\n this.#fetch = fetchFunction;\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 /**\n * Performs one authenticated GET.\n *\n * @param path - Path under `/neobank`.\n * @param query - Optional query params.\n * @returns Parsed JSON body.\n */\n async #getJson<ResponseBody extends Json = Json>(\n path: string,\n query?: NeoBankQueryParams,\n ): Promise<ResponseBody> {\n const url = this.#buildUrl(path, query);\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 * Performs one authenticated JSON POST.\n *\n * @param path - Path under `/neobank`.\n * @param body - JSON request body.\n * @param options - Optional idempotency key.\n * @returns Parsed JSON body.\n */\n async #postJson<ResponseBody extends Json = Json>(\n path: string,\n body: Record<string, unknown>,\n options: NeoBankRequestOptions,\n ): Promise<ResponseBody> {\n const url = this.#buildUrl(path);\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 * 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.fetchQuery({\n queryKey: [`${this.name}:getAutoramp`, autorampId],\n staleTime: 0,\n gcTime: 0,\n responseStruct: AutorampResponseStruct,\n queryFn: async () =>\n this.#getJson<AutorampResponseBody>(\n `autoramps/${encodeURIComponent(autorampId)}`,\n ),\n });\n return mapNeoBankAutorampToRemoteSnapshot(\n response as NeoBankAutorampResponse,\n );\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: AutorampResponseBody[] = [];\n const seenCursors = new Set<string>();\n let cursor: string | undefined;\n\n do {\n const query: NeoBankQueryParams = {\n customer_id: params.customerId,\n page_size: AUTORAMP_LIST_PAGE_SIZE,\n cursor,\n };\n const response = await this.fetchQuery({\n queryKey: [`${this.name}:getAutoramps`, toQueryKeyParams(query)],\n staleTime: 0,\n gcTime: 0,\n responseStruct: AutorampListResponseStruct,\n queryFn: async () =>\n this.#getJson<Infer<typeof AutorampListResponseStruct>>(\n 'autoramps',\n query,\n ),\n });\n autoramps.push(...readPagedItems(response));\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 mapNeoBankAutorampToRemoteSnapshot(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.fetchQuery({\n queryKey: [`${this.name}:getPixDepositInstructions`, autorampId],\n staleTime: 0,\n gcTime: 0,\n responseStruct: PixAutorampResponseStruct,\n queryFn: async () =>\n this.#getJson<Infer<typeof PixAutorampResponseStruct>>(\n `autoramps/${encodeURIComponent(autorampId)}`,\n ),\n });\n return extractPixDepositInstructions(\n (response as Pick<NeoBankAutorampResponse, 'deposit_rails'>)\n .deposit_rails,\n );\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`), or else the SEPA rail.\n * SEPA details also carry the autoramp's `inbound_payment_reference` as\n * `paymentReference` when MoonPay uses pay-by-reference.\n * Returns null until MoonPay has attached a supported rail. MoonPay only\n * verifies the rail at `Approved`, so callers should not show these details\n * 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.fetchQuery({\n queryKey: [`${this.name}:getDepositInstructions`, autorampId],\n staleTime: 0,\n gcTime: 0,\n responseStruct: PixAutorampResponseStruct,\n queryFn: async () =>\n this.#getJson<Infer<typeof PixAutorampResponseStruct>>(\n `autoramps/${encodeURIComponent(autorampId)}`,\n ),\n });\n const {\n deposit_rails: depositRails,\n inbound_payment_reference: inboundPaymentReference,\n } = response as Pick<\n NeoBankAutorampResponse,\n 'deposit_rails' | 'inbound_payment_reference'\n >;\n const pix = extractPixDepositInstructions(depositRails);\n if (pix) {\n return { type: 'Pix', ...pix };\n }\n const usBank = extractUsBankDepositInstructions(depositRails);\n if (usBank) {\n return { type: 'UsBank', ...usBank };\n }\n const sepa = extractSepaDepositInstructions(depositRails);\n if (!sepa) {\n return null;\n }\n const paymentReference = readNonEmptyString(inboundPaymentReference);\n return {\n type: 'Sepa',\n ...sepa,\n ...(paymentReference ? { paymentReference } : {}),\n };\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 query: NeoBankQueryParams = {\n autoramp_id: autorampId,\n sort_order: 'desc',\n ...(options?.pageSize === undefined\n ? {}\n : { page_size: options.pageSize }),\n };\n const response = await this.fetchQuery({\n queryKey: [\n `${this.name}:listAutorampTransactions`,\n toQueryKeyParams(query),\n ],\n staleTime: 0,\n gcTime: 0,\n responseStruct: AutorampTransactionListResponseStruct,\n queryFn: async () =>\n this.#getJson<Infer<typeof AutorampTransactionListResponseStruct>>(\n 'autoramp-transactions',\n query,\n ),\n });\n return readPagedItems(response).map((transaction) => {\n const record = transaction as typeof transaction & {\n autoramp_id?: unknown;\n source_amount?: unknown;\n destination_amount?: unknown;\n created_at?: unknown;\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<Json> {\n return this.executeMutation({\n mutationKey: [`${this.name}:registerPixAddress`],\n mutationFn: async () => this.#postJson('addresses/pix', body, options),\n });\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<Json> {\n return this.fetchQuery({\n queryKey: [`${this.name}:getAutorampQuote`, toQueryKeyParams(query)],\n staleTime: 0,\n gcTime: 0,\n queryFn: async () => this.#getJson('autoramps/quote', query),\n });\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.executeMutation({\n mutationKey: [`${this.name}:createAutoramp`],\n responseStruct: AutorampResponseStruct,\n mutationFn: async () =>\n this.#postJson<AutorampResponseBody>('autoramps', body, options),\n });\n return mapNeoBankAutorampToRemoteSnapshot(\n response as NeoBankAutorampResponse,\n );\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<Json> {\n return this.fetchQuery({\n queryKey: [\n `${this.name}:getAutorampQuoteForAutoramp`,\n autorampId,\n toQueryKeyParams(query),\n ],\n staleTime: 0,\n gcTime: 0,\n queryFn: async () =>\n this.#getJson(\n `autoramps/${encodeURIComponent(autorampId)}/quote`,\n query,\n ),\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<Json> {\n return this.executeMutation({\n mutationKey: [`${this.name}:attachAutorampQuote`, autorampId],\n mutationFn: async () =>\n this.#postJson(\n `autoramps/${encodeURIComponent(autorampId)}/quotes`,\n body,\n options,\n ),\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<Json> {\n return this.fetchQuery({\n queryKey: [`${this.name}:getCustomerByExternalId`, externalId],\n staleTime: 0,\n gcTime: 0,\n queryFn: async () =>\n this.#getJson(`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: Infer<typeof MicrodepositListResponseStruct>;\n try {\n const customerId = await this.#resolveCustomerId();\n response = await this.fetchQuery({\n queryKey: [`${this.name}:getMicrodeposits`, customerId],\n staleTime: 0,\n gcTime: 0,\n responseStruct: MicrodepositListResponseStruct,\n queryFn: async () =>\n this.#getJson<Infer<typeof MicrodepositListResponseStruct>>(\n `customers/${encodeURIComponent(customerId)}/microdeposits`,\n ),\n });\n } catch (error) {\n if ((error as { httpStatus?: unknown }).httpStatus === 404) {\n return [];\n }\n throw error;\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.fetchQuery({\n queryKey: [`${this.name}:getCustomerAbilities`, customerId],\n staleTime: 0,\n gcTime: 0,\n responseStruct: CustomerAbilitiesResponseStruct,\n queryFn: async () =>\n this.#getJson<Infer<typeof CustomerAbilitiesResponseStruct>>(\n `customers/${encodeURIComponent(customerId)}/abilities`,\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"]}
@@ -58,6 +58,29 @@ export type UsBankDepositInstructions = {
58
58
  /** Account holder address, when MoonPay includes one. */
59
59
  accountHolderAddress?: string;
60
60
  };
61
+ /**
62
+ * SEPA transfer details from an autoramp `deposit_rails` entry (EUR), plus the
63
+ * autoramp's inbound payment reference when MoonPay uses pay-by-reference.
64
+ * Re-fetched for display; not stored on the autoramp cursor.
65
+ */
66
+ export type SepaDepositInstructions = {
67
+ /** The customer's IBAN, no spaces. Always present. */
68
+ iban: string;
69
+ /** The bank's BIC, when MoonPay includes one. */
70
+ bic?: string;
71
+ /** Account holder: the customer's verified name, when present. */
72
+ accountHolder?: string;
73
+ /** Name of the bank that holds the account, when present. */
74
+ bankName?: string;
75
+ /** Address of that bank, when present. */
76
+ bankAddress?: string;
77
+ /**
78
+ * Reference to include in the SEPA payment reference so MoonPay can match
79
+ * the deposit, when the autoramp uses pay-by-reference. Backed by the
80
+ * autoramp's `inbound_payment_reference`.
81
+ */
82
+ paymentReference?: string;
83
+ };
61
84
  /**
62
85
  * Deposit details for an autoramp, discriminated by `type`.
63
86
  */
@@ -65,7 +88,9 @@ export type AutorampDepositInstructions = ({
65
88
  type: 'Pix';
66
89
  } & PixDepositInstructions) | ({
67
90
  type: 'UsBank';
68
- } & UsBankDepositInstructions);
91
+ } & UsBankDepositInstructions) | ({
92
+ type: 'Sepa';
93
+ } & SepaDepositInstructions);
69
94
  /**
70
95
  * Polling summary of one autoramp transaction.
71
96
  * `status` is MoonPay `transaction_status` (`Completed`, `Failed`, …).
@@ -1 +1 @@
1
- {"version":3,"file":"autoramp-types.d.ts","sourceRoot":"","sources":["../src/autoramp-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,CAAC,EAAE,2BAA2B,CAAC;CACnD,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC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AAM,CAAC;IACb,kEAAkE;IAClE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,2BAA2B,GACnC,CAAC;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,GAAG,sBAAsB,CAAC,GAC1C,CAAC;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAAG,yBAAyB,CAAC,GAChD,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,uBAAuB,CAAC,CAAC;AAEjD;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"autoramp-types.js","sourceRoot":"","sources":["../src/autoramp-types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Non-PII deposit readiness summary from a neo-bank autoramp response.\n * Full deposit rail details (IBAN, etc.) should be re-fetched when needed.\n */\nexport type AutorampDepositRailsSummary = {\n /** Source currency code when known (e.g. EUR). */\n currency?: string;\n /** True when the autoramp is approved and deposit details may be shared. */\n ready: boolean;\n};\n\n/**\n * Minimal remote snapshot from `GET /neobank/autoramps/{id}` (or a push payload).\n * Identity fields may be omitted on partial proxy responses.\n */\nexport type AutorampRemoteSnapshot = {\n id: string;\n customerId?: string;\n walletAddress?: string;\n status: string;\n depositRailsSummary?: AutorampDepositRailsSummary;\n};\n\n/**\n * PIX \"Copia e Cola\" instructions from an autoramp `deposit_rails` entry.\n * Re-fetched for display; not stored on the autoramp cursor.\n */\nexport type PixDepositInstructions = {\n /** EMV BR Code the payer pastes into their bank app. */\n brCode: string;\n /** Human-readable payer guidance from MoonPay. */\n instruction: string;\n /** Bare PIX key, when MoonPay includes one. */\n pixKey?: string;\n /** Expiry of a one-time QR code. Absent for a reusable code. */\n expiresAt?: string;\n};\n\n/**\n * MoonPay `deposit_rails` types for a USD virtual account. They share the same\n * fields.\n */\nexport type UsBankDepositRail = 'ACH' | 'Wire' | 'RTP' | 'FedNow';\n\n/**\n * US bank transfer details from an autoramp `deposit_rails` entry.\n * Re-fetched for display; not stored on the autoramp cursor.\n */\nexport type UsBankDepositInstructions = {\n /** Which US rail these details came from. */\n rail: UsBankDepositRail;\n /** Account holder name, matching the customer's verified identity. */\n accountHolder: string;\n /** ABA routing number. */\n routingNumber: string;\n /** Virtual account number. */\n accountNumber: string;\n /** Name of the issuing bank. */\n bankName: string;\n /** Address of the issuing bank, when MoonPay includes one. */\n bankAddress?: string;\n /** Account holder address, when MoonPay includes one. */\n accountHolderAddress?: string;\n};\n\n/**\n * Deposit details for an autoramp, discriminated by `type`.\n */\nexport type AutorampDepositInstructions =\n | ({ type: 'Pix' } & PixDepositInstructions)\n | ({ type: 'UsBank' } & UsBankDepositInstructions);\n\n/**\n * Polling summary of one autoramp transaction.\n * `status` is MoonPay `transaction_status` (`Completed`, `Failed`, …).\n */\nexport type AutorampTransactionSummary = {\n id: string;\n autorampId: string;\n status: string;\n /** Source amount decimal string, when present (BRL for this flow). */\n sourceAmount?: string;\n /** Destination amount decimal string, when present (mUSD). */\n destinationAmount?: string;\n /** MoonPay `created_at` when present, for newest-first client selection. */\n createdAt?: string;\n};\n"]}
1
+ {"version":3,"file":"autoramp-types.js","sourceRoot":"","sources":["../src/autoramp-types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Non-PII deposit readiness summary from a neo-bank autoramp response.\n * Full deposit rail details (IBAN, etc.) should be re-fetched when needed.\n */\nexport type AutorampDepositRailsSummary = {\n /** Source currency code when known (e.g. EUR). */\n currency?: string;\n /** True when the autoramp is approved and deposit details may be shared. */\n ready: boolean;\n};\n\n/**\n * Minimal remote snapshot from `GET /neobank/autoramps/{id}` (or a push payload).\n * Identity fields may be omitted on partial proxy responses.\n */\nexport type AutorampRemoteSnapshot = {\n id: string;\n customerId?: string;\n walletAddress?: string;\n status: string;\n depositRailsSummary?: AutorampDepositRailsSummary;\n};\n\n/**\n * PIX \"Copia e Cola\" instructions from an autoramp `deposit_rails` entry.\n * Re-fetched for display; not stored on the autoramp cursor.\n */\nexport type PixDepositInstructions = {\n /** EMV BR Code the payer pastes into their bank app. */\n brCode: string;\n /** Human-readable payer guidance from MoonPay. */\n instruction: string;\n /** Bare PIX key, when MoonPay includes one. */\n pixKey?: string;\n /** Expiry of a one-time QR code. Absent for a reusable code. */\n expiresAt?: string;\n};\n\n/**\n * MoonPay `deposit_rails` types for a USD virtual account. They share the same\n * fields.\n */\nexport type UsBankDepositRail = 'ACH' | 'Wire' | 'RTP' | 'FedNow';\n\n/**\n * US bank transfer details from an autoramp `deposit_rails` entry.\n * Re-fetched for display; not stored on the autoramp cursor.\n */\nexport type UsBankDepositInstructions = {\n /** Which US rail these details came from. */\n rail: UsBankDepositRail;\n /** Account holder name, matching the customer's verified identity. */\n accountHolder: string;\n /** ABA routing number. */\n routingNumber: string;\n /** Virtual account number. */\n accountNumber: string;\n /** Name of the issuing bank. */\n bankName: string;\n /** Address of the issuing bank, when MoonPay includes one. */\n bankAddress?: string;\n /** Account holder address, when MoonPay includes one. */\n accountHolderAddress?: string;\n};\n\n/**\n * SEPA transfer details from an autoramp `deposit_rails` entry (EUR), plus the\n * autoramp's inbound payment reference when MoonPay uses pay-by-reference.\n * Re-fetched for display; not stored on the autoramp cursor.\n */\nexport type SepaDepositInstructions = {\n /** The customer's IBAN, no spaces. Always present. */\n iban: string;\n /** The bank's BIC, when MoonPay includes one. */\n bic?: string;\n /** Account holder: the customer's verified name, when present. */\n accountHolder?: string;\n /** Name of the bank that holds the account, when present. */\n bankName?: string;\n /** Address of that bank, when present. */\n bankAddress?: string;\n /**\n * Reference to include in the SEPA payment reference so MoonPay can match\n * the deposit, when the autoramp uses pay-by-reference. Backed by the\n * autoramp's `inbound_payment_reference`.\n */\n paymentReference?: string;\n};\n\n/**\n * Deposit details for an autoramp, discriminated by `type`.\n */\nexport type AutorampDepositInstructions =\n | ({ type: 'Pix' } & PixDepositInstructions)\n | ({ type: 'UsBank' } & UsBankDepositInstructions)\n | ({ type: 'Sepa' } & SepaDepositInstructions);\n\n/**\n * Polling summary of one autoramp transaction.\n * `status` is MoonPay `transaction_status` (`Completed`, `Failed`, …).\n */\nexport type AutorampTransactionSummary = {\n id: string;\n autorampId: string;\n status: string;\n /** Source amount decimal string, when present (BRL for this flow). */\n sourceAmount?: string;\n /** Destination amount decimal string, when present (mUSD). */\n destinationAmount?: string;\n /** MoonPay `created_at` when present, for newest-first client selection. */\n createdAt?: string;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"autorampAccount.d.ts","sourceRoot":"","sources":["../src/autorampAccount.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACV,2BAA2B,EAC3B,sBAAsB,EACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAEpE,YAAY,EACV,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B;;;;GAIG;AACH,oBAAY,cAAc;IACxB,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,WAAW,gBAAgB;IAC3B,mBAAmB,wBAAwB;IAC3C,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,SAAS,cAAc;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,2BAA2B;IAC3B,EAAE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WAAW,CAAC,cAAc,CAGjE,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,WAAW,CAAC,cAAc,CAIhE,CAAC;AAEH;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAExE;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,cAAc,GAAG,MAAM,GAC9B,cAAc,CAKhB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;IACjC,mBAAmB,CAAC,EAAE,2BAA2B,CAAC;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,eAAe,CAalB;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,2BAA2B,GAAG,SAAS,EAC9C,MAAM,EAAE,2BAA2B,GAAG,SAAS,GAC9C,2BAA2B,GAAG,SAAS,CAYzC;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,eAAe,GAAG,IAAI,EAC7B,MAAM,EAAE,sBAAsB,GAC7B,+BAA+B,CAuDjC;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,eAAe,GACvB,eAAe,CAKjB"}
@@ -58,11 +58,14 @@ export function buildBrazilMusdAutorampRequest(walletAddress) {
58
58
  /**
59
59
  * Deposit rails MoonPay needs Active before it accepts a
60
60
  * {@link buildMusdAutorampRequest} create, keyed by fiat code. neobank-proxy
61
- * sends every create as third-party, so that rail is required too.
61
+ * normally sends creates as third-party, so that rail is required too. EUR is
62
+ * the exception: the proxy falls back to a first-party autoramp when
63
+ * `sepa_thirdparty` is not Active, so only the base rail is required.
62
64
  */
63
65
  const MUSD_AUTORAMP_REQUIRED_DEPOSIT_RAILS = {
64
66
  BRL: ['pix', 'pix_thirdparty'],
65
67
  USD: ['ach', 'ach_thirdparty'],
68
+ EUR: ['sepa'],
66
69
  };
67
70
  const BLOCKED_ABILITY_STATUSES = new Set([
68
71
  'Unavailable',
@@ -1 +1 @@
1
- {"version":3,"file":"autorampAccount.js","sourceRoot":"","sources":["../src/autorampAccount.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH;;;;GAIG;AACH,MAAM,CAAN,IAAY,cAQX;AARD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,2CAAyB,CAAA;IACzB,6CAA2B,CAAA;IAC3B,6DAA2C,CAAA;IAC3C,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;IACrB,yCAAuB,CAAA;AACzB,CAAC,EARW,cAAc,KAAd,cAAc,QAQzB;AAwCD;;;;;;;;;GASG;AACH,MAAM,UAAU,wBAAwB,CACtC,aAAqB,EACrB,kBAA0B;IAE1B,OAAO;QACL,iBAAiB,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC;QAC/D,oBAAoB,EAAE;YACpB,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,MAAM;YACb,UAAU,EAAE,OAAO;SACpB;QACD,iBAAiB,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,OAAO;YACd,OAAO,EAAE,aAAa;SACvB;QACD,qBAAqB,EAAE,KAAK;KAC7B,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,8BAA8B,CAC5C,aAAqB;IAErB,OAAO,wBAAwB,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,oCAAoC,GAEtC;IACF,GAAG,EAAE,CAAC,KAAK,EAAE,gBAAgB,CAAC;IAC9B,GAAG,EAAE,CAAC,KAAK,EAAE,gBAAgB,CAAC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,EAAE,YAAY;QACpB,cAAc,EAAE,cAAc;QAC9B,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,mBAAmB,EAAE,wBAAwB,CAC3C,KAAK,CAAC,mBAAmB,EACzB,MAAM,CAAC,mBAAmB,CAC3B;KACF,CAAC;IAEF,OAAO;QACL,OAAO;QACP,cAAc;QACd,aAAa;QACb,YAAY;KACb,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAwB;IAExB,OAAO;QACL,GAAG,OAAO;QACV,iBAAiB,EAAE,OAAO,CAAC,MAAM;KAClC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Local + remote models for MoonPay Enterprise autoramp accounts.\n * Separate from {@link RampsOrder}: autoramps are standing routes; orders are payments.\n */\n\nimport type {\n AutorampDepositRailsSummary,\n AutorampRemoteSnapshot,\n} from './autoramp-types.js';\nimport type { NeoBankCustomerAbilities } from './NeoBankService.js';\n\nexport type {\n AutorampDepositRailsSummary,\n AutorampRemoteSnapshot,\n} from './autoramp-types.js';\n\n/**\n * Autoramp lifecycle statuses from MoonPay Enterprise.\n *\n * @see https://dev.enterprise.moonpay.com/autoramp-status\n */\nexport enum AutorampStatus {\n Created = 'Created',\n Authorized = 'Authorized',\n EditPending = 'EditPending',\n DepositAccountAdded = 'DepositAccountAdded',\n Approved = 'Approved',\n Rejected = 'Rejected',\n Cancelled = 'Cancelled',\n}\n\n/**\n * Local controller representation of an autoramp account.\n */\nexport type AutorampAccount = {\n /** MoonPay autoramp id. */\n id: string;\n /** MoonPay customer id. */\n customerId: string;\n /** Destination wallet address associated with this autoramp. */\n walletAddress: string;\n /** Latest status from MoonPay (source of truth after refresh). */\n status: AutorampStatus;\n /**\n * Status observed before the most recent remote apply.\n * Used for transition UX / analytics (e.g. Authorized → Approved).\n */\n lastSeenStatus: AutorampStatus;\n /**\n * Last status for which the UI already showed a notification.\n * Prevents duplicate toasts across refresh and push.\n */\n notifiedForStatus?: AutorampStatus;\n /** Epoch ms of the last local update from remote or push. */\n updatedAt: number;\n /** Optional non-PII deposit readiness cache. */\n depositRailsSummary?: AutorampDepositRailsSummary;\n};\n\n/**\n * Controller-facing payload for creating an autoramp.\n *\n * Mirrors the MoonPay `POST /api/autoramps` body that\n * {@link NeoBankService.createAutoramp} forwards opaquely, minus `customer_id`:\n * `RampsController.createAutoramp` injects the vendor customer id resolved from\n * Profile Sync, so callers never supply (or need to know) it.\n */\nexport type CreateAutorampRequest = Record<string, unknown>;\n\n/**\n * Standing fiat → mUSD autoramp for a Money Account on Monad.\n *\n * `customer_id` is omitted; {@link RampsController.createAutoramp} injects it.\n * The fiat code is required: this helper does not default to BRL.\n *\n * @param walletAddress - Money Account address that receives mUSD.\n * @param sourceCurrencyCode - Fiat code placed in `source_currencies[0].code`.\n * @returns MoonPay `POST /autoramps` market body.\n */\nexport function buildMusdAutorampRequest(\n walletAddress: string,\n sourceCurrencyCode: string,\n): CreateAutorampRequest {\n return {\n source_currencies: [{ type: 'Fiat', code: sourceCurrencyCode }],\n destination_currency: {\n type: 'Crypto',\n token: 'mUSD',\n blockchain: 'Monad',\n },\n recipient_account: {\n type: 'Crypto',\n chain: 'Monad',\n address: walletAddress,\n },\n source_is_third_party: false,\n };\n}\n\n/**\n * Standing BRL → mUSD autoramp for a Money Account on Monad.\n *\n * Wrapper around {@link buildMusdAutorampRequest} with code `BRL`.\n * `customer_id` is omitted; {@link RampsController.createAutoramp} injects it.\n *\n * @param walletAddress - Money Account address that receives mUSD.\n * @returns MoonPay `POST /autoramps` market body.\n */\nexport function buildBrazilMusdAutorampRequest(\n walletAddress: string,\n): CreateAutorampRequest {\n return buildMusdAutorampRequest(walletAddress, 'BRL');\n}\n\n/**\n * Deposit rails MoonPay needs Active before it accepts a\n * {@link buildMusdAutorampRequest} create, keyed by fiat code. neobank-proxy\n * sends every create as third-party, so that rail is required too.\n */\nconst MUSD_AUTORAMP_REQUIRED_DEPOSIT_RAILS: Readonly<\n Record<string, readonly string[]>\n> = {\n BRL: ['pix', 'pix_thirdparty'],\n USD: ['ach', 'ach_thirdparty'],\n};\n\nconst BLOCKED_ABILITY_STATUSES: ReadonlySet<string> = new Set([\n 'Unavailable',\n 'Blocked',\n]);\n\n/**\n * Whether the deposit rails a fiat → mUSD autoramp needs are usable.\n *\n * - `active`: every required rail is Active, or the fiat has none.\n * - `pending`: a required rail is not Active yet (Pending, Maintenance or\n * missing), so MoonPay would reject the create for now.\n * - `blocked`: a required rail is Unavailable or Blocked.\n */\nexport type MusdAutorampDepositRailReadiness = 'active' | 'pending' | 'blocked';\n\n/**\n * Reads the deposit rail readiness for a fiat → mUSD autoramp from the\n * customer's abilities.\n *\n * @param abilities - Customer abilities, e.g. `vbaCustomerAbilities`.\n * @param sourceCurrencyCode - Fiat code passed to\n * {@link buildMusdAutorampRequest}.\n * @returns The rail readiness.\n */\nexport function getMusdAutorampDepositRailReadiness(\n abilities: NeoBankCustomerAbilities,\n sourceCurrencyCode: string,\n): MusdAutorampDepositRailReadiness {\n const code = sourceCurrencyCode.toUpperCase();\n const rails = MUSD_AUTORAMP_REQUIRED_DEPOSIT_RAILS[code];\n if (!rails) {\n return 'active';\n }\n const currencyRails = abilities.fiat_deposit[code.toLowerCase()] ?? {};\n const statuses = rails.map((rail) => currencyRails[rail]);\n if (\n statuses.some(\n (status) => status !== undefined && BLOCKED_ABILITY_STATUSES.has(status),\n )\n ) {\n return 'blocked';\n }\n return statuses.every((status) => status === 'Active') ? 'active' : 'pending';\n}\n\n/**\n * Result of applying a remote autoramp snapshot onto local state.\n */\nexport type ApplyAutorampRemoteStatusResult = {\n account: AutorampAccount;\n previousStatus: AutorampStatus;\n statusChanged: boolean;\n /** True when status changed and UI has not yet notified for the new status. */\n shouldNotify: boolean;\n};\n\n/**\n * Terminal autoramp statuses — no further lifecycle progress expected.\n */\nexport const TERMINAL_AUTORAMP_STATUSES: ReadonlySet<AutorampStatus> = new Set([\n AutorampStatus.Rejected,\n AutorampStatus.Cancelled,\n]);\n\n/**\n * Statuses that commonly warrant user-visible transition UX (toast / banner).\n */\nexport const NOTABLE_AUTORAMP_STATUSES: ReadonlySet<AutorampStatus> = new Set([\n AutorampStatus.Approved,\n AutorampStatus.Rejected,\n AutorampStatus.Cancelled,\n]);\n\n/**\n * Whether an autoramp status is terminal.\n *\n * @param status - Status to test.\n * @returns Whether the status is terminal.\n */\nexport function isTerminalAutorampStatus(status: AutorampStatus): boolean {\n return TERMINAL_AUTORAMP_STATUSES.has(status);\n}\n\n/**\n * Normalize a remote status string into {@link AutorampStatus}.\n * Unknown values fall back to {@link AutorampStatus.Created}.\n *\n * @param status - Remote status string.\n * @returns A known {@link AutorampStatus}.\n */\nexport function normalizeAutorampStatus(\n status: AutorampStatus | string,\n): AutorampStatus {\n if (Object.values(AutorampStatus).includes(status as AutorampStatus)) {\n return status as AutorampStatus;\n }\n return AutorampStatus.Created;\n}\n\n/**\n * Build a new local autoramp account from create/response fields.\n *\n * @param input - Required identity + status fields.\n * @param input.id - MoonPay autoramp id.\n * @param input.customerId - MoonPay customer id.\n * @param input.walletAddress - Destination wallet address.\n * @param input.status - Optional remote status (defaults to Authorized).\n * @param input.depositRailsSummary - Optional non-PII deposit readiness cache.\n * @param input.updatedAt - Optional epoch ms timestamp (defaults to now).\n * @returns A new {@link AutorampAccount}.\n */\nexport function createAutorampAccount(input: {\n id: string;\n customerId: string;\n walletAddress: string;\n status?: AutorampStatus | string;\n depositRailsSummary?: AutorampDepositRailsSummary;\n updatedAt?: number;\n}): AutorampAccount {\n const status = normalizeAutorampStatus(\n input.status ?? AutorampStatus.Authorized,\n );\n return {\n id: input.id,\n customerId: input.customerId,\n walletAddress: input.walletAddress,\n status,\n lastSeenStatus: status,\n updatedAt: input.updatedAt ?? Date.now(),\n depositRailsSummary: input.depositRailsSummary,\n };\n}\n\n/**\n * Keeps a currency the client already learned when a later snapshot omits it.\n * Readiness follows the remote snapshot. A remote currency replaces the local one.\n *\n * @param local - Currency summary already stored for this autoramp.\n * @param remote - Currency summary from the latest GET or push.\n * @returns The summary to store, or undefined when neither side has one.\n */\nexport function mergeDepositRailsSummary(\n local: AutorampDepositRailsSummary | undefined,\n remote: AutorampDepositRailsSummary | undefined,\n): AutorampDepositRailsSummary | undefined {\n if (!remote) {\n return local;\n }\n if (!local) {\n return remote;\n }\n const currency = remote.currency ?? local.currency;\n return {\n ready: remote.ready,\n ...(currency ? { currency } : {}),\n };\n}\n\n/**\n * Apply a remote autoramp snapshot onto a local account for transition detection.\n * Pure helper — shared by refresh-on-load and websocket push paths.\n *\n * @param local - Current local account (or null when first upserting from remote).\n * @param remote - Remote snapshot (MoonPay GET or push).\n * @returns Updated account plus change / notify flags.\n */\nexport function applyAutorampRemoteStatus(\n local: AutorampAccount | null,\n remote: AutorampRemoteSnapshot,\n): ApplyAutorampRemoteStatusResult {\n const remoteStatus = normalizeAutorampStatus(remote.status);\n\n if (!local) {\n const account = createAutorampAccount({\n id: remote.id,\n customerId: remote.customerId ?? '',\n walletAddress: remote.walletAddress ?? '',\n status: remoteStatus,\n depositRailsSummary: remote.depositRailsSummary,\n });\n return {\n account,\n previousStatus: remoteStatus,\n statusChanged: false,\n shouldNotify: false,\n };\n }\n\n const previousStatus = local.status;\n const statusChanged = previousStatus !== remoteStatus;\n const shouldNotify =\n statusChanged &&\n local.notifiedForStatus !== remoteStatus &&\n NOTABLE_AUTORAMP_STATUSES.has(remoteStatus);\n\n const account: AutorampAccount = {\n ...local,\n id: remote.id,\n // A blank remote identity field means \"not supplied\", not \"cleared\": the\n // proxy omits or empties these on partial status pushes, so keep the local\n // value rather than wiping it.\n customerId:\n remote.customerId !== undefined && remote.customerId.length > 0\n ? remote.customerId\n : local.customerId,\n walletAddress:\n remote.walletAddress !== undefined && remote.walletAddress.length > 0\n ? remote.walletAddress\n : local.walletAddress,\n status: remoteStatus,\n lastSeenStatus: previousStatus,\n updatedAt: Date.now(),\n depositRailsSummary: mergeDepositRailsSummary(\n local.depositRailsSummary,\n remote.depositRailsSummary,\n ),\n };\n\n return {\n account,\n previousStatus,\n statusChanged,\n shouldNotify,\n };\n}\n\n/**\n * Mark that the UI has notified for the account's current status.\n *\n * @param account - Account to update.\n * @returns Account with `notifiedForStatus` set to current status.\n */\nexport function markAutorampNotified(\n account: AutorampAccount,\n): AutorampAccount {\n return {\n ...account,\n notifiedForStatus: account.status,\n };\n}\n"]}
1
+ {"version":3,"file":"autorampAccount.js","sourceRoot":"","sources":["../src/autorampAccount.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH;;;;GAIG;AACH,MAAM,CAAN,IAAY,cAQX;AARD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,2CAAyB,CAAA;IACzB,6CAA2B,CAAA;IAC3B,6DAA2C,CAAA;IAC3C,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;IACrB,yCAAuB,CAAA;AACzB,CAAC,EARW,cAAc,KAAd,cAAc,QAQzB;AAwCD;;;;;;;;;GASG;AACH,MAAM,UAAU,wBAAwB,CACtC,aAAqB,EACrB,kBAA0B;IAE1B,OAAO;QACL,iBAAiB,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC;QAC/D,oBAAoB,EAAE;YACpB,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,MAAM;YACb,UAAU,EAAE,OAAO;SACpB;QACD,iBAAiB,EAAE;YACjB,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,OAAO;YACd,OAAO,EAAE,aAAa;SACvB;QACD,qBAAqB,EAAE,KAAK;KAC7B,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,8BAA8B,CAC5C,aAAqB;IAErB,OAAO,wBAAwB,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,oCAAoC,GAEtC;IACF,GAAG,EAAE,CAAC,KAAK,EAAE,gBAAgB,CAAC;IAC9B,GAAG,EAAE,CAAC,KAA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AC,aAAa;YACtB,CAAC,CAAC,KAAK,CAAC,aAAa;QACzB,MAAM,EAAE,YAAY;QACpB,cAAc,EAAE,cAAc;QAC9B,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,mBAAmB,EAAE,wBAAwB,CAC3C,KAAK,CAAC,mBAAmB,EACzB,MAAM,CAAC,mBAAmB,CAC3B;KACF,CAAC;IAEF,OAAO;QACL,OAAO;QACP,cAAc;QACd,aAAa;QACb,YAAY;KACb,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAwB;IAExB,OAAO;QACL,GAAG,OAAO;QACV,iBAAiB,EAAE,OAAO,CAAC,MAAM;KAClC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Local + remote models for MoonPay Enterprise autoramp accounts.\n * Separate from {@link RampsOrder}: autoramps are standing routes; orders are payments.\n */\n\nimport type {\n AutorampDepositRailsSummary,\n AutorampRemoteSnapshot,\n} from './autoramp-types.js';\nimport type { NeoBankCustomerAbilities } from './NeoBankService.js';\n\nexport type {\n AutorampDepositRailsSummary,\n AutorampRemoteSnapshot,\n} from './autoramp-types.js';\n\n/**\n * Autoramp lifecycle statuses from MoonPay Enterprise.\n *\n * @see https://dev.enterprise.moonpay.com/autoramp-status\n */\nexport enum AutorampStatus {\n Created = 'Created',\n Authorized = 'Authorized',\n EditPending = 'EditPending',\n DepositAccountAdded = 'DepositAccountAdded',\n Approved = 'Approved',\n Rejected = 'Rejected',\n Cancelled = 'Cancelled',\n}\n\n/**\n * Local controller representation of an autoramp account.\n */\nexport type AutorampAccount = {\n /** MoonPay autoramp id. */\n id: string;\n /** MoonPay customer id. */\n customerId: string;\n /** Destination wallet address associated with this autoramp. */\n walletAddress: string;\n /** Latest status from MoonPay (source of truth after refresh). */\n status: AutorampStatus;\n /**\n * Status observed before the most recent remote apply.\n * Used for transition UX / analytics (e.g. Authorized → Approved).\n */\n lastSeenStatus: AutorampStatus;\n /**\n * Last status for which the UI already showed a notification.\n * Prevents duplicate toasts across refresh and push.\n */\n notifiedForStatus?: AutorampStatus;\n /** Epoch ms of the last local update from remote or push. */\n updatedAt: number;\n /** Optional non-PII deposit readiness cache. */\n depositRailsSummary?: AutorampDepositRailsSummary;\n};\n\n/**\n * Controller-facing payload for creating an autoramp.\n *\n * Mirrors the MoonPay `POST /api/autoramps` body that\n * {@link NeoBankService.createAutoramp} forwards opaquely, minus `customer_id`:\n * `RampsController.createAutoramp` injects the vendor customer id resolved from\n * Profile Sync, so callers never supply (or need to know) it.\n */\nexport type CreateAutorampRequest = Record<string, unknown>;\n\n/**\n * Standing fiat → mUSD autoramp for a Money Account on Monad.\n *\n * `customer_id` is omitted; {@link RampsController.createAutoramp} injects it.\n * The fiat code is required: this helper does not default to BRL.\n *\n * @param walletAddress - Money Account address that receives mUSD.\n * @param sourceCurrencyCode - Fiat code placed in `source_currencies[0].code`.\n * @returns MoonPay `POST /autoramps` market body.\n */\nexport function buildMusdAutorampRequest(\n walletAddress: string,\n sourceCurrencyCode: string,\n): CreateAutorampRequest {\n return {\n source_currencies: [{ type: 'Fiat', code: sourceCurrencyCode }],\n destination_currency: {\n type: 'Crypto',\n token: 'mUSD',\n blockchain: 'Monad',\n },\n recipient_account: {\n type: 'Crypto',\n chain: 'Monad',\n address: walletAddress,\n },\n source_is_third_party: false,\n };\n}\n\n/**\n * Standing BRL → mUSD autoramp for a Money Account on Monad.\n *\n * Wrapper around {@link buildMusdAutorampRequest} with code `BRL`.\n * `customer_id` is omitted; {@link RampsController.createAutoramp} injects it.\n *\n * @param walletAddress - Money Account address that receives mUSD.\n * @returns MoonPay `POST /autoramps` market body.\n */\nexport function buildBrazilMusdAutorampRequest(\n walletAddress: string,\n): CreateAutorampRequest {\n return buildMusdAutorampRequest(walletAddress, 'BRL');\n}\n\n/**\n * Deposit rails MoonPay needs Active before it accepts a\n * {@link buildMusdAutorampRequest} create, keyed by fiat code. neobank-proxy\n * normally sends creates as third-party, so that rail is required too. EUR is\n * the exception: the proxy falls back to a first-party autoramp when\n * `sepa_thirdparty` is not Active, so only the base rail is required.\n */\nconst MUSD_AUTORAMP_REQUIRED_DEPOSIT_RAILS: Readonly<\n Record<string, readonly string[]>\n> = {\n BRL: ['pix', 'pix_thirdparty'],\n USD: ['ach', 'ach_thirdparty'],\n EUR: ['sepa'],\n};\n\nconst BLOCKED_ABILITY_STATUSES: ReadonlySet<string> = new Set([\n 'Unavailable',\n 'Blocked',\n]);\n\n/**\n * Whether the deposit rails a fiat → mUSD autoramp needs are usable.\n *\n * - `active`: every required rail is Active, or the fiat has none.\n * - `pending`: a required rail is not Active yet (Pending, Maintenance or\n * missing), so MoonPay would reject the create for now.\n * - `blocked`: a required rail is Unavailable or Blocked.\n */\nexport type MusdAutorampDepositRailReadiness = 'active' | 'pending' | 'blocked';\n\n/**\n * Reads the deposit rail readiness for a fiat → mUSD autoramp from the\n * customer's abilities.\n *\n * @param abilities - Customer abilities, e.g. `vbaCustomerAbilities`.\n * @param sourceCurrencyCode - Fiat code passed to\n * {@link buildMusdAutorampRequest}.\n * @returns The rail readiness.\n */\nexport function getMusdAutorampDepositRailReadiness(\n abilities: NeoBankCustomerAbilities,\n sourceCurrencyCode: string,\n): MusdAutorampDepositRailReadiness {\n const code = sourceCurrencyCode.toUpperCase();\n const rails = MUSD_AUTORAMP_REQUIRED_DEPOSIT_RAILS[code];\n if (!rails) {\n return 'active';\n }\n const currencyRails = abilities.fiat_deposit[code.toLowerCase()] ?? {};\n const statuses = rails.map((rail) => currencyRails[rail]);\n if (\n statuses.some(\n (status) => status !== undefined && BLOCKED_ABILITY_STATUSES.has(status),\n )\n ) {\n return 'blocked';\n }\n return statuses.every((status) => status === 'Active') ? 'active' : 'pending';\n}\n\n/**\n * Result of applying a remote autoramp snapshot onto local state.\n */\nexport type ApplyAutorampRemoteStatusResult = {\n account: AutorampAccount;\n previousStatus: AutorampStatus;\n statusChanged: boolean;\n /** True when status changed and UI has not yet notified for the new status. */\n shouldNotify: boolean;\n};\n\n/**\n * Terminal autoramp statuses — no further lifecycle progress expected.\n */\nexport const TERMINAL_AUTORAMP_STATUSES: ReadonlySet<AutorampStatus> = new Set([\n AutorampStatus.Rejected,\n AutorampStatus.Cancelled,\n]);\n\n/**\n * Statuses that commonly warrant user-visible transition UX (toast / banner).\n */\nexport const NOTABLE_AUTORAMP_STATUSES: ReadonlySet<AutorampStatus> = new Set([\n AutorampStatus.Approved,\n AutorampStatus.Rejected,\n AutorampStatus.Cancelled,\n]);\n\n/**\n * Whether an autoramp status is terminal.\n *\n * @param status - Status to test.\n * @returns Whether the status is terminal.\n */\nexport function isTerminalAutorampStatus(status: AutorampStatus): boolean {\n return TERMINAL_AUTORAMP_STATUSES.has(status);\n}\n\n/**\n * Normalize a remote status string into {@link AutorampStatus}.\n * Unknown values fall back to {@link AutorampStatus.Created}.\n *\n * @param status - Remote status string.\n * @returns A known {@link AutorampStatus}.\n */\nexport function normalizeAutorampStatus(\n status: AutorampStatus | string,\n): AutorampStatus {\n if (Object.values(AutorampStatus).includes(status as AutorampStatus)) {\n return status as AutorampStatus;\n }\n return AutorampStatus.Created;\n}\n\n/**\n * Build a new local autoramp account from create/response fields.\n *\n * @param input - Required identity + status fields.\n * @param input.id - MoonPay autoramp id.\n * @param input.customerId - MoonPay customer id.\n * @param input.walletAddress - Destination wallet address.\n * @param input.status - Optional remote status (defaults to Authorized).\n * @param input.depositRailsSummary - Optional non-PII deposit readiness cache.\n * @param input.updatedAt - Optional epoch ms timestamp (defaults to now).\n * @returns A new {@link AutorampAccount}.\n */\nexport function createAutorampAccount(input: {\n id: string;\n customerId: string;\n walletAddress: string;\n status?: AutorampStatus | string;\n depositRailsSummary?: AutorampDepositRailsSummary;\n updatedAt?: number;\n}): AutorampAccount {\n const status = normalizeAutorampStatus(\n input.status ?? AutorampStatus.Authorized,\n );\n return {\n id: input.id,\n customerId: input.customerId,\n walletAddress: input.walletAddress,\n status,\n lastSeenStatus: status,\n updatedAt: input.updatedAt ?? Date.now(),\n depositRailsSummary: input.depositRailsSummary,\n };\n}\n\n/**\n * Keeps a currency the client already learned when a later snapshot omits it.\n * Readiness follows the remote snapshot. A remote currency replaces the local one.\n *\n * @param local - Currency summary already stored for this autoramp.\n * @param remote - Currency summary from the latest GET or push.\n * @returns The summary to store, or undefined when neither side has one.\n */\nexport function mergeDepositRailsSummary(\n local: AutorampDepositRailsSummary | undefined,\n remote: AutorampDepositRailsSummary | undefined,\n): AutorampDepositRailsSummary | undefined {\n if (!remote) {\n return local;\n }\n if (!local) {\n return remote;\n }\n const currency = remote.currency ?? local.currency;\n return {\n ready: remote.ready,\n ...(currency ? { currency } : {}),\n };\n}\n\n/**\n * Apply a remote autoramp snapshot onto a local account for transition detection.\n * Pure helper — shared by refresh-on-load and websocket push paths.\n *\n * @param local - Current local account (or null when first upserting from remote).\n * @param remote - Remote snapshot (MoonPay GET or push).\n * @returns Updated account plus change / notify flags.\n */\nexport function applyAutorampRemoteStatus(\n local: AutorampAccount | null,\n remote: AutorampRemoteSnapshot,\n): ApplyAutorampRemoteStatusResult {\n const remoteStatus = normalizeAutorampStatus(remote.status);\n\n if (!local) {\n const account = createAutorampAccount({\n id: remote.id,\n customerId: remote.customerId ?? '',\n walletAddress: remote.walletAddress ?? '',\n status: remoteStatus,\n depositRailsSummary: remote.depositRailsSummary,\n });\n return {\n account,\n previousStatus: remoteStatus,\n statusChanged: false,\n shouldNotify: false,\n };\n }\n\n const previousStatus = local.status;\n const statusChanged = previousStatus !== remoteStatus;\n const shouldNotify =\n statusChanged &&\n local.notifiedForStatus !== remoteStatus &&\n NOTABLE_AUTORAMP_STATUSES.has(remoteStatus);\n\n const account: AutorampAccount = {\n ...local,\n id: remote.id,\n // A blank remote identity field means \"not supplied\", not \"cleared\": the\n // proxy omits or empties these on partial status pushes, so keep the local\n // value rather than wiping it.\n customerId:\n remote.customerId !== undefined && remote.customerId.length > 0\n ? remote.customerId\n : local.customerId,\n walletAddress:\n remote.walletAddress !== undefined && remote.walletAddress.length > 0\n ? remote.walletAddress\n : local.walletAddress,\n status: remoteStatus,\n lastSeenStatus: previousStatus,\n updatedAt: Date.now(),\n depositRailsSummary: mergeDepositRailsSummary(\n local.depositRailsSummary,\n remote.depositRailsSummary,\n ),\n };\n\n return {\n account,\n previousStatus,\n statusChanged,\n shouldNotify,\n };\n}\n\n/**\n * Mark that the UI has notified for the account's current status.\n *\n * @param account - Account to update.\n * @returns Account with `notifiedForStatus` set to current status.\n */\nexport function markAutorampNotified(\n account: AutorampAccount,\n): AutorampAccount {\n return {\n ...account,\n notifiedForStatus: account.status,\n };\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -30,10 +30,10 @@ export { AutorampStatus, TERMINAL_AUTORAMP_STATUSES, NOTABLE_AUTORAMP_STATUSES,
30
30
  export { buildOwnershipMessage } from './ownership-message.js';
31
31
  export type { AutorampTransactionRecord, AutorampTransactionRecords, AutorampTransactionChange, } from './diffAutorampTransactions.js';
32
32
  export { diffAutorampTransactions } from './diffAutorampTransactions.js';
33
- export type { AutorampDepositInstructions, AutorampDepositRailsSummary, AutorampRemoteSnapshot, AutorampTransactionSummary, PixDepositInstructions, UsBankDepositInstructions, UsBankDepositRail, } from './autoramp-types.js';
33
+ export type { AutorampDepositInstructions, AutorampDepositRailsSummary, AutorampRemoteSnapshot, AutorampTransactionSummary, PixDepositInstructions, SepaDepositInstructions, UsBankDepositInstructions, UsBankDepositRail, } from './autoramp-types.js';
34
34
  export type { NeoBankServiceActions, NeoBankServiceCacheUpdatedEvent, NeoBankServiceEvents, NeoBankServiceGranularCacheUpdatedEvent, NeoBankServiceInvalidateQueriesAction, NeoBankServiceMessenger, NeoBankAutorampResponse, NeoBankMicrodeposit, NeoBankAbilityCurrency, NeoBankAbilityStatus, NeoBankCurrencyAbility, NeoBankCustomerAbilities, NeoBankFiatAbilities, NeoBankRequestOptions, NeoBankQueryParams, GetWalletRegistrationStatusParams, RegisterSelfHostedWalletParams, } from './NeoBankService.js';
35
35
  export type { NeoBankServiceGetAutorampAction, NeoBankServiceGetAutorampsAction, NeoBankServiceGetPixDepositInstructionsAction, NeoBankServiceGetDepositInstructionsAction, NeoBankServiceListAutorampTransactionsAction, NeoBankServiceRegisterPixAddressAction, NeoBankServiceGetAutorampQuoteAction, NeoBankServiceCreateAutorampAction, NeoBankServiceGetAutorampQuoteForAutorampAction, NeoBankServiceAttachAutorampQuoteAction, NeoBankServiceGetCustomerByExternalIdAction, NeoBankServiceGetMoonpayCustomerIdAction, NeoBankServiceGetMicrodepositsAction, NeoBankServiceGetCustomerAbilitiesAction, NeoBankServiceGetWalletRegistrationStatusAction, NeoBankServiceRegisterSelfHostedWalletAction, } from './NeoBankService-method-action-types.js';
36
- export { NeoBankService, serviceName as neoBankServiceName, mapNeoBankAutorampToRemoteSnapshot, extractPixDepositInstructions, extractUsBankDepositInstructions, } from './NeoBankService.js';
36
+ export { NeoBankService, serviceName as neoBankServiceName, mapNeoBankAutorampToRemoteSnapshot, extractPixDepositInstructions, extractSepaDepositInstructions, extractUsBankDepositInstructions, } from './NeoBankService.js';
37
37
  export type { Blockchain, RegistrationOutcome, RegistrationStatus, SelfHostedRegistration, WalletRegistrationErrorKind, } from './wallet-registration-service.js';
38
38
  export { WalletRegistrationError } from './wallet-registration-service.js';
39
39
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,6BAA6B,EAC7B,wBAAwB,EACxB,oBAAoB,EACpB,+BAA+B,EAC/B,sCAAsC,EACtC,yCAAyC,EACzC,uCAAuC,EACvC,sBAAsB,EACtB,gCAAgC,EAChC,UAAU,EACV,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,8BAA8B,EAC9B,oCAAoC,EACpC,0CAA0C,EAC1C,iBAAiB,EACjB,YAAY,EACZ,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9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B,EACpB,uCAAuC,EACvC,qCAAqC,EACrC,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,iCAAiC,EACjC,8BAA8B,GAC/B,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,+BAA+B,EAC/B,gCAAgC,EAChC,6CAA6C,EAC7C,0CAA0C,EAC1C,4CAA4C,EAC5C,sCAAsC,EACtC,oCAAoC,EACpC,kCAAkC,EAClC,+CAA+C,EAC/C,uCAAuC,EACvC,2CAA2C,EAC3C,wCAAwC,EACxC,oCAAoC,EACpC,wCAAwC,EACxC,+CAA+C,EAC/C,4CAA4C,GAC7C,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,cAAc,EACd,WAAW,IAAI,kBAAkB,EACjC,kCAAkC,EAClC,6BAA6B,EAC7B,gCAAgC,GACjC,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,sBAAsB,EACtB,qBAAqB,EACrB,6BAA6B,EAC7B,wBAAwB,EACxB,oBAAoB,EACpB,+BAA+B,EAC/B,sCAAsC,EACtC,yCAAyC,EACzC,uCAAuC,EACvC,sBAAsB,EACtB,gCAAgC,EAChC,UAAU,EACV,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,8BAA8B,EAC9B,oCAAoC,EACpC,0CAA0C,EAC1C,iBAAiB,EACjB,YAAY,EACZ,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,mCAAm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pB,uCAAuC,EACvC,qCAAqC,EACrC,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,iCAAiC,EACjC,8BAA8B,GAC/B,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,+BAA+B,EAC/B,gCAAgC,EAChC,6CAA6C,EAC7C,0CAA0C,EAC1C,4CAA4C,EAC5C,sCAAsC,EACtC,oCAAoC,EACpC,kCAAkC,EAClC,+CAA+C,EAC/C,uCAAuC,EACvC,2CAA2C,EAC3C,wCAAwC,EACxC,oCAAoC,EACpC,wCAAwC,EACxC,+CAA+C,EAC/C,4CAA4C,GAC7C,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,cAAc,EACd,WAAW,IAAI,kBAAkB,EACjC,kCAAkC,EAClC,6BAA6B,EAC7B,8BAA8B,EAC9B,gCAAgC,GACjC,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC"}
package/dist/index.js CHANGED
@@ -15,6 +15,6 @@ export { getTransakApiMessage, isTransakPhoneRegisteredError, } from './transakA
15
15
  export { AutorampStatus, TERMINAL_AUTORAMP_STATUSES, NOTABLE_AUTORAMP_STATUSES, isTerminalAutorampStatus, normalizeAutorampStatus, createAutorampAccount, applyAutorampRemoteStatus, markAutorampNotified, buildMusdAutorampRequest, buildBrazilMusdAutorampRequest, getMusdAutorampDepositRailReadiness, } from './autorampAccount.js';
16
16
  export { buildOwnershipMessage } from './ownership-message.js';
17
17
  export { diffAutorampTransactions } from './diffAutorampTransactions.js';
18
- export { NeoBankService, serviceName as neoBankServiceName, mapNeoBankAutorampToRemoteSnapshot, extractPixDepositInstructions, extractUsBankDepositInstructions, } from './NeoBankService.js';
18
+ export { NeoBankService, serviceName as neoBankServiceName, mapNeoBankAutorampToRemoteSnapshot, extractPixDepositInstructions, extractSepaDepositInstructions, extractUsBankDepositInstructions, } from './NeoBankService.js';
19
19
  export { WalletRegistrationError } from './wallet-registration-service.js';
20
20
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAyFA,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,0BAA0B,EAC1B,8BAA8B,EAC9B,oBAAoB,EACpB,yCAAyC,EACzC,4CAA4C,GAC7C,MAAM,sBAAsB,CAAC;AA2C9B,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,6BAA6B,GAC9B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAmB9B,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,8BAA8B,EAC9B,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EACL,sCAAsC,EACtC,qCAAqC,EACrC,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAQjC,OAAO,EACL,iCAAiC,EACjC,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,eAAe,EACf,+BAA+B,EAC/B,+BAA+B,EAC/B,mCAAmC,EACnC,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AA8BlC,OAAO,EACL,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,2BAA2B,CAAC;AAoBnC,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,yBAAyB,EACzB,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,wBAAwB,EACxB,8BAA8B,EAC9B,mCAAmC,GACpC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAM/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AA+CzE,OAAO,EACL,cAAc,EACd,WAAW,IAAI,kBAAkB,EACjC,kCAAkC,EAClC,6BAA6B,EAC7B,gCAAgC,GACjC,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC","sourcesContent":["export type {\n RampsControllerActions,\n RampsControllerEvents,\n RampsControllerGetStateAction,\n RampsControllerMessenger,\n RampsControllerState,\n RampsControllerStateChangeEvent,\n RampsControllerOrderStatusChangedEvent,\n RampsControllerAutorampStatusChangedEvent,\n AutorampTransactionStatusChangedPayload,\n RampsControllerOptions,\n PaymentMethodsForContextResponse,\n UserRegion,\n ResourceState,\n TransakState,\n NativeProvidersState,\n MoneyAccountWalletRegistration,\n MoneyAccountWalletRegistrationResult,\n KeyringControllerSignPersonalMessageAction,\n VbaAutorampStatus,\n VbaKycStatus,\n VbaOnboardingSnapshot,\n VbaProviderFlowStatus,\n} from './RampsController.js';\nexport type {\n RampsControllerExecuteRequestAction,\n RampsControllerAbortRequestAction,\n RampsControllerGetRequestStateAction,\n RampsControllerSetUserRegionAction,\n RampsControllerSetSelectedProviderAction,\n RampsControllerSetSelectedProviderForAssetAction,\n RampsControllerInitAction,\n RampsControllerGetCountriesAction,\n RampsControllerGetTokensAction,\n RampsControllerSetSelectedTokenAction,\n RampsControllerGetProvidersAction,\n RampsControllerGetPaymentMethodsAction,\n RampsControllerGetPaymentMethodsForContextAction,\n RampsControllerSetSelectedPaymentMethodAction,\n RampsControllerGetQuotesAction,\n RampsControllerGetQuoteWithFeesAction,\n RampsControllerAddOrderAction,\n RampsControllerRemoveOrderAction,\n RampsControllerAddAutorampAction,\n RampsControllerCreateAutorampAction,\n RampsControllerHydrateVbaOnboardingAction,\n RampsControllerRemoveAutorampAction,\n RampsControllerRegisterMoneyAccountWalletAction,\n RampsControllerMarkAutorampAsNotifiedAction,\n RampsControllerApplyAutorampStatusFromPushAction,\n RampsControllerRefreshAutorampAction,\n RampsControllerRefreshAutorampsAction,\n RampsControllerRefreshAutorampTransactionsAction,\n RampsControllerRefreshCustomerAbilitiesAction,\n RampsControllerStartOrderPollingAction,\n RampsControllerStopOrderPollingAction,\n RampsControllerGetBuyWidgetDataAction,\n RampsControllerGetFallbackBuyWidgetDataAction,\n RampsControllerAddPrecreatedOrderAction,\n RampsControllerGetOrderAction,\n RampsControllerGetOrderFromCallbackAction,\n RampsControllerTransakSetApiKeyAction,\n RampsControllerTransakSetAccessTokenAction,\n RampsControllerTransakClearAccessTokenAction,\n RampsControllerTransakSetAuthenticatedAction,\n RampsControllerTransakResetStateAction,\n RampsControllerTransakSendUserOtpAction,\n RampsControllerTransakVerifyUserOtpAction,\n RampsControllerTransakLogoutAction,\n RampsControllerTransakGetUserDetailsAction,\n RampsControllerTransakGetBuyQuoteAction,\n RampsControllerTransakGetKycRequirementAction,\n RampsControllerTransakGetAdditionalRequirementsAction,\n RampsControllerTransakCreateOrderAction,\n RampsControllerTransakGetOrderAction,\n RampsControllerTransakGetUserLimitsAction,\n RampsControllerTransakRequestOttAction,\n RampsControllerTransakGeneratePaymentWidgetUrlAction,\n RampsControllerTransakSubmitPurposeOfUsageFormAction,\n RampsControllerTransakPatchUserAction,\n RampsControllerTransakSubmitSsnDetailsAction,\n RampsControllerTransakConfirmPaymentAction,\n RampsControllerTransakGetTranslationAction,\n RampsControllerTransakGetIdProofStatusAction,\n RampsControllerTransakCancelOrderAction,\n RampsControllerTransakCancelAllActiveOrdersAction,\n RampsControllerTransakGetActiveOrdersAction,\n RampsControllerSyncOrdersWithUserStorageAction,\n} from './RampsController-method-action-types.js';\nexport {\n RampsController,\n VBA_AUTORAMP_STATUSES,\n VBA_KYC_STATUSES,\n VBA_PROVIDER_FLOW_STATUSES,\n getDefaultRampsControllerState,\n getInternalOrderCode,\n RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS,\n RAMPS_CONTROLLER_REQUIRED_CONTROLLER_ACTIONS,\n} from './RampsController.js';\nexport type {\n RampsServiceActions,\n RampsServiceEvents,\n RampsServiceMessenger,\n RampsServiceInvalidateQueriesAction,\n RampsServiceCacheUpdatedEvent,\n RampsServiceGranularCacheUpdatedEvent,\n Country,\n State,\n SupportedActions,\n CountryPhone,\n Provider,\n ProviderLink,\n ProviderLogos,\n ProviderBrowserType,\n ProviderLimit,\n ProviderFiatLimits,\n ProviderLimits,\n ProviderSortOrder,\n ProvidersResponse,\n RampAction,\n PaymentMethod,\n PaymentMethodsResponse,\n Quote,\n QuoteError,\n QuoteSortBy,\n QuoteSortOrder,\n QuoteCryptoTranslation,\n QuoteCustomAction,\n QuotesResponse,\n GetQuotesParams,\n RampsToken,\n TokensResponse,\n BuyWidget,\n BuyWidgetFallback,\n RampsOrder,\n RampsOrderNetwork,\n RampsOrderCryptoCurrency,\n RampsOrderFiatCurrency,\n RampsOrderPaymentMethod,\n OrderPaymentDetail,\n} from './RampsService.js';\nexport {\n RampsService,\n RampsEnvironment,\n RampsApiService,\n RampsOrderStatus,\n RAMPS_SDK_VERSION,\n getDefaultRedirectCallbackUrl,\n} from './RampsService.js';\nexport type { RampsClientIdentity } from './client-identity.js';\nexport {\n addRampsClientIdentityParams,\n RAMPS_CLIENT_PRODUCT_PARAM,\n RAMPS_CLIENT_VERSION_PARAM,\n} from './client-identity.js';\nexport type {\n RampsServiceGetDefaultRedirectCallbackUrlAction,\n RampsServiceGetGeolocationAction,\n RampsServiceGetCountriesAction,\n RampsServiceGetPaymentMethodsAction,\n RampsServiceGetQuotesAction,\n RampsServiceGetBuyWidgetUrlAction,\n RampsServiceGetOrderAction,\n RampsServiceGetOrderFromCallbackAction,\n} from './RampsService-method-action-types.js';\nexport type {\n RequestCache,\n RequestState,\n ExecuteRequestOptions,\n PendingRequest,\n ResourceType,\n} from './RequestCache.js';\nexport type { RampsErrorCode } from './rampsErrorCodes.js';\nexport {\n RequestStatus,\n DEFAULT_REQUEST_CACHE_TTL,\n DEFAULT_REQUEST_CACHE_MAX_SIZE,\n createCacheKey,\n isCacheExpired,\n createLoadingState,\n createSuccessState,\n createErrorState,\n} from './RequestCache.js';\nexport { RAMPS_ERROR_CODES } from './rampsErrorCodes.js';\nexport type { RequestSelectorResult } from './selectors.js';\nexport { createRequestSelector } from './selectors.js';\nexport type { HeadlessFeatureFlagsLookup } from './featureFlags.js';\nexport {\n HEADLESS_ALL_PROVIDERS_FEATURE_VERSION,\n MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY,\n getHeadlessProviderAllowlist,\n isHeadlessAllProvidersEnabled,\n} from './featureFlags.js';\nexport {\n normalizeRampsAssetId,\n providerServesAsset,\n getProvidersServingAsset,\n regionHasProviderForAsset,\n isFiatDepositAvailable,\n} from './providerAvailability.js';\nexport {\n isExternalBrowserQuote,\n isCustomActionQuote,\n isInAppOnlyQuote,\n getBuyWidgetFallback,\n} from './quoteClassification.js';\nexport {\n TERMINAL_ORDER_STATUSES,\n isTerminalOrderStatus,\n} from './orderStatus.js';\nexport type { TypedError } from './errorNormalization.js';\nexport {\n getErrorMessage,\n extractExplicitTypedError,\n normalizeToTypedError,\n} from './errorNormalization.js';\nexport type {\n UserStorageRampsOrderEntry,\n SyncRampsOrder,\n OrderSyncingController,\n OrderSyncingOptions,\n SyncOrdersWithUserStorageConfig,\n} from './order-syncing/index.js';\nexport {\n USER_STORAGE_RAMPS_ORDERS_FEATURE,\n USER_STORAGE_VERSION,\n USER_STORAGE_VERSION_KEY,\n createOrderStorageKey,\n isSyncableOrder,\n mapRampsOrderToUserStorageEntry,\n mapUserStorageEntryToRampsOrder,\n stripPaymentDetailsForRemoteStorage,\n stripSyncMetadata,\n stripDeletedAt,\n areOrdersEqual,\n canPerformOrderSyncing,\n syncOrdersWithUserStorage,\n updateOrderInUserStorage,\n deleteOrderInUserStorage,\n} from './order-syncing/index.js';\nexport type {\n TransakServiceActions,\n TransakServiceCacheUpdatedEvent,\n TransakServiceEvents,\n TransakServiceGranularCacheUpdatedEvent,\n TransakServiceInvalidateQueriesAction,\n TransakServiceMessenger,\n TransakAccessToken,\n TransakUserDetails,\n TransakUserDetailsAddress,\n TransakUserDetailsKycDetails,\n TransakBuyQuote,\n TransakKycRequirement,\n TransakAdditionalRequirement,\n TransakAdditionalRequirementsResponse,\n TransakOttResponse,\n TransakOrderPaymentMethod,\n TransakDepositOrder,\n TransakDepositNetwork,\n TransakDepositCryptoCurrency,\n TransakDepositPaymentMethod,\n TransakDepositRegion,\n TransakOrder,\n TransakQuoteTranslation,\n TransakTranslationRequest,\n TransakUserLimits,\n TransakIdProofStatus,\n PatchUserRequestBody as TransakPatchUserRequestBody,\n} from './TransakService.js';\nexport {\n TransakApiError,\n TransakService,\n TransakEnvironment,\n TransakOrderIdTransformer,\n} from './TransakService.js';\nexport {\n getTransakApiMessage,\n isTransakPhoneRegisteredError,\n} from './transakApiErrorUtils.js';\nexport type {\n TransakServiceMethodActions,\n TransakServiceSendUserOtpAction,\n TransakServiceVerifyUserOtpAction,\n TransakServiceGetUserDetailsAction,\n TransakServiceGetBuyQuoteAction,\n TransakServiceGetKycRequirementAction,\n TransakServiceCreateOrderAction,\n TransakServiceGetOrderAction,\n TransakServiceRequestOttAction,\n TransakServiceGeneratePaymentWidgetUrlAction,\n TransakServiceCreateWidgetUrlAction,\n} from './TransakService-method-action-types.js';\nexport type {\n AutorampAccount,\n ApplyAutorampRemoteStatusResult,\n CreateAutorampRequest,\n MusdAutorampDepositRailReadiness,\n} from './autorampAccount.js';\nexport {\n AutorampStatus,\n TERMINAL_AUTORAMP_STATUSES,\n NOTABLE_AUTORAMP_STATUSES,\n isTerminalAutorampStatus,\n normalizeAutorampStatus,\n createAutorampAccount,\n applyAutorampRemoteStatus,\n markAutorampNotified,\n buildMusdAutorampRequest,\n buildBrazilMusdAutorampRequest,\n getMusdAutorampDepositRailReadiness,\n} from './autorampAccount.js';\nexport { buildOwnershipMessage } from './ownership-message.js';\nexport type {\n AutorampTransactionRecord,\n AutorampTransactionRecords,\n AutorampTransactionChange,\n} from './diffAutorampTransactions.js';\nexport { diffAutorampTransactions } from './diffAutorampTransactions.js';\nexport type {\n AutorampDepositInstructions,\n AutorampDepositRailsSummary,\n AutorampRemoteSnapshot,\n AutorampTransactionSummary,\n PixDepositInstructions,\n UsBankDepositInstructions,\n UsBankDepositRail,\n} from './autoramp-types.js';\nexport type {\n NeoBankServiceActions,\n NeoBankServiceCacheUpdatedEvent,\n NeoBankServiceEvents,\n NeoBankServiceGranularCacheUpdatedEvent,\n NeoBankServiceInvalidateQueriesAction,\n NeoBankServiceMessenger,\n NeoBankAutorampResponse,\n NeoBankMicrodeposit,\n NeoBankAbilityCurrency,\n NeoBankAbilityStatus,\n NeoBankCurrencyAbility,\n NeoBankCustomerAbilities,\n NeoBankFiatAbilities,\n NeoBankRequestOptions,\n NeoBankQueryParams,\n GetWalletRegistrationStatusParams,\n RegisterSelfHostedWalletParams,\n} from './NeoBankService.js';\nexport type {\n NeoBankServiceGetAutorampAction,\n NeoBankServiceGetAutorampsAction,\n NeoBankServiceGetPixDepositInstructionsAction,\n NeoBankServiceGetDepositInstructionsAction,\n NeoBankServiceListAutorampTransactionsAction,\n NeoBankServiceRegisterPixAddressAction,\n NeoBankServiceGetAutorampQuoteAction,\n NeoBankServiceCreateAutorampAction,\n NeoBankServiceGetAutorampQuoteForAutorampAction,\n NeoBankServiceAttachAutorampQuoteAction,\n NeoBankServiceGetCustomerByExternalIdAction,\n NeoBankServiceGetMoonpayCustomerIdAction,\n NeoBankServiceGetMicrodepositsAction,\n NeoBankServiceGetCustomerAbilitiesAction,\n NeoBankServiceGetWalletRegistrationStatusAction,\n NeoBankServiceRegisterSelfHostedWalletAction,\n} from './NeoBankService-method-action-types.js';\nexport {\n NeoBankService,\n serviceName as neoBankServiceName,\n mapNeoBankAutorampToRemoteSnapshot,\n extractPixDepositInstructions,\n extractUsBankDepositInstructions,\n} from './NeoBankService.js';\nexport type {\n Blockchain,\n RegistrationOutcome,\n RegistrationStatus,\n SelfHostedRegistration,\n WalletRegistrationErrorKind,\n} from './wallet-registration-service.js';\nexport { WalletRegistrationError } from './wallet-registration-service.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAyFA,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,0BAA0B,EAC1B,8BAA8B,EAC9B,oBAAoB,EACpB,yCAAyC,EACzC,4CAA4C,GAC7C,MAAM,sBAAsB,CAAC;AA2C9B,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,6BAA6B,GAC9B,MAAM,mBAAmB,CAAC;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,EAC1B,yBAAyB,EACzB,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,yBAAyB,EACzB,oBAAoB,EACpB,wBAAwB,EACxB,8BAA8B,EAC9B,mCAAmC,GACpC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAM/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAgDzE,OAAO,EACL,cAAc,EACd,WAAW,IAAI,kBAAkB,EACjC,kCAAkC,EAClC,6BAA6B,EAC7B,8BAA8B,EAC9B,gCAAgC,GACjC,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC","sourcesContent":["export type {\n RampsControllerActions,\n RampsControllerEvents,\n RampsControllerGetStateAction,\n RampsControllerMessenger,\n RampsControllerState,\n RampsControllerStateChangeEvent,\n RampsControllerOrderStatusChangedEvent,\n RampsControllerAutorampStatusChangedEvent,\n AutorampTransactionStatusChangedPayload,\n RampsControllerOptions,\n PaymentMethodsForContextResponse,\n UserRegion,\n ResourceState,\n TransakState,\n NativeProvidersState,\n MoneyAccountWalletRegistration,\n MoneyAccountWalletRegistrationResult,\n KeyringControllerSignPersonalMessageAction,\n VbaAutorampStatus,\n VbaKycStatus,\n VbaOnboardingSnapshot,\n VbaProviderFlowStatus,\n} from './RampsController.js';\nexport type {\n RampsControllerExecuteRequestAction,\n RampsControllerAbortRequestAction,\n RampsControllerGetRequestStateAction,\n RampsControllerSetUserRegionAction,\n RampsControllerSetSelectedProviderAction,\n RampsControllerSetSelectedProviderForAssetAction,\n RampsControllerInitAction,\n RampsControllerGetCountriesAction,\n RampsControllerGetTokensAction,\n RampsControllerSetSelectedTokenAction,\n RampsControllerGetProvidersAction,\n RampsControllerGetPaymentMethodsAction,\n RampsControllerGetPaymentMethodsForContextAction,\n RampsControllerSetSelectedPaymentMethodAction,\n RampsControllerGetQuotesAction,\n RampsControllerGetQuoteWithFeesAction,\n RampsControllerAddOrderAction,\n RampsControllerRemoveOrderAction,\n RampsControllerAddAutorampAction,\n RampsControllerCreateAutorampAction,\n RampsControllerHydrateVbaOnboardingAction,\n RampsControllerRemoveAutorampAction,\n RampsControllerRegisterMoneyAccountWalletAction,\n RampsControllerMarkAutorampAsNotifiedAction,\n RampsControllerApplyAutorampStatusFromPushAction,\n RampsControllerRefreshAutorampAction,\n RampsControllerRefreshAutorampsAction,\n RampsControllerRefreshAutorampTransactionsAction,\n RampsControllerRefreshCustomerAbilitiesAction,\n RampsControllerStartOrderPollingAction,\n RampsControllerStopOrderPollingAction,\n RampsControllerGetBuyWidgetDataAction,\n RampsControllerGetFallbackBuyWidgetDataAction,\n RampsControllerAddPrecreatedOrderAction,\n RampsControllerGetOrderAction,\n RampsControllerGetOrderFromCallbackAction,\n RampsControllerTransakSetApiKeyAction,\n RampsControllerTransakSetAccessTokenAction,\n RampsControllerTransakClearAccessTokenAction,\n RampsControllerTransakSetAuthenticatedAction,\n RampsControllerTransakResetStateAction,\n RampsControllerTransakSendUserOtpAction,\n RampsControllerTransakVerifyUserOtpAction,\n RampsControllerTransakLogoutAction,\n RampsControllerTransakGetUserDetailsAction,\n RampsControllerTransakGetBuyQuoteAction,\n RampsControllerTransakGetKycRequirementAction,\n RampsControllerTransakGetAdditionalRequirementsAction,\n RampsControllerTransakCreateOrderAction,\n RampsControllerTransakGetOrderAction,\n RampsControllerTransakGetUserLimitsAction,\n RampsControllerTransakRequestOttAction,\n RampsControllerTransakGeneratePaymentWidgetUrlAction,\n RampsControllerTransakSubmitPurposeOfUsageFormAction,\n RampsControllerTransakPatchUserAction,\n RampsControllerTransakSubmitSsnDetailsAction,\n RampsControllerTransakConfirmPaymentAction,\n RampsControllerTransakGetTranslationAction,\n RampsControllerTransakGetIdProofStatusAction,\n RampsControllerTransakCancelOrderAction,\n RampsControllerTransakCancelAllActiveOrdersAction,\n RampsControllerTransakGetActiveOrdersAction,\n RampsControllerSyncOrdersWithUserStorageAction,\n} from './RampsController-method-action-types.js';\nexport {\n RampsController,\n VBA_AUTORAMP_STATUSES,\n VBA_KYC_STATUSES,\n VBA_PROVIDER_FLOW_STATUSES,\n getDefaultRampsControllerState,\n getInternalOrderCode,\n RAMPS_CONTROLLER_REQUIRED_SERVICE_ACTIONS,\n RAMPS_CONTROLLER_REQUIRED_CONTROLLER_ACTIONS,\n} from './RampsController.js';\nexport type {\n RampsServiceActions,\n RampsServiceEvents,\n RampsServiceMessenger,\n RampsServiceInvalidateQueriesAction,\n RampsServiceCacheUpdatedEvent,\n RampsServiceGranularCacheUpdatedEvent,\n Country,\n State,\n SupportedActions,\n CountryPhone,\n Provider,\n ProviderLink,\n ProviderLogos,\n ProviderBrowserType,\n ProviderLimit,\n ProviderFiatLimits,\n ProviderLimits,\n ProviderSortOrder,\n ProvidersResponse,\n RampAction,\n PaymentMethod,\n PaymentMethodsResponse,\n Quote,\n QuoteError,\n QuoteSortBy,\n QuoteSortOrder,\n QuoteCryptoTranslation,\n QuoteCustomAction,\n QuotesResponse,\n GetQuotesParams,\n RampsToken,\n TokensResponse,\n BuyWidget,\n BuyWidgetFallback,\n RampsOrder,\n RampsOrderNetwork,\n RampsOrderCryptoCurrency,\n RampsOrderFiatCurrency,\n RampsOrderPaymentMethod,\n OrderPaymentDetail,\n} from './RampsService.js';\nexport {\n RampsService,\n RampsEnvironment,\n RampsApiService,\n RampsOrderStatus,\n RAMPS_SDK_VERSION,\n getDefaultRedirectCallbackUrl,\n} from './RampsService.js';\nexport type { RampsClientIdentity } from './client-identity.js';\nexport {\n addRampsClientIdentityParams,\n RAMPS_CLIENT_PRODUCT_PARAM,\n RAMPS_CLIENT_VERSION_PARAM,\n} from './client-identity.js';\nexport type {\n RampsServiceGetDefaultRedirectCallbackUrlAction,\n RampsServiceGetGeolocationAction,\n RampsServiceGetCountriesAction,\n RampsServiceGetPaymentMethodsAction,\n RampsServiceGetQuotesAction,\n RampsServiceGetBuyWidgetUrlAction,\n RampsServiceGetOrderAction,\n RampsServiceGetOrderFromCallbackAction,\n} from './RampsService-method-action-types.js';\nexport type {\n RequestCache,\n RequestState,\n ExecuteRequestOptions,\n PendingRequest,\n ResourceType,\n} from './RequestCache.js';\nexport type { RampsErrorCode } from './rampsErrorCodes.js';\nexport {\n RequestStatus,\n DEFAULT_REQUEST_CACHE_TTL,\n DEFAULT_REQUEST_CACHE_MAX_SIZE,\n createCacheKey,\n isCacheExpired,\n createLoadingState,\n createSuccessState,\n createErrorState,\n} from './RequestCache.js';\nexport { RAMPS_ERROR_CODES } from './rampsErrorCodes.js';\nexport type { RequestSelectorResult } from './selectors.js';\nexport { createRequestSelector } from './selectors.js';\nexport type { HeadlessFeatureFlagsLookup } from './featureFlags.js';\nexport {\n HEADLESS_ALL_PROVIDERS_FEATURE_VERSION,\n MONEY_HEADLESS_ALL_PROVIDERS_FLAG_KEY,\n getHeadlessProviderAllowlist,\n isHeadlessAllProvidersEnabled,\n} from './featureFlags.js';\nexport {\n normalizeRampsAssetId,\n providerServesAsset,\n getProvidersServingAsset,\n regionHasProviderForAsset,\n isFiatDepositAvailable,\n} from './providerAvailability.js';\nexport {\n isExternalBrowserQuote,\n isCustomActionQuote,\n isInAppOnlyQuote,\n getBuyWidgetFallback,\n} from './quoteClassification.js';\nexport {\n TERMINAL_ORDER_STATUSES,\n isTerminalOrderStatus,\n} from './orderStatus.js';\nexport type { TypedError } from './errorNormalization.js';\nexport {\n getErrorMessage,\n extractExplicitTypedError,\n normalizeToTypedError,\n} from './errorNormalization.js';\nexport type {\n UserStorageRampsOrderEntry,\n SyncRampsOrder,\n OrderSyncingController,\n OrderSyncingOptions,\n SyncOrdersWithUserStorageConfig,\n} from './order-syncing/index.js';\nexport {\n USER_STORAGE_RAMPS_ORDERS_FEATURE,\n USER_STORAGE_VERSION,\n USER_STORAGE_VERSION_KEY,\n createOrderStorageKey,\n isSyncableOrder,\n mapRampsOrderToUserStorageEntry,\n mapUserStorageEntryToRampsOrder,\n stripPaymentDetailsForRemoteStorage,\n stripSyncMetadata,\n stripDeletedAt,\n areOrdersEqual,\n canPerformOrderSyncing,\n syncOrdersWithUserStorage,\n updateOrderInUserStorage,\n deleteOrderInUserStorage,\n} from './order-syncing/index.js';\nexport type {\n TransakServiceActions,\n TransakServiceCacheUpdatedEvent,\n TransakServiceEvents,\n TransakServiceGranularCacheUpdatedEvent,\n TransakServiceInvalidateQueriesAction,\n TransakServiceMessenger,\n TransakAccessToken,\n TransakUserDetails,\n TransakUserDetailsAddress,\n TransakUserDetailsKycDetails,\n TransakBuyQuote,\n TransakKycRequirement,\n TransakAdditionalRequirement,\n TransakAdditionalRequirementsResponse,\n TransakOttResponse,\n TransakOrderPaymentMethod,\n TransakDepositOrder,\n TransakDepositNetwork,\n TransakDepositCryptoCurrency,\n TransakDepositPaymentMethod,\n TransakDepositRegion,\n TransakOrder,\n TransakQuoteTranslation,\n TransakTranslationRequest,\n TransakUserLimits,\n TransakIdProofStatus,\n PatchUserRequestBody as TransakPatchUserRequestBody,\n} from './TransakService.js';\nexport {\n TransakApiError,\n TransakService,\n TransakEnvironment,\n TransakOrderIdTransformer,\n} from './TransakService.js';\nexport {\n getTransakApiMessage,\n isTransakPhoneRegisteredError,\n} from './transakApiErrorUtils.js';\nexport type {\n TransakServiceMethodActions,\n TransakServiceSendUserOtpAction,\n TransakServiceVerifyUserOtpAction,\n TransakServiceGetUserDetailsAction,\n TransakServiceGetBuyQuoteAction,\n TransakServiceGetKycRequirementAction,\n TransakServiceCreateOrderAction,\n TransakServiceGetOrderAction,\n TransakServiceRequestOttAction,\n TransakServiceGeneratePaymentWidgetUrlAction,\n TransakServiceCreateWidgetUrlAction,\n} from './TransakService-method-action-types.js';\nexport type {\n AutorampAccount,\n ApplyAutorampRemoteStatusResult,\n CreateAutorampRequest,\n MusdAutorampDepositRailReadiness,\n} from './autorampAccount.js';\nexport {\n AutorampStatus,\n TERMINAL_AUTORAMP_STATUSES,\n NOTABLE_AUTORAMP_STATUSES,\n isTerminalAutorampStatus,\n normalizeAutorampStatus,\n createAutorampAccount,\n applyAutorampRemoteStatus,\n markAutorampNotified,\n buildMusdAutorampRequest,\n buildBrazilMusdAutorampRequest,\n getMusdAutorampDepositRailReadiness,\n} from './autorampAccount.js';\nexport { buildOwnershipMessage } from './ownership-message.js';\nexport type {\n AutorampTransactionRecord,\n AutorampTransactionRecords,\n AutorampTransactionChange,\n} from './diffAutorampTransactions.js';\nexport { diffAutorampTransactions } from './diffAutorampTransactions.js';\nexport type {\n AutorampDepositInstructions,\n AutorampDepositRailsSummary,\n AutorampRemoteSnapshot,\n AutorampTransactionSummary,\n PixDepositInstructions,\n SepaDepositInstructions,\n UsBankDepositInstructions,\n UsBankDepositRail,\n} from './autoramp-types.js';\nexport type {\n NeoBankServiceActions,\n NeoBankServiceCacheUpdatedEvent,\n NeoBankServiceEvents,\n NeoBankServiceGranularCacheUpdatedEvent,\n NeoBankServiceInvalidateQueriesAction,\n NeoBankServiceMessenger,\n NeoBankAutorampResponse,\n NeoBankMicrodeposit,\n NeoBankAbilityCurrency,\n NeoBankAbilityStatus,\n NeoBankCurrencyAbility,\n NeoBankCustomerAbilities,\n NeoBankFiatAbilities,\n NeoBankRequestOptions,\n NeoBankQueryParams,\n GetWalletRegistrationStatusParams,\n RegisterSelfHostedWalletParams,\n} from './NeoBankService.js';\nexport type {\n NeoBankServiceGetAutorampAction,\n NeoBankServiceGetAutorampsAction,\n NeoBankServiceGetPixDepositInstructionsAction,\n NeoBankServiceGetDepositInstructionsAction,\n NeoBankServiceListAutorampTransactionsAction,\n NeoBankServiceRegisterPixAddressAction,\n NeoBankServiceGetAutorampQuoteAction,\n NeoBankServiceCreateAutorampAction,\n NeoBankServiceGetAutorampQuoteForAutorampAction,\n NeoBankServiceAttachAutorampQuoteAction,\n NeoBankServiceGetCustomerByExternalIdAction,\n NeoBankServiceGetMoonpayCustomerIdAction,\n NeoBankServiceGetMicrodepositsAction,\n NeoBankServiceGetCustomerAbilitiesAction,\n NeoBankServiceGetWalletRegistrationStatusAction,\n NeoBankServiceRegisterSelfHostedWalletAction,\n} from './NeoBankService-method-action-types.js';\nexport {\n NeoBankService,\n serviceName as neoBankServiceName,\n mapNeoBankAutorampToRemoteSnapshot,\n extractPixDepositInstructions,\n extractSepaDepositInstructions,\n extractUsBankDepositInstructions,\n} from './NeoBankService.js';\nexport type {\n Blockchain,\n RegistrationOutcome,\n RegistrationStatus,\n SelfHostedRegistration,\n WalletRegistrationErrorKind,\n} from './wallet-registration-service.js';\nexport { WalletRegistrationError } from './wallet-registration-service.js';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/ramps-controller",
3
- "version": "29.0.0-preview-622cd8571",
3
+ "version": "29.0.0-preview-9dfb538be",
4
4
  "description": "A controller for managing cryptocurrency on/off ramps functionality",
5
5
  "keywords": [
6
6
  "Ethereum",