@unifold/core 0.1.67 → 0.1.68-beta.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/dist/index.d.mts CHANGED
@@ -340,6 +340,11 @@ interface OnrampQuotesResponse {
340
340
  * @param publishableKey - Optional publishable key, defaults to configured key
341
341
  */
342
342
  declare function getOnrampQuotes(request: OnrampQuotesRequest, publishableKey?: string): Promise<OnrampQuotesResponse>;
343
+ /**
344
+ * Payment method for an onramp session. Defaults to `card` server-side.
345
+ * `sepa` routes the session through SEPA bank transfer (Swapped-only today).
346
+ */
347
+ type OnrampSessionPaymentMethod = "card" | "sepa";
343
348
  interface OnrampSessionRequest {
344
349
  service_provider: string;
345
350
  country_code: string;
@@ -352,6 +357,7 @@ interface OnrampSessionRequest {
352
357
  redirect_url?: string;
353
358
  external_id?: string;
354
359
  email?: string;
360
+ payment_method?: OnrampSessionPaymentMethod;
355
361
  }
356
362
  interface OnrampSessionResponse {
357
363
  url: string;
@@ -363,6 +369,51 @@ interface OnrampSessionResponse {
363
369
  * @param publishableKey - Optional publishable key, defaults to configured key
364
370
  */
365
371
  declare function createOnrampSession(request: OnrampSessionRequest, publishableKey?: string): Promise<OnrampSessionResponse>;
372
+ /**
373
+ * A bank-transfer onramp provider returned by `getBankTransferProviders()`.
374
+ * Mirrors the shape of `IntegrationExchangeInfo` so SDK consumers can render
375
+ * exchanges + bank-transfer with the same UI primitives.
376
+ */
377
+ interface BankTransferProvider {
378
+ service_provider: string;
379
+ service_provider_display_name: string;
380
+ description: string;
381
+ icon_url: string;
382
+ icon_urls: IconUrl[];
383
+ /**
384
+ * True when the provider is configured AND the rail supports the caller's
385
+ * country. Use this to decide whether the row is clickable.
386
+ */
387
+ enabled: boolean;
388
+ /**
389
+ * Payment methods this provider supports. Forward one of these as
390
+ * `payment_method` when calling `/onramps/sessions`. Stored as an array so
391
+ * a single provider can light up multiple rails (e.g. SEPA + ACH) without
392
+ * forking the row.
393
+ */
394
+ payment_methods: OnrampSessionPaymentMethod[];
395
+ /** All fiat currencies the rail accepts (e.g. ['eur', 'gbp']). */
396
+ supported_currencies: string[];
397
+ /**
398
+ * Preferred fiat for the caller's country, picked from `supported_currencies`.
399
+ * Forward as `source_currency` to `/onramps/sessions` — avoids the SDK
400
+ * re-implementing the country → fiat mapping.
401
+ */
402
+ source_currency: string;
403
+ }
404
+ interface BankTransferProvidersResponse {
405
+ data: BankTransferProvider[];
406
+ }
407
+ interface GetBankTransferProvidersOptions {
408
+ /** ISO 3166-1 alpha-2 country code. Drives the `enabled` flag per provider. */
409
+ countryCode?: string;
410
+ }
411
+ /**
412
+ * Get supported bank-transfer onramp providers (SEPA via Swapped today).
413
+ * Each provider's `enabled` flag reflects project config + native integration
414
+ * availability + the caller-supplied country.
415
+ */
416
+ declare function getBankTransferProviders(publishableKey?: string, options?: GetBankTransferProvidersOptions): Promise<BankTransferProvidersResponse>;
366
417
  /**
367
418
  * Generate a URL for the sessions/start endpoint that redirects to the onramp provider.
368
419
  * This is useful for avoiding popup blockers by opening the URL directly via anchor tag.
@@ -484,10 +535,20 @@ interface ProjectConfigResponse {
484
535
  deposit_tracker?: {
485
536
  enabled: boolean;
486
537
  };
538
+ bank_transfer?: BankTransferConfig;
487
539
  hypercore_sponsorship?: {
488
540
  enabled: boolean;
489
541
  };
490
542
  }
543
+ /**
544
+ * Bank-transfer project-level toggle returned by `/projects/config`.
545
+ *
546
+ * Only reflects the dashboard preference — the actual rails available for
547
+ * a given country live under `getBankTransferProviders()`.
548
+ */
549
+ interface BankTransferConfig {
550
+ enabled: boolean;
551
+ }
491
552
  /**
492
553
  * Get project configuration
493
554
  * @param publishableKey - Optional publishable key, defaults to configured key
@@ -1296,12 +1357,51 @@ declare enum DepositEventType {
1296
1357
  declare enum WithdrawEventType {
1297
1358
  DIRECT_EXECUTION_SUCCEEDED = "direct_execution.succeeded"
1298
1359
  }
1360
+ /** Event types emitted by the checkout flow. */
1361
+ declare enum CheckoutEventType {
1362
+ PAYMENT_INTENT_SUCCEEDED = "payment_intent.succeeded"
1363
+ }
1299
1364
  /** Funding method used by a deposit flow. */
1300
1365
  type DepositMethod = "transfer" | "card" | "cashapp" | "pay_with_exchange" | "exchange_connect" | "wallet_connect";
1366
+ /** Funding method used by a checkout flow. */
1367
+ type CheckoutMethod = "transfer" | "wallet_connect";
1301
1368
  /** `data.object` payload for {@link DepositEventType.ONRAMP_SESSION_CREATED} */
1302
1369
  interface OnrampSessionCreatedData {
1303
1370
  externalId: string;
1304
1371
  }
1372
+ /**
1373
+ * Callback-facing payment intent object.
1374
+ * Mirrors the field-naming conventions used by {@link DirectExecution}
1375
+ * (camelCase, `BaseUnit` / `Usd` amount suffixes, `failureReason`, no currency
1376
+ * code or decimals — derive those from `*TokenAddress` if needed).
1377
+ */
1378
+ interface CheckoutPaymentIntent {
1379
+ id: string;
1380
+ status: "succeeded";
1381
+ recipientAddress: string;
1382
+ destinationChainType: string;
1383
+ destinationChainId: string;
1384
+ destinationTokenAddress: string;
1385
+ destinationAmountBaseUnit: string;
1386
+ destinationAmountUsd: string;
1387
+ destinationAmountReceivedBaseUnit: string;
1388
+ destinationAmountReceivedUsd: string;
1389
+ sourceChainType: string | null;
1390
+ sourceChainId: string | null;
1391
+ sourceTokenAddress: string | null;
1392
+ sourceAmountBaseUnit: string | null;
1393
+ sourceAmountUsd: string | null;
1394
+ sourceAmountReceivedBaseUnit: string | null;
1395
+ sourceAmountReceivedUsd: string | null;
1396
+ /** Atomic payout (pool → recipient) hash. Locked-quote only; null until broadcast. */
1397
+ transactionHash: string | null;
1398
+ failureReason: string | null;
1399
+ }
1400
+ /**
1401
+ * `data.object` payload for {@link CheckoutEventType.PAYMENT_INTENT_SUCCEEDED}.
1402
+ * @deprecated Use {@link CheckoutPaymentIntent} — kept as an alias for back-compat.
1403
+ */
1404
+ type CheckoutPaymentIntentData = CheckoutPaymentIntent;
1305
1405
  /**
1306
1406
  * Callback-facing direct execution object.
1307
1407
  * Intentionally separate from legacy `DirectExecutionResponse` naming.
@@ -1334,6 +1434,10 @@ interface DepositEventDataMap {
1334
1434
  interface WithdrawEventDataMap {
1335
1435
  [WithdrawEventType.DIRECT_EXECUTION_SUCCEEDED]: DirectExecution;
1336
1436
  }
1437
+ /** Map from event type to its `data.object` shape */
1438
+ interface CheckoutEventDataMap {
1439
+ [CheckoutEventType.PAYMENT_INTENT_SUCCEEDED]: CheckoutPaymentIntent;
1440
+ }
1337
1441
  /**
1338
1442
  * Event envelope emitted by the deposit flow, inspired by the server-side
1339
1443
  * webhook payload shape: top-level metadata (`id`, `type`, `created`) with
@@ -1370,6 +1474,18 @@ type WithdrawEvent = {
1370
1474
  };
1371
1475
  };
1372
1476
  }[WithdrawEventType];
1477
+ /** Event envelope emitted by the checkout flow. */
1478
+ type CheckoutEvent = {
1479
+ [K in CheckoutEventType]: {
1480
+ id: string;
1481
+ type: K;
1482
+ created: number;
1483
+ method?: CheckoutMethod;
1484
+ data: {
1485
+ object: CheckoutEventDataMap[K];
1486
+ };
1487
+ };
1488
+ }[CheckoutEventType];
1373
1489
  /** Convenience type for a fully-typed `onramp_session.created` event */
1374
1490
  type OnrampSessionCreatedEvent = Extract<DepositEvent, {
1375
1491
  type: DepositEventType.ONRAMP_SESSION_CREATED;
@@ -1385,6 +1501,10 @@ type DirectExecutionSucceededEvent = Extract<DepositEvent, {
1385
1501
  type WithdrawDirectExecutionSucceededEvent = Extract<WithdrawEvent, {
1386
1502
  type: WithdrawEventType.DIRECT_EXECUTION_SUCCEEDED;
1387
1503
  }>;
1504
+ /** Convenience type for a fully-typed `payment_intent.succeeded` checkout event */
1505
+ type CheckoutPaymentIntentSucceededEvent = Extract<CheckoutEvent, {
1506
+ type: CheckoutEventType.PAYMENT_INTENT_SUCCEEDED;
1507
+ }>;
1388
1508
 
1389
1509
  /**
1390
1510
  * User IP information interface
@@ -1508,4 +1628,4 @@ declare const i18n: {
1508
1628
  };
1509
1629
  type I18nStrings = typeof i18n;
1510
1630
 
1511
- export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AuthenticateOAuthResult, type AutoSwapRequest, type AutoSwapResponse, type BlockedCountrySubdivision, type BuildHypercoreTransactionRequest, type BuildHypercoreTransactionResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type CashAppLimits, type CashAppSessionRequest, type CashAppSessionResponse, type CashAppSessionStatusResponse, type ChainType, type ConfirmIntegrationTransferResult, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type CreateIntegrationTransferParams, type CreateIntegrationTransferResult, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, type DepositEvent, DepositEventType, type DepositMethod, type DepositQuote, type DepositQuoteRequest, type DestinationToken, type DestinationTokenChain, type DirectExecution, 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 GetExchangesQuery, type HypercoreActivationRequest, type HypercoreActivationResponse, type I18nStrings, type IconUrl, IneligibilityReason, type IntegrationAccount, type IntegrationExchangeInfo, type IntegrationExchangesResponse, type IntegrationFeeAmount, type IntegrationHoldingsResponse, IntegrationProvider, type IpAddressResponse, type LockedQuoteLimits, type LockedQuotePreview, type LockedQuotePreviewRequest, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionCreatedData, type OnrampSessionCreatedEvent, type OnrampSessionRequest, type OnrampSessionResponse, type PaymentIntent, type PaymentIntentDepositAddress, type PaymentIntentExecutionsResponse, type PaymentIntentStatus, type PaymentIntentType, type PaymentNetwork, type PollExecutionsRequest, type PollExecutionsResponse, type ProductType, type ProjectConfigResponse, type QueryExecutionsRequest, type QueryExecutionsResponse, type RefreshIntegrationTokenResult, SOLANA_USDC_ADDRESS, type SendHypercoreTransactionRequest, type SendHypercoreTransactionResponse, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SourceToken, type SourceTokenNetwork, type StartIntegrationOAuthResult, type SupportedChain, type SupportedDepositTokensResponse, type SupportedDestinationTokensResponse, type SupportedSourceTokensQuery, type SupportedSourceTokensResponse, type SupportedToken, type TokenBalance, type TokenChain, type TokenChainIconUrl, type TokenChainsResponse, type TokenIconUrl, type TokenInfo, type TokenMetadata, type TransferDefaultTokenParams, type TransferDefaultTokenResult, type UserIpInfo, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, type WalletMobileDeepLinkDepositAddress, type WalletMobileDeepLinkResponse, type WalletMobileDeepLinkWallet, type WithdrawDirectExecutionSucceededEvent, type WithdrawEvent, WithdrawEventType, authenticateIntegrationOAuth, buildHypercoreTransaction, buildSolanaTransaction, checkHypercoreActivation, confirmIntegrationTransfer, createCashAppSession, createDepositAddress, createExchangeSession, createIntegrationTransfer, createOnrampSession, formatStablecoinAmount, generateKSUID, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getCashAppLimits, getCashAppSessionStatus, getChainName, getDefaultOnrampToken, getDepositAddress, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getExternalWallets, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIntegrationExchanges, getIntegrationHoldings, getIntegrationTransferDefaultToken, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, getWalletMobileDeepLink, i18n, listPaymentIntentExecutions, pollDirectExecutions, queryExecutions, refreshIntegrationToken, retrievePaymentIntent, revokeIntegrationToken, sendHypercoreTransaction, sendSolanaTransaction, setApiConfig, startIntegrationOAuth, useUserIp, verifyRecipientAddress };
1631
+ export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, 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 CheckoutMethod, type CheckoutPaymentIntent, type CheckoutPaymentIntentData, type CheckoutPaymentIntentSucceededEvent, type ConfirmIntegrationTransferResult, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type CreateIntegrationTransferParams, type CreateIntegrationTransferResult, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, type DepositEvent, DepositEventType, type DepositMethod, type DepositQuote, type DepositQuoteRequest, type DestinationToken, type DestinationTokenChain, type DirectExecution, 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 HypercoreActivationRequest, type HypercoreActivationResponse, type I18nStrings, type IconUrl, IneligibilityReason, type IntegrationAccount, type IntegrationExchangeInfo, type IntegrationExchangesResponse, type IntegrationFeeAmount, type IntegrationHoldingsResponse, IntegrationProvider, type IpAddressResponse, type LockedQuoteLimits, type LockedQuotePreview, type LockedQuotePreviewRequest, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionCreatedData, type OnrampSessionCreatedEvent, type OnrampSessionPaymentMethod, type OnrampSessionRequest, type OnrampSessionResponse, type PaymentIntent, type PaymentIntentDepositAddress, type PaymentIntentExecutionsResponse, type PaymentIntentStatus, type PaymentIntentType, type PaymentNetwork, type PollExecutionsRequest, type PollExecutionsResponse, type ProductType, type ProjectConfigResponse, type QueryExecutionsRequest, type QueryExecutionsResponse, type RefreshIntegrationTokenResult, SOLANA_USDC_ADDRESS, type SendHypercoreTransactionRequest, type SendHypercoreTransactionResponse, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SourceToken, type SourceTokenNetwork, type StartIntegrationOAuthResult, type SupportedChain, type SupportedDepositTokensResponse, type SupportedDestinationTokensResponse, type SupportedSourceTokensQuery, type SupportedSourceTokensResponse, type SupportedToken, type TokenBalance, type TokenChain, type TokenChainIconUrl, type TokenChainsResponse, type TokenIconUrl, type TokenInfo, type TokenMetadata, type TransferDefaultTokenParams, type TransferDefaultTokenResult, type UserIpInfo, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, type WalletMobileDeepLinkDepositAddress, type WalletMobileDeepLinkResponse, type WalletMobileDeepLinkWallet, type WithdrawDirectExecutionSucceededEvent, type WithdrawEvent, WithdrawEventType, authenticateIntegrationOAuth, buildHypercoreTransaction, buildSolanaTransaction, checkHypercoreActivation, confirmIntegrationTransfer, createCashAppSession, createDepositAddress, createExchangeSession, createIntegrationTransfer, createOnrampSession, formatStablecoinAmount, generateKSUID, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getBankTransferProviders, getCashAppLimits, getCashAppSessionStatus, getChainName, getDefaultOnrampToken, getDepositAddress, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getExternalWallets, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIntegrationExchanges, getIntegrationHoldings, getIntegrationTransferDefaultToken, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, getWalletMobileDeepLink, i18n, listPaymentIntentExecutions, pollDirectExecutions, queryExecutions, refreshIntegrationToken, retrievePaymentIntent, revokeIntegrationToken, sendHypercoreTransaction, sendSolanaTransaction, setApiConfig, startIntegrationOAuth, useUserIp, verifyRecipientAddress };
package/dist/index.d.ts CHANGED
@@ -340,6 +340,11 @@ interface OnrampQuotesResponse {
340
340
  * @param publishableKey - Optional publishable key, defaults to configured key
341
341
  */
342
342
  declare function getOnrampQuotes(request: OnrampQuotesRequest, publishableKey?: string): Promise<OnrampQuotesResponse>;
343
+ /**
344
+ * Payment method for an onramp session. Defaults to `card` server-side.
345
+ * `sepa` routes the session through SEPA bank transfer (Swapped-only today).
346
+ */
347
+ type OnrampSessionPaymentMethod = "card" | "sepa";
343
348
  interface OnrampSessionRequest {
344
349
  service_provider: string;
345
350
  country_code: string;
@@ -352,6 +357,7 @@ interface OnrampSessionRequest {
352
357
  redirect_url?: string;
353
358
  external_id?: string;
354
359
  email?: string;
360
+ payment_method?: OnrampSessionPaymentMethod;
355
361
  }
356
362
  interface OnrampSessionResponse {
357
363
  url: string;
@@ -363,6 +369,51 @@ interface OnrampSessionResponse {
363
369
  * @param publishableKey - Optional publishable key, defaults to configured key
364
370
  */
365
371
  declare function createOnrampSession(request: OnrampSessionRequest, publishableKey?: string): Promise<OnrampSessionResponse>;
372
+ /**
373
+ * A bank-transfer onramp provider returned by `getBankTransferProviders()`.
374
+ * Mirrors the shape of `IntegrationExchangeInfo` so SDK consumers can render
375
+ * exchanges + bank-transfer with the same UI primitives.
376
+ */
377
+ interface BankTransferProvider {
378
+ service_provider: string;
379
+ service_provider_display_name: string;
380
+ description: string;
381
+ icon_url: string;
382
+ icon_urls: IconUrl[];
383
+ /**
384
+ * True when the provider is configured AND the rail supports the caller's
385
+ * country. Use this to decide whether the row is clickable.
386
+ */
387
+ enabled: boolean;
388
+ /**
389
+ * Payment methods this provider supports. Forward one of these as
390
+ * `payment_method` when calling `/onramps/sessions`. Stored as an array so
391
+ * a single provider can light up multiple rails (e.g. SEPA + ACH) without
392
+ * forking the row.
393
+ */
394
+ payment_methods: OnrampSessionPaymentMethod[];
395
+ /** All fiat currencies the rail accepts (e.g. ['eur', 'gbp']). */
396
+ supported_currencies: string[];
397
+ /**
398
+ * Preferred fiat for the caller's country, picked from `supported_currencies`.
399
+ * Forward as `source_currency` to `/onramps/sessions` — avoids the SDK
400
+ * re-implementing the country → fiat mapping.
401
+ */
402
+ source_currency: string;
403
+ }
404
+ interface BankTransferProvidersResponse {
405
+ data: BankTransferProvider[];
406
+ }
407
+ interface GetBankTransferProvidersOptions {
408
+ /** ISO 3166-1 alpha-2 country code. Drives the `enabled` flag per provider. */
409
+ countryCode?: string;
410
+ }
411
+ /**
412
+ * Get supported bank-transfer onramp providers (SEPA via Swapped today).
413
+ * Each provider's `enabled` flag reflects project config + native integration
414
+ * availability + the caller-supplied country.
415
+ */
416
+ declare function getBankTransferProviders(publishableKey?: string, options?: GetBankTransferProvidersOptions): Promise<BankTransferProvidersResponse>;
366
417
  /**
367
418
  * Generate a URL for the sessions/start endpoint that redirects to the onramp provider.
368
419
  * This is useful for avoiding popup blockers by opening the URL directly via anchor tag.
@@ -484,10 +535,20 @@ interface ProjectConfigResponse {
484
535
  deposit_tracker?: {
485
536
  enabled: boolean;
486
537
  };
538
+ bank_transfer?: BankTransferConfig;
487
539
  hypercore_sponsorship?: {
488
540
  enabled: boolean;
489
541
  };
490
542
  }
543
+ /**
544
+ * Bank-transfer project-level toggle returned by `/projects/config`.
545
+ *
546
+ * Only reflects the dashboard preference — the actual rails available for
547
+ * a given country live under `getBankTransferProviders()`.
548
+ */
549
+ interface BankTransferConfig {
550
+ enabled: boolean;
551
+ }
491
552
  /**
492
553
  * Get project configuration
493
554
  * @param publishableKey - Optional publishable key, defaults to configured key
@@ -1296,12 +1357,51 @@ declare enum DepositEventType {
1296
1357
  declare enum WithdrawEventType {
1297
1358
  DIRECT_EXECUTION_SUCCEEDED = "direct_execution.succeeded"
1298
1359
  }
1360
+ /** Event types emitted by the checkout flow. */
1361
+ declare enum CheckoutEventType {
1362
+ PAYMENT_INTENT_SUCCEEDED = "payment_intent.succeeded"
1363
+ }
1299
1364
  /** Funding method used by a deposit flow. */
1300
1365
  type DepositMethod = "transfer" | "card" | "cashapp" | "pay_with_exchange" | "exchange_connect" | "wallet_connect";
1366
+ /** Funding method used by a checkout flow. */
1367
+ type CheckoutMethod = "transfer" | "wallet_connect";
1301
1368
  /** `data.object` payload for {@link DepositEventType.ONRAMP_SESSION_CREATED} */
1302
1369
  interface OnrampSessionCreatedData {
1303
1370
  externalId: string;
1304
1371
  }
1372
+ /**
1373
+ * Callback-facing payment intent object.
1374
+ * Mirrors the field-naming conventions used by {@link DirectExecution}
1375
+ * (camelCase, `BaseUnit` / `Usd` amount suffixes, `failureReason`, no currency
1376
+ * code or decimals — derive those from `*TokenAddress` if needed).
1377
+ */
1378
+ interface CheckoutPaymentIntent {
1379
+ id: string;
1380
+ status: "succeeded";
1381
+ recipientAddress: string;
1382
+ destinationChainType: string;
1383
+ destinationChainId: string;
1384
+ destinationTokenAddress: string;
1385
+ destinationAmountBaseUnit: string;
1386
+ destinationAmountUsd: string;
1387
+ destinationAmountReceivedBaseUnit: string;
1388
+ destinationAmountReceivedUsd: string;
1389
+ sourceChainType: string | null;
1390
+ sourceChainId: string | null;
1391
+ sourceTokenAddress: string | null;
1392
+ sourceAmountBaseUnit: string | null;
1393
+ sourceAmountUsd: string | null;
1394
+ sourceAmountReceivedBaseUnit: string | null;
1395
+ sourceAmountReceivedUsd: string | null;
1396
+ /** Atomic payout (pool → recipient) hash. Locked-quote only; null until broadcast. */
1397
+ transactionHash: string | null;
1398
+ failureReason: string | null;
1399
+ }
1400
+ /**
1401
+ * `data.object` payload for {@link CheckoutEventType.PAYMENT_INTENT_SUCCEEDED}.
1402
+ * @deprecated Use {@link CheckoutPaymentIntent} — kept as an alias for back-compat.
1403
+ */
1404
+ type CheckoutPaymentIntentData = CheckoutPaymentIntent;
1305
1405
  /**
1306
1406
  * Callback-facing direct execution object.
1307
1407
  * Intentionally separate from legacy `DirectExecutionResponse` naming.
@@ -1334,6 +1434,10 @@ interface DepositEventDataMap {
1334
1434
  interface WithdrawEventDataMap {
1335
1435
  [WithdrawEventType.DIRECT_EXECUTION_SUCCEEDED]: DirectExecution;
1336
1436
  }
1437
+ /** Map from event type to its `data.object` shape */
1438
+ interface CheckoutEventDataMap {
1439
+ [CheckoutEventType.PAYMENT_INTENT_SUCCEEDED]: CheckoutPaymentIntent;
1440
+ }
1337
1441
  /**
1338
1442
  * Event envelope emitted by the deposit flow, inspired by the server-side
1339
1443
  * webhook payload shape: top-level metadata (`id`, `type`, `created`) with
@@ -1370,6 +1474,18 @@ type WithdrawEvent = {
1370
1474
  };
1371
1475
  };
1372
1476
  }[WithdrawEventType];
1477
+ /** Event envelope emitted by the checkout flow. */
1478
+ type CheckoutEvent = {
1479
+ [K in CheckoutEventType]: {
1480
+ id: string;
1481
+ type: K;
1482
+ created: number;
1483
+ method?: CheckoutMethod;
1484
+ data: {
1485
+ object: CheckoutEventDataMap[K];
1486
+ };
1487
+ };
1488
+ }[CheckoutEventType];
1373
1489
  /** Convenience type for a fully-typed `onramp_session.created` event */
1374
1490
  type OnrampSessionCreatedEvent = Extract<DepositEvent, {
1375
1491
  type: DepositEventType.ONRAMP_SESSION_CREATED;
@@ -1385,6 +1501,10 @@ type DirectExecutionSucceededEvent = Extract<DepositEvent, {
1385
1501
  type WithdrawDirectExecutionSucceededEvent = Extract<WithdrawEvent, {
1386
1502
  type: WithdrawEventType.DIRECT_EXECUTION_SUCCEEDED;
1387
1503
  }>;
1504
+ /** Convenience type for a fully-typed `payment_intent.succeeded` checkout event */
1505
+ type CheckoutPaymentIntentSucceededEvent = Extract<CheckoutEvent, {
1506
+ type: CheckoutEventType.PAYMENT_INTENT_SUCCEEDED;
1507
+ }>;
1388
1508
 
1389
1509
  /**
1390
1510
  * User IP information interface
@@ -1508,4 +1628,4 @@ declare const i18n: {
1508
1628
  };
1509
1629
  type I18nStrings = typeof i18n;
1510
1630
 
1511
- export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AuthenticateOAuthResult, type AutoSwapRequest, type AutoSwapResponse, type BlockedCountrySubdivision, type BuildHypercoreTransactionRequest, type BuildHypercoreTransactionResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type CashAppLimits, type CashAppSessionRequest, type CashAppSessionResponse, type CashAppSessionStatusResponse, type ChainType, type ConfirmIntegrationTransferResult, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type CreateIntegrationTransferParams, type CreateIntegrationTransferResult, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, type DepositEvent, DepositEventType, type DepositMethod, type DepositQuote, type DepositQuoteRequest, type DestinationToken, type DestinationTokenChain, type DirectExecution, 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 GetExchangesQuery, type HypercoreActivationRequest, type HypercoreActivationResponse, type I18nStrings, type IconUrl, IneligibilityReason, type IntegrationAccount, type IntegrationExchangeInfo, type IntegrationExchangesResponse, type IntegrationFeeAmount, type IntegrationHoldingsResponse, IntegrationProvider, type IpAddressResponse, type LockedQuoteLimits, type LockedQuotePreview, type LockedQuotePreviewRequest, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionCreatedData, type OnrampSessionCreatedEvent, type OnrampSessionRequest, type OnrampSessionResponse, type PaymentIntent, type PaymentIntentDepositAddress, type PaymentIntentExecutionsResponse, type PaymentIntentStatus, type PaymentIntentType, type PaymentNetwork, type PollExecutionsRequest, type PollExecutionsResponse, type ProductType, type ProjectConfigResponse, type QueryExecutionsRequest, type QueryExecutionsResponse, type RefreshIntegrationTokenResult, SOLANA_USDC_ADDRESS, type SendHypercoreTransactionRequest, type SendHypercoreTransactionResponse, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SourceToken, type SourceTokenNetwork, type StartIntegrationOAuthResult, type SupportedChain, type SupportedDepositTokensResponse, type SupportedDestinationTokensResponse, type SupportedSourceTokensQuery, type SupportedSourceTokensResponse, type SupportedToken, type TokenBalance, type TokenChain, type TokenChainIconUrl, type TokenChainsResponse, type TokenIconUrl, type TokenInfo, type TokenMetadata, type TransferDefaultTokenParams, type TransferDefaultTokenResult, type UserIpInfo, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, type WalletMobileDeepLinkDepositAddress, type WalletMobileDeepLinkResponse, type WalletMobileDeepLinkWallet, type WithdrawDirectExecutionSucceededEvent, type WithdrawEvent, WithdrawEventType, authenticateIntegrationOAuth, buildHypercoreTransaction, buildSolanaTransaction, checkHypercoreActivation, confirmIntegrationTransfer, createCashAppSession, createDepositAddress, createExchangeSession, createIntegrationTransfer, createOnrampSession, formatStablecoinAmount, generateKSUID, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getCashAppLimits, getCashAppSessionStatus, getChainName, getDefaultOnrampToken, getDepositAddress, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getExternalWallets, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIntegrationExchanges, getIntegrationHoldings, getIntegrationTransferDefaultToken, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, getWalletMobileDeepLink, i18n, listPaymentIntentExecutions, pollDirectExecutions, queryExecutions, refreshIntegrationToken, retrievePaymentIntent, revokeIntegrationToken, sendHypercoreTransaction, sendSolanaTransaction, setApiConfig, startIntegrationOAuth, useUserIp, verifyRecipientAddress };
1631
+ export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, 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 CheckoutMethod, type CheckoutPaymentIntent, type CheckoutPaymentIntentData, type CheckoutPaymentIntentSucceededEvent, type ConfirmIntegrationTransferResult, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type CreateIntegrationTransferParams, type CreateIntegrationTransferResult, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, type DepositEvent, DepositEventType, type DepositMethod, type DepositQuote, type DepositQuoteRequest, type DestinationToken, type DestinationTokenChain, type DirectExecution, 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 HypercoreActivationRequest, type HypercoreActivationResponse, type I18nStrings, type IconUrl, IneligibilityReason, type IntegrationAccount, type IntegrationExchangeInfo, type IntegrationExchangesResponse, type IntegrationFeeAmount, type IntegrationHoldingsResponse, IntegrationProvider, type IpAddressResponse, type LockedQuoteLimits, type LockedQuotePreview, type LockedQuotePreviewRequest, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionCreatedData, type OnrampSessionCreatedEvent, type OnrampSessionPaymentMethod, type OnrampSessionRequest, type OnrampSessionResponse, type PaymentIntent, type PaymentIntentDepositAddress, type PaymentIntentExecutionsResponse, type PaymentIntentStatus, type PaymentIntentType, type PaymentNetwork, type PollExecutionsRequest, type PollExecutionsResponse, type ProductType, type ProjectConfigResponse, type QueryExecutionsRequest, type QueryExecutionsResponse, type RefreshIntegrationTokenResult, SOLANA_USDC_ADDRESS, type SendHypercoreTransactionRequest, type SendHypercoreTransactionResponse, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SourceToken, type SourceTokenNetwork, type StartIntegrationOAuthResult, type SupportedChain, type SupportedDepositTokensResponse, type SupportedDestinationTokensResponse, type SupportedSourceTokensQuery, type SupportedSourceTokensResponse, type SupportedToken, type TokenBalance, type TokenChain, type TokenChainIconUrl, type TokenChainsResponse, type TokenIconUrl, type TokenInfo, type TokenMetadata, type TransferDefaultTokenParams, type TransferDefaultTokenResult, type UserIpInfo, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, type WalletMobileDeepLinkDepositAddress, type WalletMobileDeepLinkResponse, type WalletMobileDeepLinkWallet, type WithdrawDirectExecutionSucceededEvent, type WithdrawEvent, WithdrawEventType, authenticateIntegrationOAuth, buildHypercoreTransaction, buildSolanaTransaction, checkHypercoreActivation, confirmIntegrationTransfer, createCashAppSession, createDepositAddress, createExchangeSession, createIntegrationTransfer, createOnrampSession, formatStablecoinAmount, generateKSUID, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getBankTransferProviders, getCashAppLimits, getCashAppSessionStatus, getChainName, getDefaultOnrampToken, getDepositAddress, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getExternalWallets, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIntegrationExchanges, getIntegrationHoldings, getIntegrationTransferDefaultToken, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, getWalletMobileDeepLink, i18n, listPaymentIntentExecutions, pollDirectExecutions, queryExecutions, refreshIntegrationToken, retrievePaymentIntent, revokeIntegrationToken, sendHypercoreTransaction, sendSolanaTransaction, setApiConfig, startIntegrationOAuth, useUserIp, verifyRecipientAddress };
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  ActionType: () => ActionType,
24
+ CheckoutEventType: () => CheckoutEventType,
24
25
  DepositEventType: () => DepositEventType,
25
26
  ExecutionStatus: () => ExecutionStatus,
26
27
  IneligibilityReason: () => IneligibilityReason,
@@ -43,6 +44,7 @@ __export(index_exports, {
43
44
  getAddressBalance: () => getAddressBalance,
44
45
  getAddressBalances: () => getAddressBalances,
45
46
  getApiBaseUrl: () => getApiBaseUrl,
47
+ getBankTransferProviders: () => getBankTransferProviders,
46
48
  getCashAppLimits: () => getCashAppLimits,
47
49
  getCashAppSessionStatus: () => getCashAppSessionStatus,
48
50
  getChainName: () => getChainName,
@@ -437,6 +439,29 @@ async function createOnrampSession(request, publishableKey) {
437
439
  }
438
440
  return response.json();
439
441
  }
442
+ async function getBankTransferProviders(publishableKey, options = {}) {
443
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
444
+ validatePublishableKey(pk);
445
+ const params = new URLSearchParams();
446
+ if (options.countryCode) {
447
+ params.set("country_code", options.countryCode);
448
+ }
449
+ const queryString = params.toString();
450
+ const url = `${API_BASE_URL}/v1/public/onramps/bank_transfer/providers${queryString ? `?${queryString}` : ""}`;
451
+ const response = await fetch(url, {
452
+ method: "GET",
453
+ headers: {
454
+ accept: "application/json",
455
+ "x-publishable-key": pk
456
+ }
457
+ });
458
+ if (!response.ok) {
459
+ throw new Error(
460
+ `Failed to fetch bank-transfer providers: ${response.statusText}`
461
+ );
462
+ }
463
+ return response.json();
464
+ }
440
465
  function getOnrampSessionStartUrl(request, publishableKey) {
441
466
  const params = new URLSearchParams();
442
467
  params.append("publishable_key", publishableKey);
@@ -454,6 +479,9 @@ function getOnrampSessionStartUrl(request, publishableKey) {
454
479
  if (request.email) {
455
480
  params.append("email", request.email);
456
481
  }
482
+ if (request.payment_method) {
483
+ params.append("payment_method", request.payment_method);
484
+ }
457
485
  return `${API_BASE_URL}/v1/public/onramps/sessions/start?${params.toString()}`;
458
486
  }
459
487
  async function getDefaultOnrampToken(params, publishableKey) {
@@ -1110,6 +1138,10 @@ var WithdrawEventType = /* @__PURE__ */ ((WithdrawEventType2) => {
1110
1138
  WithdrawEventType2["DIRECT_EXECUTION_SUCCEEDED"] = "direct_execution.succeeded";
1111
1139
  return WithdrawEventType2;
1112
1140
  })(WithdrawEventType || {});
1141
+ var CheckoutEventType = /* @__PURE__ */ ((CheckoutEventType2) => {
1142
+ CheckoutEventType2["PAYMENT_INTENT_SUCCEEDED"] = "payment_intent.succeeded";
1143
+ return CheckoutEventType2;
1144
+ })(CheckoutEventType || {});
1113
1145
 
1114
1146
  // src/hooks/use-user-ip.ts
1115
1147
  var import_react_query = require("@tanstack/react-query");
@@ -1245,6 +1277,7 @@ var i18n = en_default;
1245
1277
  // Annotate the CommonJS export names for ESM import in node:
1246
1278
  0 && (module.exports = {
1247
1279
  ActionType,
1280
+ CheckoutEventType,
1248
1281
  DepositEventType,
1249
1282
  ExecutionStatus,
1250
1283
  IneligibilityReason,
@@ -1267,6 +1300,7 @@ var i18n = en_default;
1267
1300
  getAddressBalance,
1268
1301
  getAddressBalances,
1269
1302
  getApiBaseUrl,
1303
+ getBankTransferProviders,
1270
1304
  getCashAppLimits,
1271
1305
  getCashAppSessionStatus,
1272
1306
  getChainName,
package/dist/index.mjs CHANGED
@@ -350,6 +350,29 @@ async function createOnrampSession(request, publishableKey) {
350
350
  }
351
351
  return response.json();
352
352
  }
353
+ async function getBankTransferProviders(publishableKey, options = {}) {
354
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
355
+ validatePublishableKey(pk);
356
+ const params = new URLSearchParams();
357
+ if (options.countryCode) {
358
+ params.set("country_code", options.countryCode);
359
+ }
360
+ const queryString = params.toString();
361
+ const url = `${API_BASE_URL}/v1/public/onramps/bank_transfer/providers${queryString ? `?${queryString}` : ""}`;
362
+ const response = await fetch(url, {
363
+ method: "GET",
364
+ headers: {
365
+ accept: "application/json",
366
+ "x-publishable-key": pk
367
+ }
368
+ });
369
+ if (!response.ok) {
370
+ throw new Error(
371
+ `Failed to fetch bank-transfer providers: ${response.statusText}`
372
+ );
373
+ }
374
+ return response.json();
375
+ }
353
376
  function getOnrampSessionStartUrl(request, publishableKey) {
354
377
  const params = new URLSearchParams();
355
378
  params.append("publishable_key", publishableKey);
@@ -367,6 +390,9 @@ function getOnrampSessionStartUrl(request, publishableKey) {
367
390
  if (request.email) {
368
391
  params.append("email", request.email);
369
392
  }
393
+ if (request.payment_method) {
394
+ params.append("payment_method", request.payment_method);
395
+ }
370
396
  return `${API_BASE_URL}/v1/public/onramps/sessions/start?${params.toString()}`;
371
397
  }
372
398
  async function getDefaultOnrampToken(params, publishableKey) {
@@ -1023,6 +1049,10 @@ var WithdrawEventType = /* @__PURE__ */ ((WithdrawEventType2) => {
1023
1049
  WithdrawEventType2["DIRECT_EXECUTION_SUCCEEDED"] = "direct_execution.succeeded";
1024
1050
  return WithdrawEventType2;
1025
1051
  })(WithdrawEventType || {});
1052
+ var CheckoutEventType = /* @__PURE__ */ ((CheckoutEventType2) => {
1053
+ CheckoutEventType2["PAYMENT_INTENT_SUCCEEDED"] = "payment_intent.succeeded";
1054
+ return CheckoutEventType2;
1055
+ })(CheckoutEventType || {});
1026
1056
 
1027
1057
  // src/hooks/use-user-ip.ts
1028
1058
  import { useQuery } from "@tanstack/react-query";
@@ -1157,6 +1187,7 @@ var en_default = {
1157
1187
  var i18n = en_default;
1158
1188
  export {
1159
1189
  ActionType,
1190
+ CheckoutEventType,
1160
1191
  DepositEventType,
1161
1192
  ExecutionStatus,
1162
1193
  IneligibilityReason,
@@ -1179,6 +1210,7 @@ export {
1179
1210
  getAddressBalance,
1180
1211
  getAddressBalances,
1181
1212
  getApiBaseUrl,
1213
+ getBankTransferProviders,
1182
1214
  getCashAppLimits,
1183
1215
  getCashAppSessionStatus,
1184
1216
  getChainName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unifold/core",
3
- "version": "0.1.67",
3
+ "version": "0.1.68-beta.0",
4
4
  "description": "Unifold Core SDK - Core types, API client, and business logic",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",