@metamask/ramps-controller 26.2.0 → 27.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [27.0.0]
11
+
12
+ ### Added
13
+
14
+ - Add `needs_source_currency` to `VBA_AUTORAMP_STATUSES` for an approved, registered wallet that has no usable autoramp and was not given a source currency ([#10743](https://github.com/MetaMask/core/pull/10743))
15
+ - Add `buildMusdAutorampRequest`, which builds the standing mUSD-on-Monad autoramp body for an explicit fiat code. `buildBrazilMusdAutorampRequest` remains the BRL wrapper ([#10743](https://github.com/MetaMask/core/pull/10743))
16
+ - Add persisted `moneyAccountWalletRegistrations` (`walletAddress`, `status` of `active` or `disabled`, `updatedAt`) and `vbaAutorampListFetchedAt` on `RampsController` state ([#10749](https://github.com/MetaMask/core/pull/10749))
17
+ - Add `needs_wallet_registration` to `VbaOnboardingSnapshot.autorampStatus` for an approved session with no persisted registration row and no usable autoramp ([#10749](https://github.com/MetaMask/core/pull/10749))
18
+
19
+ ### Changed
20
+
21
+ - **BREAKING:** `hydrateVbaOnboarding` is a read. It returns KYC and autoramp facts from persisted state, and no longer signs a wallet, posts a self-hosted address, creates an autoramp, or starts the 15-second KYC poll. Optional `refreshKyc` performs one `GET /sessions/{id}/status` when a non-terminal session is already stored. Optional `refreshAutoramps` replaces the autoramp cursor from `GET /neobank/autoramps` unless that wallet already has a usable (not Rejected or Cancelled) route. An approved session with no registration row returns `needs_wallet_registration`. `needs_source_currency` now means an approved session whose persisted registration is `active` or `disabled` and which has no usable autoramp. `vbaAutorampListFetchedAt` is set only when the autoramp list GET succeeds. A persisted KYC session owned by a different profile is discarded together with `moneyAccountWalletRegistrations`, the `autoramps` cursor, and `vbaAutorampListFetchedAt` ([#10749](https://github.com/MetaMask/core/pull/10749))
22
+ - The `sourceCurrencyCode` argument is removed. To create an autoramp, call `createAutoramp(buildMusdAutorampRequest(walletAddress, code))` instead of passing a code to `hydrateVbaOnboarding`
23
+ - A failed one-shot KYC status GET keeps the persisted session instead of rejecting the read. A 404 clears that session and returns an empty snapshot
24
+ - **BREAKING:** `RampsControllerMessenger` now requires `KycController:readSessionStatus` and `KycController:fetchSessionStatusOnce` instead of `KycController:refreshSessionStatus` and `KycController:getSessionStatusForVendor` ([#10749](https://github.com/MetaMask/core/pull/10749))
25
+ - `registerMoneyAccountWallet` writes a `moneyAccountWalletRegistrations` row after `alreadyRegistered`, `registered`, or `registeredDisabled`. The stored address is trimmed and lowercased. A lookup failure or a thrown signature writes nothing ([#10749](https://github.com/MetaMask/core/pull/10749))
26
+ - `createAutoramp` derives its idempotency key from the caller-supplied source fiat (`brl-musd-monad` versus `usd-musd-monad`), the customer, the wallet, and rejected or cancelled autoramp ids. A caller-supplied key is used only when the body has no source fiat or recipient address ([#10749](https://github.com/MetaMask/core/pull/10749))
27
+ - Bump `@metamask/profile-sync-controller` from `^34.0.0` to `^34.0.2` ([#10752](https://github.com/MetaMask/core/pull/10752), [#10756](https://github.com/MetaMask/core/pull/10756))
28
+
29
+ ## [26.3.0]
30
+
31
+ ### Added
32
+
33
+ - Add `getPixDepositInstructions` and `listAutorampTransactions` so a client can show a PIX BR Code and poll autoramp transaction status ([#10586](https://github.com/MetaMask/core/pull/10586))
34
+ - Add `buildBrazilMusdAutorampRequest` for a standing BRL to mUSD autoramp on Monad ([#10586](https://github.com/MetaMask/core/pull/10586))
35
+ - Include `createdAt` on autoramp transaction summaries when MoonPay returns `created_at` ([#10586](https://github.com/MetaMask/core/pull/10586))
36
+
37
+ ### Fixed
38
+
39
+ - `hydrateVbaOnboarding` creates that BRL to mUSD autoramp instead of posting an empty body ([#10586](https://github.com/MetaMask/core/pull/10586))
40
+ - `hydrateVbaOnboarding` sends a stable idempotency key when creating the BRL to mUSD autoramp so a retry does not open a second route, and uses a different key when replacing a rejected or cancelled route ([#10586](https://github.com/MetaMask/core/pull/10586))
41
+ - `getAutoramps` accepts MoonPay's paged `{ items }` list, follows `cursor` until the list is complete, and can be scoped with `customerId` ([#10586](https://github.com/MetaMask/core/pull/10586))
42
+ - Fall back to MoonPay `recipient.address` when mapping an autoramp wallet address ([#10586](https://github.com/MetaMask/core/pull/10586))
43
+
10
44
  ## [26.2.0]
11
45
 
12
46
  ### Changed
@@ -680,7 +714,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
680
714
  - Add `OnRampService` for interacting with the OnRamp API
681
715
  - Add geolocation detection via IP address lookup
682
716
 
683
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/ramps-controller@26.2.0...HEAD
717
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/ramps-controller@27.0.0...HEAD
718
+ [27.0.0]: https://github.com/MetaMask/core/compare/@metamask/ramps-controller@26.3.0...@metamask/ramps-controller@27.0.0
719
+ [26.3.0]: https://github.com/MetaMask/core/compare/@metamask/ramps-controller@26.2.0...@metamask/ramps-controller@26.3.0
684
720
  [26.2.0]: https://github.com/MetaMask/core/compare/@metamask/ramps-controller@26.1.0...@metamask/ramps-controller@26.2.0
685
721
  [26.1.0]: https://github.com/MetaMask/core/compare/@metamask/ramps-controller@26.0.1...@metamask/ramps-controller@26.1.0
686
722
  [26.0.1]: https://github.com/MetaMask/core/compare/@metamask/ramps-controller@26.0.0...@metamask/ramps-controller@26.0.1
@@ -16,14 +16,49 @@ export type NeoBankServiceGetAutorampAction = {
16
16
  handler: NeoBankService['getAutoramp'];
17
17
  };
18
18
  /**
19
- * Fetches all autoramp accounts belonging to the authenticated customer.
19
+ * Fetches autoramp accounts, following MoonPay `cursor` pages until the
20
+ * list is complete.
20
21
  *
21
- * @returns Remote snapshots for all customer autoramps.
22
+ * Pass `customerId` to scope the list to one MoonPay customer. Omitting it
23
+ * asks the proxy for the partner-wide list. Each request uses MoonPay's
24
+ * maximum `page_size`.
25
+ *
26
+ * @param params - Optional filters.
27
+ * @param params.customerId - MoonPay customer id.
28
+ * @returns Remote snapshots for every page.
22
29
  */
23
30
  export type NeoBankServiceGetAutorampsAction = {
24
31
  type: `NeoBankService:getAutoramps`;
25
32
  handler: NeoBankService['getAutoramps'];
26
33
  };
34
+ /**
35
+ * Loads PIX deposit instructions for an autoramp.
36
+ *
37
+ * Calls `GET /neobank/autoramps/{id}` and reads the `type: Pix` rail
38
+ * (`br_code`, `instruction`, optional `pix_key`). Returns null until MoonPay
39
+ * has attached deposit rails (typically once the autoramp is Approved).
40
+ *
41
+ * @param autorampId - MoonPay autoramp id.
42
+ * @returns PIX instructions, or null when the rail is not ready.
43
+ */
44
+ export type NeoBankServiceGetPixDepositInstructionsAction = {
45
+ type: `NeoBankService:getPixDepositInstructions`;
46
+ handler: NeoBankService['getPixDepositInstructions'];
47
+ };
48
+ /**
49
+ * Lists the newest page of transactions for one autoramp via
50
+ * `GET /neobank/autoramp-transactions?autoramp_id=&sort_order=desc`.
51
+ *
52
+ * This is the first page only, not the full history. Poll `status`
53
+ * (`Completed`, `Failed`, …). The deprecated `state` field is ignored.
54
+ *
55
+ * @param autorampId - MoonPay autoramp id.
56
+ * @returns Transaction summaries from the newest page.
57
+ */
58
+ export type NeoBankServiceListAutorampTransactionsAction = {
59
+ type: `NeoBankService:listAutorampTransactions`;
60
+ handler: NeoBankService['listAutorampTransactions'];
61
+ };
27
62
  /**
28
63
  * Registers a Pix address via neobank-proxy `POST /neobank/addresses/pix`.
29
64
  * Body is forwarded as opaque JSON (MoonPay address schema).
@@ -131,5 +166,5 @@ export type NeoBankServiceRegisterSelfHostedWalletAction = {
131
166
  /**
132
167
  * Union of all NeoBankService action types.
133
168
  */
134
- export type NeoBankServiceMethodActions = NeoBankServiceGetAutorampAction | NeoBankServiceGetAutorampsAction | NeoBankServiceRegisterPixAddressAction | NeoBankServiceGetAutorampQuoteAction | NeoBankServiceCreateAutorampAction | NeoBankServiceGetAutorampQuoteForAutorampAction | NeoBankServiceAttachAutorampQuoteAction | NeoBankServiceGetCustomerByExternalIdAction | NeoBankServiceGetMoonpayCustomerIdAction | NeoBankServiceGetWalletRegistrationStatusAction | NeoBankServiceRegisterSelfHostedWalletAction;
169
+ export type NeoBankServiceMethodActions = NeoBankServiceGetAutorampAction | NeoBankServiceGetAutorampsAction | NeoBankServiceGetPixDepositInstructionsAction | NeoBankServiceListAutorampTransactionsAction | NeoBankServiceRegisterPixAddressAction | NeoBankServiceGetAutorampQuoteAction | NeoBankServiceCreateAutorampAction | NeoBankServiceGetAutorampQuoteForAutorampAction | NeoBankServiceAttachAutorampQuoteAction | NeoBankServiceGetCustomerByExternalIdAction | NeoBankServiceGetMoonpayCustomerIdAction | NeoBankServiceGetWalletRegistrationStatusAction | NeoBankServiceRegisterSelfHostedWalletAction;
135
170
  //# sourceMappingURL=NeoBankService-method-action-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NeoBankService-method-action-types.d.ts","sourceRoot":"","sources":["../src/NeoBankService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;;;;;GAOG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;CACxC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAC7C,IAAI,EAAE,6BAA6B,CAAC;IACpC,OAAO,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;CACzC,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,iCAAiC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AAuC,GACvC,2CAA2C,GAC3C,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;;;;;;;;;GASG;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,iCAAiC,CAAC;IACxC,OAAO,EAAE,cAAc,CAAC,kBAAkB,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,cAAc,CAAC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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 all autoramp accounts belonging to the authenticated customer.\n *\n * @returns Remote snapshots for all customer autoramps.\n */\nexport type NeoBankServiceGetAutorampsAction = {\n type: `NeoBankService:getAutoramps`;\n handler: NeoBankService['getAutoramps'];\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 * 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 | NeoBankServiceRegisterPixAddressAction\n | NeoBankServiceGetAutorampQuoteAction\n | NeoBankServiceCreateAutorampAction\n | NeoBankServiceGetAutorampQuoteForAutorampAction\n | NeoBankServiceAttachAutorampQuoteAction\n | NeoBankServiceGetCustomerByExternalIdAction\n | NeoBankServiceGetMoonpayCustomerIdAction\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 * 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 * @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 * 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 | NeoBankServiceListAutorampTransactionsAction\n | NeoBankServiceRegisterPixAddressAction\n | NeoBankServiceGetAutorampQuoteAction\n | NeoBankServiceCreateAutorampAction\n | NeoBankServiceGetAutorampQuoteForAutorampAction\n | NeoBankServiceAttachAutorampQuoteAction\n | NeoBankServiceGetCustomerByExternalIdAction\n | NeoBankServiceGetMoonpayCustomerIdAction\n | NeoBankServiceGetWalletRegistrationStatusAction\n | NeoBankServiceRegisterSelfHostedWalletAction;\n"]}
@@ -1,7 +1,7 @@
1
1
  import type { CreateServicePolicyOptions, ServicePolicy } from '@metamask/controller-utils';
2
2
  import type { Messenger } from '@metamask/messenger';
3
3
  import type { AuthenticationController } from '@metamask/profile-sync-controller';
4
- import type { AutorampRemoteSnapshot } from './autoramp-types.js';
4
+ import type { AutorampRemoteSnapshot, AutorampTransactionSummary, PixDepositInstructions } from './autoramp-types.js';
5
5
  import type { NeoBankServiceMethodActions } from './NeoBankService-method-action-types.js';
6
6
  import { RampsEnvironment } from './RampsService.js';
7
7
  import type { RegistrationOutcome, RegistrationStatus } from './wallet-registration-service.js';
@@ -27,6 +27,13 @@ export type NeoBankAutorampResponse = {
27
27
  recipient_account?: {
28
28
  address?: string;
29
29
  };
30
+ /**
31
+ * Some MoonPay autoramp responses put the destination under `recipient`
32
+ * instead of `recipient_account`.
33
+ */
34
+ recipient?: {
35
+ address?: string;
36
+ };
30
37
  deposit_rails?: unknown[];
31
38
  };
32
39
  /**
@@ -77,6 +84,13 @@ export type NeoBankServiceMessenger = Messenger<typeof serviceName, NeoBankServi
77
84
  * @returns Snapshot for the controller last-seen cursor.
78
85
  */
79
86
  export declare function mapNeoBankAutorampToRemoteSnapshot(response: NeoBankAutorampResponse): AutorampRemoteSnapshot;
87
+ /**
88
+ * Pulls the PIX deposit rail out of an autoramp `deposit_rails` array.
89
+ *
90
+ * @param depositRails - MoonPay `deposit_rails` value.
91
+ * @returns PIX instructions, or null when no usable PIX rail is present.
92
+ */
93
+ export declare function extractPixDepositInstructions(depositRails: unknown): PixDepositInstructions | null;
80
94
  /**
81
95
  * Client for MetaMask Ramp API neo-bank endpoints (MoonPay Enterprise proxy).
82
96
  *
@@ -107,11 +121,42 @@ export declare class NeoBankService {
107
121
  */
108
122
  getAutoramp(autorampId: string): Promise<AutorampRemoteSnapshot>;
109
123
  /**
110
- * Fetches all autoramp accounts belonging to the authenticated customer.
124
+ * Fetches autoramp accounts, following MoonPay `cursor` pages until the
125
+ * list is complete.
126
+ *
127
+ * Pass `customerId` to scope the list to one MoonPay customer. Omitting it
128
+ * asks the proxy for the partner-wide list. Each request uses MoonPay's
129
+ * maximum `page_size`.
130
+ *
131
+ * @param params - Optional filters.
132
+ * @param params.customerId - MoonPay customer id.
133
+ * @returns Remote snapshots for every page.
134
+ */
135
+ getAutoramps(params?: {
136
+ customerId?: string;
137
+ }): Promise<AutorampRemoteSnapshot[]>;
138
+ /**
139
+ * Loads PIX deposit instructions for an autoramp.
140
+ *
141
+ * Calls `GET /neobank/autoramps/{id}` and reads the `type: Pix` rail
142
+ * (`br_code`, `instruction`, optional `pix_key`). Returns null until MoonPay
143
+ * has attached deposit rails (typically once the autoramp is Approved).
144
+ *
145
+ * @param autorampId - MoonPay autoramp id.
146
+ * @returns PIX instructions, or null when the rail is not ready.
147
+ */
148
+ getPixDepositInstructions(autorampId: string): Promise<PixDepositInstructions | null>;
149
+ /**
150
+ * Lists the newest page of transactions for one autoramp via
151
+ * `GET /neobank/autoramp-transactions?autoramp_id=&sort_order=desc`.
152
+ *
153
+ * This is the first page only, not the full history. Poll `status`
154
+ * (`Completed`, `Failed`, …). The deprecated `state` field is ignored.
111
155
  *
112
- * @returns Remote snapshots for all customer autoramps.
156
+ * @param autorampId - MoonPay autoramp id.
157
+ * @returns Transaction summaries from the newest page.
113
158
  */
114
- getAutoramps(): Promise<AutorampRemoteSnapshot[]>;
159
+ listAutorampTransactions(autorampId: string): Promise<AutorampTransactionSummary[]>;
115
160
  /**
116
161
  * Registers a Pix address via neobank-proxy `POST /neobank/addresses/pix`.
117
162
  * Body is forwarded as opaque JSON (MoonPay address schema).
@@ -1 +1 @@
1
- {"version":3,"file":"NeoBankService.d.ts","sourceRoot":"","sources":["../src/NeoBankService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,aAAa,EACd,MAAM,4BAA4B,CAAC;AAMpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAGlF,OAAO,KAAK,EAEV,sBAAsB,EACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAC3F,OAAO,EAAqB,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAExE,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kCAAkC,CAAC;AAE1C;;GAEG;AACH,eAAO,MAAM,WAAW,mBAAmB,CAAC;AAuB5C;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,MAAM,CAAC;IAEX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IAEH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,iBAAiB,CAAC,EAAE;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;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,CACL,QAAQ,EAAE,UAAU,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,GAChD,UAAU,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAEtC;IAED,UAAU,CACR,QAAQ,EAAE,UAAU,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,GACnD,UAAU,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAEzC;CACF"}
@@ -38,7 +38,13 @@ const MESSENGER_EXPOSED_METHODS = [
38
38
  'getMoonpayCustomerId',
39
39
  'getWalletRegistrationStatus',
40
40
  'registerSelfHostedWallet',
41
+ 'getPixDepositInstructions',
42
+ 'listAutorampTransactions',
41
43
  ];
44
+ /**
45
+ * MoonPay's maximum `page_size` for `GET /api/autoramps`.
46
+ */
47
+ const AUTORAMP_LIST_PAGE_SIZE = 100;
42
48
  /**
43
49
  * Builds a path under the neobank-proxy global prefix.
44
50
  *
@@ -92,11 +98,95 @@ export function mapNeoBankAutorampToRemoteSnapshot(response) {
92
98
  walletAddress: response.wallet_address !== undefined &&
93
99
  response.wallet_address.length > 0
94
100
  ? response.wallet_address
95
- : response.recipient_account?.address,
101
+ : (response.recipient_account?.address ?? response.recipient?.address),
96
102
  status: response.status,
97
103
  depositRailsSummary,
98
104
  };
99
105
  }
106
+ /**
107
+ * Reads a MoonPay paged list (an object with an items array) or a raw array.
108
+ *
109
+ * @param response - Proxy JSON body.
110
+ * @param malformedMessage - Error when the body is neither shape.
111
+ * @returns Item list.
112
+ */
113
+ function readPagedItems(response, malformedMessage) {
114
+ if (Array.isArray(response)) {
115
+ return response;
116
+ }
117
+ if (response !== null &&
118
+ typeof response === 'object' &&
119
+ Array.isArray(response.items)) {
120
+ return response.items;
121
+ }
122
+ throw new Error(malformedMessage);
123
+ }
124
+ /**
125
+ * Reads the next-page cursor from a MoonPay paged list.
126
+ * A raw array has no further page.
127
+ *
128
+ * @param response - Proxy JSON body.
129
+ * @returns Next cursor, or undefined when this page is the last.
130
+ */
131
+ function readNextCursor(response) {
132
+ if (response === null ||
133
+ typeof response !== 'object' ||
134
+ Array.isArray(response)) {
135
+ return undefined;
136
+ }
137
+ const { cursor } = response;
138
+ return typeof cursor === 'string' && cursor.length > 0 ? cursor : undefined;
139
+ }
140
+ /**
141
+ * Pulls the PIX deposit rail out of an autoramp `deposit_rails` array.
142
+ *
143
+ * @param depositRails - MoonPay `deposit_rails` value.
144
+ * @returns PIX instructions, or null when no usable PIX rail is present.
145
+ */
146
+ export function extractPixDepositInstructions(depositRails) {
147
+ if (!Array.isArray(depositRails)) {
148
+ return null;
149
+ }
150
+ for (const rail of depositRails) {
151
+ if (rail === null || typeof rail !== 'object') {
152
+ continue;
153
+ }
154
+ const record = rail;
155
+ if (record.type !== 'Pix') {
156
+ continue;
157
+ }
158
+ if (typeof record.br_code !== 'string' ||
159
+ record.br_code.length === 0 ||
160
+ typeof record.instruction !== 'string') {
161
+ continue;
162
+ }
163
+ const instructions = {
164
+ brCode: record.br_code,
165
+ instruction: record.instruction,
166
+ };
167
+ if (typeof record.pix_key === 'string' && record.pix_key.length > 0) {
168
+ instructions.pixKey = record.pix_key;
169
+ }
170
+ if (typeof record.expires_at === 'string' && record.expires_at.length > 0) {
171
+ instructions.expiresAt = record.expires_at;
172
+ }
173
+ return instructions;
174
+ }
175
+ return null;
176
+ }
177
+ /**
178
+ * Reads a decimal amount from a MoonPay `Amount` object.
179
+ *
180
+ * @param value - `source_amount` or `destination_amount`.
181
+ * @returns Decimal string, or undefined.
182
+ */
183
+ function readAmount(value) {
184
+ if (value === null || typeof value !== 'object') {
185
+ return undefined;
186
+ }
187
+ const { amount } = value;
188
+ return typeof amount === 'string' && amount.length > 0 ? amount : undefined;
189
+ }
100
190
  /**
101
191
  * Client for MetaMask Ramp API neo-bank endpoints (MoonPay Enterprise proxy).
102
192
  *
@@ -249,16 +339,94 @@ export class NeoBankService {
249
339
  return this.#mapAutorampResponse(response);
250
340
  }
251
341
  /**
252
- * Fetches all autoramp accounts belonging to the authenticated customer.
342
+ * Fetches autoramp accounts, following MoonPay `cursor` pages until the
343
+ * list is complete.
344
+ *
345
+ * Pass `customerId` to scope the list to one MoonPay customer. Omitting it
346
+ * asks the proxy for the partner-wide list. Each request uses MoonPay's
347
+ * maximum `page_size`.
348
+ *
349
+ * @param params - Optional filters.
350
+ * @param params.customerId - MoonPay customer id.
351
+ * @returns Remote snapshots for every page.
352
+ */
353
+ async getAutoramps(params = {}) {
354
+ const autoramps = [];
355
+ const seenCursors = new Set();
356
+ let cursor;
357
+ do {
358
+ const response = await this.#getJson('autoramps', {
359
+ customer_id: params.customerId,
360
+ page_size: AUTORAMP_LIST_PAGE_SIZE,
361
+ cursor,
362
+ });
363
+ autoramps.push(...readPagedItems(response, 'Malformed response received from neo-bank autoramps API'));
364
+ const nextCursor = readNextCursor(response);
365
+ if (nextCursor === undefined || seenCursors.has(nextCursor)) {
366
+ break;
367
+ }
368
+ seenCursors.add(nextCursor);
369
+ cursor = nextCursor;
370
+ } while (cursor !== undefined);
371
+ return autoramps.map((autoramp) => this.#mapAutorampResponse(autoramp));
372
+ }
373
+ /**
374
+ * Loads PIX deposit instructions for an autoramp.
253
375
  *
254
- * @returns Remote snapshots for all customer autoramps.
376
+ * Calls `GET /neobank/autoramps/{id}` and reads the `type: Pix` rail
377
+ * (`br_code`, `instruction`, optional `pix_key`). Returns null until MoonPay
378
+ * has attached deposit rails (typically once the autoramp is Approved).
379
+ *
380
+ * @param autorampId - MoonPay autoramp id.
381
+ * @returns PIX instructions, or null when the rail is not ready.
255
382
  */
256
- async getAutoramps() {
257
- const response = await this.#getJson('autoramps');
258
- if (!Array.isArray(response)) {
259
- throw new Error('Malformed response received from neo-bank autoramps API');
383
+ async getPixDepositInstructions(autorampId) {
384
+ const response = await this.#getJson(`autoramps/${encodeURIComponent(autorampId)}`);
385
+ if (!response || typeof response !== 'object') {
386
+ throw new Error('Malformed response received from neo-bank autoramp API');
260
387
  }
261
- return response.map((autoramp) => this.#mapAutorampResponse(autoramp));
388
+ return extractPixDepositInstructions(response.deposit_rails);
389
+ }
390
+ /**
391
+ * Lists the newest page of transactions for one autoramp via
392
+ * `GET /neobank/autoramp-transactions?autoramp_id=&sort_order=desc`.
393
+ *
394
+ * This is the first page only, not the full history. Poll `status`
395
+ * (`Completed`, `Failed`, …). The deprecated `state` field is ignored.
396
+ *
397
+ * @param autorampId - MoonPay autoramp id.
398
+ * @returns Transaction summaries from the newest page.
399
+ */
400
+ async listAutorampTransactions(autorampId) {
401
+ const response = await this.#getJson('autoramp-transactions', {
402
+ autoramp_id: autorampId,
403
+ sort_order: 'desc',
404
+ });
405
+ const transactions = readPagedItems(response, 'Malformed response received from neo-bank autoramp transactions API');
406
+ return transactions.map((transaction) => {
407
+ if (transaction === null ||
408
+ typeof transaction !== 'object' ||
409
+ typeof transaction.id !== 'string') {
410
+ throw new Error('Malformed response received from neo-bank autoramp transactions API');
411
+ }
412
+ const record = transaction;
413
+ if (typeof record.status !== 'string') {
414
+ throw new Error('Malformed response received from neo-bank autoramp transactions API');
415
+ }
416
+ const createdAt = typeof record.created_at === 'string' && record.created_at.length > 0
417
+ ? record.created_at
418
+ : undefined;
419
+ return {
420
+ id: record.id,
421
+ autorampId: typeof record.autoramp_id === 'string'
422
+ ? record.autoramp_id
423
+ : autorampId,
424
+ status: record.status,
425
+ sourceAmount: readAmount(record.source_amount),
426
+ destinationAmount: readAmount(record.destination_amount),
427
+ createdAt,
428
+ };
429
+ });
262
430
  }
263
431
  /**
264
432
  * Registers a Pix address via neobank-proxy `POST /neobank/addresses/pix`.