@unifold/core 0.1.66 → 0.1.68-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +192 -5
- package/dist/index.d.ts +192 -5
- package/dist/index.js +41 -0
- package/dist/index.mjs +38 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -111,7 +111,7 @@ interface IconUrl {
|
|
|
111
111
|
format: "svg" | "png";
|
|
112
112
|
}
|
|
113
113
|
type ProductType = "deposit" | "payment";
|
|
114
|
-
interface
|
|
114
|
+
interface DirectExecutionResponse {
|
|
115
115
|
id: string;
|
|
116
116
|
project_id: string;
|
|
117
117
|
user_id: string;
|
|
@@ -160,7 +160,7 @@ interface QueryExecutionsRequest {
|
|
|
160
160
|
action_type?: ActionType;
|
|
161
161
|
}
|
|
162
162
|
interface QueryExecutionsResponse {
|
|
163
|
-
data:
|
|
163
|
+
data: DirectExecutionResponse[];
|
|
164
164
|
total_count: number;
|
|
165
165
|
has_more: boolean;
|
|
166
166
|
}
|
|
@@ -340,6 +340,11 @@ interface OnrampQuotesResponse {
|
|
|
340
340
|
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
341
341
|
*/
|
|
342
342
|
declare function getOnrampQuotes(request: OnrampQuotesRequest, publishableKey?: string): Promise<OnrampQuotesResponse>;
|
|
343
|
+
/**
|
|
344
|
+
* Payment method for an onramp session. Defaults to `card` server-side.
|
|
345
|
+
* `sepa` routes the session through SEPA bank transfer (Swapped-only today).
|
|
346
|
+
*/
|
|
347
|
+
type OnrampSessionPaymentMethod = "card" | "sepa";
|
|
343
348
|
interface OnrampSessionRequest {
|
|
344
349
|
service_provider: string;
|
|
345
350
|
country_code: string;
|
|
@@ -352,6 +357,7 @@ interface OnrampSessionRequest {
|
|
|
352
357
|
redirect_url?: string;
|
|
353
358
|
external_id?: string;
|
|
354
359
|
email?: string;
|
|
360
|
+
payment_method?: OnrampSessionPaymentMethod;
|
|
355
361
|
}
|
|
356
362
|
interface OnrampSessionResponse {
|
|
357
363
|
url: string;
|
|
@@ -363,6 +369,51 @@ interface OnrampSessionResponse {
|
|
|
363
369
|
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
364
370
|
*/
|
|
365
371
|
declare function createOnrampSession(request: OnrampSessionRequest, publishableKey?: string): Promise<OnrampSessionResponse>;
|
|
372
|
+
/**
|
|
373
|
+
* A bank-transfer onramp provider returned by `getBankTransferProviders()`.
|
|
374
|
+
* Mirrors the shape of `IntegrationExchangeInfo` so SDK consumers can render
|
|
375
|
+
* exchanges + bank-transfer with the same UI primitives.
|
|
376
|
+
*/
|
|
377
|
+
interface BankTransferProvider {
|
|
378
|
+
service_provider: string;
|
|
379
|
+
service_provider_display_name: string;
|
|
380
|
+
description: string;
|
|
381
|
+
icon_url: string;
|
|
382
|
+
icon_urls: IconUrl[];
|
|
383
|
+
/**
|
|
384
|
+
* True when the provider is configured AND the rail supports the caller's
|
|
385
|
+
* country. Use this to decide whether the row is clickable.
|
|
386
|
+
*/
|
|
387
|
+
enabled: boolean;
|
|
388
|
+
/**
|
|
389
|
+
* Payment methods this provider supports. Forward one of these as
|
|
390
|
+
* `payment_method` when calling `/onramps/sessions`. Stored as an array so
|
|
391
|
+
* a single provider can light up multiple rails (e.g. SEPA + ACH) without
|
|
392
|
+
* forking the row.
|
|
393
|
+
*/
|
|
394
|
+
payment_methods: OnrampSessionPaymentMethod[];
|
|
395
|
+
/** All fiat currencies the rail accepts (e.g. ['eur', 'gbp']). */
|
|
396
|
+
supported_currencies: string[];
|
|
397
|
+
/**
|
|
398
|
+
* Preferred fiat for the caller's country, picked from `supported_currencies`.
|
|
399
|
+
* Forward as `source_currency` to `/onramps/sessions` — avoids the SDK
|
|
400
|
+
* re-implementing the country → fiat mapping.
|
|
401
|
+
*/
|
|
402
|
+
source_currency: string;
|
|
403
|
+
}
|
|
404
|
+
interface BankTransferProvidersResponse {
|
|
405
|
+
data: BankTransferProvider[];
|
|
406
|
+
}
|
|
407
|
+
interface GetBankTransferProvidersOptions {
|
|
408
|
+
/** ISO 3166-1 alpha-2 country code. Drives the `enabled` flag per provider. */
|
|
409
|
+
countryCode?: string;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Get supported bank-transfer onramp providers (SEPA via Swapped today).
|
|
413
|
+
* Each provider's `enabled` flag reflects project config + native integration
|
|
414
|
+
* availability + the caller-supplied country.
|
|
415
|
+
*/
|
|
416
|
+
declare function getBankTransferProviders(publishableKey?: string, options?: GetBankTransferProvidersOptions): Promise<BankTransferProvidersResponse>;
|
|
366
417
|
/**
|
|
367
418
|
* Generate a URL for the sessions/start endpoint that redirects to the onramp provider.
|
|
368
419
|
* This is useful for avoiding popup blockers by opening the URL directly via anchor tag.
|
|
@@ -484,10 +535,20 @@ interface ProjectConfigResponse {
|
|
|
484
535
|
deposit_tracker?: {
|
|
485
536
|
enabled: boolean;
|
|
486
537
|
};
|
|
538
|
+
bank_transfer?: BankTransferConfig;
|
|
487
539
|
hypercore_sponsorship?: {
|
|
488
540
|
enabled: boolean;
|
|
489
541
|
};
|
|
490
542
|
}
|
|
543
|
+
/**
|
|
544
|
+
* Bank-transfer project-level toggle returned by `/projects/config`.
|
|
545
|
+
*
|
|
546
|
+
* Only reflects the dashboard preference — the actual rails available for
|
|
547
|
+
* a given country live under `getBankTransferProviders()`.
|
|
548
|
+
*/
|
|
549
|
+
interface BankTransferConfig {
|
|
550
|
+
enabled: boolean;
|
|
551
|
+
}
|
|
491
552
|
/**
|
|
492
553
|
* Get project configuration
|
|
493
554
|
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
@@ -1032,8 +1093,10 @@ interface PaymentIntent {
|
|
|
1032
1093
|
*/
|
|
1033
1094
|
declare function retrievePaymentIntent(clientSecret: string, publishableKey?: string): Promise<PaymentIntent>;
|
|
1034
1095
|
interface PaymentIntentExecutionsResponse {
|
|
1035
|
-
data:
|
|
1096
|
+
data: DirectExecutionResponse[];
|
|
1036
1097
|
}
|
|
1098
|
+
/** @deprecated Use `DirectExecutionResponse` instead. */
|
|
1099
|
+
type AutoSwapResponse = DirectExecutionResponse;
|
|
1037
1100
|
/**
|
|
1038
1101
|
* List all executions (deposits/swaps) for a payment intent.
|
|
1039
1102
|
* Authenticates via client_secret and publishable key.
|
|
@@ -1287,15 +1350,93 @@ declare function generatePrefixedKSUID(prefix: string): string;
|
|
|
1287
1350
|
|
|
1288
1351
|
/** Event types emitted by the deposit flow, following `resource.action` convention */
|
|
1289
1352
|
declare enum DepositEventType {
|
|
1290
|
-
ONRAMP_SESSION_CREATED = "onramp_session.created"
|
|
1353
|
+
ONRAMP_SESSION_CREATED = "onramp_session.created",
|
|
1354
|
+
DIRECT_EXECUTION_SUCCEEDED = "direct_execution.succeeded"
|
|
1355
|
+
}
|
|
1356
|
+
/** Event types emitted by the withdraw flow, following `resource.action` convention */
|
|
1357
|
+
declare enum WithdrawEventType {
|
|
1358
|
+
DIRECT_EXECUTION_SUCCEEDED = "direct_execution.succeeded"
|
|
1291
1359
|
}
|
|
1360
|
+
/** Event types emitted by the checkout flow. */
|
|
1361
|
+
declare enum CheckoutEventType {
|
|
1362
|
+
PAYMENT_INTENT_SUCCEEDED = "payment_intent.succeeded"
|
|
1363
|
+
}
|
|
1364
|
+
/** Funding method used by a deposit flow. */
|
|
1365
|
+
type DepositMethod = "transfer" | "card" | "cashapp" | "pay_with_exchange" | "exchange_connect" | "wallet_connect";
|
|
1366
|
+
/** Funding method used by a checkout flow. */
|
|
1367
|
+
type CheckoutMethod = "transfer" | "wallet_connect";
|
|
1292
1368
|
/** `data.object` payload for {@link DepositEventType.ONRAMP_SESSION_CREATED} */
|
|
1293
1369
|
interface OnrampSessionCreatedData {
|
|
1294
1370
|
externalId: string;
|
|
1295
1371
|
}
|
|
1372
|
+
/**
|
|
1373
|
+
* Callback-facing payment intent object.
|
|
1374
|
+
* Mirrors the field-naming conventions used by {@link DirectExecution}
|
|
1375
|
+
* (camelCase, `BaseUnit` / `Usd` amount suffixes, `failureReason`, no currency
|
|
1376
|
+
* code or decimals — derive those from `*TokenAddress` if needed).
|
|
1377
|
+
*/
|
|
1378
|
+
interface CheckoutPaymentIntent {
|
|
1379
|
+
id: string;
|
|
1380
|
+
status: "succeeded";
|
|
1381
|
+
recipientAddress: string;
|
|
1382
|
+
destinationChainType: string;
|
|
1383
|
+
destinationChainId: string;
|
|
1384
|
+
destinationTokenAddress: string;
|
|
1385
|
+
destinationAmountBaseUnit: string;
|
|
1386
|
+
destinationAmountUsd: string;
|
|
1387
|
+
destinationAmountReceivedBaseUnit: string;
|
|
1388
|
+
destinationAmountReceivedUsd: string;
|
|
1389
|
+
sourceChainType: string | null;
|
|
1390
|
+
sourceChainId: string | null;
|
|
1391
|
+
sourceTokenAddress: string | null;
|
|
1392
|
+
sourceAmountBaseUnit: string | null;
|
|
1393
|
+
sourceAmountUsd: string | null;
|
|
1394
|
+
sourceAmountReceivedBaseUnit: string | null;
|
|
1395
|
+
sourceAmountReceivedUsd: string | null;
|
|
1396
|
+
/** Atomic payout (pool → recipient) hash. Locked-quote only; null until broadcast. */
|
|
1397
|
+
transactionHash: string | null;
|
|
1398
|
+
failureReason: string | null;
|
|
1399
|
+
}
|
|
1400
|
+
/**
|
|
1401
|
+
* `data.object` payload for {@link CheckoutEventType.PAYMENT_INTENT_SUCCEEDED}.
|
|
1402
|
+
* @deprecated Use {@link CheckoutPaymentIntent} — kept as an alias for back-compat.
|
|
1403
|
+
*/
|
|
1404
|
+
type CheckoutPaymentIntentData = CheckoutPaymentIntent;
|
|
1405
|
+
/**
|
|
1406
|
+
* Callback-facing direct execution object.
|
|
1407
|
+
* Intentionally separate from legacy `DirectExecutionResponse` naming.
|
|
1408
|
+
*/
|
|
1409
|
+
interface DirectExecution {
|
|
1410
|
+
id: string;
|
|
1411
|
+
transactionHash: string;
|
|
1412
|
+
recipientAddress: string;
|
|
1413
|
+
depositAddress?: string;
|
|
1414
|
+
sourceChainType: string;
|
|
1415
|
+
sourceChainId: string;
|
|
1416
|
+
sourceTokenAddress: string;
|
|
1417
|
+
destinationChainType: string;
|
|
1418
|
+
destinationChainId: string;
|
|
1419
|
+
destinationTokenAddress: string;
|
|
1420
|
+
sourceAmountBaseUnit: string;
|
|
1421
|
+
sourceAmountUsd?: string;
|
|
1422
|
+
destinationAmountBaseUnit: string;
|
|
1423
|
+
destinationAmountUsd?: string;
|
|
1424
|
+
destinationTransactionHashes: string[];
|
|
1425
|
+
status: ExecutionStatus;
|
|
1426
|
+
failureReason: string | null;
|
|
1427
|
+
}
|
|
1296
1428
|
/** Map from event type to its `data.object` shape */
|
|
1297
1429
|
interface DepositEventDataMap {
|
|
1298
1430
|
[DepositEventType.ONRAMP_SESSION_CREATED]: OnrampSessionCreatedData;
|
|
1431
|
+
[DepositEventType.DIRECT_EXECUTION_SUCCEEDED]: DirectExecution;
|
|
1432
|
+
}
|
|
1433
|
+
/** Map from event type to its `data.object` shape */
|
|
1434
|
+
interface WithdrawEventDataMap {
|
|
1435
|
+
[WithdrawEventType.DIRECT_EXECUTION_SUCCEEDED]: DirectExecution;
|
|
1436
|
+
}
|
|
1437
|
+
/** Map from event type to its `data.object` shape */
|
|
1438
|
+
interface CheckoutEventDataMap {
|
|
1439
|
+
[CheckoutEventType.PAYMENT_INTENT_SUCCEEDED]: CheckoutPaymentIntent;
|
|
1299
1440
|
}
|
|
1300
1441
|
/**
|
|
1301
1442
|
* Event envelope emitted by the deposit flow, inspired by the server-side
|
|
@@ -1309,15 +1450,61 @@ type DepositEvent = {
|
|
|
1309
1450
|
id: string;
|
|
1310
1451
|
type: K;
|
|
1311
1452
|
created: number;
|
|
1453
|
+
/**
|
|
1454
|
+
* Optional SDK-level context indicating which deposit method triggered
|
|
1455
|
+
* this event (e.g. transfer, wallet_connect).
|
|
1456
|
+
*/
|
|
1457
|
+
method?: DepositMethod;
|
|
1312
1458
|
data: {
|
|
1313
1459
|
object: DepositEventDataMap[K];
|
|
1314
1460
|
};
|
|
1315
1461
|
};
|
|
1316
1462
|
}[DepositEventType];
|
|
1463
|
+
/**
|
|
1464
|
+
* Event envelope emitted by the withdraw flow, matching the same top-level
|
|
1465
|
+
* shape as deposit events.
|
|
1466
|
+
*/
|
|
1467
|
+
type WithdrawEvent = {
|
|
1468
|
+
[K in WithdrawEventType]: {
|
|
1469
|
+
id: string;
|
|
1470
|
+
type: K;
|
|
1471
|
+
created: number;
|
|
1472
|
+
data: {
|
|
1473
|
+
object: WithdrawEventDataMap[K];
|
|
1474
|
+
};
|
|
1475
|
+
};
|
|
1476
|
+
}[WithdrawEventType];
|
|
1477
|
+
/** Event envelope emitted by the checkout flow. */
|
|
1478
|
+
type CheckoutEvent = {
|
|
1479
|
+
[K in CheckoutEventType]: {
|
|
1480
|
+
id: string;
|
|
1481
|
+
type: K;
|
|
1482
|
+
created: number;
|
|
1483
|
+
method?: CheckoutMethod;
|
|
1484
|
+
data: {
|
|
1485
|
+
object: CheckoutEventDataMap[K];
|
|
1486
|
+
};
|
|
1487
|
+
};
|
|
1488
|
+
}[CheckoutEventType];
|
|
1317
1489
|
/** Convenience type for a fully-typed `onramp_session.created` event */
|
|
1318
1490
|
type OnrampSessionCreatedEvent = Extract<DepositEvent, {
|
|
1319
1491
|
type: DepositEventType.ONRAMP_SESSION_CREATED;
|
|
1320
1492
|
}>;
|
|
1493
|
+
/**
|
|
1494
|
+
* Event envelope for direct execution success callbacks.
|
|
1495
|
+
* Mirrors the `data.object` schema used by {@link DepositEvent}.
|
|
1496
|
+
*/
|
|
1497
|
+
type DirectExecutionSucceededEvent = Extract<DepositEvent, {
|
|
1498
|
+
type: DepositEventType.DIRECT_EXECUTION_SUCCEEDED;
|
|
1499
|
+
}>;
|
|
1500
|
+
/** Convenience type for a fully-typed `direct_execution.succeeded` withdraw event */
|
|
1501
|
+
type WithdrawDirectExecutionSucceededEvent = Extract<WithdrawEvent, {
|
|
1502
|
+
type: WithdrawEventType.DIRECT_EXECUTION_SUCCEEDED;
|
|
1503
|
+
}>;
|
|
1504
|
+
/** Convenience type for a fully-typed `payment_intent.succeeded` checkout event */
|
|
1505
|
+
type CheckoutPaymentIntentSucceededEvent = Extract<CheckoutEvent, {
|
|
1506
|
+
type: CheckoutEventType.PAYMENT_INTENT_SUCCEEDED;
|
|
1507
|
+
}>;
|
|
1321
1508
|
|
|
1322
1509
|
/**
|
|
1323
1510
|
* User IP information interface
|
|
@@ -1441,4 +1628,4 @@ declare const i18n: {
|
|
|
1441
1628
|
};
|
|
1442
1629
|
type I18nStrings = typeof i18n;
|
|
1443
1630
|
|
|
1444
|
-
export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AuthenticateOAuthResult, type AutoSwapRequest, type AutoSwapResponse, type BlockedCountrySubdivision, type BuildHypercoreTransactionRequest, type BuildHypercoreTransactionResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type CashAppLimits, type CashAppSessionRequest, type CashAppSessionResponse, type CashAppSessionStatusResponse, type ChainType, type ConfirmIntegrationTransferResult, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type CreateIntegrationTransferParams, type CreateIntegrationTransferResult, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, type DepositEvent, DepositEventType, type DepositQuote, type DepositQuoteRequest, type DestinationToken, type DestinationTokenChain, type EvmContractCall, type ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type ExternalWalletChainType, type ExternalWalletInfo, type ExternalWalletsResponse, type FeaturedToken, type FeaturedWallet, type FiatCurrenciesResponse, type FiatCurrency, type GetExchangesQuery, type HypercoreActivationRequest, type HypercoreActivationResponse, type I18nStrings, type IconUrl, IneligibilityReason, type IntegrationAccount, type IntegrationExchangeInfo, type IntegrationExchangesResponse, type IntegrationFeeAmount, type IntegrationHoldingsResponse, IntegrationProvider, type IpAddressResponse, type LockedQuoteLimits, type LockedQuotePreview, type LockedQuotePreviewRequest, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionCreatedData, type OnrampSessionCreatedEvent, type OnrampSessionRequest, type OnrampSessionResponse, type PaymentIntent, type PaymentIntentDepositAddress, type PaymentIntentExecutionsResponse, type PaymentIntentStatus, type PaymentIntentType, type PaymentNetwork, type PollExecutionsRequest, type PollExecutionsResponse, type ProductType, type ProjectConfigResponse, type QueryExecutionsRequest, type QueryExecutionsResponse, type RefreshIntegrationTokenResult, SOLANA_USDC_ADDRESS, type SendHypercoreTransactionRequest, type SendHypercoreTransactionResponse, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SourceToken, type SourceTokenNetwork, type StartIntegrationOAuthResult, type SupportedChain, type SupportedDepositTokensResponse, type SupportedDestinationTokensResponse, type SupportedSourceTokensQuery, type SupportedSourceTokensResponse, type SupportedToken, type TokenBalance, type TokenChain, type TokenChainIconUrl, type TokenChainsResponse, type TokenIconUrl, type TokenInfo, type TokenMetadata, type TransferDefaultTokenParams, type TransferDefaultTokenResult, type UserIpInfo, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, type WalletMobileDeepLinkDepositAddress, type WalletMobileDeepLinkResponse, type WalletMobileDeepLinkWallet, authenticateIntegrationOAuth, buildHypercoreTransaction, buildSolanaTransaction, checkHypercoreActivation, confirmIntegrationTransfer, createCashAppSession, createDepositAddress, createExchangeSession, createIntegrationTransfer, createOnrampSession, formatStablecoinAmount, generateKSUID, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getCashAppLimits, getCashAppSessionStatus, getChainName, getDefaultOnrampToken, getDepositAddress, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getExternalWallets, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIntegrationExchanges, getIntegrationHoldings, getIntegrationTransferDefaultToken, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, getWalletMobileDeepLink, i18n, listPaymentIntentExecutions, pollDirectExecutions, queryExecutions, refreshIntegrationToken, retrievePaymentIntent, revokeIntegrationToken, sendHypercoreTransaction, sendSolanaTransaction, setApiConfig, startIntegrationOAuth, useUserIp, verifyRecipientAddress };
|
|
1631
|
+
export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AuthenticateOAuthResult, type AutoSwapRequest, type AutoSwapResponse, type BankTransferConfig, type BankTransferProvider, type BankTransferProvidersResponse, type BlockedCountrySubdivision, type BuildHypercoreTransactionRequest, type BuildHypercoreTransactionResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type CashAppLimits, type CashAppSessionRequest, type CashAppSessionResponse, type CashAppSessionStatusResponse, type ChainType, type CheckoutEvent, CheckoutEventType, type CheckoutMethod, type CheckoutPaymentIntent, type CheckoutPaymentIntentData, type CheckoutPaymentIntentSucceededEvent, type ConfirmIntegrationTransferResult, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type CreateIntegrationTransferParams, type CreateIntegrationTransferResult, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, type DepositEvent, DepositEventType, type DepositMethod, type DepositQuote, type DepositQuoteRequest, type DestinationToken, type DestinationTokenChain, type DirectExecution, type DirectExecutionResponse, type DirectExecutionSucceededEvent, type EvmContractCall, type ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type ExternalWalletChainType, type ExternalWalletInfo, type ExternalWalletsResponse, type FeaturedToken, type FeaturedWallet, type FiatCurrenciesResponse, type FiatCurrency, type GetBankTransferProvidersOptions, type GetExchangesQuery, type HypercoreActivationRequest, type HypercoreActivationResponse, type I18nStrings, type IconUrl, IneligibilityReason, type IntegrationAccount, type IntegrationExchangeInfo, type IntegrationExchangesResponse, type IntegrationFeeAmount, type IntegrationHoldingsResponse, IntegrationProvider, type IpAddressResponse, type LockedQuoteLimits, type LockedQuotePreview, type LockedQuotePreviewRequest, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionCreatedData, type OnrampSessionCreatedEvent, type OnrampSessionPaymentMethod, type OnrampSessionRequest, type OnrampSessionResponse, type PaymentIntent, type PaymentIntentDepositAddress, type PaymentIntentExecutionsResponse, type PaymentIntentStatus, type PaymentIntentType, type PaymentNetwork, type PollExecutionsRequest, type PollExecutionsResponse, type ProductType, type ProjectConfigResponse, type QueryExecutionsRequest, type QueryExecutionsResponse, type RefreshIntegrationTokenResult, SOLANA_USDC_ADDRESS, type SendHypercoreTransactionRequest, type SendHypercoreTransactionResponse, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SourceToken, type SourceTokenNetwork, type StartIntegrationOAuthResult, type SupportedChain, type SupportedDepositTokensResponse, type SupportedDestinationTokensResponse, type SupportedSourceTokensQuery, type SupportedSourceTokensResponse, type SupportedToken, type TokenBalance, type TokenChain, type TokenChainIconUrl, type TokenChainsResponse, type TokenIconUrl, type TokenInfo, type TokenMetadata, type TransferDefaultTokenParams, type TransferDefaultTokenResult, type UserIpInfo, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, type WalletMobileDeepLinkDepositAddress, type WalletMobileDeepLinkResponse, type WalletMobileDeepLinkWallet, type WithdrawDirectExecutionSucceededEvent, type WithdrawEvent, WithdrawEventType, authenticateIntegrationOAuth, buildHypercoreTransaction, buildSolanaTransaction, checkHypercoreActivation, confirmIntegrationTransfer, createCashAppSession, createDepositAddress, createExchangeSession, createIntegrationTransfer, createOnrampSession, formatStablecoinAmount, generateKSUID, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getBankTransferProviders, getCashAppLimits, getCashAppSessionStatus, getChainName, getDefaultOnrampToken, getDepositAddress, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getExternalWallets, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIntegrationExchanges, getIntegrationHoldings, getIntegrationTransferDefaultToken, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, getWalletMobileDeepLink, i18n, listPaymentIntentExecutions, pollDirectExecutions, queryExecutions, refreshIntegrationToken, retrievePaymentIntent, revokeIntegrationToken, sendHypercoreTransaction, sendSolanaTransaction, setApiConfig, startIntegrationOAuth, useUserIp, verifyRecipientAddress };
|
package/dist/index.d.ts
CHANGED
|
@@ -111,7 +111,7 @@ interface IconUrl {
|
|
|
111
111
|
format: "svg" | "png";
|
|
112
112
|
}
|
|
113
113
|
type ProductType = "deposit" | "payment";
|
|
114
|
-
interface
|
|
114
|
+
interface DirectExecutionResponse {
|
|
115
115
|
id: string;
|
|
116
116
|
project_id: string;
|
|
117
117
|
user_id: string;
|
|
@@ -160,7 +160,7 @@ interface QueryExecutionsRequest {
|
|
|
160
160
|
action_type?: ActionType;
|
|
161
161
|
}
|
|
162
162
|
interface QueryExecutionsResponse {
|
|
163
|
-
data:
|
|
163
|
+
data: DirectExecutionResponse[];
|
|
164
164
|
total_count: number;
|
|
165
165
|
has_more: boolean;
|
|
166
166
|
}
|
|
@@ -340,6 +340,11 @@ interface OnrampQuotesResponse {
|
|
|
340
340
|
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
341
341
|
*/
|
|
342
342
|
declare function getOnrampQuotes(request: OnrampQuotesRequest, publishableKey?: string): Promise<OnrampQuotesResponse>;
|
|
343
|
+
/**
|
|
344
|
+
* Payment method for an onramp session. Defaults to `card` server-side.
|
|
345
|
+
* `sepa` routes the session through SEPA bank transfer (Swapped-only today).
|
|
346
|
+
*/
|
|
347
|
+
type OnrampSessionPaymentMethod = "card" | "sepa";
|
|
343
348
|
interface OnrampSessionRequest {
|
|
344
349
|
service_provider: string;
|
|
345
350
|
country_code: string;
|
|
@@ -352,6 +357,7 @@ interface OnrampSessionRequest {
|
|
|
352
357
|
redirect_url?: string;
|
|
353
358
|
external_id?: string;
|
|
354
359
|
email?: string;
|
|
360
|
+
payment_method?: OnrampSessionPaymentMethod;
|
|
355
361
|
}
|
|
356
362
|
interface OnrampSessionResponse {
|
|
357
363
|
url: string;
|
|
@@ -363,6 +369,51 @@ interface OnrampSessionResponse {
|
|
|
363
369
|
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
364
370
|
*/
|
|
365
371
|
declare function createOnrampSession(request: OnrampSessionRequest, publishableKey?: string): Promise<OnrampSessionResponse>;
|
|
372
|
+
/**
|
|
373
|
+
* A bank-transfer onramp provider returned by `getBankTransferProviders()`.
|
|
374
|
+
* Mirrors the shape of `IntegrationExchangeInfo` so SDK consumers can render
|
|
375
|
+
* exchanges + bank-transfer with the same UI primitives.
|
|
376
|
+
*/
|
|
377
|
+
interface BankTransferProvider {
|
|
378
|
+
service_provider: string;
|
|
379
|
+
service_provider_display_name: string;
|
|
380
|
+
description: string;
|
|
381
|
+
icon_url: string;
|
|
382
|
+
icon_urls: IconUrl[];
|
|
383
|
+
/**
|
|
384
|
+
* True when the provider is configured AND the rail supports the caller's
|
|
385
|
+
* country. Use this to decide whether the row is clickable.
|
|
386
|
+
*/
|
|
387
|
+
enabled: boolean;
|
|
388
|
+
/**
|
|
389
|
+
* Payment methods this provider supports. Forward one of these as
|
|
390
|
+
* `payment_method` when calling `/onramps/sessions`. Stored as an array so
|
|
391
|
+
* a single provider can light up multiple rails (e.g. SEPA + ACH) without
|
|
392
|
+
* forking the row.
|
|
393
|
+
*/
|
|
394
|
+
payment_methods: OnrampSessionPaymentMethod[];
|
|
395
|
+
/** All fiat currencies the rail accepts (e.g. ['eur', 'gbp']). */
|
|
396
|
+
supported_currencies: string[];
|
|
397
|
+
/**
|
|
398
|
+
* Preferred fiat for the caller's country, picked from `supported_currencies`.
|
|
399
|
+
* Forward as `source_currency` to `/onramps/sessions` — avoids the SDK
|
|
400
|
+
* re-implementing the country → fiat mapping.
|
|
401
|
+
*/
|
|
402
|
+
source_currency: string;
|
|
403
|
+
}
|
|
404
|
+
interface BankTransferProvidersResponse {
|
|
405
|
+
data: BankTransferProvider[];
|
|
406
|
+
}
|
|
407
|
+
interface GetBankTransferProvidersOptions {
|
|
408
|
+
/** ISO 3166-1 alpha-2 country code. Drives the `enabled` flag per provider. */
|
|
409
|
+
countryCode?: string;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Get supported bank-transfer onramp providers (SEPA via Swapped today).
|
|
413
|
+
* Each provider's `enabled` flag reflects project config + native integration
|
|
414
|
+
* availability + the caller-supplied country.
|
|
415
|
+
*/
|
|
416
|
+
declare function getBankTransferProviders(publishableKey?: string, options?: GetBankTransferProvidersOptions): Promise<BankTransferProvidersResponse>;
|
|
366
417
|
/**
|
|
367
418
|
* Generate a URL for the sessions/start endpoint that redirects to the onramp provider.
|
|
368
419
|
* This is useful for avoiding popup blockers by opening the URL directly via anchor tag.
|
|
@@ -484,10 +535,20 @@ interface ProjectConfigResponse {
|
|
|
484
535
|
deposit_tracker?: {
|
|
485
536
|
enabled: boolean;
|
|
486
537
|
};
|
|
538
|
+
bank_transfer?: BankTransferConfig;
|
|
487
539
|
hypercore_sponsorship?: {
|
|
488
540
|
enabled: boolean;
|
|
489
541
|
};
|
|
490
542
|
}
|
|
543
|
+
/**
|
|
544
|
+
* Bank-transfer project-level toggle returned by `/projects/config`.
|
|
545
|
+
*
|
|
546
|
+
* Only reflects the dashboard preference — the actual rails available for
|
|
547
|
+
* a given country live under `getBankTransferProviders()`.
|
|
548
|
+
*/
|
|
549
|
+
interface BankTransferConfig {
|
|
550
|
+
enabled: boolean;
|
|
551
|
+
}
|
|
491
552
|
/**
|
|
492
553
|
* Get project configuration
|
|
493
554
|
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
@@ -1032,8 +1093,10 @@ interface PaymentIntent {
|
|
|
1032
1093
|
*/
|
|
1033
1094
|
declare function retrievePaymentIntent(clientSecret: string, publishableKey?: string): Promise<PaymentIntent>;
|
|
1034
1095
|
interface PaymentIntentExecutionsResponse {
|
|
1035
|
-
data:
|
|
1096
|
+
data: DirectExecutionResponse[];
|
|
1036
1097
|
}
|
|
1098
|
+
/** @deprecated Use `DirectExecutionResponse` instead. */
|
|
1099
|
+
type AutoSwapResponse = DirectExecutionResponse;
|
|
1037
1100
|
/**
|
|
1038
1101
|
* List all executions (deposits/swaps) for a payment intent.
|
|
1039
1102
|
* Authenticates via client_secret and publishable key.
|
|
@@ -1287,15 +1350,93 @@ declare function generatePrefixedKSUID(prefix: string): string;
|
|
|
1287
1350
|
|
|
1288
1351
|
/** Event types emitted by the deposit flow, following `resource.action` convention */
|
|
1289
1352
|
declare enum DepositEventType {
|
|
1290
|
-
ONRAMP_SESSION_CREATED = "onramp_session.created"
|
|
1353
|
+
ONRAMP_SESSION_CREATED = "onramp_session.created",
|
|
1354
|
+
DIRECT_EXECUTION_SUCCEEDED = "direct_execution.succeeded"
|
|
1355
|
+
}
|
|
1356
|
+
/** Event types emitted by the withdraw flow, following `resource.action` convention */
|
|
1357
|
+
declare enum WithdrawEventType {
|
|
1358
|
+
DIRECT_EXECUTION_SUCCEEDED = "direct_execution.succeeded"
|
|
1291
1359
|
}
|
|
1360
|
+
/** Event types emitted by the checkout flow. */
|
|
1361
|
+
declare enum CheckoutEventType {
|
|
1362
|
+
PAYMENT_INTENT_SUCCEEDED = "payment_intent.succeeded"
|
|
1363
|
+
}
|
|
1364
|
+
/** Funding method used by a deposit flow. */
|
|
1365
|
+
type DepositMethod = "transfer" | "card" | "cashapp" | "pay_with_exchange" | "exchange_connect" | "wallet_connect";
|
|
1366
|
+
/** Funding method used by a checkout flow. */
|
|
1367
|
+
type CheckoutMethod = "transfer" | "wallet_connect";
|
|
1292
1368
|
/** `data.object` payload for {@link DepositEventType.ONRAMP_SESSION_CREATED} */
|
|
1293
1369
|
interface OnrampSessionCreatedData {
|
|
1294
1370
|
externalId: string;
|
|
1295
1371
|
}
|
|
1372
|
+
/**
|
|
1373
|
+
* Callback-facing payment intent object.
|
|
1374
|
+
* Mirrors the field-naming conventions used by {@link DirectExecution}
|
|
1375
|
+
* (camelCase, `BaseUnit` / `Usd` amount suffixes, `failureReason`, no currency
|
|
1376
|
+
* code or decimals — derive those from `*TokenAddress` if needed).
|
|
1377
|
+
*/
|
|
1378
|
+
interface CheckoutPaymentIntent {
|
|
1379
|
+
id: string;
|
|
1380
|
+
status: "succeeded";
|
|
1381
|
+
recipientAddress: string;
|
|
1382
|
+
destinationChainType: string;
|
|
1383
|
+
destinationChainId: string;
|
|
1384
|
+
destinationTokenAddress: string;
|
|
1385
|
+
destinationAmountBaseUnit: string;
|
|
1386
|
+
destinationAmountUsd: string;
|
|
1387
|
+
destinationAmountReceivedBaseUnit: string;
|
|
1388
|
+
destinationAmountReceivedUsd: string;
|
|
1389
|
+
sourceChainType: string | null;
|
|
1390
|
+
sourceChainId: string | null;
|
|
1391
|
+
sourceTokenAddress: string | null;
|
|
1392
|
+
sourceAmountBaseUnit: string | null;
|
|
1393
|
+
sourceAmountUsd: string | null;
|
|
1394
|
+
sourceAmountReceivedBaseUnit: string | null;
|
|
1395
|
+
sourceAmountReceivedUsd: string | null;
|
|
1396
|
+
/** Atomic payout (pool → recipient) hash. Locked-quote only; null until broadcast. */
|
|
1397
|
+
transactionHash: string | null;
|
|
1398
|
+
failureReason: string | null;
|
|
1399
|
+
}
|
|
1400
|
+
/**
|
|
1401
|
+
* `data.object` payload for {@link CheckoutEventType.PAYMENT_INTENT_SUCCEEDED}.
|
|
1402
|
+
* @deprecated Use {@link CheckoutPaymentIntent} — kept as an alias for back-compat.
|
|
1403
|
+
*/
|
|
1404
|
+
type CheckoutPaymentIntentData = CheckoutPaymentIntent;
|
|
1405
|
+
/**
|
|
1406
|
+
* Callback-facing direct execution object.
|
|
1407
|
+
* Intentionally separate from legacy `DirectExecutionResponse` naming.
|
|
1408
|
+
*/
|
|
1409
|
+
interface DirectExecution {
|
|
1410
|
+
id: string;
|
|
1411
|
+
transactionHash: string;
|
|
1412
|
+
recipientAddress: string;
|
|
1413
|
+
depositAddress?: string;
|
|
1414
|
+
sourceChainType: string;
|
|
1415
|
+
sourceChainId: string;
|
|
1416
|
+
sourceTokenAddress: string;
|
|
1417
|
+
destinationChainType: string;
|
|
1418
|
+
destinationChainId: string;
|
|
1419
|
+
destinationTokenAddress: string;
|
|
1420
|
+
sourceAmountBaseUnit: string;
|
|
1421
|
+
sourceAmountUsd?: string;
|
|
1422
|
+
destinationAmountBaseUnit: string;
|
|
1423
|
+
destinationAmountUsd?: string;
|
|
1424
|
+
destinationTransactionHashes: string[];
|
|
1425
|
+
status: ExecutionStatus;
|
|
1426
|
+
failureReason: string | null;
|
|
1427
|
+
}
|
|
1296
1428
|
/** Map from event type to its `data.object` shape */
|
|
1297
1429
|
interface DepositEventDataMap {
|
|
1298
1430
|
[DepositEventType.ONRAMP_SESSION_CREATED]: OnrampSessionCreatedData;
|
|
1431
|
+
[DepositEventType.DIRECT_EXECUTION_SUCCEEDED]: DirectExecution;
|
|
1432
|
+
}
|
|
1433
|
+
/** Map from event type to its `data.object` shape */
|
|
1434
|
+
interface WithdrawEventDataMap {
|
|
1435
|
+
[WithdrawEventType.DIRECT_EXECUTION_SUCCEEDED]: DirectExecution;
|
|
1436
|
+
}
|
|
1437
|
+
/** Map from event type to its `data.object` shape */
|
|
1438
|
+
interface CheckoutEventDataMap {
|
|
1439
|
+
[CheckoutEventType.PAYMENT_INTENT_SUCCEEDED]: CheckoutPaymentIntent;
|
|
1299
1440
|
}
|
|
1300
1441
|
/**
|
|
1301
1442
|
* Event envelope emitted by the deposit flow, inspired by the server-side
|
|
@@ -1309,15 +1450,61 @@ type DepositEvent = {
|
|
|
1309
1450
|
id: string;
|
|
1310
1451
|
type: K;
|
|
1311
1452
|
created: number;
|
|
1453
|
+
/**
|
|
1454
|
+
* Optional SDK-level context indicating which deposit method triggered
|
|
1455
|
+
* this event (e.g. transfer, wallet_connect).
|
|
1456
|
+
*/
|
|
1457
|
+
method?: DepositMethod;
|
|
1312
1458
|
data: {
|
|
1313
1459
|
object: DepositEventDataMap[K];
|
|
1314
1460
|
};
|
|
1315
1461
|
};
|
|
1316
1462
|
}[DepositEventType];
|
|
1463
|
+
/**
|
|
1464
|
+
* Event envelope emitted by the withdraw flow, matching the same top-level
|
|
1465
|
+
* shape as deposit events.
|
|
1466
|
+
*/
|
|
1467
|
+
type WithdrawEvent = {
|
|
1468
|
+
[K in WithdrawEventType]: {
|
|
1469
|
+
id: string;
|
|
1470
|
+
type: K;
|
|
1471
|
+
created: number;
|
|
1472
|
+
data: {
|
|
1473
|
+
object: WithdrawEventDataMap[K];
|
|
1474
|
+
};
|
|
1475
|
+
};
|
|
1476
|
+
}[WithdrawEventType];
|
|
1477
|
+
/** Event envelope emitted by the checkout flow. */
|
|
1478
|
+
type CheckoutEvent = {
|
|
1479
|
+
[K in CheckoutEventType]: {
|
|
1480
|
+
id: string;
|
|
1481
|
+
type: K;
|
|
1482
|
+
created: number;
|
|
1483
|
+
method?: CheckoutMethod;
|
|
1484
|
+
data: {
|
|
1485
|
+
object: CheckoutEventDataMap[K];
|
|
1486
|
+
};
|
|
1487
|
+
};
|
|
1488
|
+
}[CheckoutEventType];
|
|
1317
1489
|
/** Convenience type for a fully-typed `onramp_session.created` event */
|
|
1318
1490
|
type OnrampSessionCreatedEvent = Extract<DepositEvent, {
|
|
1319
1491
|
type: DepositEventType.ONRAMP_SESSION_CREATED;
|
|
1320
1492
|
}>;
|
|
1493
|
+
/**
|
|
1494
|
+
* Event envelope for direct execution success callbacks.
|
|
1495
|
+
* Mirrors the `data.object` schema used by {@link DepositEvent}.
|
|
1496
|
+
*/
|
|
1497
|
+
type DirectExecutionSucceededEvent = Extract<DepositEvent, {
|
|
1498
|
+
type: DepositEventType.DIRECT_EXECUTION_SUCCEEDED;
|
|
1499
|
+
}>;
|
|
1500
|
+
/** Convenience type for a fully-typed `direct_execution.succeeded` withdraw event */
|
|
1501
|
+
type WithdrawDirectExecutionSucceededEvent = Extract<WithdrawEvent, {
|
|
1502
|
+
type: WithdrawEventType.DIRECT_EXECUTION_SUCCEEDED;
|
|
1503
|
+
}>;
|
|
1504
|
+
/** Convenience type for a fully-typed `payment_intent.succeeded` checkout event */
|
|
1505
|
+
type CheckoutPaymentIntentSucceededEvent = Extract<CheckoutEvent, {
|
|
1506
|
+
type: CheckoutEventType.PAYMENT_INTENT_SUCCEEDED;
|
|
1507
|
+
}>;
|
|
1321
1508
|
|
|
1322
1509
|
/**
|
|
1323
1510
|
* User IP information interface
|
|
@@ -1441,4 +1628,4 @@ declare const i18n: {
|
|
|
1441
1628
|
};
|
|
1442
1629
|
type I18nStrings = typeof i18n;
|
|
1443
1630
|
|
|
1444
|
-
export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AuthenticateOAuthResult, type AutoSwapRequest, type AutoSwapResponse, type BlockedCountrySubdivision, type BuildHypercoreTransactionRequest, type BuildHypercoreTransactionResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type CashAppLimits, type CashAppSessionRequest, type CashAppSessionResponse, type CashAppSessionStatusResponse, type ChainType, type ConfirmIntegrationTransferResult, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type CreateIntegrationTransferParams, type CreateIntegrationTransferResult, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, type DepositEvent, DepositEventType, type DepositQuote, type DepositQuoteRequest, type DestinationToken, type DestinationTokenChain, type EvmContractCall, type ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type ExternalWalletChainType, type ExternalWalletInfo, type ExternalWalletsResponse, type FeaturedToken, type FeaturedWallet, type FiatCurrenciesResponse, type FiatCurrency, type GetExchangesQuery, type HypercoreActivationRequest, type HypercoreActivationResponse, type I18nStrings, type IconUrl, IneligibilityReason, type IntegrationAccount, type IntegrationExchangeInfo, type IntegrationExchangesResponse, type IntegrationFeeAmount, type IntegrationHoldingsResponse, IntegrationProvider, type IpAddressResponse, type LockedQuoteLimits, type LockedQuotePreview, type LockedQuotePreviewRequest, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionCreatedData, type OnrampSessionCreatedEvent, type OnrampSessionRequest, type OnrampSessionResponse, type PaymentIntent, type PaymentIntentDepositAddress, type PaymentIntentExecutionsResponse, type PaymentIntentStatus, type PaymentIntentType, type PaymentNetwork, type PollExecutionsRequest, type PollExecutionsResponse, type ProductType, type ProjectConfigResponse, type QueryExecutionsRequest, type QueryExecutionsResponse, type RefreshIntegrationTokenResult, SOLANA_USDC_ADDRESS, type SendHypercoreTransactionRequest, type SendHypercoreTransactionResponse, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SourceToken, type SourceTokenNetwork, type StartIntegrationOAuthResult, type SupportedChain, type SupportedDepositTokensResponse, type SupportedDestinationTokensResponse, type SupportedSourceTokensQuery, type SupportedSourceTokensResponse, type SupportedToken, type TokenBalance, type TokenChain, type TokenChainIconUrl, type TokenChainsResponse, type TokenIconUrl, type TokenInfo, type TokenMetadata, type TransferDefaultTokenParams, type TransferDefaultTokenResult, type UserIpInfo, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, type WalletMobileDeepLinkDepositAddress, type WalletMobileDeepLinkResponse, type WalletMobileDeepLinkWallet, authenticateIntegrationOAuth, buildHypercoreTransaction, buildSolanaTransaction, checkHypercoreActivation, confirmIntegrationTransfer, createCashAppSession, createDepositAddress, createExchangeSession, createIntegrationTransfer, createOnrampSession, formatStablecoinAmount, generateKSUID, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getCashAppLimits, getCashAppSessionStatus, getChainName, getDefaultOnrampToken, getDepositAddress, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getExternalWallets, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIntegrationExchanges, getIntegrationHoldings, getIntegrationTransferDefaultToken, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, getWalletMobileDeepLink, i18n, listPaymentIntentExecutions, pollDirectExecutions, queryExecutions, refreshIntegrationToken, retrievePaymentIntent, revokeIntegrationToken, sendHypercoreTransaction, sendSolanaTransaction, setApiConfig, startIntegrationOAuth, useUserIp, verifyRecipientAddress };
|
|
1631
|
+
export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AuthenticateOAuthResult, type AutoSwapRequest, type AutoSwapResponse, type BankTransferConfig, type BankTransferProvider, type BankTransferProvidersResponse, type BlockedCountrySubdivision, type BuildHypercoreTransactionRequest, type BuildHypercoreTransactionResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type CashAppLimits, type CashAppSessionRequest, type CashAppSessionResponse, type CashAppSessionStatusResponse, type ChainType, type CheckoutEvent, CheckoutEventType, type CheckoutMethod, type CheckoutPaymentIntent, type CheckoutPaymentIntentData, type CheckoutPaymentIntentSucceededEvent, type ConfirmIntegrationTransferResult, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type CreateIntegrationTransferParams, type CreateIntegrationTransferResult, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, type DepositEvent, DepositEventType, type DepositMethod, type DepositQuote, type DepositQuoteRequest, type DestinationToken, type DestinationTokenChain, type DirectExecution, type DirectExecutionResponse, type DirectExecutionSucceededEvent, type EvmContractCall, type ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type ExternalWalletChainType, type ExternalWalletInfo, type ExternalWalletsResponse, type FeaturedToken, type FeaturedWallet, type FiatCurrenciesResponse, type FiatCurrency, type GetBankTransferProvidersOptions, type GetExchangesQuery, type HypercoreActivationRequest, type HypercoreActivationResponse, type I18nStrings, type IconUrl, IneligibilityReason, type IntegrationAccount, type IntegrationExchangeInfo, type IntegrationExchangesResponse, type IntegrationFeeAmount, type IntegrationHoldingsResponse, IntegrationProvider, type IpAddressResponse, type LockedQuoteLimits, type LockedQuotePreview, type LockedQuotePreviewRequest, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionCreatedData, type OnrampSessionCreatedEvent, type OnrampSessionPaymentMethod, type OnrampSessionRequest, type OnrampSessionResponse, type PaymentIntent, type PaymentIntentDepositAddress, type PaymentIntentExecutionsResponse, type PaymentIntentStatus, type PaymentIntentType, type PaymentNetwork, type PollExecutionsRequest, type PollExecutionsResponse, type ProductType, type ProjectConfigResponse, type QueryExecutionsRequest, type QueryExecutionsResponse, type RefreshIntegrationTokenResult, SOLANA_USDC_ADDRESS, type SendHypercoreTransactionRequest, type SendHypercoreTransactionResponse, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SourceToken, type SourceTokenNetwork, type StartIntegrationOAuthResult, type SupportedChain, type SupportedDepositTokensResponse, type SupportedDestinationTokensResponse, type SupportedSourceTokensQuery, type SupportedSourceTokensResponse, type SupportedToken, type TokenBalance, type TokenChain, type TokenChainIconUrl, type TokenChainsResponse, type TokenIconUrl, type TokenInfo, type TokenMetadata, type TransferDefaultTokenParams, type TransferDefaultTokenResult, type UserIpInfo, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, type WalletMobileDeepLinkDepositAddress, type WalletMobileDeepLinkResponse, type WalletMobileDeepLinkWallet, type WithdrawDirectExecutionSucceededEvent, type WithdrawEvent, WithdrawEventType, authenticateIntegrationOAuth, buildHypercoreTransaction, buildSolanaTransaction, checkHypercoreActivation, confirmIntegrationTransfer, createCashAppSession, createDepositAddress, createExchangeSession, createIntegrationTransfer, createOnrampSession, formatStablecoinAmount, generateKSUID, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getBankTransferProviders, getCashAppLimits, getCashAppSessionStatus, getChainName, getDefaultOnrampToken, getDepositAddress, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getExternalWallets, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIntegrationExchanges, getIntegrationHoldings, getIntegrationTransferDefaultToken, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, getWalletMobileDeepLink, i18n, listPaymentIntentExecutions, pollDirectExecutions, queryExecutions, refreshIntegrationToken, retrievePaymentIntent, revokeIntegrationToken, sendHypercoreTransaction, sendSolanaTransaction, setApiConfig, startIntegrationOAuth, useUserIp, verifyRecipientAddress };
|
package/dist/index.js
CHANGED
|
@@ -21,11 +21,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
ActionType: () => ActionType,
|
|
24
|
+
CheckoutEventType: () => CheckoutEventType,
|
|
24
25
|
DepositEventType: () => DepositEventType,
|
|
25
26
|
ExecutionStatus: () => ExecutionStatus,
|
|
26
27
|
IneligibilityReason: () => IneligibilityReason,
|
|
27
28
|
IntegrationProvider: () => IntegrationProvider,
|
|
28
29
|
SOLANA_USDC_ADDRESS: () => SOLANA_USDC_ADDRESS,
|
|
30
|
+
WithdrawEventType: () => WithdrawEventType,
|
|
29
31
|
authenticateIntegrationOAuth: () => authenticateIntegrationOAuth,
|
|
30
32
|
buildHypercoreTransaction: () => buildHypercoreTransaction,
|
|
31
33
|
buildSolanaTransaction: () => buildSolanaTransaction,
|
|
@@ -42,6 +44,7 @@ __export(index_exports, {
|
|
|
42
44
|
getAddressBalance: () => getAddressBalance,
|
|
43
45
|
getAddressBalances: () => getAddressBalances,
|
|
44
46
|
getApiBaseUrl: () => getApiBaseUrl,
|
|
47
|
+
getBankTransferProviders: () => getBankTransferProviders,
|
|
45
48
|
getCashAppLimits: () => getCashAppLimits,
|
|
46
49
|
getCashAppSessionStatus: () => getCashAppSessionStatus,
|
|
47
50
|
getChainName: () => getChainName,
|
|
@@ -436,6 +439,29 @@ async function createOnrampSession(request, publishableKey) {
|
|
|
436
439
|
}
|
|
437
440
|
return response.json();
|
|
438
441
|
}
|
|
442
|
+
async function getBankTransferProviders(publishableKey, options = {}) {
|
|
443
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
444
|
+
validatePublishableKey(pk);
|
|
445
|
+
const params = new URLSearchParams();
|
|
446
|
+
if (options.countryCode) {
|
|
447
|
+
params.set("country_code", options.countryCode);
|
|
448
|
+
}
|
|
449
|
+
const queryString = params.toString();
|
|
450
|
+
const url = `${API_BASE_URL}/v1/public/onramps/bank_transfer/providers${queryString ? `?${queryString}` : ""}`;
|
|
451
|
+
const response = await fetch(url, {
|
|
452
|
+
method: "GET",
|
|
453
|
+
headers: {
|
|
454
|
+
accept: "application/json",
|
|
455
|
+
"x-publishable-key": pk
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
if (!response.ok) {
|
|
459
|
+
throw new Error(
|
|
460
|
+
`Failed to fetch bank-transfer providers: ${response.statusText}`
|
|
461
|
+
);
|
|
462
|
+
}
|
|
463
|
+
return response.json();
|
|
464
|
+
}
|
|
439
465
|
function getOnrampSessionStartUrl(request, publishableKey) {
|
|
440
466
|
const params = new URLSearchParams();
|
|
441
467
|
params.append("publishable_key", publishableKey);
|
|
@@ -453,6 +479,9 @@ function getOnrampSessionStartUrl(request, publishableKey) {
|
|
|
453
479
|
if (request.email) {
|
|
454
480
|
params.append("email", request.email);
|
|
455
481
|
}
|
|
482
|
+
if (request.payment_method) {
|
|
483
|
+
params.append("payment_method", request.payment_method);
|
|
484
|
+
}
|
|
456
485
|
return `${API_BASE_URL}/v1/public/onramps/sessions/start?${params.toString()}`;
|
|
457
486
|
}
|
|
458
487
|
async function getDefaultOnrampToken(params, publishableKey) {
|
|
@@ -1102,8 +1131,17 @@ async function sendHypercoreTransaction(request, publishableKey) {
|
|
|
1102
1131
|
// src/lib/events.ts
|
|
1103
1132
|
var DepositEventType = /* @__PURE__ */ ((DepositEventType2) => {
|
|
1104
1133
|
DepositEventType2["ONRAMP_SESSION_CREATED"] = "onramp_session.created";
|
|
1134
|
+
DepositEventType2["DIRECT_EXECUTION_SUCCEEDED"] = "direct_execution.succeeded";
|
|
1105
1135
|
return DepositEventType2;
|
|
1106
1136
|
})(DepositEventType || {});
|
|
1137
|
+
var WithdrawEventType = /* @__PURE__ */ ((WithdrawEventType2) => {
|
|
1138
|
+
WithdrawEventType2["DIRECT_EXECUTION_SUCCEEDED"] = "direct_execution.succeeded";
|
|
1139
|
+
return WithdrawEventType2;
|
|
1140
|
+
})(WithdrawEventType || {});
|
|
1141
|
+
var CheckoutEventType = /* @__PURE__ */ ((CheckoutEventType2) => {
|
|
1142
|
+
CheckoutEventType2["PAYMENT_INTENT_SUCCEEDED"] = "payment_intent.succeeded";
|
|
1143
|
+
return CheckoutEventType2;
|
|
1144
|
+
})(CheckoutEventType || {});
|
|
1107
1145
|
|
|
1108
1146
|
// src/hooks/use-user-ip.ts
|
|
1109
1147
|
var import_react_query = require("@tanstack/react-query");
|
|
@@ -1239,11 +1277,13 @@ var i18n = en_default;
|
|
|
1239
1277
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1240
1278
|
0 && (module.exports = {
|
|
1241
1279
|
ActionType,
|
|
1280
|
+
CheckoutEventType,
|
|
1242
1281
|
DepositEventType,
|
|
1243
1282
|
ExecutionStatus,
|
|
1244
1283
|
IneligibilityReason,
|
|
1245
1284
|
IntegrationProvider,
|
|
1246
1285
|
SOLANA_USDC_ADDRESS,
|
|
1286
|
+
WithdrawEventType,
|
|
1247
1287
|
authenticateIntegrationOAuth,
|
|
1248
1288
|
buildHypercoreTransaction,
|
|
1249
1289
|
buildSolanaTransaction,
|
|
@@ -1260,6 +1300,7 @@ var i18n = en_default;
|
|
|
1260
1300
|
getAddressBalance,
|
|
1261
1301
|
getAddressBalances,
|
|
1262
1302
|
getApiBaseUrl,
|
|
1303
|
+
getBankTransferProviders,
|
|
1263
1304
|
getCashAppLimits,
|
|
1264
1305
|
getCashAppSessionStatus,
|
|
1265
1306
|
getChainName,
|
package/dist/index.mjs
CHANGED
|
@@ -350,6 +350,29 @@ async function createOnrampSession(request, publishableKey) {
|
|
|
350
350
|
}
|
|
351
351
|
return response.json();
|
|
352
352
|
}
|
|
353
|
+
async function getBankTransferProviders(publishableKey, options = {}) {
|
|
354
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
355
|
+
validatePublishableKey(pk);
|
|
356
|
+
const params = new URLSearchParams();
|
|
357
|
+
if (options.countryCode) {
|
|
358
|
+
params.set("country_code", options.countryCode);
|
|
359
|
+
}
|
|
360
|
+
const queryString = params.toString();
|
|
361
|
+
const url = `${API_BASE_URL}/v1/public/onramps/bank_transfer/providers${queryString ? `?${queryString}` : ""}`;
|
|
362
|
+
const response = await fetch(url, {
|
|
363
|
+
method: "GET",
|
|
364
|
+
headers: {
|
|
365
|
+
accept: "application/json",
|
|
366
|
+
"x-publishable-key": pk
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
if (!response.ok) {
|
|
370
|
+
throw new Error(
|
|
371
|
+
`Failed to fetch bank-transfer providers: ${response.statusText}`
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
return response.json();
|
|
375
|
+
}
|
|
353
376
|
function getOnrampSessionStartUrl(request, publishableKey) {
|
|
354
377
|
const params = new URLSearchParams();
|
|
355
378
|
params.append("publishable_key", publishableKey);
|
|
@@ -367,6 +390,9 @@ function getOnrampSessionStartUrl(request, publishableKey) {
|
|
|
367
390
|
if (request.email) {
|
|
368
391
|
params.append("email", request.email);
|
|
369
392
|
}
|
|
393
|
+
if (request.payment_method) {
|
|
394
|
+
params.append("payment_method", request.payment_method);
|
|
395
|
+
}
|
|
370
396
|
return `${API_BASE_URL}/v1/public/onramps/sessions/start?${params.toString()}`;
|
|
371
397
|
}
|
|
372
398
|
async function getDefaultOnrampToken(params, publishableKey) {
|
|
@@ -1016,8 +1042,17 @@ async function sendHypercoreTransaction(request, publishableKey) {
|
|
|
1016
1042
|
// src/lib/events.ts
|
|
1017
1043
|
var DepositEventType = /* @__PURE__ */ ((DepositEventType2) => {
|
|
1018
1044
|
DepositEventType2["ONRAMP_SESSION_CREATED"] = "onramp_session.created";
|
|
1045
|
+
DepositEventType2["DIRECT_EXECUTION_SUCCEEDED"] = "direct_execution.succeeded";
|
|
1019
1046
|
return DepositEventType2;
|
|
1020
1047
|
})(DepositEventType || {});
|
|
1048
|
+
var WithdrawEventType = /* @__PURE__ */ ((WithdrawEventType2) => {
|
|
1049
|
+
WithdrawEventType2["DIRECT_EXECUTION_SUCCEEDED"] = "direct_execution.succeeded";
|
|
1050
|
+
return WithdrawEventType2;
|
|
1051
|
+
})(WithdrawEventType || {});
|
|
1052
|
+
var CheckoutEventType = /* @__PURE__ */ ((CheckoutEventType2) => {
|
|
1053
|
+
CheckoutEventType2["PAYMENT_INTENT_SUCCEEDED"] = "payment_intent.succeeded";
|
|
1054
|
+
return CheckoutEventType2;
|
|
1055
|
+
})(CheckoutEventType || {});
|
|
1021
1056
|
|
|
1022
1057
|
// src/hooks/use-user-ip.ts
|
|
1023
1058
|
import { useQuery } from "@tanstack/react-query";
|
|
@@ -1152,11 +1187,13 @@ var en_default = {
|
|
|
1152
1187
|
var i18n = en_default;
|
|
1153
1188
|
export {
|
|
1154
1189
|
ActionType,
|
|
1190
|
+
CheckoutEventType,
|
|
1155
1191
|
DepositEventType,
|
|
1156
1192
|
ExecutionStatus,
|
|
1157
1193
|
IneligibilityReason,
|
|
1158
1194
|
IntegrationProvider,
|
|
1159
1195
|
SOLANA_USDC_ADDRESS,
|
|
1196
|
+
WithdrawEventType,
|
|
1160
1197
|
authenticateIntegrationOAuth,
|
|
1161
1198
|
buildHypercoreTransaction,
|
|
1162
1199
|
buildSolanaTransaction,
|
|
@@ -1173,6 +1210,7 @@ export {
|
|
|
1173
1210
|
getAddressBalance,
|
|
1174
1211
|
getAddressBalances,
|
|
1175
1212
|
getApiBaseUrl,
|
|
1213
|
+
getBankTransferProviders,
|
|
1176
1214
|
getCashAppLimits,
|
|
1177
1215
|
getCashAppSessionStatus,
|
|
1178
1216
|
getChainName,
|