@unifold/core 0.1.73 → 0.1.74

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
@@ -369,7 +369,18 @@ interface OnrampQuote {
369
369
  }
370
370
  interface OnrampQuotesRequest {
371
371
  country_code: string;
372
- source_amount: string;
372
+ /**
373
+ * Fiat amount to spend, inclusive of provider fees. Mutually exclusive with
374
+ * `destination_amount` — provide exactly one.
375
+ */
376
+ source_amount?: string;
377
+ /**
378
+ * Fixed crypto (destination) amount to receive, with provider fees added on
379
+ * top. Mutually exclusive with `source_amount` — provide exactly one. Only
380
+ * supported by providers that can quote by a fixed destination amount
381
+ * (unsupported providers are omitted from the results).
382
+ */
383
+ destination_amount?: string;
373
384
  source_currency: string;
374
385
  destination_currency: string;
375
386
  destination_network: string;
@@ -405,7 +416,11 @@ interface OnrampSessionRequest {
405
416
  service_provider: string;
406
417
  country_code: string;
407
418
  source_currency: string;
408
- source_amount: string;
419
+ /**
420
+ * Fiat amount to spend, inclusive of provider fees. Mutually exclusive with
421
+ * `destination_amount` — provide exactly one.
422
+ */
423
+ source_amount?: string;
409
424
  destination_currency: string;
410
425
  destination_network: string;
411
426
  wallet_address: string;
@@ -420,6 +435,13 @@ interface OnrampSessionRequest {
420
435
  payment_method_type?: OnrampSessionPaymentMethodType;
421
436
  /** @deprecated Use `payment_method_type` instead (same value). */
422
437
  payment_method?: OnrampSessionPaymentMethodType;
438
+ /**
439
+ * Fixed crypto (destination) amount to receive, with provider fees added on
440
+ * top. Mutually exclusive with `source_amount` — provide exactly one. Only
441
+ * supported by providers that can quote by a fixed destination amount;
442
+ * otherwise the request is rejected.
443
+ */
444
+ destination_amount?: string;
423
445
  }
424
446
  interface OnrampSessionResponse {
425
447
  url: string;
@@ -552,6 +574,8 @@ interface DefaultTokenMetadata {
552
574
  interface DefaultTokenResponse {
553
575
  destination_network: string;
554
576
  destination_currency: string;
577
+ /** Whether the requested destination token is a stablecoin. */
578
+ is_stablecoin: boolean;
555
579
  destination_token_metadata: DefaultTokenMetadata;
556
580
  estimated_processing_time: number | null;
557
581
  }
@@ -1061,6 +1085,35 @@ interface IntegrationFeeAmount {
1061
1085
  amount: string;
1062
1086
  currency: string;
1063
1087
  }
1088
+ /**
1089
+ * Backend error_type values for integration (exchange) transfer failures, so the
1090
+ * SDK can branch on them instead of string-matching provider messages.
1091
+ */
1092
+ type IntegrationTransferErrorType = 'integration_transfer_mfa_failed' | 'integration_transfer_confirm_failed' | 'integration_transfer_create_failed' | 'integration_transfer_intent_not_found' | 'integration_transfer_insufficient_balance' | 'integration_unsupported_provider' | (string & NonNullable<unknown>);
1093
+ /**
1094
+ * Extends `Error` so existing `catch` blocks that only read `.message` keep
1095
+ * working unchanged.
1096
+ */
1097
+ declare class IntegrationTransferError extends Error {
1098
+ readonly statusCode: number;
1099
+ /** Unifold backend error_type (e.g. `integration_transfer_mfa_failed`) */
1100
+ readonly errorType?: IntegrationTransferErrorType | undefined;
1101
+ /**
1102
+ * The exchange's own message (from `details.message`), without the operation
1103
+ * prefix baked into `message` — e.g. Coinbase's "Two factor code validation
1104
+ * failed. Please try again."
1105
+ */
1106
+ readonly detailMessage?: string | undefined;
1107
+ constructor(message: string, statusCode: number,
1108
+ /** Unifold backend error_type (e.g. `integration_transfer_mfa_failed`) */
1109
+ errorType?: IntegrationTransferErrorType | undefined,
1110
+ /**
1111
+ * The exchange's own message (from `details.message`), without the operation
1112
+ * prefix baked into `message` — e.g. Coinbase's "Two factor code validation
1113
+ * failed. Please try again."
1114
+ */
1115
+ detailMessage?: string | undefined);
1116
+ }
1064
1117
  interface CreateIntegrationTransferResult {
1065
1118
  id: string;
1066
1119
  status: string;
@@ -3100,4 +3153,4 @@ declare const i18n: {
3100
3153
  };
3101
3154
  type I18nStrings = typeof i18n;
3102
3155
 
3103
- 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, 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -369,7 +369,18 @@ interface OnrampQuote {
369
369
  }
370
370
  interface OnrampQuotesRequest {
371
371
  country_code: string;
372
- source_amount: string;
372
+ /**
373
+ * Fiat amount to spend, inclusive of provider fees. Mutually exclusive with
374
+ * `destination_amount` — provide exactly one.
375
+ */
376
+ source_amount?: string;
377
+ /**
378
+ * Fixed crypto (destination) amount to receive, with provider fees added on
379
+ * top. Mutually exclusive with `source_amount` — provide exactly one. Only
380
+ * supported by providers that can quote by a fixed destination amount
381
+ * (unsupported providers are omitted from the results).
382
+ */
383
+ destination_amount?: string;
373
384
  source_currency: string;
374
385
  destination_currency: string;
375
386
  destination_network: string;
@@ -405,7 +416,11 @@ interface OnrampSessionRequest {
405
416
  service_provider: string;
406
417
  country_code: string;
407
418
  source_currency: string;
408
- source_amount: string;
419
+ /**
420
+ * Fiat amount to spend, inclusive of provider fees. Mutually exclusive with
421
+ * `destination_amount` — provide exactly one.
422
+ */
423
+ source_amount?: string;
409
424
  destination_currency: string;
410
425
  destination_network: string;
411
426
  wallet_address: string;
@@ -420,6 +435,13 @@ interface OnrampSessionRequest {
420
435
  payment_method_type?: OnrampSessionPaymentMethodType;
421
436
  /** @deprecated Use `payment_method_type` instead (same value). */
422
437
  payment_method?: OnrampSessionPaymentMethodType;
438
+ /**
439
+ * Fixed crypto (destination) amount to receive, with provider fees added on
440
+ * top. Mutually exclusive with `source_amount` — provide exactly one. Only
441
+ * supported by providers that can quote by a fixed destination amount;
442
+ * otherwise the request is rejected.
443
+ */
444
+ destination_amount?: string;
423
445
  }
424
446
  interface OnrampSessionResponse {
425
447
  url: string;
@@ -552,6 +574,8 @@ interface DefaultTokenMetadata {
552
574
  interface DefaultTokenResponse {
553
575
  destination_network: string;
554
576
  destination_currency: string;
577
+ /** Whether the requested destination token is a stablecoin. */
578
+ is_stablecoin: boolean;
555
579
  destination_token_metadata: DefaultTokenMetadata;
556
580
  estimated_processing_time: number | null;
557
581
  }
@@ -1061,6 +1085,35 @@ interface IntegrationFeeAmount {
1061
1085
  amount: string;
1062
1086
  currency: string;
1063
1087
  }
1088
+ /**
1089
+ * Backend error_type values for integration (exchange) transfer failures, so the
1090
+ * SDK can branch on them instead of string-matching provider messages.
1091
+ */
1092
+ type IntegrationTransferErrorType = 'integration_transfer_mfa_failed' | 'integration_transfer_confirm_failed' | 'integration_transfer_create_failed' | 'integration_transfer_intent_not_found' | 'integration_transfer_insufficient_balance' | 'integration_unsupported_provider' | (string & NonNullable<unknown>);
1093
+ /**
1094
+ * Extends `Error` so existing `catch` blocks that only read `.message` keep
1095
+ * working unchanged.
1096
+ */
1097
+ declare class IntegrationTransferError extends Error {
1098
+ readonly statusCode: number;
1099
+ /** Unifold backend error_type (e.g. `integration_transfer_mfa_failed`) */
1100
+ readonly errorType?: IntegrationTransferErrorType | undefined;
1101
+ /**
1102
+ * The exchange's own message (from `details.message`), without the operation
1103
+ * prefix baked into `message` — e.g. Coinbase's "Two factor code validation
1104
+ * failed. Please try again."
1105
+ */
1106
+ readonly detailMessage?: string | undefined;
1107
+ constructor(message: string, statusCode: number,
1108
+ /** Unifold backend error_type (e.g. `integration_transfer_mfa_failed`) */
1109
+ errorType?: IntegrationTransferErrorType | undefined,
1110
+ /**
1111
+ * The exchange's own message (from `details.message`), without the operation
1112
+ * prefix baked into `message` — e.g. Coinbase's "Two factor code validation
1113
+ * failed. Please try again."
1114
+ */
1115
+ detailMessage?: string | undefined);
1116
+ }
1064
1117
  interface CreateIntegrationTransferResult {
1065
1118
  id: string;
1066
1119
  status: string;
@@ -3100,4 +3153,4 @@ declare const i18n: {
3100
3153
  };
3101
3154
  type I18nStrings = typeof i18n;
3102
3155
 
3103
- 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, 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 };
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 };
package/dist/index.js CHANGED
@@ -34,6 +34,7 @@ __export(index_exports, {
34
34
  ExecutionStatus: () => ExecutionStatus,
35
35
  IneligibilityReason: () => IneligibilityReason,
36
36
  IntegrationProvider: () => IntegrationProvider,
37
+ IntegrationTransferError: () => IntegrationTransferError,
37
38
  LOOKBACK_MS: () => LOOKBACK_MS,
38
39
  SCAN_NUDGE_INTERVAL_MS: () => SCAN_NUDGE_INTERVAL_MS,
39
40
  SOLANA_USDC_ADDRESS: () => SOLANA_USDC_ADDRESS,
@@ -180,7 +181,7 @@ function generatePrefixedKSUID(prefix) {
180
181
  }
181
182
 
182
183
  // src/lib/client-headers.ts
183
- var SDK_VERSION = true ? "0.1.73" : "0.0.0-dev";
184
+ var SDK_VERSION = true ? "0.1.74" : "0.0.0-dev";
184
185
  var CLIENT_VERSION_HEADER = "x-unifold-client-version";
185
186
  var CLIENT_USER_AGENT_HEADER = "x-unifold-client-user-agent";
186
187
  function detectRuntime() {
@@ -648,7 +649,12 @@ function getOnrampSessionStartUrl(request, publishableKey) {
648
649
  params.append("service_provider", request.service_provider);
649
650
  params.append("country_code", request.country_code);
650
651
  params.append("source_currency", request.source_currency);
651
- params.append("source_amount", request.source_amount);
652
+ if (request.source_amount) {
653
+ params.append("source_amount", request.source_amount);
654
+ }
655
+ if (request.destination_amount) {
656
+ params.append("destination_amount", request.destination_amount);
657
+ }
652
658
  params.append("destination_currency", request.destination_currency);
653
659
  params.append("destination_network", request.destination_network);
654
660
  params.append("wallet_address", request.wallet_address);
@@ -1061,6 +1067,25 @@ async function getIntegrationHoldings(provider, accessToken, publishableKey) {
1061
1067
  }
1062
1068
  return response.json();
1063
1069
  }
1070
+ var IntegrationTransferError = class extends Error {
1071
+ constructor(message, statusCode, errorType, detailMessage) {
1072
+ super(message);
1073
+ this.statusCode = statusCode;
1074
+ this.errorType = errorType;
1075
+ this.detailMessage = detailMessage;
1076
+ this.name = "IntegrationTransferError";
1077
+ }
1078
+ };
1079
+ async function throwIntegrationTransferError(prefix, response) {
1080
+ const body = await response.json().catch(() => ({}));
1081
+ const detailMessage = body.details?.message;
1082
+ throw new IntegrationTransferError(
1083
+ `${prefix}: ${detailMessage || body.message || response.statusText}`,
1084
+ response.status,
1085
+ body.error_type,
1086
+ detailMessage
1087
+ );
1088
+ }
1064
1089
  async function createIntegrationTransfer(params, publishableKey) {
1065
1090
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1066
1091
  validatePublishableKey(pk);
@@ -1074,8 +1099,7 @@ async function createIntegrationTransfer(params, publishableKey) {
1074
1099
  body: JSON.stringify(params)
1075
1100
  });
1076
1101
  if (!response.ok) {
1077
- const err = await response.json().catch(() => ({ message: response.statusText }));
1078
- throw new Error(`Failed to create transfer: ${err.message || response.statusText}`);
1102
+ await throwIntegrationTransferError("Failed to create transfer", response);
1079
1103
  }
1080
1104
  return response.json();
1081
1105
  }
@@ -1097,8 +1121,7 @@ async function confirmIntegrationTransfer(transferId, accessToken, mfaCode, publ
1097
1121
  }
1098
1122
  );
1099
1123
  if (!response.ok) {
1100
- const err = await response.json().catch(() => ({ message: response.statusText }));
1101
- throw new Error(`Failed to confirm transfer: ${err.message || response.statusText}`);
1124
+ await throwIntegrationTransferError("Failed to confirm transfer", response);
1102
1125
  }
1103
1126
  return response.json();
1104
1127
  }
@@ -2855,6 +2878,7 @@ var i18n = en_default;
2855
2878
  ExecutionStatus,
2856
2879
  IneligibilityReason,
2857
2880
  IntegrationProvider,
2881
+ IntegrationTransferError,
2858
2882
  LOOKBACK_MS,
2859
2883
  SCAN_NUDGE_INTERVAL_MS,
2860
2884
  SOLANA_USDC_ADDRESS,
package/dist/index.mjs CHANGED
@@ -41,7 +41,7 @@ function generatePrefixedKSUID(prefix) {
41
41
  }
42
42
 
43
43
  // src/lib/client-headers.ts
44
- var SDK_VERSION = true ? "0.1.73" : "0.0.0-dev";
44
+ var SDK_VERSION = true ? "0.1.74" : "0.0.0-dev";
45
45
  var CLIENT_VERSION_HEADER = "x-unifold-client-version";
46
46
  var CLIENT_USER_AGENT_HEADER = "x-unifold-client-user-agent";
47
47
  function detectRuntime() {
@@ -509,7 +509,12 @@ function getOnrampSessionStartUrl(request, publishableKey) {
509
509
  params.append("service_provider", request.service_provider);
510
510
  params.append("country_code", request.country_code);
511
511
  params.append("source_currency", request.source_currency);
512
- params.append("source_amount", request.source_amount);
512
+ if (request.source_amount) {
513
+ params.append("source_amount", request.source_amount);
514
+ }
515
+ if (request.destination_amount) {
516
+ params.append("destination_amount", request.destination_amount);
517
+ }
513
518
  params.append("destination_currency", request.destination_currency);
514
519
  params.append("destination_network", request.destination_network);
515
520
  params.append("wallet_address", request.wallet_address);
@@ -922,6 +927,25 @@ async function getIntegrationHoldings(provider, accessToken, publishableKey) {
922
927
  }
923
928
  return response.json();
924
929
  }
930
+ var IntegrationTransferError = class extends Error {
931
+ constructor(message, statusCode, errorType, detailMessage) {
932
+ super(message);
933
+ this.statusCode = statusCode;
934
+ this.errorType = errorType;
935
+ this.detailMessage = detailMessage;
936
+ this.name = "IntegrationTransferError";
937
+ }
938
+ };
939
+ async function throwIntegrationTransferError(prefix, response) {
940
+ const body = await response.json().catch(() => ({}));
941
+ const detailMessage = body.details?.message;
942
+ throw new IntegrationTransferError(
943
+ `${prefix}: ${detailMessage || body.message || response.statusText}`,
944
+ response.status,
945
+ body.error_type,
946
+ detailMessage
947
+ );
948
+ }
925
949
  async function createIntegrationTransfer(params, publishableKey) {
926
950
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
927
951
  validatePublishableKey(pk);
@@ -935,8 +959,7 @@ async function createIntegrationTransfer(params, publishableKey) {
935
959
  body: JSON.stringify(params)
936
960
  });
937
961
  if (!response.ok) {
938
- const err = await response.json().catch(() => ({ message: response.statusText }));
939
- throw new Error(`Failed to create transfer: ${err.message || response.statusText}`);
962
+ await throwIntegrationTransferError("Failed to create transfer", response);
940
963
  }
941
964
  return response.json();
942
965
  }
@@ -958,8 +981,7 @@ async function confirmIntegrationTransfer(transferId, accessToken, mfaCode, publ
958
981
  }
959
982
  );
960
983
  if (!response.ok) {
961
- const err = await response.json().catch(() => ({ message: response.statusText }));
962
- throw new Error(`Failed to confirm transfer: ${err.message || response.statusText}`);
984
+ await throwIntegrationTransferError("Failed to confirm transfer", response);
963
985
  }
964
986
  return response.json();
965
987
  }
@@ -2715,6 +2737,7 @@ export {
2715
2737
  ExecutionStatus,
2716
2738
  IneligibilityReason,
2717
2739
  IntegrationProvider,
2740
+ IntegrationTransferError,
2718
2741
  LOOKBACK_MS,
2719
2742
  SCAN_NUDGE_INTERVAL_MS,
2720
2743
  SOLANA_USDC_ADDRESS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unifold/core",
3
- "version": "0.1.73",
3
+ "version": "0.1.74",
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",