Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion packages/ramps-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Export `TERMINAL_ORDER_STATUSES` and `isTerminalOrderStatus()` so consuming clients can share the controller's terminal order status set instead of maintaining duplicate copies. ([#9679](https://github.com/MetaMask/core/pull/9679))
- Add `RampsController.provisionMoneyAccount({ address, autoramp })` and `RampsController.setMoneyAccountProvisioningIntent(intent)` (plus the matching messenger actions and the exported `ProvisionMoneyAccountParams` / `ProvisionMoneyAccountResult` types). `provisionMoneyAccount` refreshes KYC status via `KycController:refreshKycStatus`, throws unless the status is `completed`, then registers the Money Account wallet and creates an autoramp. Concurrent and repeat calls for the same address share one run. Setting a non-null intent subscribes to `KycController:statusChanged` and auto-runs the same provision (without a second status refresh) when status becomes `completed`. Hosts that enable this path must also delegate `KycController:refreshKycStatus` (`RAMPS_CONTROLLER_REQUIRED_CONTROLLER_ACTIONS`) and `KycController:statusChanged` (`RAMPS_CONTROLLER_REQUIRED_CONTROLLER_EVENTS`). ([#9933](https://github.com/MetaMask/core/pull/9933))
- Export structural KYC messenger types `KycControllerRefreshKycStatusAction`, `KycControllerStatusChangedEvent`, and `KycStatusPayload` so hosts can type those delegations without depending on `@metamask/kyc-controller`. ([#9933](https://github.com/MetaMask/core/pull/9933))
- Add `RampsController.createAutoramp(request, options?)` method and the `RampsController:createAutoramp` messenger action (plus the exported `RampsControllerCreateAutorampAction` and `CreateAutorampRequest` types). It resolves the MoonPay `customer_id` from Profile Sync (`AuthenticationController:getSessionProfile`) via `NeoBankService:getCustomerByExternalId`, injects it into the request (overwriting any caller-supplied `customer_id`), forwards the body to `NeoBankService:createAutoramp`, and applies the returned snapshot to local state. Throws when the wallet is not signed in or no MoonPay customer is mapped to the external id. ([#9853](https://github.com/MetaMask/core/pull/9853))
- Add the exported `RAMPS_CONTROLLER_REQUIRED_CONTROLLER_ACTIONS` constant listing the other-controller actions (`KycController:getCustomerIdentity`, `AuthenticationController:getSessionProfile`, `KeyringController:signPersonalMessage`) that hosts must delegate to the `RampsController` messenger to enable autoramp creation and Money Account wallet registration. ([#9853](https://github.com/MetaMask/core/pull/9853), [#9908](https://github.com/MetaMask/core/pull/9908))
- Export `KycControllerGetCustomerIdentityAction` so hosts can type the KYC messenger action they delegate onto `RampsController` without depending on `@metamask/kyc-controller`. ([#9908](https://github.com/MetaMask/core/pull/9908))
- Add NeoBankService Pix / autoramp quote client methods and messenger actions, targeting the neobank-proxy `/neobank` prefix on the Ramp API host: `registerPixAddress`, `getAutorampQuote`, `createAutoramp`, `getAutorampQuoteForAutoramp`, `attachAutorampQuote`, and `getCustomerByExternalId`. Pix/quote helpers return parsed proxy JSON; `createAutoramp` maps autoramp-shaped responses via `mapNeoBankAutorampToRemoteSnapshot` (same as `getAutoramp`). Optional `Idempotency-Key` is supported on mutating calls. ([#9853](https://github.com/MetaMask/core/pull/9853))
- Export `TERMINAL_ORDER_STATUSES` and `isTerminalOrderStatus()` so consuming clients can share the controller's terminal order status set instead of maintaining duplicate copies. ([#9679](https://github.com/MetaMask/core/pull/9679), [#9853](https://github.com/MetaMask/core/pull/9853))
- Add `RampsController.registerMoneyAccountWallet({ address })` method and the `RampsController:registerMoneyAccountWallet` messenger action (moved from `@metamask/kyc-controller`). Resolves the MoonPay Iron customer id via Profile Sync → neobank-proxy external-id lookup, signs the Monad ownership message via `KeyringController:signPersonalMessage`, and registers the self-hosted wallet through the neobank-proxy — including `409` disambiguation, transient-failure reconciliation, and UTC date rollover re-signing ([#9850](https://github.com/MetaMask/core/pull/9850), [#9847](https://github.com/MetaMask/core/pull/9847), [#9853](https://github.com/MetaMask/core/pull/9853))
- Add `NeoBankService.getMoonpayCustomerId`, `NeoBankService.getWalletRegistrationStatus`, and `NeoBankService.registerSelfHostedWallet` methods and messenger actions, targeting the transparent neobank routes (`GET /neobank/customers/{external_id}/external`, `GET /neobank/addresses/crypto/{customer_id}`, `POST /neobank/addresses/crypto/selfhosted`) with client-side Monad filtering, `Idempotency-Key` support, and upstream error bodies mirrored 1:1. ([#9853](https://github.com/MetaMask/core/pull/9853))
- Export the wallet registration types (`SelfHostedRegistration`, `RegistrationStatus`, `RegistrationOutcome`, `WalletRegistrationError`, `WalletRegistrationErrorKind`, `MoneyAccountWalletRegistrationResult`) and `buildOwnershipMessage` (moved from `@metamask/kyc-controller`). ([#9853](https://github.com/MetaMask/core/pull/9853))

### Changed

- Resolve autoramp / Money Account wallet-registration customer id from `KycController:getCustomerIdentity` when a session identity is present (vendor-scoped `{ vendor, id }`), falling back to Profile Sync + `NeoBankService:getCustomerByExternalId` (prefer `canonicalProfileId`, else `profileId`). Hosts that enable autoramp creation / wallet registration must delegate `KycController:getCustomerIdentity` on the `RampsController` messenger (`RAMPS_CONTROLLER_REQUIRED_CONTROLLER_ACTIONS`). ([#9908](https://github.com/MetaMask/core/pull/9908), [#9859](https://github.com/MetaMask/core/pull/9859), [#9853](https://github.com/MetaMask/core/pull/9853))
- Point `NeoBankService.getAutoramp` at `GET /neobank/autoramps/{id}` (neobank-proxy global `/neobank` prefix) instead of `/api/v2/autoramps/{id}`, so Core matches the proxy that ships. ([#9853](https://github.com/MetaMask/core/pull/9853))

### Fixed

- Keep the local `customerId` / `walletAddress` when a remote autoramp snapshot omits or blanks them. The proxy sends empty identity fields on partial status pushes, and `applyAutorampRemoteStatus` / `mapNeoBankAutorampToRemoteSnapshot` treated those as a clear, wiping valid local values during refresh-on-load and websocket pushes. ([#9861](https://github.com/MetaMask/core/pull/9861), [#9853](https://github.com/MetaMask/core/pull/9853))

## [20.0.0]

Expand Down
147 changes: 147 additions & 0 deletions packages/ramps-controller/src/NeoBankService-method-action-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
/**
* This file is auto generated.
* Do not edit manually.
*/

import type { NeoBankService } from './NeoBankService.js';

/**
* Fetches an autoramp account via neobank-proxy
* `GET /neobank/autoramps/{autoramp_id}` (MoonPay
* `GET /api/autoramps/{autoramp_id}`).
*
* @param autorampId - MoonPay / Ramp API autoramp id.
* @returns Remote snapshot for controller apply/refresh.
*/
export type NeoBankServiceGetAutorampAction = {
type: `NeoBankService:getAutoramp`;
handler: NeoBankService['getAutoramp'];
};

/**
* Registers a Pix address via neobank-proxy `POST /neobank/addresses/pix`.
* Body is forwarded as opaque JSON (MoonPay address schema).
*
* @param body - Pix address registration payload.
* @param options - Optional idempotency key.
* @returns Parsed proxy JSON response.
*/
export type NeoBankServiceRegisterPixAddressAction = {
type: `NeoBankService:registerPixAddress`;
handler: NeoBankService['registerPixAddress'];
};

/**
* Fetches an autoramp quote via neobank-proxy `GET /neobank/autoramps/quote`.
*
* @param query - Quote query params (forwarded as-is).
* @returns Parsed proxy JSON response.
*/
export type NeoBankServiceGetAutorampQuoteAction = {
type: `NeoBankService:getAutorampQuote`;
handler: NeoBankService['getAutorampQuote'];
};

/**
* Creates an autoramp from a signed quote via neobank-proxy
* `POST /neobank/autoramps` (MoonPay `POST /api/autoramps`).
*
* @param body - CreateAutoramp / signed-quote payload (forwarded as-is).
* @param options - Optional idempotency key.
* @returns Remote snapshot for controller apply/refresh.
*/
export type NeoBankServiceCreateAutorampAction = {
type: `NeoBankService:createAutoramp`;
handler: NeoBankService['createAutoramp'];
};

/**
* Fetches a quote for an existing autoramp via neobank-proxy
* `GET /neobank/autoramps/{autoramp_id}/quote`.
*
* @param autorampId - Autoramp id.
* @param query - Quote query params (forwarded as-is).
* @returns Parsed proxy JSON response.
*/
export type NeoBankServiceGetAutorampQuoteForAutorampAction = {
type: `NeoBankService:getAutorampQuoteForAutoramp`;
handler: NeoBankService['getAutorampQuoteForAutoramp'];
};

/**
* Attaches a signed quote to an autoramp via neobank-proxy
* `POST /neobank/autoramps/{autoramp_id}/quotes`.
*
* @param autorampId - Autoramp id.
* @param body - Quote attachment payload (forwarded as-is).
* @param options - Optional idempotency key.
* @returns Parsed proxy JSON response.
*/
export type NeoBankServiceAttachAutorampQuoteAction = {
type: `NeoBankService:attachAutorampQuote`;
handler: NeoBankService['attachAutorampQuote'];
};

/**
* Fetches a customer by partner external id via neobank-proxy
* `GET /neobank/customers/{external_id}/external`.
*
* @param externalId - Partner-assigned external customer id.
* @returns Parsed proxy JSON response.
*/
export type NeoBankServiceGetCustomerByExternalIdAction = {
type: `NeoBankService:getCustomerByExternalId`;
handler: NeoBankService['getCustomerByExternalId'];
};

/**
* Resolves Iron's internal customer id via neobank-proxy customer lookup,
* using the MetaMask canonical profile id as the partner `external_id`.
*
* @returns Iron's internal customer id.
*/
export type NeoBankServiceGetMoonpayCustomerIdAction = {
type: `NeoBankService:getMoonpayCustomerId`;
handler: NeoBankService['getMoonpayCustomerId'];
};

/**
* Checks whether a Monad Money Account address is already registered for the
* given Iron customer.
*
* @param params - Customer id and address to check.
* @param params.customerId - Iron / MoonPay customer UUID.
* @param params.address - Money Account address.
* @returns Active, disabled, or absent registration status.
*/
export type NeoBankServiceGetWalletRegistrationStatusAction = {
type: `NeoBankService:getWalletRegistrationStatus`;
handler: NeoBankService['getWalletRegistrationStatus'];
};

/**
* Submits a signed Monad Money Account ownership proof via neobank-proxy
* `POST /neobank/addresses/crypto/selfhosted`.
*
* @param params - Signed ownership proof.
* @returns Registered wallet record.
*/
export type NeoBankServiceRegisterSelfHostedWalletAction = {
type: `NeoBankService:registerSelfHostedWallet`;
handler: NeoBankService['registerSelfHostedWallet'];
};

/**
* Union of all NeoBankService action types.
*/
export type NeoBankServiceMethodActions =
| NeoBankServiceGetAutorampAction
| NeoBankServiceRegisterPixAddressAction
| NeoBankServiceGetAutorampQuoteAction
| NeoBankServiceCreateAutorampAction
| NeoBankServiceGetAutorampQuoteForAutorampAction
| NeoBankServiceAttachAutorampQuoteAction
| NeoBankServiceGetCustomerByExternalIdAction
| NeoBankServiceGetMoonpayCustomerIdAction
| NeoBankServiceGetWalletRegistrationStatusAction
| NeoBankServiceRegisterSelfHostedWalletAction;
Loading
Loading