@unifold/core 0.1.52 → 0.1.53

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 CHANGED
@@ -204,6 +204,7 @@ declare function getSupportedDepositTokens(publishableKey?: string, options?: {
204
204
  destination_token_address?: string;
205
205
  destination_chain_id?: string;
206
206
  destination_chain_type?: string;
207
+ product_type?: "deposit" | "payment";
207
208
  }): Promise<SupportedDepositTokensResponse>;
208
209
  interface TokenMetadata {
209
210
  symbol: string;
@@ -242,7 +243,7 @@ interface FiatCurrency {
242
243
  icon_url: string;
243
244
  icon_urls: IconUrl[];
244
245
  country_codes: string[];
245
- default_amount: number;
246
+ default_amount: number | null;
246
247
  minimum_amount: number;
247
248
  maximum_amount: number;
248
249
  suggested_amounts: number[];
@@ -882,6 +883,11 @@ interface DepositQuoteRequest {
882
883
  destination_chain_type: string;
883
884
  destination_chain_id: string;
884
885
  destination_token_address: string;
886
+ /**
887
+ * When true, the source amount is inflated by the expected slippage to
888
+ * reduce stuck payments. Typically set by the checkout flow.
889
+ */
890
+ adjust_for_slippage?: boolean;
885
891
  }
886
892
  interface DepositQuote {
887
893
  /**
@@ -901,6 +907,17 @@ interface DepositQuote {
901
907
  destination_token_symbol: string;
902
908
  estimated_price_impact_percent: number | null;
903
909
  estimated_fees_usd: string | null;
910
+ /**
911
+ * The slippage buffer percentage applied to the source amount.
912
+ * Present when `adjust_for_slippage` was true; null otherwise.
913
+ */
914
+ slippage_buffer_percent: number | null;
915
+ /**
916
+ * Expected slippage for this route (from Relay or token config).
917
+ * Always present when slippage data is available, regardless of
918
+ * `adjust_for_slippage`.
919
+ */
920
+ expected_slippage_percent: number | null;
904
921
  }
905
922
  /**
906
923
  * Get a deposit quote: how much source token is needed to receive a
package/dist/index.d.ts CHANGED
@@ -204,6 +204,7 @@ declare function getSupportedDepositTokens(publishableKey?: string, options?: {
204
204
  destination_token_address?: string;
205
205
  destination_chain_id?: string;
206
206
  destination_chain_type?: string;
207
+ product_type?: "deposit" | "payment";
207
208
  }): Promise<SupportedDepositTokensResponse>;
208
209
  interface TokenMetadata {
209
210
  symbol: string;
@@ -242,7 +243,7 @@ interface FiatCurrency {
242
243
  icon_url: string;
243
244
  icon_urls: IconUrl[];
244
245
  country_codes: string[];
245
- default_amount: number;
246
+ default_amount: number | null;
246
247
  minimum_amount: number;
247
248
  maximum_amount: number;
248
249
  suggested_amounts: number[];
@@ -882,6 +883,11 @@ interface DepositQuoteRequest {
882
883
  destination_chain_type: string;
883
884
  destination_chain_id: string;
884
885
  destination_token_address: string;
886
+ /**
887
+ * When true, the source amount is inflated by the expected slippage to
888
+ * reduce stuck payments. Typically set by the checkout flow.
889
+ */
890
+ adjust_for_slippage?: boolean;
885
891
  }
886
892
  interface DepositQuote {
887
893
  /**
@@ -901,6 +907,17 @@ interface DepositQuote {
901
907
  destination_token_symbol: string;
902
908
  estimated_price_impact_percent: number | null;
903
909
  estimated_fees_usd: string | null;
910
+ /**
911
+ * The slippage buffer percentage applied to the source amount.
912
+ * Present when `adjust_for_slippage` was true; null otherwise.
913
+ */
914
+ slippage_buffer_percent: number | null;
915
+ /**
916
+ * Expected slippage for this route (from Relay or token config).
917
+ * Always present when slippage data is available, regardless of
918
+ * `adjust_for_slippage`.
919
+ */
920
+ expected_slippage_percent: number | null;
904
921
  }
905
922
  /**
906
923
  * Get a deposit quote: how much source token is needed to receive a
package/dist/index.js CHANGED
@@ -234,13 +234,18 @@ async function getSupportedDepositTokens(publishableKey, options) {
234
234
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
235
235
  validatePublishableKey(pk);
236
236
  let url = `${API_BASE_URL}/v1/public/tokens/supported_deposit_tokens`;
237
+ const params = new URLSearchParams();
237
238
  if (options?.destination_token_address && options?.destination_chain_id && options?.destination_chain_type) {
238
- const params = new URLSearchParams({
239
- destination_token_address: options.destination_token_address,
240
- destination_chain_id: options.destination_chain_id,
241
- destination_chain_type: options.destination_chain_type
242
- });
243
- url = `${url}?${params.toString()}`;
239
+ params.set("destination_token_address", options.destination_token_address);
240
+ params.set("destination_chain_id", options.destination_chain_id);
241
+ params.set("destination_chain_type", options.destination_chain_type);
242
+ }
243
+ if (options?.product_type) {
244
+ params.set("product_type", options.product_type);
245
+ }
246
+ const qs = params.toString();
247
+ if (qs) {
248
+ url = `${url}?${qs}`;
244
249
  }
245
250
  const response = await fetch(url, {
246
251
  method: "GET",
package/dist/index.mjs CHANGED
@@ -166,13 +166,18 @@ async function getSupportedDepositTokens(publishableKey, options) {
166
166
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
167
167
  validatePublishableKey(pk);
168
168
  let url = `${API_BASE_URL}/v1/public/tokens/supported_deposit_tokens`;
169
+ const params = new URLSearchParams();
169
170
  if (options?.destination_token_address && options?.destination_chain_id && options?.destination_chain_type) {
170
- const params = new URLSearchParams({
171
- destination_token_address: options.destination_token_address,
172
- destination_chain_id: options.destination_chain_id,
173
- destination_chain_type: options.destination_chain_type
174
- });
175
- url = `${url}?${params.toString()}`;
171
+ params.set("destination_token_address", options.destination_token_address);
172
+ params.set("destination_chain_id", options.destination_chain_id);
173
+ params.set("destination_chain_type", options.destination_chain_type);
174
+ }
175
+ if (options?.product_type) {
176
+ params.set("product_type", options.product_type);
177
+ }
178
+ const qs = params.toString();
179
+ if (qs) {
180
+ url = `${url}?${qs}`;
176
181
  }
177
182
  const response = await fetch(url, {
178
183
  method: "GET",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unifold/core",
3
- "version": "0.1.52",
3
+ "version": "0.1.53",
4
4
  "description": "Unifold Core SDK - Core types, API client, and business logic",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",