@unifold/core 0.1.42 → 0.1.44
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 +123 -1
- package/dist/index.d.ts +123 -1
- package/dist/index.js +147 -0
- package/dist/index.mjs +141 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -524,6 +524,20 @@ interface VerifyAddressResponse {
|
|
|
524
524
|
* @returns Verification result with valid status and reason if invalid
|
|
525
525
|
*/
|
|
526
526
|
declare function verifyRecipientAddress(request: VerifyAddressRequest, publishableKey?: string): Promise<VerifyAddressResponse>;
|
|
527
|
+
interface HypercoreActivationRequest {
|
|
528
|
+
source_address: string;
|
|
529
|
+
recipient_address: string;
|
|
530
|
+
}
|
|
531
|
+
interface HypercoreActivationResponse {
|
|
532
|
+
user_exists: boolean;
|
|
533
|
+
activation_fee: number;
|
|
534
|
+
is_sanctioned: boolean;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Check whether a recipient address is activated on HyperCore (Hyperliquid L1).
|
|
538
|
+
* Returns whether the recipient exists and the activation fee if not.
|
|
539
|
+
*/
|
|
540
|
+
declare function checkHypercoreActivation(request: HypercoreActivationRequest, publishableKey?: string): Promise<HypercoreActivationResponse>;
|
|
527
541
|
interface ExchangeProviderInfo {
|
|
528
542
|
service_provider: string;
|
|
529
543
|
service_provider_display_name: string;
|
|
@@ -631,6 +645,114 @@ interface SendSolanaTransactionResponse {
|
|
|
631
645
|
* @returns Transaction signature (hash) that can be used to track the transaction
|
|
632
646
|
*/
|
|
633
647
|
declare function sendSolanaTransaction(request: SendSolanaTransactionRequest, publishableKey?: string): Promise<SendSolanaTransactionResponse>;
|
|
648
|
+
interface PaymentIntentDepositAddress {
|
|
649
|
+
id: string;
|
|
650
|
+
chain_type: ChainType;
|
|
651
|
+
address_type: string | null;
|
|
652
|
+
address: string;
|
|
653
|
+
}
|
|
654
|
+
interface PaymentIntent {
|
|
655
|
+
id: string;
|
|
656
|
+
user_id: string | null;
|
|
657
|
+
amount: string;
|
|
658
|
+
amount_usd: string;
|
|
659
|
+
amount_received: string;
|
|
660
|
+
amount_received_usd: string;
|
|
661
|
+
currency: string;
|
|
662
|
+
status: string;
|
|
663
|
+
client_secret: string;
|
|
664
|
+
destination_network: string | null;
|
|
665
|
+
destination_chain_type: ChainType;
|
|
666
|
+
destination_chain_id: string;
|
|
667
|
+
destination_token_address: string;
|
|
668
|
+
recipient_address: string;
|
|
669
|
+
destination_token_decimals: number;
|
|
670
|
+
deposit_addresses: PaymentIntentDepositAddress[];
|
|
671
|
+
metadata: Record<string, string> | null;
|
|
672
|
+
description: string | null;
|
|
673
|
+
livemode: boolean;
|
|
674
|
+
settlement_tolerance_percent: number;
|
|
675
|
+
canceled_at: string | null;
|
|
676
|
+
cancellation_reason: string | null;
|
|
677
|
+
expires_at: string | null;
|
|
678
|
+
created_at: string;
|
|
679
|
+
updated_at: string;
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Retrieve a payment intent by its client secret.
|
|
683
|
+
* Uses the public endpoint that requires a publishable key header.
|
|
684
|
+
*/
|
|
685
|
+
declare function retrievePaymentIntent(clientSecret: string, publishableKey?: string): Promise<PaymentIntent>;
|
|
686
|
+
interface PaymentIntentExecutionsResponse {
|
|
687
|
+
data: AutoSwapResponse[];
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* List all executions (deposits/swaps) for a payment intent.
|
|
691
|
+
* Authenticates via client_secret and publishable key.
|
|
692
|
+
*/
|
|
693
|
+
declare function listPaymentIntentExecutions(clientSecret: string, publishableKey?: string): Promise<PaymentIntentExecutionsResponse>;
|
|
694
|
+
interface DepositQuoteRequest {
|
|
695
|
+
source_chain_type: string;
|
|
696
|
+
source_chain_id: string;
|
|
697
|
+
source_token_address: string;
|
|
698
|
+
destination_amount: string;
|
|
699
|
+
destination_chain_type: string;
|
|
700
|
+
destination_chain_id: string;
|
|
701
|
+
destination_token_address: string;
|
|
702
|
+
}
|
|
703
|
+
interface DepositQuote {
|
|
704
|
+
source_amount: string;
|
|
705
|
+
source_amount_usd: string | null;
|
|
706
|
+
source_token_decimals: number;
|
|
707
|
+
source_token_symbol: string;
|
|
708
|
+
destination_amount: string;
|
|
709
|
+
destination_amount_usd: string | null;
|
|
710
|
+
destination_token_decimals: number;
|
|
711
|
+
destination_token_symbol: string;
|
|
712
|
+
estimated_price_impact_percent: number | null;
|
|
713
|
+
estimated_fees_usd: string | null;
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Get a deposit quote: how much source token is needed to receive a
|
|
717
|
+
* specific destination amount, accounting for bridge fees and slippage.
|
|
718
|
+
* Results are cached server-side for 1 minute.
|
|
719
|
+
*/
|
|
720
|
+
declare function getDepositQuote(request: DepositQuoteRequest, publishableKey?: string): Promise<DepositQuote>;
|
|
721
|
+
type HypercoreActionType = "spot_send" | "usd_send";
|
|
722
|
+
interface BuildHypercoreTransactionRequest {
|
|
723
|
+
action_type: HypercoreActionType;
|
|
724
|
+
signature_chain_type: string;
|
|
725
|
+
signature_chain_id: string;
|
|
726
|
+
recipient_address: string;
|
|
727
|
+
token_address: string;
|
|
728
|
+
token_symbol?: string;
|
|
729
|
+
amount: string;
|
|
730
|
+
}
|
|
731
|
+
interface BuildHypercoreTransactionResponse {
|
|
732
|
+
typed_data: Record<string, unknown>;
|
|
733
|
+
action_payload: Record<string, unknown>;
|
|
734
|
+
nonce: number;
|
|
735
|
+
}
|
|
736
|
+
interface SendHypercoreTransactionRequest {
|
|
737
|
+
action_payload: Record<string, unknown>;
|
|
738
|
+
signature: string;
|
|
739
|
+
nonce: number;
|
|
740
|
+
}
|
|
741
|
+
interface SendHypercoreTransactionResponse {
|
|
742
|
+
status: string;
|
|
743
|
+
response?: unknown;
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Build EIP-712 typed data + action for a HyperCore transaction.
|
|
747
|
+
* Returns everything the frontend needs to sign and then submit.
|
|
748
|
+
*/
|
|
749
|
+
declare function buildHypercoreTransaction(request: BuildHypercoreTransactionRequest, publishableKey?: string): Promise<BuildHypercoreTransactionResponse>;
|
|
750
|
+
/**
|
|
751
|
+
* Send a signed HyperCore transaction via the backend proxy.
|
|
752
|
+
* Pass the action + nonce from buildHypercoreTransaction and
|
|
753
|
+
* the signature from eth_signTypedData_v4.
|
|
754
|
+
*/
|
|
755
|
+
declare function sendHypercoreTransaction(request: SendHypercoreTransactionRequest, publishableKey?: string): Promise<SendHypercoreTransactionResponse>;
|
|
634
756
|
|
|
635
757
|
/**
|
|
636
758
|
* User IP information interface
|
|
@@ -752,4 +874,4 @@ declare const i18n: {
|
|
|
752
874
|
};
|
|
753
875
|
type I18nStrings = typeof i18n;
|
|
754
876
|
|
|
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 };
|
|
877
|
+
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 HypercoreActivationRequest, type HypercoreActivationResponse, 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, checkHypercoreActivation, 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
|
@@ -524,6 +524,20 @@ interface VerifyAddressResponse {
|
|
|
524
524
|
* @returns Verification result with valid status and reason if invalid
|
|
525
525
|
*/
|
|
526
526
|
declare function verifyRecipientAddress(request: VerifyAddressRequest, publishableKey?: string): Promise<VerifyAddressResponse>;
|
|
527
|
+
interface HypercoreActivationRequest {
|
|
528
|
+
source_address: string;
|
|
529
|
+
recipient_address: string;
|
|
530
|
+
}
|
|
531
|
+
interface HypercoreActivationResponse {
|
|
532
|
+
user_exists: boolean;
|
|
533
|
+
activation_fee: number;
|
|
534
|
+
is_sanctioned: boolean;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Check whether a recipient address is activated on HyperCore (Hyperliquid L1).
|
|
538
|
+
* Returns whether the recipient exists and the activation fee if not.
|
|
539
|
+
*/
|
|
540
|
+
declare function checkHypercoreActivation(request: HypercoreActivationRequest, publishableKey?: string): Promise<HypercoreActivationResponse>;
|
|
527
541
|
interface ExchangeProviderInfo {
|
|
528
542
|
service_provider: string;
|
|
529
543
|
service_provider_display_name: string;
|
|
@@ -631,6 +645,114 @@ interface SendSolanaTransactionResponse {
|
|
|
631
645
|
* @returns Transaction signature (hash) that can be used to track the transaction
|
|
632
646
|
*/
|
|
633
647
|
declare function sendSolanaTransaction(request: SendSolanaTransactionRequest, publishableKey?: string): Promise<SendSolanaTransactionResponse>;
|
|
648
|
+
interface PaymentIntentDepositAddress {
|
|
649
|
+
id: string;
|
|
650
|
+
chain_type: ChainType;
|
|
651
|
+
address_type: string | null;
|
|
652
|
+
address: string;
|
|
653
|
+
}
|
|
654
|
+
interface PaymentIntent {
|
|
655
|
+
id: string;
|
|
656
|
+
user_id: string | null;
|
|
657
|
+
amount: string;
|
|
658
|
+
amount_usd: string;
|
|
659
|
+
amount_received: string;
|
|
660
|
+
amount_received_usd: string;
|
|
661
|
+
currency: string;
|
|
662
|
+
status: string;
|
|
663
|
+
client_secret: string;
|
|
664
|
+
destination_network: string | null;
|
|
665
|
+
destination_chain_type: ChainType;
|
|
666
|
+
destination_chain_id: string;
|
|
667
|
+
destination_token_address: string;
|
|
668
|
+
recipient_address: string;
|
|
669
|
+
destination_token_decimals: number;
|
|
670
|
+
deposit_addresses: PaymentIntentDepositAddress[];
|
|
671
|
+
metadata: Record<string, string> | null;
|
|
672
|
+
description: string | null;
|
|
673
|
+
livemode: boolean;
|
|
674
|
+
settlement_tolerance_percent: number;
|
|
675
|
+
canceled_at: string | null;
|
|
676
|
+
cancellation_reason: string | null;
|
|
677
|
+
expires_at: string | null;
|
|
678
|
+
created_at: string;
|
|
679
|
+
updated_at: string;
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Retrieve a payment intent by its client secret.
|
|
683
|
+
* Uses the public endpoint that requires a publishable key header.
|
|
684
|
+
*/
|
|
685
|
+
declare function retrievePaymentIntent(clientSecret: string, publishableKey?: string): Promise<PaymentIntent>;
|
|
686
|
+
interface PaymentIntentExecutionsResponse {
|
|
687
|
+
data: AutoSwapResponse[];
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* List all executions (deposits/swaps) for a payment intent.
|
|
691
|
+
* Authenticates via client_secret and publishable key.
|
|
692
|
+
*/
|
|
693
|
+
declare function listPaymentIntentExecutions(clientSecret: string, publishableKey?: string): Promise<PaymentIntentExecutionsResponse>;
|
|
694
|
+
interface DepositQuoteRequest {
|
|
695
|
+
source_chain_type: string;
|
|
696
|
+
source_chain_id: string;
|
|
697
|
+
source_token_address: string;
|
|
698
|
+
destination_amount: string;
|
|
699
|
+
destination_chain_type: string;
|
|
700
|
+
destination_chain_id: string;
|
|
701
|
+
destination_token_address: string;
|
|
702
|
+
}
|
|
703
|
+
interface DepositQuote {
|
|
704
|
+
source_amount: string;
|
|
705
|
+
source_amount_usd: string | null;
|
|
706
|
+
source_token_decimals: number;
|
|
707
|
+
source_token_symbol: string;
|
|
708
|
+
destination_amount: string;
|
|
709
|
+
destination_amount_usd: string | null;
|
|
710
|
+
destination_token_decimals: number;
|
|
711
|
+
destination_token_symbol: string;
|
|
712
|
+
estimated_price_impact_percent: number | null;
|
|
713
|
+
estimated_fees_usd: string | null;
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Get a deposit quote: how much source token is needed to receive a
|
|
717
|
+
* specific destination amount, accounting for bridge fees and slippage.
|
|
718
|
+
* Results are cached server-side for 1 minute.
|
|
719
|
+
*/
|
|
720
|
+
declare function getDepositQuote(request: DepositQuoteRequest, publishableKey?: string): Promise<DepositQuote>;
|
|
721
|
+
type HypercoreActionType = "spot_send" | "usd_send";
|
|
722
|
+
interface BuildHypercoreTransactionRequest {
|
|
723
|
+
action_type: HypercoreActionType;
|
|
724
|
+
signature_chain_type: string;
|
|
725
|
+
signature_chain_id: string;
|
|
726
|
+
recipient_address: string;
|
|
727
|
+
token_address: string;
|
|
728
|
+
token_symbol?: string;
|
|
729
|
+
amount: string;
|
|
730
|
+
}
|
|
731
|
+
interface BuildHypercoreTransactionResponse {
|
|
732
|
+
typed_data: Record<string, unknown>;
|
|
733
|
+
action_payload: Record<string, unknown>;
|
|
734
|
+
nonce: number;
|
|
735
|
+
}
|
|
736
|
+
interface SendHypercoreTransactionRequest {
|
|
737
|
+
action_payload: Record<string, unknown>;
|
|
738
|
+
signature: string;
|
|
739
|
+
nonce: number;
|
|
740
|
+
}
|
|
741
|
+
interface SendHypercoreTransactionResponse {
|
|
742
|
+
status: string;
|
|
743
|
+
response?: unknown;
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Build EIP-712 typed data + action for a HyperCore transaction.
|
|
747
|
+
* Returns everything the frontend needs to sign and then submit.
|
|
748
|
+
*/
|
|
749
|
+
declare function buildHypercoreTransaction(request: BuildHypercoreTransactionRequest, publishableKey?: string): Promise<BuildHypercoreTransactionResponse>;
|
|
750
|
+
/**
|
|
751
|
+
* Send a signed HyperCore transaction via the backend proxy.
|
|
752
|
+
* Pass the action + nonce from buildHypercoreTransaction and
|
|
753
|
+
* the signature from eth_signTypedData_v4.
|
|
754
|
+
*/
|
|
755
|
+
declare function sendHypercoreTransaction(request: SendHypercoreTransactionRequest, publishableKey?: string): Promise<SendHypercoreTransactionResponse>;
|
|
634
756
|
|
|
635
757
|
/**
|
|
636
758
|
* User IP information interface
|
|
@@ -752,4 +874,4 @@ declare const i18n: {
|
|
|
752
874
|
};
|
|
753
875
|
type I18nStrings = typeof i18n;
|
|
754
876
|
|
|
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 };
|
|
877
|
+
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 HypercoreActivationRequest, type HypercoreActivationResponse, 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, checkHypercoreActivation, 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,7 +24,9 @@ __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,
|
|
29
|
+
checkHypercoreActivation: () => checkHypercoreActivation,
|
|
28
30
|
createDepositAddress: () => createDepositAddress,
|
|
29
31
|
createExchangeSession: () => createExchangeSession,
|
|
30
32
|
createOnrampSession: () => createOnrampSession,
|
|
@@ -33,6 +35,7 @@ __export(index_exports, {
|
|
|
33
35
|
getApiBaseUrl: () => getApiBaseUrl,
|
|
34
36
|
getChainName: () => getChainName,
|
|
35
37
|
getDefaultOnrampToken: () => getDefaultOnrampToken,
|
|
38
|
+
getDepositQuote: () => getDepositQuote,
|
|
36
39
|
getExchangeSessionStartUrl: () => getExchangeSessionStartUrl,
|
|
37
40
|
getExchanges: () => getExchanges,
|
|
38
41
|
getFiatCurrencies: () => getFiatCurrencies,
|
|
@@ -49,8 +52,11 @@ __export(index_exports, {
|
|
|
49
52
|
getTokenMetadata: () => getTokenMetadata,
|
|
50
53
|
getWalletByChainType: () => getWalletByChainType,
|
|
51
54
|
i18n: () => i18n,
|
|
55
|
+
listPaymentIntentExecutions: () => listPaymentIntentExecutions,
|
|
52
56
|
pollDirectExecutions: () => pollDirectExecutions,
|
|
53
57
|
queryExecutions: () => queryExecutions,
|
|
58
|
+
retrievePaymentIntent: () => retrievePaymentIntent,
|
|
59
|
+
sendHypercoreTransaction: () => sendHypercoreTransaction,
|
|
54
60
|
sendSolanaTransaction: () => sendSolanaTransaction,
|
|
55
61
|
setApiConfig: () => setApiConfig,
|
|
56
62
|
useUserIp: () => useUserIp,
|
|
@@ -502,6 +508,28 @@ async function verifyRecipientAddress(request, publishableKey) {
|
|
|
502
508
|
}
|
|
503
509
|
return response.json();
|
|
504
510
|
}
|
|
511
|
+
async function checkHypercoreActivation(request, publishableKey) {
|
|
512
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
513
|
+
validatePublishableKey(pk);
|
|
514
|
+
const response = await fetch(
|
|
515
|
+
`${API_BASE_URL}/v1/public/addresses/hypercore/activation`,
|
|
516
|
+
{
|
|
517
|
+
method: "POST",
|
|
518
|
+
headers: {
|
|
519
|
+
accept: "application/json",
|
|
520
|
+
"x-publishable-key": pk,
|
|
521
|
+
"Content-Type": "application/json"
|
|
522
|
+
},
|
|
523
|
+
body: JSON.stringify(request)
|
|
524
|
+
}
|
|
525
|
+
);
|
|
526
|
+
if (!response.ok) {
|
|
527
|
+
throw new Error(
|
|
528
|
+
`HyperCore activation check failed: ${response.statusText}`
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
return response.json();
|
|
532
|
+
}
|
|
505
533
|
async function getExchanges(query, publishableKey) {
|
|
506
534
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
507
535
|
validatePublishableKey(pk);
|
|
@@ -606,6 +634,119 @@ async function sendSolanaTransaction(request, publishableKey) {
|
|
|
606
634
|
}
|
|
607
635
|
return response.json();
|
|
608
636
|
}
|
|
637
|
+
async function retrievePaymentIntent(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/retrieve`,
|
|
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 retrieve payment intent: ${error.message || response.statusText}`
|
|
656
|
+
);
|
|
657
|
+
}
|
|
658
|
+
return response.json();
|
|
659
|
+
}
|
|
660
|
+
async function listPaymentIntentExecutions(clientSecret, publishableKey) {
|
|
661
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
662
|
+
validatePublishableKey(pk);
|
|
663
|
+
const response = await fetch(
|
|
664
|
+
`${API_BASE_URL}/v1/public/payment_intents/executions`,
|
|
665
|
+
{
|
|
666
|
+
method: "POST",
|
|
667
|
+
headers: {
|
|
668
|
+
accept: "application/json",
|
|
669
|
+
"x-publishable-key": pk,
|
|
670
|
+
"Content-Type": "application/json"
|
|
671
|
+
},
|
|
672
|
+
body: JSON.stringify({ client_secret: clientSecret })
|
|
673
|
+
}
|
|
674
|
+
);
|
|
675
|
+
if (!response.ok) {
|
|
676
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
677
|
+
throw new Error(
|
|
678
|
+
`Failed to list payment intent executions: ${error.message || response.statusText}`
|
|
679
|
+
);
|
|
680
|
+
}
|
|
681
|
+
return response.json();
|
|
682
|
+
}
|
|
683
|
+
async function getDepositQuote(request, publishableKey) {
|
|
684
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
685
|
+
validatePublishableKey(pk);
|
|
686
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/quotes`, {
|
|
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
|
+
if (!response.ok) {
|
|
696
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
697
|
+
throw new Error(
|
|
698
|
+
`Failed to get deposit quote: ${error.message || response.statusText}`
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
const json = await response.json();
|
|
702
|
+
return json.data;
|
|
703
|
+
}
|
|
704
|
+
async function buildHypercoreTransaction(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/build`,
|
|
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 build HyperCore transaction: ${error.message || response.statusText}`
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
return response.json();
|
|
726
|
+
}
|
|
727
|
+
async function sendHypercoreTransaction(request, publishableKey) {
|
|
728
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
729
|
+
validatePublishableKey(pk);
|
|
730
|
+
const response = await fetch(
|
|
731
|
+
`${API_BASE_URL}/v1/public/transactions/hypercore/send`,
|
|
732
|
+
{
|
|
733
|
+
method: "POST",
|
|
734
|
+
headers: {
|
|
735
|
+
accept: "application/json",
|
|
736
|
+
"x-publishable-key": pk,
|
|
737
|
+
"Content-Type": "application/json"
|
|
738
|
+
},
|
|
739
|
+
body: JSON.stringify(request)
|
|
740
|
+
}
|
|
741
|
+
);
|
|
742
|
+
if (!response.ok) {
|
|
743
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
744
|
+
throw new Error(
|
|
745
|
+
`Failed to send HyperCore transaction: ${error.message || response.statusText}`
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
return response.json();
|
|
749
|
+
}
|
|
609
750
|
|
|
610
751
|
// src/hooks/use-user-ip.ts
|
|
611
752
|
var import_react_query = require("@tanstack/react-query");
|
|
@@ -742,7 +883,9 @@ var i18n = en_default;
|
|
|
742
883
|
ExecutionStatus,
|
|
743
884
|
IneligibilityReason,
|
|
744
885
|
SOLANA_USDC_ADDRESS,
|
|
886
|
+
buildHypercoreTransaction,
|
|
745
887
|
buildSolanaTransaction,
|
|
888
|
+
checkHypercoreActivation,
|
|
746
889
|
createDepositAddress,
|
|
747
890
|
createExchangeSession,
|
|
748
891
|
createOnrampSession,
|
|
@@ -751,6 +894,7 @@ var i18n = en_default;
|
|
|
751
894
|
getApiBaseUrl,
|
|
752
895
|
getChainName,
|
|
753
896
|
getDefaultOnrampToken,
|
|
897
|
+
getDepositQuote,
|
|
754
898
|
getExchangeSessionStartUrl,
|
|
755
899
|
getExchanges,
|
|
756
900
|
getFiatCurrencies,
|
|
@@ -767,8 +911,11 @@ var i18n = en_default;
|
|
|
767
911
|
getTokenMetadata,
|
|
768
912
|
getWalletByChainType,
|
|
769
913
|
i18n,
|
|
914
|
+
listPaymentIntentExecutions,
|
|
770
915
|
pollDirectExecutions,
|
|
771
916
|
queryExecutions,
|
|
917
|
+
retrievePaymentIntent,
|
|
918
|
+
sendHypercoreTransaction,
|
|
772
919
|
sendSolanaTransaction,
|
|
773
920
|
setApiConfig,
|
|
774
921
|
useUserIp,
|
package/dist/index.mjs
CHANGED
|
@@ -442,6 +442,28 @@ async function verifyRecipientAddress(request, publishableKey) {
|
|
|
442
442
|
}
|
|
443
443
|
return response.json();
|
|
444
444
|
}
|
|
445
|
+
async function checkHypercoreActivation(request, publishableKey) {
|
|
446
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
447
|
+
validatePublishableKey(pk);
|
|
448
|
+
const response = await fetch(
|
|
449
|
+
`${API_BASE_URL}/v1/public/addresses/hypercore/activation`,
|
|
450
|
+
{
|
|
451
|
+
method: "POST",
|
|
452
|
+
headers: {
|
|
453
|
+
accept: "application/json",
|
|
454
|
+
"x-publishable-key": pk,
|
|
455
|
+
"Content-Type": "application/json"
|
|
456
|
+
},
|
|
457
|
+
body: JSON.stringify(request)
|
|
458
|
+
}
|
|
459
|
+
);
|
|
460
|
+
if (!response.ok) {
|
|
461
|
+
throw new Error(
|
|
462
|
+
`HyperCore activation check failed: ${response.statusText}`
|
|
463
|
+
);
|
|
464
|
+
}
|
|
465
|
+
return response.json();
|
|
466
|
+
}
|
|
445
467
|
async function getExchanges(query, publishableKey) {
|
|
446
468
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
447
469
|
validatePublishableKey(pk);
|
|
@@ -546,6 +568,119 @@ async function sendSolanaTransaction(request, publishableKey) {
|
|
|
546
568
|
}
|
|
547
569
|
return response.json();
|
|
548
570
|
}
|
|
571
|
+
async function retrievePaymentIntent(clientSecret, publishableKey) {
|
|
572
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
573
|
+
validatePublishableKey(pk);
|
|
574
|
+
const response = await fetch(
|
|
575
|
+
`${API_BASE_URL}/v1/public/payment_intents/retrieve`,
|
|
576
|
+
{
|
|
577
|
+
method: "POST",
|
|
578
|
+
headers: {
|
|
579
|
+
accept: "application/json",
|
|
580
|
+
"x-publishable-key": pk,
|
|
581
|
+
"Content-Type": "application/json"
|
|
582
|
+
},
|
|
583
|
+
body: JSON.stringify({ client_secret: clientSecret })
|
|
584
|
+
}
|
|
585
|
+
);
|
|
586
|
+
if (!response.ok) {
|
|
587
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
588
|
+
throw new Error(
|
|
589
|
+
`Failed to retrieve payment intent: ${error.message || response.statusText}`
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
return response.json();
|
|
593
|
+
}
|
|
594
|
+
async function listPaymentIntentExecutions(clientSecret, publishableKey) {
|
|
595
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
596
|
+
validatePublishableKey(pk);
|
|
597
|
+
const response = await fetch(
|
|
598
|
+
`${API_BASE_URL}/v1/public/payment_intents/executions`,
|
|
599
|
+
{
|
|
600
|
+
method: "POST",
|
|
601
|
+
headers: {
|
|
602
|
+
accept: "application/json",
|
|
603
|
+
"x-publishable-key": pk,
|
|
604
|
+
"Content-Type": "application/json"
|
|
605
|
+
},
|
|
606
|
+
body: JSON.stringify({ client_secret: clientSecret })
|
|
607
|
+
}
|
|
608
|
+
);
|
|
609
|
+
if (!response.ok) {
|
|
610
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
611
|
+
throw new Error(
|
|
612
|
+
`Failed to list payment intent executions: ${error.message || response.statusText}`
|
|
613
|
+
);
|
|
614
|
+
}
|
|
615
|
+
return response.json();
|
|
616
|
+
}
|
|
617
|
+
async function getDepositQuote(request, publishableKey) {
|
|
618
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
619
|
+
validatePublishableKey(pk);
|
|
620
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/quotes`, {
|
|
621
|
+
method: "POST",
|
|
622
|
+
headers: {
|
|
623
|
+
accept: "application/json",
|
|
624
|
+
"x-publishable-key": pk,
|
|
625
|
+
"Content-Type": "application/json"
|
|
626
|
+
},
|
|
627
|
+
body: JSON.stringify(request)
|
|
628
|
+
});
|
|
629
|
+
if (!response.ok) {
|
|
630
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
631
|
+
throw new Error(
|
|
632
|
+
`Failed to get deposit quote: ${error.message || response.statusText}`
|
|
633
|
+
);
|
|
634
|
+
}
|
|
635
|
+
const json = await response.json();
|
|
636
|
+
return json.data;
|
|
637
|
+
}
|
|
638
|
+
async function buildHypercoreTransaction(request, publishableKey) {
|
|
639
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
640
|
+
validatePublishableKey(pk);
|
|
641
|
+
const response = await fetch(
|
|
642
|
+
`${API_BASE_URL}/v1/public/transactions/hypercore/build`,
|
|
643
|
+
{
|
|
644
|
+
method: "POST",
|
|
645
|
+
headers: {
|
|
646
|
+
accept: "application/json",
|
|
647
|
+
"x-publishable-key": pk,
|
|
648
|
+
"Content-Type": "application/json"
|
|
649
|
+
},
|
|
650
|
+
body: JSON.stringify(request)
|
|
651
|
+
}
|
|
652
|
+
);
|
|
653
|
+
if (!response.ok) {
|
|
654
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
655
|
+
throw new Error(
|
|
656
|
+
`Failed to build HyperCore transaction: ${error.message || response.statusText}`
|
|
657
|
+
);
|
|
658
|
+
}
|
|
659
|
+
return response.json();
|
|
660
|
+
}
|
|
661
|
+
async function sendHypercoreTransaction(request, publishableKey) {
|
|
662
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
663
|
+
validatePublishableKey(pk);
|
|
664
|
+
const response = await fetch(
|
|
665
|
+
`${API_BASE_URL}/v1/public/transactions/hypercore/send`,
|
|
666
|
+
{
|
|
667
|
+
method: "POST",
|
|
668
|
+
headers: {
|
|
669
|
+
accept: "application/json",
|
|
670
|
+
"x-publishable-key": pk,
|
|
671
|
+
"Content-Type": "application/json"
|
|
672
|
+
},
|
|
673
|
+
body: JSON.stringify(request)
|
|
674
|
+
}
|
|
675
|
+
);
|
|
676
|
+
if (!response.ok) {
|
|
677
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
678
|
+
throw new Error(
|
|
679
|
+
`Failed to send HyperCore transaction: ${error.message || response.statusText}`
|
|
680
|
+
);
|
|
681
|
+
}
|
|
682
|
+
return response.json();
|
|
683
|
+
}
|
|
549
684
|
|
|
550
685
|
// src/hooks/use-user-ip.ts
|
|
551
686
|
import { useQuery } from "@tanstack/react-query";
|
|
@@ -681,7 +816,9 @@ export {
|
|
|
681
816
|
ExecutionStatus,
|
|
682
817
|
IneligibilityReason,
|
|
683
818
|
SOLANA_USDC_ADDRESS,
|
|
819
|
+
buildHypercoreTransaction,
|
|
684
820
|
buildSolanaTransaction,
|
|
821
|
+
checkHypercoreActivation,
|
|
685
822
|
createDepositAddress,
|
|
686
823
|
createExchangeSession,
|
|
687
824
|
createOnrampSession,
|
|
@@ -690,6 +827,7 @@ export {
|
|
|
690
827
|
getApiBaseUrl,
|
|
691
828
|
getChainName,
|
|
692
829
|
getDefaultOnrampToken,
|
|
830
|
+
getDepositQuote,
|
|
693
831
|
getExchangeSessionStartUrl,
|
|
694
832
|
getExchanges,
|
|
695
833
|
getFiatCurrencies,
|
|
@@ -706,8 +844,11 @@ export {
|
|
|
706
844
|
getTokenMetadata,
|
|
707
845
|
getWalletByChainType,
|
|
708
846
|
i18n,
|
|
847
|
+
listPaymentIntentExecutions,
|
|
709
848
|
pollDirectExecutions,
|
|
710
849
|
queryExecutions,
|
|
850
|
+
retrievePaymentIntent,
|
|
851
|
+
sendHypercoreTransaction,
|
|
711
852
|
sendSolanaTransaction,
|
|
712
853
|
setApiConfig,
|
|
713
854
|
useUserIp,
|