@unifold/core 0.1.74 → 0.1.75
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 +120 -4
- package/dist/index.d.ts +120 -4
- package/dist/index.js +104 -7
- package/dist/index.mjs +101 -7
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -587,6 +587,12 @@ interface DefaultTokenResponse {
|
|
|
587
587
|
declare function getDefaultOnrampToken(params: {
|
|
588
588
|
country_code?: string;
|
|
589
589
|
subdivision_code?: string;
|
|
590
|
+
/**
|
|
591
|
+
* Service provider the default token will be used with (e.g. binancepay).
|
|
592
|
+
* Reserved for provider-aware defaults — accepted but not used in
|
|
593
|
+
* resolution yet.
|
|
594
|
+
*/
|
|
595
|
+
service_provider?: string;
|
|
590
596
|
token_address: string;
|
|
591
597
|
chain_id: string;
|
|
592
598
|
chain_type: string;
|
|
@@ -953,6 +959,15 @@ interface ExchangeProviderInfo {
|
|
|
953
959
|
enabled: boolean;
|
|
954
960
|
supported_networks: string[];
|
|
955
961
|
supported_currencies: string[];
|
|
962
|
+
/**
|
|
963
|
+
* The exchange's own minimum order in USD, or null when it sets none.
|
|
964
|
+
*
|
|
965
|
+
* Not a deposit minimum: `/supported_deposit_tokens` carries that per chain,
|
|
966
|
+
* and the two are independent, so an amount screen gates on whichever is
|
|
967
|
+
* higher. Undefined against API deployments that predate the field, which
|
|
968
|
+
* reads the same as "no floor of its own".
|
|
969
|
+
*/
|
|
970
|
+
minimum_amount_usd?: number | null;
|
|
956
971
|
}
|
|
957
972
|
interface ExchangeProvidersResponse {
|
|
958
973
|
data: ExchangeProviderInfo[];
|
|
@@ -982,6 +997,17 @@ interface CreateExchangeSessionRequest {
|
|
|
982
997
|
source_currency?: string;
|
|
983
998
|
source_amount?: string;
|
|
984
999
|
external_id?: string;
|
|
1000
|
+
/**
|
|
1001
|
+
* ISO 3166-1 alpha-2 country code of the user. Recorded on the session, and
|
|
1002
|
+
* required by some redirect providers (e.g. Binance Pay via Meld).
|
|
1003
|
+
*/
|
|
1004
|
+
country_code?: string;
|
|
1005
|
+
/**
|
|
1006
|
+
* State/subdivision code (e.g. CA). Recorded on the session, and worth sending
|
|
1007
|
+
* whenever it is known: no exchange provider reports a subdivision back, so
|
|
1008
|
+
* this is the only way the session can carry one.
|
|
1009
|
+
*/
|
|
1010
|
+
subdivision_code?: string;
|
|
985
1011
|
}
|
|
986
1012
|
interface CreateExchangeSessionResponse {
|
|
987
1013
|
url: string;
|
|
@@ -994,6 +1020,37 @@ interface CreateExchangeSessionResponse {
|
|
|
994
1020
|
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
995
1021
|
*/
|
|
996
1022
|
declare function createExchangeSession(request: CreateExchangeSessionRequest, publishableKey?: string): Promise<CreateExchangeSessionResponse>;
|
|
1023
|
+
/**
|
|
1024
|
+
* Where the provider says an onramp session has got to.
|
|
1025
|
+
*
|
|
1026
|
+
* - `pending` — the provider has no transaction for this session yet (the
|
|
1027
|
+
* user hasn't paid, or hasn't finished paying).
|
|
1028
|
+
* - `processing` — payment taken, crypto on its way.
|
|
1029
|
+
* - `completed` — the provider has sent the crypto.
|
|
1030
|
+
* - `failed` — the payment or the delivery failed.
|
|
1031
|
+
* - `expired` — the session timed out before it was paid.
|
|
1032
|
+
* - `unknown` — we couldn't reach the provider. Not a verdict; retry.
|
|
1033
|
+
*/
|
|
1034
|
+
type OnrampSessionStatusValue = 'pending' | 'processing' | 'completed' | 'failed' | 'expired' | 'unknown';
|
|
1035
|
+
interface OnrampSessionStatusResponse {
|
|
1036
|
+
status: OnrampSessionStatusValue;
|
|
1037
|
+
/** Crypto delivered, once the provider reports it. */
|
|
1038
|
+
destination_amount?: string;
|
|
1039
|
+
/** Fiat charged, once the provider reports it. */
|
|
1040
|
+
source_amount?: string;
|
|
1041
|
+
source_currency?: string;
|
|
1042
|
+
transaction_hash?: string;
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* Read an onramp session's status from its provider, by the `external_id` the
|
|
1046
|
+
* session was created with. Polls transfer sessions rendered as a QR or
|
|
1047
|
+
* deeplink (Binance Pay) and device-wallet orders paid on another device.
|
|
1048
|
+
*
|
|
1049
|
+
* This is the only channel that reports a *payment* — the deposit poller sees
|
|
1050
|
+
* crypto arriving on-chain, which is a later and different event, and never
|
|
1051
|
+
* arrives at all if the payment failed.
|
|
1052
|
+
*/
|
|
1053
|
+
declare function getOnrampSessionStatus(externalId: string, publishableKey?: string, signal?: AbortSignal): Promise<OnrampSessionStatusResponse>;
|
|
997
1054
|
interface ExchangeSessionStartParams {
|
|
998
1055
|
service_provider: string;
|
|
999
1056
|
chain_type: string;
|
|
@@ -1003,12 +1060,31 @@ interface ExchangeSessionStartParams {
|
|
|
1003
1060
|
source_currency?: string;
|
|
1004
1061
|
source_amount?: string;
|
|
1005
1062
|
external_id?: string;
|
|
1063
|
+
/** ISO 3166-1 alpha-2 country code of the user. Recorded on the session. */
|
|
1064
|
+
country_code?: string;
|
|
1065
|
+
/**
|
|
1066
|
+
* State/subdivision code (e.g. CA). Recorded on the session, and the only
|
|
1067
|
+
* source for it — no exchange provider reports a subdivision back.
|
|
1068
|
+
*/
|
|
1069
|
+
subdivision_code?: string;
|
|
1006
1070
|
}
|
|
1007
1071
|
/**
|
|
1008
1072
|
* Generate a URL for the exchanges/sessions/start endpoint that redirects to the exchange provider.
|
|
1009
1073
|
* This avoids popup blockers in Safari by opening the URL directly via anchor tag or window.open().
|
|
1010
1074
|
*/
|
|
1011
1075
|
declare function getExchangeSessionStartUrl(request: ExchangeSessionStartParams, publishableKey: string): string;
|
|
1076
|
+
/**
|
|
1077
|
+
* How a Connect Exchange provider completes the transfer:
|
|
1078
|
+
* - 'oauth': full account connection (holdings/amount/confirm in-app)
|
|
1079
|
+
* - 'redirect': redirect/QR-style payment completed inside the exchange
|
|
1080
|
+
* (e.g. Binance Pay, or Coinbase in regions without OAuth). Named
|
|
1081
|
+
* 'redirect' — not 'link' — to avoid confusion with Stripe Link.
|
|
1082
|
+
*
|
|
1083
|
+
* The server resolves this per provider per request, so clients should branch
|
|
1084
|
+
* on this field rather than hardcoding provider names. Older API versions omit
|
|
1085
|
+
* the field; treat undefined as 'oauth'.
|
|
1086
|
+
*/
|
|
1087
|
+
type IntegrationConnectionMethod = 'oauth' | 'redirect';
|
|
1012
1088
|
interface IntegrationExchangeInfo {
|
|
1013
1089
|
service_provider: string;
|
|
1014
1090
|
service_provider_display_name: string;
|
|
@@ -1016,17 +1092,57 @@ interface IntegrationExchangeInfo {
|
|
|
1016
1092
|
icon_url: string;
|
|
1017
1093
|
icon_urls: IconUrl[];
|
|
1018
1094
|
enabled: boolean;
|
|
1095
|
+
connection_method?: IntegrationConnectionMethod;
|
|
1019
1096
|
supported_networks: string[];
|
|
1020
1097
|
supported_currencies: string[];
|
|
1098
|
+
/**
|
|
1099
|
+
* The exchange's own minimum order in USD, or null when it sets none.
|
|
1100
|
+
*
|
|
1101
|
+
* Not a deposit minimum: `/supported_deposit_tokens` carries that per chain,
|
|
1102
|
+
* and the two are independent, so an amount screen gates on whichever is
|
|
1103
|
+
* higher. Undefined against API deployments that predate the field, which
|
|
1104
|
+
* reads the same as "no floor of its own".
|
|
1105
|
+
*/
|
|
1106
|
+
minimum_amount_usd?: number | null;
|
|
1021
1107
|
}
|
|
1022
1108
|
interface IntegrationExchangesResponse {
|
|
1023
1109
|
data: IntegrationExchangeInfo[];
|
|
1024
1110
|
}
|
|
1111
|
+
interface GetIntegrationExchangesQuery {
|
|
1112
|
+
/**
|
|
1113
|
+
* ISO 3166-1 alpha-2 country code of the user. Lets the server apply
|
|
1114
|
+
* region-based connection method overrides (e.g. Coinbase redirect flow in
|
|
1115
|
+
* regions without OAuth).
|
|
1116
|
+
*/
|
|
1117
|
+
country_code?: string;
|
|
1118
|
+
/**
|
|
1119
|
+
* State/subdivision code of the user (e.g. CA). Reserved for state-level
|
|
1120
|
+
* connection-method/enablement control server-side.
|
|
1121
|
+
*/
|
|
1122
|
+
subdivision_code?: string;
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* Get the exchanges available from the Connect Exchange entrypoint
|
|
1126
|
+
* (Coinbase, Binance, Kraken, etc.).
|
|
1127
|
+
* Returns provider info with icons, enabled status, connection_method
|
|
1128
|
+
* ('oauth' or 'redirect'), and supported networks/currencies.
|
|
1129
|
+
*/
|
|
1130
|
+
declare function getIntegrationExchanges(publishableKey?: string, query?: GetIntegrationExchangesQuery): Promise<IntegrationExchangesResponse>;
|
|
1131
|
+
type CreateIntegrationExchangeSessionRequest = CreateExchangeSessionRequest;
|
|
1132
|
+
type CreateIntegrationExchangeSessionResponse = CreateExchangeSessionResponse;
|
|
1133
|
+
type IntegrationExchangeSessionStartParams = ExchangeSessionStartParams;
|
|
1134
|
+
/**
|
|
1135
|
+
* Create a redirect-based exchange payment session for a Connect Exchange
|
|
1136
|
+
* provider whose connection_method is 'redirect'.
|
|
1137
|
+
* Returns a URL that opens the exchange with the deposit address pre-filled.
|
|
1138
|
+
*/
|
|
1139
|
+
declare function createIntegrationExchangeSession(request: CreateIntegrationExchangeSessionRequest, publishableKey?: string): Promise<CreateIntegrationExchangeSessionResponse>;
|
|
1025
1140
|
/**
|
|
1026
|
-
*
|
|
1027
|
-
*
|
|
1141
|
+
* Generate a URL for the integrations exchanges/sessions/start endpoint that
|
|
1142
|
+
* redirects (302) to the exchange provider. Opening this URL directly via
|
|
1143
|
+
* anchor tag or window.open() avoids popup blockers in Safari.
|
|
1028
1144
|
*/
|
|
1029
|
-
declare function
|
|
1145
|
+
declare function getIntegrationExchangeSessionStartUrl(request: IntegrationExchangeSessionStartParams, publishableKey: string): string;
|
|
1030
1146
|
interface StartIntegrationOAuthResult {
|
|
1031
1147
|
redirect_url: string;
|
|
1032
1148
|
state: string;
|
|
@@ -3153,4 +3269,4 @@ declare const i18n: {
|
|
|
3153
3269
|
};
|
|
3154
3270
|
type I18nStrings = typeof i18n;
|
|
3155
3271
|
|
|
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 };
|
|
3272
|
+
export { type AccountConnectionData, ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AddressVerification, type ApplePayLimitUpgradeStatus, type ApplePayProvider, type ApplePayProvidersResponse, type AuthenticateOAuthResult, type AutoSwapRequest, type AutoSwapResponse, type BankTransferConfig, type BankTransferProvider, type BankTransferProvidersResponse, type BlockedCountrySubdivision, type BuildHypercoreTransactionRequest, type BuildHypercoreTransactionResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type CashAppLimits, type CashAppSessionRequest, type CashAppSessionResponse, type CashAppSessionStatusResponse, type ChainType, type CheckoutEvent, CheckoutEventType, type CheckoutFlowFailedData, type CheckoutFlowStartedData, type CheckoutMethod, type CheckoutMethodSelectedData, type CheckoutPaymentIntent, type CheckoutPaymentIntentData, type CheckoutPaymentIntentSucceededEvent, type CoinbaseApplePayLimit, type CoinbaseApplePayLimitUpgradeOption, type CoinbaseApplePayLimitsResponse, type CoinbaseApplePaySessionResponse, type CoinbaseGooglePaySessionResponse, type CoinbaseLegalAgreement, type CoinbaseLegalAgreementsResponse, type CoinbaseWalletPayLimit, type CoinbaseWalletPayLimitUpgradeOption, type CoinbaseWalletPayLimitsResponse, type CoinbaseWalletPaySessionResponse, type ConfirmIntegrationTransferResult, type CreateCoinbaseApplePaySessionRequest, type CreateCoinbaseGooglePaySessionRequest, type CreateCoinbaseWalletPaySessionRequest, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type CreateIntegrationExchangeSessionRequest, type CreateIntegrationExchangeSessionResponse, type CreateIntegrationTransferParams, type CreateIntegrationTransferResult, type CreateOnrampVerificationSessionRequest, DETECTION_ARM_DELAY_MS, DETECTION_POLL_INTERVAL_MS, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddress, type DepositAddressParams, type DepositAddressResponse, DepositAddressValidationError, type DepositEvent, DepositEventType, type DepositFlowFailedData, type DepositFlowStartedData, type DepositLimitReachedData, type DepositMethod, type DepositMethodSelectedData, type DepositQuote, type DepositQuoteRequest, DepositSession, type DepositSessionConfig, type DepositSessionDestination, type DepositSessionError, type DepositSessionErrorCode, type DepositSessionEvent, type DepositSessionEventMap, DepositSessionEventType, type DepositSessionParams, type DepositSessionSnapshot, type DepositSessionStatus, DepositSessionWaitError, type DepositSessionWaitErrorCode, type DepositSessionWaitOptions, type DestinationToken, type DestinationTokenChain, type DirectExecution, type DirectExecutionFailedEvent, type DirectExecutionResponse, type DirectExecutionSucceededEvent, type EvmContractCall, type ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type ExternalWalletChainType, type ExternalWalletInfo, type ExternalWalletsResponse, type FeaturedToken, type FeaturedWallet, type FiatCurrenciesResponse, type FiatCurrency, type GetBankTransferProvidersOptions, type GetExchangesQuery, type GetIntegrationExchangesQuery, type GooglePayProvider, type GooglePayProvidersResponse, type HypercoreActivationRequest, type HypercoreActivationResponse, type I18nStrings, type IconUrl, IneligibilityReason, type IntegrationAccount, type IntegrationConnectionMethod, type IntegrationExchangeInfo, type IntegrationExchangeSessionStartParams, type IntegrationExchangesResponse, type IntegrationFeeAmount, type IntegrationHoldingsResponse, IntegrationProvider, IntegrationTransferError, type IntegrationTransferErrorType, type IpAddressResponse, LOOKBACK_MS, type ListExecutionsParams, type LockedQuoteLimits, type LockedQuotePreview, type LockedQuotePreviewRequest, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionCreatedData, type OnrampSessionCreatedEvent, type OnrampSessionPaymentMethod, type OnrampSessionPaymentMethodType, type OnrampSessionRequest, type OnrampSessionResponse, type OnrampSessionStatusResponse, type OnrampSessionStatusValue, 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, createIntegrationExchangeSession, createIntegrationTransfer, createOnrampSession, createOnrampVerificationSession, createUnifoldClient, exchangeOnrampVerificationToken, formatStablecoinAmount, generateKSUID, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getApplePayLimitUpgradeStatus, getApplePayProviders, getBankTransferProviders, getCashAppLimits, getCashAppSessionStatus, getChainName, getCoinbaseApplePayLimits, getCoinbaseLegalAgreements, getCoinbaseWalletPayLimits, getDefaultOnrampToken, getDepositAddress, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getExternalWallets, getFiatCurrencies, getFiatExchangeRates, getGooglePayLimitUpgradeStatus, getGooglePayProviders, getIconUrl, getIconUrlWithCdn, getIntegrationExchangeSessionStartUrl, getIntegrationExchanges, getIntegrationHoldings, getIntegrationTransferDefaultToken, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getOnrampSessionStatus, getOnrampVerificationSession, getPreferredIconUrl, getProjectConfig, getPublicIncident, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, getWalletMobileDeepLink, getWalletPayLimitUpgradeStatus, getWalletPayProviders, i18n, isApplePayLimitReached, isDepositAddressValidationError, isGooglePayLimitReached, isWalletPayLimitReached, listPaymentIntentExecutions, 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
|
@@ -587,6 +587,12 @@ interface DefaultTokenResponse {
|
|
|
587
587
|
declare function getDefaultOnrampToken(params: {
|
|
588
588
|
country_code?: string;
|
|
589
589
|
subdivision_code?: string;
|
|
590
|
+
/**
|
|
591
|
+
* Service provider the default token will be used with (e.g. binancepay).
|
|
592
|
+
* Reserved for provider-aware defaults — accepted but not used in
|
|
593
|
+
* resolution yet.
|
|
594
|
+
*/
|
|
595
|
+
service_provider?: string;
|
|
590
596
|
token_address: string;
|
|
591
597
|
chain_id: string;
|
|
592
598
|
chain_type: string;
|
|
@@ -953,6 +959,15 @@ interface ExchangeProviderInfo {
|
|
|
953
959
|
enabled: boolean;
|
|
954
960
|
supported_networks: string[];
|
|
955
961
|
supported_currencies: string[];
|
|
962
|
+
/**
|
|
963
|
+
* The exchange's own minimum order in USD, or null when it sets none.
|
|
964
|
+
*
|
|
965
|
+
* Not a deposit minimum: `/supported_deposit_tokens` carries that per chain,
|
|
966
|
+
* and the two are independent, so an amount screen gates on whichever is
|
|
967
|
+
* higher. Undefined against API deployments that predate the field, which
|
|
968
|
+
* reads the same as "no floor of its own".
|
|
969
|
+
*/
|
|
970
|
+
minimum_amount_usd?: number | null;
|
|
956
971
|
}
|
|
957
972
|
interface ExchangeProvidersResponse {
|
|
958
973
|
data: ExchangeProviderInfo[];
|
|
@@ -982,6 +997,17 @@ interface CreateExchangeSessionRequest {
|
|
|
982
997
|
source_currency?: string;
|
|
983
998
|
source_amount?: string;
|
|
984
999
|
external_id?: string;
|
|
1000
|
+
/**
|
|
1001
|
+
* ISO 3166-1 alpha-2 country code of the user. Recorded on the session, and
|
|
1002
|
+
* required by some redirect providers (e.g. Binance Pay via Meld).
|
|
1003
|
+
*/
|
|
1004
|
+
country_code?: string;
|
|
1005
|
+
/**
|
|
1006
|
+
* State/subdivision code (e.g. CA). Recorded on the session, and worth sending
|
|
1007
|
+
* whenever it is known: no exchange provider reports a subdivision back, so
|
|
1008
|
+
* this is the only way the session can carry one.
|
|
1009
|
+
*/
|
|
1010
|
+
subdivision_code?: string;
|
|
985
1011
|
}
|
|
986
1012
|
interface CreateExchangeSessionResponse {
|
|
987
1013
|
url: string;
|
|
@@ -994,6 +1020,37 @@ interface CreateExchangeSessionResponse {
|
|
|
994
1020
|
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
995
1021
|
*/
|
|
996
1022
|
declare function createExchangeSession(request: CreateExchangeSessionRequest, publishableKey?: string): Promise<CreateExchangeSessionResponse>;
|
|
1023
|
+
/**
|
|
1024
|
+
* Where the provider says an onramp session has got to.
|
|
1025
|
+
*
|
|
1026
|
+
* - `pending` — the provider has no transaction for this session yet (the
|
|
1027
|
+
* user hasn't paid, or hasn't finished paying).
|
|
1028
|
+
* - `processing` — payment taken, crypto on its way.
|
|
1029
|
+
* - `completed` — the provider has sent the crypto.
|
|
1030
|
+
* - `failed` — the payment or the delivery failed.
|
|
1031
|
+
* - `expired` — the session timed out before it was paid.
|
|
1032
|
+
* - `unknown` — we couldn't reach the provider. Not a verdict; retry.
|
|
1033
|
+
*/
|
|
1034
|
+
type OnrampSessionStatusValue = 'pending' | 'processing' | 'completed' | 'failed' | 'expired' | 'unknown';
|
|
1035
|
+
interface OnrampSessionStatusResponse {
|
|
1036
|
+
status: OnrampSessionStatusValue;
|
|
1037
|
+
/** Crypto delivered, once the provider reports it. */
|
|
1038
|
+
destination_amount?: string;
|
|
1039
|
+
/** Fiat charged, once the provider reports it. */
|
|
1040
|
+
source_amount?: string;
|
|
1041
|
+
source_currency?: string;
|
|
1042
|
+
transaction_hash?: string;
|
|
1043
|
+
}
|
|
1044
|
+
/**
|
|
1045
|
+
* Read an onramp session's status from its provider, by the `external_id` the
|
|
1046
|
+
* session was created with. Polls transfer sessions rendered as a QR or
|
|
1047
|
+
* deeplink (Binance Pay) and device-wallet orders paid on another device.
|
|
1048
|
+
*
|
|
1049
|
+
* This is the only channel that reports a *payment* — the deposit poller sees
|
|
1050
|
+
* crypto arriving on-chain, which is a later and different event, and never
|
|
1051
|
+
* arrives at all if the payment failed.
|
|
1052
|
+
*/
|
|
1053
|
+
declare function getOnrampSessionStatus(externalId: string, publishableKey?: string, signal?: AbortSignal): Promise<OnrampSessionStatusResponse>;
|
|
997
1054
|
interface ExchangeSessionStartParams {
|
|
998
1055
|
service_provider: string;
|
|
999
1056
|
chain_type: string;
|
|
@@ -1003,12 +1060,31 @@ interface ExchangeSessionStartParams {
|
|
|
1003
1060
|
source_currency?: string;
|
|
1004
1061
|
source_amount?: string;
|
|
1005
1062
|
external_id?: string;
|
|
1063
|
+
/** ISO 3166-1 alpha-2 country code of the user. Recorded on the session. */
|
|
1064
|
+
country_code?: string;
|
|
1065
|
+
/**
|
|
1066
|
+
* State/subdivision code (e.g. CA). Recorded on the session, and the only
|
|
1067
|
+
* source for it — no exchange provider reports a subdivision back.
|
|
1068
|
+
*/
|
|
1069
|
+
subdivision_code?: string;
|
|
1006
1070
|
}
|
|
1007
1071
|
/**
|
|
1008
1072
|
* Generate a URL for the exchanges/sessions/start endpoint that redirects to the exchange provider.
|
|
1009
1073
|
* This avoids popup blockers in Safari by opening the URL directly via anchor tag or window.open().
|
|
1010
1074
|
*/
|
|
1011
1075
|
declare function getExchangeSessionStartUrl(request: ExchangeSessionStartParams, publishableKey: string): string;
|
|
1076
|
+
/**
|
|
1077
|
+
* How a Connect Exchange provider completes the transfer:
|
|
1078
|
+
* - 'oauth': full account connection (holdings/amount/confirm in-app)
|
|
1079
|
+
* - 'redirect': redirect/QR-style payment completed inside the exchange
|
|
1080
|
+
* (e.g. Binance Pay, or Coinbase in regions without OAuth). Named
|
|
1081
|
+
* 'redirect' — not 'link' — to avoid confusion with Stripe Link.
|
|
1082
|
+
*
|
|
1083
|
+
* The server resolves this per provider per request, so clients should branch
|
|
1084
|
+
* on this field rather than hardcoding provider names. Older API versions omit
|
|
1085
|
+
* the field; treat undefined as 'oauth'.
|
|
1086
|
+
*/
|
|
1087
|
+
type IntegrationConnectionMethod = 'oauth' | 'redirect';
|
|
1012
1088
|
interface IntegrationExchangeInfo {
|
|
1013
1089
|
service_provider: string;
|
|
1014
1090
|
service_provider_display_name: string;
|
|
@@ -1016,17 +1092,57 @@ interface IntegrationExchangeInfo {
|
|
|
1016
1092
|
icon_url: string;
|
|
1017
1093
|
icon_urls: IconUrl[];
|
|
1018
1094
|
enabled: boolean;
|
|
1095
|
+
connection_method?: IntegrationConnectionMethod;
|
|
1019
1096
|
supported_networks: string[];
|
|
1020
1097
|
supported_currencies: string[];
|
|
1098
|
+
/**
|
|
1099
|
+
* The exchange's own minimum order in USD, or null when it sets none.
|
|
1100
|
+
*
|
|
1101
|
+
* Not a deposit minimum: `/supported_deposit_tokens` carries that per chain,
|
|
1102
|
+
* and the two are independent, so an amount screen gates on whichever is
|
|
1103
|
+
* higher. Undefined against API deployments that predate the field, which
|
|
1104
|
+
* reads the same as "no floor of its own".
|
|
1105
|
+
*/
|
|
1106
|
+
minimum_amount_usd?: number | null;
|
|
1021
1107
|
}
|
|
1022
1108
|
interface IntegrationExchangesResponse {
|
|
1023
1109
|
data: IntegrationExchangeInfo[];
|
|
1024
1110
|
}
|
|
1111
|
+
interface GetIntegrationExchangesQuery {
|
|
1112
|
+
/**
|
|
1113
|
+
* ISO 3166-1 alpha-2 country code of the user. Lets the server apply
|
|
1114
|
+
* region-based connection method overrides (e.g. Coinbase redirect flow in
|
|
1115
|
+
* regions without OAuth).
|
|
1116
|
+
*/
|
|
1117
|
+
country_code?: string;
|
|
1118
|
+
/**
|
|
1119
|
+
* State/subdivision code of the user (e.g. CA). Reserved for state-level
|
|
1120
|
+
* connection-method/enablement control server-side.
|
|
1121
|
+
*/
|
|
1122
|
+
subdivision_code?: string;
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* Get the exchanges available from the Connect Exchange entrypoint
|
|
1126
|
+
* (Coinbase, Binance, Kraken, etc.).
|
|
1127
|
+
* Returns provider info with icons, enabled status, connection_method
|
|
1128
|
+
* ('oauth' or 'redirect'), and supported networks/currencies.
|
|
1129
|
+
*/
|
|
1130
|
+
declare function getIntegrationExchanges(publishableKey?: string, query?: GetIntegrationExchangesQuery): Promise<IntegrationExchangesResponse>;
|
|
1131
|
+
type CreateIntegrationExchangeSessionRequest = CreateExchangeSessionRequest;
|
|
1132
|
+
type CreateIntegrationExchangeSessionResponse = CreateExchangeSessionResponse;
|
|
1133
|
+
type IntegrationExchangeSessionStartParams = ExchangeSessionStartParams;
|
|
1134
|
+
/**
|
|
1135
|
+
* Create a redirect-based exchange payment session for a Connect Exchange
|
|
1136
|
+
* provider whose connection_method is 'redirect'.
|
|
1137
|
+
* Returns a URL that opens the exchange with the deposit address pre-filled.
|
|
1138
|
+
*/
|
|
1139
|
+
declare function createIntegrationExchangeSession(request: CreateIntegrationExchangeSessionRequest, publishableKey?: string): Promise<CreateIntegrationExchangeSessionResponse>;
|
|
1025
1140
|
/**
|
|
1026
|
-
*
|
|
1027
|
-
*
|
|
1141
|
+
* Generate a URL for the integrations exchanges/sessions/start endpoint that
|
|
1142
|
+
* redirects (302) to the exchange provider. Opening this URL directly via
|
|
1143
|
+
* anchor tag or window.open() avoids popup blockers in Safari.
|
|
1028
1144
|
*/
|
|
1029
|
-
declare function
|
|
1145
|
+
declare function getIntegrationExchangeSessionStartUrl(request: IntegrationExchangeSessionStartParams, publishableKey: string): string;
|
|
1030
1146
|
interface StartIntegrationOAuthResult {
|
|
1031
1147
|
redirect_url: string;
|
|
1032
1148
|
state: string;
|
|
@@ -3153,4 +3269,4 @@ declare const i18n: {
|
|
|
3153
3269
|
};
|
|
3154
3270
|
type I18nStrings = typeof i18n;
|
|
3155
3271
|
|
|
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 };
|
|
3272
|
+
export { type AccountConnectionData, ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AddressVerification, type ApplePayLimitUpgradeStatus, type ApplePayProvider, type ApplePayProvidersResponse, type AuthenticateOAuthResult, type AutoSwapRequest, type AutoSwapResponse, type BankTransferConfig, type BankTransferProvider, type BankTransferProvidersResponse, type BlockedCountrySubdivision, type BuildHypercoreTransactionRequest, type BuildHypercoreTransactionResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type CashAppLimits, type CashAppSessionRequest, type CashAppSessionResponse, type CashAppSessionStatusResponse, type ChainType, type CheckoutEvent, CheckoutEventType, type CheckoutFlowFailedData, type CheckoutFlowStartedData, type CheckoutMethod, type CheckoutMethodSelectedData, type CheckoutPaymentIntent, type CheckoutPaymentIntentData, type CheckoutPaymentIntentSucceededEvent, type CoinbaseApplePayLimit, type CoinbaseApplePayLimitUpgradeOption, type CoinbaseApplePayLimitsResponse, type CoinbaseApplePaySessionResponse, type CoinbaseGooglePaySessionResponse, type CoinbaseLegalAgreement, type CoinbaseLegalAgreementsResponse, type CoinbaseWalletPayLimit, type CoinbaseWalletPayLimitUpgradeOption, type CoinbaseWalletPayLimitsResponse, type CoinbaseWalletPaySessionResponse, type ConfirmIntegrationTransferResult, type CreateCoinbaseApplePaySessionRequest, type CreateCoinbaseGooglePaySessionRequest, type CreateCoinbaseWalletPaySessionRequest, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type CreateIntegrationExchangeSessionRequest, type CreateIntegrationExchangeSessionResponse, type CreateIntegrationTransferParams, type CreateIntegrationTransferResult, type CreateOnrampVerificationSessionRequest, DETECTION_ARM_DELAY_MS, DETECTION_POLL_INTERVAL_MS, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddress, type DepositAddressParams, type DepositAddressResponse, DepositAddressValidationError, type DepositEvent, DepositEventType, type DepositFlowFailedData, type DepositFlowStartedData, type DepositLimitReachedData, type DepositMethod, type DepositMethodSelectedData, type DepositQuote, type DepositQuoteRequest, DepositSession, type DepositSessionConfig, type DepositSessionDestination, type DepositSessionError, type DepositSessionErrorCode, type DepositSessionEvent, type DepositSessionEventMap, DepositSessionEventType, type DepositSessionParams, type DepositSessionSnapshot, type DepositSessionStatus, DepositSessionWaitError, type DepositSessionWaitErrorCode, type DepositSessionWaitOptions, type DestinationToken, type DestinationTokenChain, type DirectExecution, type DirectExecutionFailedEvent, type DirectExecutionResponse, type DirectExecutionSucceededEvent, type EvmContractCall, type ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type ExternalWalletChainType, type ExternalWalletInfo, type ExternalWalletsResponse, type FeaturedToken, type FeaturedWallet, type FiatCurrenciesResponse, type FiatCurrency, type GetBankTransferProvidersOptions, type GetExchangesQuery, type GetIntegrationExchangesQuery, type GooglePayProvider, type GooglePayProvidersResponse, type HypercoreActivationRequest, type HypercoreActivationResponse, type I18nStrings, type IconUrl, IneligibilityReason, type IntegrationAccount, type IntegrationConnectionMethod, type IntegrationExchangeInfo, type IntegrationExchangeSessionStartParams, type IntegrationExchangesResponse, type IntegrationFeeAmount, type IntegrationHoldingsResponse, IntegrationProvider, IntegrationTransferError, type IntegrationTransferErrorType, type IpAddressResponse, LOOKBACK_MS, type ListExecutionsParams, type LockedQuoteLimits, type LockedQuotePreview, type LockedQuotePreviewRequest, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionCreatedData, type OnrampSessionCreatedEvent, type OnrampSessionPaymentMethod, type OnrampSessionPaymentMethodType, type OnrampSessionRequest, type OnrampSessionResponse, type OnrampSessionStatusResponse, type OnrampSessionStatusValue, 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, createIntegrationExchangeSession, createIntegrationTransfer, createOnrampSession, createOnrampVerificationSession, createUnifoldClient, exchangeOnrampVerificationToken, formatStablecoinAmount, generateKSUID, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getApplePayLimitUpgradeStatus, getApplePayProviders, getBankTransferProviders, getCashAppLimits, getCashAppSessionStatus, getChainName, getCoinbaseApplePayLimits, getCoinbaseLegalAgreements, getCoinbaseWalletPayLimits, getDefaultOnrampToken, getDepositAddress, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getExternalWallets, getFiatCurrencies, getFiatExchangeRates, getGooglePayLimitUpgradeStatus, getGooglePayProviders, getIconUrl, getIconUrlWithCdn, getIntegrationExchangeSessionStartUrl, getIntegrationExchanges, getIntegrationHoldings, getIntegrationTransferDefaultToken, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getOnrampSessionStatus, getOnrampVerificationSession, getPreferredIconUrl, getProjectConfig, getPublicIncident, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, getWalletMobileDeepLink, getWalletPayLimitUpgradeStatus, getWalletPayProviders, i18n, isApplePayLimitReached, isDepositAddressValidationError, isGooglePayLimitReached, isWalletPayLimitReached, listPaymentIntentExecutions, 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
|
@@ -52,6 +52,7 @@ __export(index_exports, {
|
|
|
52
52
|
createCoinbaseWalletPaySession: () => createCoinbaseWalletPaySession,
|
|
53
53
|
createDepositAddress: () => createDepositAddress,
|
|
54
54
|
createExchangeSession: () => createExchangeSession,
|
|
55
|
+
createIntegrationExchangeSession: () => createIntegrationExchangeSession,
|
|
55
56
|
createIntegrationTransfer: () => createIntegrationTransfer,
|
|
56
57
|
createOnrampSession: () => createOnrampSession,
|
|
57
58
|
createOnrampVerificationSession: () => createOnrampVerificationSession,
|
|
@@ -84,12 +85,14 @@ __export(index_exports, {
|
|
|
84
85
|
getGooglePayProviders: () => getGooglePayProviders,
|
|
85
86
|
getIconUrl: () => getIconUrl,
|
|
86
87
|
getIconUrlWithCdn: () => getIconUrlWithCdn,
|
|
88
|
+
getIntegrationExchangeSessionStartUrl: () => getIntegrationExchangeSessionStartUrl,
|
|
87
89
|
getIntegrationExchanges: () => getIntegrationExchanges,
|
|
88
90
|
getIntegrationHoldings: () => getIntegrationHoldings,
|
|
89
91
|
getIntegrationTransferDefaultToken: () => getIntegrationTransferDefaultToken,
|
|
90
92
|
getIpAddress: () => getIpAddress,
|
|
91
93
|
getOnrampQuotes: () => getOnrampQuotes,
|
|
92
94
|
getOnrampSessionStartUrl: () => getOnrampSessionStartUrl,
|
|
95
|
+
getOnrampSessionStatus: () => getOnrampSessionStatus,
|
|
93
96
|
getOnrampVerificationSession: () => getOnrampVerificationSession,
|
|
94
97
|
getPreferredIconUrl: () => getPreferredIconUrl,
|
|
95
98
|
getProjectConfig: () => getProjectConfig,
|
|
@@ -181,7 +184,7 @@ function generatePrefixedKSUID(prefix) {
|
|
|
181
184
|
}
|
|
182
185
|
|
|
183
186
|
// src/lib/client-headers.ts
|
|
184
|
-
var SDK_VERSION = true ? "0.1.
|
|
187
|
+
var SDK_VERSION = true ? "0.1.75" : "0.0.0-dev";
|
|
185
188
|
var CLIENT_VERSION_HEADER = "x-unifold-client-version";
|
|
186
189
|
var CLIENT_USER_AGENT_HEADER = "x-unifold-client-user-agent";
|
|
187
190
|
function detectRuntime() {
|
|
@@ -679,6 +682,7 @@ async function getDefaultOnrampToken(params, publishableKey) {
|
|
|
679
682
|
const queryParams = new URLSearchParams();
|
|
680
683
|
if (params.country_code) queryParams.append("country_code", params.country_code);
|
|
681
684
|
if (params.subdivision_code) queryParams.append("subdivision_code", params.subdivision_code);
|
|
685
|
+
if (params.service_provider) queryParams.append("service_provider", params.service_provider);
|
|
682
686
|
queryParams.append("token_address", params.token_address);
|
|
683
687
|
queryParams.append("chain_id", params.chain_id);
|
|
684
688
|
queryParams.append("chain_type", params.chain_type);
|
|
@@ -943,6 +947,25 @@ async function createExchangeSession(request, publishableKey) {
|
|
|
943
947
|
}
|
|
944
948
|
return response.json();
|
|
945
949
|
}
|
|
950
|
+
async function getOnrampSessionStatus(externalId, publishableKey, signal) {
|
|
951
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
952
|
+
validatePublishableKey(pk);
|
|
953
|
+
const response = await apiFetch(`${API_BASE_URL}/v1/public/onramps/sessions/status`, {
|
|
954
|
+
method: "POST",
|
|
955
|
+
headers: {
|
|
956
|
+
accept: "application/json",
|
|
957
|
+
"x-publishable-key": pk,
|
|
958
|
+
"Content-Type": "application/json"
|
|
959
|
+
},
|
|
960
|
+
body: JSON.stringify({ external_id: externalId }),
|
|
961
|
+
signal
|
|
962
|
+
});
|
|
963
|
+
if (!response.ok) {
|
|
964
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
965
|
+
throw new Error(`Failed to get session status: ${error.message || response.statusText}`);
|
|
966
|
+
}
|
|
967
|
+
return response.json();
|
|
968
|
+
}
|
|
946
969
|
function getExchangeSessionStartUrl(request, publishableKey) {
|
|
947
970
|
const params = new URLSearchParams();
|
|
948
971
|
params.append("publishable_key", publishableKey);
|
|
@@ -961,24 +984,95 @@ function getExchangeSessionStartUrl(request, publishableKey) {
|
|
|
961
984
|
if (request.source_amount) {
|
|
962
985
|
params.append("source_amount", request.source_amount);
|
|
963
986
|
}
|
|
987
|
+
if (request.country_code) {
|
|
988
|
+
params.append("country_code", request.country_code);
|
|
989
|
+
}
|
|
990
|
+
if (request.subdivision_code) {
|
|
991
|
+
params.append("subdivision_code", request.subdivision_code);
|
|
992
|
+
}
|
|
964
993
|
params.append("external_id", request.external_id ?? generatePrefixedKSUID("exc"));
|
|
965
994
|
return `${API_BASE_URL}/v1/public/onramps/exchanges/sessions/start?${params.toString()}`;
|
|
966
995
|
}
|
|
967
|
-
async function getIntegrationExchanges(publishableKey) {
|
|
996
|
+
async function getIntegrationExchanges(publishableKey, query) {
|
|
968
997
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
969
998
|
validatePublishableKey(pk);
|
|
970
|
-
const
|
|
971
|
-
|
|
999
|
+
const params = new URLSearchParams();
|
|
1000
|
+
if (query?.country_code) params.append("country_code", query.country_code);
|
|
1001
|
+
if (query?.subdivision_code) params.append("subdivision_code", query.subdivision_code);
|
|
1002
|
+
const queryString = params.toString() ? `?${params.toString()}` : "";
|
|
1003
|
+
const headers = {
|
|
1004
|
+
accept: "application/json",
|
|
1005
|
+
"x-publishable-key": pk
|
|
1006
|
+
};
|
|
1007
|
+
const response = await apiFetch(
|
|
1008
|
+
`${API_BASE_URL}/v1/public/integrations/exchanges${queryString}`,
|
|
1009
|
+
{
|
|
1010
|
+
method: "GET",
|
|
1011
|
+
headers
|
|
1012
|
+
}
|
|
1013
|
+
);
|
|
1014
|
+
if (response.ok) {
|
|
1015
|
+
return response.json();
|
|
1016
|
+
}
|
|
1017
|
+
if (response.status === 404) {
|
|
1018
|
+
const legacyResponse = await apiFetch(
|
|
1019
|
+
`${API_BASE_URL}/v1/public/integrations/oauth/exchanges${queryString}`,
|
|
1020
|
+
{
|
|
1021
|
+
method: "GET",
|
|
1022
|
+
headers
|
|
1023
|
+
}
|
|
1024
|
+
);
|
|
1025
|
+
if (legacyResponse.ok) {
|
|
1026
|
+
return legacyResponse.json();
|
|
1027
|
+
}
|
|
1028
|
+
throw new Error(`Failed to fetch integration exchanges: ${legacyResponse.statusText}`);
|
|
1029
|
+
}
|
|
1030
|
+
throw new Error(`Failed to fetch integration exchanges: ${response.statusText}`);
|
|
1031
|
+
}
|
|
1032
|
+
async function createIntegrationExchangeSession(request, publishableKey) {
|
|
1033
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
1034
|
+
validatePublishableKey(pk);
|
|
1035
|
+
const response = await apiFetch(`${API_BASE_URL}/v1/public/integrations/exchanges/sessions`, {
|
|
1036
|
+
method: "POST",
|
|
972
1037
|
headers: {
|
|
973
1038
|
accept: "application/json",
|
|
974
|
-
"x-publishable-key": pk
|
|
975
|
-
|
|
1039
|
+
"x-publishable-key": pk,
|
|
1040
|
+
"Content-Type": "application/json"
|
|
1041
|
+
},
|
|
1042
|
+
body: JSON.stringify(request)
|
|
976
1043
|
});
|
|
977
1044
|
if (!response.ok) {
|
|
978
|
-
throw new Error(`Failed to
|
|
1045
|
+
throw new Error(`Failed to create integration exchange session: ${response.statusText}`);
|
|
979
1046
|
}
|
|
980
1047
|
return response.json();
|
|
981
1048
|
}
|
|
1049
|
+
function getIntegrationExchangeSessionStartUrl(request, publishableKey) {
|
|
1050
|
+
const params = new URLSearchParams();
|
|
1051
|
+
params.append("publishable_key", publishableKey);
|
|
1052
|
+
params.append("service_provider", request.service_provider);
|
|
1053
|
+
params.append("chain_type", request.chain_type);
|
|
1054
|
+
params.append("address", request.address);
|
|
1055
|
+
if (request.preferred_destination_currency) {
|
|
1056
|
+
params.append("preferred_destination_currency", request.preferred_destination_currency);
|
|
1057
|
+
}
|
|
1058
|
+
if (request.preferred_destination_network) {
|
|
1059
|
+
params.append("preferred_destination_network", request.preferred_destination_network);
|
|
1060
|
+
}
|
|
1061
|
+
if (request.source_currency) {
|
|
1062
|
+
params.append("source_currency", request.source_currency);
|
|
1063
|
+
}
|
|
1064
|
+
if (request.source_amount) {
|
|
1065
|
+
params.append("source_amount", request.source_amount);
|
|
1066
|
+
}
|
|
1067
|
+
if (request.country_code) {
|
|
1068
|
+
params.append("country_code", request.country_code);
|
|
1069
|
+
}
|
|
1070
|
+
if (request.subdivision_code) {
|
|
1071
|
+
params.append("subdivision_code", request.subdivision_code);
|
|
1072
|
+
}
|
|
1073
|
+
params.append("external_id", request.external_id ?? generatePrefixedKSUID("exc"));
|
|
1074
|
+
return `${API_BASE_URL}/v1/public/integrations/exchanges/sessions/start?${params.toString()}`;
|
|
1075
|
+
}
|
|
982
1076
|
async function startIntegrationOAuth(publishableKey) {
|
|
983
1077
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
984
1078
|
validatePublishableKey(pk);
|
|
@@ -2896,6 +2990,7 @@ var i18n = en_default;
|
|
|
2896
2990
|
createCoinbaseWalletPaySession,
|
|
2897
2991
|
createDepositAddress,
|
|
2898
2992
|
createExchangeSession,
|
|
2993
|
+
createIntegrationExchangeSession,
|
|
2899
2994
|
createIntegrationTransfer,
|
|
2900
2995
|
createOnrampSession,
|
|
2901
2996
|
createOnrampVerificationSession,
|
|
@@ -2928,12 +3023,14 @@ var i18n = en_default;
|
|
|
2928
3023
|
getGooglePayProviders,
|
|
2929
3024
|
getIconUrl,
|
|
2930
3025
|
getIconUrlWithCdn,
|
|
3026
|
+
getIntegrationExchangeSessionStartUrl,
|
|
2931
3027
|
getIntegrationExchanges,
|
|
2932
3028
|
getIntegrationHoldings,
|
|
2933
3029
|
getIntegrationTransferDefaultToken,
|
|
2934
3030
|
getIpAddress,
|
|
2935
3031
|
getOnrampQuotes,
|
|
2936
3032
|
getOnrampSessionStartUrl,
|
|
3033
|
+
getOnrampSessionStatus,
|
|
2937
3034
|
getOnrampVerificationSession,
|
|
2938
3035
|
getPreferredIconUrl,
|
|
2939
3036
|
getProjectConfig,
|
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.
|
|
44
|
+
var SDK_VERSION = true ? "0.1.75" : "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() {
|
|
@@ -539,6 +539,7 @@ async function getDefaultOnrampToken(params, publishableKey) {
|
|
|
539
539
|
const queryParams = new URLSearchParams();
|
|
540
540
|
if (params.country_code) queryParams.append("country_code", params.country_code);
|
|
541
541
|
if (params.subdivision_code) queryParams.append("subdivision_code", params.subdivision_code);
|
|
542
|
+
if (params.service_provider) queryParams.append("service_provider", params.service_provider);
|
|
542
543
|
queryParams.append("token_address", params.token_address);
|
|
543
544
|
queryParams.append("chain_id", params.chain_id);
|
|
544
545
|
queryParams.append("chain_type", params.chain_type);
|
|
@@ -803,6 +804,25 @@ async function createExchangeSession(request, publishableKey) {
|
|
|
803
804
|
}
|
|
804
805
|
return response.json();
|
|
805
806
|
}
|
|
807
|
+
async function getOnrampSessionStatus(externalId, publishableKey, signal) {
|
|
808
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
809
|
+
validatePublishableKey(pk);
|
|
810
|
+
const response = await apiFetch(`${API_BASE_URL}/v1/public/onramps/sessions/status`, {
|
|
811
|
+
method: "POST",
|
|
812
|
+
headers: {
|
|
813
|
+
accept: "application/json",
|
|
814
|
+
"x-publishable-key": pk,
|
|
815
|
+
"Content-Type": "application/json"
|
|
816
|
+
},
|
|
817
|
+
body: JSON.stringify({ external_id: externalId }),
|
|
818
|
+
signal
|
|
819
|
+
});
|
|
820
|
+
if (!response.ok) {
|
|
821
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
822
|
+
throw new Error(`Failed to get session status: ${error.message || response.statusText}`);
|
|
823
|
+
}
|
|
824
|
+
return response.json();
|
|
825
|
+
}
|
|
806
826
|
function getExchangeSessionStartUrl(request, publishableKey) {
|
|
807
827
|
const params = new URLSearchParams();
|
|
808
828
|
params.append("publishable_key", publishableKey);
|
|
@@ -821,24 +841,95 @@ function getExchangeSessionStartUrl(request, publishableKey) {
|
|
|
821
841
|
if (request.source_amount) {
|
|
822
842
|
params.append("source_amount", request.source_amount);
|
|
823
843
|
}
|
|
844
|
+
if (request.country_code) {
|
|
845
|
+
params.append("country_code", request.country_code);
|
|
846
|
+
}
|
|
847
|
+
if (request.subdivision_code) {
|
|
848
|
+
params.append("subdivision_code", request.subdivision_code);
|
|
849
|
+
}
|
|
824
850
|
params.append("external_id", request.external_id ?? generatePrefixedKSUID("exc"));
|
|
825
851
|
return `${API_BASE_URL}/v1/public/onramps/exchanges/sessions/start?${params.toString()}`;
|
|
826
852
|
}
|
|
827
|
-
async function getIntegrationExchanges(publishableKey) {
|
|
853
|
+
async function getIntegrationExchanges(publishableKey, query) {
|
|
828
854
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
829
855
|
validatePublishableKey(pk);
|
|
830
|
-
const
|
|
831
|
-
|
|
856
|
+
const params = new URLSearchParams();
|
|
857
|
+
if (query?.country_code) params.append("country_code", query.country_code);
|
|
858
|
+
if (query?.subdivision_code) params.append("subdivision_code", query.subdivision_code);
|
|
859
|
+
const queryString = params.toString() ? `?${params.toString()}` : "";
|
|
860
|
+
const headers = {
|
|
861
|
+
accept: "application/json",
|
|
862
|
+
"x-publishable-key": pk
|
|
863
|
+
};
|
|
864
|
+
const response = await apiFetch(
|
|
865
|
+
`${API_BASE_URL}/v1/public/integrations/exchanges${queryString}`,
|
|
866
|
+
{
|
|
867
|
+
method: "GET",
|
|
868
|
+
headers
|
|
869
|
+
}
|
|
870
|
+
);
|
|
871
|
+
if (response.ok) {
|
|
872
|
+
return response.json();
|
|
873
|
+
}
|
|
874
|
+
if (response.status === 404) {
|
|
875
|
+
const legacyResponse = await apiFetch(
|
|
876
|
+
`${API_BASE_URL}/v1/public/integrations/oauth/exchanges${queryString}`,
|
|
877
|
+
{
|
|
878
|
+
method: "GET",
|
|
879
|
+
headers
|
|
880
|
+
}
|
|
881
|
+
);
|
|
882
|
+
if (legacyResponse.ok) {
|
|
883
|
+
return legacyResponse.json();
|
|
884
|
+
}
|
|
885
|
+
throw new Error(`Failed to fetch integration exchanges: ${legacyResponse.statusText}`);
|
|
886
|
+
}
|
|
887
|
+
throw new Error(`Failed to fetch integration exchanges: ${response.statusText}`);
|
|
888
|
+
}
|
|
889
|
+
async function createIntegrationExchangeSession(request, publishableKey) {
|
|
890
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
891
|
+
validatePublishableKey(pk);
|
|
892
|
+
const response = await apiFetch(`${API_BASE_URL}/v1/public/integrations/exchanges/sessions`, {
|
|
893
|
+
method: "POST",
|
|
832
894
|
headers: {
|
|
833
895
|
accept: "application/json",
|
|
834
|
-
"x-publishable-key": pk
|
|
835
|
-
|
|
896
|
+
"x-publishable-key": pk,
|
|
897
|
+
"Content-Type": "application/json"
|
|
898
|
+
},
|
|
899
|
+
body: JSON.stringify(request)
|
|
836
900
|
});
|
|
837
901
|
if (!response.ok) {
|
|
838
|
-
throw new Error(`Failed to
|
|
902
|
+
throw new Error(`Failed to create integration exchange session: ${response.statusText}`);
|
|
839
903
|
}
|
|
840
904
|
return response.json();
|
|
841
905
|
}
|
|
906
|
+
function getIntegrationExchangeSessionStartUrl(request, publishableKey) {
|
|
907
|
+
const params = new URLSearchParams();
|
|
908
|
+
params.append("publishable_key", publishableKey);
|
|
909
|
+
params.append("service_provider", request.service_provider);
|
|
910
|
+
params.append("chain_type", request.chain_type);
|
|
911
|
+
params.append("address", request.address);
|
|
912
|
+
if (request.preferred_destination_currency) {
|
|
913
|
+
params.append("preferred_destination_currency", request.preferred_destination_currency);
|
|
914
|
+
}
|
|
915
|
+
if (request.preferred_destination_network) {
|
|
916
|
+
params.append("preferred_destination_network", request.preferred_destination_network);
|
|
917
|
+
}
|
|
918
|
+
if (request.source_currency) {
|
|
919
|
+
params.append("source_currency", request.source_currency);
|
|
920
|
+
}
|
|
921
|
+
if (request.source_amount) {
|
|
922
|
+
params.append("source_amount", request.source_amount);
|
|
923
|
+
}
|
|
924
|
+
if (request.country_code) {
|
|
925
|
+
params.append("country_code", request.country_code);
|
|
926
|
+
}
|
|
927
|
+
if (request.subdivision_code) {
|
|
928
|
+
params.append("subdivision_code", request.subdivision_code);
|
|
929
|
+
}
|
|
930
|
+
params.append("external_id", request.external_id ?? generatePrefixedKSUID("exc"));
|
|
931
|
+
return `${API_BASE_URL}/v1/public/integrations/exchanges/sessions/start?${params.toString()}`;
|
|
932
|
+
}
|
|
842
933
|
async function startIntegrationOAuth(publishableKey) {
|
|
843
934
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
844
935
|
validatePublishableKey(pk);
|
|
@@ -2755,6 +2846,7 @@ export {
|
|
|
2755
2846
|
createCoinbaseWalletPaySession,
|
|
2756
2847
|
createDepositAddress,
|
|
2757
2848
|
createExchangeSession,
|
|
2849
|
+
createIntegrationExchangeSession,
|
|
2758
2850
|
createIntegrationTransfer,
|
|
2759
2851
|
createOnrampSession,
|
|
2760
2852
|
createOnrampVerificationSession,
|
|
@@ -2787,12 +2879,14 @@ export {
|
|
|
2787
2879
|
getGooglePayProviders,
|
|
2788
2880
|
getIconUrl,
|
|
2789
2881
|
getIconUrlWithCdn,
|
|
2882
|
+
getIntegrationExchangeSessionStartUrl,
|
|
2790
2883
|
getIntegrationExchanges,
|
|
2791
2884
|
getIntegrationHoldings,
|
|
2792
2885
|
getIntegrationTransferDefaultToken,
|
|
2793
2886
|
getIpAddress,
|
|
2794
2887
|
getOnrampQuotes,
|
|
2795
2888
|
getOnrampSessionStartUrl,
|
|
2889
|
+
getOnrampSessionStatus,
|
|
2796
2890
|
getOnrampVerificationSession,
|
|
2797
2891
|
getPreferredIconUrl,
|
|
2798
2892
|
getProjectConfig,
|