@unifold/core 0.1.80 → 0.1.82
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 +29 -1
- package/dist/index.d.ts +29 -1
- package/dist/index.js +8 -2
- package/dist/index.mjs +8 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -258,6 +258,21 @@ declare function getSupportedDestinationTokens(publishableKey?: string, options?
|
|
|
258
258
|
*/
|
|
259
259
|
source_chain_type?: ChainType;
|
|
260
260
|
}): Promise<SupportedDestinationTokensResponse>;
|
|
261
|
+
/**
|
|
262
|
+
* Fiat currency a stablecoin is pegged to (lowercase ISO 4217). Mirrors the
|
|
263
|
+
* API's `FiatCurrency` enum; kept as a local union here because the SDK cannot
|
|
264
|
+
* import server-side types across the package boundary. Named distinctly from
|
|
265
|
+
* the onramp `FiatCurrency` object interface below.
|
|
266
|
+
*
|
|
267
|
+
* This is intentionally an OPEN union: `'usd'` and `'eur'` are listed for
|
|
268
|
+
* editor autocomplete, but the `(string & Record<never, never>)` member keeps
|
|
269
|
+
* the type forward-compatible. If the backend later adds a new fiat currency
|
|
270
|
+
* (e.g. `'gbp'`), an older SDK build still type-checks — the new value is a
|
|
271
|
+
* valid `string`, so consumers can compare/handle it without a TS error and
|
|
272
|
+
* without needing to upgrade. Always treat unknown values defensively rather
|
|
273
|
+
* than assuming USD.
|
|
274
|
+
*/
|
|
275
|
+
type StablecoinFiatCurrency = 'usd' | 'eur' | (string & Record<never, never>);
|
|
261
276
|
interface SupportedToken {
|
|
262
277
|
symbol: string;
|
|
263
278
|
/** Slugged `symbol` (e.g. "usdc", "usdc_e", "usdc_perp"). */
|
|
@@ -266,6 +281,12 @@ interface SupportedToken {
|
|
|
266
281
|
icon_url: string;
|
|
267
282
|
is_newly_added: boolean;
|
|
268
283
|
is_stablecoin: boolean;
|
|
284
|
+
/**
|
|
285
|
+
* Fiat currency a stablecoin tracks (e.g. "usd", "eur"). Present only for
|
|
286
|
+
* stablecoins. Consumers must not assume a stablecoin is USD-denominated —
|
|
287
|
+
* check this before treating a token amount as a USD amount.
|
|
288
|
+
*/
|
|
289
|
+
stablecoin_fiat_currency?: StablecoinFiatCurrency;
|
|
269
290
|
chains: SupportedChain[];
|
|
270
291
|
}
|
|
271
292
|
interface SupportedDepositTokensResponse {
|
|
@@ -297,6 +318,8 @@ interface TokenMetadata {
|
|
|
297
318
|
chain_id: string;
|
|
298
319
|
token_address: string;
|
|
299
320
|
decimals: number;
|
|
321
|
+
/** Catalog classification from `/v1/public/tokens/token`. */
|
|
322
|
+
is_stablecoin?: boolean;
|
|
300
323
|
chain_icon_url: string;
|
|
301
324
|
chain_icon_urls: IconUrl[];
|
|
302
325
|
}
|
|
@@ -400,6 +423,8 @@ interface OnrampQuote {
|
|
|
400
423
|
institution_name: string | null;
|
|
401
424
|
low_kyc: boolean;
|
|
402
425
|
partner_fee: number | null;
|
|
426
|
+
/** Seconds. Same unit as token `estimated_processing_time`. */
|
|
427
|
+
estimated_processing_time: number;
|
|
403
428
|
}
|
|
404
429
|
interface OnrampQuotesRequest {
|
|
405
430
|
country_code: string;
|
|
@@ -963,7 +988,7 @@ interface VerifyAddressRequest {
|
|
|
963
988
|
* Standard error codes for address validation failures.
|
|
964
989
|
* Used by frontend to display localized error messages.
|
|
965
990
|
*/
|
|
966
|
-
type AddressValidationFailureCode = 'token_not_supported' | 'not_opted_in' | 'insufficient_balance' | 'account_not_found' | 'validation_error';
|
|
991
|
+
type AddressValidationFailureCode = 'token_not_supported' | 'not_opted_in' | 'insufficient_balance' | 'account_not_found' | 'destination_tag_required' | 'validation_error';
|
|
967
992
|
interface AddressValidationMetadata {
|
|
968
993
|
chain_name?: string;
|
|
969
994
|
token_symbol?: string;
|
|
@@ -1900,6 +1925,7 @@ interface StripeQuotesResponse {
|
|
|
1900
1925
|
destination_network: string;
|
|
1901
1926
|
service_provider: string;
|
|
1902
1927
|
service_provider_display_name: string;
|
|
1928
|
+
estimated_processing_time: number;
|
|
1903
1929
|
destination_network_quotes: Record<string, unknown[]>;
|
|
1904
1930
|
}
|
|
1905
1931
|
/**
|
|
@@ -2897,6 +2923,8 @@ interface OnrampProviderQuote {
|
|
|
2897
2923
|
iconUrl: string;
|
|
2898
2924
|
iconUrls: IconUrl[];
|
|
2899
2925
|
institutionName: string | null;
|
|
2926
|
+
/** Seconds. Same unit as token `estimatedProcessingTime`. */
|
|
2927
|
+
estimatedProcessingTime: number;
|
|
2900
2928
|
}
|
|
2901
2929
|
/** Map a wire {@link OnrampQuote} to the SDK-facing {@link OnrampProviderQuote}. */
|
|
2902
2930
|
declare function mapOnrampQuote(quote: OnrampQuote): OnrampProviderQuote;
|
package/dist/index.d.ts
CHANGED
|
@@ -258,6 +258,21 @@ declare function getSupportedDestinationTokens(publishableKey?: string, options?
|
|
|
258
258
|
*/
|
|
259
259
|
source_chain_type?: ChainType;
|
|
260
260
|
}): Promise<SupportedDestinationTokensResponse>;
|
|
261
|
+
/**
|
|
262
|
+
* Fiat currency a stablecoin is pegged to (lowercase ISO 4217). Mirrors the
|
|
263
|
+
* API's `FiatCurrency` enum; kept as a local union here because the SDK cannot
|
|
264
|
+
* import server-side types across the package boundary. Named distinctly from
|
|
265
|
+
* the onramp `FiatCurrency` object interface below.
|
|
266
|
+
*
|
|
267
|
+
* This is intentionally an OPEN union: `'usd'` and `'eur'` are listed for
|
|
268
|
+
* editor autocomplete, but the `(string & Record<never, never>)` member keeps
|
|
269
|
+
* the type forward-compatible. If the backend later adds a new fiat currency
|
|
270
|
+
* (e.g. `'gbp'`), an older SDK build still type-checks — the new value is a
|
|
271
|
+
* valid `string`, so consumers can compare/handle it without a TS error and
|
|
272
|
+
* without needing to upgrade. Always treat unknown values defensively rather
|
|
273
|
+
* than assuming USD.
|
|
274
|
+
*/
|
|
275
|
+
type StablecoinFiatCurrency = 'usd' | 'eur' | (string & Record<never, never>);
|
|
261
276
|
interface SupportedToken {
|
|
262
277
|
symbol: string;
|
|
263
278
|
/** Slugged `symbol` (e.g. "usdc", "usdc_e", "usdc_perp"). */
|
|
@@ -266,6 +281,12 @@ interface SupportedToken {
|
|
|
266
281
|
icon_url: string;
|
|
267
282
|
is_newly_added: boolean;
|
|
268
283
|
is_stablecoin: boolean;
|
|
284
|
+
/**
|
|
285
|
+
* Fiat currency a stablecoin tracks (e.g. "usd", "eur"). Present only for
|
|
286
|
+
* stablecoins. Consumers must not assume a stablecoin is USD-denominated —
|
|
287
|
+
* check this before treating a token amount as a USD amount.
|
|
288
|
+
*/
|
|
289
|
+
stablecoin_fiat_currency?: StablecoinFiatCurrency;
|
|
269
290
|
chains: SupportedChain[];
|
|
270
291
|
}
|
|
271
292
|
interface SupportedDepositTokensResponse {
|
|
@@ -297,6 +318,8 @@ interface TokenMetadata {
|
|
|
297
318
|
chain_id: string;
|
|
298
319
|
token_address: string;
|
|
299
320
|
decimals: number;
|
|
321
|
+
/** Catalog classification from `/v1/public/tokens/token`. */
|
|
322
|
+
is_stablecoin?: boolean;
|
|
300
323
|
chain_icon_url: string;
|
|
301
324
|
chain_icon_urls: IconUrl[];
|
|
302
325
|
}
|
|
@@ -400,6 +423,8 @@ interface OnrampQuote {
|
|
|
400
423
|
institution_name: string | null;
|
|
401
424
|
low_kyc: boolean;
|
|
402
425
|
partner_fee: number | null;
|
|
426
|
+
/** Seconds. Same unit as token `estimated_processing_time`. */
|
|
427
|
+
estimated_processing_time: number;
|
|
403
428
|
}
|
|
404
429
|
interface OnrampQuotesRequest {
|
|
405
430
|
country_code: string;
|
|
@@ -963,7 +988,7 @@ interface VerifyAddressRequest {
|
|
|
963
988
|
* Standard error codes for address validation failures.
|
|
964
989
|
* Used by frontend to display localized error messages.
|
|
965
990
|
*/
|
|
966
|
-
type AddressValidationFailureCode = 'token_not_supported' | 'not_opted_in' | 'insufficient_balance' | 'account_not_found' | 'validation_error';
|
|
991
|
+
type AddressValidationFailureCode = 'token_not_supported' | 'not_opted_in' | 'insufficient_balance' | 'account_not_found' | 'destination_tag_required' | 'validation_error';
|
|
967
992
|
interface AddressValidationMetadata {
|
|
968
993
|
chain_name?: string;
|
|
969
994
|
token_symbol?: string;
|
|
@@ -1900,6 +1925,7 @@ interface StripeQuotesResponse {
|
|
|
1900
1925
|
destination_network: string;
|
|
1901
1926
|
service_provider: string;
|
|
1902
1927
|
service_provider_display_name: string;
|
|
1928
|
+
estimated_processing_time: number;
|
|
1903
1929
|
destination_network_quotes: Record<string, unknown[]>;
|
|
1904
1930
|
}
|
|
1905
1931
|
/**
|
|
@@ -2897,6 +2923,8 @@ interface OnrampProviderQuote {
|
|
|
2897
2923
|
iconUrl: string;
|
|
2898
2924
|
iconUrls: IconUrl[];
|
|
2899
2925
|
institutionName: string | null;
|
|
2926
|
+
/** Seconds. Same unit as token `estimatedProcessingTime`. */
|
|
2927
|
+
estimatedProcessingTime: number;
|
|
2900
2928
|
}
|
|
2901
2929
|
/** Map a wire {@link OnrampQuote} to the SDK-facing {@link OnrampProviderQuote}. */
|
|
2902
2930
|
declare function mapOnrampQuote(quote: OnrampQuote): OnrampProviderQuote;
|
package/dist/index.js
CHANGED
|
@@ -192,7 +192,7 @@ function generatePrefixedKSUID(prefix) {
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
// src/lib/client-headers.ts
|
|
195
|
-
var SDK_VERSION = true ? "0.1.
|
|
195
|
+
var SDK_VERSION = true ? "0.1.82" : "0.0.0-dev";
|
|
196
196
|
var CLIENT_VERSION_HEADER = "x-unifold-client-version";
|
|
197
197
|
var CLIENT_USER_AGENT_HEADER = "x-unifold-client-user-agent";
|
|
198
198
|
function detectRuntime() {
|
|
@@ -355,6 +355,11 @@ async function createDepositAddress(overrides, publishableKey) {
|
|
|
355
355
|
const firstError = Array.isArray(body.details?.errors) ? body.details?.errors[0] : void 0;
|
|
356
356
|
throw new DepositAddressValidationError(firstError ?? "Invalid recipient address");
|
|
357
357
|
}
|
|
358
|
+
if (body?.error_type === "xrpl_destination_tag_required") {
|
|
359
|
+
throw new DepositAddressValidationError(
|
|
360
|
+
body.message ?? "Recipient address requires a destination tag"
|
|
361
|
+
);
|
|
362
|
+
}
|
|
358
363
|
}
|
|
359
364
|
throw new Error(`Failed to create EOA: ${response.statusText}`);
|
|
360
365
|
}
|
|
@@ -2156,7 +2161,8 @@ function mapOnrampQuote(quote) {
|
|
|
2156
2161
|
lowKyc: quote.low_kyc,
|
|
2157
2162
|
iconUrl: quote.icon_url,
|
|
2158
2163
|
iconUrls: quote.icon_urls,
|
|
2159
|
-
institutionName: quote.institution_name
|
|
2164
|
+
institutionName: quote.institution_name,
|
|
2165
|
+
estimatedProcessingTime: quote.estimated_processing_time
|
|
2160
2166
|
};
|
|
2161
2167
|
}
|
|
2162
2168
|
function mapDefaultOnrampToken(response) {
|
package/dist/index.mjs
CHANGED
|
@@ -41,7 +41,7 @@ function generatePrefixedKSUID(prefix) {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
// src/lib/client-headers.ts
|
|
44
|
-
var SDK_VERSION = true ? "0.1.
|
|
44
|
+
var SDK_VERSION = true ? "0.1.82" : "0.0.0-dev";
|
|
45
45
|
var CLIENT_VERSION_HEADER = "x-unifold-client-version";
|
|
46
46
|
var CLIENT_USER_AGENT_HEADER = "x-unifold-client-user-agent";
|
|
47
47
|
function detectRuntime() {
|
|
@@ -204,6 +204,11 @@ async function createDepositAddress(overrides, publishableKey) {
|
|
|
204
204
|
const firstError = Array.isArray(body.details?.errors) ? body.details?.errors[0] : void 0;
|
|
205
205
|
throw new DepositAddressValidationError(firstError ?? "Invalid recipient address");
|
|
206
206
|
}
|
|
207
|
+
if (body?.error_type === "xrpl_destination_tag_required") {
|
|
208
|
+
throw new DepositAddressValidationError(
|
|
209
|
+
body.message ?? "Recipient address requires a destination tag"
|
|
210
|
+
);
|
|
211
|
+
}
|
|
207
212
|
}
|
|
208
213
|
throw new Error(`Failed to create EOA: ${response.statusText}`);
|
|
209
214
|
}
|
|
@@ -2005,7 +2010,8 @@ function mapOnrampQuote(quote) {
|
|
|
2005
2010
|
lowKyc: quote.low_kyc,
|
|
2006
2011
|
iconUrl: quote.icon_url,
|
|
2007
2012
|
iconUrls: quote.icon_urls,
|
|
2008
|
-
institutionName: quote.institution_name
|
|
2013
|
+
institutionName: quote.institution_name,
|
|
2014
|
+
estimatedProcessingTime: quote.estimated_processing_time
|
|
2009
2015
|
};
|
|
2010
2016
|
}
|
|
2011
2017
|
function mapDefaultOnrampToken(response) {
|