@unifold/core 0.1.73 → 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 +175 -6
- package/dist/index.d.ts +175 -6
- package/dist/index.js +133 -12
- package/dist/index.mjs +129 -12
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -369,7 +369,18 @@ interface OnrampQuote {
|
|
|
369
369
|
}
|
|
370
370
|
interface OnrampQuotesRequest {
|
|
371
371
|
country_code: string;
|
|
372
|
-
|
|
372
|
+
/**
|
|
373
|
+
* Fiat amount to spend, inclusive of provider fees. Mutually exclusive with
|
|
374
|
+
* `destination_amount` — provide exactly one.
|
|
375
|
+
*/
|
|
376
|
+
source_amount?: string;
|
|
377
|
+
/**
|
|
378
|
+
* Fixed crypto (destination) amount to receive, with provider fees added on
|
|
379
|
+
* top. Mutually exclusive with `source_amount` — provide exactly one. Only
|
|
380
|
+
* supported by providers that can quote by a fixed destination amount
|
|
381
|
+
* (unsupported providers are omitted from the results).
|
|
382
|
+
*/
|
|
383
|
+
destination_amount?: string;
|
|
373
384
|
source_currency: string;
|
|
374
385
|
destination_currency: string;
|
|
375
386
|
destination_network: string;
|
|
@@ -405,7 +416,11 @@ interface OnrampSessionRequest {
|
|
|
405
416
|
service_provider: string;
|
|
406
417
|
country_code: string;
|
|
407
418
|
source_currency: string;
|
|
408
|
-
|
|
419
|
+
/**
|
|
420
|
+
* Fiat amount to spend, inclusive of provider fees. Mutually exclusive with
|
|
421
|
+
* `destination_amount` — provide exactly one.
|
|
422
|
+
*/
|
|
423
|
+
source_amount?: string;
|
|
409
424
|
destination_currency: string;
|
|
410
425
|
destination_network: string;
|
|
411
426
|
wallet_address: string;
|
|
@@ -420,6 +435,13 @@ interface OnrampSessionRequest {
|
|
|
420
435
|
payment_method_type?: OnrampSessionPaymentMethodType;
|
|
421
436
|
/** @deprecated Use `payment_method_type` instead (same value). */
|
|
422
437
|
payment_method?: OnrampSessionPaymentMethodType;
|
|
438
|
+
/**
|
|
439
|
+
* Fixed crypto (destination) amount to receive, with provider fees added on
|
|
440
|
+
* top. Mutually exclusive with `source_amount` — provide exactly one. Only
|
|
441
|
+
* supported by providers that can quote by a fixed destination amount;
|
|
442
|
+
* otherwise the request is rejected.
|
|
443
|
+
*/
|
|
444
|
+
destination_amount?: string;
|
|
423
445
|
}
|
|
424
446
|
interface OnrampSessionResponse {
|
|
425
447
|
url: string;
|
|
@@ -552,6 +574,8 @@ interface DefaultTokenMetadata {
|
|
|
552
574
|
interface DefaultTokenResponse {
|
|
553
575
|
destination_network: string;
|
|
554
576
|
destination_currency: string;
|
|
577
|
+
/** Whether the requested destination token is a stablecoin. */
|
|
578
|
+
is_stablecoin: boolean;
|
|
555
579
|
destination_token_metadata: DefaultTokenMetadata;
|
|
556
580
|
estimated_processing_time: number | null;
|
|
557
581
|
}
|
|
@@ -563,6 +587,12 @@ interface DefaultTokenResponse {
|
|
|
563
587
|
declare function getDefaultOnrampToken(params: {
|
|
564
588
|
country_code?: string;
|
|
565
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;
|
|
566
596
|
token_address: string;
|
|
567
597
|
chain_id: string;
|
|
568
598
|
chain_type: string;
|
|
@@ -929,6 +959,15 @@ interface ExchangeProviderInfo {
|
|
|
929
959
|
enabled: boolean;
|
|
930
960
|
supported_networks: string[];
|
|
931
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;
|
|
932
971
|
}
|
|
933
972
|
interface ExchangeProvidersResponse {
|
|
934
973
|
data: ExchangeProviderInfo[];
|
|
@@ -958,6 +997,17 @@ interface CreateExchangeSessionRequest {
|
|
|
958
997
|
source_currency?: string;
|
|
959
998
|
source_amount?: string;
|
|
960
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;
|
|
961
1011
|
}
|
|
962
1012
|
interface CreateExchangeSessionResponse {
|
|
963
1013
|
url: string;
|
|
@@ -970,6 +1020,37 @@ interface CreateExchangeSessionResponse {
|
|
|
970
1020
|
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
971
1021
|
*/
|
|
972
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>;
|
|
973
1054
|
interface ExchangeSessionStartParams {
|
|
974
1055
|
service_provider: string;
|
|
975
1056
|
chain_type: string;
|
|
@@ -979,12 +1060,31 @@ interface ExchangeSessionStartParams {
|
|
|
979
1060
|
source_currency?: string;
|
|
980
1061
|
source_amount?: string;
|
|
981
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;
|
|
982
1070
|
}
|
|
983
1071
|
/**
|
|
984
1072
|
* Generate a URL for the exchanges/sessions/start endpoint that redirects to the exchange provider.
|
|
985
1073
|
* This avoids popup blockers in Safari by opening the URL directly via anchor tag or window.open().
|
|
986
1074
|
*/
|
|
987
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';
|
|
988
1088
|
interface IntegrationExchangeInfo {
|
|
989
1089
|
service_provider: string;
|
|
990
1090
|
service_provider_display_name: string;
|
|
@@ -992,17 +1092,57 @@ interface IntegrationExchangeInfo {
|
|
|
992
1092
|
icon_url: string;
|
|
993
1093
|
icon_urls: IconUrl[];
|
|
994
1094
|
enabled: boolean;
|
|
1095
|
+
connection_method?: IntegrationConnectionMethod;
|
|
995
1096
|
supported_networks: string[];
|
|
996
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;
|
|
997
1107
|
}
|
|
998
1108
|
interface IntegrationExchangesResponse {
|
|
999
1109
|
data: IntegrationExchangeInfo[];
|
|
1000
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>;
|
|
1001
1140
|
/**
|
|
1002
|
-
*
|
|
1003
|
-
*
|
|
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.
|
|
1004
1144
|
*/
|
|
1005
|
-
declare function
|
|
1145
|
+
declare function getIntegrationExchangeSessionStartUrl(request: IntegrationExchangeSessionStartParams, publishableKey: string): string;
|
|
1006
1146
|
interface StartIntegrationOAuthResult {
|
|
1007
1147
|
redirect_url: string;
|
|
1008
1148
|
state: string;
|
|
@@ -1061,6 +1201,35 @@ interface IntegrationFeeAmount {
|
|
|
1061
1201
|
amount: string;
|
|
1062
1202
|
currency: string;
|
|
1063
1203
|
}
|
|
1204
|
+
/**
|
|
1205
|
+
* Backend error_type values for integration (exchange) transfer failures, so the
|
|
1206
|
+
* SDK can branch on them instead of string-matching provider messages.
|
|
1207
|
+
*/
|
|
1208
|
+
type IntegrationTransferErrorType = 'integration_transfer_mfa_failed' | 'integration_transfer_confirm_failed' | 'integration_transfer_create_failed' | 'integration_transfer_intent_not_found' | 'integration_transfer_insufficient_balance' | 'integration_unsupported_provider' | (string & NonNullable<unknown>);
|
|
1209
|
+
/**
|
|
1210
|
+
* Extends `Error` so existing `catch` blocks that only read `.message` keep
|
|
1211
|
+
* working unchanged.
|
|
1212
|
+
*/
|
|
1213
|
+
declare class IntegrationTransferError extends Error {
|
|
1214
|
+
readonly statusCode: number;
|
|
1215
|
+
/** Unifold backend error_type (e.g. `integration_transfer_mfa_failed`) */
|
|
1216
|
+
readonly errorType?: IntegrationTransferErrorType | undefined;
|
|
1217
|
+
/**
|
|
1218
|
+
* The exchange's own message (from `details.message`), without the operation
|
|
1219
|
+
* prefix baked into `message` — e.g. Coinbase's "Two factor code validation
|
|
1220
|
+
* failed. Please try again."
|
|
1221
|
+
*/
|
|
1222
|
+
readonly detailMessage?: string | undefined;
|
|
1223
|
+
constructor(message: string, statusCode: number,
|
|
1224
|
+
/** Unifold backend error_type (e.g. `integration_transfer_mfa_failed`) */
|
|
1225
|
+
errorType?: IntegrationTransferErrorType | undefined,
|
|
1226
|
+
/**
|
|
1227
|
+
* The exchange's own message (from `details.message`), without the operation
|
|
1228
|
+
* prefix baked into `message` — e.g. Coinbase's "Two factor code validation
|
|
1229
|
+
* failed. Please try again."
|
|
1230
|
+
*/
|
|
1231
|
+
detailMessage?: string | undefined);
|
|
1232
|
+
}
|
|
1064
1233
|
interface CreateIntegrationTransferResult {
|
|
1065
1234
|
id: string;
|
|
1066
1235
|
status: string;
|
|
@@ -3100,4 +3269,4 @@ declare const i18n: {
|
|
|
3100
3269
|
};
|
|
3101
3270
|
type I18nStrings = typeof i18n;
|
|
3102
3271
|
|
|
3103
|
-
export { type AccountConnectionData, ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AddressVerification, type ApplePayLimitUpgradeStatus, type ApplePayProvider, type ApplePayProvidersResponse, type AuthenticateOAuthResult, type AutoSwapRequest, type AutoSwapResponse, type BankTransferConfig, type BankTransferProvider, type BankTransferProvidersResponse, type BlockedCountrySubdivision, type BuildHypercoreTransactionRequest, type BuildHypercoreTransactionResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type CashAppLimits, type CashAppSessionRequest, type CashAppSessionResponse, type CashAppSessionStatusResponse, type ChainType, type CheckoutEvent, CheckoutEventType, type CheckoutFlowFailedData, type CheckoutFlowStartedData, type CheckoutMethod, type CheckoutMethodSelectedData, type CheckoutPaymentIntent, type CheckoutPaymentIntentData, type CheckoutPaymentIntentSucceededEvent, type CoinbaseApplePayLimit, type CoinbaseApplePayLimitUpgradeOption, type CoinbaseApplePayLimitsResponse, type CoinbaseApplePaySessionResponse, type CoinbaseGooglePaySessionResponse, type CoinbaseLegalAgreement, type CoinbaseLegalAgreementsResponse, type CoinbaseWalletPayLimit, type CoinbaseWalletPayLimitUpgradeOption, type CoinbaseWalletPayLimitsResponse, type CoinbaseWalletPaySessionResponse, type ConfirmIntegrationTransferResult, type CreateCoinbaseApplePaySessionRequest, type CreateCoinbaseGooglePaySessionRequest, type CreateCoinbaseWalletPaySessionRequest, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type CreateIntegrationTransferParams, type CreateIntegrationTransferResult, type CreateOnrampVerificationSessionRequest, DETECTION_ARM_DELAY_MS, DETECTION_POLL_INTERVAL_MS, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddress, type DepositAddressParams, type DepositAddressResponse, DepositAddressValidationError, type DepositEvent, DepositEventType, type DepositFlowFailedData, type DepositFlowStartedData, type DepositLimitReachedData, type DepositMethod, type DepositMethodSelectedData, type DepositQuote, type DepositQuoteRequest, DepositSession, type DepositSessionConfig, type DepositSessionDestination, type DepositSessionError, type DepositSessionErrorCode, type DepositSessionEvent, type DepositSessionEventMap, DepositSessionEventType, type DepositSessionParams, type DepositSessionSnapshot, type DepositSessionStatus, DepositSessionWaitError, type DepositSessionWaitErrorCode, type DepositSessionWaitOptions, type DestinationToken, type DestinationTokenChain, type DirectExecution, type DirectExecutionFailedEvent, type DirectExecutionResponse, type DirectExecutionSucceededEvent, type EvmContractCall, type ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type ExternalWalletChainType, type ExternalWalletInfo, type ExternalWalletsResponse, type FeaturedToken, type FeaturedWallet, type FiatCurrenciesResponse, type FiatCurrency, type GetBankTransferProvidersOptions, type GetExchangesQuery, type GooglePayProvider, type GooglePayProvidersResponse, type HypercoreActivationRequest, type HypercoreActivationResponse, type I18nStrings, type IconUrl, IneligibilityReason, type IntegrationAccount, type IntegrationExchangeInfo, type IntegrationExchangesResponse, type IntegrationFeeAmount, type IntegrationHoldingsResponse, IntegrationProvider, type IpAddressResponse, LOOKBACK_MS, type ListExecutionsParams, type LockedQuoteLimits, type LockedQuotePreview, type LockedQuotePreviewRequest, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionCreatedData, type OnrampSessionCreatedEvent, type OnrampSessionPaymentMethod, type OnrampSessionPaymentMethodType, type OnrampSessionRequest, type OnrampSessionResponse, type OnrampVerificationFactor, type OnrampVerificationFactorStatus, type OnrampVerificationSession, type OnrampVerificationStatus, type OnrampVerificationTokenResponse, type PaymentIntent, type PaymentIntentDepositAddress, type PaymentIntentExecutionsResponse, type PaymentIntentStatus, type PaymentIntentType, type PaymentNetwork, type PollExecutionsRequest, type PollExecutionsResponse, type ProductType, type ProjectConfigResponse, type ProviderSelectedData, type PublicIncidentResponse, type QueryExecutionsRequest, type QueryExecutionsResponse, type RefreshIntegrationTokenResult, type RequestCoinbaseApplePayLimitUpgradeRequest, type RequestCoinbaseApplePayLimitUpgradeResponse, type RequestCoinbaseWalletPayLimitUpgradeRequest, type RequestCoinbaseWalletPayLimitUpgradeResponse, SCAN_NUDGE_INTERVAL_MS, SOLANA_USDC_ADDRESS, type SendHypercoreTransactionRequest, type SendHypercoreTransactionResponse, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SourceToken, type SourceTokenNetwork, type StartIntegrationOAuthResult, type StripeAccessTokenResponse, StripeApiResponseError, type StripeAuthIntentResponse, type StripeConfigResponse, type StripeConfirmRequest, type StripeConsumerWallet, type StripeCreateSessionRequest, type StripeCryptoCustomer, type StripeCustomerVerification, type StripeDefaultTokenResponse, type StripeListResponse, type StripeOnrampErrorType, type StripeOnrampSession, type StripeOnrampTransactionDetails, type StripePaymentToken, type StripeQuoteRequest, type StripeQuotesResponse, type StripeTransactionLimitEntry, type StripeTransactionLimitsResponse, type SupportedChain, type SupportedDepositTokensParams, type SupportedDepositTokensResponse, type SupportedDestinationTokensResponse, type SupportedSourceTokensQuery, type SupportedSourceTokensResponse, type SupportedToken, type TokenBalance, type TokenChain, type TokenChainIconUrl, type TokenChainsResponse, type TokenDisplayMetadata, type TokenIconUrl, type TokenInfo, type TokenMetadata, type TokenSelectedData, type TransferDefaultTokenParams, type TransferDefaultTokenResult, UnifoldClient, type UnifoldClientOptions, type UserIpInfo, type VerificationData, type VerifyAddressParams, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, type WalletConnectionData, type WalletMobileDeepLinkDepositAddress, type WalletMobileDeepLinkResponse, type WalletMobileDeepLinkWallet, type WalletPayLimitUpgradeStatus, type WalletPayMethod, type WalletPayProvider, type WalletPayProvidersResponse, type WalletSelectedData, type WithdrawDirectExecutionFailedEvent, type WithdrawDirectExecutionSucceededEvent, type WithdrawEvent, WithdrawEventType, type WithdrawFlowStartedData, authenticateIntegrationOAuth, buildHypercoreTransaction, buildSolanaTransaction, checkHypercoreActivation, confirmIntegrationTransfer, createCashAppSession, createCoinbaseApplePaySession, createCoinbaseGooglePaySession, createCoinbaseWalletPaySession, createDepositAddress, createExchangeSession, createIntegrationTransfer, createOnrampSession, createOnrampVerificationSession, createUnifoldClient, exchangeOnrampVerificationToken, formatStablecoinAmount, generateKSUID, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getApplePayLimitUpgradeStatus, getApplePayProviders, getBankTransferProviders, getCashAppLimits, getCashAppSessionStatus, getChainName, getCoinbaseApplePayLimits, getCoinbaseLegalAgreements, getCoinbaseWalletPayLimits, getDefaultOnrampToken, getDepositAddress, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getExternalWallets, getFiatCurrencies, getFiatExchangeRates, getGooglePayLimitUpgradeStatus, getGooglePayProviders, getIconUrl, getIconUrlWithCdn, getIntegrationExchanges, getIntegrationHoldings, getIntegrationTransferDefaultToken, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getOnrampVerificationSession, getPreferredIconUrl, getProjectConfig, getPublicIncident, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, getWalletMobileDeepLink, getWalletPayLimitUpgradeStatus, getWalletPayProviders, i18n, isApplePayLimitReached, isDepositAddressValidationError, isGooglePayLimitReached, isWalletPayLimitReached, listPaymentIntentExecutions, mapDirectExecution, mapWalletToDepositAddress, pollDirectExecutions, queryExecutions, refreshIntegrationToken, requestCoinbaseApplePayLimitUpgrade, requestCoinbaseWalletPayLimitUpgrade, retrievePaymentIntent, revokeIntegrationToken, sendHypercoreTransaction, sendOnrampVerificationOtp, sendSolanaTransaction, setApiConfig, startIntegrationOAuth, stripeConfirmSession, stripeCreateAuthIntent, stripeCreateSession, stripeExchangeTokens, stripeGetConfig, stripeGetCustomer, stripeGetDefaultToken, stripeGetQuotes, stripeGetSession, stripeGetTransactionLimits, stripeListPaymentTokens, stripeListWallets, stripeRefreshQuote, stripeRefreshToken, useUserIp, verifyOnrampVerificationOtp, verifyRecipientAddress };
|
|
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
|
@@ -369,7 +369,18 @@ interface OnrampQuote {
|
|
|
369
369
|
}
|
|
370
370
|
interface OnrampQuotesRequest {
|
|
371
371
|
country_code: string;
|
|
372
|
-
|
|
372
|
+
/**
|
|
373
|
+
* Fiat amount to spend, inclusive of provider fees. Mutually exclusive with
|
|
374
|
+
* `destination_amount` — provide exactly one.
|
|
375
|
+
*/
|
|
376
|
+
source_amount?: string;
|
|
377
|
+
/**
|
|
378
|
+
* Fixed crypto (destination) amount to receive, with provider fees added on
|
|
379
|
+
* top. Mutually exclusive with `source_amount` — provide exactly one. Only
|
|
380
|
+
* supported by providers that can quote by a fixed destination amount
|
|
381
|
+
* (unsupported providers are omitted from the results).
|
|
382
|
+
*/
|
|
383
|
+
destination_amount?: string;
|
|
373
384
|
source_currency: string;
|
|
374
385
|
destination_currency: string;
|
|
375
386
|
destination_network: string;
|
|
@@ -405,7 +416,11 @@ interface OnrampSessionRequest {
|
|
|
405
416
|
service_provider: string;
|
|
406
417
|
country_code: string;
|
|
407
418
|
source_currency: string;
|
|
408
|
-
|
|
419
|
+
/**
|
|
420
|
+
* Fiat amount to spend, inclusive of provider fees. Mutually exclusive with
|
|
421
|
+
* `destination_amount` — provide exactly one.
|
|
422
|
+
*/
|
|
423
|
+
source_amount?: string;
|
|
409
424
|
destination_currency: string;
|
|
410
425
|
destination_network: string;
|
|
411
426
|
wallet_address: string;
|
|
@@ -420,6 +435,13 @@ interface OnrampSessionRequest {
|
|
|
420
435
|
payment_method_type?: OnrampSessionPaymentMethodType;
|
|
421
436
|
/** @deprecated Use `payment_method_type` instead (same value). */
|
|
422
437
|
payment_method?: OnrampSessionPaymentMethodType;
|
|
438
|
+
/**
|
|
439
|
+
* Fixed crypto (destination) amount to receive, with provider fees added on
|
|
440
|
+
* top. Mutually exclusive with `source_amount` — provide exactly one. Only
|
|
441
|
+
* supported by providers that can quote by a fixed destination amount;
|
|
442
|
+
* otherwise the request is rejected.
|
|
443
|
+
*/
|
|
444
|
+
destination_amount?: string;
|
|
423
445
|
}
|
|
424
446
|
interface OnrampSessionResponse {
|
|
425
447
|
url: string;
|
|
@@ -552,6 +574,8 @@ interface DefaultTokenMetadata {
|
|
|
552
574
|
interface DefaultTokenResponse {
|
|
553
575
|
destination_network: string;
|
|
554
576
|
destination_currency: string;
|
|
577
|
+
/** Whether the requested destination token is a stablecoin. */
|
|
578
|
+
is_stablecoin: boolean;
|
|
555
579
|
destination_token_metadata: DefaultTokenMetadata;
|
|
556
580
|
estimated_processing_time: number | null;
|
|
557
581
|
}
|
|
@@ -563,6 +587,12 @@ interface DefaultTokenResponse {
|
|
|
563
587
|
declare function getDefaultOnrampToken(params: {
|
|
564
588
|
country_code?: string;
|
|
565
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;
|
|
566
596
|
token_address: string;
|
|
567
597
|
chain_id: string;
|
|
568
598
|
chain_type: string;
|
|
@@ -929,6 +959,15 @@ interface ExchangeProviderInfo {
|
|
|
929
959
|
enabled: boolean;
|
|
930
960
|
supported_networks: string[];
|
|
931
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;
|
|
932
971
|
}
|
|
933
972
|
interface ExchangeProvidersResponse {
|
|
934
973
|
data: ExchangeProviderInfo[];
|
|
@@ -958,6 +997,17 @@ interface CreateExchangeSessionRequest {
|
|
|
958
997
|
source_currency?: string;
|
|
959
998
|
source_amount?: string;
|
|
960
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;
|
|
961
1011
|
}
|
|
962
1012
|
interface CreateExchangeSessionResponse {
|
|
963
1013
|
url: string;
|
|
@@ -970,6 +1020,37 @@ interface CreateExchangeSessionResponse {
|
|
|
970
1020
|
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
971
1021
|
*/
|
|
972
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>;
|
|
973
1054
|
interface ExchangeSessionStartParams {
|
|
974
1055
|
service_provider: string;
|
|
975
1056
|
chain_type: string;
|
|
@@ -979,12 +1060,31 @@ interface ExchangeSessionStartParams {
|
|
|
979
1060
|
source_currency?: string;
|
|
980
1061
|
source_amount?: string;
|
|
981
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;
|
|
982
1070
|
}
|
|
983
1071
|
/**
|
|
984
1072
|
* Generate a URL for the exchanges/sessions/start endpoint that redirects to the exchange provider.
|
|
985
1073
|
* This avoids popup blockers in Safari by opening the URL directly via anchor tag or window.open().
|
|
986
1074
|
*/
|
|
987
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';
|
|
988
1088
|
interface IntegrationExchangeInfo {
|
|
989
1089
|
service_provider: string;
|
|
990
1090
|
service_provider_display_name: string;
|
|
@@ -992,17 +1092,57 @@ interface IntegrationExchangeInfo {
|
|
|
992
1092
|
icon_url: string;
|
|
993
1093
|
icon_urls: IconUrl[];
|
|
994
1094
|
enabled: boolean;
|
|
1095
|
+
connection_method?: IntegrationConnectionMethod;
|
|
995
1096
|
supported_networks: string[];
|
|
996
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;
|
|
997
1107
|
}
|
|
998
1108
|
interface IntegrationExchangesResponse {
|
|
999
1109
|
data: IntegrationExchangeInfo[];
|
|
1000
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>;
|
|
1001
1140
|
/**
|
|
1002
|
-
*
|
|
1003
|
-
*
|
|
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.
|
|
1004
1144
|
*/
|
|
1005
|
-
declare function
|
|
1145
|
+
declare function getIntegrationExchangeSessionStartUrl(request: IntegrationExchangeSessionStartParams, publishableKey: string): string;
|
|
1006
1146
|
interface StartIntegrationOAuthResult {
|
|
1007
1147
|
redirect_url: string;
|
|
1008
1148
|
state: string;
|
|
@@ -1061,6 +1201,35 @@ interface IntegrationFeeAmount {
|
|
|
1061
1201
|
amount: string;
|
|
1062
1202
|
currency: string;
|
|
1063
1203
|
}
|
|
1204
|
+
/**
|
|
1205
|
+
* Backend error_type values for integration (exchange) transfer failures, so the
|
|
1206
|
+
* SDK can branch on them instead of string-matching provider messages.
|
|
1207
|
+
*/
|
|
1208
|
+
type IntegrationTransferErrorType = 'integration_transfer_mfa_failed' | 'integration_transfer_confirm_failed' | 'integration_transfer_create_failed' | 'integration_transfer_intent_not_found' | 'integration_transfer_insufficient_balance' | 'integration_unsupported_provider' | (string & NonNullable<unknown>);
|
|
1209
|
+
/**
|
|
1210
|
+
* Extends `Error` so existing `catch` blocks that only read `.message` keep
|
|
1211
|
+
* working unchanged.
|
|
1212
|
+
*/
|
|
1213
|
+
declare class IntegrationTransferError extends Error {
|
|
1214
|
+
readonly statusCode: number;
|
|
1215
|
+
/** Unifold backend error_type (e.g. `integration_transfer_mfa_failed`) */
|
|
1216
|
+
readonly errorType?: IntegrationTransferErrorType | undefined;
|
|
1217
|
+
/**
|
|
1218
|
+
* The exchange's own message (from `details.message`), without the operation
|
|
1219
|
+
* prefix baked into `message` — e.g. Coinbase's "Two factor code validation
|
|
1220
|
+
* failed. Please try again."
|
|
1221
|
+
*/
|
|
1222
|
+
readonly detailMessage?: string | undefined;
|
|
1223
|
+
constructor(message: string, statusCode: number,
|
|
1224
|
+
/** Unifold backend error_type (e.g. `integration_transfer_mfa_failed`) */
|
|
1225
|
+
errorType?: IntegrationTransferErrorType | undefined,
|
|
1226
|
+
/**
|
|
1227
|
+
* The exchange's own message (from `details.message`), without the operation
|
|
1228
|
+
* prefix baked into `message` — e.g. Coinbase's "Two factor code validation
|
|
1229
|
+
* failed. Please try again."
|
|
1230
|
+
*/
|
|
1231
|
+
detailMessage?: string | undefined);
|
|
1232
|
+
}
|
|
1064
1233
|
interface CreateIntegrationTransferResult {
|
|
1065
1234
|
id: string;
|
|
1066
1235
|
status: string;
|
|
@@ -3100,4 +3269,4 @@ declare const i18n: {
|
|
|
3100
3269
|
};
|
|
3101
3270
|
type I18nStrings = typeof i18n;
|
|
3102
3271
|
|
|
3103
|
-
export { type AccountConnectionData, ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AddressVerification, type ApplePayLimitUpgradeStatus, type ApplePayProvider, type ApplePayProvidersResponse, type AuthenticateOAuthResult, type AutoSwapRequest, type AutoSwapResponse, type BankTransferConfig, type BankTransferProvider, type BankTransferProvidersResponse, type BlockedCountrySubdivision, type BuildHypercoreTransactionRequest, type BuildHypercoreTransactionResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type CashAppLimits, type CashAppSessionRequest, type CashAppSessionResponse, type CashAppSessionStatusResponse, type ChainType, type CheckoutEvent, CheckoutEventType, type CheckoutFlowFailedData, type CheckoutFlowStartedData, type CheckoutMethod, type CheckoutMethodSelectedData, type CheckoutPaymentIntent, type CheckoutPaymentIntentData, type CheckoutPaymentIntentSucceededEvent, type CoinbaseApplePayLimit, type CoinbaseApplePayLimitUpgradeOption, type CoinbaseApplePayLimitsResponse, type CoinbaseApplePaySessionResponse, type CoinbaseGooglePaySessionResponse, type CoinbaseLegalAgreement, type CoinbaseLegalAgreementsResponse, type CoinbaseWalletPayLimit, type CoinbaseWalletPayLimitUpgradeOption, type CoinbaseWalletPayLimitsResponse, type CoinbaseWalletPaySessionResponse, type ConfirmIntegrationTransferResult, type CreateCoinbaseApplePaySessionRequest, type CreateCoinbaseGooglePaySessionRequest, type CreateCoinbaseWalletPaySessionRequest, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type CreateIntegrationTransferParams, type CreateIntegrationTransferResult, type CreateOnrampVerificationSessionRequest, DETECTION_ARM_DELAY_MS, DETECTION_POLL_INTERVAL_MS, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddress, type DepositAddressParams, type DepositAddressResponse, DepositAddressValidationError, type DepositEvent, DepositEventType, type DepositFlowFailedData, type DepositFlowStartedData, type DepositLimitReachedData, type DepositMethod, type DepositMethodSelectedData, type DepositQuote, type DepositQuoteRequest, DepositSession, type DepositSessionConfig, type DepositSessionDestination, type DepositSessionError, type DepositSessionErrorCode, type DepositSessionEvent, type DepositSessionEventMap, DepositSessionEventType, type DepositSessionParams, type DepositSessionSnapshot, type DepositSessionStatus, DepositSessionWaitError, type DepositSessionWaitErrorCode, type DepositSessionWaitOptions, type DestinationToken, type DestinationTokenChain, type DirectExecution, type DirectExecutionFailedEvent, type DirectExecutionResponse, type DirectExecutionSucceededEvent, type EvmContractCall, type ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type ExternalWalletChainType, type ExternalWalletInfo, type ExternalWalletsResponse, type FeaturedToken, type FeaturedWallet, type FiatCurrenciesResponse, type FiatCurrency, type GetBankTransferProvidersOptions, type GetExchangesQuery, type GooglePayProvider, type GooglePayProvidersResponse, type HypercoreActivationRequest, type HypercoreActivationResponse, type I18nStrings, type IconUrl, IneligibilityReason, type IntegrationAccount, type IntegrationExchangeInfo, type IntegrationExchangesResponse, type IntegrationFeeAmount, type IntegrationHoldingsResponse, IntegrationProvider, type IpAddressResponse, LOOKBACK_MS, type ListExecutionsParams, type LockedQuoteLimits, type LockedQuotePreview, type LockedQuotePreviewRequest, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionCreatedData, type OnrampSessionCreatedEvent, type OnrampSessionPaymentMethod, type OnrampSessionPaymentMethodType, type OnrampSessionRequest, type OnrampSessionResponse, type OnrampVerificationFactor, type OnrampVerificationFactorStatus, type OnrampVerificationSession, type OnrampVerificationStatus, type OnrampVerificationTokenResponse, type PaymentIntent, type PaymentIntentDepositAddress, type PaymentIntentExecutionsResponse, type PaymentIntentStatus, type PaymentIntentType, type PaymentNetwork, type PollExecutionsRequest, type PollExecutionsResponse, type ProductType, type ProjectConfigResponse, type ProviderSelectedData, type PublicIncidentResponse, type QueryExecutionsRequest, type QueryExecutionsResponse, type RefreshIntegrationTokenResult, type RequestCoinbaseApplePayLimitUpgradeRequest, type RequestCoinbaseApplePayLimitUpgradeResponse, type RequestCoinbaseWalletPayLimitUpgradeRequest, type RequestCoinbaseWalletPayLimitUpgradeResponse, SCAN_NUDGE_INTERVAL_MS, SOLANA_USDC_ADDRESS, type SendHypercoreTransactionRequest, type SendHypercoreTransactionResponse, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SourceToken, type SourceTokenNetwork, type StartIntegrationOAuthResult, type StripeAccessTokenResponse, StripeApiResponseError, type StripeAuthIntentResponse, type StripeConfigResponse, type StripeConfirmRequest, type StripeConsumerWallet, type StripeCreateSessionRequest, type StripeCryptoCustomer, type StripeCustomerVerification, type StripeDefaultTokenResponse, type StripeListResponse, type StripeOnrampErrorType, type StripeOnrampSession, type StripeOnrampTransactionDetails, type StripePaymentToken, type StripeQuoteRequest, type StripeQuotesResponse, type StripeTransactionLimitEntry, type StripeTransactionLimitsResponse, type SupportedChain, type SupportedDepositTokensParams, type SupportedDepositTokensResponse, type SupportedDestinationTokensResponse, type SupportedSourceTokensQuery, type SupportedSourceTokensResponse, type SupportedToken, type TokenBalance, type TokenChain, type TokenChainIconUrl, type TokenChainsResponse, type TokenDisplayMetadata, type TokenIconUrl, type TokenInfo, type TokenMetadata, type TokenSelectedData, type TransferDefaultTokenParams, type TransferDefaultTokenResult, UnifoldClient, type UnifoldClientOptions, type UserIpInfo, type VerificationData, type VerifyAddressParams, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, type WalletConnectionData, type WalletMobileDeepLinkDepositAddress, type WalletMobileDeepLinkResponse, type WalletMobileDeepLinkWallet, type WalletPayLimitUpgradeStatus, type WalletPayMethod, type WalletPayProvider, type WalletPayProvidersResponse, type WalletSelectedData, type WithdrawDirectExecutionFailedEvent, type WithdrawDirectExecutionSucceededEvent, type WithdrawEvent, WithdrawEventType, type WithdrawFlowStartedData, authenticateIntegrationOAuth, buildHypercoreTransaction, buildSolanaTransaction, checkHypercoreActivation, confirmIntegrationTransfer, createCashAppSession, createCoinbaseApplePaySession, createCoinbaseGooglePaySession, createCoinbaseWalletPaySession, createDepositAddress, createExchangeSession, createIntegrationTransfer, createOnrampSession, createOnrampVerificationSession, createUnifoldClient, exchangeOnrampVerificationToken, formatStablecoinAmount, generateKSUID, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getApplePayLimitUpgradeStatus, getApplePayProviders, getBankTransferProviders, getCashAppLimits, getCashAppSessionStatus, getChainName, getCoinbaseApplePayLimits, getCoinbaseLegalAgreements, getCoinbaseWalletPayLimits, getDefaultOnrampToken, getDepositAddress, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getExternalWallets, getFiatCurrencies, getFiatExchangeRates, getGooglePayLimitUpgradeStatus, getGooglePayProviders, getIconUrl, getIconUrlWithCdn, getIntegrationExchanges, getIntegrationHoldings, getIntegrationTransferDefaultToken, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getOnrampVerificationSession, getPreferredIconUrl, getProjectConfig, getPublicIncident, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, getWalletMobileDeepLink, getWalletPayLimitUpgradeStatus, getWalletPayProviders, i18n, isApplePayLimitReached, isDepositAddressValidationError, isGooglePayLimitReached, isWalletPayLimitReached, listPaymentIntentExecutions, mapDirectExecution, mapWalletToDepositAddress, pollDirectExecutions, queryExecutions, refreshIntegrationToken, requestCoinbaseApplePayLimitUpgrade, requestCoinbaseWalletPayLimitUpgrade, retrievePaymentIntent, revokeIntegrationToken, sendHypercoreTransaction, sendOnrampVerificationOtp, sendSolanaTransaction, setApiConfig, startIntegrationOAuth, stripeConfirmSession, stripeCreateAuthIntent, stripeCreateSession, stripeExchangeTokens, stripeGetConfig, stripeGetCustomer, stripeGetDefaultToken, stripeGetQuotes, stripeGetSession, stripeGetTransactionLimits, stripeListPaymentTokens, stripeListWallets, stripeRefreshQuote, stripeRefreshToken, useUserIp, verifyOnrampVerificationOtp, verifyRecipientAddress };
|
|
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
|
@@ -34,6 +34,7 @@ __export(index_exports, {
|
|
|
34
34
|
ExecutionStatus: () => ExecutionStatus,
|
|
35
35
|
IneligibilityReason: () => IneligibilityReason,
|
|
36
36
|
IntegrationProvider: () => IntegrationProvider,
|
|
37
|
+
IntegrationTransferError: () => IntegrationTransferError,
|
|
37
38
|
LOOKBACK_MS: () => LOOKBACK_MS,
|
|
38
39
|
SCAN_NUDGE_INTERVAL_MS: () => SCAN_NUDGE_INTERVAL_MS,
|
|
39
40
|
SOLANA_USDC_ADDRESS: () => SOLANA_USDC_ADDRESS,
|
|
@@ -51,6 +52,7 @@ __export(index_exports, {
|
|
|
51
52
|
createCoinbaseWalletPaySession: () => createCoinbaseWalletPaySession,
|
|
52
53
|
createDepositAddress: () => createDepositAddress,
|
|
53
54
|
createExchangeSession: () => createExchangeSession,
|
|
55
|
+
createIntegrationExchangeSession: () => createIntegrationExchangeSession,
|
|
54
56
|
createIntegrationTransfer: () => createIntegrationTransfer,
|
|
55
57
|
createOnrampSession: () => createOnrampSession,
|
|
56
58
|
createOnrampVerificationSession: () => createOnrampVerificationSession,
|
|
@@ -83,12 +85,14 @@ __export(index_exports, {
|
|
|
83
85
|
getGooglePayProviders: () => getGooglePayProviders,
|
|
84
86
|
getIconUrl: () => getIconUrl,
|
|
85
87
|
getIconUrlWithCdn: () => getIconUrlWithCdn,
|
|
88
|
+
getIntegrationExchangeSessionStartUrl: () => getIntegrationExchangeSessionStartUrl,
|
|
86
89
|
getIntegrationExchanges: () => getIntegrationExchanges,
|
|
87
90
|
getIntegrationHoldings: () => getIntegrationHoldings,
|
|
88
91
|
getIntegrationTransferDefaultToken: () => getIntegrationTransferDefaultToken,
|
|
89
92
|
getIpAddress: () => getIpAddress,
|
|
90
93
|
getOnrampQuotes: () => getOnrampQuotes,
|
|
91
94
|
getOnrampSessionStartUrl: () => getOnrampSessionStartUrl,
|
|
95
|
+
getOnrampSessionStatus: () => getOnrampSessionStatus,
|
|
92
96
|
getOnrampVerificationSession: () => getOnrampVerificationSession,
|
|
93
97
|
getPreferredIconUrl: () => getPreferredIconUrl,
|
|
94
98
|
getProjectConfig: () => getProjectConfig,
|
|
@@ -180,7 +184,7 @@ function generatePrefixedKSUID(prefix) {
|
|
|
180
184
|
}
|
|
181
185
|
|
|
182
186
|
// src/lib/client-headers.ts
|
|
183
|
-
var SDK_VERSION = true ? "0.1.
|
|
187
|
+
var SDK_VERSION = true ? "0.1.75" : "0.0.0-dev";
|
|
184
188
|
var CLIENT_VERSION_HEADER = "x-unifold-client-version";
|
|
185
189
|
var CLIENT_USER_AGENT_HEADER = "x-unifold-client-user-agent";
|
|
186
190
|
function detectRuntime() {
|
|
@@ -648,7 +652,12 @@ function getOnrampSessionStartUrl(request, publishableKey) {
|
|
|
648
652
|
params.append("service_provider", request.service_provider);
|
|
649
653
|
params.append("country_code", request.country_code);
|
|
650
654
|
params.append("source_currency", request.source_currency);
|
|
651
|
-
|
|
655
|
+
if (request.source_amount) {
|
|
656
|
+
params.append("source_amount", request.source_amount);
|
|
657
|
+
}
|
|
658
|
+
if (request.destination_amount) {
|
|
659
|
+
params.append("destination_amount", request.destination_amount);
|
|
660
|
+
}
|
|
652
661
|
params.append("destination_currency", request.destination_currency);
|
|
653
662
|
params.append("destination_network", request.destination_network);
|
|
654
663
|
params.append("wallet_address", request.wallet_address);
|
|
@@ -673,6 +682,7 @@ async function getDefaultOnrampToken(params, publishableKey) {
|
|
|
673
682
|
const queryParams = new URLSearchParams();
|
|
674
683
|
if (params.country_code) queryParams.append("country_code", params.country_code);
|
|
675
684
|
if (params.subdivision_code) queryParams.append("subdivision_code", params.subdivision_code);
|
|
685
|
+
if (params.service_provider) queryParams.append("service_provider", params.service_provider);
|
|
676
686
|
queryParams.append("token_address", params.token_address);
|
|
677
687
|
queryParams.append("chain_id", params.chain_id);
|
|
678
688
|
queryParams.append("chain_type", params.chain_type);
|
|
@@ -937,6 +947,25 @@ async function createExchangeSession(request, publishableKey) {
|
|
|
937
947
|
}
|
|
938
948
|
return response.json();
|
|
939
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
|
+
}
|
|
940
969
|
function getExchangeSessionStartUrl(request, publishableKey) {
|
|
941
970
|
const params = new URLSearchParams();
|
|
942
971
|
params.append("publishable_key", publishableKey);
|
|
@@ -955,24 +984,95 @@ function getExchangeSessionStartUrl(request, publishableKey) {
|
|
|
955
984
|
if (request.source_amount) {
|
|
956
985
|
params.append("source_amount", request.source_amount);
|
|
957
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
|
+
}
|
|
958
993
|
params.append("external_id", request.external_id ?? generatePrefixedKSUID("exc"));
|
|
959
994
|
return `${API_BASE_URL}/v1/public/onramps/exchanges/sessions/start?${params.toString()}`;
|
|
960
995
|
}
|
|
961
|
-
async function getIntegrationExchanges(publishableKey) {
|
|
996
|
+
async function getIntegrationExchanges(publishableKey, query) {
|
|
962
997
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
963
998
|
validatePublishableKey(pk);
|
|
964
|
-
const
|
|
965
|
-
|
|
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",
|
|
966
1037
|
headers: {
|
|
967
1038
|
accept: "application/json",
|
|
968
|
-
"x-publishable-key": pk
|
|
969
|
-
|
|
1039
|
+
"x-publishable-key": pk,
|
|
1040
|
+
"Content-Type": "application/json"
|
|
1041
|
+
},
|
|
1042
|
+
body: JSON.stringify(request)
|
|
970
1043
|
});
|
|
971
1044
|
if (!response.ok) {
|
|
972
|
-
throw new Error(`Failed to
|
|
1045
|
+
throw new Error(`Failed to create integration exchange session: ${response.statusText}`);
|
|
973
1046
|
}
|
|
974
1047
|
return response.json();
|
|
975
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
|
+
}
|
|
976
1076
|
async function startIntegrationOAuth(publishableKey) {
|
|
977
1077
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
978
1078
|
validatePublishableKey(pk);
|
|
@@ -1061,6 +1161,25 @@ async function getIntegrationHoldings(provider, accessToken, publishableKey) {
|
|
|
1061
1161
|
}
|
|
1062
1162
|
return response.json();
|
|
1063
1163
|
}
|
|
1164
|
+
var IntegrationTransferError = class extends Error {
|
|
1165
|
+
constructor(message, statusCode, errorType, detailMessage) {
|
|
1166
|
+
super(message);
|
|
1167
|
+
this.statusCode = statusCode;
|
|
1168
|
+
this.errorType = errorType;
|
|
1169
|
+
this.detailMessage = detailMessage;
|
|
1170
|
+
this.name = "IntegrationTransferError";
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1173
|
+
async function throwIntegrationTransferError(prefix, response) {
|
|
1174
|
+
const body = await response.json().catch(() => ({}));
|
|
1175
|
+
const detailMessage = body.details?.message;
|
|
1176
|
+
throw new IntegrationTransferError(
|
|
1177
|
+
`${prefix}: ${detailMessage || body.message || response.statusText}`,
|
|
1178
|
+
response.status,
|
|
1179
|
+
body.error_type,
|
|
1180
|
+
detailMessage
|
|
1181
|
+
);
|
|
1182
|
+
}
|
|
1064
1183
|
async function createIntegrationTransfer(params, publishableKey) {
|
|
1065
1184
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
1066
1185
|
validatePublishableKey(pk);
|
|
@@ -1074,8 +1193,7 @@ async function createIntegrationTransfer(params, publishableKey) {
|
|
|
1074
1193
|
body: JSON.stringify(params)
|
|
1075
1194
|
});
|
|
1076
1195
|
if (!response.ok) {
|
|
1077
|
-
|
|
1078
|
-
throw new Error(`Failed to create transfer: ${err.message || response.statusText}`);
|
|
1196
|
+
await throwIntegrationTransferError("Failed to create transfer", response);
|
|
1079
1197
|
}
|
|
1080
1198
|
return response.json();
|
|
1081
1199
|
}
|
|
@@ -1097,8 +1215,7 @@ async function confirmIntegrationTransfer(transferId, accessToken, mfaCode, publ
|
|
|
1097
1215
|
}
|
|
1098
1216
|
);
|
|
1099
1217
|
if (!response.ok) {
|
|
1100
|
-
|
|
1101
|
-
throw new Error(`Failed to confirm transfer: ${err.message || response.statusText}`);
|
|
1218
|
+
await throwIntegrationTransferError("Failed to confirm transfer", response);
|
|
1102
1219
|
}
|
|
1103
1220
|
return response.json();
|
|
1104
1221
|
}
|
|
@@ -2855,6 +2972,7 @@ var i18n = en_default;
|
|
|
2855
2972
|
ExecutionStatus,
|
|
2856
2973
|
IneligibilityReason,
|
|
2857
2974
|
IntegrationProvider,
|
|
2975
|
+
IntegrationTransferError,
|
|
2858
2976
|
LOOKBACK_MS,
|
|
2859
2977
|
SCAN_NUDGE_INTERVAL_MS,
|
|
2860
2978
|
SOLANA_USDC_ADDRESS,
|
|
@@ -2872,6 +2990,7 @@ var i18n = en_default;
|
|
|
2872
2990
|
createCoinbaseWalletPaySession,
|
|
2873
2991
|
createDepositAddress,
|
|
2874
2992
|
createExchangeSession,
|
|
2993
|
+
createIntegrationExchangeSession,
|
|
2875
2994
|
createIntegrationTransfer,
|
|
2876
2995
|
createOnrampSession,
|
|
2877
2996
|
createOnrampVerificationSession,
|
|
@@ -2904,12 +3023,14 @@ var i18n = en_default;
|
|
|
2904
3023
|
getGooglePayProviders,
|
|
2905
3024
|
getIconUrl,
|
|
2906
3025
|
getIconUrlWithCdn,
|
|
3026
|
+
getIntegrationExchangeSessionStartUrl,
|
|
2907
3027
|
getIntegrationExchanges,
|
|
2908
3028
|
getIntegrationHoldings,
|
|
2909
3029
|
getIntegrationTransferDefaultToken,
|
|
2910
3030
|
getIpAddress,
|
|
2911
3031
|
getOnrampQuotes,
|
|
2912
3032
|
getOnrampSessionStartUrl,
|
|
3033
|
+
getOnrampSessionStatus,
|
|
2913
3034
|
getOnrampVerificationSession,
|
|
2914
3035
|
getPreferredIconUrl,
|
|
2915
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() {
|
|
@@ -509,7 +509,12 @@ function getOnrampSessionStartUrl(request, publishableKey) {
|
|
|
509
509
|
params.append("service_provider", request.service_provider);
|
|
510
510
|
params.append("country_code", request.country_code);
|
|
511
511
|
params.append("source_currency", request.source_currency);
|
|
512
|
-
|
|
512
|
+
if (request.source_amount) {
|
|
513
|
+
params.append("source_amount", request.source_amount);
|
|
514
|
+
}
|
|
515
|
+
if (request.destination_amount) {
|
|
516
|
+
params.append("destination_amount", request.destination_amount);
|
|
517
|
+
}
|
|
513
518
|
params.append("destination_currency", request.destination_currency);
|
|
514
519
|
params.append("destination_network", request.destination_network);
|
|
515
520
|
params.append("wallet_address", request.wallet_address);
|
|
@@ -534,6 +539,7 @@ async function getDefaultOnrampToken(params, publishableKey) {
|
|
|
534
539
|
const queryParams = new URLSearchParams();
|
|
535
540
|
if (params.country_code) queryParams.append("country_code", params.country_code);
|
|
536
541
|
if (params.subdivision_code) queryParams.append("subdivision_code", params.subdivision_code);
|
|
542
|
+
if (params.service_provider) queryParams.append("service_provider", params.service_provider);
|
|
537
543
|
queryParams.append("token_address", params.token_address);
|
|
538
544
|
queryParams.append("chain_id", params.chain_id);
|
|
539
545
|
queryParams.append("chain_type", params.chain_type);
|
|
@@ -798,6 +804,25 @@ async function createExchangeSession(request, publishableKey) {
|
|
|
798
804
|
}
|
|
799
805
|
return response.json();
|
|
800
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
|
+
}
|
|
801
826
|
function getExchangeSessionStartUrl(request, publishableKey) {
|
|
802
827
|
const params = new URLSearchParams();
|
|
803
828
|
params.append("publishable_key", publishableKey);
|
|
@@ -816,24 +841,95 @@ function getExchangeSessionStartUrl(request, publishableKey) {
|
|
|
816
841
|
if (request.source_amount) {
|
|
817
842
|
params.append("source_amount", request.source_amount);
|
|
818
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
|
+
}
|
|
819
850
|
params.append("external_id", request.external_id ?? generatePrefixedKSUID("exc"));
|
|
820
851
|
return `${API_BASE_URL}/v1/public/onramps/exchanges/sessions/start?${params.toString()}`;
|
|
821
852
|
}
|
|
822
|
-
async function getIntegrationExchanges(publishableKey) {
|
|
853
|
+
async function getIntegrationExchanges(publishableKey, query) {
|
|
823
854
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
824
855
|
validatePublishableKey(pk);
|
|
825
|
-
const
|
|
826
|
-
|
|
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",
|
|
827
894
|
headers: {
|
|
828
895
|
accept: "application/json",
|
|
829
|
-
"x-publishable-key": pk
|
|
830
|
-
|
|
896
|
+
"x-publishable-key": pk,
|
|
897
|
+
"Content-Type": "application/json"
|
|
898
|
+
},
|
|
899
|
+
body: JSON.stringify(request)
|
|
831
900
|
});
|
|
832
901
|
if (!response.ok) {
|
|
833
|
-
throw new Error(`Failed to
|
|
902
|
+
throw new Error(`Failed to create integration exchange session: ${response.statusText}`);
|
|
834
903
|
}
|
|
835
904
|
return response.json();
|
|
836
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
|
+
}
|
|
837
933
|
async function startIntegrationOAuth(publishableKey) {
|
|
838
934
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
839
935
|
validatePublishableKey(pk);
|
|
@@ -922,6 +1018,25 @@ async function getIntegrationHoldings(provider, accessToken, publishableKey) {
|
|
|
922
1018
|
}
|
|
923
1019
|
return response.json();
|
|
924
1020
|
}
|
|
1021
|
+
var IntegrationTransferError = class extends Error {
|
|
1022
|
+
constructor(message, statusCode, errorType, detailMessage) {
|
|
1023
|
+
super(message);
|
|
1024
|
+
this.statusCode = statusCode;
|
|
1025
|
+
this.errorType = errorType;
|
|
1026
|
+
this.detailMessage = detailMessage;
|
|
1027
|
+
this.name = "IntegrationTransferError";
|
|
1028
|
+
}
|
|
1029
|
+
};
|
|
1030
|
+
async function throwIntegrationTransferError(prefix, response) {
|
|
1031
|
+
const body = await response.json().catch(() => ({}));
|
|
1032
|
+
const detailMessage = body.details?.message;
|
|
1033
|
+
throw new IntegrationTransferError(
|
|
1034
|
+
`${prefix}: ${detailMessage || body.message || response.statusText}`,
|
|
1035
|
+
response.status,
|
|
1036
|
+
body.error_type,
|
|
1037
|
+
detailMessage
|
|
1038
|
+
);
|
|
1039
|
+
}
|
|
925
1040
|
async function createIntegrationTransfer(params, publishableKey) {
|
|
926
1041
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
927
1042
|
validatePublishableKey(pk);
|
|
@@ -935,8 +1050,7 @@ async function createIntegrationTransfer(params, publishableKey) {
|
|
|
935
1050
|
body: JSON.stringify(params)
|
|
936
1051
|
});
|
|
937
1052
|
if (!response.ok) {
|
|
938
|
-
|
|
939
|
-
throw new Error(`Failed to create transfer: ${err.message || response.statusText}`);
|
|
1053
|
+
await throwIntegrationTransferError("Failed to create transfer", response);
|
|
940
1054
|
}
|
|
941
1055
|
return response.json();
|
|
942
1056
|
}
|
|
@@ -958,8 +1072,7 @@ async function confirmIntegrationTransfer(transferId, accessToken, mfaCode, publ
|
|
|
958
1072
|
}
|
|
959
1073
|
);
|
|
960
1074
|
if (!response.ok) {
|
|
961
|
-
|
|
962
|
-
throw new Error(`Failed to confirm transfer: ${err.message || response.statusText}`);
|
|
1075
|
+
await throwIntegrationTransferError("Failed to confirm transfer", response);
|
|
963
1076
|
}
|
|
964
1077
|
return response.json();
|
|
965
1078
|
}
|
|
@@ -2715,6 +2828,7 @@ export {
|
|
|
2715
2828
|
ExecutionStatus,
|
|
2716
2829
|
IneligibilityReason,
|
|
2717
2830
|
IntegrationProvider,
|
|
2831
|
+
IntegrationTransferError,
|
|
2718
2832
|
LOOKBACK_MS,
|
|
2719
2833
|
SCAN_NUDGE_INTERVAL_MS,
|
|
2720
2834
|
SOLANA_USDC_ADDRESS,
|
|
@@ -2732,6 +2846,7 @@ export {
|
|
|
2732
2846
|
createCoinbaseWalletPaySession,
|
|
2733
2847
|
createDepositAddress,
|
|
2734
2848
|
createExchangeSession,
|
|
2849
|
+
createIntegrationExchangeSession,
|
|
2735
2850
|
createIntegrationTransfer,
|
|
2736
2851
|
createOnrampSession,
|
|
2737
2852
|
createOnrampVerificationSession,
|
|
@@ -2764,12 +2879,14 @@ export {
|
|
|
2764
2879
|
getGooglePayProviders,
|
|
2765
2880
|
getIconUrl,
|
|
2766
2881
|
getIconUrlWithCdn,
|
|
2882
|
+
getIntegrationExchangeSessionStartUrl,
|
|
2767
2883
|
getIntegrationExchanges,
|
|
2768
2884
|
getIntegrationHoldings,
|
|
2769
2885
|
getIntegrationTransferDefaultToken,
|
|
2770
2886
|
getIpAddress,
|
|
2771
2887
|
getOnrampQuotes,
|
|
2772
2888
|
getOnrampSessionStartUrl,
|
|
2889
|
+
getOnrampSessionStatus,
|
|
2773
2890
|
getOnrampVerificationSession,
|
|
2774
2891
|
getPreferredIconUrl,
|
|
2775
2892
|
getProjectConfig,
|