@unifold/core 0.1.55 → 0.1.57
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 +154 -2
- package/dist/index.d.ts +154 -2
- package/dist/index.js +202 -0
- package/dist/index.mjs +191 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -48,6 +48,12 @@ interface CreateDepositAddressRequest {
|
|
|
48
48
|
recipient_address: string;
|
|
49
49
|
/** @default ActionType.Deposit */
|
|
50
50
|
action_type?: ActionType;
|
|
51
|
+
/**
|
|
52
|
+
* Source chain type. When provided together with `action_type=withdraw`,
|
|
53
|
+
* only the deposit wallet for this chain is generated — the other chain
|
|
54
|
+
* types are skipped (they're unused in a withdrawal flow).
|
|
55
|
+
*/
|
|
56
|
+
source_chain_type?: ChainType;
|
|
51
57
|
client_metadata?: Record<string, unknown>;
|
|
52
58
|
}
|
|
53
59
|
/**
|
|
@@ -56,6 +62,22 @@ interface CreateDepositAddressRequest {
|
|
|
56
62
|
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
57
63
|
*/
|
|
58
64
|
declare function createDepositAddress(overrides?: Partial<CreateDepositAddressRequest>, publishableKey?: string): Promise<DepositAddressResponse>;
|
|
65
|
+
interface GetExistingDepositAddressRequest {
|
|
66
|
+
external_user_id: string;
|
|
67
|
+
destination_chain_type: string;
|
|
68
|
+
destination_chain_id: string;
|
|
69
|
+
destination_token_address: string;
|
|
70
|
+
recipient_address: string;
|
|
71
|
+
/** @default ActionType.Deposit */
|
|
72
|
+
action_type?: ActionType;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get existing deposit wallets without creating new ones.
|
|
76
|
+
* Returns an empty `data` array when no wallet exists yet for the
|
|
77
|
+
* (user, destination) tuple — callers can treat this as "the wallet
|
|
78
|
+
* will be created fresh on the next createDepositAddress call".
|
|
79
|
+
*/
|
|
80
|
+
declare function getDepositAddress(params: GetExistingDepositAddressRequest, publishableKey?: string): Promise<DepositAddressResponse>;
|
|
59
81
|
/**
|
|
60
82
|
* Get wallet address for a specific chain type
|
|
61
83
|
*/
|
|
@@ -435,6 +457,9 @@ interface ProjectConfigResponse {
|
|
|
435
457
|
pay_with_exchange?: {
|
|
436
458
|
enabled: boolean;
|
|
437
459
|
};
|
|
460
|
+
hypercore_sponsorship?: {
|
|
461
|
+
enabled: boolean;
|
|
462
|
+
};
|
|
438
463
|
}
|
|
439
464
|
/**
|
|
440
465
|
* Get project configuration
|
|
@@ -556,6 +581,7 @@ interface HypercoreActivationResponse {
|
|
|
556
581
|
user_exists: boolean;
|
|
557
582
|
activation_fee: number;
|
|
558
583
|
is_sanctioned: boolean;
|
|
584
|
+
sponsored?: boolean;
|
|
559
585
|
}
|
|
560
586
|
/**
|
|
561
587
|
* Check whether a recipient address is activated on HyperCore (Hyperliquid L1).
|
|
@@ -627,6 +653,132 @@ interface ExchangeSessionStartParams {
|
|
|
627
653
|
* This avoids popup blockers in Safari by opening the URL directly via anchor tag or window.open().
|
|
628
654
|
*/
|
|
629
655
|
declare function getExchangeSessionStartUrl(request: ExchangeSessionStartParams, publishableKey: string): string;
|
|
656
|
+
interface IntegrationExchangeInfo {
|
|
657
|
+
service_provider: string;
|
|
658
|
+
service_provider_display_name: string;
|
|
659
|
+
description: string;
|
|
660
|
+
icon_url: string;
|
|
661
|
+
icon_urls: IconUrl[];
|
|
662
|
+
enabled: boolean;
|
|
663
|
+
supported_networks: string[];
|
|
664
|
+
supported_currencies: string[];
|
|
665
|
+
}
|
|
666
|
+
interface IntegrationExchangesResponse {
|
|
667
|
+
data: IntegrationExchangeInfo[];
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Get available integration OAuth exchanges (Coinbase, Binance, Kraken, etc.)
|
|
671
|
+
* Returns provider info with icons, enabled status, and supported networks/currencies.
|
|
672
|
+
*/
|
|
673
|
+
declare function getIntegrationExchanges(publishableKey?: string): Promise<IntegrationExchangesResponse>;
|
|
674
|
+
interface StartIntegrationOAuthResult {
|
|
675
|
+
redirect_url: string;
|
|
676
|
+
state: string;
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Start Coinbase OAuth flow.
|
|
680
|
+
* Returns a redirect URL (for the user to authorize) and a state token for polling.
|
|
681
|
+
*/
|
|
682
|
+
declare function startIntegrationOAuth(publishableKey?: string): Promise<StartIntegrationOAuthResult>;
|
|
683
|
+
declare enum IntegrationProvider {
|
|
684
|
+
COINBASE = "coinbase"
|
|
685
|
+
}
|
|
686
|
+
interface IntegrationAccount {
|
|
687
|
+
id: string;
|
|
688
|
+
name: string;
|
|
689
|
+
currency: string;
|
|
690
|
+
amount: string;
|
|
691
|
+
amount_usd: string | null;
|
|
692
|
+
exchange_rate: string | null;
|
|
693
|
+
type: string;
|
|
694
|
+
icon_url: string;
|
|
695
|
+
icon_urls: IconUrl[];
|
|
696
|
+
}
|
|
697
|
+
type AuthenticateOAuthResult = {
|
|
698
|
+
status: "pending";
|
|
699
|
+
} | {
|
|
700
|
+
status: "completed";
|
|
701
|
+
accounts: IntegrationAccount[];
|
|
702
|
+
access_token: string;
|
|
703
|
+
expires_at: string;
|
|
704
|
+
};
|
|
705
|
+
/**
|
|
706
|
+
* Poll or exchange an OAuth state/token for Coinbase credentials.
|
|
707
|
+
* In the polling flow, pass the `state` from startIntegrationOAuth.
|
|
708
|
+
* Returns `{ status: "pending" }` until the user completes authorization.
|
|
709
|
+
*/
|
|
710
|
+
declare function authenticateIntegrationOAuth(params: {
|
|
711
|
+
state?: string;
|
|
712
|
+
oauth_token?: string;
|
|
713
|
+
}, publishableKey?: string): Promise<AuthenticateOAuthResult>;
|
|
714
|
+
interface RefreshIntegrationTokenResult {
|
|
715
|
+
access_token: string;
|
|
716
|
+
expires_at: string;
|
|
717
|
+
}
|
|
718
|
+
declare function refreshIntegrationToken(accessToken: string, publishableKey?: string): Promise<RefreshIntegrationTokenResult>;
|
|
719
|
+
/**
|
|
720
|
+
* Revoke a Coinbase OAuth token.
|
|
721
|
+
* Fire-and-forget — the backend can wire up actual Coinbase revocation without a client update.
|
|
722
|
+
*/
|
|
723
|
+
declare function revokeIntegrationToken(accessToken: string, publishableKey?: string): Promise<void>;
|
|
724
|
+
interface IntegrationHoldingsResponse {
|
|
725
|
+
data: IntegrationAccount[];
|
|
726
|
+
}
|
|
727
|
+
declare function getIntegrationHoldings(provider: string, accessToken: string, publishableKey?: string): Promise<IntegrationHoldingsResponse>;
|
|
728
|
+
interface IntegrationFeeAmount {
|
|
729
|
+
amount: string;
|
|
730
|
+
currency: string;
|
|
731
|
+
}
|
|
732
|
+
interface CreateIntegrationTransferResult {
|
|
733
|
+
id: string;
|
|
734
|
+
status: string;
|
|
735
|
+
integration_provider: string;
|
|
736
|
+
currency: string;
|
|
737
|
+
amount: string;
|
|
738
|
+
destination_address: string;
|
|
739
|
+
network: string;
|
|
740
|
+
fee_included: boolean;
|
|
741
|
+
estimated_network_fee: IntegrationFeeAmount;
|
|
742
|
+
destination_amount: string;
|
|
743
|
+
total_amount: string;
|
|
744
|
+
expires_at: string;
|
|
745
|
+
}
|
|
746
|
+
interface CreateIntegrationTransferParams {
|
|
747
|
+
integration_provider: string;
|
|
748
|
+
access_token: string;
|
|
749
|
+
currency: string;
|
|
750
|
+
amount: string;
|
|
751
|
+
network: string;
|
|
752
|
+
destination_address: string;
|
|
753
|
+
fee_included?: boolean;
|
|
754
|
+
}
|
|
755
|
+
declare function createIntegrationTransfer(params: CreateIntegrationTransferParams, publishableKey?: string): Promise<CreateIntegrationTransferResult>;
|
|
756
|
+
interface ConfirmIntegrationTransferResult {
|
|
757
|
+
id: string;
|
|
758
|
+
status: string;
|
|
759
|
+
currency?: string;
|
|
760
|
+
amount?: string;
|
|
761
|
+
destination_address?: string;
|
|
762
|
+
destination_amount?: string;
|
|
763
|
+
network_fee?: IntegrationFeeAmount;
|
|
764
|
+
message?: string;
|
|
765
|
+
}
|
|
766
|
+
declare function confirmIntegrationTransfer(transferId: string, accessToken: string, mfaCode?: string, publishableKey?: string): Promise<ConfirmIntegrationTransferResult>;
|
|
767
|
+
interface TransferDefaultTokenParams {
|
|
768
|
+
integration_provider: string;
|
|
769
|
+
source_currency: string;
|
|
770
|
+
destination_token_address: string;
|
|
771
|
+
destination_chain_id: string;
|
|
772
|
+
destination_chain_type: string;
|
|
773
|
+
country_code?: string;
|
|
774
|
+
subdivision_code?: string;
|
|
775
|
+
}
|
|
776
|
+
interface TransferDefaultTokenResult {
|
|
777
|
+
source_network: string;
|
|
778
|
+
source_network_display_name: string;
|
|
779
|
+
source_chain_type: string;
|
|
780
|
+
}
|
|
781
|
+
declare function getIntegrationTransferDefaultToken(params: TransferDefaultTokenParams, publishableKey?: string): Promise<TransferDefaultTokenResult>;
|
|
630
782
|
interface BuildSolanaTransactionRequest {
|
|
631
783
|
chain_id: string;
|
|
632
784
|
token_address: string;
|
|
@@ -767,7 +919,7 @@ interface PaymentIntent {
|
|
|
767
919
|
description: string | null;
|
|
768
920
|
livemode: boolean;
|
|
769
921
|
settlement_tolerance_percent: number;
|
|
770
|
-
/**
|
|
922
|
+
/** Whether stablecoin deposits were settled at 1:1. Always `false` for `locked_quote`. */
|
|
771
923
|
stablecoin_parity: boolean;
|
|
772
924
|
canceled_at: string | null;
|
|
773
925
|
cancellation_reason: string | null;
|
|
@@ -1189,4 +1341,4 @@ declare const i18n: {
|
|
|
1189
1341
|
};
|
|
1190
1342
|
type I18nStrings = typeof i18n;
|
|
1191
1343
|
|
|
1192
|
-
export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, 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 CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, type DepositEvent, DepositEventType, type DepositQuote, type DepositQuoteRequest, type DestinationToken, type DestinationTokenChain, type ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type FeaturedToken, type FeaturedWallet, type FiatCurrenciesResponse, type FiatCurrency, type GetExchangesQuery, type HypercoreActionType, type HypercoreActivationRequest, type HypercoreActivationResponse, type I18nStrings, type IconUrl, IneligibilityReason, 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, SOLANA_USDC_ADDRESS, type SendHypercoreTransactionRequest, type SendHypercoreTransactionResponse, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SourceToken, type SourceTokenNetwork, 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 UserIpInfo, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, buildHypercoreTransaction, buildSolanaTransaction, checkHypercoreActivation, createCashAppSession, createDepositAddress, createExchangeSession, createOnrampSession, formatStablecoinAmount, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getCashAppLimits, getCashAppSessionStatus, getChainName, getDefaultOnrampToken, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, i18n, listPaymentIntentExecutions, pollDirectExecutions, queryExecutions, retrievePaymentIntent, sendHypercoreTransaction, sendSolanaTransaction, setApiConfig, useUserIp, verifyRecipientAddress };
|
|
1344
|
+
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 ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type FeaturedToken, type FeaturedWallet, type FiatCurrenciesResponse, type FiatCurrency, type GetExchangesQuery, type HypercoreActionType, 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, authenticateIntegrationOAuth, buildHypercoreTransaction, buildSolanaTransaction, checkHypercoreActivation, confirmIntegrationTransfer, createCashAppSession, createDepositAddress, createExchangeSession, createIntegrationTransfer, createOnrampSession, formatStablecoinAmount, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getCashAppLimits, getCashAppSessionStatus, getChainName, getDefaultOnrampToken, getDepositAddress, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIntegrationExchanges, getIntegrationHoldings, getIntegrationTransferDefaultToken, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, i18n, listPaymentIntentExecutions, pollDirectExecutions, queryExecutions, refreshIntegrationToken, retrievePaymentIntent, revokeIntegrationToken, sendHypercoreTransaction, sendSolanaTransaction, setApiConfig, startIntegrationOAuth, useUserIp, verifyRecipientAddress };
|
package/dist/index.d.ts
CHANGED
|
@@ -48,6 +48,12 @@ interface CreateDepositAddressRequest {
|
|
|
48
48
|
recipient_address: string;
|
|
49
49
|
/** @default ActionType.Deposit */
|
|
50
50
|
action_type?: ActionType;
|
|
51
|
+
/**
|
|
52
|
+
* Source chain type. When provided together with `action_type=withdraw`,
|
|
53
|
+
* only the deposit wallet for this chain is generated — the other chain
|
|
54
|
+
* types are skipped (they're unused in a withdrawal flow).
|
|
55
|
+
*/
|
|
56
|
+
source_chain_type?: ChainType;
|
|
51
57
|
client_metadata?: Record<string, unknown>;
|
|
52
58
|
}
|
|
53
59
|
/**
|
|
@@ -56,6 +62,22 @@ interface CreateDepositAddressRequest {
|
|
|
56
62
|
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
57
63
|
*/
|
|
58
64
|
declare function createDepositAddress(overrides?: Partial<CreateDepositAddressRequest>, publishableKey?: string): Promise<DepositAddressResponse>;
|
|
65
|
+
interface GetExistingDepositAddressRequest {
|
|
66
|
+
external_user_id: string;
|
|
67
|
+
destination_chain_type: string;
|
|
68
|
+
destination_chain_id: string;
|
|
69
|
+
destination_token_address: string;
|
|
70
|
+
recipient_address: string;
|
|
71
|
+
/** @default ActionType.Deposit */
|
|
72
|
+
action_type?: ActionType;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get existing deposit wallets without creating new ones.
|
|
76
|
+
* Returns an empty `data` array when no wallet exists yet for the
|
|
77
|
+
* (user, destination) tuple — callers can treat this as "the wallet
|
|
78
|
+
* will be created fresh on the next createDepositAddress call".
|
|
79
|
+
*/
|
|
80
|
+
declare function getDepositAddress(params: GetExistingDepositAddressRequest, publishableKey?: string): Promise<DepositAddressResponse>;
|
|
59
81
|
/**
|
|
60
82
|
* Get wallet address for a specific chain type
|
|
61
83
|
*/
|
|
@@ -435,6 +457,9 @@ interface ProjectConfigResponse {
|
|
|
435
457
|
pay_with_exchange?: {
|
|
436
458
|
enabled: boolean;
|
|
437
459
|
};
|
|
460
|
+
hypercore_sponsorship?: {
|
|
461
|
+
enabled: boolean;
|
|
462
|
+
};
|
|
438
463
|
}
|
|
439
464
|
/**
|
|
440
465
|
* Get project configuration
|
|
@@ -556,6 +581,7 @@ interface HypercoreActivationResponse {
|
|
|
556
581
|
user_exists: boolean;
|
|
557
582
|
activation_fee: number;
|
|
558
583
|
is_sanctioned: boolean;
|
|
584
|
+
sponsored?: boolean;
|
|
559
585
|
}
|
|
560
586
|
/**
|
|
561
587
|
* Check whether a recipient address is activated on HyperCore (Hyperliquid L1).
|
|
@@ -627,6 +653,132 @@ interface ExchangeSessionStartParams {
|
|
|
627
653
|
* This avoids popup blockers in Safari by opening the URL directly via anchor tag or window.open().
|
|
628
654
|
*/
|
|
629
655
|
declare function getExchangeSessionStartUrl(request: ExchangeSessionStartParams, publishableKey: string): string;
|
|
656
|
+
interface IntegrationExchangeInfo {
|
|
657
|
+
service_provider: string;
|
|
658
|
+
service_provider_display_name: string;
|
|
659
|
+
description: string;
|
|
660
|
+
icon_url: string;
|
|
661
|
+
icon_urls: IconUrl[];
|
|
662
|
+
enabled: boolean;
|
|
663
|
+
supported_networks: string[];
|
|
664
|
+
supported_currencies: string[];
|
|
665
|
+
}
|
|
666
|
+
interface IntegrationExchangesResponse {
|
|
667
|
+
data: IntegrationExchangeInfo[];
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Get available integration OAuth exchanges (Coinbase, Binance, Kraken, etc.)
|
|
671
|
+
* Returns provider info with icons, enabled status, and supported networks/currencies.
|
|
672
|
+
*/
|
|
673
|
+
declare function getIntegrationExchanges(publishableKey?: string): Promise<IntegrationExchangesResponse>;
|
|
674
|
+
interface StartIntegrationOAuthResult {
|
|
675
|
+
redirect_url: string;
|
|
676
|
+
state: string;
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Start Coinbase OAuth flow.
|
|
680
|
+
* Returns a redirect URL (for the user to authorize) and a state token for polling.
|
|
681
|
+
*/
|
|
682
|
+
declare function startIntegrationOAuth(publishableKey?: string): Promise<StartIntegrationOAuthResult>;
|
|
683
|
+
declare enum IntegrationProvider {
|
|
684
|
+
COINBASE = "coinbase"
|
|
685
|
+
}
|
|
686
|
+
interface IntegrationAccount {
|
|
687
|
+
id: string;
|
|
688
|
+
name: string;
|
|
689
|
+
currency: string;
|
|
690
|
+
amount: string;
|
|
691
|
+
amount_usd: string | null;
|
|
692
|
+
exchange_rate: string | null;
|
|
693
|
+
type: string;
|
|
694
|
+
icon_url: string;
|
|
695
|
+
icon_urls: IconUrl[];
|
|
696
|
+
}
|
|
697
|
+
type AuthenticateOAuthResult = {
|
|
698
|
+
status: "pending";
|
|
699
|
+
} | {
|
|
700
|
+
status: "completed";
|
|
701
|
+
accounts: IntegrationAccount[];
|
|
702
|
+
access_token: string;
|
|
703
|
+
expires_at: string;
|
|
704
|
+
};
|
|
705
|
+
/**
|
|
706
|
+
* Poll or exchange an OAuth state/token for Coinbase credentials.
|
|
707
|
+
* In the polling flow, pass the `state` from startIntegrationOAuth.
|
|
708
|
+
* Returns `{ status: "pending" }` until the user completes authorization.
|
|
709
|
+
*/
|
|
710
|
+
declare function authenticateIntegrationOAuth(params: {
|
|
711
|
+
state?: string;
|
|
712
|
+
oauth_token?: string;
|
|
713
|
+
}, publishableKey?: string): Promise<AuthenticateOAuthResult>;
|
|
714
|
+
interface RefreshIntegrationTokenResult {
|
|
715
|
+
access_token: string;
|
|
716
|
+
expires_at: string;
|
|
717
|
+
}
|
|
718
|
+
declare function refreshIntegrationToken(accessToken: string, publishableKey?: string): Promise<RefreshIntegrationTokenResult>;
|
|
719
|
+
/**
|
|
720
|
+
* Revoke a Coinbase OAuth token.
|
|
721
|
+
* Fire-and-forget — the backend can wire up actual Coinbase revocation without a client update.
|
|
722
|
+
*/
|
|
723
|
+
declare function revokeIntegrationToken(accessToken: string, publishableKey?: string): Promise<void>;
|
|
724
|
+
interface IntegrationHoldingsResponse {
|
|
725
|
+
data: IntegrationAccount[];
|
|
726
|
+
}
|
|
727
|
+
declare function getIntegrationHoldings(provider: string, accessToken: string, publishableKey?: string): Promise<IntegrationHoldingsResponse>;
|
|
728
|
+
interface IntegrationFeeAmount {
|
|
729
|
+
amount: string;
|
|
730
|
+
currency: string;
|
|
731
|
+
}
|
|
732
|
+
interface CreateIntegrationTransferResult {
|
|
733
|
+
id: string;
|
|
734
|
+
status: string;
|
|
735
|
+
integration_provider: string;
|
|
736
|
+
currency: string;
|
|
737
|
+
amount: string;
|
|
738
|
+
destination_address: string;
|
|
739
|
+
network: string;
|
|
740
|
+
fee_included: boolean;
|
|
741
|
+
estimated_network_fee: IntegrationFeeAmount;
|
|
742
|
+
destination_amount: string;
|
|
743
|
+
total_amount: string;
|
|
744
|
+
expires_at: string;
|
|
745
|
+
}
|
|
746
|
+
interface CreateIntegrationTransferParams {
|
|
747
|
+
integration_provider: string;
|
|
748
|
+
access_token: string;
|
|
749
|
+
currency: string;
|
|
750
|
+
amount: string;
|
|
751
|
+
network: string;
|
|
752
|
+
destination_address: string;
|
|
753
|
+
fee_included?: boolean;
|
|
754
|
+
}
|
|
755
|
+
declare function createIntegrationTransfer(params: CreateIntegrationTransferParams, publishableKey?: string): Promise<CreateIntegrationTransferResult>;
|
|
756
|
+
interface ConfirmIntegrationTransferResult {
|
|
757
|
+
id: string;
|
|
758
|
+
status: string;
|
|
759
|
+
currency?: string;
|
|
760
|
+
amount?: string;
|
|
761
|
+
destination_address?: string;
|
|
762
|
+
destination_amount?: string;
|
|
763
|
+
network_fee?: IntegrationFeeAmount;
|
|
764
|
+
message?: string;
|
|
765
|
+
}
|
|
766
|
+
declare function confirmIntegrationTransfer(transferId: string, accessToken: string, mfaCode?: string, publishableKey?: string): Promise<ConfirmIntegrationTransferResult>;
|
|
767
|
+
interface TransferDefaultTokenParams {
|
|
768
|
+
integration_provider: string;
|
|
769
|
+
source_currency: string;
|
|
770
|
+
destination_token_address: string;
|
|
771
|
+
destination_chain_id: string;
|
|
772
|
+
destination_chain_type: string;
|
|
773
|
+
country_code?: string;
|
|
774
|
+
subdivision_code?: string;
|
|
775
|
+
}
|
|
776
|
+
interface TransferDefaultTokenResult {
|
|
777
|
+
source_network: string;
|
|
778
|
+
source_network_display_name: string;
|
|
779
|
+
source_chain_type: string;
|
|
780
|
+
}
|
|
781
|
+
declare function getIntegrationTransferDefaultToken(params: TransferDefaultTokenParams, publishableKey?: string): Promise<TransferDefaultTokenResult>;
|
|
630
782
|
interface BuildSolanaTransactionRequest {
|
|
631
783
|
chain_id: string;
|
|
632
784
|
token_address: string;
|
|
@@ -767,7 +919,7 @@ interface PaymentIntent {
|
|
|
767
919
|
description: string | null;
|
|
768
920
|
livemode: boolean;
|
|
769
921
|
settlement_tolerance_percent: number;
|
|
770
|
-
/**
|
|
922
|
+
/** Whether stablecoin deposits were settled at 1:1. Always `false` for `locked_quote`. */
|
|
771
923
|
stablecoin_parity: boolean;
|
|
772
924
|
canceled_at: string | null;
|
|
773
925
|
cancellation_reason: string | null;
|
|
@@ -1189,4 +1341,4 @@ declare const i18n: {
|
|
|
1189
1341
|
};
|
|
1190
1342
|
type I18nStrings = typeof i18n;
|
|
1191
1343
|
|
|
1192
|
-
export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, 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 CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, type DepositEvent, DepositEventType, type DepositQuote, type DepositQuoteRequest, type DestinationToken, type DestinationTokenChain, type ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type FeaturedToken, type FeaturedWallet, type FiatCurrenciesResponse, type FiatCurrency, type GetExchangesQuery, type HypercoreActionType, type HypercoreActivationRequest, type HypercoreActivationResponse, type I18nStrings, type IconUrl, IneligibilityReason, 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, SOLANA_USDC_ADDRESS, type SendHypercoreTransactionRequest, type SendHypercoreTransactionResponse, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SourceToken, type SourceTokenNetwork, 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 UserIpInfo, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, buildHypercoreTransaction, buildSolanaTransaction, checkHypercoreActivation, createCashAppSession, createDepositAddress, createExchangeSession, createOnrampSession, formatStablecoinAmount, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getCashAppLimits, getCashAppSessionStatus, getChainName, getDefaultOnrampToken, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, i18n, listPaymentIntentExecutions, pollDirectExecutions, queryExecutions, retrievePaymentIntent, sendHypercoreTransaction, sendSolanaTransaction, setApiConfig, useUserIp, verifyRecipientAddress };
|
|
1344
|
+
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 ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type FeaturedToken, type FeaturedWallet, type FiatCurrenciesResponse, type FiatCurrency, type GetExchangesQuery, type HypercoreActionType, 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, authenticateIntegrationOAuth, buildHypercoreTransaction, buildSolanaTransaction, checkHypercoreActivation, confirmIntegrationTransfer, createCashAppSession, createDepositAddress, createExchangeSession, createIntegrationTransfer, createOnrampSession, formatStablecoinAmount, generatePrefixedKSUID, getAddressBalance, getAddressBalances, getApiBaseUrl, getCashAppLimits, getCashAppSessionStatus, getChainName, getDefaultOnrampToken, getDepositAddress, getDepositQuote, getExchangeSessionStartUrl, getExchanges, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIntegrationExchanges, getIntegrationHoldings, getIntegrationTransferDefaultToken, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, i18n, listPaymentIntentExecutions, pollDirectExecutions, queryExecutions, refreshIntegrationToken, retrievePaymentIntent, revokeIntegrationToken, sendHypercoreTransaction, sendSolanaTransaction, setApiConfig, startIntegrationOAuth, useUserIp, verifyRecipientAddress };
|
package/dist/index.js
CHANGED
|
@@ -24,13 +24,17 @@ __export(index_exports, {
|
|
|
24
24
|
DepositEventType: () => DepositEventType,
|
|
25
25
|
ExecutionStatus: () => ExecutionStatus,
|
|
26
26
|
IneligibilityReason: () => IneligibilityReason,
|
|
27
|
+
IntegrationProvider: () => IntegrationProvider,
|
|
27
28
|
SOLANA_USDC_ADDRESS: () => SOLANA_USDC_ADDRESS,
|
|
29
|
+
authenticateIntegrationOAuth: () => authenticateIntegrationOAuth,
|
|
28
30
|
buildHypercoreTransaction: () => buildHypercoreTransaction,
|
|
29
31
|
buildSolanaTransaction: () => buildSolanaTransaction,
|
|
30
32
|
checkHypercoreActivation: () => checkHypercoreActivation,
|
|
33
|
+
confirmIntegrationTransfer: () => confirmIntegrationTransfer,
|
|
31
34
|
createCashAppSession: () => createCashAppSession,
|
|
32
35
|
createDepositAddress: () => createDepositAddress,
|
|
33
36
|
createExchangeSession: () => createExchangeSession,
|
|
37
|
+
createIntegrationTransfer: () => createIntegrationTransfer,
|
|
34
38
|
createOnrampSession: () => createOnrampSession,
|
|
35
39
|
formatStablecoinAmount: () => formatStablecoinAmount,
|
|
36
40
|
generatePrefixedKSUID: () => generatePrefixedKSUID,
|
|
@@ -41,12 +45,16 @@ __export(index_exports, {
|
|
|
41
45
|
getCashAppSessionStatus: () => getCashAppSessionStatus,
|
|
42
46
|
getChainName: () => getChainName,
|
|
43
47
|
getDefaultOnrampToken: () => getDefaultOnrampToken,
|
|
48
|
+
getDepositAddress: () => getDepositAddress,
|
|
44
49
|
getDepositQuote: () => getDepositQuote,
|
|
45
50
|
getExchangeSessionStartUrl: () => getExchangeSessionStartUrl,
|
|
46
51
|
getExchanges: () => getExchanges,
|
|
47
52
|
getFiatCurrencies: () => getFiatCurrencies,
|
|
48
53
|
getIconUrl: () => getIconUrl,
|
|
49
54
|
getIconUrlWithCdn: () => getIconUrlWithCdn,
|
|
55
|
+
getIntegrationExchanges: () => getIntegrationExchanges,
|
|
56
|
+
getIntegrationHoldings: () => getIntegrationHoldings,
|
|
57
|
+
getIntegrationTransferDefaultToken: () => getIntegrationTransferDefaultToken,
|
|
50
58
|
getIpAddress: () => getIpAddress,
|
|
51
59
|
getOnrampQuotes: () => getOnrampQuotes,
|
|
52
60
|
getOnrampSessionStartUrl: () => getOnrampSessionStartUrl,
|
|
@@ -61,10 +69,13 @@ __export(index_exports, {
|
|
|
61
69
|
listPaymentIntentExecutions: () => listPaymentIntentExecutions,
|
|
62
70
|
pollDirectExecutions: () => pollDirectExecutions,
|
|
63
71
|
queryExecutions: () => queryExecutions,
|
|
72
|
+
refreshIntegrationToken: () => refreshIntegrationToken,
|
|
64
73
|
retrievePaymentIntent: () => retrievePaymentIntent,
|
|
74
|
+
revokeIntegrationToken: () => revokeIntegrationToken,
|
|
65
75
|
sendHypercoreTransaction: () => sendHypercoreTransaction,
|
|
66
76
|
sendSolanaTransaction: () => sendSolanaTransaction,
|
|
67
77
|
setApiConfig: () => setApiConfig,
|
|
78
|
+
startIntegrationOAuth: () => startIntegrationOAuth,
|
|
68
79
|
useUserIp: () => useUserIp,
|
|
69
80
|
verifyRecipientAddress: () => verifyRecipientAddress
|
|
70
81
|
});
|
|
@@ -139,6 +150,7 @@ async function createDepositAddress(overrides, publishableKey) {
|
|
|
139
150
|
destination_token_address: overrides?.destination_token_address || DEFAULT_CONFIG.destinationTokenAddress || "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
|
|
140
151
|
recipient_address: overrides?.recipient_address || DEFAULT_CONFIG.recipientAddress || "0x309a4154a2CD4153Da886E780890C9cb5161553C",
|
|
141
152
|
...overrides?.action_type ? { action_type: overrides.action_type } : {},
|
|
153
|
+
...overrides?.source_chain_type ? { source_chain_type: overrides.source_chain_type } : {},
|
|
142
154
|
client_metadata: overrides?.client_metadata || {}
|
|
143
155
|
};
|
|
144
156
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
@@ -157,6 +169,26 @@ async function createDepositAddress(overrides, publishableKey) {
|
|
|
157
169
|
}
|
|
158
170
|
return response.json();
|
|
159
171
|
}
|
|
172
|
+
async function getDepositAddress(params, publishableKey) {
|
|
173
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
174
|
+
validatePublishableKey(pk);
|
|
175
|
+
const response = await fetch(
|
|
176
|
+
`${API_BASE_URL}/v1/public/deposit_addresses/existing`,
|
|
177
|
+
{
|
|
178
|
+
method: "POST",
|
|
179
|
+
headers: {
|
|
180
|
+
accept: "application/json",
|
|
181
|
+
"x-publishable-key": pk,
|
|
182
|
+
"Content-Type": "application/json"
|
|
183
|
+
},
|
|
184
|
+
body: JSON.stringify(params)
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
if (!response.ok) {
|
|
188
|
+
throw new Error(`Failed to get deposit addresses: ${response.statusText}`);
|
|
189
|
+
}
|
|
190
|
+
return response.json();
|
|
191
|
+
}
|
|
160
192
|
function getWalletByChainType(wallets, chainType) {
|
|
161
193
|
return wallets.find((wallet) => wallet.chain_type === chainType);
|
|
162
194
|
}
|
|
@@ -617,6 +649,165 @@ function getExchangeSessionStartUrl(request, publishableKey) {
|
|
|
617
649
|
}
|
|
618
650
|
return `${API_BASE_URL}/v1/public/onramps/exchanges/sessions/start?${params.toString()}`;
|
|
619
651
|
}
|
|
652
|
+
async function getIntegrationExchanges(publishableKey) {
|
|
653
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
654
|
+
validatePublishableKey(pk);
|
|
655
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/integrations/oauth/exchanges`, {
|
|
656
|
+
method: "GET",
|
|
657
|
+
headers: {
|
|
658
|
+
accept: "application/json",
|
|
659
|
+
"x-publishable-key": pk
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
if (!response.ok) {
|
|
663
|
+
throw new Error(`Failed to fetch integration exchanges: ${response.statusText}`);
|
|
664
|
+
}
|
|
665
|
+
return response.json();
|
|
666
|
+
}
|
|
667
|
+
async function startIntegrationOAuth(publishableKey) {
|
|
668
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
669
|
+
validatePublishableKey(pk);
|
|
670
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/integrations/oauth/coinbase/start`, {
|
|
671
|
+
method: "POST",
|
|
672
|
+
headers: {
|
|
673
|
+
accept: "application/json",
|
|
674
|
+
"x-publishable-key": pk,
|
|
675
|
+
"Content-Type": "application/json"
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
if (!response.ok) {
|
|
679
|
+
throw new Error(`Failed to start OAuth: ${response.statusText}`);
|
|
680
|
+
}
|
|
681
|
+
return response.json();
|
|
682
|
+
}
|
|
683
|
+
var IntegrationProvider = /* @__PURE__ */ ((IntegrationProvider2) => {
|
|
684
|
+
IntegrationProvider2["COINBASE"] = "coinbase";
|
|
685
|
+
return IntegrationProvider2;
|
|
686
|
+
})(IntegrationProvider || {});
|
|
687
|
+
async function authenticateIntegrationOAuth(params, publishableKey) {
|
|
688
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
689
|
+
validatePublishableKey(pk);
|
|
690
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/integrations/oauth/authenticate`, {
|
|
691
|
+
method: "POST",
|
|
692
|
+
headers: {
|
|
693
|
+
accept: "application/json",
|
|
694
|
+
"x-publishable-key": pk,
|
|
695
|
+
"Content-Type": "application/json"
|
|
696
|
+
},
|
|
697
|
+
body: JSON.stringify(params)
|
|
698
|
+
});
|
|
699
|
+
if (!response.ok) {
|
|
700
|
+
throw new Error(`Failed to authenticate OAuth: ${response.statusText}`);
|
|
701
|
+
}
|
|
702
|
+
return response.json();
|
|
703
|
+
}
|
|
704
|
+
async function refreshIntegrationToken(accessToken, publishableKey) {
|
|
705
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
706
|
+
validatePublishableKey(pk);
|
|
707
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/integrations/token/refresh`, {
|
|
708
|
+
method: "POST",
|
|
709
|
+
headers: {
|
|
710
|
+
accept: "application/json",
|
|
711
|
+
"x-publishable-key": pk,
|
|
712
|
+
"Content-Type": "application/json"
|
|
713
|
+
},
|
|
714
|
+
body: JSON.stringify({ access_token: accessToken })
|
|
715
|
+
});
|
|
716
|
+
if (!response.ok) {
|
|
717
|
+
throw new Error(`Failed to refresh token: ${response.statusText}`);
|
|
718
|
+
}
|
|
719
|
+
return response.json();
|
|
720
|
+
}
|
|
721
|
+
async function revokeIntegrationToken(accessToken, publishableKey) {
|
|
722
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
723
|
+
validatePublishableKey(pk);
|
|
724
|
+
await fetch(`${API_BASE_URL}/v1/public/integrations/token/revoke`, {
|
|
725
|
+
method: "POST",
|
|
726
|
+
headers: {
|
|
727
|
+
accept: "application/json",
|
|
728
|
+
"x-publishable-key": pk,
|
|
729
|
+
"Content-Type": "application/json"
|
|
730
|
+
},
|
|
731
|
+
body: JSON.stringify({ access_token: accessToken })
|
|
732
|
+
}).catch(() => {
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
async function getIntegrationHoldings(provider, accessToken, publishableKey) {
|
|
736
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
737
|
+
validatePublishableKey(pk);
|
|
738
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/integrations/holdings`, {
|
|
739
|
+
method: "POST",
|
|
740
|
+
headers: {
|
|
741
|
+
accept: "application/json",
|
|
742
|
+
"x-publishable-key": pk,
|
|
743
|
+
"Content-Type": "application/json"
|
|
744
|
+
},
|
|
745
|
+
body: JSON.stringify({
|
|
746
|
+
integration_provider: provider,
|
|
747
|
+
access_token: accessToken
|
|
748
|
+
})
|
|
749
|
+
});
|
|
750
|
+
if (!response.ok) {
|
|
751
|
+
throw new Error(`Failed to fetch holdings: ${response.statusText}`);
|
|
752
|
+
}
|
|
753
|
+
return response.json();
|
|
754
|
+
}
|
|
755
|
+
async function createIntegrationTransfer(params, publishableKey) {
|
|
756
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
757
|
+
validatePublishableKey(pk);
|
|
758
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/integrations/transfers`, {
|
|
759
|
+
method: "POST",
|
|
760
|
+
headers: {
|
|
761
|
+
accept: "application/json",
|
|
762
|
+
"x-publishable-key": pk,
|
|
763
|
+
"Content-Type": "application/json"
|
|
764
|
+
},
|
|
765
|
+
body: JSON.stringify(params)
|
|
766
|
+
});
|
|
767
|
+
if (!response.ok) {
|
|
768
|
+
const err = await response.json().catch(() => ({ message: response.statusText }));
|
|
769
|
+
throw new Error(`Failed to create transfer: ${err.message || response.statusText}`);
|
|
770
|
+
}
|
|
771
|
+
return response.json();
|
|
772
|
+
}
|
|
773
|
+
async function confirmIntegrationTransfer(transferId, accessToken, mfaCode, publishableKey) {
|
|
774
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
775
|
+
validatePublishableKey(pk);
|
|
776
|
+
const body = { access_token: accessToken };
|
|
777
|
+
if (mfaCode) body.mfa_code = mfaCode;
|
|
778
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/integrations/transfers/${transferId}/confirm`, {
|
|
779
|
+
method: "POST",
|
|
780
|
+
headers: {
|
|
781
|
+
accept: "application/json",
|
|
782
|
+
"x-publishable-key": pk,
|
|
783
|
+
"Content-Type": "application/json"
|
|
784
|
+
},
|
|
785
|
+
body: JSON.stringify(body)
|
|
786
|
+
});
|
|
787
|
+
if (!response.ok) {
|
|
788
|
+
const err = await response.json().catch(() => ({ message: response.statusText }));
|
|
789
|
+
throw new Error(`Failed to confirm transfer: ${err.message || response.statusText}`);
|
|
790
|
+
}
|
|
791
|
+
return response.json();
|
|
792
|
+
}
|
|
793
|
+
async function getIntegrationTransferDefaultToken(params, publishableKey) {
|
|
794
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
795
|
+
validatePublishableKey(pk);
|
|
796
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/integrations/transfers/default_token`, {
|
|
797
|
+
method: "POST",
|
|
798
|
+
headers: {
|
|
799
|
+
accept: "application/json",
|
|
800
|
+
"x-publishable-key": pk,
|
|
801
|
+
"Content-Type": "application/json"
|
|
802
|
+
},
|
|
803
|
+
body: JSON.stringify(params)
|
|
804
|
+
});
|
|
805
|
+
if (!response.ok) {
|
|
806
|
+
const err = await response.json().catch(() => ({ message: response.statusText }));
|
|
807
|
+
throw new Error(`Failed to get transfer default token: ${err.message || response.statusText}`);
|
|
808
|
+
}
|
|
809
|
+
return response.json();
|
|
810
|
+
}
|
|
620
811
|
async function buildSolanaTransaction(request, publishableKey) {
|
|
621
812
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
622
813
|
validatePublishableKey(pk);
|
|
@@ -1015,13 +1206,17 @@ var i18n = en_default;
|
|
|
1015
1206
|
DepositEventType,
|
|
1016
1207
|
ExecutionStatus,
|
|
1017
1208
|
IneligibilityReason,
|
|
1209
|
+
IntegrationProvider,
|
|
1018
1210
|
SOLANA_USDC_ADDRESS,
|
|
1211
|
+
authenticateIntegrationOAuth,
|
|
1019
1212
|
buildHypercoreTransaction,
|
|
1020
1213
|
buildSolanaTransaction,
|
|
1021
1214
|
checkHypercoreActivation,
|
|
1215
|
+
confirmIntegrationTransfer,
|
|
1022
1216
|
createCashAppSession,
|
|
1023
1217
|
createDepositAddress,
|
|
1024
1218
|
createExchangeSession,
|
|
1219
|
+
createIntegrationTransfer,
|
|
1025
1220
|
createOnrampSession,
|
|
1026
1221
|
formatStablecoinAmount,
|
|
1027
1222
|
generatePrefixedKSUID,
|
|
@@ -1032,12 +1227,16 @@ var i18n = en_default;
|
|
|
1032
1227
|
getCashAppSessionStatus,
|
|
1033
1228
|
getChainName,
|
|
1034
1229
|
getDefaultOnrampToken,
|
|
1230
|
+
getDepositAddress,
|
|
1035
1231
|
getDepositQuote,
|
|
1036
1232
|
getExchangeSessionStartUrl,
|
|
1037
1233
|
getExchanges,
|
|
1038
1234
|
getFiatCurrencies,
|
|
1039
1235
|
getIconUrl,
|
|
1040
1236
|
getIconUrlWithCdn,
|
|
1237
|
+
getIntegrationExchanges,
|
|
1238
|
+
getIntegrationHoldings,
|
|
1239
|
+
getIntegrationTransferDefaultToken,
|
|
1041
1240
|
getIpAddress,
|
|
1042
1241
|
getOnrampQuotes,
|
|
1043
1242
|
getOnrampSessionStartUrl,
|
|
@@ -1052,10 +1251,13 @@ var i18n = en_default;
|
|
|
1052
1251
|
listPaymentIntentExecutions,
|
|
1053
1252
|
pollDirectExecutions,
|
|
1054
1253
|
queryExecutions,
|
|
1254
|
+
refreshIntegrationToken,
|
|
1055
1255
|
retrievePaymentIntent,
|
|
1256
|
+
revokeIntegrationToken,
|
|
1056
1257
|
sendHypercoreTransaction,
|
|
1057
1258
|
sendSolanaTransaction,
|
|
1058
1259
|
setApiConfig,
|
|
1260
|
+
startIntegrationOAuth,
|
|
1059
1261
|
useUserIp,
|
|
1060
1262
|
verifyRecipientAddress
|
|
1061
1263
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -67,6 +67,7 @@ async function createDepositAddress(overrides, publishableKey) {
|
|
|
67
67
|
destination_token_address: overrides?.destination_token_address || DEFAULT_CONFIG.destinationTokenAddress || "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
|
|
68
68
|
recipient_address: overrides?.recipient_address || DEFAULT_CONFIG.recipientAddress || "0x309a4154a2CD4153Da886E780890C9cb5161553C",
|
|
69
69
|
...overrides?.action_type ? { action_type: overrides.action_type } : {},
|
|
70
|
+
...overrides?.source_chain_type ? { source_chain_type: overrides.source_chain_type } : {},
|
|
70
71
|
client_metadata: overrides?.client_metadata || {}
|
|
71
72
|
};
|
|
72
73
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
@@ -85,6 +86,26 @@ async function createDepositAddress(overrides, publishableKey) {
|
|
|
85
86
|
}
|
|
86
87
|
return response.json();
|
|
87
88
|
}
|
|
89
|
+
async function getDepositAddress(params, publishableKey) {
|
|
90
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
91
|
+
validatePublishableKey(pk);
|
|
92
|
+
const response = await fetch(
|
|
93
|
+
`${API_BASE_URL}/v1/public/deposit_addresses/existing`,
|
|
94
|
+
{
|
|
95
|
+
method: "POST",
|
|
96
|
+
headers: {
|
|
97
|
+
accept: "application/json",
|
|
98
|
+
"x-publishable-key": pk,
|
|
99
|
+
"Content-Type": "application/json"
|
|
100
|
+
},
|
|
101
|
+
body: JSON.stringify(params)
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
if (!response.ok) {
|
|
105
|
+
throw new Error(`Failed to get deposit addresses: ${response.statusText}`);
|
|
106
|
+
}
|
|
107
|
+
return response.json();
|
|
108
|
+
}
|
|
88
109
|
function getWalletByChainType(wallets, chainType) {
|
|
89
110
|
return wallets.find((wallet) => wallet.chain_type === chainType);
|
|
90
111
|
}
|
|
@@ -545,6 +566,165 @@ function getExchangeSessionStartUrl(request, publishableKey) {
|
|
|
545
566
|
}
|
|
546
567
|
return `${API_BASE_URL}/v1/public/onramps/exchanges/sessions/start?${params.toString()}`;
|
|
547
568
|
}
|
|
569
|
+
async function getIntegrationExchanges(publishableKey) {
|
|
570
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
571
|
+
validatePublishableKey(pk);
|
|
572
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/integrations/oauth/exchanges`, {
|
|
573
|
+
method: "GET",
|
|
574
|
+
headers: {
|
|
575
|
+
accept: "application/json",
|
|
576
|
+
"x-publishable-key": pk
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
if (!response.ok) {
|
|
580
|
+
throw new Error(`Failed to fetch integration exchanges: ${response.statusText}`);
|
|
581
|
+
}
|
|
582
|
+
return response.json();
|
|
583
|
+
}
|
|
584
|
+
async function startIntegrationOAuth(publishableKey) {
|
|
585
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
586
|
+
validatePublishableKey(pk);
|
|
587
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/integrations/oauth/coinbase/start`, {
|
|
588
|
+
method: "POST",
|
|
589
|
+
headers: {
|
|
590
|
+
accept: "application/json",
|
|
591
|
+
"x-publishable-key": pk,
|
|
592
|
+
"Content-Type": "application/json"
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
if (!response.ok) {
|
|
596
|
+
throw new Error(`Failed to start OAuth: ${response.statusText}`);
|
|
597
|
+
}
|
|
598
|
+
return response.json();
|
|
599
|
+
}
|
|
600
|
+
var IntegrationProvider = /* @__PURE__ */ ((IntegrationProvider2) => {
|
|
601
|
+
IntegrationProvider2["COINBASE"] = "coinbase";
|
|
602
|
+
return IntegrationProvider2;
|
|
603
|
+
})(IntegrationProvider || {});
|
|
604
|
+
async function authenticateIntegrationOAuth(params, publishableKey) {
|
|
605
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
606
|
+
validatePublishableKey(pk);
|
|
607
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/integrations/oauth/authenticate`, {
|
|
608
|
+
method: "POST",
|
|
609
|
+
headers: {
|
|
610
|
+
accept: "application/json",
|
|
611
|
+
"x-publishable-key": pk,
|
|
612
|
+
"Content-Type": "application/json"
|
|
613
|
+
},
|
|
614
|
+
body: JSON.stringify(params)
|
|
615
|
+
});
|
|
616
|
+
if (!response.ok) {
|
|
617
|
+
throw new Error(`Failed to authenticate OAuth: ${response.statusText}`);
|
|
618
|
+
}
|
|
619
|
+
return response.json();
|
|
620
|
+
}
|
|
621
|
+
async function refreshIntegrationToken(accessToken, publishableKey) {
|
|
622
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
623
|
+
validatePublishableKey(pk);
|
|
624
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/integrations/token/refresh`, {
|
|
625
|
+
method: "POST",
|
|
626
|
+
headers: {
|
|
627
|
+
accept: "application/json",
|
|
628
|
+
"x-publishable-key": pk,
|
|
629
|
+
"Content-Type": "application/json"
|
|
630
|
+
},
|
|
631
|
+
body: JSON.stringify({ access_token: accessToken })
|
|
632
|
+
});
|
|
633
|
+
if (!response.ok) {
|
|
634
|
+
throw new Error(`Failed to refresh token: ${response.statusText}`);
|
|
635
|
+
}
|
|
636
|
+
return response.json();
|
|
637
|
+
}
|
|
638
|
+
async function revokeIntegrationToken(accessToken, publishableKey) {
|
|
639
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
640
|
+
validatePublishableKey(pk);
|
|
641
|
+
await fetch(`${API_BASE_URL}/v1/public/integrations/token/revoke`, {
|
|
642
|
+
method: "POST",
|
|
643
|
+
headers: {
|
|
644
|
+
accept: "application/json",
|
|
645
|
+
"x-publishable-key": pk,
|
|
646
|
+
"Content-Type": "application/json"
|
|
647
|
+
},
|
|
648
|
+
body: JSON.stringify({ access_token: accessToken })
|
|
649
|
+
}).catch(() => {
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
async function getIntegrationHoldings(provider, accessToken, publishableKey) {
|
|
653
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
654
|
+
validatePublishableKey(pk);
|
|
655
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/integrations/holdings`, {
|
|
656
|
+
method: "POST",
|
|
657
|
+
headers: {
|
|
658
|
+
accept: "application/json",
|
|
659
|
+
"x-publishable-key": pk,
|
|
660
|
+
"Content-Type": "application/json"
|
|
661
|
+
},
|
|
662
|
+
body: JSON.stringify({
|
|
663
|
+
integration_provider: provider,
|
|
664
|
+
access_token: accessToken
|
|
665
|
+
})
|
|
666
|
+
});
|
|
667
|
+
if (!response.ok) {
|
|
668
|
+
throw new Error(`Failed to fetch holdings: ${response.statusText}`);
|
|
669
|
+
}
|
|
670
|
+
return response.json();
|
|
671
|
+
}
|
|
672
|
+
async function createIntegrationTransfer(params, publishableKey) {
|
|
673
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
674
|
+
validatePublishableKey(pk);
|
|
675
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/integrations/transfers`, {
|
|
676
|
+
method: "POST",
|
|
677
|
+
headers: {
|
|
678
|
+
accept: "application/json",
|
|
679
|
+
"x-publishable-key": pk,
|
|
680
|
+
"Content-Type": "application/json"
|
|
681
|
+
},
|
|
682
|
+
body: JSON.stringify(params)
|
|
683
|
+
});
|
|
684
|
+
if (!response.ok) {
|
|
685
|
+
const err = await response.json().catch(() => ({ message: response.statusText }));
|
|
686
|
+
throw new Error(`Failed to create transfer: ${err.message || response.statusText}`);
|
|
687
|
+
}
|
|
688
|
+
return response.json();
|
|
689
|
+
}
|
|
690
|
+
async function confirmIntegrationTransfer(transferId, accessToken, mfaCode, publishableKey) {
|
|
691
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
692
|
+
validatePublishableKey(pk);
|
|
693
|
+
const body = { access_token: accessToken };
|
|
694
|
+
if (mfaCode) body.mfa_code = mfaCode;
|
|
695
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/integrations/transfers/${transferId}/confirm`, {
|
|
696
|
+
method: "POST",
|
|
697
|
+
headers: {
|
|
698
|
+
accept: "application/json",
|
|
699
|
+
"x-publishable-key": pk,
|
|
700
|
+
"Content-Type": "application/json"
|
|
701
|
+
},
|
|
702
|
+
body: JSON.stringify(body)
|
|
703
|
+
});
|
|
704
|
+
if (!response.ok) {
|
|
705
|
+
const err = await response.json().catch(() => ({ message: response.statusText }));
|
|
706
|
+
throw new Error(`Failed to confirm transfer: ${err.message || response.statusText}`);
|
|
707
|
+
}
|
|
708
|
+
return response.json();
|
|
709
|
+
}
|
|
710
|
+
async function getIntegrationTransferDefaultToken(params, publishableKey) {
|
|
711
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
712
|
+
validatePublishableKey(pk);
|
|
713
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/integrations/transfers/default_token`, {
|
|
714
|
+
method: "POST",
|
|
715
|
+
headers: {
|
|
716
|
+
accept: "application/json",
|
|
717
|
+
"x-publishable-key": pk,
|
|
718
|
+
"Content-Type": "application/json"
|
|
719
|
+
},
|
|
720
|
+
body: JSON.stringify(params)
|
|
721
|
+
});
|
|
722
|
+
if (!response.ok) {
|
|
723
|
+
const err = await response.json().catch(() => ({ message: response.statusText }));
|
|
724
|
+
throw new Error(`Failed to get transfer default token: ${err.message || response.statusText}`);
|
|
725
|
+
}
|
|
726
|
+
return response.json();
|
|
727
|
+
}
|
|
548
728
|
async function buildSolanaTransaction(request, publishableKey) {
|
|
549
729
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
550
730
|
validatePublishableKey(pk);
|
|
@@ -942,13 +1122,17 @@ export {
|
|
|
942
1122
|
DepositEventType,
|
|
943
1123
|
ExecutionStatus,
|
|
944
1124
|
IneligibilityReason,
|
|
1125
|
+
IntegrationProvider,
|
|
945
1126
|
SOLANA_USDC_ADDRESS,
|
|
1127
|
+
authenticateIntegrationOAuth,
|
|
946
1128
|
buildHypercoreTransaction,
|
|
947
1129
|
buildSolanaTransaction,
|
|
948
1130
|
checkHypercoreActivation,
|
|
1131
|
+
confirmIntegrationTransfer,
|
|
949
1132
|
createCashAppSession,
|
|
950
1133
|
createDepositAddress,
|
|
951
1134
|
createExchangeSession,
|
|
1135
|
+
createIntegrationTransfer,
|
|
952
1136
|
createOnrampSession,
|
|
953
1137
|
formatStablecoinAmount,
|
|
954
1138
|
generatePrefixedKSUID,
|
|
@@ -959,12 +1143,16 @@ export {
|
|
|
959
1143
|
getCashAppSessionStatus,
|
|
960
1144
|
getChainName,
|
|
961
1145
|
getDefaultOnrampToken,
|
|
1146
|
+
getDepositAddress,
|
|
962
1147
|
getDepositQuote,
|
|
963
1148
|
getExchangeSessionStartUrl,
|
|
964
1149
|
getExchanges,
|
|
965
1150
|
getFiatCurrencies,
|
|
966
1151
|
getIconUrl,
|
|
967
1152
|
getIconUrlWithCdn,
|
|
1153
|
+
getIntegrationExchanges,
|
|
1154
|
+
getIntegrationHoldings,
|
|
1155
|
+
getIntegrationTransferDefaultToken,
|
|
968
1156
|
getIpAddress,
|
|
969
1157
|
getOnrampQuotes,
|
|
970
1158
|
getOnrampSessionStartUrl,
|
|
@@ -979,10 +1167,13 @@ export {
|
|
|
979
1167
|
listPaymentIntentExecutions,
|
|
980
1168
|
pollDirectExecutions,
|
|
981
1169
|
queryExecutions,
|
|
1170
|
+
refreshIntegrationToken,
|
|
982
1171
|
retrievePaymentIntent,
|
|
1172
|
+
revokeIntegrationToken,
|
|
983
1173
|
sendHypercoreTransaction,
|
|
984
1174
|
sendSolanaTransaction,
|
|
985
1175
|
setApiConfig,
|
|
1176
|
+
startIntegrationOAuth,
|
|
986
1177
|
useUserIp,
|
|
987
1178
|
verifyRecipientAddress
|
|
988
1179
|
};
|