@coinlist-co/react 0.12.2-rc.7b430dd → 0.12.2-rc.9fb6364

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.
Files changed (32) hide show
  1. package/dist/{chunk-MOE5S6CE.js → chunk-BNMF2HMW.js} +114 -4
  2. package/dist/chunk-BNMF2HMW.js.map +1 -0
  3. package/dist/{chunk-VH34YC3Q.js → chunk-KRA6EM2L.js} +2 -2
  4. package/dist/{chunk-DCW7NQXH.js → chunk-STAHYDLY.js} +52 -19
  5. package/dist/chunk-STAHYDLY.js.map +1 -0
  6. package/dist/client/index.cjs +322 -96
  7. package/dist/client/index.cjs.map +1 -1
  8. package/dist/client/index.d.cts +26 -10
  9. package/dist/client/index.d.ts +26 -10
  10. package/dist/client/index.js +225 -102
  11. package/dist/client/index.js.map +1 -1
  12. package/dist/server/index.cjs +437 -76
  13. package/dist/server/index.cjs.map +1 -1
  14. package/dist/server/index.d.cts +47 -38
  15. package/dist/server/index.d.ts +47 -38
  16. package/dist/server/index.js +316 -61
  17. package/dist/server/index.js.map +1 -1
  18. package/dist/time-B5YOQxuh.d.ts +50 -0
  19. package/dist/time-BY3apBpc.d.cts +50 -0
  20. package/dist/{token-registry-snapshot-BNBNuDu1.d.ts → token-registry-snapshot-C1NxdBmF.d.ts} +1 -1
  21. package/dist/{token-registry-snapshot-CqI6dXM_.d.cts → token-registry-snapshot-DyjrA32p.d.cts} +1 -1
  22. package/dist/{tokens-namespace-CIWBtgt2.d.cts → tokens-namespace-BJfFeowE.d.cts} +53 -1
  23. package/dist/{tokens-namespace-CIWBtgt2.d.ts → tokens-namespace-BJfFeowE.d.ts} +53 -1
  24. package/dist/universal/index.cjs +100 -3
  25. package/dist/universal/index.cjs.map +1 -1
  26. package/dist/universal/index.d.cts +23 -5
  27. package/dist/universal/index.d.ts +23 -5
  28. package/dist/universal/index.js +12 -2
  29. package/package.json +1 -1
  30. package/dist/chunk-DCW7NQXH.js.map +0 -1
  31. package/dist/chunk-MOE5S6CE.js.map +0 -1
  32. /package/dist/{chunk-VH34YC3Q.js.map → chunk-KRA6EM2L.js.map} +0 -0
@@ -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,6 +72,7 @@ __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,
@@ -123,6 +125,7 @@ __export(universal_exports, {
123
125
  SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA: () => SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA,
124
126
  SWAP_LEVEL: () => SWAP_LEVEL,
125
127
  SWAP_POLL_INTERVAL_MS: () => SWAP_POLL_INTERVAL_MS,
128
+ Seconds: () => Seconds,
126
129
  ShortenedWalletAddress: () => ShortenedWalletAddress,
127
130
  SolanaChain: () => SolanaChain,
128
131
  StablecoinSymbol: () => StablecoinSymbol,
@@ -166,12 +169,14 @@ __export(universal_exports, {
166
169
  formatBpsAsPercent: () => formatBpsAsPercent,
167
170
  formatCompactAmount: () => formatCompactAmount,
168
171
  formatRawAmount: () => formatRawAmount,
172
+ formatShareAmount: () => formatShareAmount,
169
173
  formattedPricePerShare: () => formattedPricePerShare,
170
174
  formattedUsdPrice: () => formattedUsdPrice,
171
175
  generatePKCEParams: () => generatePKCEParams,
172
176
  getChainId: () => getChainId,
173
177
  getNetworkName: () => getNetworkName,
174
178
  isChain: () => isChain,
179
+ isExpired: () => isExpired,
175
180
  isOfferType: () => isOfferType,
176
181
  isSwapAvailable: () => isSwapAvailable,
177
182
  offerDisplayTokens: () => offerDisplayTokens,
@@ -187,6 +192,15 @@ __export(universal_exports, {
187
192
  });
188
193
  module.exports = __toCommonJS(universal_exports);
189
194
 
195
+ // src/universal/api/internal-access-token-source.ts
196
+ var SentWith = {
197
+ userToken: (token) => ({
198
+ type: "user-token",
199
+ token
200
+ }),
201
+ noUserToken: { type: "no-user-token" }
202
+ };
203
+
190
204
  // src/universal/api/http-attributes.ts
191
205
  var empty = {};
192
206
  var concat = (left, right) => ({
@@ -214,6 +228,10 @@ var retryAttempt = (attempt) => ({
214
228
  var renewAttempted = (value) => ({
215
229
  renewAttempted: value
216
230
  });
231
+ var notRetryable = () => ({ retryable: false });
232
+ var sentWith = (token) => ({
233
+ sentWith: token
234
+ });
217
235
  var requestId = (id) => ({ requestId: id });
218
236
  var getRequestId = (attrs) => attrs?.requestId ?? null;
219
237
  var isProtected = (attrs) => attrs?.protected === true;
@@ -221,6 +239,8 @@ var needUserAgent = (attrs) => attrs?.userAgent === true;
221
239
  var isIdempotent = (attrs) => attrs?.idempotencyKey === true;
222
240
  var getRetryAttempt = (attrs) => attrs?.retryAttempt ?? 0;
223
241
  var wasRenewAttempted = (attrs) => attrs?.renewAttempted === true;
242
+ var isRetryable = (attrs) => attrs?.retryable !== false;
243
+ var getSentWith = (attrs) => attrs?.sentWith === void 0 ? SentWith.noUserToken : SentWith.userToken(attrs.sentWith);
224
244
  var getClientCredentials = (attrs) => attrs?.clientCredentials;
225
245
  var Attributes = {
226
246
  empty,
@@ -236,6 +256,10 @@ var Attributes = {
236
256
  getRetryAttempt,
237
257
  renewAttempted,
238
258
  wasRenewAttempted,
259
+ notRetryable,
260
+ isRetryable,
261
+ sentWith,
262
+ getSentWith,
239
263
  clientCredentials,
240
264
  getClientCredentials,
241
265
  requestId,
@@ -1265,7 +1289,11 @@ function formatAmount(amount, locale, options) {
1265
1289
  const decimal = formatRawAmount(amount);
1266
1290
  let [integerPart, fractionPart = ""] = decimal.split(".");
1267
1291
  const maxFractionDigits = options?.maxFractionDigits;
1268
- const minFractionDigits = maxFractionDigits !== void 0 ? Math.min(maxFractionDigits, amount.decimals) : Math.min(2, amount.decimals);
1292
+ const minFractionDigits = Math.min(
1293
+ options?.minFractionDigits ?? (maxFractionDigits !== void 0 ? maxFractionDigits : 2),
1294
+ maxFractionDigits ?? amount.decimals,
1295
+ amount.decimals
1296
+ );
1269
1297
  if (maxFractionDigits !== void 0 && fractionPart.length > maxFractionDigits) {
1270
1298
  ({ integerPart, fractionPart } = roundFractionHalfUp(
1271
1299
  integerPart,
@@ -1273,7 +1301,8 @@ function formatAmount(amount, locale, options) {
1273
1301
  maxFractionDigits
1274
1302
  ));
1275
1303
  }
1276
- const fraction = minFractionDigits === 0 ? "" : fractionPart.padEnd(minFractionDigits, "0");
1304
+ const trimmed = fractionPart.replace(/0+$/, "");
1305
+ const fraction = trimmed.padEnd(minFractionDigits, "0");
1277
1306
  const integerFormatted = BigInt(integerPart).toLocaleString(locale);
1278
1307
  if (minFractionDigits === 0 && fraction === "") {
1279
1308
  return FormattedAmountUi(integerFormatted);
@@ -1342,6 +1371,14 @@ function assetAmount(amount, symbol) {
1342
1371
  return FormattedAmountAssetUi(`${amount} ${symbol}`);
1343
1372
  }
1344
1373
  var NA_AMOUNT_ASSET_UI = FormattedAmountAssetUi("-");
1374
+ var SHARE_MAX_FRACTION_DIGITS = AssetDecimals(6);
1375
+ var SHARE_MIN_FRACTION_DIGITS = AssetDecimals(2);
1376
+ function formatShareAmount(amount, locale) {
1377
+ return formatAmount(amount, locale, {
1378
+ maxFractionDigits: SHARE_MAX_FRACTION_DIGITS,
1379
+ minFractionDigits: SHARE_MIN_FRACTION_DIGITS
1380
+ });
1381
+ }
1345
1382
  var USD_FRACTION_DIGITS = AssetDecimals(2);
1346
1383
  function formattedUsdPrice(amount, locale) {
1347
1384
  if (!amount) return NA_AMOUNT_ASSET_UI;
@@ -3355,11 +3392,18 @@ var HttpClient = class {
3355
3392
  );
3356
3393
  let response = await this.executeRequest(preparedRequest);
3357
3394
  for (const middleware of this.middleware.afterRequest ?? []) {
3395
+ let retried = false;
3358
3396
  response = await middleware({
3359
3397
  request: preparedRequest,
3360
3398
  response,
3361
- retry: (nextRequest = preparedRequest) => this.runRequestWithAfterMiddleware(nextRequest)
3399
+ retry: (nextRequest = preparedRequest) => {
3400
+ retried = true;
3401
+ return this.runRequestWithAfterMiddleware(nextRequest);
3402
+ }
3362
3403
  });
3404
+ if (retried) {
3405
+ return response;
3406
+ }
3363
3407
  }
3364
3408
  return response;
3365
3409
  }
@@ -3849,6 +3893,54 @@ var OAuthSession = {
3849
3893
  }
3850
3894
  };
3851
3895
 
3896
+ // src/universal/types/time.ts
3897
+ var MAX_EPOCH_MILLIS = 864e13;
3898
+ var EpochMillis = {
3899
+ /**
3900
+ * @throws {@link ValidationError} unless `value` is an integer a `Date` can
3901
+ * represent: at most {@link MAX_EPOCH_MILLIS} either side of the epoch.
3902
+ */
3903
+ of: (value) => {
3904
+ if (!Number.isInteger(value) || Math.abs(value) > MAX_EPOCH_MILLIS) {
3905
+ throw new ValidationError(
3906
+ `EpochMillis must be an integer within \xB1${MAX_EPOCH_MILLIS}, got ${value}`
3907
+ );
3908
+ }
3909
+ return value;
3910
+ },
3911
+ /** The wall clock. Code that needs the time takes a `TimeEff` instead. */
3912
+ now: () => EpochMillis.of(Date.now()),
3913
+ /** @throws {@link ValidationError} for an invalid `Date`. */
3914
+ fromDate: (date) => EpochMillis.of(date.getTime()),
3915
+ /** How long after `from` the instant `to` is; negative if it is before. */
3916
+ elapsed: (from, to) => Millis.of(to - from),
3917
+ plus: (at, duration) => EpochMillis.of(at + duration)
3918
+ };
3919
+ var Millis = {
3920
+ of: (value) => value
3921
+ };
3922
+ var Seconds = {
3923
+ /**
3924
+ * @throws {@link ValidationError} unless `value` is a non-negative integer.
3925
+ */
3926
+ of: (value) => {
3927
+ if (!Number.isInteger(value) || value < 0) {
3928
+ throw new ValidationError(
3929
+ `Seconds must be a non-negative integer, got ${value}`
3930
+ );
3931
+ }
3932
+ return value;
3933
+ },
3934
+ toMillis: (value) => Millis.of(value * 1e3)
3935
+ };
3936
+ function isExpired({
3937
+ expiresAt,
3938
+ now,
3939
+ buffer = Millis.of(0)
3940
+ }) {
3941
+ return now >= expiresAt - buffer;
3942
+ }
3943
+
3852
3944
  // src/universal/types/user.ts
3853
3945
  var UserId = (value) => value;
3854
3946
  var UserEmail = (value) => value;
@@ -3891,6 +3983,7 @@ var User = {
3891
3983
  DocumentSubmission,
3892
3984
  ERC20_ABI,
3893
3985
  ETHEREUM_CHAINS,
3986
+ EpochMillis,
3894
3987
  Erc20NamespaceImpl,
3895
3988
  EthereumChain,
3896
3989
  EvmContractAddress,
@@ -3911,6 +4004,7 @@ var User = {
3911
4004
  MAX_UINT_256,
3912
4005
  MathError,
3913
4006
  Milestone,
4007
+ Millis,
3914
4008
  NA_AMOUNT_ASSET_UI,
3915
4009
  NotAuthenticatedError,
3916
4010
  NotImplementedError,
@@ -3963,6 +4057,7 @@ var User = {
3963
4057
  SUPERSTATE_SWAP_CONTRACT_ADDRESS_SEPOLIA,
3964
4058
  SWAP_LEVEL,
3965
4059
  SWAP_POLL_INTERVAL_MS,
4060
+ Seconds,
3966
4061
  ShortenedWalletAddress,
3967
4062
  SolanaChain,
3968
4063
  StablecoinSymbol,
@@ -4006,12 +4101,14 @@ var User = {
4006
4101
  formatBpsAsPercent,
4007
4102
  formatCompactAmount,
4008
4103
  formatRawAmount,
4104
+ formatShareAmount,
4009
4105
  formattedPricePerShare,
4010
4106
  formattedUsdPrice,
4011
4107
  generatePKCEParams,
4012
4108
  getChainId,
4013
4109
  getNetworkName,
4014
4110
  isChain,
4111
+ isExpired,
4015
4112
  isOfferType,
4016
4113
  isSwapAvailable,
4017
4114
  offerDisplayTokens,