@unifold/core 0.1.74 → 0.1.76

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/dist/index.d.mts CHANGED
@@ -454,35 +454,37 @@ interface OnrampSessionResponse {
454
454
  */
455
455
  declare function createOnrampSession(request: OnrampSessionRequest, publishableKey?: string): Promise<OnrampSessionResponse>;
456
456
  /**
457
- * A bank-transfer onramp provider returned by `getBankTransferProviders()`.
458
- * Mirrors the shape of `IntegrationExchangeInfo` so SDK consumers can render
459
- * exchanges + bank-transfer with the same UI primitives.
457
+ * One bank-transfer rail from `getBankTransferProviders()`. **A row is a rail,
458
+ * not a provider**, so two rows can share a `service_provider` the response is
459
+ * the currency selector's option list, ordered usable-first, so `data[0]` is the
460
+ * right default. `unifold` never names the provider behind a rail; what to do
461
+ * next comes off the session.
460
462
  */
461
463
  interface BankTransferProvider {
464
+ /** Not unique within a response — see the note above. */
462
465
  service_provider: string;
463
466
  service_provider_display_name: string;
464
467
  description: string;
465
468
  icon_url: string;
466
469
  icon_urls: IconUrl[];
467
470
  /**
468
- * True when the provider is configured AND the rail supports the caller's
469
- * country. Use this to decide whether the row is clickable.
471
+ * Whether this rail serves the caller's country. Unusable rails are still
472
+ * returned so a selector can grey them out rather than making "EUR only" look
473
+ * like "no bank transfer".
470
474
  */
471
475
  enabled: boolean;
472
476
  /**
473
- * Payment methods this provider supports. Forward one of these as
474
- * `payment_method` when calling `/onramps/sessions`. Stored as an array so
475
- * a single provider can light up multiple rails (e.g. SEPA + ACH) without
476
- * forking the row.
477
+ * Always one element, like `supported_currencies` a row is one rail. Read
478
+ * `[0]` and forward as `payment_method_type`. Corridor-level, never
479
+ * network-level: one account accepts ACH / wire / RTP at once and the payer's
480
+ * bank picks, so the networks arrive on the deposit instructions.
477
481
  */
478
- payment_methods: OnrampSessionPaymentMethodType[];
479
- /** All fiat currencies the rail accepts (e.g. ['eur', 'gbp']). */
482
+ payment_method_types: OnrampSessionPaymentMethodType[];
483
+ /** Always one element read `[0]` and forward as `source_currency`. */
480
484
  supported_currencies: string[];
481
- /**
482
- * Preferred fiat for the caller's country, picked from `supported_currencies`.
483
- * Forward as `source_currency` to `/onramps/sessions` — avoids the SDK
484
- * re-implementing the country → fiat mapping.
485
- */
485
+ /** @deprecated Read `payment_method_types`. Identical contents. */
486
+ payment_methods: OnrampSessionPaymentMethodType[];
487
+ /** @deprecated Read `supported_currencies[0]`. */
486
488
  source_currency: string;
487
489
  }
488
490
  interface BankTransferProvidersResponse {
@@ -587,6 +589,12 @@ interface DefaultTokenResponse {
587
589
  declare function getDefaultOnrampToken(params: {
588
590
  country_code?: string;
589
591
  subdivision_code?: string;
592
+ /**
593
+ * Service provider the default token will be used with (e.g. binancepay).
594
+ * Reserved for provider-aware defaults — accepted but not used in
595
+ * resolution yet.
596
+ */
597
+ service_provider?: string;
590
598
  token_address: string;
591
599
  chain_id: string;
592
600
  chain_type: string;
@@ -805,7 +813,7 @@ interface AddressBalancesResponse {
805
813
  */
806
814
  declare function getAddressBalances(address: string, chainType: ChainType, publishableKey?: string): Promise<AddressBalancesResponse>;
807
815
  /** Wallet ids supported by the connect-wallet flow. */
808
- type WalletMobileDeepLinkWallet = 'phantom' | 'metamask' | 'coinbase' | 'trust' | 'rainbow' | 'rabby' | 'okx' | 'solflare' | 'backpack';
816
+ type WalletMobileDeepLinkWallet = 'phantom' | 'metamask' | 'coinbase' | 'trust' | 'rainbow' | 'rabby' | 'okx' | 'robinhood' | 'solflare' | 'backpack';
809
817
  /** Chain types an external wallet can connect on. */
810
818
  type ExternalWalletChainType = 'ethereum' | 'solana';
811
819
  /** A supported external (self-custody) wallet from the directory endpoint. */
@@ -827,6 +835,19 @@ interface ExternalWalletInfo {
827
835
  * client to only offer mobile-browse on those platforms.
828
836
  */
829
837
  mobile_browse_platforms: ('ios' | 'android')[] | null;
838
+ /**
839
+ * Whether the wallet ships a browser extension, so a desktop page can get an
840
+ * injected provider from it. `false` for mobile-only wallets: a desktop row
841
+ * could only ever offer an app download, never a connection, so clients should
842
+ * omit them on desktop unless the provider is already injected.
843
+ *
844
+ * Describes the wallet, not what Unifold supports, so it does not change as
845
+ * connectors are added — a wallet reachable only through a protocol the SDK has
846
+ * to implement (e.g. WalletConnect) keeps this `false` and advertises that
847
+ * through a separate additive field, so an SDK that can't speak the protocol
848
+ * keeps hiding it.
849
+ */
850
+ supports_desktop_extension: boolean;
830
851
  }
831
852
  interface ExternalWalletsResponse {
832
853
  data: ExternalWalletInfo[];
@@ -871,7 +892,7 @@ interface WalletMobileDeepLinkResponse {
871
892
  * on the merchant's site. `deeplink` is `null` for wallets without a reliable
872
893
  * dapp-browser deep link.
873
894
  *
874
- * @param wallet - Wallet id (phantom, metamask, coinbase, trust, rainbow, rabby, okx)
895
+ * @param wallet - Wallet id (phantom, metamask, coinbase, trust, rainbow, rabby, okx, robinhood)
875
896
  * @param depositAddresses - Unifold deposit addresses (one per source chain) to embed in the hosted pay URL
876
897
  * @param publishableKey - Optional publishable key, defaults to configured key
877
898
  * @param amountUsd - Optional USD amount to pre-fill on the hosted pay page so the user
@@ -953,6 +974,15 @@ interface ExchangeProviderInfo {
953
974
  enabled: boolean;
954
975
  supported_networks: string[];
955
976
  supported_currencies: string[];
977
+ /**
978
+ * The exchange's own minimum order in USD, or null when it sets none.
979
+ *
980
+ * Not a deposit minimum: `/supported_deposit_tokens` carries that per chain,
981
+ * and the two are independent, so an amount screen gates on whichever is
982
+ * higher. Undefined against API deployments that predate the field, which
983
+ * reads the same as "no floor of its own".
984
+ */
985
+ minimum_amount_usd?: number | null;
956
986
  }
957
987
  interface ExchangeProvidersResponse {
958
988
  data: ExchangeProviderInfo[];
@@ -982,6 +1012,17 @@ interface CreateExchangeSessionRequest {
982
1012
  source_currency?: string;
983
1013
  source_amount?: string;
984
1014
  external_id?: string;
1015
+ /**
1016
+ * ISO 3166-1 alpha-2 country code of the user. Recorded on the session, and
1017
+ * required by some redirect providers (e.g. Binance Pay via Meld).
1018
+ */
1019
+ country_code?: string;
1020
+ /**
1021
+ * State/subdivision code (e.g. CA). Recorded on the session, and worth sending
1022
+ * whenever it is known: no exchange provider reports a subdivision back, so
1023
+ * this is the only way the session can carry one.
1024
+ */
1025
+ subdivision_code?: string;
985
1026
  }
986
1027
  interface CreateExchangeSessionResponse {
987
1028
  url: string;
@@ -994,6 +1035,37 @@ interface CreateExchangeSessionResponse {
994
1035
  * @param publishableKey - Optional publishable key, defaults to configured key
995
1036
  */
996
1037
  declare function createExchangeSession(request: CreateExchangeSessionRequest, publishableKey?: string): Promise<CreateExchangeSessionResponse>;
1038
+ /**
1039
+ * Where the provider says an onramp session has got to.
1040
+ *
1041
+ * - `pending` — the provider has no transaction for this session yet (the
1042
+ * user hasn't paid, or hasn't finished paying).
1043
+ * - `processing` — payment taken, crypto on its way.
1044
+ * - `completed` — the provider has sent the crypto.
1045
+ * - `failed` — the payment or the delivery failed.
1046
+ * - `expired` — the session timed out before it was paid.
1047
+ * - `unknown` — we couldn't reach the provider. Not a verdict; retry.
1048
+ */
1049
+ type OnrampSessionStatusValue = 'pending' | 'processing' | 'completed' | 'failed' | 'expired' | 'unknown';
1050
+ interface OnrampSessionStatusResponse {
1051
+ status: OnrampSessionStatusValue;
1052
+ /** Crypto delivered, once the provider reports it. */
1053
+ destination_amount?: string;
1054
+ /** Fiat charged, once the provider reports it. */
1055
+ source_amount?: string;
1056
+ source_currency?: string;
1057
+ transaction_hash?: string;
1058
+ }
1059
+ /**
1060
+ * Read an onramp session's status from its provider, by the `external_id` the
1061
+ * session was created with. Polls transfer sessions rendered as a QR or
1062
+ * deeplink (Binance Pay) and device-wallet orders paid on another device.
1063
+ *
1064
+ * This is the only channel that reports a *payment* — the deposit poller sees
1065
+ * crypto arriving on-chain, which is a later and different event, and never
1066
+ * arrives at all if the payment failed.
1067
+ */
1068
+ declare function getOnrampSessionStatus(externalId: string, publishableKey?: string, signal?: AbortSignal): Promise<OnrampSessionStatusResponse>;
997
1069
  interface ExchangeSessionStartParams {
998
1070
  service_provider: string;
999
1071
  chain_type: string;
@@ -1003,12 +1075,31 @@ interface ExchangeSessionStartParams {
1003
1075
  source_currency?: string;
1004
1076
  source_amount?: string;
1005
1077
  external_id?: string;
1078
+ /** ISO 3166-1 alpha-2 country code of the user. Recorded on the session. */
1079
+ country_code?: string;
1080
+ /**
1081
+ * State/subdivision code (e.g. CA). Recorded on the session, and the only
1082
+ * source for it — no exchange provider reports a subdivision back.
1083
+ */
1084
+ subdivision_code?: string;
1006
1085
  }
1007
1086
  /**
1008
1087
  * Generate a URL for the exchanges/sessions/start endpoint that redirects to the exchange provider.
1009
1088
  * This avoids popup blockers in Safari by opening the URL directly via anchor tag or window.open().
1010
1089
  */
1011
1090
  declare function getExchangeSessionStartUrl(request: ExchangeSessionStartParams, publishableKey: string): string;
1091
+ /**
1092
+ * How a Connect Exchange provider completes the transfer:
1093
+ * - 'oauth': full account connection (holdings/amount/confirm in-app)
1094
+ * - 'redirect': redirect/QR-style payment completed inside the exchange
1095
+ * (e.g. Binance Pay, or Coinbase in regions without OAuth). Named
1096
+ * 'redirect' — not 'link' — to avoid confusion with Stripe Link.
1097
+ *
1098
+ * The server resolves this per provider per request, so clients should branch
1099
+ * on this field rather than hardcoding provider names. Older API versions omit
1100
+ * the field; treat undefined as 'oauth'.
1101
+ */
1102
+ type IntegrationConnectionMethod = 'oauth' | 'redirect';
1012
1103
  interface IntegrationExchangeInfo {
1013
1104
  service_provider: string;
1014
1105
  service_provider_display_name: string;
@@ -1016,17 +1107,57 @@ interface IntegrationExchangeInfo {
1016
1107
  icon_url: string;
1017
1108
  icon_urls: IconUrl[];
1018
1109
  enabled: boolean;
1110
+ connection_method?: IntegrationConnectionMethod;
1019
1111
  supported_networks: string[];
1020
1112
  supported_currencies: string[];
1113
+ /**
1114
+ * The exchange's own minimum order in USD, or null when it sets none.
1115
+ *
1116
+ * Not a deposit minimum: `/supported_deposit_tokens` carries that per chain,
1117
+ * and the two are independent, so an amount screen gates on whichever is
1118
+ * higher. Undefined against API deployments that predate the field, which
1119
+ * reads the same as "no floor of its own".
1120
+ */
1121
+ minimum_amount_usd?: number | null;
1021
1122
  }
1022
1123
  interface IntegrationExchangesResponse {
1023
1124
  data: IntegrationExchangeInfo[];
1024
1125
  }
1126
+ interface GetIntegrationExchangesQuery {
1127
+ /**
1128
+ * ISO 3166-1 alpha-2 country code of the user. Lets the server apply
1129
+ * region-based connection method overrides (e.g. Coinbase redirect flow in
1130
+ * regions without OAuth).
1131
+ */
1132
+ country_code?: string;
1133
+ /**
1134
+ * State/subdivision code of the user (e.g. CA). Reserved for state-level
1135
+ * connection-method/enablement control server-side.
1136
+ */
1137
+ subdivision_code?: string;
1138
+ }
1139
+ /**
1140
+ * Get the exchanges available from the Connect Exchange entrypoint
1141
+ * (Coinbase, Binance, Kraken, etc.).
1142
+ * Returns provider info with icons, enabled status, connection_method
1143
+ * ('oauth' or 'redirect'), and supported networks/currencies.
1144
+ */
1145
+ declare function getIntegrationExchanges(publishableKey?: string, query?: GetIntegrationExchangesQuery): Promise<IntegrationExchangesResponse>;
1146
+ type CreateIntegrationExchangeSessionRequest = CreateExchangeSessionRequest;
1147
+ type CreateIntegrationExchangeSessionResponse = CreateExchangeSessionResponse;
1148
+ type IntegrationExchangeSessionStartParams = ExchangeSessionStartParams;
1149
+ /**
1150
+ * Create a redirect-based exchange payment session for a Connect Exchange
1151
+ * provider whose connection_method is 'redirect'.
1152
+ * Returns a URL that opens the exchange with the deposit address pre-filled.
1153
+ */
1154
+ declare function createIntegrationExchangeSession(request: CreateIntegrationExchangeSessionRequest, publishableKey?: string): Promise<CreateIntegrationExchangeSessionResponse>;
1025
1155
  /**
1026
- * Get available integration OAuth exchanges (Coinbase, Binance, Kraken, etc.)
1027
- * Returns provider info with icons, enabled status, and supported networks/currencies.
1156
+ * Generate a URL for the integrations exchanges/sessions/start endpoint that
1157
+ * redirects (302) to the exchange provider. Opening this URL directly via
1158
+ * anchor tag or window.open() avoids popup blockers in Safari.
1028
1159
  */
1029
- declare function getIntegrationExchanges(publishableKey?: string): Promise<IntegrationExchangesResponse>;
1160
+ declare function getIntegrationExchangeSessionStartUrl(request: IntegrationExchangeSessionStartParams, publishableKey: string): string;
1030
1161
  interface StartIntegrationOAuthResult {
1031
1162
  redirect_url: string;
1032
1163
  state: string;
@@ -2103,6 +2234,23 @@ declare function generateKSUID(): string;
2103
2234
  */
2104
2235
  declare function generatePrefixedKSUID(prefix: string): string;
2105
2236
 
2237
+ /**
2238
+ * The settlement event names, defined once here because every surface emits
2239
+ * the same ones: the modal ({@link DepositEventType},
2240
+ * {@link WithdrawEventType}) and the headless controllers
2241
+ * (`DepositSessionEventType`, `OnrampSessionEventType`) all alias these
2242
+ * members, so one host-side handler can serve any of them. Aliasing rather
2243
+ * than restating the strings is what keeps that promise from drifting — the
2244
+ * enums stay distinct types, but they cannot disagree on a value.
2245
+ */
2246
+ declare enum DirectExecutionEventType {
2247
+ /** A deposit matching the session's addresses was first observed. */
2248
+ DETECTED = "direct_execution.detected",
2249
+ /** An observed execution changed status. */
2250
+ UPDATED = "direct_execution.updated",
2251
+ SUCCEEDED = "direct_execution.succeeded",
2252
+ FAILED = "direct_execution.failed"
2253
+ }
2106
2254
  /** Event types emitted by the deposit flow, following `resource.action` convention */
2107
2255
  declare enum DepositEventType {
2108
2256
  ONRAMP_SESSION_CREATED = "onramp_session.created",
@@ -2637,6 +2785,79 @@ declare function mapWalletToDepositAddress(wallet: Wallet): DepositAddress;
2637
2785
  * which custom (headless) UIs need to render an execution timeline.
2638
2786
  */
2639
2787
  declare function mapDirectExecution(execution: DirectExecutionResponse): DirectExecution;
2788
+ /**
2789
+ * One provider's quote for a fiat → crypto onramp purchase.
2790
+ *
2791
+ * camelCase SDK projection of the wire {@link OnrampQuote} returned by
2792
+ * `POST /v1/public/onramps/quotes`. Amounts are denominated in
2793
+ * `sourceCurrency` (fees, source) and `destinationCurrency` (destination).
2794
+ */
2795
+ interface OnrampProviderQuote {
2796
+ /** Stable provider identifier — pass to `selectQuote()` / session creation. */
2797
+ serviceProvider: string;
2798
+ serviceProviderDisplayName: string;
2799
+ paymentMethodType: OnrampSessionPaymentMethodType;
2800
+ sourceCurrency: string;
2801
+ countryCode: string;
2802
+ sourceAmount: number;
2803
+ sourceAmountWithoutFees: number;
2804
+ totalFee: number;
2805
+ networkFee: number;
2806
+ transactionFee: number;
2807
+ /** Provider-charged partner fee, when disclosed. */
2808
+ partnerFee: number | null;
2809
+ destinationAmount: number;
2810
+ destinationAmountWithoutFees: number | null;
2811
+ destinationCurrency: string;
2812
+ destinationNetwork: string;
2813
+ exchangeRate: number;
2814
+ /** Backend ranking signal (higher is better) used for the default ordering. */
2815
+ customerScore: number;
2816
+ /** True when the provider settles without a document-upload KYC step. */
2817
+ lowKyc: boolean;
2818
+ iconUrl: string;
2819
+ iconUrls: IconUrl[];
2820
+ institutionName: string | null;
2821
+ }
2822
+ /** Map a wire {@link OnrampQuote} to the SDK-facing {@link OnrampProviderQuote}. */
2823
+ declare function mapOnrampQuote(quote: OnrampQuote): OnrampProviderQuote;
2824
+ /**
2825
+ * The onramp-side destination for a card purchase: which provider network /
2826
+ * currency the funds are bought on, and the token that lands there before
2827
+ * Unifold converts it to the host's destination.
2828
+ *
2829
+ * camelCase SDK projection of the wire {@link DefaultTokenResponse} returned
2830
+ * by `GET /v1/public/onramps/default_token`.
2831
+ */
2832
+ interface OnrampDestinationToken {
2833
+ /** Provider-side network identifier — the `destination_network` for quotes/sessions. */
2834
+ network: string;
2835
+ /** Provider-side currency code — the `destination_currency` for quotes/sessions. */
2836
+ currency: string;
2837
+ /**
2838
+ * Whether the token the host asked to receive is a stablecoin. Quoting by a
2839
+ * fixed `destinationAmount` prices an exact quantity of the provider-side
2840
+ * currency above, so it only matches the requested token when that token is
2841
+ * a stablecoin too — the session refuses destination mode otherwise.
2842
+ */
2843
+ isStablecoin: boolean;
2844
+ token: {
2845
+ symbol: string;
2846
+ name: string;
2847
+ tokenAddress: string;
2848
+ decimals: number;
2849
+ chainId: string;
2850
+ chainType: ChainType;
2851
+ chainName: string;
2852
+ iconUrl: string;
2853
+ iconUrls: IconUrl[];
2854
+ chainIconUrl: string;
2855
+ };
2856
+ /** Estimated provider processing time in seconds, when known. */
2857
+ estimatedProcessingTimeSeconds: number | null;
2858
+ }
2859
+ /** Map a wire {@link DefaultTokenResponse} to the SDK-facing {@link OnrampDestinationToken}. */
2860
+ declare function mapDefaultOnrampToken(response: DefaultTokenResponse): OnrampDestinationToken;
2640
2861
 
2641
2862
  /** How often `/direct_executions/query` is polled (modal: POLL_INTERVAL_MS). */
2642
2863
  declare const DETECTION_POLL_INTERVAL_MS = 2500;
@@ -2672,7 +2893,6 @@ declare enum DepositSessionEventType {
2672
2893
  EXECUTION_DETECTED = "direct_execution.detected",
2673
2894
  /** Any status transition on a tracked execution. */
2674
2895
  EXECUTION_UPDATED = "direct_execution.updated",
2675
- /** Kept byte-compatible with the modal's DepositEventType member. */
2676
2896
  EXECUTION_SUCCEEDED = "direct_execution.succeeded",
2677
2897
  EXECUTION_FAILED = "direct_execution.failed"
2678
2898
  }
@@ -2958,6 +3178,523 @@ declare class DepositSession {
2958
3178
  private emitExecutionEvent;
2959
3179
  }
2960
3180
 
3181
+ /** How often quotes auto-refresh while awaiting checkout (modal: 60s countdown). */
3182
+ declare const QUOTE_REFRESH_INTERVAL_MS = 60000;
3183
+ /**
3184
+ * Events emitted by {@link OnrampSession}, following the
3185
+ * `resource.action` convention. Two names are intentionally byte-compatible
3186
+ * with existing surfaces so one host-side handler can serve modal `onEvent`
3187
+ * events and headless session events — both are **aliased** from their
3188
+ * defining enum rather than restated, so the two can never drift apart:
3189
+ *
3190
+ * - `onramp_session.created` from the modal's
3191
+ * {@link DepositEventType.ONRAMP_SESSION_CREATED} (its `data.object` is a
3192
+ * superset of the modal's `{ externalId }`),
3193
+ * - `direct_execution.*` from the shared {@link DirectExecutionEventType} —
3194
+ * the onramp settlement is the same direct-execution resource as a manual
3195
+ * transfer, so `DepositSessionEventType` aliases the same members.
3196
+ */
3197
+ declare enum OnrampSessionEventType {
3198
+ SESSION_STARTED = "onramp_session.started",
3199
+ ADDRESSES_CREATED = "onramp_session.addresses_created",
3200
+ /** A fresh set of provider quotes was fetched (initial, refresh, or after updateQuoteRequest). */
3201
+ QUOTES_UPDATED = "onramp_session.quotes_updated",
3202
+ /** Provider checkout created — the modal's `onramp_session.created`. */
3203
+ CHECKOUT_CREATED = "onramp_session.created",
3204
+ SESSION_STOPPED = "onramp_session.stopped",
3205
+ /** Non-fatal (quote refresh / polling outage) and fatal errors; `data.object.fatal` distinguishes. */
3206
+ SESSION_ERRORED = "onramp_session.errored",
3207
+ EXECUTION_DETECTED = "direct_execution.detected",
3208
+ EXECUTION_UPDATED = "direct_execution.updated",
3209
+ EXECUTION_SUCCEEDED = "direct_execution.succeeded",
3210
+ EXECUTION_FAILED = "direct_execution.failed"
3211
+ }
3212
+ type OnrampSessionErrorCode = 'ADDRESS_CREATION_FAILED' | 'DESTINATION_TOKEN_FAILED' | 'DESTINATION_AMOUNT_UNSUPPORTED' | 'QUOTES_FAILED' | 'POLLING_ERROR' | 'DEPOSIT_FAILED' | 'INVALID_RECIPIENT';
3213
+ interface OnrampSessionError {
3214
+ code: OnrampSessionErrorCode;
3215
+ message: string;
3216
+ /** Fatal errors end the run (status 'error'); non-fatal ones don't stop the flow. */
3217
+ fatal: boolean;
3218
+ cause?: unknown;
3219
+ }
3220
+ interface OnrampSessionEventDataMap {
3221
+ [OnrampSessionEventType.SESSION_STARTED]: {
3222
+ sessionId: string;
3223
+ };
3224
+ [OnrampSessionEventType.ADDRESSES_CREATED]: {
3225
+ sessionId: string;
3226
+ addresses: DepositAddress[];
3227
+ };
3228
+ [OnrampSessionEventType.QUOTES_UPDATED]: {
3229
+ sessionId: string;
3230
+ quotes: OnrampProviderQuote[];
3231
+ selectedQuote: OnrampProviderQuote | null;
3232
+ };
3233
+ [OnrampSessionEventType.CHECKOUT_CREATED]: {
3234
+ /** Kept first-class for byte-compatibility with the modal's `{ externalId }`. */
3235
+ externalId: string;
3236
+ sessionId: string;
3237
+ url: string;
3238
+ serviceProvider: string;
3239
+ };
3240
+ [OnrampSessionEventType.SESSION_STOPPED]: {
3241
+ sessionId: string;
3242
+ };
3243
+ [OnrampSessionEventType.SESSION_ERRORED]: {
3244
+ sessionId: string;
3245
+ code: OnrampSessionErrorCode;
3246
+ message: string;
3247
+ fatal: boolean;
3248
+ };
3249
+ [OnrampSessionEventType.EXECUTION_DETECTED]: DirectExecution;
3250
+ [OnrampSessionEventType.EXECUTION_UPDATED]: DirectExecution & {
3251
+ previousStatus: ExecutionStatus | null;
3252
+ };
3253
+ [OnrampSessionEventType.EXECUTION_SUCCEEDED]: DirectExecution;
3254
+ [OnrampSessionEventType.EXECUTION_FAILED]: DirectExecution;
3255
+ }
3256
+ /**
3257
+ * Event envelope emitted by the onramp session. Mirrors the
3258
+ * server-side webhook payload shape (top-level `id`, `type`, `created`,
3259
+ * resource under `data.object`), with `sevt_` IDs to distinguish from
3260
+ * backend `evt_` IDs.
3261
+ */
3262
+ type OnrampSessionEvent = {
3263
+ [K in OnrampSessionEventType]: {
3264
+ id: string;
3265
+ type: K;
3266
+ created: number;
3267
+ /** Rail hint — 'card' (or 'apple_pay' when paymentMethodType is apple_pay). */
3268
+ method?: DepositMethod;
3269
+ data: {
3270
+ object: OnrampSessionEventDataMap[K];
3271
+ };
3272
+ };
3273
+ }[OnrampSessionEventType];
3274
+ /** Map from event type to its fully-narrowed envelope. */
3275
+ type OnrampSessionEventMap = {
3276
+ [K in OnrampSessionEventType]: Extract<OnrampSessionEvent, {
3277
+ type: K;
3278
+ }>;
3279
+ };
3280
+ /**
3281
+ * The mutable amount side of the quote request. Everything else about the
3282
+ * flow (destination, user) is session identity and requires a new session.
3283
+ *
3284
+ * Quoting works in one of two AMOUNT MODES — provide exactly one:
3285
+ *
3286
+ * - **Source mode** (`sourceAmount`): "spend 100 USD" — the user pays exactly
3287
+ * this, fees included; the crypto received is what remains
3288
+ * (`quote.destinationAmount`).
3289
+ * - **Destination mode** (`destinationAmount`): "receive 100 USDC" — the
3290
+ * crypto amount is fixed and provider fees are added on top; the fiat the
3291
+ * user pays is `quote.sourceAmount`. Only providers that can quote by a
3292
+ * fixed destination amount participate (the backend omits the rest from
3293
+ * the results, so `quotes` is already filtered).
3294
+ */
3295
+ interface OnrampQuoteRequest {
3296
+ /**
3297
+ * ISO 3166-1 alpha-2 country of the payer. OPTIONAL — when omitted, the
3298
+ * session auto-detects it from the caller's IP during start() (public
3299
+ * `/ip_address` endpoint, same signal as the modal), falling back to 'US'
3300
+ * when detection fails (modal parity). Provide it only to override
3301
+ * detection with your own geo signal. The effective value is exposed as
3302
+ * `snapshot.countryCode`.
3303
+ */
3304
+ countryCode?: string;
3305
+ /**
3306
+ * ISO 3166-2 subdivision (e.g. 'US-NY') when relevant for provider
3307
+ * routing. Auto-detected alongside the country when `countryCode` is
3308
+ * omitted; never mixed with an explicit `countryCode` (a detected
3309
+ * subdivision only applies to the detected country).
3310
+ */
3311
+ subdivisionCode?: string;
3312
+ /**
3313
+ * Fiat amount to spend, as a decimal string (e.g. '100' / '99.50'), fees
3314
+ * included. Mutually exclusive with `destinationAmount`.
3315
+ */
3316
+ sourceAmount?: string;
3317
+ /**
3318
+ * Fixed crypto (destination) amount to receive, as a decimal string, with
3319
+ * provider fees added on top. Mutually exclusive with `sourceAmount`.
3320
+ *
3321
+ * Only available when the destination token is a stablecoin
3322
+ * (`snapshot.destinationToken.isStablecoin`): the amount prices an exact
3323
+ * quantity of the provider-side currency, which only matches the requested
3324
+ * token 1:1 for stablecoins. Otherwise quoting stops with a non-fatal
3325
+ * `DESTINATION_AMOUNT_UNSUPPORTED` error (modal parity) until the host
3326
+ * switches back to `sourceAmount`.
3327
+ */
3328
+ destinationAmount?: string;
3329
+ /** ISO 4217 fiat currency code the user pays in. @default 'usd' */
3330
+ sourceCurrency?: string;
3331
+ }
3332
+ interface OnrampSessionParams {
3333
+ /** Host platform's stable user identifier (maps to external_user_id). */
3334
+ externalUserId: string;
3335
+ /** Destination — what the purchase converts into and where it lands. */
3336
+ destination: DepositSessionDestination;
3337
+ /** Initial fiat quote request; mutable later via {@link OnrampSession.updateQuoteRequest}. */
3338
+ quoteRequest: OnrampQuoteRequest;
3339
+ /**
3340
+ * Payment rail forwarded to the provider session. @default 'card'
3341
+ * (`apple_pay` / `sepa` / `us_bank_account` reuse the same unified flow).
3342
+ */
3343
+ paymentMethodType?: OnrampSessionPaymentMethodType;
3344
+ /** Prefill email forwarded to the provider checkout. */
3345
+ email?: string;
3346
+ /**
3347
+ * Auto-refresh interval for quotes while awaiting checkout.
3348
+ * Set 0 to disable (call refreshQuotes() yourself). @default 60000
3349
+ */
3350
+ quoteRefreshIntervalMs?: number;
3351
+ }
3352
+ /** Internal construction config — created via `UnifoldClient.createOnrampSession`. */
3353
+ interface OnrampSessionConfig extends OnrampSessionParams {
3354
+ publishableKey: string;
3355
+ }
3356
+ /**
3357
+ * Session status is LIFECYCLE-ONLY (same principle as {@link DepositSession}):
3358
+ * a card purchase can settle as multiple executions, so execution outcomes
3359
+ * never appear here — they live on `snapshot.executions` / `latestExecution`,
3360
+ * the `direct_execution.succeeded`/`.failed` events, and `waitForSuccess()`.
3361
+ */
3362
+ type OnrampSessionStatus = 'idle' | 'preparing' | 'quoting' | 'ready' | 'awaiting_payment' | 'processing' | 'error';
3363
+ /** A provider-hosted checkout created by {@link OnrampSession.createCheckout}. */
3364
+ interface OnrampCheckout {
3365
+ /**
3366
+ * Single-use redirect URL to the provider's hosted checkout. Open it
3367
+ * synchronously from your click handler (`window.open(checkout.url)`) —
3368
+ * building it requires no network round-trip, so popup blockers stay happy.
3369
+ */
3370
+ url: string;
3371
+ /** Correlation id (`orsext_*`) stamped on the provider session. */
3372
+ externalId: string;
3373
+ serviceProvider: string;
3374
+ /** The quote the checkout was created from (price shown to the user). */
3375
+ quote: OnrampProviderQuote;
3376
+ /** Requested fiat spend; null in destination mode (read `quote.sourceAmount` for the fee-inclusive fiat). */
3377
+ sourceAmount: string | null;
3378
+ /** Requested fixed crypto amount; null in source mode. */
3379
+ destinationAmount: string | null;
3380
+ sourceCurrency: string;
3381
+ /** Epoch ms the checkout was created. */
3382
+ createdAt: number;
3383
+ }
3384
+ interface OnrampSessionSnapshot {
3385
+ status: OnrampSessionStatus;
3386
+ /**
3387
+ * Effective payer country driving quotes: the host-supplied override when
3388
+ * given, otherwise the IP-detected country ('US' when detection failed).
3389
+ * Null until known (before start() finishes preparing, when no override).
3390
+ */
3391
+ countryCode: string | null;
3392
+ /** Deposit addresses backing the purchase (one per chain type); empty until created. */
3393
+ addresses: DepositAddress[];
3394
+ /**
3395
+ * Provider-side network/currency the fiat is converted on; null until
3396
+ * resolved, and briefly again while a payer-country change is re-resolving
3397
+ * it (the routing is geo-dependent).
3398
+ */
3399
+ destinationToken: OnrampDestinationToken | null;
3400
+ /** Latest provider quotes, backend priority order; empty while loading or on failure. */
3401
+ quotes: OnrampProviderQuote[];
3402
+ /** Quote used by createCheckout() — auto-picked (quotes[0]) unless selectQuote() was called. */
3403
+ selectedQuote: OnrampProviderQuote | null;
3404
+ /** False once the host picked a provider via selectQuote() (sticky across refreshes). */
3405
+ isQuoteAutoSelected: boolean;
3406
+ /**
3407
+ * True when there is more than one quote to pick between — gate your
3408
+ * provider-picker UI on this. False when the project's fiat-onramp smart
3409
+ * routing is enabled (the backend collapses the list to a single routed
3410
+ * quote; there is no dedicated response flag) or when only one provider
3411
+ * quotes this request.
3412
+ */
3413
+ canSelectProvider: boolean;
3414
+ /** True while a (re)fetch of quotes is in flight. */
3415
+ isRefreshingQuotes: boolean;
3416
+ /** Epoch ms of the last successful quote fetch — drive your own countdown. */
3417
+ quotesUpdatedAt: number | null;
3418
+ /** The active provider checkout; null until createCheckout(). */
3419
+ checkout: OnrampCheckout | null;
3420
+ /** All executions observed since checkout, newest first. */
3421
+ executions: DirectExecution[];
3422
+ latestExecution: DirectExecution | null;
3423
+ /** True while the backend is actively scanning for the provider's transfer. */
3424
+ isCheckingDeposit: boolean;
3425
+ /** Latest non-fatal (quote refresh / polling outage) or fatal error, if any. */
3426
+ error: OnrampSessionError | null;
3427
+ }
3428
+ interface OnrampSessionWaitOptions {
3429
+ /**
3430
+ * Abort the wait (reject with code 'ABORTED'). Cancels only the wait — the
3431
+ * session keeps watching, because a card purchase is not cancelable from
3432
+ * the SDK once the user has paid at the provider. For a deadline, compose
3433
+ * `waitForSuccess({ signal: AbortSignal.timeout(60_000) })` and treat it as
3434
+ * "outcome unknown", not "outcome bad".
3435
+ */
3436
+ signal?: AbortSignal;
3437
+ }
3438
+ type OnrampSessionWaitErrorCode = 'ABORTED' | 'DESTROYED' | 'DEPOSIT_FAILED' | 'SESSION_ERROR';
3439
+ /** Rejection type for {@link OnrampSession.waitForStatus} / {@link OnrampSession.waitForSuccess}. */
3440
+ declare class OnrampSessionWaitError extends Error {
3441
+ readonly code: OnrampSessionWaitErrorCode;
3442
+ /** Failed execution (`DEPOSIT_FAILED`) or fatal {@link OnrampSessionError} (`SESSION_ERROR`). */
3443
+ readonly cause?: unknown;
3444
+ constructor(code: OnrampSessionWaitErrorCode, message: string, cause?: unknown);
3445
+ }
3446
+ /**
3447
+ * Headless controller for one attempt by one user to buy crypto with a card
3448
+ * (fiat onramp) into a destination — the no-UI equivalent of the modal's
3449
+ * `beginDeposit({ initialScreen: 'card' })`. Owns:
3450
+ *
3451
+ * 1. creating/fetching the deposit addresses the provider settles into,
3452
+ * 2. resolving the onramp destination token (provider network/currency),
3453
+ * 3. fetching + auto-refreshing provider quotes, with sticky manual selection,
3454
+ * 4. building the provider checkout URL (synchronous — popup-blocker safe),
3455
+ * 5. watching for the provider's on-chain settlement by composing a
3456
+ * {@link DepositSession} (method 'card') — same detection polling, scan
3457
+ * nudge, lookback window, and `direct_execution.*` events as a transfer.
3458
+ *
3459
+ * UI state should come from {@link getSnapshot} (or the React hook built on
3460
+ * it); events are for side effects (analytics, toasts, navigation).
3461
+ *
3462
+ * Geo: the payer country drives quoting, so when the host doesn't supply
3463
+ * `countryCode` the session auto-detects it from the caller's IP (public
3464
+ * `/ip_address` endpoint; 'US' fallback — modal parity). An explicit
3465
+ * `countryCode` always overrides and suppresses detection. This deliberately
3466
+ * differs from DepositSession's not-IP-aware stance: there geo is a policy
3467
+ * gate the host opts into; here it is a functional input of the quote.
3468
+ * Fiat min/max validation is host-side against `getFiatCurrencies()` — the
3469
+ * session only requires a parseable amount > 0.
3470
+ */
3471
+ declare class OnrampSession {
3472
+ /** Immutable id for correlation, `osess_<ksuid>`. Client-generated. */
3473
+ readonly id: string;
3474
+ private readonly emitter;
3475
+ private readonly listeners;
3476
+ private readonly publishableKey;
3477
+ private readonly externalUserId;
3478
+ private readonly destination;
3479
+ private readonly paymentMethodType;
3480
+ private readonly email?;
3481
+ private readonly quoteRefreshIntervalMs;
3482
+ private readonly method;
3483
+ private explicitCountryCode?;
3484
+ private explicitSubdivisionCode?;
3485
+ private detectedCountryCode;
3486
+ private detectedSubdivisionCode;
3487
+ private sourceAmount?;
3488
+ private destinationAmount?;
3489
+ private sourceCurrency;
3490
+ private runToken;
3491
+ private startPromise;
3492
+ private destroyed;
3493
+ /** Pending waiter rejections, invoked by destroy() so waiters never hang. */
3494
+ private waiterDestroyCallbacks;
3495
+ /** In-flight destination-token + quotes pipeline (see syncQuoteInputs). */
3496
+ private syncPromise;
3497
+ /** A sync was asked for mid-pipeline; the loop owes it another pass. */
3498
+ private syncRequested;
3499
+ /** Code of the non-fatal error already reported, so a streak emits once. */
3500
+ private nonFatalErrorLatch;
3501
+ /** True once run() got past preparing — gates live quote-input syncing. */
3502
+ private prepared;
3503
+ private refreshTimer;
3504
+ /** service_provider chosen via selectQuote(); sticky across quote refreshes. */
3505
+ private manualSelection;
3506
+ /** First execution to succeed this run — waitForSuccess's one-shot answer. */
3507
+ private firstSuccess;
3508
+ private watcher;
3509
+ private watcherOffs;
3510
+ private status;
3511
+ private addresses;
3512
+ private destinationToken;
3513
+ /** Geo `destinationToken` was resolved for; null while unresolved. */
3514
+ private destinationTokenGeoKey;
3515
+ private quotes;
3516
+ private selectedQuote;
3517
+ private isRefreshingQuotes;
3518
+ private quotesUpdatedAt;
3519
+ private checkout;
3520
+ private executions;
3521
+ private checkingDeposit;
3522
+ private error;
3523
+ private snapshot;
3524
+ constructor(config: OnrampSessionConfig);
3525
+ /** Synchronous snapshot; the reference is stable until state changes. */
3526
+ getSnapshot(): OnrampSessionSnapshot;
3527
+ /**
3528
+ * Subscribe to snapshot changes (external-store contract; drives
3529
+ * `useSyncExternalStore` in the React binding). Returns an unsubscribe fn.
3530
+ */
3531
+ subscribe(listener: () => void): () => void;
3532
+ /** Typed event subscription. Returns an unsubscribe function. */
3533
+ on<K extends OnrampSessionEventType>(type: K, handler: (event: OnrampSessionEventMap[K]) => void): () => void;
3534
+ on(type: '*', handler: (event: OnrampSessionEvent) => void): () => void;
3535
+ /**
3536
+ * Creates/fetches addresses, resolves the onramp destination token (both
3537
+ * with fail-fast recipient validation), and fetches the first quotes.
3538
+ * Idempotent while running; callable again after stop() or a fatal error.
3539
+ */
3540
+ start(): Promise<void>;
3541
+ /**
3542
+ * Update the quote request (amount / currency / country) and refetch
3543
+ * quotes. Debounce keystrokes host-side — every call that changes
3544
+ * something hits the quotes API. No-op after createCheckout().
3545
+ *
3546
+ * Amount-mode switching: patching `sourceAmount` while in destination mode
3547
+ * (or `destinationAmount` while in source mode) switches modes — the other
3548
+ * amount is cleared. Patching BOTH to truthy values in one call throws
3549
+ * (exactly one drives quoting).
3550
+ */
3551
+ updateQuoteRequest(patch: Partial<OnrampQuoteRequest>): void;
3552
+ /** Refetch quotes with the current request. Resolves when the fetch settles. */
3553
+ refreshQuotes(): Promise<void>;
3554
+ /**
3555
+ * Pick a provider quote by `serviceProvider`. The selection is sticky
3556
+ * across refreshes: while the provider keeps quoting it stays selected
3557
+ * (with fresh pricing); if it drops out, selection falls back to the
3558
+ * backend's top quote and auto-selection resumes.
3559
+ *
3560
+ * Returns the selected quote, or null when no quote matches.
3561
+ */
3562
+ selectQuote(serviceProvider: string): OnrampProviderQuote | null;
3563
+ /**
3564
+ * Build the provider-hosted checkout and start watching the deposit
3565
+ * addresses for the provider's on-chain settlement.
3566
+ *
3567
+ * Uses `snapshot.selectedQuote` (backend's top quote unless the host called
3568
+ * selectQuote()). Hosts that manage their own selection UI can instead pass
3569
+ * `options.serviceProvider` for a one-shot choice without mutating the
3570
+ * sticky selection.
3571
+ *
3572
+ * Synchronous by design: the URL is assembled locally (single-use token
3573
+ * exchange happens when it is opened), so hosts can `window.open()` the
3574
+ * result inside the click handler without tripping popup blockers.
3575
+ *
3576
+ * Throws when the session is not ready (no matching quote / addresses or
3577
+ * destination token missing) — gate your button on `status === 'ready'`
3578
+ * and `selectedQuote`.
3579
+ */
3580
+ createCheckout(options?: {
3581
+ serviceProvider?: string;
3582
+ email?: string;
3583
+ externalId?: string;
3584
+ }): OnrampCheckout;
3585
+ /**
3586
+ * Stops quote refresh and settlement watching. The session can be
3587
+ * restarted with start(), which resets quotes/checkout/executions
3588
+ * (fresh run).
3589
+ */
3590
+ stop(): void;
3591
+ /** stop() + release all listeners. Terminal — start() rejects afterwards. */
3592
+ destroy(): void;
3593
+ /**
3594
+ * Resolve when the session reaches one of the given statuses (immediately
3595
+ * if it's already there) — e.g. `waitForStatus('ready')` awaits quotes,
3596
+ * `waitForStatus('processing')` awaits detection of the settlement.
3597
+ * Statuses carry no outcomes; await those with {@link waitForSuccess}.
3598
+ *
3599
+ * Rejects with {@link OnrampSessionWaitError} on abort or destroy().
3600
+ * Does not start or stop the session — it only listens.
3601
+ */
3602
+ waitForStatus(status: OnrampSessionStatus | OnrampSessionStatus[], options?: OnrampSessionWaitOptions): Promise<OnrampSessionSnapshot>;
3603
+ /**
3604
+ * Resolve with the **first** succeeded {@link DirectExecution} observed by
3605
+ * this session — same one-shot first-completion contract as
3606
+ * {@link DepositSession.waitForSuccess}. A failure only rejects
3607
+ * (`DEPOSIT_FAILED`) when no other observed execution is still in flight;
3608
+ * fatal session errors reject with `SESSION_ERROR`. The session keeps
3609
+ * watching after success — subscribe to `direct_execution.succeeded` to
3610
+ * react to every settlement.
3611
+ */
3612
+ waitForSuccess(options?: OnrampSessionWaitOptions): Promise<DirectExecution>;
3613
+ /** Shared waiter plumbing — AbortSignal / destroy() rejection with single settlement. */
3614
+ private installWaiter;
3615
+ private run;
3616
+ private failFatally;
3617
+ private createAddressesWithRetry;
3618
+ /** Host-supplied geo wins; otherwise the IP-detected value; 'US' as a last resort. */
3619
+ private effectiveCountryCode;
3620
+ /**
3621
+ * Explicit subdivision wins. A detected subdivision applies only while the
3622
+ * country is also detected — mixing a detected subdivision into an
3623
+ * explicitly-set country would pin quotes to a region of the wrong country.
3624
+ */
3625
+ private effectiveSubdivisionCode;
3626
+ /**
3627
+ * Auto-detect the payer's country from their IP when the host didn't
3628
+ * supply one — so integrators don't need to build geo plumbing to render
3629
+ * a buy screen. Never fatal: detection failure falls back to 'US' (modal
3630
+ * parity — BuyWithCard quotes with `userIpInfo?.alpha2 || 'US'`). The
3631
+ * detection result is cached for the session's lifetime (restarts reuse
3632
+ * it); an explicit countryCode — at construction or via
3633
+ * updateQuoteRequest — always overrides.
3634
+ */
3635
+ private resolveCountry;
3636
+ /** Identity of the geo a destination-token resolution was made for. */
3637
+ private geoKey;
3638
+ /**
3639
+ * Resolve the provider-side network/currency the destination maps to. The
3640
+ * geo it was resolved for travels with the result: routing is
3641
+ * geo-dependent, so the caller has to know when a later country change
3642
+ * invalidates it.
3643
+ */
3644
+ private resolveDestinationToken;
3645
+ /**
3646
+ * Fail-fast recipient validation — parity with DepositSession. Fails open
3647
+ * on network errors (the backend still enforces at execution time), but a
3648
+ * definitive negative result is fatal.
3649
+ */
3650
+ private runStartChecks;
3651
+ /**
3652
+ * Bring the quote inputs and the destination token back in sync, then
3653
+ * fetch quotes. Destination-token routing is geo-dependent (the modal
3654
+ * re-runs its default-token effect whenever `userIpInfo` changes), so a
3655
+ * payer-country change has to re-resolve it first — quoting on the network
3656
+ * and currency routed for the previous geo would also carry into the
3657
+ * checkout built from those quotes.
3658
+ */
3659
+ private syncQuoteInputs;
3660
+ /** Loops until the session state matches the inputs it was built from. */
3661
+ private syncQuoteInputsUntilFresh;
3662
+ /**
3663
+ * Re-resolve the destination token for the current geo. Returns false when
3664
+ * the run ended or the lookup failed.
3665
+ */
3666
+ private resolveDestinationTokenForGeo;
3667
+ /** Returns true when the request inputs moved and quotes must be refetched. */
3668
+ private fetchQuotesOnce;
3669
+ /**
3670
+ * Record a non-fatal error and announce it once per streak — auto-refresh
3671
+ * keeps retrying, and repeating the event every 60s would be noise.
3672
+ */
3673
+ private raiseNonFatal;
3674
+ /** Sticky manual selection: keep the host's provider while it still quotes. */
3675
+ private reconcileSelection;
3676
+ /**
3677
+ * Start (once) the composed {@link DepositSession} that watches the deposit
3678
+ * addresses for the provider's on-chain settlement. Its baseline starts at
3679
+ * checkout time — correct for card rails, where funds can only arrive after
3680
+ * the user pays at the provider. Detection polling, the backend scan nudge
3681
+ * (auto-armed), the lookback window, and `direct_execution.*` semantics are
3682
+ * all inherited rather than reimplemented.
3683
+ */
3684
+ private startWatcher;
3685
+ private syncFromWatcher;
3686
+ private forwardExecutionEvent;
3687
+ private teardownWatcher;
3688
+ private anyExecutionInFlight;
3689
+ private setStatus;
3690
+ private clearRefreshTimer;
3691
+ private buildSnapshot;
3692
+ /** Rebuild the snapshot so getSnapshot() reflects current state. */
3693
+ private commit;
3694
+ private notify;
3695
+ private emitSessionEvent;
3696
+ }
3697
+
2961
3698
  interface UnifoldClientOptions {
2962
3699
  /** Publishable key (`pk_test_*` / `pk_live_*`). */
2963
3700
  publishableKey: string;
@@ -3011,6 +3748,8 @@ declare class UnifoldClient {
3011
3748
  constructor(options: UnifoldClientOptions);
3012
3749
  /** Create a headless deposit-session flow controller. */
3013
3750
  createDepositSession(params: DepositSessionParams): DepositSession;
3751
+ /** Create a headless fiat-onramp flow controller (buy with card by default). */
3752
+ createOnrampSession(params: OnrampSessionParams): OnrampSession;
3014
3753
  /**
3015
3754
  * Create (idempotently) and return the user's deposit addresses for a
3016
3755
  * destination — `POST /v1/public/deposit_addresses`.
@@ -3153,4 +3892,4 @@ declare const i18n: {
3153
3892
  };
3154
3893
  type I18nStrings = typeof i18n;
3155
3894
 
3156
- export { type AccountConnectionData, ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AddressVerification, type ApplePayLimitUpgradeStatus, type ApplePayProvider, type ApplePayProvidersResponse, type AuthenticateOAuthResult, type AutoSwapRequest, type AutoSwapResponse, type BankTransferConfig, type BankTransferProvider, type BankTransferProvidersResponse, type BlockedCountrySubdivision, type BuildHypercoreTransactionRequest, type BuildHypercoreTransactionResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type CashAppLimits, type CashAppSessionRequest, type CashAppSessionResponse, type CashAppSessionStatusResponse, type ChainType, type CheckoutEvent, CheckoutEventType, type CheckoutFlowFailedData, type CheckoutFlowStartedData, type CheckoutMethod, type CheckoutMethodSelectedData, type CheckoutPaymentIntent, type CheckoutPaymentIntentData, type CheckoutPaymentIntentSucceededEvent, type CoinbaseApplePayLimit, type CoinbaseApplePayLimitUpgradeOption, type CoinbaseApplePayLimitsResponse, type CoinbaseApplePaySessionResponse, type CoinbaseGooglePaySessionResponse, type CoinbaseLegalAgreement, type CoinbaseLegalAgreementsResponse, type CoinbaseWalletPayLimit, type CoinbaseWalletPayLimitUpgradeOption, type CoinbaseWalletPayLimitsResponse, type CoinbaseWalletPaySessionResponse, type ConfirmIntegrationTransferResult, type CreateCoinbaseApplePaySessionRequest, type CreateCoinbaseGooglePaySessionRequest, type CreateCoinbaseWalletPaySessionRequest, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type CreateIntegrationTransferParams, type CreateIntegrationTransferResult, type CreateOnrampVerificationSessionRequest, DETECTION_ARM_DELAY_MS, DETECTION_POLL_INTERVAL_MS, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddress, type DepositAddressParams, type DepositAddressResponse, DepositAddressValidationError, type DepositEvent, DepositEventType, type DepositFlowFailedData, type DepositFlowStartedData, type DepositLimitReachedData, type DepositMethod, type DepositMethodSelectedData, type DepositQuote, type DepositQuoteRequest, DepositSession, type DepositSessionConfig, type DepositSessionDestination, type DepositSessionError, type DepositSessionErrorCode, type DepositSessionEvent, type DepositSessionEventMap, DepositSessionEventType, type DepositSessionParams, type DepositSessionSnapshot, type DepositSessionStatus, DepositSessionWaitError, type DepositSessionWaitErrorCode, type DepositSessionWaitOptions, type DestinationToken, type DestinationTokenChain, type DirectExecution, type DirectExecutionFailedEvent, type DirectExecutionResponse, type DirectExecutionSucceededEvent, type EvmContractCall, type ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type ExternalWalletChainType, type ExternalWalletInfo, type ExternalWalletsResponse, type FeaturedToken, type FeaturedWallet, type FiatCurrenciesResponse, type FiatCurrency, type GetBankTransferProvidersOptions, type GetExchangesQuery, type GooglePayProvider, type GooglePayProvidersResponse, type HypercoreActivationRequest, type HypercoreActivationResponse, type I18nStrings, type IconUrl, IneligibilityReason, type IntegrationAccount, type IntegrationExchangeInfo, type IntegrationExchangesResponse, type IntegrationFeeAmount, type IntegrationHoldingsResponse, IntegrationProvider, IntegrationTransferError, type IntegrationTransferErrorType, type IpAddressResponse, LOOKBACK_MS, type ListExecutionsParams, type LockedQuoteLimits, type LockedQuotePreview, type LockedQuotePreviewRequest, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionCreatedData, type OnrampSessionCreatedEvent, type OnrampSessionPaymentMethod, type OnrampSessionPaymentMethodType, type OnrampSessionRequest, type OnrampSessionResponse, type OnrampVerificationFactor, type OnrampVerificationFactorStatus, type OnrampVerificationSession, type OnrampVerificationStatus, type OnrampVerificationTokenResponse, type PaymentIntent, type PaymentIntentDepositAddress, type PaymentIntentExecutionsResponse, type PaymentIntentStatus, type PaymentIntentType, type PaymentNetwork, type PollExecutionsRequest, type PollExecutionsResponse, type ProductType, type ProjectConfigResponse, type ProviderSelectedData, type PublicIncidentResponse, type QueryExecutionsRequest, type QueryExecutionsResponse, type RefreshIntegrationTokenResult, type RequestCoinbaseApplePayLimitUpgradeRequest, type RequestCoinbaseApplePayLimitUpgradeResponse, type RequestCoinbaseWalletPayLimitUpgradeRequest, type RequestCoinbaseWalletPayLimitUpgradeResponse, SCAN_NUDGE_INTERVAL_MS, SOLANA_USDC_ADDRESS, type SendHypercoreTransactionRequest, type SendHypercoreTransactionResponse, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SourceToken, type SourceTokenNetwork, type StartIntegrationOAuthResult, type StripeAccessTokenResponse, StripeApiResponseError, type StripeAuthIntentResponse, type StripeConfigResponse, type StripeConfirmRequest, type StripeConsumerWallet, type StripeCreateSessionRequest, type StripeCryptoCustomer, type StripeCustomerVerification, type StripeDefaultTokenResponse, type StripeListResponse, type StripeOnrampErrorType, type StripeOnrampSession, type StripeOnrampTransactionDetails, type StripePaymentToken, type StripeQuoteRequest, type StripeQuotesResponse, type StripeTransactionLimitEntry, type StripeTransactionLimitsResponse, type SupportedChain, type SupportedDepositTokensParams, type SupportedDepositTokensResponse, type SupportedDestinationTokensResponse, type SupportedSourceTokensQuery, type SupportedSourceTokensResponse, type SupportedToken, type TokenBalance, type TokenChain, type TokenChainIconUrl, type TokenChainsResponse, type TokenDisplayMetadata, type TokenIconUrl, type TokenInfo, type TokenMetadata, type TokenSelectedData, type TransferDefaultTokenParams, type TransferDefaultTokenResult, UnifoldClient, type UnifoldClientOptions, type UserIpInfo, type VerificationData, type VerifyAddressParams, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, type WalletConnectionData, type WalletMobileDeepLinkDepositAddress, type WalletMobileDeepLinkResponse, type WalletMobileDeepLinkWallet, type WalletPayLimitUpgradeStatus, type WalletPayMethod, type WalletPayProvider, type WalletPayProvidersResponse, type WalletSelectedData, type WithdrawDirectExecutionFailedEvent, type WithdrawDirectExecutionSucceededEvent, type WithdrawEvent, WithdrawEventType, type WithdrawFlowStartedData, authenticateIntegrationOAuth, buildHypercoreTransaction, buildSolanaTransaction, checkHypercoreActivation, confirmIntegrationTransfer, createCashAppSession, createCoinbaseApplePaySession, createCoinbaseGooglePaySession, createCoinbaseWalletPaySession, createDepositAddress, createExchangeSession, createIntegrationTransfer, createOnrampSession, createOnrampVerificationSession, createUnifoldClient, exchangeOnrampVerificationToken, formatStablecoinAmount, generateKSUID, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getApplePayLimitUpgradeStatus, getApplePayProviders, getBankTransferProviders, getCashAppLimits, getCashAppSessionStatus, getChainName, getCoinbaseApplePayLimits, getCoinbaseLegalAgreements, getCoinbaseWalletPayLimits, getDefaultOnrampToken, getDepositAddress, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getExternalWallets, getFiatCurrencies, getFiatExchangeRates, getGooglePayLimitUpgradeStatus, getGooglePayProviders, getIconUrl, getIconUrlWithCdn, getIntegrationExchanges, getIntegrationHoldings, getIntegrationTransferDefaultToken, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getOnrampVerificationSession, getPreferredIconUrl, getProjectConfig, getPublicIncident, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, getWalletMobileDeepLink, getWalletPayLimitUpgradeStatus, getWalletPayProviders, i18n, isApplePayLimitReached, isDepositAddressValidationError, isGooglePayLimitReached, isWalletPayLimitReached, listPaymentIntentExecutions, mapDirectExecution, mapWalletToDepositAddress, pollDirectExecutions, queryExecutions, refreshIntegrationToken, requestCoinbaseApplePayLimitUpgrade, requestCoinbaseWalletPayLimitUpgrade, retrievePaymentIntent, revokeIntegrationToken, sendHypercoreTransaction, sendOnrampVerificationOtp, sendSolanaTransaction, setApiConfig, startIntegrationOAuth, stripeConfirmSession, stripeCreateAuthIntent, stripeCreateSession, stripeExchangeTokens, stripeGetConfig, stripeGetCustomer, stripeGetDefaultToken, stripeGetQuotes, stripeGetSession, stripeGetTransactionLimits, stripeListPaymentTokens, stripeListWallets, stripeRefreshQuote, stripeRefreshToken, useUserIp, verifyOnrampVerificationOtp, verifyRecipientAddress };
3895
+ export { type AccountConnectionData, ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AddressVerification, type ApplePayLimitUpgradeStatus, type ApplePayProvider, type ApplePayProvidersResponse, type AuthenticateOAuthResult, type AutoSwapRequest, type AutoSwapResponse, type BankTransferConfig, type BankTransferProvider, type BankTransferProvidersResponse, type BlockedCountrySubdivision, type BuildHypercoreTransactionRequest, type BuildHypercoreTransactionResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type CashAppLimits, type CashAppSessionRequest, type CashAppSessionResponse, type CashAppSessionStatusResponse, type ChainType, type CheckoutEvent, CheckoutEventType, type CheckoutFlowFailedData, type CheckoutFlowStartedData, type CheckoutMethod, type CheckoutMethodSelectedData, type CheckoutPaymentIntent, type CheckoutPaymentIntentData, type CheckoutPaymentIntentSucceededEvent, type CoinbaseApplePayLimit, type CoinbaseApplePayLimitUpgradeOption, type CoinbaseApplePayLimitsResponse, type CoinbaseApplePaySessionResponse, type CoinbaseGooglePaySessionResponse, type CoinbaseLegalAgreement, type CoinbaseLegalAgreementsResponse, type CoinbaseWalletPayLimit, type CoinbaseWalletPayLimitUpgradeOption, type CoinbaseWalletPayLimitsResponse, type CoinbaseWalletPaySessionResponse, type ConfirmIntegrationTransferResult, type CreateCoinbaseApplePaySessionRequest, type CreateCoinbaseGooglePaySessionRequest, type CreateCoinbaseWalletPaySessionRequest, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type CreateIntegrationExchangeSessionRequest, type CreateIntegrationExchangeSessionResponse, type CreateIntegrationTransferParams, type CreateIntegrationTransferResult, type CreateOnrampVerificationSessionRequest, DETECTION_ARM_DELAY_MS, DETECTION_POLL_INTERVAL_MS, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddress, type DepositAddressParams, type DepositAddressResponse, DepositAddressValidationError, type DepositEvent, DepositEventType, type DepositFlowFailedData, type DepositFlowStartedData, type DepositLimitReachedData, type DepositMethod, type DepositMethodSelectedData, type DepositQuote, type DepositQuoteRequest, DepositSession, type DepositSessionConfig, type DepositSessionDestination, type DepositSessionError, type DepositSessionErrorCode, type DepositSessionEvent, type DepositSessionEventMap, DepositSessionEventType, type DepositSessionParams, type DepositSessionSnapshot, type DepositSessionStatus, DepositSessionWaitError, type DepositSessionWaitErrorCode, type DepositSessionWaitOptions, type DestinationToken, type DestinationTokenChain, type DirectExecution, DirectExecutionEventType, type DirectExecutionFailedEvent, type DirectExecutionResponse, type DirectExecutionSucceededEvent, type EvmContractCall, type ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type ExternalWalletChainType, type ExternalWalletInfo, type ExternalWalletsResponse, type FeaturedToken, type FeaturedWallet, type FiatCurrenciesResponse, type FiatCurrency, type GetBankTransferProvidersOptions, type GetExchangesQuery, type GetIntegrationExchangesQuery, type GooglePayProvider, type GooglePayProvidersResponse, type HypercoreActivationRequest, type HypercoreActivationResponse, type I18nStrings, type IconUrl, IneligibilityReason, type IntegrationAccount, type IntegrationConnectionMethod, type IntegrationExchangeInfo, type IntegrationExchangeSessionStartParams, type IntegrationExchangesResponse, type IntegrationFeeAmount, type IntegrationHoldingsResponse, IntegrationProvider, IntegrationTransferError, type IntegrationTransferErrorType, type IpAddressResponse, LOOKBACK_MS, type ListExecutionsParams, type LockedQuoteLimits, type LockedQuotePreview, type LockedQuotePreviewRequest, type OnrampCheckout, type OnrampDestinationToken, type OnrampProviderQuote, type OnrampQuote, type OnrampQuoteRequest, type OnrampQuotesRequest, type OnrampQuotesResponse, OnrampSession, type OnrampSessionConfig, type OnrampSessionCreatedData, type OnrampSessionCreatedEvent, type OnrampSessionError, type OnrampSessionErrorCode, type OnrampSessionEvent, type OnrampSessionEventMap, OnrampSessionEventType, type OnrampSessionParams, type OnrampSessionPaymentMethod, type OnrampSessionPaymentMethodType, type OnrampSessionRequest, type OnrampSessionResponse, type OnrampSessionSnapshot, type OnrampSessionStatus, type OnrampSessionStatusResponse, type OnrampSessionStatusValue, OnrampSessionWaitError, type OnrampSessionWaitErrorCode, type OnrampSessionWaitOptions, type OnrampVerificationFactor, type OnrampVerificationFactorStatus, type OnrampVerificationSession, type OnrampVerificationStatus, type OnrampVerificationTokenResponse, type PaymentIntent, type PaymentIntentDepositAddress, type PaymentIntentExecutionsResponse, type PaymentIntentStatus, type PaymentIntentType, type PaymentNetwork, type PollExecutionsRequest, type PollExecutionsResponse, type ProductType, type ProjectConfigResponse, type ProviderSelectedData, type PublicIncidentResponse, QUOTE_REFRESH_INTERVAL_MS, type QueryExecutionsRequest, type QueryExecutionsResponse, type RefreshIntegrationTokenResult, type RequestCoinbaseApplePayLimitUpgradeRequest, type RequestCoinbaseApplePayLimitUpgradeResponse, type RequestCoinbaseWalletPayLimitUpgradeRequest, type RequestCoinbaseWalletPayLimitUpgradeResponse, SCAN_NUDGE_INTERVAL_MS, SOLANA_USDC_ADDRESS, type SendHypercoreTransactionRequest, type SendHypercoreTransactionResponse, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SourceToken, type SourceTokenNetwork, type StartIntegrationOAuthResult, type StripeAccessTokenResponse, StripeApiResponseError, type StripeAuthIntentResponse, type StripeConfigResponse, type StripeConfirmRequest, type StripeConsumerWallet, type StripeCreateSessionRequest, type StripeCryptoCustomer, type StripeCustomerVerification, type StripeDefaultTokenResponse, type StripeListResponse, type StripeOnrampErrorType, type StripeOnrampSession, type StripeOnrampTransactionDetails, type StripePaymentToken, type StripeQuoteRequest, type StripeQuotesResponse, type StripeTransactionLimitEntry, type StripeTransactionLimitsResponse, type SupportedChain, type SupportedDepositTokensParams, type SupportedDepositTokensResponse, type SupportedDestinationTokensResponse, type SupportedSourceTokensQuery, type SupportedSourceTokensResponse, type SupportedToken, type TokenBalance, type TokenChain, type TokenChainIconUrl, type TokenChainsResponse, type TokenDisplayMetadata, type TokenIconUrl, type TokenInfo, type TokenMetadata, type TokenSelectedData, type TransferDefaultTokenParams, type TransferDefaultTokenResult, UnifoldClient, type UnifoldClientOptions, type UserIpInfo, type VerificationData, type VerifyAddressParams, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, type WalletConnectionData, type WalletMobileDeepLinkDepositAddress, type WalletMobileDeepLinkResponse, type WalletMobileDeepLinkWallet, type WalletPayLimitUpgradeStatus, type WalletPayMethod, type WalletPayProvider, type WalletPayProvidersResponse, type WalletSelectedData, type WithdrawDirectExecutionFailedEvent, type WithdrawDirectExecutionSucceededEvent, type WithdrawEvent, WithdrawEventType, type WithdrawFlowStartedData, authenticateIntegrationOAuth, buildHypercoreTransaction, buildSolanaTransaction, checkHypercoreActivation, confirmIntegrationTransfer, createCashAppSession, createCoinbaseApplePaySession, createCoinbaseGooglePaySession, createCoinbaseWalletPaySession, createDepositAddress, createExchangeSession, createIntegrationExchangeSession, createIntegrationTransfer, createOnrampSession, createOnrampVerificationSession, createUnifoldClient, exchangeOnrampVerificationToken, formatStablecoinAmount, generateKSUID, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getApplePayLimitUpgradeStatus, getApplePayProviders, getBankTransferProviders, getCashAppLimits, getCashAppSessionStatus, getChainName, getCoinbaseApplePayLimits, getCoinbaseLegalAgreements, getCoinbaseWalletPayLimits, getDefaultOnrampToken, getDepositAddress, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getExternalWallets, getFiatCurrencies, getFiatExchangeRates, getGooglePayLimitUpgradeStatus, getGooglePayProviders, getIconUrl, getIconUrlWithCdn, getIntegrationExchangeSessionStartUrl, getIntegrationExchanges, getIntegrationHoldings, getIntegrationTransferDefaultToken, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getOnrampSessionStatus, getOnrampVerificationSession, getPreferredIconUrl, getProjectConfig, getPublicIncident, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, getWalletMobileDeepLink, getWalletPayLimitUpgradeStatus, getWalletPayProviders, i18n, isApplePayLimitReached, isDepositAddressValidationError, isGooglePayLimitReached, isWalletPayLimitReached, listPaymentIntentExecutions, mapDefaultOnrampToken, mapDirectExecution, mapOnrampQuote, mapWalletToDepositAddress, pollDirectExecutions, queryExecutions, refreshIntegrationToken, requestCoinbaseApplePayLimitUpgrade, requestCoinbaseWalletPayLimitUpgrade, retrievePaymentIntent, revokeIntegrationToken, sendHypercoreTransaction, sendOnrampVerificationOtp, sendSolanaTransaction, setApiConfig, startIntegrationOAuth, stripeConfirmSession, stripeCreateAuthIntent, stripeCreateSession, stripeExchangeTokens, stripeGetConfig, stripeGetCustomer, stripeGetDefaultToken, stripeGetQuotes, stripeGetSession, stripeGetTransactionLimits, stripeListPaymentTokens, stripeListWallets, stripeRefreshQuote, stripeRefreshToken, useUserIp, verifyOnrampVerificationOtp, verifyRecipientAddress };