@unifold/core 0.1.40 → 0.1.42
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 +62 -4
- package/dist/index.d.ts +62 -4
- package/dist/index.js +62 -4
- package/dist/index.mjs +60 -4
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -36,12 +36,18 @@ interface Wallet {
|
|
|
36
36
|
interface DepositAddressResponse {
|
|
37
37
|
data: Wallet[];
|
|
38
38
|
}
|
|
39
|
+
declare enum ActionType {
|
|
40
|
+
Deposit = "deposit",
|
|
41
|
+
Withdraw = "withdraw"
|
|
42
|
+
}
|
|
39
43
|
interface CreateDepositAddressRequest {
|
|
40
44
|
external_user_id: string;
|
|
41
45
|
destination_chain_type: string;
|
|
42
46
|
destination_chain_id: string;
|
|
43
47
|
destination_token_address: string;
|
|
44
48
|
recipient_address: string;
|
|
49
|
+
/** @default ActionType.Deposit */
|
|
50
|
+
action_type?: ActionType;
|
|
45
51
|
client_metadata?: Record<string, unknown>;
|
|
46
52
|
}
|
|
47
53
|
/**
|
|
@@ -93,6 +99,7 @@ interface AutoSwapResponse {
|
|
|
93
99
|
destination_explorer_url: string | null;
|
|
94
100
|
destination_transaction_hashes: string[];
|
|
95
101
|
status: ExecutionStatus;
|
|
102
|
+
failure_reason: string | null;
|
|
96
103
|
source_token_metadata?: {
|
|
97
104
|
icon_url: string;
|
|
98
105
|
icon_urls?: IconUrl[];
|
|
@@ -115,6 +122,7 @@ interface AutoSwapResponse {
|
|
|
115
122
|
declare const SOLANA_USDC_ADDRESS = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
116
123
|
interface QueryExecutionsRequest {
|
|
117
124
|
external_user_id: string;
|
|
125
|
+
action_type?: ActionType;
|
|
118
126
|
}
|
|
119
127
|
interface QueryExecutionsResponse {
|
|
120
128
|
data: AutoSwapResponse[];
|
|
@@ -122,12 +130,12 @@ interface QueryExecutionsResponse {
|
|
|
122
130
|
has_more: boolean;
|
|
123
131
|
}
|
|
124
132
|
/**
|
|
125
|
-
* Query
|
|
126
|
-
* Returns ALL executions - filter client-side for new ones
|
|
133
|
+
* Query direct executions for a user, optionally filtered by action type.
|
|
127
134
|
* @param externalUserId - External user ID
|
|
128
135
|
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
136
|
+
* @param actionType - Optional filter: ActionType.Deposit or ActionType.Withdraw
|
|
129
137
|
*/
|
|
130
|
-
declare function queryExecutions(externalUserId: string, publishableKey?: string): Promise<QueryExecutionsResponse>;
|
|
138
|
+
declare function queryExecutions(externalUserId: string, publishableKey?: string, actionType?: ActionType): Promise<QueryExecutionsResponse>;
|
|
131
139
|
interface PollExecutionsRequest {
|
|
132
140
|
deposit_wallet_id: string;
|
|
133
141
|
}
|
|
@@ -154,6 +162,30 @@ interface SupportedChain {
|
|
|
154
162
|
estimated_processing_time: number | null;
|
|
155
163
|
minimum_deposit_amount_usd: number;
|
|
156
164
|
}
|
|
165
|
+
interface DestinationTokenChain {
|
|
166
|
+
chain_id: string;
|
|
167
|
+
chain_name: string;
|
|
168
|
+
chain_type: string;
|
|
169
|
+
token_address: string;
|
|
170
|
+
decimals: number;
|
|
171
|
+
icon_url: string;
|
|
172
|
+
icon_urls?: IconUrl[];
|
|
173
|
+
}
|
|
174
|
+
interface DestinationToken {
|
|
175
|
+
symbol: string;
|
|
176
|
+
name: string;
|
|
177
|
+
icon_url: string;
|
|
178
|
+
icon_urls?: IconUrl[];
|
|
179
|
+
chains: DestinationTokenChain[];
|
|
180
|
+
}
|
|
181
|
+
interface SupportedDestinationTokensResponse {
|
|
182
|
+
data: DestinationToken[];
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Get supported destination tokens (used for withdraw flow)
|
|
186
|
+
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
187
|
+
*/
|
|
188
|
+
declare function getSupportedDestinationTokens(publishableKey?: string): Promise<SupportedDestinationTokensResponse>;
|
|
157
189
|
interface SupportedToken {
|
|
158
190
|
symbol: string;
|
|
159
191
|
name: string;
|
|
@@ -691,7 +723,33 @@ declare const i18n: {
|
|
|
691
723
|
intentAddressNote: string;
|
|
692
724
|
};
|
|
693
725
|
};
|
|
726
|
+
withdrawModal: {
|
|
727
|
+
title: string;
|
|
728
|
+
withdrawCrypto: {
|
|
729
|
+
title: string;
|
|
730
|
+
subtitle: string;
|
|
731
|
+
};
|
|
732
|
+
selectToken: string;
|
|
733
|
+
receiveToken: string;
|
|
734
|
+
receiveChain: string;
|
|
735
|
+
recipientAddress: string;
|
|
736
|
+
recipientAddressPlaceholder: string;
|
|
737
|
+
amount: string;
|
|
738
|
+
amountPlaceholder: string;
|
|
739
|
+
balance: string;
|
|
740
|
+
minimum: string;
|
|
741
|
+
withdraw: string;
|
|
742
|
+
invalidAddress: string;
|
|
743
|
+
invalidAmount: string;
|
|
744
|
+
verifyingAddress: string;
|
|
745
|
+
loading: string;
|
|
746
|
+
noTokensAvailable: string;
|
|
747
|
+
sourceToken: string;
|
|
748
|
+
review: string;
|
|
749
|
+
confirm: string;
|
|
750
|
+
back: string;
|
|
751
|
+
};
|
|
694
752
|
};
|
|
695
753
|
type I18nStrings = typeof i18n;
|
|
696
754
|
|
|
697
|
-
export { 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 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 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, getTokenChains, getTokenMetadata, getWalletByChainType, i18n, pollDirectExecutions, queryExecutions, sendSolanaTransaction, setApiConfig, useUserIp, verifyRecipientAddress };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -36,12 +36,18 @@ interface Wallet {
|
|
|
36
36
|
interface DepositAddressResponse {
|
|
37
37
|
data: Wallet[];
|
|
38
38
|
}
|
|
39
|
+
declare enum ActionType {
|
|
40
|
+
Deposit = "deposit",
|
|
41
|
+
Withdraw = "withdraw"
|
|
42
|
+
}
|
|
39
43
|
interface CreateDepositAddressRequest {
|
|
40
44
|
external_user_id: string;
|
|
41
45
|
destination_chain_type: string;
|
|
42
46
|
destination_chain_id: string;
|
|
43
47
|
destination_token_address: string;
|
|
44
48
|
recipient_address: string;
|
|
49
|
+
/** @default ActionType.Deposit */
|
|
50
|
+
action_type?: ActionType;
|
|
45
51
|
client_metadata?: Record<string, unknown>;
|
|
46
52
|
}
|
|
47
53
|
/**
|
|
@@ -93,6 +99,7 @@ interface AutoSwapResponse {
|
|
|
93
99
|
destination_explorer_url: string | null;
|
|
94
100
|
destination_transaction_hashes: string[];
|
|
95
101
|
status: ExecutionStatus;
|
|
102
|
+
failure_reason: string | null;
|
|
96
103
|
source_token_metadata?: {
|
|
97
104
|
icon_url: string;
|
|
98
105
|
icon_urls?: IconUrl[];
|
|
@@ -115,6 +122,7 @@ interface AutoSwapResponse {
|
|
|
115
122
|
declare const SOLANA_USDC_ADDRESS = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
116
123
|
interface QueryExecutionsRequest {
|
|
117
124
|
external_user_id: string;
|
|
125
|
+
action_type?: ActionType;
|
|
118
126
|
}
|
|
119
127
|
interface QueryExecutionsResponse {
|
|
120
128
|
data: AutoSwapResponse[];
|
|
@@ -122,12 +130,12 @@ interface QueryExecutionsResponse {
|
|
|
122
130
|
has_more: boolean;
|
|
123
131
|
}
|
|
124
132
|
/**
|
|
125
|
-
* Query
|
|
126
|
-
* Returns ALL executions - filter client-side for new ones
|
|
133
|
+
* Query direct executions for a user, optionally filtered by action type.
|
|
127
134
|
* @param externalUserId - External user ID
|
|
128
135
|
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
136
|
+
* @param actionType - Optional filter: ActionType.Deposit or ActionType.Withdraw
|
|
129
137
|
*/
|
|
130
|
-
declare function queryExecutions(externalUserId: string, publishableKey?: string): Promise<QueryExecutionsResponse>;
|
|
138
|
+
declare function queryExecutions(externalUserId: string, publishableKey?: string, actionType?: ActionType): Promise<QueryExecutionsResponse>;
|
|
131
139
|
interface PollExecutionsRequest {
|
|
132
140
|
deposit_wallet_id: string;
|
|
133
141
|
}
|
|
@@ -154,6 +162,30 @@ interface SupportedChain {
|
|
|
154
162
|
estimated_processing_time: number | null;
|
|
155
163
|
minimum_deposit_amount_usd: number;
|
|
156
164
|
}
|
|
165
|
+
interface DestinationTokenChain {
|
|
166
|
+
chain_id: string;
|
|
167
|
+
chain_name: string;
|
|
168
|
+
chain_type: string;
|
|
169
|
+
token_address: string;
|
|
170
|
+
decimals: number;
|
|
171
|
+
icon_url: string;
|
|
172
|
+
icon_urls?: IconUrl[];
|
|
173
|
+
}
|
|
174
|
+
interface DestinationToken {
|
|
175
|
+
symbol: string;
|
|
176
|
+
name: string;
|
|
177
|
+
icon_url: string;
|
|
178
|
+
icon_urls?: IconUrl[];
|
|
179
|
+
chains: DestinationTokenChain[];
|
|
180
|
+
}
|
|
181
|
+
interface SupportedDestinationTokensResponse {
|
|
182
|
+
data: DestinationToken[];
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Get supported destination tokens (used for withdraw flow)
|
|
186
|
+
* @param publishableKey - Optional publishable key, defaults to configured key
|
|
187
|
+
*/
|
|
188
|
+
declare function getSupportedDestinationTokens(publishableKey?: string): Promise<SupportedDestinationTokensResponse>;
|
|
157
189
|
interface SupportedToken {
|
|
158
190
|
symbol: string;
|
|
159
191
|
name: string;
|
|
@@ -691,7 +723,33 @@ declare const i18n: {
|
|
|
691
723
|
intentAddressNote: string;
|
|
692
724
|
};
|
|
693
725
|
};
|
|
726
|
+
withdrawModal: {
|
|
727
|
+
title: string;
|
|
728
|
+
withdrawCrypto: {
|
|
729
|
+
title: string;
|
|
730
|
+
subtitle: string;
|
|
731
|
+
};
|
|
732
|
+
selectToken: string;
|
|
733
|
+
receiveToken: string;
|
|
734
|
+
receiveChain: string;
|
|
735
|
+
recipientAddress: string;
|
|
736
|
+
recipientAddressPlaceholder: string;
|
|
737
|
+
amount: string;
|
|
738
|
+
amountPlaceholder: string;
|
|
739
|
+
balance: string;
|
|
740
|
+
minimum: string;
|
|
741
|
+
withdraw: string;
|
|
742
|
+
invalidAddress: string;
|
|
743
|
+
invalidAmount: string;
|
|
744
|
+
verifyingAddress: string;
|
|
745
|
+
loading: string;
|
|
746
|
+
noTokensAvailable: string;
|
|
747
|
+
sourceToken: string;
|
|
748
|
+
review: string;
|
|
749
|
+
confirm: string;
|
|
750
|
+
back: string;
|
|
751
|
+
};
|
|
694
752
|
};
|
|
695
753
|
type I18nStrings = typeof i18n;
|
|
696
754
|
|
|
697
|
-
export { 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 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 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, getTokenChains, getTokenMetadata, getWalletByChainType, i18n, pollDirectExecutions, queryExecutions, sendSolanaTransaction, setApiConfig, useUserIp, verifyRecipientAddress };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
ActionType: () => ActionType,
|
|
23
24
|
ExecutionStatus: () => ExecutionStatus,
|
|
24
25
|
IneligibilityReason: () => IneligibilityReason,
|
|
25
26
|
SOLANA_USDC_ADDRESS: () => SOLANA_USDC_ADDRESS,
|
|
@@ -43,6 +44,7 @@ __export(index_exports, {
|
|
|
43
44
|
getPreferredIconUrl: () => getPreferredIconUrl,
|
|
44
45
|
getProjectConfig: () => getProjectConfig,
|
|
45
46
|
getSupportedDepositTokens: () => getSupportedDepositTokens,
|
|
47
|
+
getSupportedDestinationTokens: () => getSupportedDestinationTokens,
|
|
46
48
|
getTokenChains: () => getTokenChains,
|
|
47
49
|
getTokenMetadata: () => getTokenMetadata,
|
|
48
50
|
getWalletByChainType: () => getWalletByChainType,
|
|
@@ -109,6 +111,11 @@ function getIconUrlWithCdn(iconPath, assetCdnUrl) {
|
|
|
109
111
|
const baseUrl = assetCdnUrl.endsWith("/") ? assetCdnUrl.slice(0, -1) : assetCdnUrl;
|
|
110
112
|
return `${baseUrl}/api/public${normalizedPath}`;
|
|
111
113
|
}
|
|
114
|
+
var ActionType = /* @__PURE__ */ ((ActionType2) => {
|
|
115
|
+
ActionType2["Deposit"] = "deposit";
|
|
116
|
+
ActionType2["Withdraw"] = "withdraw";
|
|
117
|
+
return ActionType2;
|
|
118
|
+
})(ActionType || {});
|
|
112
119
|
async function createDepositAddress(overrides, publishableKey) {
|
|
113
120
|
if (!overrides?.external_user_id) {
|
|
114
121
|
throw new Error("external_user_id is required");
|
|
@@ -119,6 +126,7 @@ async function createDepositAddress(overrides, publishableKey) {
|
|
|
119
126
|
destination_chain_id: overrides?.destination_chain_id || DEFAULT_CONFIG.destinationChainId || "8453",
|
|
120
127
|
destination_token_address: overrides?.destination_token_address || DEFAULT_CONFIG.destinationTokenAddress || "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
|
|
121
128
|
recipient_address: overrides?.recipient_address || DEFAULT_CONFIG.recipientAddress || "0x309a4154a2CD4153Da886E780890C9cb5161553C",
|
|
129
|
+
...overrides?.action_type ? { action_type: overrides.action_type } : {},
|
|
122
130
|
client_metadata: overrides?.client_metadata || {}
|
|
123
131
|
};
|
|
124
132
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
@@ -150,9 +158,13 @@ var ExecutionStatus = /* @__PURE__ */ ((ExecutionStatus2) => {
|
|
|
150
158
|
return ExecutionStatus2;
|
|
151
159
|
})(ExecutionStatus || {});
|
|
152
160
|
var SOLANA_USDC_ADDRESS = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
153
|
-
async function queryExecutions(externalUserId, publishableKey) {
|
|
161
|
+
async function queryExecutions(externalUserId, publishableKey, actionType) {
|
|
154
162
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
155
163
|
validatePublishableKey(pk);
|
|
164
|
+
const body = {
|
|
165
|
+
external_user_id: externalUserId,
|
|
166
|
+
...actionType ? { action_type: actionType } : {}
|
|
167
|
+
};
|
|
156
168
|
const response = await fetch(
|
|
157
169
|
`${API_BASE_URL}/v1/public/direct_executions/query`,
|
|
158
170
|
{
|
|
@@ -162,9 +174,7 @@ async function queryExecutions(externalUserId, publishableKey) {
|
|
|
162
174
|
"x-publishable-key": pk,
|
|
163
175
|
"Content-Type": "application/json"
|
|
164
176
|
},
|
|
165
|
-
body: JSON.stringify(
|
|
166
|
-
external_user_id: externalUserId
|
|
167
|
-
})
|
|
177
|
+
body: JSON.stringify(body)
|
|
168
178
|
}
|
|
169
179
|
);
|
|
170
180
|
if (!response.ok) {
|
|
@@ -192,6 +202,26 @@ async function pollDirectExecutions(request, publishableKey) {
|
|
|
192
202
|
}
|
|
193
203
|
return response.json();
|
|
194
204
|
}
|
|
205
|
+
async function getSupportedDestinationTokens(publishableKey) {
|
|
206
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
207
|
+
validatePublishableKey(pk);
|
|
208
|
+
const response = await fetch(
|
|
209
|
+
`${API_BASE_URL}/v1/public/tokens/supported_destination_tokens`,
|
|
210
|
+
{
|
|
211
|
+
method: "GET",
|
|
212
|
+
headers: {
|
|
213
|
+
accept: "application/json",
|
|
214
|
+
"x-publishable-key": pk
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
if (!response.ok) {
|
|
219
|
+
throw new Error(
|
|
220
|
+
`Failed to fetch supported destination tokens: ${response.statusText}`
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
return response.json();
|
|
224
|
+
}
|
|
195
225
|
async function getSupportedDepositTokens(publishableKey, options) {
|
|
196
226
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
197
227
|
validatePublishableKey(pk);
|
|
@@ -675,6 +705,32 @@ var en_default = {
|
|
|
675
705
|
youReceive: "You receive",
|
|
676
706
|
intentAddressNote: "The wallet address displayed in the payment provider is a temporary deposit address. Your funds will be automatically converted and deposited into your account."
|
|
677
707
|
}
|
|
708
|
+
},
|
|
709
|
+
withdrawModal: {
|
|
710
|
+
title: "Withdraw",
|
|
711
|
+
withdrawCrypto: {
|
|
712
|
+
title: "Withdraw with Crypto",
|
|
713
|
+
subtitle: "Send to any wallet address"
|
|
714
|
+
},
|
|
715
|
+
selectToken: "Select withdrawal token",
|
|
716
|
+
receiveToken: "Receive token",
|
|
717
|
+
receiveChain: "Receive chain",
|
|
718
|
+
recipientAddress: "Recipient address",
|
|
719
|
+
recipientAddressPlaceholder: "Enter wallet address",
|
|
720
|
+
amount: "Amount",
|
|
721
|
+
amountPlaceholder: "0.00",
|
|
722
|
+
balance: "Balance",
|
|
723
|
+
minimum: "min",
|
|
724
|
+
withdraw: "Withdraw",
|
|
725
|
+
invalidAddress: "Please enter a valid address",
|
|
726
|
+
invalidAmount: "Please enter a valid amount",
|
|
727
|
+
verifyingAddress: "Verifying address...",
|
|
728
|
+
loading: "Loading...",
|
|
729
|
+
noTokensAvailable: "No tokens available",
|
|
730
|
+
sourceToken: "Source token",
|
|
731
|
+
review: "Review",
|
|
732
|
+
confirm: "Confirm Withdrawal",
|
|
733
|
+
back: "Back"
|
|
678
734
|
}
|
|
679
735
|
};
|
|
680
736
|
|
|
@@ -682,6 +738,7 @@ var en_default = {
|
|
|
682
738
|
var i18n = en_default;
|
|
683
739
|
// Annotate the CommonJS export names for ESM import in node:
|
|
684
740
|
0 && (module.exports = {
|
|
741
|
+
ActionType,
|
|
685
742
|
ExecutionStatus,
|
|
686
743
|
IneligibilityReason,
|
|
687
744
|
SOLANA_USDC_ADDRESS,
|
|
@@ -705,6 +762,7 @@ var i18n = en_default;
|
|
|
705
762
|
getPreferredIconUrl,
|
|
706
763
|
getProjectConfig,
|
|
707
764
|
getSupportedDepositTokens,
|
|
765
|
+
getSupportedDestinationTokens,
|
|
708
766
|
getTokenChains,
|
|
709
767
|
getTokenMetadata,
|
|
710
768
|
getWalletByChainType,
|
package/dist/index.mjs
CHANGED
|
@@ -51,6 +51,11 @@ function getIconUrlWithCdn(iconPath, assetCdnUrl) {
|
|
|
51
51
|
const baseUrl = assetCdnUrl.endsWith("/") ? assetCdnUrl.slice(0, -1) : assetCdnUrl;
|
|
52
52
|
return `${baseUrl}/api/public${normalizedPath}`;
|
|
53
53
|
}
|
|
54
|
+
var ActionType = /* @__PURE__ */ ((ActionType2) => {
|
|
55
|
+
ActionType2["Deposit"] = "deposit";
|
|
56
|
+
ActionType2["Withdraw"] = "withdraw";
|
|
57
|
+
return ActionType2;
|
|
58
|
+
})(ActionType || {});
|
|
54
59
|
async function createDepositAddress(overrides, publishableKey) {
|
|
55
60
|
if (!overrides?.external_user_id) {
|
|
56
61
|
throw new Error("external_user_id is required");
|
|
@@ -61,6 +66,7 @@ async function createDepositAddress(overrides, publishableKey) {
|
|
|
61
66
|
destination_chain_id: overrides?.destination_chain_id || DEFAULT_CONFIG.destinationChainId || "8453",
|
|
62
67
|
destination_token_address: overrides?.destination_token_address || DEFAULT_CONFIG.destinationTokenAddress || "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
|
|
63
68
|
recipient_address: overrides?.recipient_address || DEFAULT_CONFIG.recipientAddress || "0x309a4154a2CD4153Da886E780890C9cb5161553C",
|
|
69
|
+
...overrides?.action_type ? { action_type: overrides.action_type } : {},
|
|
64
70
|
client_metadata: overrides?.client_metadata || {}
|
|
65
71
|
};
|
|
66
72
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
@@ -92,9 +98,13 @@ var ExecutionStatus = /* @__PURE__ */ ((ExecutionStatus2) => {
|
|
|
92
98
|
return ExecutionStatus2;
|
|
93
99
|
})(ExecutionStatus || {});
|
|
94
100
|
var SOLANA_USDC_ADDRESS = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
|
|
95
|
-
async function queryExecutions(externalUserId, publishableKey) {
|
|
101
|
+
async function queryExecutions(externalUserId, publishableKey, actionType) {
|
|
96
102
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
97
103
|
validatePublishableKey(pk);
|
|
104
|
+
const body = {
|
|
105
|
+
external_user_id: externalUserId,
|
|
106
|
+
...actionType ? { action_type: actionType } : {}
|
|
107
|
+
};
|
|
98
108
|
const response = await fetch(
|
|
99
109
|
`${API_BASE_URL}/v1/public/direct_executions/query`,
|
|
100
110
|
{
|
|
@@ -104,9 +114,7 @@ async function queryExecutions(externalUserId, publishableKey) {
|
|
|
104
114
|
"x-publishable-key": pk,
|
|
105
115
|
"Content-Type": "application/json"
|
|
106
116
|
},
|
|
107
|
-
body: JSON.stringify(
|
|
108
|
-
external_user_id: externalUserId
|
|
109
|
-
})
|
|
117
|
+
body: JSON.stringify(body)
|
|
110
118
|
}
|
|
111
119
|
);
|
|
112
120
|
if (!response.ok) {
|
|
@@ -134,6 +142,26 @@ async function pollDirectExecutions(request, publishableKey) {
|
|
|
134
142
|
}
|
|
135
143
|
return response.json();
|
|
136
144
|
}
|
|
145
|
+
async function getSupportedDestinationTokens(publishableKey) {
|
|
146
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
147
|
+
validatePublishableKey(pk);
|
|
148
|
+
const response = await fetch(
|
|
149
|
+
`${API_BASE_URL}/v1/public/tokens/supported_destination_tokens`,
|
|
150
|
+
{
|
|
151
|
+
method: "GET",
|
|
152
|
+
headers: {
|
|
153
|
+
accept: "application/json",
|
|
154
|
+
"x-publishable-key": pk
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
if (!response.ok) {
|
|
159
|
+
throw new Error(
|
|
160
|
+
`Failed to fetch supported destination tokens: ${response.statusText}`
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
return response.json();
|
|
164
|
+
}
|
|
137
165
|
async function getSupportedDepositTokens(publishableKey, options) {
|
|
138
166
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
139
167
|
validatePublishableKey(pk);
|
|
@@ -617,12 +645,39 @@ var en_default = {
|
|
|
617
645
|
youReceive: "You receive",
|
|
618
646
|
intentAddressNote: "The wallet address displayed in the payment provider is a temporary deposit address. Your funds will be automatically converted and deposited into your account."
|
|
619
647
|
}
|
|
648
|
+
},
|
|
649
|
+
withdrawModal: {
|
|
650
|
+
title: "Withdraw",
|
|
651
|
+
withdrawCrypto: {
|
|
652
|
+
title: "Withdraw with Crypto",
|
|
653
|
+
subtitle: "Send to any wallet address"
|
|
654
|
+
},
|
|
655
|
+
selectToken: "Select withdrawal token",
|
|
656
|
+
receiveToken: "Receive token",
|
|
657
|
+
receiveChain: "Receive chain",
|
|
658
|
+
recipientAddress: "Recipient address",
|
|
659
|
+
recipientAddressPlaceholder: "Enter wallet address",
|
|
660
|
+
amount: "Amount",
|
|
661
|
+
amountPlaceholder: "0.00",
|
|
662
|
+
balance: "Balance",
|
|
663
|
+
minimum: "min",
|
|
664
|
+
withdraw: "Withdraw",
|
|
665
|
+
invalidAddress: "Please enter a valid address",
|
|
666
|
+
invalidAmount: "Please enter a valid amount",
|
|
667
|
+
verifyingAddress: "Verifying address...",
|
|
668
|
+
loading: "Loading...",
|
|
669
|
+
noTokensAvailable: "No tokens available",
|
|
670
|
+
sourceToken: "Source token",
|
|
671
|
+
review: "Review",
|
|
672
|
+
confirm: "Confirm Withdrawal",
|
|
673
|
+
back: "Back"
|
|
620
674
|
}
|
|
621
675
|
};
|
|
622
676
|
|
|
623
677
|
// src/lib/i18n.ts
|
|
624
678
|
var i18n = en_default;
|
|
625
679
|
export {
|
|
680
|
+
ActionType,
|
|
626
681
|
ExecutionStatus,
|
|
627
682
|
IneligibilityReason,
|
|
628
683
|
SOLANA_USDC_ADDRESS,
|
|
@@ -646,6 +701,7 @@ export {
|
|
|
646
701
|
getPreferredIconUrl,
|
|
647
702
|
getProjectConfig,
|
|
648
703
|
getSupportedDepositTokens,
|
|
704
|
+
getSupportedDestinationTokens,
|
|
649
705
|
getTokenChains,
|
|
650
706
|
getTokenMetadata,
|
|
651
707
|
getWalletByChainType,
|