@unifold/core 0.1.68-beta.1 → 0.1.68-beta.2

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
@@ -1703,6 +1703,132 @@ interface CoinbaseApplePaySessionResponse {
1703
1703
  destination_amount?: string;
1704
1704
  total_fee?: number;
1705
1705
  }
1706
+ /**
1707
+ * One Coinbase guest-checkout limit bucket. Field names are snake_case
1708
+ * to match the wire format (every API response is recursively
1709
+ * snake_cased by `TransformInterceptor` on the way out).
1710
+ */
1711
+ interface CoinbaseApplePayLimit {
1712
+ /** `weekly_spending` (rolling 7-day USD cap) or `lifetime_transactions` (all-time count). */
1713
+ limit_type: 'weekly_spending' | 'lifetime_transactions';
1714
+ /** USD for spending limits; absent for count limits. */
1715
+ currency?: string;
1716
+ /** Max limit value (stringified). */
1717
+ limit: string;
1718
+ /** Remaining capacity (`"0"` once the cap is exhausted). */
1719
+ remaining: string;
1720
+ }
1721
+ /**
1722
+ * State machine for a single limit-upgrade option, per Coinbase's
1723
+ * headless-onramp limits-upgrade guide:
1724
+ *
1725
+ * unrequested → user has never submitted; collect `fields` and POST
1726
+ * /limits/upgrade.
1727
+ * pending → submission under review by Coinbase; poll /limits
1728
+ * until a terminal state.
1729
+ * resubmit → previous submission was rejected but retryable;
1730
+ * collect corrected `fields` and POST /limits/upgrade
1731
+ * again.
1732
+ * active → terminal. Upgrade approved.
1733
+ * inactive → terminal. User permanently blocked; do not retry.
1734
+ */
1735
+ type ApplePayLimitUpgradeStatus = 'unrequested' | 'pending' | 'resubmit' | 'active' | 'inactive';
1736
+ /** One available limit-upgrade option (shape is loose; Coinbase may add fields). */
1737
+ interface CoinbaseApplePayLimitUpgradeOption {
1738
+ /** State machine value. May be absent on partial / pre-eligible responses. */
1739
+ status?: ApplePayLimitUpgradeStatus | string;
1740
+ /** Field keys to collect from the user (today: `ssnLast4`, `dateOfBirth`). */
1741
+ fields?: string[];
1742
+ [key: string]: unknown;
1743
+ }
1744
+ /**
1745
+ * Wire-format response from `POST /apple_pay/limits`. The two `limit_*`
1746
+ * fields come straight from Coinbase (via our snake_casing
1747
+ * passthrough); the two derived fields (`limit_reached`,
1748
+ * `upgrade_status`) are appended by the SDK function for caller
1749
+ * ergonomics — see `getCoinbaseApplePayLimits`.
1750
+ */
1751
+ interface CoinbaseApplePayLimitsResponse {
1752
+ limits: CoinbaseApplePayLimit[];
1753
+ limit_upgrade_options?: CoinbaseApplePayLimitUpgradeOption[];
1754
+ /**
1755
+ * Convenience flag baked in by the SDK function. True iff EITHER
1756
+ * `weekly_spending` OR `lifetime_transactions` is exhausted —
1757
+ * Coinbase rejects a new order if it would exceed *either* cap, so
1758
+ * either bucket at `"0"` blocks the user from transacting.
1759
+ * Equivalent to `isApplePayLimitReached(response)`.
1760
+ */
1761
+ limit_reached: boolean;
1762
+ /**
1763
+ * Convenience flag baked in by the SDK function — the status of
1764
+ * `limit_upgrade_options[0]` when present, `null` otherwise.
1765
+ * Equivalent to `getApplePayLimitUpgradeStatus(response)`.
1766
+ */
1767
+ upgrade_status: ApplePayLimitUpgradeStatus | null;
1768
+ }
1769
+ /**
1770
+ * True iff EITHER `weekly_spending` OR `lifetime_transactions` bucket
1771
+ * is exhausted (`remaining === "0"`). Coinbase rejects a new order if
1772
+ * it would exceed *either* cap — so a user with `weekly=985` but
1773
+ * `lifetime=0` still can't transact, and we should route to the
1774
+ * upgrade flow (or terminal screen if no upgrade is available).
1775
+ *
1776
+ * Defensive on missing buckets: an absent bucket is treated as "not at
1777
+ * cap" for that dimension. All buckets absent ⇒ false (safe default —
1778
+ * we have no evidence they're blocked).
1779
+ */
1780
+ declare function isApplePayLimitReached(response: Pick<CoinbaseApplePayLimitsResponse, 'limits'>): boolean;
1781
+ /**
1782
+ * Extract the upgrade option's `status` from a limits response. Returns
1783
+ * `null` when the user has no `limit_upgrade_options` at all
1784
+ * (ineligible) or when the upstream omits the field; the caller should
1785
+ * treat that case the same as an `inactive` terminal — there's no
1786
+ * upgrade path.
1787
+ *
1788
+ * Today Coinbase only ever returns a single entry in
1789
+ * `limit_upgrade_options`; if that changes we'll need to scope this by
1790
+ * payment-method type. For now indexing `[0]` is what the
1791
+ * limits-upgrade guide itself does.
1792
+ */
1793
+ declare function getApplePayLimitUpgradeStatus(response: Pick<CoinbaseApplePayLimitsResponse, 'limit_upgrade_options'>): ApplePayLimitUpgradeStatus | null;
1794
+ /**
1795
+ * Fetch the user's current Apple Pay (guest-checkout) limits + any
1796
+ * available upgrade options. Safe to call before the verification OTP —
1797
+ * callers usually pair this with `isApplePayBothLimitsReached` to decide
1798
+ * whether to surface the limit-upgrade flow instead of sending the SMS.
1799
+ *
1800
+ * @see https://docs.cdp.coinbase.com/api-reference/v2/rest-api/onramp/get-onramp-user-limits
1801
+ */
1802
+ declare function getCoinbaseApplePayLimits(
1803
+ /** US phone in E.164 (e.g. `+12345678901`). */
1804
+ phone: string, publishableKey?: string, signal?: AbortSignal): Promise<CoinbaseApplePayLimitsResponse>;
1805
+ interface RequestCoinbaseApplePayLimitUpgradeRequest {
1806
+ /** US phone in E.164. Must match a phone the user controls (Coinbase verifies via the prior OTP). */
1807
+ phone: string;
1808
+ fields: {
1809
+ /** Last 4 SSN digits, no dashes/spaces. */
1810
+ ssnLast4: string;
1811
+ /** Zero-padded day/month, 4-digit year. */
1812
+ dateOfBirth: {
1813
+ day: string;
1814
+ month: string;
1815
+ year: string;
1816
+ };
1817
+ };
1818
+ }
1819
+ interface RequestCoinbaseApplePayLimitUpgradeResponse {
1820
+ /** Always `"accepted"`. The upgrade decision is asynchronous — poll the limits endpoint. */
1821
+ status: 'accepted';
1822
+ }
1823
+ /**
1824
+ * Submit identity fields (DOB + SSN last 4) to request an Apple Pay limit
1825
+ * upgrade. The decision is asynchronous on Coinbase's side; poll
1826
+ * `getCoinbaseApplePayLimits` after this to observe whether the new caps
1827
+ * landed.
1828
+ *
1829
+ * @see https://docs.cdp.coinbase.com/api-reference/v2/rest-api/onramp/request-limit-upgrade
1830
+ */
1831
+ declare function requestCoinbaseApplePayLimitUpgrade(request: RequestCoinbaseApplePayLimitUpgradeRequest, publishableKey?: string, signal?: AbortSignal): Promise<RequestCoinbaseApplePayLimitUpgradeResponse>;
1706
1832
  /**
1707
1833
  * Create an Apple Pay onramp session. Requires a fresh `onrampToken` from
1708
1834
  * `exchangeOnrampVerificationToken`.
@@ -2021,4 +2147,4 @@ declare const i18n: {
2021
2147
  };
2022
2148
  type I18nStrings = typeof i18n;
2023
2149
 
2024
- export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, 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 CheckoutMethod, type CheckoutPaymentIntent, type CheckoutPaymentIntentData, type CheckoutPaymentIntentSucceededEvent, type CoinbaseApplePaySessionResponse, type CoinbaseLegalAgreement, type CoinbaseLegalAgreementsResponse, type ConfirmIntegrationTransferResult, type CreateCoinbaseApplePaySessionRequest, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type CreateIntegrationTransferParams, type CreateIntegrationTransferResult, type CreateOnrampVerificationSessionRequest, 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 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 QueryExecutionsRequest, type QueryExecutionsResponse, type RefreshIntegrationTokenResult, 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 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, createCoinbaseApplePaySession, createDepositAddress, createExchangeSession, createIntegrationTransfer, createOnrampSession, createOnrampVerificationSession, exchangeOnrampVerificationToken, formatStablecoinAmount, generateKSUID, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getApplePayProviders, getBankTransferProviders, getCashAppLimits, getCashAppSessionStatus, getChainName, getCoinbaseLegalAgreements, getDefaultOnrampToken, getDepositAddress, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getExternalWallets, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIntegrationExchanges, getIntegrationHoldings, getIntegrationTransferDefaultToken, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getOnrampVerificationSession, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, getWalletMobileDeepLink, i18n, listPaymentIntentExecutions, pollDirectExecutions, queryExecutions, refreshIntegrationToken, retrievePaymentIntent, revokeIntegrationToken, sendHypercoreTransaction, sendOnrampVerificationOtp, sendSolanaTransaction, setApiConfig, startIntegrationOAuth, stripeConfirmSession, stripeCreateAuthIntent, stripeCreateSession, stripeExchangeTokens, stripeGetConfig, stripeGetCustomer, stripeGetDefaultToken, stripeGetQuotes, stripeGetSession, stripeGetTransactionLimits, stripeListPaymentTokens, stripeListWallets, stripeRefreshQuote, stripeRefreshToken, useUserIp, verifyOnrampVerificationOtp, verifyRecipientAddress };
2150
+ export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, 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 CheckoutMethod, type CheckoutPaymentIntent, type CheckoutPaymentIntentData, type CheckoutPaymentIntentSucceededEvent, type CoinbaseApplePayLimit, type CoinbaseApplePayLimitUpgradeOption, type CoinbaseApplePayLimitsResponse, type CoinbaseApplePaySessionResponse, type CoinbaseLegalAgreement, type CoinbaseLegalAgreementsResponse, type ConfirmIntegrationTransferResult, type CreateCoinbaseApplePaySessionRequest, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type CreateIntegrationTransferParams, type CreateIntegrationTransferResult, type CreateOnrampVerificationSessionRequest, 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 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 QueryExecutionsRequest, type QueryExecutionsResponse, type RefreshIntegrationTokenResult, type RequestCoinbaseApplePayLimitUpgradeRequest, type RequestCoinbaseApplePayLimitUpgradeResponse, 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 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, createCoinbaseApplePaySession, createDepositAddress, createExchangeSession, createIntegrationTransfer, createOnrampSession, createOnrampVerificationSession, exchangeOnrampVerificationToken, formatStablecoinAmount, generateKSUID, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getApplePayLimitUpgradeStatus, getApplePayProviders, getBankTransferProviders, getCashAppLimits, getCashAppSessionStatus, getChainName, getCoinbaseApplePayLimits, getCoinbaseLegalAgreements, getDefaultOnrampToken, getDepositAddress, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getExternalWallets, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIntegrationExchanges, getIntegrationHoldings, getIntegrationTransferDefaultToken, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getOnrampVerificationSession, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, getWalletMobileDeepLink, i18n, isApplePayLimitReached, listPaymentIntentExecutions, pollDirectExecutions, queryExecutions, refreshIntegrationToken, requestCoinbaseApplePayLimitUpgrade, 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
@@ -1703,6 +1703,132 @@ interface CoinbaseApplePaySessionResponse {
1703
1703
  destination_amount?: string;
1704
1704
  total_fee?: number;
1705
1705
  }
1706
+ /**
1707
+ * One Coinbase guest-checkout limit bucket. Field names are snake_case
1708
+ * to match the wire format (every API response is recursively
1709
+ * snake_cased by `TransformInterceptor` on the way out).
1710
+ */
1711
+ interface CoinbaseApplePayLimit {
1712
+ /** `weekly_spending` (rolling 7-day USD cap) or `lifetime_transactions` (all-time count). */
1713
+ limit_type: 'weekly_spending' | 'lifetime_transactions';
1714
+ /** USD for spending limits; absent for count limits. */
1715
+ currency?: string;
1716
+ /** Max limit value (stringified). */
1717
+ limit: string;
1718
+ /** Remaining capacity (`"0"` once the cap is exhausted). */
1719
+ remaining: string;
1720
+ }
1721
+ /**
1722
+ * State machine for a single limit-upgrade option, per Coinbase's
1723
+ * headless-onramp limits-upgrade guide:
1724
+ *
1725
+ * unrequested → user has never submitted; collect `fields` and POST
1726
+ * /limits/upgrade.
1727
+ * pending → submission under review by Coinbase; poll /limits
1728
+ * until a terminal state.
1729
+ * resubmit → previous submission was rejected but retryable;
1730
+ * collect corrected `fields` and POST /limits/upgrade
1731
+ * again.
1732
+ * active → terminal. Upgrade approved.
1733
+ * inactive → terminal. User permanently blocked; do not retry.
1734
+ */
1735
+ type ApplePayLimitUpgradeStatus = 'unrequested' | 'pending' | 'resubmit' | 'active' | 'inactive';
1736
+ /** One available limit-upgrade option (shape is loose; Coinbase may add fields). */
1737
+ interface CoinbaseApplePayLimitUpgradeOption {
1738
+ /** State machine value. May be absent on partial / pre-eligible responses. */
1739
+ status?: ApplePayLimitUpgradeStatus | string;
1740
+ /** Field keys to collect from the user (today: `ssnLast4`, `dateOfBirth`). */
1741
+ fields?: string[];
1742
+ [key: string]: unknown;
1743
+ }
1744
+ /**
1745
+ * Wire-format response from `POST /apple_pay/limits`. The two `limit_*`
1746
+ * fields come straight from Coinbase (via our snake_casing
1747
+ * passthrough); the two derived fields (`limit_reached`,
1748
+ * `upgrade_status`) are appended by the SDK function for caller
1749
+ * ergonomics — see `getCoinbaseApplePayLimits`.
1750
+ */
1751
+ interface CoinbaseApplePayLimitsResponse {
1752
+ limits: CoinbaseApplePayLimit[];
1753
+ limit_upgrade_options?: CoinbaseApplePayLimitUpgradeOption[];
1754
+ /**
1755
+ * Convenience flag baked in by the SDK function. True iff EITHER
1756
+ * `weekly_spending` OR `lifetime_transactions` is exhausted —
1757
+ * Coinbase rejects a new order if it would exceed *either* cap, so
1758
+ * either bucket at `"0"` blocks the user from transacting.
1759
+ * Equivalent to `isApplePayLimitReached(response)`.
1760
+ */
1761
+ limit_reached: boolean;
1762
+ /**
1763
+ * Convenience flag baked in by the SDK function — the status of
1764
+ * `limit_upgrade_options[0]` when present, `null` otherwise.
1765
+ * Equivalent to `getApplePayLimitUpgradeStatus(response)`.
1766
+ */
1767
+ upgrade_status: ApplePayLimitUpgradeStatus | null;
1768
+ }
1769
+ /**
1770
+ * True iff EITHER `weekly_spending` OR `lifetime_transactions` bucket
1771
+ * is exhausted (`remaining === "0"`). Coinbase rejects a new order if
1772
+ * it would exceed *either* cap — so a user with `weekly=985` but
1773
+ * `lifetime=0` still can't transact, and we should route to the
1774
+ * upgrade flow (or terminal screen if no upgrade is available).
1775
+ *
1776
+ * Defensive on missing buckets: an absent bucket is treated as "not at
1777
+ * cap" for that dimension. All buckets absent ⇒ false (safe default —
1778
+ * we have no evidence they're blocked).
1779
+ */
1780
+ declare function isApplePayLimitReached(response: Pick<CoinbaseApplePayLimitsResponse, 'limits'>): boolean;
1781
+ /**
1782
+ * Extract the upgrade option's `status` from a limits response. Returns
1783
+ * `null` when the user has no `limit_upgrade_options` at all
1784
+ * (ineligible) or when the upstream omits the field; the caller should
1785
+ * treat that case the same as an `inactive` terminal — there's no
1786
+ * upgrade path.
1787
+ *
1788
+ * Today Coinbase only ever returns a single entry in
1789
+ * `limit_upgrade_options`; if that changes we'll need to scope this by
1790
+ * payment-method type. For now indexing `[0]` is what the
1791
+ * limits-upgrade guide itself does.
1792
+ */
1793
+ declare function getApplePayLimitUpgradeStatus(response: Pick<CoinbaseApplePayLimitsResponse, 'limit_upgrade_options'>): ApplePayLimitUpgradeStatus | null;
1794
+ /**
1795
+ * Fetch the user's current Apple Pay (guest-checkout) limits + any
1796
+ * available upgrade options. Safe to call before the verification OTP —
1797
+ * callers usually pair this with `isApplePayBothLimitsReached` to decide
1798
+ * whether to surface the limit-upgrade flow instead of sending the SMS.
1799
+ *
1800
+ * @see https://docs.cdp.coinbase.com/api-reference/v2/rest-api/onramp/get-onramp-user-limits
1801
+ */
1802
+ declare function getCoinbaseApplePayLimits(
1803
+ /** US phone in E.164 (e.g. `+12345678901`). */
1804
+ phone: string, publishableKey?: string, signal?: AbortSignal): Promise<CoinbaseApplePayLimitsResponse>;
1805
+ interface RequestCoinbaseApplePayLimitUpgradeRequest {
1806
+ /** US phone in E.164. Must match a phone the user controls (Coinbase verifies via the prior OTP). */
1807
+ phone: string;
1808
+ fields: {
1809
+ /** Last 4 SSN digits, no dashes/spaces. */
1810
+ ssnLast4: string;
1811
+ /** Zero-padded day/month, 4-digit year. */
1812
+ dateOfBirth: {
1813
+ day: string;
1814
+ month: string;
1815
+ year: string;
1816
+ };
1817
+ };
1818
+ }
1819
+ interface RequestCoinbaseApplePayLimitUpgradeResponse {
1820
+ /** Always `"accepted"`. The upgrade decision is asynchronous — poll the limits endpoint. */
1821
+ status: 'accepted';
1822
+ }
1823
+ /**
1824
+ * Submit identity fields (DOB + SSN last 4) to request an Apple Pay limit
1825
+ * upgrade. The decision is asynchronous on Coinbase's side; poll
1826
+ * `getCoinbaseApplePayLimits` after this to observe whether the new caps
1827
+ * landed.
1828
+ *
1829
+ * @see https://docs.cdp.coinbase.com/api-reference/v2/rest-api/onramp/request-limit-upgrade
1830
+ */
1831
+ declare function requestCoinbaseApplePayLimitUpgrade(request: RequestCoinbaseApplePayLimitUpgradeRequest, publishableKey?: string, signal?: AbortSignal): Promise<RequestCoinbaseApplePayLimitUpgradeResponse>;
1706
1832
  /**
1707
1833
  * Create an Apple Pay onramp session. Requires a fresh `onrampToken` from
1708
1834
  * `exchangeOnrampVerificationToken`.
@@ -2021,4 +2147,4 @@ declare const i18n: {
2021
2147
  };
2022
2148
  type I18nStrings = typeof i18n;
2023
2149
 
2024
- export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, 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 CheckoutMethod, type CheckoutPaymentIntent, type CheckoutPaymentIntentData, type CheckoutPaymentIntentSucceededEvent, type CoinbaseApplePaySessionResponse, type CoinbaseLegalAgreement, type CoinbaseLegalAgreementsResponse, type ConfirmIntegrationTransferResult, type CreateCoinbaseApplePaySessionRequest, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type CreateIntegrationTransferParams, type CreateIntegrationTransferResult, type CreateOnrampVerificationSessionRequest, 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 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 QueryExecutionsRequest, type QueryExecutionsResponse, type RefreshIntegrationTokenResult, 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 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, createCoinbaseApplePaySession, createDepositAddress, createExchangeSession, createIntegrationTransfer, createOnrampSession, createOnrampVerificationSession, exchangeOnrampVerificationToken, formatStablecoinAmount, generateKSUID, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getApplePayProviders, getBankTransferProviders, getCashAppLimits, getCashAppSessionStatus, getChainName, getCoinbaseLegalAgreements, getDefaultOnrampToken, getDepositAddress, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getExternalWallets, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIntegrationExchanges, getIntegrationHoldings, getIntegrationTransferDefaultToken, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getOnrampVerificationSession, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, getWalletMobileDeepLink, i18n, listPaymentIntentExecutions, pollDirectExecutions, queryExecutions, refreshIntegrationToken, retrievePaymentIntent, revokeIntegrationToken, sendHypercoreTransaction, sendOnrampVerificationOtp, sendSolanaTransaction, setApiConfig, startIntegrationOAuth, stripeConfirmSession, stripeCreateAuthIntent, stripeCreateSession, stripeExchangeTokens, stripeGetConfig, stripeGetCustomer, stripeGetDefaultToken, stripeGetQuotes, stripeGetSession, stripeGetTransactionLimits, stripeListPaymentTokens, stripeListWallets, stripeRefreshQuote, stripeRefreshToken, useUserIp, verifyOnrampVerificationOtp, verifyRecipientAddress };
2150
+ export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, 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 CheckoutMethod, type CheckoutPaymentIntent, type CheckoutPaymentIntentData, type CheckoutPaymentIntentSucceededEvent, type CoinbaseApplePayLimit, type CoinbaseApplePayLimitUpgradeOption, type CoinbaseApplePayLimitsResponse, type CoinbaseApplePaySessionResponse, type CoinbaseLegalAgreement, type CoinbaseLegalAgreementsResponse, type ConfirmIntegrationTransferResult, type CreateCoinbaseApplePaySessionRequest, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type CreateIntegrationTransferParams, type CreateIntegrationTransferResult, type CreateOnrampVerificationSessionRequest, 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 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 QueryExecutionsRequest, type QueryExecutionsResponse, type RefreshIntegrationTokenResult, type RequestCoinbaseApplePayLimitUpgradeRequest, type RequestCoinbaseApplePayLimitUpgradeResponse, 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 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, createCoinbaseApplePaySession, createDepositAddress, createExchangeSession, createIntegrationTransfer, createOnrampSession, createOnrampVerificationSession, exchangeOnrampVerificationToken, formatStablecoinAmount, generateKSUID, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getApplePayLimitUpgradeStatus, getApplePayProviders, getBankTransferProviders, getCashAppLimits, getCashAppSessionStatus, getChainName, getCoinbaseApplePayLimits, getCoinbaseLegalAgreements, getDefaultOnrampToken, getDepositAddress, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getExternalWallets, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIntegrationExchanges, getIntegrationHoldings, getIntegrationTransferDefaultToken, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getOnrampVerificationSession, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, getWalletMobileDeepLink, i18n, isApplePayLimitReached, listPaymentIntentExecutions, pollDirectExecutions, queryExecutions, refreshIntegrationToken, requestCoinbaseApplePayLimitUpgrade, 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
@@ -48,11 +48,13 @@ __export(index_exports, {
48
48
  getAddressBalance: () => getAddressBalance,
49
49
  getAddressBalances: () => getAddressBalances,
50
50
  getApiBaseUrl: () => getApiBaseUrl,
51
+ getApplePayLimitUpgradeStatus: () => getApplePayLimitUpgradeStatus,
51
52
  getApplePayProviders: () => getApplePayProviders,
52
53
  getBankTransferProviders: () => getBankTransferProviders,
53
54
  getCashAppLimits: () => getCashAppLimits,
54
55
  getCashAppSessionStatus: () => getCashAppSessionStatus,
55
56
  getChainName: () => getChainName,
57
+ getCoinbaseApplePayLimits: () => getCoinbaseApplePayLimits,
56
58
  getCoinbaseLegalAgreements: () => getCoinbaseLegalAgreements,
57
59
  getDefaultOnrampToken: () => getDefaultOnrampToken,
58
60
  getDepositAddress: () => getDepositAddress,
@@ -79,10 +81,12 @@ __export(index_exports, {
79
81
  getWalletByChainType: () => getWalletByChainType,
80
82
  getWalletMobileDeepLink: () => getWalletMobileDeepLink,
81
83
  i18n: () => i18n,
84
+ isApplePayLimitReached: () => isApplePayLimitReached,
82
85
  listPaymentIntentExecutions: () => listPaymentIntentExecutions,
83
86
  pollDirectExecutions: () => pollDirectExecutions,
84
87
  queryExecutions: () => queryExecutions,
85
88
  refreshIntegrationToken: () => refreshIntegrationToken,
89
+ requestCoinbaseApplePayLimitUpgrade: () => requestCoinbaseApplePayLimitUpgrade,
86
90
  retrievePaymentIntent: () => retrievePaymentIntent,
87
91
  revokeIntegrationToken: () => revokeIntegrationToken,
88
92
  sendHypercoreTransaction: () => sendHypercoreTransaction,
@@ -1535,6 +1539,59 @@ async function getOnrampVerificationSession(id, clientSecret, publishableKey) {
1535
1539
  });
1536
1540
  return jsonOrThrow(response, "Failed to fetch verification session");
1537
1541
  }
1542
+ function isApplePayLimitReached(response) {
1543
+ return response.limits.some((l) => l.remaining === "0");
1544
+ }
1545
+ function getApplePayLimitUpgradeStatus(response) {
1546
+ const opt = response.limit_upgrade_options?.[0];
1547
+ if (!opt || typeof opt.status !== "string") return null;
1548
+ return opt.status;
1549
+ }
1550
+ async function getCoinbaseApplePayLimits(phone, publishableKey, signal) {
1551
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1552
+ validatePublishableKey(pk);
1553
+ const response = await fetch(
1554
+ `${API_BASE_URL}/v1/public/onramps/headless/coinbase/apple_pay/limits`,
1555
+ {
1556
+ method: "POST",
1557
+ headers: {
1558
+ accept: "application/json",
1559
+ "x-publishable-key": pk,
1560
+ "Content-Type": "application/json"
1561
+ },
1562
+ body: JSON.stringify({ phone }),
1563
+ signal
1564
+ }
1565
+ );
1566
+ const raw = await jsonOrThrow(response, "Failed to fetch Apple Pay limits");
1567
+ return {
1568
+ limits: raw.limits,
1569
+ limit_upgrade_options: raw.limit_upgrade_options,
1570
+ limit_reached: isApplePayLimitReached(raw),
1571
+ upgrade_status: getApplePayLimitUpgradeStatus(raw)
1572
+ };
1573
+ }
1574
+ async function requestCoinbaseApplePayLimitUpgrade(request, publishableKey, signal) {
1575
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1576
+ validatePublishableKey(pk);
1577
+ const response = await fetch(
1578
+ `${API_BASE_URL}/v1/public/onramps/headless/coinbase/apple_pay/limits/upgrade`,
1579
+ {
1580
+ method: "POST",
1581
+ headers: {
1582
+ accept: "application/json",
1583
+ "x-publishable-key": pk,
1584
+ "Content-Type": "application/json"
1585
+ },
1586
+ body: JSON.stringify(request),
1587
+ signal
1588
+ }
1589
+ );
1590
+ return jsonOrThrow(
1591
+ response,
1592
+ "Failed to request Apple Pay limit upgrade"
1593
+ );
1594
+ }
1538
1595
  async function createCoinbaseApplePaySession(request, onrampToken, publishableKey, signal) {
1539
1596
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1540
1597
  validatePublishableKey(pk);
@@ -1734,11 +1791,13 @@ var i18n = en_default;
1734
1791
  getAddressBalance,
1735
1792
  getAddressBalances,
1736
1793
  getApiBaseUrl,
1794
+ getApplePayLimitUpgradeStatus,
1737
1795
  getApplePayProviders,
1738
1796
  getBankTransferProviders,
1739
1797
  getCashAppLimits,
1740
1798
  getCashAppSessionStatus,
1741
1799
  getChainName,
1800
+ getCoinbaseApplePayLimits,
1742
1801
  getCoinbaseLegalAgreements,
1743
1802
  getDefaultOnrampToken,
1744
1803
  getDepositAddress,
@@ -1765,10 +1824,12 @@ var i18n = en_default;
1765
1824
  getWalletByChainType,
1766
1825
  getWalletMobileDeepLink,
1767
1826
  i18n,
1827
+ isApplePayLimitReached,
1768
1828
  listPaymentIntentExecutions,
1769
1829
  pollDirectExecutions,
1770
1830
  queryExecutions,
1771
1831
  refreshIntegrationToken,
1832
+ requestCoinbaseApplePayLimitUpgrade,
1772
1833
  retrievePaymentIntent,
1773
1834
  revokeIntegrationToken,
1774
1835
  sendHypercoreTransaction,
package/dist/index.mjs CHANGED
@@ -1423,6 +1423,59 @@ async function getOnrampVerificationSession(id, clientSecret, publishableKey) {
1423
1423
  });
1424
1424
  return jsonOrThrow(response, "Failed to fetch verification session");
1425
1425
  }
1426
+ function isApplePayLimitReached(response) {
1427
+ return response.limits.some((l) => l.remaining === "0");
1428
+ }
1429
+ function getApplePayLimitUpgradeStatus(response) {
1430
+ const opt = response.limit_upgrade_options?.[0];
1431
+ if (!opt || typeof opt.status !== "string") return null;
1432
+ return opt.status;
1433
+ }
1434
+ async function getCoinbaseApplePayLimits(phone, publishableKey, signal) {
1435
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1436
+ validatePublishableKey(pk);
1437
+ const response = await fetch(
1438
+ `${API_BASE_URL}/v1/public/onramps/headless/coinbase/apple_pay/limits`,
1439
+ {
1440
+ method: "POST",
1441
+ headers: {
1442
+ accept: "application/json",
1443
+ "x-publishable-key": pk,
1444
+ "Content-Type": "application/json"
1445
+ },
1446
+ body: JSON.stringify({ phone }),
1447
+ signal
1448
+ }
1449
+ );
1450
+ const raw = await jsonOrThrow(response, "Failed to fetch Apple Pay limits");
1451
+ return {
1452
+ limits: raw.limits,
1453
+ limit_upgrade_options: raw.limit_upgrade_options,
1454
+ limit_reached: isApplePayLimitReached(raw),
1455
+ upgrade_status: getApplePayLimitUpgradeStatus(raw)
1456
+ };
1457
+ }
1458
+ async function requestCoinbaseApplePayLimitUpgrade(request, publishableKey, signal) {
1459
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1460
+ validatePublishableKey(pk);
1461
+ const response = await fetch(
1462
+ `${API_BASE_URL}/v1/public/onramps/headless/coinbase/apple_pay/limits/upgrade`,
1463
+ {
1464
+ method: "POST",
1465
+ headers: {
1466
+ accept: "application/json",
1467
+ "x-publishable-key": pk,
1468
+ "Content-Type": "application/json"
1469
+ },
1470
+ body: JSON.stringify(request),
1471
+ signal
1472
+ }
1473
+ );
1474
+ return jsonOrThrow(
1475
+ response,
1476
+ "Failed to request Apple Pay limit upgrade"
1477
+ );
1478
+ }
1426
1479
  async function createCoinbaseApplePaySession(request, onrampToken, publishableKey, signal) {
1427
1480
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
1428
1481
  validatePublishableKey(pk);
@@ -1621,11 +1674,13 @@ export {
1621
1674
  getAddressBalance,
1622
1675
  getAddressBalances,
1623
1676
  getApiBaseUrl,
1677
+ getApplePayLimitUpgradeStatus,
1624
1678
  getApplePayProviders,
1625
1679
  getBankTransferProviders,
1626
1680
  getCashAppLimits,
1627
1681
  getCashAppSessionStatus,
1628
1682
  getChainName,
1683
+ getCoinbaseApplePayLimits,
1629
1684
  getCoinbaseLegalAgreements,
1630
1685
  getDefaultOnrampToken,
1631
1686
  getDepositAddress,
@@ -1652,10 +1707,12 @@ export {
1652
1707
  getWalletByChainType,
1653
1708
  getWalletMobileDeepLink,
1654
1709
  i18n,
1710
+ isApplePayLimitReached,
1655
1711
  listPaymentIntentExecutions,
1656
1712
  pollDirectExecutions,
1657
1713
  queryExecutions,
1658
1714
  refreshIntegrationToken,
1715
+ requestCoinbaseApplePayLimitUpgrade,
1659
1716
  retrievePaymentIntent,
1660
1717
  revokeIntegrationToken,
1661
1718
  sendHypercoreTransaction,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unifold/core",
3
- "version": "0.1.68-beta.1",
3
+ "version": "0.1.68-beta.2",
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",