@unifold/core 0.1.25 → 0.1.27
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 +51 -3
- package/dist/index.d.ts +51 -3
- package/dist/index.js +51 -0
- package/dist/index.mjs +48 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -22,7 +22,7 @@ declare function getIconUrl(iconPath: string): string;
|
|
|
22
22
|
declare function getIconUrlWithCdn(iconPath: string, assetCdnUrl?: string): string;
|
|
23
23
|
interface Wallet {
|
|
24
24
|
id: string;
|
|
25
|
-
chain_type: "ethereum" | "solana" | "bitcoin" | "algorand";
|
|
25
|
+
chain_type: "ethereum" | "solana" | "bitcoin" | "algorand" | "xrpl";
|
|
26
26
|
address_type: string | null;
|
|
27
27
|
address: string;
|
|
28
28
|
destination_chain_type: string;
|
|
@@ -51,7 +51,7 @@ declare function createDepositAddress(overrides?: Partial<CreateDepositAddressRe
|
|
|
51
51
|
/**
|
|
52
52
|
* Get wallet address for a specific chain type
|
|
53
53
|
*/
|
|
54
|
-
declare function getWalletByChainType(wallets: Wallet[], chainType: "ethereum" | "solana" | "bitcoin" | "algorand"): Wallet | undefined;
|
|
54
|
+
declare function getWalletByChainType(wallets: Wallet[], chainType: "ethereum" | "solana" | "bitcoin" | "algorand" | "xrpl"): Wallet | undefined;
|
|
55
55
|
interface AutoSwapRequest {
|
|
56
56
|
wallet_id: string;
|
|
57
57
|
origin_currency: string;
|
|
@@ -374,6 +374,7 @@ interface PaymentNetwork {
|
|
|
374
374
|
icon_urls: IconUrl[];
|
|
375
375
|
}
|
|
376
376
|
interface ProjectConfigResponse {
|
|
377
|
+
project_name?: string;
|
|
377
378
|
asset_cdn_url: string;
|
|
378
379
|
transfer_crypto: {
|
|
379
380
|
networks: FeaturedToken[];
|
|
@@ -419,11 +420,16 @@ interface TokenInfo {
|
|
|
419
420
|
chain_icon_url: string;
|
|
420
421
|
chain_icon_urls: TokenIconUrl[];
|
|
421
422
|
}
|
|
423
|
+
declare enum IneligibilityReason {
|
|
424
|
+
MINIMUM_NOT_MET = "minimum_not_met",
|
|
425
|
+
NOT_SUPPORTED_DEPOSIT_FROM = "not_supported_deposit_from"
|
|
426
|
+
}
|
|
422
427
|
interface TokenBalance {
|
|
423
428
|
amount: string;
|
|
424
429
|
amount_usd: string | null;
|
|
425
430
|
exchange_rate: string | null;
|
|
426
431
|
is_eligible: boolean;
|
|
432
|
+
ineligibility_reason: IneligibilityReason | null;
|
|
427
433
|
token: TokenInfo;
|
|
428
434
|
}
|
|
429
435
|
interface AddressBalancesResponse {
|
|
@@ -488,6 +494,48 @@ interface VerifyAddressResponse {
|
|
|
488
494
|
* @returns Verification result with valid status and reason if invalid
|
|
489
495
|
*/
|
|
490
496
|
declare function verifyRecipientAddress(request: VerifyAddressRequest, publishableKey?: string): Promise<VerifyAddressResponse>;
|
|
497
|
+
interface BuildSolanaTransactionRequest {
|
|
498
|
+
chain_id: string;
|
|
499
|
+
token_address: string;
|
|
500
|
+
source_address: string;
|
|
501
|
+
destination_address: string;
|
|
502
|
+
amount: string;
|
|
503
|
+
}
|
|
504
|
+
interface BuildSolanaTransactionResponse {
|
|
505
|
+
encoding: 'base64';
|
|
506
|
+
transaction: string;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Build a Solana transaction for transferring SOL or SPL tokens.
|
|
510
|
+
* Returns an unsigned VersionedTransaction that must be signed by the user's wallet.
|
|
511
|
+
*
|
|
512
|
+
* Features:
|
|
513
|
+
* - Native SOL transfers (use "native" as token_address)
|
|
514
|
+
* - SPL Token transfers (standard Token Program)
|
|
515
|
+
* - SPL Token-2022 transfers (Token Extensions)
|
|
516
|
+
* - Automatic ATA (Associated Token Account) creation with idempotency
|
|
517
|
+
*
|
|
518
|
+
* @param request - Transaction details including chain_id, token_address, source/destination addresses, and amount
|
|
519
|
+
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
520
|
+
* @returns Unsigned transaction in base64 format that needs to be signed by the wallet
|
|
521
|
+
*/
|
|
522
|
+
declare function buildSolanaTransaction(request: BuildSolanaTransactionRequest, publishableKey?: string): Promise<BuildSolanaTransactionResponse>;
|
|
523
|
+
interface SendSolanaTransactionRequest {
|
|
524
|
+
chain_id: string;
|
|
525
|
+
signed_transaction: string;
|
|
526
|
+
}
|
|
527
|
+
interface SendSolanaTransactionResponse {
|
|
528
|
+
signature: string;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Send a signed Solana transaction to the network.
|
|
532
|
+
* The transaction must have been previously built using buildSolanaTransaction() and signed by the user's wallet.
|
|
533
|
+
*
|
|
534
|
+
* @param request - Contains chain_id and the signed transaction in base64 format
|
|
535
|
+
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
536
|
+
* @returns Transaction signature (hash) that can be used to track the transaction
|
|
537
|
+
*/
|
|
538
|
+
declare function sendSolanaTransaction(request: SendSolanaTransactionRequest, publishableKey?: string): Promise<SendSolanaTransactionResponse>;
|
|
491
539
|
|
|
492
540
|
/**
|
|
493
541
|
* User IP information interface
|
|
@@ -583,4 +631,4 @@ declare const i18n: {
|
|
|
583
631
|
};
|
|
584
632
|
type I18nStrings = typeof i18n;
|
|
585
633
|
|
|
586
|
-
export { type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AutoSwapRequest, type AutoSwapResponse, type CreateDepositAddressRequest, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, ExecutionStatus, type FeaturedToken, type FiatCurrenciesResponse, type FiatCurrency, type I18nStrings, type IconUrl, 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 SupportedChain, type SupportedDepositTokensResponse, type SupportedToken, type TokenBalance, type TokenChain, type TokenChainIconUrl, type TokenChainsResponse, type TokenIconUrl, type TokenInfo, type TokenMetadata, type UserIpInfo, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, createDepositAddress, createOnrampSession, getAddressBalance, getAddressBalances, getApiBaseUrl, getChainName, getDefaultOnrampToken, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getTokenChains, getTokenMetadata, getWalletByChainType, i18n, pollDirectExecutions, queryExecutions, setApiConfig, useUserIp, verifyRecipientAddress };
|
|
634
|
+
export { type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AutoSwapRequest, type AutoSwapResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type CreateDepositAddressRequest, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, ExecutionStatus, type FeaturedToken, type FiatCurrenciesResponse, type FiatCurrency, 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 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, createOnrampSession, getAddressBalance, getAddressBalances, getApiBaseUrl, getChainName, getDefaultOnrampToken, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getTokenChains, getTokenMetadata, getWalletByChainType, i18n, pollDirectExecutions, queryExecutions, sendSolanaTransaction, setApiConfig, useUserIp, verifyRecipientAddress };
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ declare function getIconUrl(iconPath: string): string;
|
|
|
22
22
|
declare function getIconUrlWithCdn(iconPath: string, assetCdnUrl?: string): string;
|
|
23
23
|
interface Wallet {
|
|
24
24
|
id: string;
|
|
25
|
-
chain_type: "ethereum" | "solana" | "bitcoin" | "algorand";
|
|
25
|
+
chain_type: "ethereum" | "solana" | "bitcoin" | "algorand" | "xrpl";
|
|
26
26
|
address_type: string | null;
|
|
27
27
|
address: string;
|
|
28
28
|
destination_chain_type: string;
|
|
@@ -51,7 +51,7 @@ declare function createDepositAddress(overrides?: Partial<CreateDepositAddressRe
|
|
|
51
51
|
/**
|
|
52
52
|
* Get wallet address for a specific chain type
|
|
53
53
|
*/
|
|
54
|
-
declare function getWalletByChainType(wallets: Wallet[], chainType: "ethereum" | "solana" | "bitcoin" | "algorand"): Wallet | undefined;
|
|
54
|
+
declare function getWalletByChainType(wallets: Wallet[], chainType: "ethereum" | "solana" | "bitcoin" | "algorand" | "xrpl"): Wallet | undefined;
|
|
55
55
|
interface AutoSwapRequest {
|
|
56
56
|
wallet_id: string;
|
|
57
57
|
origin_currency: string;
|
|
@@ -374,6 +374,7 @@ interface PaymentNetwork {
|
|
|
374
374
|
icon_urls: IconUrl[];
|
|
375
375
|
}
|
|
376
376
|
interface ProjectConfigResponse {
|
|
377
|
+
project_name?: string;
|
|
377
378
|
asset_cdn_url: string;
|
|
378
379
|
transfer_crypto: {
|
|
379
380
|
networks: FeaturedToken[];
|
|
@@ -419,11 +420,16 @@ interface TokenInfo {
|
|
|
419
420
|
chain_icon_url: string;
|
|
420
421
|
chain_icon_urls: TokenIconUrl[];
|
|
421
422
|
}
|
|
423
|
+
declare enum IneligibilityReason {
|
|
424
|
+
MINIMUM_NOT_MET = "minimum_not_met",
|
|
425
|
+
NOT_SUPPORTED_DEPOSIT_FROM = "not_supported_deposit_from"
|
|
426
|
+
}
|
|
422
427
|
interface TokenBalance {
|
|
423
428
|
amount: string;
|
|
424
429
|
amount_usd: string | null;
|
|
425
430
|
exchange_rate: string | null;
|
|
426
431
|
is_eligible: boolean;
|
|
432
|
+
ineligibility_reason: IneligibilityReason | null;
|
|
427
433
|
token: TokenInfo;
|
|
428
434
|
}
|
|
429
435
|
interface AddressBalancesResponse {
|
|
@@ -488,6 +494,48 @@ interface VerifyAddressResponse {
|
|
|
488
494
|
* @returns Verification result with valid status and reason if invalid
|
|
489
495
|
*/
|
|
490
496
|
declare function verifyRecipientAddress(request: VerifyAddressRequest, publishableKey?: string): Promise<VerifyAddressResponse>;
|
|
497
|
+
interface BuildSolanaTransactionRequest {
|
|
498
|
+
chain_id: string;
|
|
499
|
+
token_address: string;
|
|
500
|
+
source_address: string;
|
|
501
|
+
destination_address: string;
|
|
502
|
+
amount: string;
|
|
503
|
+
}
|
|
504
|
+
interface BuildSolanaTransactionResponse {
|
|
505
|
+
encoding: 'base64';
|
|
506
|
+
transaction: string;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Build a Solana transaction for transferring SOL or SPL tokens.
|
|
510
|
+
* Returns an unsigned VersionedTransaction that must be signed by the user's wallet.
|
|
511
|
+
*
|
|
512
|
+
* Features:
|
|
513
|
+
* - Native SOL transfers (use "native" as token_address)
|
|
514
|
+
* - SPL Token transfers (standard Token Program)
|
|
515
|
+
* - SPL Token-2022 transfers (Token Extensions)
|
|
516
|
+
* - Automatic ATA (Associated Token Account) creation with idempotency
|
|
517
|
+
*
|
|
518
|
+
* @param request - Transaction details including chain_id, token_address, source/destination addresses, and amount
|
|
519
|
+
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
520
|
+
* @returns Unsigned transaction in base64 format that needs to be signed by the wallet
|
|
521
|
+
*/
|
|
522
|
+
declare function buildSolanaTransaction(request: BuildSolanaTransactionRequest, publishableKey?: string): Promise<BuildSolanaTransactionResponse>;
|
|
523
|
+
interface SendSolanaTransactionRequest {
|
|
524
|
+
chain_id: string;
|
|
525
|
+
signed_transaction: string;
|
|
526
|
+
}
|
|
527
|
+
interface SendSolanaTransactionResponse {
|
|
528
|
+
signature: string;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Send a signed Solana transaction to the network.
|
|
532
|
+
* The transaction must have been previously built using buildSolanaTransaction() and signed by the user's wallet.
|
|
533
|
+
*
|
|
534
|
+
* @param request - Contains chain_id and the signed transaction in base64 format
|
|
535
|
+
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
536
|
+
* @returns Transaction signature (hash) that can be used to track the transaction
|
|
537
|
+
*/
|
|
538
|
+
declare function sendSolanaTransaction(request: SendSolanaTransactionRequest, publishableKey?: string): Promise<SendSolanaTransactionResponse>;
|
|
491
539
|
|
|
492
540
|
/**
|
|
493
541
|
* User IP information interface
|
|
@@ -583,4 +631,4 @@ declare const i18n: {
|
|
|
583
631
|
};
|
|
584
632
|
type I18nStrings = typeof i18n;
|
|
585
633
|
|
|
586
|
-
export { type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AutoSwapRequest, type AutoSwapResponse, type CreateDepositAddressRequest, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, ExecutionStatus, type FeaturedToken, type FiatCurrenciesResponse, type FiatCurrency, type I18nStrings, type IconUrl, 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 SupportedChain, type SupportedDepositTokensResponse, type SupportedToken, type TokenBalance, type TokenChain, type TokenChainIconUrl, type TokenChainsResponse, type TokenIconUrl, type TokenInfo, type TokenMetadata, type UserIpInfo, type VerifyAddressRequest, type VerifyAddressResponse, type Wallet, createDepositAddress, createOnrampSession, getAddressBalance, getAddressBalances, getApiBaseUrl, getChainName, getDefaultOnrampToken, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getTokenChains, getTokenMetadata, getWalletByChainType, i18n, pollDirectExecutions, queryExecutions, setApiConfig, useUserIp, verifyRecipientAddress };
|
|
634
|
+
export { type AddressBalanceResponse, type AddressBalancesResponse, type AddressValidationFailureCode, type AddressValidationMetadata, type AutoSwapRequest, type AutoSwapResponse, type BuildSolanaTransactionRequest, type BuildSolanaTransactionResponse, type CreateDepositAddressRequest, type DefaultTokenChain, type DefaultTokenMetadata, type DefaultTokenResponse, type DepositAddressResponse, ExecutionStatus, type FeaturedToken, type FiatCurrenciesResponse, type FiatCurrency, 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 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, createOnrampSession, getAddressBalance, getAddressBalances, getApiBaseUrl, getChainName, getDefaultOnrampToken, getFiatCurrencies, getIconUrl, getIconUrlWithCdn, getIpAddress, getOnrampQuotes, getOnrampSessionStartUrl, getPreferredIconUrl, getProjectConfig, getSupportedDepositTokens, getTokenChains, getTokenMetadata, getWalletByChainType, i18n, pollDirectExecutions, queryExecutions, sendSolanaTransaction, setApiConfig, useUserIp, verifyRecipientAddress };
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
ExecutionStatus: () => ExecutionStatus,
|
|
24
|
+
IneligibilityReason: () => IneligibilityReason,
|
|
24
25
|
SOLANA_USDC_ADDRESS: () => SOLANA_USDC_ADDRESS,
|
|
26
|
+
buildSolanaTransaction: () => buildSolanaTransaction,
|
|
25
27
|
createDepositAddress: () => createDepositAddress,
|
|
26
28
|
createOnrampSession: () => createOnrampSession,
|
|
27
29
|
getAddressBalance: () => getAddressBalance,
|
|
@@ -44,6 +46,7 @@ __export(index_exports, {
|
|
|
44
46
|
i18n: () => i18n,
|
|
45
47
|
pollDirectExecutions: () => pollDirectExecutions,
|
|
46
48
|
queryExecutions: () => queryExecutions,
|
|
49
|
+
sendSolanaTransaction: () => sendSolanaTransaction,
|
|
47
50
|
setApiConfig: () => setApiConfig,
|
|
48
51
|
useUserIp: () => useUserIp,
|
|
49
52
|
verifyRecipientAddress: () => verifyRecipientAddress
|
|
@@ -395,6 +398,11 @@ async function getIpAddress() {
|
|
|
395
398
|
}
|
|
396
399
|
return response.json();
|
|
397
400
|
}
|
|
401
|
+
var IneligibilityReason = /* @__PURE__ */ ((IneligibilityReason2) => {
|
|
402
|
+
IneligibilityReason2["MINIMUM_NOT_MET"] = "minimum_not_met";
|
|
403
|
+
IneligibilityReason2["NOT_SUPPORTED_DEPOSIT_FROM"] = "not_supported_deposit_from";
|
|
404
|
+
return IneligibilityReason2;
|
|
405
|
+
})(IneligibilityReason || {});
|
|
398
406
|
async function getAddressBalances(address, chainType, publishableKey) {
|
|
399
407
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
400
408
|
validatePublishableKey(pk);
|
|
@@ -460,6 +468,46 @@ async function verifyRecipientAddress(request, publishableKey) {
|
|
|
460
468
|
}
|
|
461
469
|
return response.json();
|
|
462
470
|
}
|
|
471
|
+
async function buildSolanaTransaction(request, publishableKey) {
|
|
472
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
473
|
+
validatePublishableKey(pk);
|
|
474
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/transactions/solana/build`, {
|
|
475
|
+
method: "POST",
|
|
476
|
+
headers: {
|
|
477
|
+
accept: "application/json",
|
|
478
|
+
"x-publishable-key": pk,
|
|
479
|
+
"Content-Type": "application/json"
|
|
480
|
+
},
|
|
481
|
+
body: JSON.stringify(request)
|
|
482
|
+
});
|
|
483
|
+
if (!response.ok) {
|
|
484
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
485
|
+
throw new Error(
|
|
486
|
+
`Failed to build Solana transaction: ${error.message || response.statusText}`
|
|
487
|
+
);
|
|
488
|
+
}
|
|
489
|
+
return response.json();
|
|
490
|
+
}
|
|
491
|
+
async function sendSolanaTransaction(request, publishableKey) {
|
|
492
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
493
|
+
validatePublishableKey(pk);
|
|
494
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/transactions/solana/send`, {
|
|
495
|
+
method: "POST",
|
|
496
|
+
headers: {
|
|
497
|
+
accept: "application/json",
|
|
498
|
+
"x-publishable-key": pk,
|
|
499
|
+
"Content-Type": "application/json"
|
|
500
|
+
},
|
|
501
|
+
body: JSON.stringify(request)
|
|
502
|
+
});
|
|
503
|
+
if (!response.ok) {
|
|
504
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
505
|
+
throw new Error(
|
|
506
|
+
`Failed to send Solana transaction: ${error.message || response.statusText}`
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
return response.json();
|
|
510
|
+
}
|
|
463
511
|
|
|
464
512
|
// src/hooks/use-user-ip.ts
|
|
465
513
|
var import_react_query = require("@tanstack/react-query");
|
|
@@ -567,7 +615,9 @@ var i18n = en_default;
|
|
|
567
615
|
// Annotate the CommonJS export names for ESM import in node:
|
|
568
616
|
0 && (module.exports = {
|
|
569
617
|
ExecutionStatus,
|
|
618
|
+
IneligibilityReason,
|
|
570
619
|
SOLANA_USDC_ADDRESS,
|
|
620
|
+
buildSolanaTransaction,
|
|
571
621
|
createDepositAddress,
|
|
572
622
|
createOnrampSession,
|
|
573
623
|
getAddressBalance,
|
|
@@ -590,6 +640,7 @@ var i18n = en_default;
|
|
|
590
640
|
i18n,
|
|
591
641
|
pollDirectExecutions,
|
|
592
642
|
queryExecutions,
|
|
643
|
+
sendSolanaTransaction,
|
|
593
644
|
setApiConfig,
|
|
594
645
|
useUserIp,
|
|
595
646
|
verifyRecipientAddress
|
package/dist/index.mjs
CHANGED
|
@@ -343,6 +343,11 @@ async function getIpAddress() {
|
|
|
343
343
|
}
|
|
344
344
|
return response.json();
|
|
345
345
|
}
|
|
346
|
+
var IneligibilityReason = /* @__PURE__ */ ((IneligibilityReason2) => {
|
|
347
|
+
IneligibilityReason2["MINIMUM_NOT_MET"] = "minimum_not_met";
|
|
348
|
+
IneligibilityReason2["NOT_SUPPORTED_DEPOSIT_FROM"] = "not_supported_deposit_from";
|
|
349
|
+
return IneligibilityReason2;
|
|
350
|
+
})(IneligibilityReason || {});
|
|
346
351
|
async function getAddressBalances(address, chainType, publishableKey) {
|
|
347
352
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
348
353
|
validatePublishableKey(pk);
|
|
@@ -408,6 +413,46 @@ async function verifyRecipientAddress(request, publishableKey) {
|
|
|
408
413
|
}
|
|
409
414
|
return response.json();
|
|
410
415
|
}
|
|
416
|
+
async function buildSolanaTransaction(request, publishableKey) {
|
|
417
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
418
|
+
validatePublishableKey(pk);
|
|
419
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/transactions/solana/build`, {
|
|
420
|
+
method: "POST",
|
|
421
|
+
headers: {
|
|
422
|
+
accept: "application/json",
|
|
423
|
+
"x-publishable-key": pk,
|
|
424
|
+
"Content-Type": "application/json"
|
|
425
|
+
},
|
|
426
|
+
body: JSON.stringify(request)
|
|
427
|
+
});
|
|
428
|
+
if (!response.ok) {
|
|
429
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
430
|
+
throw new Error(
|
|
431
|
+
`Failed to build Solana transaction: ${error.message || response.statusText}`
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
return response.json();
|
|
435
|
+
}
|
|
436
|
+
async function sendSolanaTransaction(request, publishableKey) {
|
|
437
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
438
|
+
validatePublishableKey(pk);
|
|
439
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/transactions/solana/send`, {
|
|
440
|
+
method: "POST",
|
|
441
|
+
headers: {
|
|
442
|
+
accept: "application/json",
|
|
443
|
+
"x-publishable-key": pk,
|
|
444
|
+
"Content-Type": "application/json"
|
|
445
|
+
},
|
|
446
|
+
body: JSON.stringify(request)
|
|
447
|
+
});
|
|
448
|
+
if (!response.ok) {
|
|
449
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
450
|
+
throw new Error(
|
|
451
|
+
`Failed to send Solana transaction: ${error.message || response.statusText}`
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
return response.json();
|
|
455
|
+
}
|
|
411
456
|
|
|
412
457
|
// src/hooks/use-user-ip.ts
|
|
413
458
|
import { useQuery } from "@tanstack/react-query";
|
|
@@ -514,7 +559,9 @@ var en_default = {
|
|
|
514
559
|
var i18n = en_default;
|
|
515
560
|
export {
|
|
516
561
|
ExecutionStatus,
|
|
562
|
+
IneligibilityReason,
|
|
517
563
|
SOLANA_USDC_ADDRESS,
|
|
564
|
+
buildSolanaTransaction,
|
|
518
565
|
createDepositAddress,
|
|
519
566
|
createOnrampSession,
|
|
520
567
|
getAddressBalance,
|
|
@@ -537,6 +584,7 @@ export {
|
|
|
537
584
|
i18n,
|
|
538
585
|
pollDirectExecutions,
|
|
539
586
|
queryExecutions,
|
|
587
|
+
sendSolanaTransaction,
|
|
540
588
|
setApiConfig,
|
|
541
589
|
useUserIp,
|
|
542
590
|
verifyRecipientAddress
|