@unifold/core 0.1.24 → 0.1.26
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 +59 -1
- package/dist/index.d.ts +59 -1
- package/dist/index.js +66 -0
- package/dist/index.mjs +63 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -133,6 +133,21 @@ interface QueryExecutionsResponse {
|
|
|
133
133
|
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
134
134
|
*/
|
|
135
135
|
declare function queryExecutions(externalUserId: string, publishableKey?: string): Promise<QueryExecutionsResponse>;
|
|
136
|
+
interface PollExecutionsRequest {
|
|
137
|
+
deposit_wallet_id: string;
|
|
138
|
+
}
|
|
139
|
+
interface PollExecutionsResponse {
|
|
140
|
+
success: boolean;
|
|
141
|
+
message: string;
|
|
142
|
+
workflow_id: string;
|
|
143
|
+
already_running: boolean;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Start a poll workflow for direct executions on a deposit wallet
|
|
147
|
+
* @param request - Poll request with deposit_wallet_id
|
|
148
|
+
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
149
|
+
*/
|
|
150
|
+
declare function pollDirectExecutions(request: PollExecutionsRequest, publishableKey?: string): Promise<PollExecutionsResponse>;
|
|
136
151
|
interface SupportedChain {
|
|
137
152
|
chain_id: string;
|
|
138
153
|
chain_name: string;
|
|
@@ -359,6 +374,7 @@ interface PaymentNetwork {
|
|
|
359
374
|
icon_urls: IconUrl[];
|
|
360
375
|
}
|
|
361
376
|
interface ProjectConfigResponse {
|
|
377
|
+
project_name?: string;
|
|
362
378
|
asset_cdn_url: string;
|
|
363
379
|
transfer_crypto: {
|
|
364
380
|
networks: FeaturedToken[];
|
|
@@ -473,6 +489,48 @@ interface VerifyAddressResponse {
|
|
|
473
489
|
* @returns Verification result with valid status and reason if invalid
|
|
474
490
|
*/
|
|
475
491
|
declare function verifyRecipientAddress(request: VerifyAddressRequest, publishableKey?: string): Promise<VerifyAddressResponse>;
|
|
492
|
+
interface BuildSolanaTransactionRequest {
|
|
493
|
+
chain_id: string;
|
|
494
|
+
token_address: string;
|
|
495
|
+
source_address: string;
|
|
496
|
+
destination_address: string;
|
|
497
|
+
amount: string;
|
|
498
|
+
}
|
|
499
|
+
interface BuildSolanaTransactionResponse {
|
|
500
|
+
encoding: 'base64';
|
|
501
|
+
transaction: string;
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Build a Solana transaction for transferring SOL or SPL tokens.
|
|
505
|
+
* Returns an unsigned VersionedTransaction that must be signed by the user's wallet.
|
|
506
|
+
*
|
|
507
|
+
* Features:
|
|
508
|
+
* - Native SOL transfers (use "native" as token_address)
|
|
509
|
+
* - SPL Token transfers (standard Token Program)
|
|
510
|
+
* - SPL Token-2022 transfers (Token Extensions)
|
|
511
|
+
* - Automatic ATA (Associated Token Account) creation with idempotency
|
|
512
|
+
*
|
|
513
|
+
* @param request - Transaction details including chain_id, token_address, source/destination addresses, and amount
|
|
514
|
+
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
515
|
+
* @returns Unsigned transaction in base64 format that needs to be signed by the wallet
|
|
516
|
+
*/
|
|
517
|
+
declare function buildSolanaTransaction(request: BuildSolanaTransactionRequest, publishableKey?: string): Promise<BuildSolanaTransactionResponse>;
|
|
518
|
+
interface SendSolanaTransactionRequest {
|
|
519
|
+
chain_id: string;
|
|
520
|
+
signed_transaction: string;
|
|
521
|
+
}
|
|
522
|
+
interface SendSolanaTransactionResponse {
|
|
523
|
+
signature: string;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Send a signed Solana transaction to the network.
|
|
527
|
+
* The transaction must have been previously built using buildSolanaTransaction() and signed by the user's wallet.
|
|
528
|
+
*
|
|
529
|
+
* @param request - Contains chain_id and the signed transaction in base64 format
|
|
530
|
+
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
531
|
+
* @returns Transaction signature (hash) that can be used to track the transaction
|
|
532
|
+
*/
|
|
533
|
+
declare function sendSolanaTransaction(request: SendSolanaTransactionRequest, publishableKey?: string): Promise<SendSolanaTransactionResponse>;
|
|
476
534
|
|
|
477
535
|
/**
|
|
478
536
|
* User IP information interface
|
|
@@ -568,4 +626,4 @@ declare const i18n: {
|
|
|
568
626
|
};
|
|
569
627
|
type I18nStrings = typeof i18n;
|
|
570
628
|
|
|
571
|
-
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 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, queryExecutions, setApiConfig, useUserIp, verifyRecipientAddress };
|
|
629
|
+
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, 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
|
@@ -133,6 +133,21 @@ interface QueryExecutionsResponse {
|
|
|
133
133
|
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
134
134
|
*/
|
|
135
135
|
declare function queryExecutions(externalUserId: string, publishableKey?: string): Promise<QueryExecutionsResponse>;
|
|
136
|
+
interface PollExecutionsRequest {
|
|
137
|
+
deposit_wallet_id: string;
|
|
138
|
+
}
|
|
139
|
+
interface PollExecutionsResponse {
|
|
140
|
+
success: boolean;
|
|
141
|
+
message: string;
|
|
142
|
+
workflow_id: string;
|
|
143
|
+
already_running: boolean;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Start a poll workflow for direct executions on a deposit wallet
|
|
147
|
+
* @param request - Poll request with deposit_wallet_id
|
|
148
|
+
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
149
|
+
*/
|
|
150
|
+
declare function pollDirectExecutions(request: PollExecutionsRequest, publishableKey?: string): Promise<PollExecutionsResponse>;
|
|
136
151
|
interface SupportedChain {
|
|
137
152
|
chain_id: string;
|
|
138
153
|
chain_name: string;
|
|
@@ -359,6 +374,7 @@ interface PaymentNetwork {
|
|
|
359
374
|
icon_urls: IconUrl[];
|
|
360
375
|
}
|
|
361
376
|
interface ProjectConfigResponse {
|
|
377
|
+
project_name?: string;
|
|
362
378
|
asset_cdn_url: string;
|
|
363
379
|
transfer_crypto: {
|
|
364
380
|
networks: FeaturedToken[];
|
|
@@ -473,6 +489,48 @@ interface VerifyAddressResponse {
|
|
|
473
489
|
* @returns Verification result with valid status and reason if invalid
|
|
474
490
|
*/
|
|
475
491
|
declare function verifyRecipientAddress(request: VerifyAddressRequest, publishableKey?: string): Promise<VerifyAddressResponse>;
|
|
492
|
+
interface BuildSolanaTransactionRequest {
|
|
493
|
+
chain_id: string;
|
|
494
|
+
token_address: string;
|
|
495
|
+
source_address: string;
|
|
496
|
+
destination_address: string;
|
|
497
|
+
amount: string;
|
|
498
|
+
}
|
|
499
|
+
interface BuildSolanaTransactionResponse {
|
|
500
|
+
encoding: 'base64';
|
|
501
|
+
transaction: string;
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Build a Solana transaction for transferring SOL or SPL tokens.
|
|
505
|
+
* Returns an unsigned VersionedTransaction that must be signed by the user's wallet.
|
|
506
|
+
*
|
|
507
|
+
* Features:
|
|
508
|
+
* - Native SOL transfers (use "native" as token_address)
|
|
509
|
+
* - SPL Token transfers (standard Token Program)
|
|
510
|
+
* - SPL Token-2022 transfers (Token Extensions)
|
|
511
|
+
* - Automatic ATA (Associated Token Account) creation with idempotency
|
|
512
|
+
*
|
|
513
|
+
* @param request - Transaction details including chain_id, token_address, source/destination addresses, and amount
|
|
514
|
+
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
515
|
+
* @returns Unsigned transaction in base64 format that needs to be signed by the wallet
|
|
516
|
+
*/
|
|
517
|
+
declare function buildSolanaTransaction(request: BuildSolanaTransactionRequest, publishableKey?: string): Promise<BuildSolanaTransactionResponse>;
|
|
518
|
+
interface SendSolanaTransactionRequest {
|
|
519
|
+
chain_id: string;
|
|
520
|
+
signed_transaction: string;
|
|
521
|
+
}
|
|
522
|
+
interface SendSolanaTransactionResponse {
|
|
523
|
+
signature: string;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Send a signed Solana transaction to the network.
|
|
527
|
+
* The transaction must have been previously built using buildSolanaTransaction() and signed by the user's wallet.
|
|
528
|
+
*
|
|
529
|
+
* @param request - Contains chain_id and the signed transaction in base64 format
|
|
530
|
+
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
531
|
+
* @returns Transaction signature (hash) that can be used to track the transaction
|
|
532
|
+
*/
|
|
533
|
+
declare function sendSolanaTransaction(request: SendSolanaTransactionRequest, publishableKey?: string): Promise<SendSolanaTransactionResponse>;
|
|
476
534
|
|
|
477
535
|
/**
|
|
478
536
|
* User IP information interface
|
|
@@ -568,4 +626,4 @@ declare const i18n: {
|
|
|
568
626
|
};
|
|
569
627
|
type I18nStrings = typeof i18n;
|
|
570
628
|
|
|
571
|
-
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 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, queryExecutions, setApiConfig, useUserIp, verifyRecipientAddress };
|
|
629
|
+
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, 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
|
@@ -22,6 +22,7 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
ExecutionStatus: () => ExecutionStatus,
|
|
24
24
|
SOLANA_USDC_ADDRESS: () => SOLANA_USDC_ADDRESS,
|
|
25
|
+
buildSolanaTransaction: () => buildSolanaTransaction,
|
|
25
26
|
createDepositAddress: () => createDepositAddress,
|
|
26
27
|
createOnrampSession: () => createOnrampSession,
|
|
27
28
|
getAddressBalance: () => getAddressBalance,
|
|
@@ -42,7 +43,9 @@ __export(index_exports, {
|
|
|
42
43
|
getTokenMetadata: () => getTokenMetadata,
|
|
43
44
|
getWalletByChainType: () => getWalletByChainType,
|
|
44
45
|
i18n: () => i18n,
|
|
46
|
+
pollDirectExecutions: () => pollDirectExecutions,
|
|
45
47
|
queryExecutions: () => queryExecutions,
|
|
48
|
+
sendSolanaTransaction: () => sendSolanaTransaction,
|
|
46
49
|
setApiConfig: () => setApiConfig,
|
|
47
50
|
useUserIp: () => useUserIp,
|
|
48
51
|
verifyRecipientAddress: () => verifyRecipientAddress
|
|
@@ -164,6 +167,26 @@ async function queryExecutions(externalUserId, publishableKey) {
|
|
|
164
167
|
}
|
|
165
168
|
return response.json();
|
|
166
169
|
}
|
|
170
|
+
async function pollDirectExecutions(request, publishableKey) {
|
|
171
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
172
|
+
validatePublishableKey(pk);
|
|
173
|
+
const response = await fetch(
|
|
174
|
+
`${API_BASE_URL}/v1/public/direct_executions/poll`,
|
|
175
|
+
{
|
|
176
|
+
method: "POST",
|
|
177
|
+
headers: {
|
|
178
|
+
accept: "application/json",
|
|
179
|
+
"x-publishable-key": pk,
|
|
180
|
+
"Content-Type": "application/json"
|
|
181
|
+
},
|
|
182
|
+
body: JSON.stringify(request)
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
if (!response.ok) {
|
|
186
|
+
throw new Error(`Failed to poll direct executions: ${response.statusText}`);
|
|
187
|
+
}
|
|
188
|
+
return response.json();
|
|
189
|
+
}
|
|
167
190
|
async function getSupportedDepositTokens(publishableKey, options) {
|
|
168
191
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
169
192
|
validatePublishableKey(pk);
|
|
@@ -439,6 +462,46 @@ async function verifyRecipientAddress(request, publishableKey) {
|
|
|
439
462
|
}
|
|
440
463
|
return response.json();
|
|
441
464
|
}
|
|
465
|
+
async function buildSolanaTransaction(request, publishableKey) {
|
|
466
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
467
|
+
validatePublishableKey(pk);
|
|
468
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/transactions/solana/build`, {
|
|
469
|
+
method: "POST",
|
|
470
|
+
headers: {
|
|
471
|
+
accept: "application/json",
|
|
472
|
+
"x-publishable-key": pk,
|
|
473
|
+
"Content-Type": "application/json"
|
|
474
|
+
},
|
|
475
|
+
body: JSON.stringify(request)
|
|
476
|
+
});
|
|
477
|
+
if (!response.ok) {
|
|
478
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
479
|
+
throw new Error(
|
|
480
|
+
`Failed to build Solana transaction: ${error.message || response.statusText}`
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
return response.json();
|
|
484
|
+
}
|
|
485
|
+
async function sendSolanaTransaction(request, publishableKey) {
|
|
486
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
487
|
+
validatePublishableKey(pk);
|
|
488
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/transactions/solana/send`, {
|
|
489
|
+
method: "POST",
|
|
490
|
+
headers: {
|
|
491
|
+
accept: "application/json",
|
|
492
|
+
"x-publishable-key": pk,
|
|
493
|
+
"Content-Type": "application/json"
|
|
494
|
+
},
|
|
495
|
+
body: JSON.stringify(request)
|
|
496
|
+
});
|
|
497
|
+
if (!response.ok) {
|
|
498
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
499
|
+
throw new Error(
|
|
500
|
+
`Failed to send Solana transaction: ${error.message || response.statusText}`
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
return response.json();
|
|
504
|
+
}
|
|
442
505
|
|
|
443
506
|
// src/hooks/use-user-ip.ts
|
|
444
507
|
var import_react_query = require("@tanstack/react-query");
|
|
@@ -547,6 +610,7 @@ var i18n = en_default;
|
|
|
547
610
|
0 && (module.exports = {
|
|
548
611
|
ExecutionStatus,
|
|
549
612
|
SOLANA_USDC_ADDRESS,
|
|
613
|
+
buildSolanaTransaction,
|
|
550
614
|
createDepositAddress,
|
|
551
615
|
createOnrampSession,
|
|
552
616
|
getAddressBalance,
|
|
@@ -567,7 +631,9 @@ var i18n = en_default;
|
|
|
567
631
|
getTokenMetadata,
|
|
568
632
|
getWalletByChainType,
|
|
569
633
|
i18n,
|
|
634
|
+
pollDirectExecutions,
|
|
570
635
|
queryExecutions,
|
|
636
|
+
sendSolanaTransaction,
|
|
571
637
|
setApiConfig,
|
|
572
638
|
useUserIp,
|
|
573
639
|
verifyRecipientAddress
|
package/dist/index.mjs
CHANGED
|
@@ -113,6 +113,26 @@ async function queryExecutions(externalUserId, publishableKey) {
|
|
|
113
113
|
}
|
|
114
114
|
return response.json();
|
|
115
115
|
}
|
|
116
|
+
async function pollDirectExecutions(request, publishableKey) {
|
|
117
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
118
|
+
validatePublishableKey(pk);
|
|
119
|
+
const response = await fetch(
|
|
120
|
+
`${API_BASE_URL}/v1/public/direct_executions/poll`,
|
|
121
|
+
{
|
|
122
|
+
method: "POST",
|
|
123
|
+
headers: {
|
|
124
|
+
accept: "application/json",
|
|
125
|
+
"x-publishable-key": pk,
|
|
126
|
+
"Content-Type": "application/json"
|
|
127
|
+
},
|
|
128
|
+
body: JSON.stringify(request)
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
if (!response.ok) {
|
|
132
|
+
throw new Error(`Failed to poll direct executions: ${response.statusText}`);
|
|
133
|
+
}
|
|
134
|
+
return response.json();
|
|
135
|
+
}
|
|
116
136
|
async function getSupportedDepositTokens(publishableKey, options) {
|
|
117
137
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
118
138
|
validatePublishableKey(pk);
|
|
@@ -388,6 +408,46 @@ async function verifyRecipientAddress(request, publishableKey) {
|
|
|
388
408
|
}
|
|
389
409
|
return response.json();
|
|
390
410
|
}
|
|
411
|
+
async function buildSolanaTransaction(request, publishableKey) {
|
|
412
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
413
|
+
validatePublishableKey(pk);
|
|
414
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/transactions/solana/build`, {
|
|
415
|
+
method: "POST",
|
|
416
|
+
headers: {
|
|
417
|
+
accept: "application/json",
|
|
418
|
+
"x-publishable-key": pk,
|
|
419
|
+
"Content-Type": "application/json"
|
|
420
|
+
},
|
|
421
|
+
body: JSON.stringify(request)
|
|
422
|
+
});
|
|
423
|
+
if (!response.ok) {
|
|
424
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
425
|
+
throw new Error(
|
|
426
|
+
`Failed to build Solana transaction: ${error.message || response.statusText}`
|
|
427
|
+
);
|
|
428
|
+
}
|
|
429
|
+
return response.json();
|
|
430
|
+
}
|
|
431
|
+
async function sendSolanaTransaction(request, publishableKey) {
|
|
432
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
433
|
+
validatePublishableKey(pk);
|
|
434
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/transactions/solana/send`, {
|
|
435
|
+
method: "POST",
|
|
436
|
+
headers: {
|
|
437
|
+
accept: "application/json",
|
|
438
|
+
"x-publishable-key": pk,
|
|
439
|
+
"Content-Type": "application/json"
|
|
440
|
+
},
|
|
441
|
+
body: JSON.stringify(request)
|
|
442
|
+
});
|
|
443
|
+
if (!response.ok) {
|
|
444
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
445
|
+
throw new Error(
|
|
446
|
+
`Failed to send Solana transaction: ${error.message || response.statusText}`
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
return response.json();
|
|
450
|
+
}
|
|
391
451
|
|
|
392
452
|
// src/hooks/use-user-ip.ts
|
|
393
453
|
import { useQuery } from "@tanstack/react-query";
|
|
@@ -495,6 +555,7 @@ var i18n = en_default;
|
|
|
495
555
|
export {
|
|
496
556
|
ExecutionStatus,
|
|
497
557
|
SOLANA_USDC_ADDRESS,
|
|
558
|
+
buildSolanaTransaction,
|
|
498
559
|
createDepositAddress,
|
|
499
560
|
createOnrampSession,
|
|
500
561
|
getAddressBalance,
|
|
@@ -515,7 +576,9 @@ export {
|
|
|
515
576
|
getTokenMetadata,
|
|
516
577
|
getWalletByChainType,
|
|
517
578
|
i18n,
|
|
579
|
+
pollDirectExecutions,
|
|
518
580
|
queryExecutions,
|
|
581
|
+
sendSolanaTransaction,
|
|
519
582
|
setApiConfig,
|
|
520
583
|
useUserIp,
|
|
521
584
|
verifyRecipientAddress
|