@unifold/core 0.1.42 → 0.1.43
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 +109 -1
- package/dist/index.d.ts +109 -1
- package/dist/index.js +123 -0
- package/dist/index.mjs +118 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -631,6 +631,114 @@ interface SendSolanaTransactionResponse {
|
|
|
631
631
|
* @returns Transaction signature (hash) that can be used to track the transaction
|
|
632
632
|
*/
|
|
633
633
|
declare function sendSolanaTransaction(request: SendSolanaTransactionRequest, publishableKey?: string): Promise<SendSolanaTransactionResponse>;
|
|
634
|
+
interface PaymentIntentDepositAddress {
|
|
635
|
+
id: string;
|
|
636
|
+
chain_type: ChainType;
|
|
637
|
+
address_type: string | null;
|
|
638
|
+
address: string;
|
|
639
|
+
}
|
|
640
|
+
interface PaymentIntent {
|
|
641
|
+
id: string;
|
|
642
|
+
user_id: string | null;
|
|
643
|
+
amount: string;
|
|
644
|
+
amount_usd: string;
|
|
645
|
+
amount_received: string;
|
|
646
|
+
amount_received_usd: string;
|
|
647
|
+
currency: string;
|
|
648
|
+
status: string;
|
|
649
|
+
client_secret: string;
|
|
650
|
+
destination_network: string | null;
|
|
651
|
+
destination_chain_type: ChainType;
|
|
652
|
+
destination_chain_id: string;
|
|
653
|
+
destination_token_address: string;
|
|
654
|
+
recipient_address: string;
|
|
655
|
+
destination_token_decimals: number;
|
|
656
|
+
deposit_addresses: PaymentIntentDepositAddress[];
|
|
657
|
+
metadata: Record<string, string> | null;
|
|
658
|
+
description: string | null;
|
|
659
|
+
livemode: boolean;
|
|
660
|
+
settlement_tolerance_percent: number;
|
|
661
|
+
canceled_at: string | null;
|
|
662
|
+
cancellation_reason: string | null;
|
|
663
|
+
expires_at: string | null;
|
|
664
|
+
created_at: string;
|
|
665
|
+
updated_at: string;
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Retrieve a payment intent by its client secret.
|
|
669
|
+
* Uses the public endpoint that requires a publishable key header.
|
|
670
|
+
*/
|
|
671
|
+
declare function retrievePaymentIntent(clientSecret: string, publishableKey?: string): Promise<PaymentIntent>;
|
|
672
|
+
interface PaymentIntentExecutionsResponse {
|
|
673
|
+
data: AutoSwapResponse[];
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* List all executions (deposits/swaps) for a payment intent.
|
|
677
|
+
* Authenticates via client_secret and publishable key.
|
|
678
|
+
*/
|
|
679
|
+
declare function listPaymentIntentExecutions(clientSecret: string, publishableKey?: string): Promise<PaymentIntentExecutionsResponse>;
|
|
680
|
+
interface DepositQuoteRequest {
|
|
681
|
+
source_chain_type: string;
|
|
682
|
+
source_chain_id: string;
|
|
683
|
+
source_token_address: string;
|
|
684
|
+
destination_amount: string;
|
|
685
|
+
destination_chain_type: string;
|
|
686
|
+
destination_chain_id: string;
|
|
687
|
+
destination_token_address: string;
|
|
688
|
+
}
|
|
689
|
+
interface DepositQuote {
|
|
690
|
+
source_amount: string;
|
|
691
|
+
source_amount_usd: string | null;
|
|
692
|
+
source_token_decimals: number;
|
|
693
|
+
source_token_symbol: string;
|
|
694
|
+
destination_amount: string;
|
|
695
|
+
destination_amount_usd: string | null;
|
|
696
|
+
destination_token_decimals: number;
|
|
697
|
+
destination_token_symbol: string;
|
|
698
|
+
estimated_price_impact_percent: number | null;
|
|
699
|
+
estimated_fees_usd: string | null;
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* Get a deposit quote: how much source token is needed to receive a
|
|
703
|
+
* specific destination amount, accounting for bridge fees and slippage.
|
|
704
|
+
* Results are cached server-side for 1 minute.
|
|
705
|
+
*/
|
|
706
|
+
declare function getDepositQuote(request: DepositQuoteRequest, publishableKey?: string): Promise<DepositQuote>;
|
|
707
|
+
type HypercoreActionType = "spot_send" | "usd_send";
|
|
708
|
+
interface BuildHypercoreTransactionRequest {
|
|
709
|
+
action_type: HypercoreActionType;
|
|
710
|
+
signature_chain_type: string;
|
|
711
|
+
signature_chain_id: string;
|
|
712
|
+
recipient_address: string;
|
|
713
|
+
token_address: string;
|
|
714
|
+
token_symbol?: string;
|
|
715
|
+
amount: string;
|
|
716
|
+
}
|
|
717
|
+
interface BuildHypercoreTransactionResponse {
|
|
718
|
+
typed_data: Record<string, unknown>;
|
|
719
|
+
action_payload: Record<string, unknown>;
|
|
720
|
+
nonce: number;
|
|
721
|
+
}
|
|
722
|
+
interface SendHypercoreTransactionRequest {
|
|
723
|
+
action_payload: Record<string, unknown>;
|
|
724
|
+
signature: string;
|
|
725
|
+
nonce: number;
|
|
726
|
+
}
|
|
727
|
+
interface SendHypercoreTransactionResponse {
|
|
728
|
+
status: string;
|
|
729
|
+
response?: unknown;
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Build EIP-712 typed data + action for a HyperCore transaction.
|
|
733
|
+
* Returns everything the frontend needs to sign and then submit.
|
|
734
|
+
*/
|
|
735
|
+
declare function buildHypercoreTransaction(request: BuildHypercoreTransactionRequest, publishableKey?: string): Promise<BuildHypercoreTransactionResponse>;
|
|
736
|
+
/**
|
|
737
|
+
* Send a signed HyperCore transaction via the backend proxy.
|
|
738
|
+
* Pass the action + nonce from buildHypercoreTransaction and
|
|
739
|
+
* the signature from eth_signTypedData_v4.
|
|
740
|
+
*/
|
|
741
|
+
declare function sendHypercoreTransaction(request: SendHypercoreTransactionRequest, publishableKey?: string): Promise<SendHypercoreTransactionResponse>;
|
|
634
742
|
|
|
635
743
|
/**
|
|
636
744
|
* User IP information interface
|
|
@@ -752,4 +860,4 @@ declare const i18n: {
|
|
|
752
860
|
};
|
|
753
861
|
type I18nStrings = typeof i18n;
|
|
754
862
|
|
|
755
|
-
export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AutoSwapRequest, type AutoSwapResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type ChainType, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, type DestinationToken, type DestinationTokenChain, type ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type FeaturedToken, type FiatCurrenciesResponse, type FiatCurrency, type GetExchangesQuery, type I18nStrings, type IconUrl, IneligibilityReason, type IpAddressResponse, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionRequest, type OnrampSessionResponse, type PaymentNetwork, type PollExecutionsRequest, type PollExecutionsResponse, type ProjectConfigResponse, type QueryExecutionsRequest, type QueryExecutionsResponse, SOLANA_USDC_ADDRESS, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SupportedChain, type SupportedDepositTokensResponse, type SupportedDestinationTokensResponse, type SupportedToken, type TokenBalance, type TokenChain, type TokenChainIconUrl, type TokenChainsResponse, type TokenIconUrl, type TokenInfo, type TokenMetadata, type UserIpInfo, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, buildSolanaTransaction, createDepositAddress, createExchangeSession, createOnrampSession, getAddressBalance, getAddressBalances, getApiBaseUrl, getChainName, getDefaultOnrampToken, getExchangeSessionStartUrl, getExchanges, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, i18n, pollDirectExecutions, queryExecutions, sendSolanaTransaction, setApiConfig, useUserIp, verifyRecipientAddress };
|
|
863
|
+
export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AutoSwapRequest, type AutoSwapResponse, type BuildHypercoreTransactionRequest, type BuildHypercoreTransactionResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type ChainType, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, type DepositQuote, type DepositQuoteRequest, type DestinationToken, type DestinationTokenChain, type ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type FeaturedToken, type FiatCurrenciesResponse, type FiatCurrency, type GetExchangesQuery, type HypercoreActionType, type I18nStrings, type IconUrl, IneligibilityReason, type IpAddressResponse, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionRequest, type OnrampSessionResponse, type PaymentIntent, type PaymentIntentDepositAddress, type PaymentIntentExecutionsResponse, type PaymentNetwork, type PollExecutionsRequest, type PollExecutionsResponse, type ProjectConfigResponse, type QueryExecutionsRequest, type QueryExecutionsResponse, SOLANA_USDC_ADDRESS, type SendHypercoreTransactionRequest, type SendHypercoreTransactionResponse, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SupportedChain, type SupportedDepositTokensResponse, type SupportedDestinationTokensResponse, 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, createDepositAddress, createExchangeSession, createOnrampSession, getAddressBalance, getAddressBalances, getApiBaseUrl, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -631,6 +631,114 @@ interface SendSolanaTransactionResponse {
|
|
|
631
631
|
* @returns Transaction signature (hash) that can be used to track the transaction
|
|
632
632
|
*/
|
|
633
633
|
declare function sendSolanaTransaction(request: SendSolanaTransactionRequest, publishableKey?: string): Promise<SendSolanaTransactionResponse>;
|
|
634
|
+
interface PaymentIntentDepositAddress {
|
|
635
|
+
id: string;
|
|
636
|
+
chain_type: ChainType;
|
|
637
|
+
address_type: string | null;
|
|
638
|
+
address: string;
|
|
639
|
+
}
|
|
640
|
+
interface PaymentIntent {
|
|
641
|
+
id: string;
|
|
642
|
+
user_id: string | null;
|
|
643
|
+
amount: string;
|
|
644
|
+
amount_usd: string;
|
|
645
|
+
amount_received: string;
|
|
646
|
+
amount_received_usd: string;
|
|
647
|
+
currency: string;
|
|
648
|
+
status: string;
|
|
649
|
+
client_secret: string;
|
|
650
|
+
destination_network: string | null;
|
|
651
|
+
destination_chain_type: ChainType;
|
|
652
|
+
destination_chain_id: string;
|
|
653
|
+
destination_token_address: string;
|
|
654
|
+
recipient_address: string;
|
|
655
|
+
destination_token_decimals: number;
|
|
656
|
+
deposit_addresses: PaymentIntentDepositAddress[];
|
|
657
|
+
metadata: Record<string, string> | null;
|
|
658
|
+
description: string | null;
|
|
659
|
+
livemode: boolean;
|
|
660
|
+
settlement_tolerance_percent: number;
|
|
661
|
+
canceled_at: string | null;
|
|
662
|
+
cancellation_reason: string | null;
|
|
663
|
+
expires_at: string | null;
|
|
664
|
+
created_at: string;
|
|
665
|
+
updated_at: string;
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Retrieve a payment intent by its client secret.
|
|
669
|
+
* Uses the public endpoint that requires a publishable key header.
|
|
670
|
+
*/
|
|
671
|
+
declare function retrievePaymentIntent(clientSecret: string, publishableKey?: string): Promise<PaymentIntent>;
|
|
672
|
+
interface PaymentIntentExecutionsResponse {
|
|
673
|
+
data: AutoSwapResponse[];
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* List all executions (deposits/swaps) for a payment intent.
|
|
677
|
+
* Authenticates via client_secret and publishable key.
|
|
678
|
+
*/
|
|
679
|
+
declare function listPaymentIntentExecutions(clientSecret: string, publishableKey?: string): Promise<PaymentIntentExecutionsResponse>;
|
|
680
|
+
interface DepositQuoteRequest {
|
|
681
|
+
source_chain_type: string;
|
|
682
|
+
source_chain_id: string;
|
|
683
|
+
source_token_address: string;
|
|
684
|
+
destination_amount: string;
|
|
685
|
+
destination_chain_type: string;
|
|
686
|
+
destination_chain_id: string;
|
|
687
|
+
destination_token_address: string;
|
|
688
|
+
}
|
|
689
|
+
interface DepositQuote {
|
|
690
|
+
source_amount: string;
|
|
691
|
+
source_amount_usd: string | null;
|
|
692
|
+
source_token_decimals: number;
|
|
693
|
+
source_token_symbol: string;
|
|
694
|
+
destination_amount: string;
|
|
695
|
+
destination_amount_usd: string | null;
|
|
696
|
+
destination_token_decimals: number;
|
|
697
|
+
destination_token_symbol: string;
|
|
698
|
+
estimated_price_impact_percent: number | null;
|
|
699
|
+
estimated_fees_usd: string | null;
|
|
700
|
+
}
|
|
701
|
+
/**
|
|
702
|
+
* Get a deposit quote: how much source token is needed to receive a
|
|
703
|
+
* specific destination amount, accounting for bridge fees and slippage.
|
|
704
|
+
* Results are cached server-side for 1 minute.
|
|
705
|
+
*/
|
|
706
|
+
declare function getDepositQuote(request: DepositQuoteRequest, publishableKey?: string): Promise<DepositQuote>;
|
|
707
|
+
type HypercoreActionType = "spot_send" | "usd_send";
|
|
708
|
+
interface BuildHypercoreTransactionRequest {
|
|
709
|
+
action_type: HypercoreActionType;
|
|
710
|
+
signature_chain_type: string;
|
|
711
|
+
signature_chain_id: string;
|
|
712
|
+
recipient_address: string;
|
|
713
|
+
token_address: string;
|
|
714
|
+
token_symbol?: string;
|
|
715
|
+
amount: string;
|
|
716
|
+
}
|
|
717
|
+
interface BuildHypercoreTransactionResponse {
|
|
718
|
+
typed_data: Record<string, unknown>;
|
|
719
|
+
action_payload: Record<string, unknown>;
|
|
720
|
+
nonce: number;
|
|
721
|
+
}
|
|
722
|
+
interface SendHypercoreTransactionRequest {
|
|
723
|
+
action_payload: Record<string, unknown>;
|
|
724
|
+
signature: string;
|
|
725
|
+
nonce: number;
|
|
726
|
+
}
|
|
727
|
+
interface SendHypercoreTransactionResponse {
|
|
728
|
+
status: string;
|
|
729
|
+
response?: unknown;
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Build EIP-712 typed data + action for a HyperCore transaction.
|
|
733
|
+
* Returns everything the frontend needs to sign and then submit.
|
|
734
|
+
*/
|
|
735
|
+
declare function buildHypercoreTransaction(request: BuildHypercoreTransactionRequest, publishableKey?: string): Promise<BuildHypercoreTransactionResponse>;
|
|
736
|
+
/**
|
|
737
|
+
* Send a signed HyperCore transaction via the backend proxy.
|
|
738
|
+
* Pass the action + nonce from buildHypercoreTransaction and
|
|
739
|
+
* the signature from eth_signTypedData_v4.
|
|
740
|
+
*/
|
|
741
|
+
declare function sendHypercoreTransaction(request: SendHypercoreTransactionRequest, publishableKey?: string): Promise<SendHypercoreTransactionResponse>;
|
|
634
742
|
|
|
635
743
|
/**
|
|
636
744
|
* User IP information interface
|
|
@@ -752,4 +860,4 @@ declare const i18n: {
|
|
|
752
860
|
};
|
|
753
861
|
type I18nStrings = typeof i18n;
|
|
754
862
|
|
|
755
|
-
export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AutoSwapRequest, type AutoSwapResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type ChainType, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, type DestinationToken, type DestinationTokenChain, type ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type FeaturedToken, type FiatCurrenciesResponse, type FiatCurrency, type GetExchangesQuery, type I18nStrings, type IconUrl, IneligibilityReason, type IpAddressResponse, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionRequest, type OnrampSessionResponse, type PaymentNetwork, type PollExecutionsRequest, type PollExecutionsResponse, type ProjectConfigResponse, type QueryExecutionsRequest, type QueryExecutionsResponse, SOLANA_USDC_ADDRESS, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SupportedChain, type SupportedDepositTokensResponse, type SupportedDestinationTokensResponse, type SupportedToken, type TokenBalance, type TokenChain, type TokenChainIconUrl, type TokenChainsResponse, type TokenIconUrl, type TokenInfo, type TokenMetadata, type UserIpInfo, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, buildSolanaTransaction, createDepositAddress, createExchangeSession, createOnrampSession, getAddressBalance, getAddressBalances, getApiBaseUrl, getChainName, getDefaultOnrampToken, getExchangeSessionStartUrl, getExchanges, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getSupportedDestinationTokens, getTokenChains, getTokenMetadata, getWalletByChainType, i18n, pollDirectExecutions, queryExecutions, sendSolanaTransaction, setApiConfig, useUserIp, verifyRecipientAddress };
|
|
863
|
+
export { ActionType, type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AutoSwapRequest, type AutoSwapResponse, type BuildHypercoreTransactionRequest, type BuildHypercoreTransactionResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type ChainType, type CreateDepositAddressRequest, type CreateExchangeSessionRequest, type CreateExchangeSessionResponse, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, type DepositQuote, type DepositQuoteRequest, type DestinationToken, type DestinationTokenChain, type ExchangeProviderInfo, type ExchangeProvidersResponse, type ExchangeSessionStartParams, type ExchangeWalletAddress, ExecutionStatus, type FeaturedToken, type FiatCurrenciesResponse, type FiatCurrency, type GetExchangesQuery, type HypercoreActionType, type I18nStrings, type IconUrl, IneligibilityReason, type IpAddressResponse, type OnrampQuote, type OnrampQuotesRequest, type OnrampQuotesResponse, type OnrampSessionRequest, type OnrampSessionResponse, type PaymentIntent, type PaymentIntentDepositAddress, type PaymentIntentExecutionsResponse, type PaymentNetwork, type PollExecutionsRequest, type PollExecutionsResponse, type ProjectConfigResponse, type QueryExecutionsRequest, type QueryExecutionsResponse, SOLANA_USDC_ADDRESS, type SendHypercoreTransactionRequest, type SendHypercoreTransactionResponse, type SendSolanaTransactionRequest, type SendSolanaTransactionResponse, type SupportedChain, type SupportedDepositTokensResponse, type SupportedDestinationTokensResponse, 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, createDepositAddress, createExchangeSession, createOnrampSession, getAddressBalance, getAddressBalances, getApiBaseUrl, 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 };
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __export(index_exports, {
|
|
|
24
24
|
ExecutionStatus: () => ExecutionStatus,
|
|
25
25
|
IneligibilityReason: () => IneligibilityReason,
|
|
26
26
|
SOLANA_USDC_ADDRESS: () => SOLANA_USDC_ADDRESS,
|
|
27
|
+
buildHypercoreTransaction: () => buildHypercoreTransaction,
|
|
27
28
|
buildSolanaTransaction: () => buildSolanaTransaction,
|
|
28
29
|
createDepositAddress: () => createDepositAddress,
|
|
29
30
|
createExchangeSession: () => createExchangeSession,
|
|
@@ -33,6 +34,7 @@ __export(index_exports, {
|
|
|
33
34
|
getApiBaseUrl: () => getApiBaseUrl,
|
|
34
35
|
getChainName: () => getChainName,
|
|
35
36
|
getDefaultOnrampToken: () => getDefaultOnrampToken,
|
|
37
|
+
getDepositQuote: () => getDepositQuote,
|
|
36
38
|
getExchangeSessionStartUrl: () => getExchangeSessionStartUrl,
|
|
37
39
|
getExchanges: () => getExchanges,
|
|
38
40
|
getFiatCurrencies: () => getFiatCurrencies,
|
|
@@ -49,8 +51,11 @@ __export(index_exports, {
|
|
|
49
51
|
getTokenMetadata: () => getTokenMetadata,
|
|
50
52
|
getWalletByChainType: () => getWalletByChainType,
|
|
51
53
|
i18n: () => i18n,
|
|
54
|
+
listPaymentIntentExecutions: () => listPaymentIntentExecutions,
|
|
52
55
|
pollDirectExecutions: () => pollDirectExecutions,
|
|
53
56
|
queryExecutions: () => queryExecutions,
|
|
57
|
+
retrievePaymentIntent: () => retrievePaymentIntent,
|
|
58
|
+
sendHypercoreTransaction: () => sendHypercoreTransaction,
|
|
54
59
|
sendSolanaTransaction: () => sendSolanaTransaction,
|
|
55
60
|
setApiConfig: () => setApiConfig,
|
|
56
61
|
useUserIp: () => useUserIp,
|
|
@@ -606,6 +611,119 @@ async function sendSolanaTransaction(request, publishableKey) {
|
|
|
606
611
|
}
|
|
607
612
|
return response.json();
|
|
608
613
|
}
|
|
614
|
+
async function retrievePaymentIntent(clientSecret, publishableKey) {
|
|
615
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
616
|
+
validatePublishableKey(pk);
|
|
617
|
+
const response = await fetch(
|
|
618
|
+
`${API_BASE_URL}/v1/public/payment_intents/retrieve`,
|
|
619
|
+
{
|
|
620
|
+
method: "POST",
|
|
621
|
+
headers: {
|
|
622
|
+
accept: "application/json",
|
|
623
|
+
"x-publishable-key": pk,
|
|
624
|
+
"Content-Type": "application/json"
|
|
625
|
+
},
|
|
626
|
+
body: JSON.stringify({ client_secret: clientSecret })
|
|
627
|
+
}
|
|
628
|
+
);
|
|
629
|
+
if (!response.ok) {
|
|
630
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
631
|
+
throw new Error(
|
|
632
|
+
`Failed to retrieve payment intent: ${error.message || response.statusText}`
|
|
633
|
+
);
|
|
634
|
+
}
|
|
635
|
+
return response.json();
|
|
636
|
+
}
|
|
637
|
+
async function listPaymentIntentExecutions(clientSecret, publishableKey) {
|
|
638
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
639
|
+
validatePublishableKey(pk);
|
|
640
|
+
const response = await fetch(
|
|
641
|
+
`${API_BASE_URL}/v1/public/payment_intents/executions`,
|
|
642
|
+
{
|
|
643
|
+
method: "POST",
|
|
644
|
+
headers: {
|
|
645
|
+
accept: "application/json",
|
|
646
|
+
"x-publishable-key": pk,
|
|
647
|
+
"Content-Type": "application/json"
|
|
648
|
+
},
|
|
649
|
+
body: JSON.stringify({ client_secret: clientSecret })
|
|
650
|
+
}
|
|
651
|
+
);
|
|
652
|
+
if (!response.ok) {
|
|
653
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
654
|
+
throw new Error(
|
|
655
|
+
`Failed to list payment intent executions: ${error.message || response.statusText}`
|
|
656
|
+
);
|
|
657
|
+
}
|
|
658
|
+
return response.json();
|
|
659
|
+
}
|
|
660
|
+
async function getDepositQuote(request, publishableKey) {
|
|
661
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
662
|
+
validatePublishableKey(pk);
|
|
663
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/quotes`, {
|
|
664
|
+
method: "POST",
|
|
665
|
+
headers: {
|
|
666
|
+
accept: "application/json",
|
|
667
|
+
"x-publishable-key": pk,
|
|
668
|
+
"Content-Type": "application/json"
|
|
669
|
+
},
|
|
670
|
+
body: JSON.stringify(request)
|
|
671
|
+
});
|
|
672
|
+
if (!response.ok) {
|
|
673
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
674
|
+
throw new Error(
|
|
675
|
+
`Failed to get deposit quote: ${error.message || response.statusText}`
|
|
676
|
+
);
|
|
677
|
+
}
|
|
678
|
+
const json = await response.json();
|
|
679
|
+
return json.data;
|
|
680
|
+
}
|
|
681
|
+
async function buildHypercoreTransaction(request, publishableKey) {
|
|
682
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
683
|
+
validatePublishableKey(pk);
|
|
684
|
+
const response = await fetch(
|
|
685
|
+
`${API_BASE_URL}/v1/public/transactions/hypercore/build`,
|
|
686
|
+
{
|
|
687
|
+
method: "POST",
|
|
688
|
+
headers: {
|
|
689
|
+
accept: "application/json",
|
|
690
|
+
"x-publishable-key": pk,
|
|
691
|
+
"Content-Type": "application/json"
|
|
692
|
+
},
|
|
693
|
+
body: JSON.stringify(request)
|
|
694
|
+
}
|
|
695
|
+
);
|
|
696
|
+
if (!response.ok) {
|
|
697
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
698
|
+
throw new Error(
|
|
699
|
+
`Failed to build HyperCore transaction: ${error.message || response.statusText}`
|
|
700
|
+
);
|
|
701
|
+
}
|
|
702
|
+
return response.json();
|
|
703
|
+
}
|
|
704
|
+
async function sendHypercoreTransaction(request, publishableKey) {
|
|
705
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
706
|
+
validatePublishableKey(pk);
|
|
707
|
+
const response = await fetch(
|
|
708
|
+
`${API_BASE_URL}/v1/public/transactions/hypercore/send`,
|
|
709
|
+
{
|
|
710
|
+
method: "POST",
|
|
711
|
+
headers: {
|
|
712
|
+
accept: "application/json",
|
|
713
|
+
"x-publishable-key": pk,
|
|
714
|
+
"Content-Type": "application/json"
|
|
715
|
+
},
|
|
716
|
+
body: JSON.stringify(request)
|
|
717
|
+
}
|
|
718
|
+
);
|
|
719
|
+
if (!response.ok) {
|
|
720
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
721
|
+
throw new Error(
|
|
722
|
+
`Failed to send HyperCore transaction: ${error.message || response.statusText}`
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
return response.json();
|
|
726
|
+
}
|
|
609
727
|
|
|
610
728
|
// src/hooks/use-user-ip.ts
|
|
611
729
|
var import_react_query = require("@tanstack/react-query");
|
|
@@ -742,6 +860,7 @@ var i18n = en_default;
|
|
|
742
860
|
ExecutionStatus,
|
|
743
861
|
IneligibilityReason,
|
|
744
862
|
SOLANA_USDC_ADDRESS,
|
|
863
|
+
buildHypercoreTransaction,
|
|
745
864
|
buildSolanaTransaction,
|
|
746
865
|
createDepositAddress,
|
|
747
866
|
createExchangeSession,
|
|
@@ -751,6 +870,7 @@ var i18n = en_default;
|
|
|
751
870
|
getApiBaseUrl,
|
|
752
871
|
getChainName,
|
|
753
872
|
getDefaultOnrampToken,
|
|
873
|
+
getDepositQuote,
|
|
754
874
|
getExchangeSessionStartUrl,
|
|
755
875
|
getExchanges,
|
|
756
876
|
getFiatCurrencies,
|
|
@@ -767,8 +887,11 @@ var i18n = en_default;
|
|
|
767
887
|
getTokenMetadata,
|
|
768
888
|
getWalletByChainType,
|
|
769
889
|
i18n,
|
|
890
|
+
listPaymentIntentExecutions,
|
|
770
891
|
pollDirectExecutions,
|
|
771
892
|
queryExecutions,
|
|
893
|
+
retrievePaymentIntent,
|
|
894
|
+
sendHypercoreTransaction,
|
|
772
895
|
sendSolanaTransaction,
|
|
773
896
|
setApiConfig,
|
|
774
897
|
useUserIp,
|
package/dist/index.mjs
CHANGED
|
@@ -546,6 +546,119 @@ async function sendSolanaTransaction(request, publishableKey) {
|
|
|
546
546
|
}
|
|
547
547
|
return response.json();
|
|
548
548
|
}
|
|
549
|
+
async function retrievePaymentIntent(clientSecret, publishableKey) {
|
|
550
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
551
|
+
validatePublishableKey(pk);
|
|
552
|
+
const response = await fetch(
|
|
553
|
+
`${API_BASE_URL}/v1/public/payment_intents/retrieve`,
|
|
554
|
+
{
|
|
555
|
+
method: "POST",
|
|
556
|
+
headers: {
|
|
557
|
+
accept: "application/json",
|
|
558
|
+
"x-publishable-key": pk,
|
|
559
|
+
"Content-Type": "application/json"
|
|
560
|
+
},
|
|
561
|
+
body: JSON.stringify({ client_secret: clientSecret })
|
|
562
|
+
}
|
|
563
|
+
);
|
|
564
|
+
if (!response.ok) {
|
|
565
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
566
|
+
throw new Error(
|
|
567
|
+
`Failed to retrieve payment intent: ${error.message || response.statusText}`
|
|
568
|
+
);
|
|
569
|
+
}
|
|
570
|
+
return response.json();
|
|
571
|
+
}
|
|
572
|
+
async function listPaymentIntentExecutions(clientSecret, publishableKey) {
|
|
573
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
574
|
+
validatePublishableKey(pk);
|
|
575
|
+
const response = await fetch(
|
|
576
|
+
`${API_BASE_URL}/v1/public/payment_intents/executions`,
|
|
577
|
+
{
|
|
578
|
+
method: "POST",
|
|
579
|
+
headers: {
|
|
580
|
+
accept: "application/json",
|
|
581
|
+
"x-publishable-key": pk,
|
|
582
|
+
"Content-Type": "application/json"
|
|
583
|
+
},
|
|
584
|
+
body: JSON.stringify({ client_secret: clientSecret })
|
|
585
|
+
}
|
|
586
|
+
);
|
|
587
|
+
if (!response.ok) {
|
|
588
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
589
|
+
throw new Error(
|
|
590
|
+
`Failed to list payment intent executions: ${error.message || response.statusText}`
|
|
591
|
+
);
|
|
592
|
+
}
|
|
593
|
+
return response.json();
|
|
594
|
+
}
|
|
595
|
+
async function getDepositQuote(request, publishableKey) {
|
|
596
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
597
|
+
validatePublishableKey(pk);
|
|
598
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/quotes`, {
|
|
599
|
+
method: "POST",
|
|
600
|
+
headers: {
|
|
601
|
+
accept: "application/json",
|
|
602
|
+
"x-publishable-key": pk,
|
|
603
|
+
"Content-Type": "application/json"
|
|
604
|
+
},
|
|
605
|
+
body: JSON.stringify(request)
|
|
606
|
+
});
|
|
607
|
+
if (!response.ok) {
|
|
608
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
609
|
+
throw new Error(
|
|
610
|
+
`Failed to get deposit quote: ${error.message || response.statusText}`
|
|
611
|
+
);
|
|
612
|
+
}
|
|
613
|
+
const json = await response.json();
|
|
614
|
+
return json.data;
|
|
615
|
+
}
|
|
616
|
+
async function buildHypercoreTransaction(request, publishableKey) {
|
|
617
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
618
|
+
validatePublishableKey(pk);
|
|
619
|
+
const response = await fetch(
|
|
620
|
+
`${API_BASE_URL}/v1/public/transactions/hypercore/build`,
|
|
621
|
+
{
|
|
622
|
+
method: "POST",
|
|
623
|
+
headers: {
|
|
624
|
+
accept: "application/json",
|
|
625
|
+
"x-publishable-key": pk,
|
|
626
|
+
"Content-Type": "application/json"
|
|
627
|
+
},
|
|
628
|
+
body: JSON.stringify(request)
|
|
629
|
+
}
|
|
630
|
+
);
|
|
631
|
+
if (!response.ok) {
|
|
632
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
633
|
+
throw new Error(
|
|
634
|
+
`Failed to build HyperCore transaction: ${error.message || response.statusText}`
|
|
635
|
+
);
|
|
636
|
+
}
|
|
637
|
+
return response.json();
|
|
638
|
+
}
|
|
639
|
+
async function sendHypercoreTransaction(request, publishableKey) {
|
|
640
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
641
|
+
validatePublishableKey(pk);
|
|
642
|
+
const response = await fetch(
|
|
643
|
+
`${API_BASE_URL}/v1/public/transactions/hypercore/send`,
|
|
644
|
+
{
|
|
645
|
+
method: "POST",
|
|
646
|
+
headers: {
|
|
647
|
+
accept: "application/json",
|
|
648
|
+
"x-publishable-key": pk,
|
|
649
|
+
"Content-Type": "application/json"
|
|
650
|
+
},
|
|
651
|
+
body: JSON.stringify(request)
|
|
652
|
+
}
|
|
653
|
+
);
|
|
654
|
+
if (!response.ok) {
|
|
655
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
656
|
+
throw new Error(
|
|
657
|
+
`Failed to send HyperCore transaction: ${error.message || response.statusText}`
|
|
658
|
+
);
|
|
659
|
+
}
|
|
660
|
+
return response.json();
|
|
661
|
+
}
|
|
549
662
|
|
|
550
663
|
// src/hooks/use-user-ip.ts
|
|
551
664
|
import { useQuery } from "@tanstack/react-query";
|
|
@@ -681,6 +794,7 @@ export {
|
|
|
681
794
|
ExecutionStatus,
|
|
682
795
|
IneligibilityReason,
|
|
683
796
|
SOLANA_USDC_ADDRESS,
|
|
797
|
+
buildHypercoreTransaction,
|
|
684
798
|
buildSolanaTransaction,
|
|
685
799
|
createDepositAddress,
|
|
686
800
|
createExchangeSession,
|
|
@@ -690,6 +804,7 @@ export {
|
|
|
690
804
|
getApiBaseUrl,
|
|
691
805
|
getChainName,
|
|
692
806
|
getDefaultOnrampToken,
|
|
807
|
+
getDepositQuote,
|
|
693
808
|
getExchangeSessionStartUrl,
|
|
694
809
|
getExchanges,
|
|
695
810
|
getFiatCurrencies,
|
|
@@ -706,8 +821,11 @@ export {
|
|
|
706
821
|
getTokenMetadata,
|
|
707
822
|
getWalletByChainType,
|
|
708
823
|
i18n,
|
|
824
|
+
listPaymentIntentExecutions,
|
|
709
825
|
pollDirectExecutions,
|
|
710
826
|
queryExecutions,
|
|
827
|
+
retrievePaymentIntent,
|
|
828
|
+
sendHypercoreTransaction,
|
|
711
829
|
sendSolanaTransaction,
|
|
712
830
|
setApiConfig,
|
|
713
831
|
useUserIp,
|