@coinlist-co/react 0.12.2-rc.7b430dd → 0.12.2-rc.abd9d38
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/{chunk-DCW7NQXH.js → chunk-45LAPB7U.js} +52 -19
- package/dist/chunk-45LAPB7U.js.map +1 -0
- package/dist/{chunk-MOE5S6CE.js → chunk-HDJEDOS4.js} +114 -4
- package/dist/chunk-HDJEDOS4.js.map +1 -0
- package/dist/{chunk-VH34YC3Q.js → chunk-M7WDZZPX.js} +11 -2
- package/dist/chunk-M7WDZZPX.js.map +1 -0
- package/dist/client/index.cjs +396 -107
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +102 -34
- package/dist/client/index.d.ts +102 -34
- package/dist/client/index.js +292 -113
- package/dist/client/index.js.map +1 -1
- package/dist/server/index.cjs +442 -80
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +65 -41
- package/dist/server/index.d.ts +65 -41
- package/dist/server/index.js +321 -65
- package/dist/server/index.js.map +1 -1
- package/dist/time-BOCS1TbH.d.cts +50 -0
- package/dist/time-C7mhO5_a.d.ts +50 -0
- package/dist/{token-registry-snapshot-BNBNuDu1.d.ts → token-registry-snapshot-C-Qs3Lgs.d.ts} +1 -1
- package/dist/{token-registry-snapshot-CqI6dXM_.d.cts → token-registry-snapshot-CpzLmsc2.d.cts} +1 -1
- package/dist/{tokens-namespace-CIWBtgt2.d.cts → tokens-namespace-DrwRi0AQ.d.cts} +64 -1
- package/dist/{tokens-namespace-CIWBtgt2.d.ts → tokens-namespace-DrwRi0AQ.d.ts} +64 -1
- package/dist/universal/index.cjs +110 -3
- package/dist/universal/index.cjs.map +1 -1
- package/dist/universal/index.d.cts +43 -5
- package/dist/universal/index.d.ts +43 -5
- package/dist/universal/index.js +16 -2
- package/package.json +1 -1
- package/dist/chunk-DCW7NQXH.js.map +0 -1
- package/dist/chunk-MOE5S6CE.js.map +0 -1
- package/dist/chunk-VH34YC3Q.js.map +0 -1
package/dist/universal/index.cjs
CHANGED
|
@@ -51,6 +51,7 @@ __export(universal_exports, {
|
|
|
51
51
|
DocumentSubmission: () => DocumentSubmission,
|
|
52
52
|
ERC20_ABI: () => ERC20_ABI,
|
|
53
53
|
ETHEREUM_CHAINS: () => ETHEREUM_CHAINS,
|
|
54
|
+
EpochMillis: () => EpochMillis,
|
|
54
55
|
Erc20NamespaceImpl: () => Erc20NamespaceImpl,
|
|
55
56
|
EthereumChain: () => EthereumChain,
|
|
56
57
|
EvmContractAddress: () => EvmContractAddress,
|
|
@@ -71,11 +72,13 @@ __export(universal_exports, {
|
|
|
71
72
|
MAX_UINT_256: () => MAX_UINT_256,
|
|
72
73
|
MathError: () => MathError,
|
|
73
74
|
Milestone: () => Milestone,
|
|
75
|
+
Millis: () => Millis,
|
|
74
76
|
NA_AMOUNT_ASSET_UI: () => NA_AMOUNT_ASSET_UI,
|
|
75
77
|
NotAuthenticatedError: () => NotAuthenticatedError,
|
|
76
78
|
NotImplementedError: () => NotImplementedError,
|
|
77
79
|
OAuthRefreshToken: () => OAuthRefreshToken,
|
|
78
80
|
OAuthSession: () => OAuthSession,
|
|
81
|
+
ONDO_NOT_TRADABLE_CODE: () => ONDO_NOT_TRADABLE_CODE,
|
|
79
82
|
ONDO_POLL_INTERVAL_MS: () => ONDO_POLL_INTERVAL_MS,
|
|
80
83
|
ONDO_QUOTE_MAX_TTL_MS: () => ONDO_QUOTE_MAX_TTL_MS,
|
|
81
84
|
ONDO_SETTLEMENT_ASSET: () => ONDO_SETTLEMENT_ASSET,
|
|
@@ -123,6 +126,7 @@ __export(universal_exports, {
|
|
|
123
126
|
SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA: () => SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA,
|
|
124
127
|
SWAP_LEVEL: () => SWAP_LEVEL,
|
|
125
128
|
SWAP_POLL_INTERVAL_MS: () => SWAP_POLL_INTERVAL_MS,
|
|
129
|
+
Seconds: () => Seconds,
|
|
126
130
|
ShortenedWalletAddress: () => ShortenedWalletAddress,
|
|
127
131
|
SolanaChain: () => SolanaChain,
|
|
128
132
|
StablecoinSymbol: () => StablecoinSymbol,
|
|
@@ -166,13 +170,16 @@ __export(universal_exports, {
|
|
|
166
170
|
formatBpsAsPercent: () => formatBpsAsPercent,
|
|
167
171
|
formatCompactAmount: () => formatCompactAmount,
|
|
168
172
|
formatRawAmount: () => formatRawAmount,
|
|
173
|
+
formatShareAmount: () => formatShareAmount,
|
|
169
174
|
formattedPricePerShare: () => formattedPricePerShare,
|
|
170
175
|
formattedUsdPrice: () => formattedUsdPrice,
|
|
171
176
|
generatePKCEParams: () => generatePKCEParams,
|
|
172
177
|
getChainId: () => getChainId,
|
|
173
178
|
getNetworkName: () => getNetworkName,
|
|
174
179
|
isChain: () => isChain,
|
|
180
|
+
isExpired: () => isExpired,
|
|
175
181
|
isOfferType: () => isOfferType,
|
|
182
|
+
isOndoNotTradableError: () => isOndoNotTradableError,
|
|
176
183
|
isSwapAvailable: () => isSwapAvailable,
|
|
177
184
|
offerDisplayTokens: () => offerDisplayTokens,
|
|
178
185
|
ondoQuoteOfferDeadline: () => ondoQuoteOfferDeadline,
|
|
@@ -187,6 +194,15 @@ __export(universal_exports, {
|
|
|
187
194
|
});
|
|
188
195
|
module.exports = __toCommonJS(universal_exports);
|
|
189
196
|
|
|
197
|
+
// src/universal/api/internal-access-token-source.ts
|
|
198
|
+
var SentWith = {
|
|
199
|
+
userToken: (token) => ({
|
|
200
|
+
type: "user-token",
|
|
201
|
+
token
|
|
202
|
+
}),
|
|
203
|
+
noUserToken: { type: "no-user-token" }
|
|
204
|
+
};
|
|
205
|
+
|
|
190
206
|
// src/universal/api/http-attributes.ts
|
|
191
207
|
var empty = {};
|
|
192
208
|
var concat = (left, right) => ({
|
|
@@ -214,6 +230,10 @@ var retryAttempt = (attempt) => ({
|
|
|
214
230
|
var renewAttempted = (value) => ({
|
|
215
231
|
renewAttempted: value
|
|
216
232
|
});
|
|
233
|
+
var notRetryable = () => ({ retryable: false });
|
|
234
|
+
var sentWith = (token) => ({
|
|
235
|
+
sentWith: token
|
|
236
|
+
});
|
|
217
237
|
var requestId = (id) => ({ requestId: id });
|
|
218
238
|
var getRequestId = (attrs) => attrs?.requestId ?? null;
|
|
219
239
|
var isProtected = (attrs) => attrs?.protected === true;
|
|
@@ -221,6 +241,8 @@ var needUserAgent = (attrs) => attrs?.userAgent === true;
|
|
|
221
241
|
var isIdempotent = (attrs) => attrs?.idempotencyKey === true;
|
|
222
242
|
var getRetryAttempt = (attrs) => attrs?.retryAttempt ?? 0;
|
|
223
243
|
var wasRenewAttempted = (attrs) => attrs?.renewAttempted === true;
|
|
244
|
+
var isRetryable = (attrs) => attrs?.retryable !== false;
|
|
245
|
+
var getSentWith = (attrs) => attrs?.sentWith === void 0 ? SentWith.noUserToken : SentWith.userToken(attrs.sentWith);
|
|
224
246
|
var getClientCredentials = (attrs) => attrs?.clientCredentials;
|
|
225
247
|
var Attributes = {
|
|
226
248
|
empty,
|
|
@@ -236,6 +258,10 @@ var Attributes = {
|
|
|
236
258
|
getRetryAttempt,
|
|
237
259
|
renewAttempted,
|
|
238
260
|
wasRenewAttempted,
|
|
261
|
+
notRetryable,
|
|
262
|
+
isRetryable,
|
|
263
|
+
sentWith,
|
|
264
|
+
getSentWith,
|
|
239
265
|
clientCredentials,
|
|
240
266
|
getClientCredentials,
|
|
241
267
|
requestId,
|
|
@@ -1245,6 +1271,12 @@ function assertPriceFits(raw) {
|
|
|
1245
1271
|
}
|
|
1246
1272
|
}
|
|
1247
1273
|
|
|
1274
|
+
// src/universal/core/checkout/ondo/not-tradable.ts
|
|
1275
|
+
var ONDO_NOT_TRADABLE_CODE = "not_tradable";
|
|
1276
|
+
function isOndoNotTradableError(error) {
|
|
1277
|
+
return apiErrorCode(error) === ONDO_NOT_TRADABLE_CODE;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1248
1280
|
// src/universal/core/shared/blockchain/formatters.ts
|
|
1249
1281
|
var import_viem2 = require("viem");
|
|
1250
1282
|
|
|
@@ -1265,7 +1297,11 @@ function formatAmount(amount, locale, options) {
|
|
|
1265
1297
|
const decimal = formatRawAmount(amount);
|
|
1266
1298
|
let [integerPart, fractionPart = ""] = decimal.split(".");
|
|
1267
1299
|
const maxFractionDigits = options?.maxFractionDigits;
|
|
1268
|
-
const minFractionDigits =
|
|
1300
|
+
const minFractionDigits = Math.min(
|
|
1301
|
+
options?.minFractionDigits ?? (maxFractionDigits !== void 0 ? maxFractionDigits : 2),
|
|
1302
|
+
maxFractionDigits ?? amount.decimals,
|
|
1303
|
+
amount.decimals
|
|
1304
|
+
);
|
|
1269
1305
|
if (maxFractionDigits !== void 0 && fractionPart.length > maxFractionDigits) {
|
|
1270
1306
|
({ integerPart, fractionPart } = roundFractionHalfUp(
|
|
1271
1307
|
integerPart,
|
|
@@ -1273,7 +1309,8 @@ function formatAmount(amount, locale, options) {
|
|
|
1273
1309
|
maxFractionDigits
|
|
1274
1310
|
));
|
|
1275
1311
|
}
|
|
1276
|
-
const
|
|
1312
|
+
const trimmed = fractionPart.replace(/0+$/, "");
|
|
1313
|
+
const fraction = trimmed.padEnd(minFractionDigits, "0");
|
|
1277
1314
|
const integerFormatted = BigInt(integerPart).toLocaleString(locale);
|
|
1278
1315
|
if (minFractionDigits === 0 && fraction === "") {
|
|
1279
1316
|
return FormattedAmountUi(integerFormatted);
|
|
@@ -1342,6 +1379,14 @@ function assetAmount(amount, symbol) {
|
|
|
1342
1379
|
return FormattedAmountAssetUi(`${amount} ${symbol}`);
|
|
1343
1380
|
}
|
|
1344
1381
|
var NA_AMOUNT_ASSET_UI = FormattedAmountAssetUi("-");
|
|
1382
|
+
var SHARE_MAX_FRACTION_DIGITS = AssetDecimals(6);
|
|
1383
|
+
var SHARE_MIN_FRACTION_DIGITS = AssetDecimals(2);
|
|
1384
|
+
function formatShareAmount(amount, locale) {
|
|
1385
|
+
return formatAmount(amount, locale, {
|
|
1386
|
+
maxFractionDigits: SHARE_MAX_FRACTION_DIGITS,
|
|
1387
|
+
minFractionDigits: SHARE_MIN_FRACTION_DIGITS
|
|
1388
|
+
});
|
|
1389
|
+
}
|
|
1345
1390
|
var USD_FRACTION_DIGITS = AssetDecimals(2);
|
|
1346
1391
|
function formattedUsdPrice(amount, locale) {
|
|
1347
1392
|
if (!amount) return NA_AMOUNT_ASSET_UI;
|
|
@@ -3355,11 +3400,18 @@ var HttpClient = class {
|
|
|
3355
3400
|
);
|
|
3356
3401
|
let response = await this.executeRequest(preparedRequest);
|
|
3357
3402
|
for (const middleware of this.middleware.afterRequest ?? []) {
|
|
3403
|
+
let retried = false;
|
|
3358
3404
|
response = await middleware({
|
|
3359
3405
|
request: preparedRequest,
|
|
3360
3406
|
response,
|
|
3361
|
-
retry: (nextRequest = preparedRequest) =>
|
|
3407
|
+
retry: (nextRequest = preparedRequest) => {
|
|
3408
|
+
retried = true;
|
|
3409
|
+
return this.runRequestWithAfterMiddleware(nextRequest);
|
|
3410
|
+
}
|
|
3362
3411
|
});
|
|
3412
|
+
if (retried) {
|
|
3413
|
+
return response;
|
|
3414
|
+
}
|
|
3363
3415
|
}
|
|
3364
3416
|
return response;
|
|
3365
3417
|
}
|
|
@@ -3849,6 +3901,54 @@ var OAuthSession = {
|
|
|
3849
3901
|
}
|
|
3850
3902
|
};
|
|
3851
3903
|
|
|
3904
|
+
// src/universal/types/time.ts
|
|
3905
|
+
var MAX_EPOCH_MILLIS = 864e13;
|
|
3906
|
+
var EpochMillis = {
|
|
3907
|
+
/**
|
|
3908
|
+
* @throws {@link ValidationError} unless `value` is an integer a `Date` can
|
|
3909
|
+
* represent: at most {@link MAX_EPOCH_MILLIS} either side of the epoch.
|
|
3910
|
+
*/
|
|
3911
|
+
of: (value) => {
|
|
3912
|
+
if (!Number.isInteger(value) || Math.abs(value) > MAX_EPOCH_MILLIS) {
|
|
3913
|
+
throw new ValidationError(
|
|
3914
|
+
`EpochMillis must be an integer within \xB1${MAX_EPOCH_MILLIS}, got ${value}`
|
|
3915
|
+
);
|
|
3916
|
+
}
|
|
3917
|
+
return value;
|
|
3918
|
+
},
|
|
3919
|
+
/** The wall clock. Code that needs the time takes a `TimeEff` instead. */
|
|
3920
|
+
now: () => EpochMillis.of(Date.now()),
|
|
3921
|
+
/** @throws {@link ValidationError} for an invalid `Date`. */
|
|
3922
|
+
fromDate: (date) => EpochMillis.of(date.getTime()),
|
|
3923
|
+
/** How long after `from` the instant `to` is; negative if it is before. */
|
|
3924
|
+
elapsed: (from, to) => Millis.of(to - from),
|
|
3925
|
+
plus: (at, duration) => EpochMillis.of(at + duration)
|
|
3926
|
+
};
|
|
3927
|
+
var Millis = {
|
|
3928
|
+
of: (value) => value
|
|
3929
|
+
};
|
|
3930
|
+
var Seconds = {
|
|
3931
|
+
/**
|
|
3932
|
+
* @throws {@link ValidationError} unless `value` is a non-negative integer.
|
|
3933
|
+
*/
|
|
3934
|
+
of: (value) => {
|
|
3935
|
+
if (!Number.isInteger(value) || value < 0) {
|
|
3936
|
+
throw new ValidationError(
|
|
3937
|
+
`Seconds must be a non-negative integer, got ${value}`
|
|
3938
|
+
);
|
|
3939
|
+
}
|
|
3940
|
+
return value;
|
|
3941
|
+
},
|
|
3942
|
+
toMillis: (value) => Millis.of(value * 1e3)
|
|
3943
|
+
};
|
|
3944
|
+
function isExpired({
|
|
3945
|
+
expiresAt,
|
|
3946
|
+
now,
|
|
3947
|
+
buffer = Millis.of(0)
|
|
3948
|
+
}) {
|
|
3949
|
+
return now >= expiresAt - buffer;
|
|
3950
|
+
}
|
|
3951
|
+
|
|
3852
3952
|
// src/universal/types/user.ts
|
|
3853
3953
|
var UserId = (value) => value;
|
|
3854
3954
|
var UserEmail = (value) => value;
|
|
@@ -3891,6 +3991,7 @@ var User = {
|
|
|
3891
3991
|
DocumentSubmission,
|
|
3892
3992
|
ERC20_ABI,
|
|
3893
3993
|
ETHEREUM_CHAINS,
|
|
3994
|
+
EpochMillis,
|
|
3894
3995
|
Erc20NamespaceImpl,
|
|
3895
3996
|
EthereumChain,
|
|
3896
3997
|
EvmContractAddress,
|
|
@@ -3911,11 +4012,13 @@ var User = {
|
|
|
3911
4012
|
MAX_UINT_256,
|
|
3912
4013
|
MathError,
|
|
3913
4014
|
Milestone,
|
|
4015
|
+
Millis,
|
|
3914
4016
|
NA_AMOUNT_ASSET_UI,
|
|
3915
4017
|
NotAuthenticatedError,
|
|
3916
4018
|
NotImplementedError,
|
|
3917
4019
|
OAuthRefreshToken,
|
|
3918
4020
|
OAuthSession,
|
|
4021
|
+
ONDO_NOT_TRADABLE_CODE,
|
|
3919
4022
|
ONDO_POLL_INTERVAL_MS,
|
|
3920
4023
|
ONDO_QUOTE_MAX_TTL_MS,
|
|
3921
4024
|
ONDO_SETTLEMENT_ASSET,
|
|
@@ -3963,6 +4066,7 @@ var User = {
|
|
|
3963
4066
|
SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA,
|
|
3964
4067
|
SWAP_LEVEL,
|
|
3965
4068
|
SWAP_POLL_INTERVAL_MS,
|
|
4069
|
+
Seconds,
|
|
3966
4070
|
ShortenedWalletAddress,
|
|
3967
4071
|
SolanaChain,
|
|
3968
4072
|
StablecoinSymbol,
|
|
@@ -4006,13 +4110,16 @@ var User = {
|
|
|
4006
4110
|
formatBpsAsPercent,
|
|
4007
4111
|
formatCompactAmount,
|
|
4008
4112
|
formatRawAmount,
|
|
4113
|
+
formatShareAmount,
|
|
4009
4114
|
formattedPricePerShare,
|
|
4010
4115
|
formattedUsdPrice,
|
|
4011
4116
|
generatePKCEParams,
|
|
4012
4117
|
getChainId,
|
|
4013
4118
|
getNetworkName,
|
|
4014
4119
|
isChain,
|
|
4120
|
+
isExpired,
|
|
4015
4121
|
isOfferType,
|
|
4122
|
+
isOndoNotTradableError,
|
|
4016
4123
|
isSwapAvailable,
|
|
4017
4124
|
offerDisplayTokens,
|
|
4018
4125
|
ondoQuoteOfferDeadline,
|