import type { PortalApiSuccessEnvelope } from './noah' export type MeldCustomerType = 'INDIVIDUAL' | 'BUSINESS' export type MeldSessionType = 'BUY' | 'SELL' | 'TRANSFER' export interface MeldCustomerName { firstName?: string lastName?: string } export interface MeldCustomerAddressDetails { lineOne?: string lineTwo?: string city?: string region?: string postalCode?: string country?: string } export interface MeldCustomerAddress { id: string customerId: string type: 'BILLING' | 'SHIPPING' | 'RESIDENCE' status: 'ACTIVE' | 'INACTIVE' addressDetails: MeldCustomerAddressDetails } export interface MeldCustomer { id: string accountId: string externalId: string name?: MeldCustomerName email?: string phone?: string dateOfBirth?: string type?: MeldCustomerType status?: 'ACTIVE' | 'INACTIVE' addresses?: MeldCustomerAddress[] serviceProviders?: Record } export interface MeldSearchCustomerResponseData { customers: MeldCustomer[] count: number remaining: number } export interface MeldRampIntelligence { rampScore?: number | null lowKyc?: boolean | null previouslyUsed?: boolean | null } export interface MeldQuote { transactionType: string sourceAmount: number sourceAmountWithoutFees?: number | null sourceCurrencyCode: string destinationAmount: number destinationAmountWithoutFees?: number | null destinationCurrencyCode: string exchangeRate: number transactionFee: number networkFee?: number | null partnerFee?: number | null totalFee: number fiatAmountWithoutFees?: number | null paymentMethodType: string serviceProvider: string countryCode?: string customerScore?: number | null institutionName?: string | null isNativeAvailable?: boolean | null rampIntelligence?: MeldRampIntelligence | null } export interface MeldGetRetailQuoteResponseData { quotes: MeldQuote[] message?: string | null error?: string | null timestamp?: string | null } export interface MeldSessionData { countryCode: string serviceProvider: string sourceCurrencyCode: string /** String amount as required by the Meld widget API. Note: MeldGetRetailQuoteRequest.sourceAmount uses number. */ sourceAmount: string destinationCurrencyCode: string walletAddress?: string walletTag?: string paymentMethodType?: string redirectUrl?: string lockFields?: string[] } export interface MeldCreateRetailWidgetResponseData { id: string token: string customerId: string externalCustomerId: string externalSessionId: string widgetUrl: string // serviceProviderWidgetUrl exists in the Meld API response but is stripped by the backend controller } export interface MeldTransaction { id: string sessionId: string externalSessionId?: string | null externalCustomerId?: string | null status: string transactionType: string serviceProvider: string sourceAmount?: number | null sourceCurrencyCode?: string | null destinationAmount?: number | null destinationCurrencyCode?: string | null destinationWalletAddress?: string | null createdAt: string updatedAt: string paymentMethodType?: string | null cryptoPurchaseDetails?: Record | null serviceProviderDetails?: Record | null [key: string]: unknown } export interface MeldSearchRetailTransactionsResponseData { count: number remaining: number totalCount: number transactions: MeldTransaction[] } export interface MeldGetRetailTransactionResponseData { transaction: MeldTransaction } export interface MeldServiceProvider { serviceProvider: string name: string status?: string categories?: string[] categoryStatuses?: Record websiteUrl?: string customerSupportUrl?: string logos?: { dark?: string light?: string darkShort?: string lightShort?: string } } export interface MeldCountry { countryCode: string name: string flagImageUrl?: string regions?: { regionCode: string; name: string }[] | null } export interface MeldFiatCurrency { currencyCode: string name: string symbolImageUrl?: string } export interface MeldCryptoCurrency { currencyCode: string name: string chainCode?: string chainName?: string chainId?: string | null contractAddress?: string symbolImageUrl?: string } export interface MeldPaymentMethod { paymentMethod: string name: string paymentType?: string logos?: { dark?: string; light?: string } } export interface MeldCountryDefault { countryCode: string defaultCurrencyCode: string defaultPaymentMethods: string[] } export interface MeldFiatCurrencyPurchaseLimit { currencyCode: string defaultAmount: number | null minimumAmount: number maximumAmount: number } export interface MeldCryptoCurrencySellLimit { currencyCode: string chainCode?: string | null defaultAmount: number | null minimumAmount: number maximumAmount: number } export interface MeldKycLimitTier { dailyLimit?: number | null weeklyLimit?: number | null monthlyLimit?: number | null yearlyLimit?: number | null transactionLimit?: number | null } export interface MeldKycFiatLevel { currencyCode: string level1?: MeldKycLimitTier level2?: MeldKycLimitTier level3?: MeldKycLimitTier } export interface MeldCreateCustomerRequest { // externalId is auto-injected by the backend from the authenticated client identity; do not send it name?: MeldCustomerName email?: string phone?: string dateOfBirth?: string type?: MeldCustomerType } export interface MeldGetRetailQuoteRequest { countryCode: string sourceCurrencyCode: string destinationCurrencyCode: string /** Numeric amount. Note: MeldSessionData.sourceAmount uses string for the same concept. */ sourceAmount: number walletAddress?: string // externalCustomerId is auto-injected by the backend from the authenticated client identity; do not send it customerId?: string paymentMethodType?: string serviceProviders?: string[] subdivision?: string } export interface MeldCreateRetailWidgetRequest { sessionType: MeldSessionType sessionData: MeldSessionData externalSessionId?: string // externalCustomerId is auto-injected by the backend from the authenticated client identity; do not send it customerId?: string bypassKyc?: boolean } /** externalCustomerIds is auto-injected by the backend; all other string query params are forwarded to Meld */ export interface MeldSearchRetailTransactionsParams { status?: string limit?: string offset?: string [key: string]: string | undefined } export interface MeldDiscoveryParams { countryCode?: string [key: string]: string | undefined } export type MeldCreateCustomerResponse = PortalApiSuccessEnvelope export type MeldSearchCustomerResponse = PortalApiSuccessEnvelope export type MeldGetRetailQuoteResponse = PortalApiSuccessEnvelope export type MeldCreateRetailWidgetResponse = PortalApiSuccessEnvelope export type MeldSearchRetailTransactionsResponse = PortalApiSuccessEnvelope export type MeldGetRetailTransactionResponse = PortalApiSuccessEnvelope export type MeldGetServiceProvidersResponse = PortalApiSuccessEnvelope export type MeldGetCountriesResponse = PortalApiSuccessEnvelope export type MeldGetFiatCurrenciesResponse = PortalApiSuccessEnvelope export type MeldGetCryptoCurrenciesResponse = PortalApiSuccessEnvelope export type MeldGetPaymentMethodsResponse = PortalApiSuccessEnvelope export type MeldGetDefaultsResponse = PortalApiSuccessEnvelope export type MeldGetBuyLimitsResponse = PortalApiSuccessEnvelope export type MeldGetSellLimitsResponse = PortalApiSuccessEnvelope export type MeldGetKycLimitsResponse = PortalApiSuccessEnvelope