@coinlist-co/react 0.12.1-rc.e183ffd → 0.12.1-rc.f51a0c2

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.
@@ -4505,10 +4505,8 @@ interface UseOndoBuyReviewViewModelResult {
4505
4505
  * price holds, and placing it.
4506
4506
  *
4507
4507
  * The quote is firm and short-lived, so most of this is about time. The
4508
- * countdown drives the line above the CTA, and a quote inside
4509
- * {@link ONDO_QUOTE_EXPIRY_THRESHOLD_MS} of its deadline is treated as already
4510
- * gone: placing an order is not instant, and a transaction that arrives after
4511
- * the deadline reverts at the user's expense.
4508
+ * countdown drives the line above the CTA. The SDK offers the quote for at
4509
+ * most {@link ONDO_QUOTE_MAX_TTL_MS}.
4512
4510
  *
4513
4511
  * Refreshing is always something the user asks for. Each refresh builds a new
4514
4512
  * transaction, which spends an attestation, so nothing here is on a timer.
@@ -4869,10 +4867,9 @@ interface UseOndoSellReviewViewModelResult {
4869
4867
  * long the price holds, and placing it.
4870
4868
  *
4871
4869
  * The same shape as its buy counterpart, and the same reasoning about time: the
4872
- * quote is firm and short-lived, a quote inside
4873
- * {@link ONDO_QUOTE_EXPIRY_THRESHOLD_MS} of its deadline is treated as already
4874
- * gone, and refreshing is always something the user asks for because each
4875
- * refresh spends an attestation.
4870
+ * SDK offers the quote for at most {@link ONDO_QUOTE_MAX_TTL_MS}, and
4871
+ * refreshing is always something the user asks for because each refresh spends
4872
+ * an attestation.
4876
4873
  *
4877
4874
  * What differs is what it reads off the transaction. A sale has no
4878
4875
  * `notionalValue` and therefore no total to render; it publishes an expected
@@ -4505,10 +4505,8 @@ interface UseOndoBuyReviewViewModelResult {
4505
4505
  * price holds, and placing it.
4506
4506
  *
4507
4507
  * The quote is firm and short-lived, so most of this is about time. The
4508
- * countdown drives the line above the CTA, and a quote inside
4509
- * {@link ONDO_QUOTE_EXPIRY_THRESHOLD_MS} of its deadline is treated as already
4510
- * gone: placing an order is not instant, and a transaction that arrives after
4511
- * the deadline reverts at the user's expense.
4508
+ * countdown drives the line above the CTA. The SDK offers the quote for at
4509
+ * most {@link ONDO_QUOTE_MAX_TTL_MS}.
4512
4510
  *
4513
4511
  * Refreshing is always something the user asks for. Each refresh builds a new
4514
4512
  * transaction, which spends an attestation, so nothing here is on a timer.
@@ -4869,10 +4867,9 @@ interface UseOndoSellReviewViewModelResult {
4869
4867
  * long the price holds, and placing it.
4870
4868
  *
4871
4869
  * The same shape as its buy counterpart, and the same reasoning about time: the
4872
- * quote is firm and short-lived, a quote inside
4873
- * {@link ONDO_QUOTE_EXPIRY_THRESHOLD_MS} of its deadline is treated as already
4874
- * gone, and refreshing is always something the user asks for because each
4875
- * refresh spends an attestation.
4870
+ * SDK offers the quote for at most {@link ONDO_QUOTE_MAX_TTL_MS}, and
4871
+ * refreshing is always something the user asks for because each refresh spends
4872
+ * an attestation.
4876
4873
  *
4877
4874
  * What differs is what it reads off the transaction. A sale has no
4878
4875
  * `notionalValue` and therefore no total to render; it publishes an expected
@@ -14,7 +14,6 @@ import {
14
14
  DEFAULT_ONDO_SELL_TOKENS_TO_COMPUTE_PRICE,
15
15
  DEFAULT_SLIPPAGE_BPS,
16
16
  ONDO_POLL_INTERVAL_MS,
17
- ONDO_QUOTE_EXPIRY_THRESHOLD_MS,
18
17
  ONDO_SETTLEMENT_ASSET,
19
18
  ONDO_SUPPORTED_INPUT_ASSETS,
20
19
  OffersNamespaceImpl,
@@ -35,9 +34,10 @@ import {
35
34
  formattedPricePerShare,
36
35
  generatePKCEParams,
37
36
  isSwapAvailable,
37
+ ondoQuoteOfferDeadline,
38
38
  superstateSwapContractAddress,
39
39
  swapSpender
40
- } from "../chunk-ONLH57LF.js";
40
+ } from "../chunk-QIAM2VUU.js";
41
41
  import {
42
42
  API_VERSION,
43
43
  AssetDecimals,
@@ -4069,7 +4069,7 @@ function toInputAssetUi({
4069
4069
  }
4070
4070
 
4071
4071
  // src/client/hooks/checkout/ondo/buy/review/useOndoBuyReviewViewModel.ts
4072
- import { useEffect as useEffect7, useRef as useRef5, useState as useState6 } from "react";
4072
+ import { useEffect as useEffect7, useMemo as useMemo4, useRef as useRef5, useState as useState6 } from "react";
4073
4073
 
4074
4074
  // src/client/hooks/checkout/ondo/buy/data/useOndoBuyTransaction.ts
4075
4075
  import { useCallback as useCallback2, useEffect as useEffect5, useRef as useRef4, useState as useState5 } from "react";
@@ -4227,8 +4227,12 @@ function useOndoBuyReviewViewModel({
4227
4227
  }
4228
4228
  }, [stepInput.type]);
4229
4229
  const transaction = transactionState.type === "CONTENT" ? transactionState.transaction : null;
4230
+ const offerUntil = useMemo4(
4231
+ () => transaction === null ? null : ondoQuoteOfferDeadline(transaction.expiresAt),
4232
+ [transaction]
4233
+ );
4230
4234
  const secondsLeft = useCountdown({
4231
- until: transaction?.expiresAt ?? null,
4235
+ until: offerUntil,
4232
4236
  enabled
4233
4237
  });
4234
4238
  const quoteStatus = toQuoteStatusUi(transactionState, secondsLeft);
@@ -4352,14 +4356,11 @@ function toQuoteStatusUi(state, secondsLeft) {
4352
4356
  message: refreshErrorMessage(state.refreshError)
4353
4357
  };
4354
4358
  }
4355
- if (secondsLeft === null || isTooCloseToExpiry(secondsLeft)) {
4359
+ if (secondsLeft === null || secondsLeft === 0) {
4356
4360
  return { type: "expired" };
4357
4361
  }
4358
4362
  return { type: "valid", expiresInLabel: expiresInLabel(secondsLeft) };
4359
4363
  }
4360
- function isTooCloseToExpiry(secondsLeft) {
4361
- return secondsLeft * 1e3 <= ONDO_QUOTE_EXPIRY_THRESHOLD_MS;
4362
- }
4363
4364
  function expiresInLabel(secondsLeft) {
4364
4365
  const unit = secondsLeft === 1 ? "second" : "seconds";
4365
4366
  return `Quote expires in ${secondsLeft} ${unit}`;
@@ -6168,7 +6169,7 @@ function preparationErrorMessage2(error) {
6168
6169
  }
6169
6170
 
6170
6171
  // src/client/hooks/checkout/ondo/sell/review/useOndoSellReviewViewModel.ts
6171
- import { useEffect as useEffect14, useRef as useRef11, useState as useState15 } from "react";
6172
+ import { useEffect as useEffect14, useMemo as useMemo5, useRef as useRef11, useState as useState15 } from "react";
6172
6173
 
6173
6174
  // src/client/hooks/checkout/ondo/sell/data/useOndoSellTransaction.ts
6174
6175
  import { useCallback as useCallback4, useEffect as useEffect13, useRef as useRef10, useState as useState14 } from "react";
@@ -6289,8 +6290,12 @@ function useOndoSellReviewViewModel({
6289
6290
  }
6290
6291
  }, [stepInput.type]);
6291
6292
  const transaction = transactionState.type === "CONTENT" ? transactionState.transaction : null;
6293
+ const offerUntil = useMemo5(
6294
+ () => transaction === null ? null : ondoQuoteOfferDeadline(transaction.expiresAt),
6295
+ [transaction]
6296
+ );
6292
6297
  const secondsLeft = useCountdown({
6293
- until: transaction?.expiresAt ?? null,
6298
+ until: offerUntil,
6294
6299
  enabled
6295
6300
  });
6296
6301
  const quoteStatus = toQuoteStatusUi2(transactionState, secondsLeft);
@@ -6419,14 +6424,11 @@ function toQuoteStatusUi2(state, secondsLeft) {
6419
6424
  message: refreshErrorMessage2(state.refreshError)
6420
6425
  };
6421
6426
  }
6422
- if (secondsLeft === null || isTooCloseToExpiry2(secondsLeft)) {
6427
+ if (secondsLeft === null || secondsLeft === 0) {
6423
6428
  return { type: "expired" };
6424
6429
  }
6425
6430
  return { type: "valid", expiresInLabel: expiresInLabel2(secondsLeft) };
6426
6431
  }
6427
- function isTooCloseToExpiry2(secondsLeft) {
6428
- return secondsLeft * 1e3 <= ONDO_QUOTE_EXPIRY_THRESHOLD_MS;
6429
- }
6430
6432
  function expiresInLabel2(secondsLeft) {
6431
6433
  const unit = secondsLeft === 1 ? "second" : "seconds";
6432
6434
  return `Quote expires in ${secondsLeft} ${unit}`;
@@ -9605,7 +9607,7 @@ function EmptyState() {
9605
9607
  }
9606
9608
 
9607
9609
  // src/client/hooks/offers/grid/useOffersGridViewModel.ts
9608
- import { useCallback as useCallback6, useMemo as useMemo4 } from "react";
9610
+ import { useCallback as useCallback6, useMemo as useMemo6 } from "react";
9609
9611
 
9610
9612
  // src/client/hooks/offers/data/useOffers.ts
9611
9613
  import { useEffect as useEffect20, useState as useState24 } from "react";
@@ -9699,7 +9701,7 @@ var GENERIC_ERROR_MESSAGE = "Unable to load offers right now. Please try again."
9699
9701
  function useOffersGridViewModel(options = {}) {
9700
9702
  const { data, onOfferClick, enabled = true } = options;
9701
9703
  const { offersState } = useOffers({ data, enabled });
9702
- const state = useMemo4(
9704
+ const state = useMemo6(
9703
9705
  () => toUiState(offersState, onOfferClick !== void 0),
9704
9706
  [offersState, onOfferClick]
9705
9707
  );
@@ -9963,7 +9965,7 @@ function toError(error) {
9963
9965
  }
9964
9966
 
9965
9967
  // src/client/hooks/requirements/identity-verification/useIdentityVerificationViewModel.ts
9966
- import { useCallback as useCallback8, useEffect as useEffect22, useMemo as useMemo5, useRef as useRef15 } from "react";
9968
+ import { useCallback as useCallback8, useEffect as useEffect22, useMemo as useMemo7, useRef as useRef15 } from "react";
9967
9969
 
9968
9970
  // src/client/hooks/requirements/data/useKycToken.ts
9969
9971
  import { useCallback as useCallback7, useEffect as useEffect21, useRef as useRef14, useState as useState26 } from "react";
@@ -10023,7 +10025,7 @@ function useIdentityVerificationViewModel(options = {}) {
10023
10025
  fetchToken().catch(() => {
10024
10026
  });
10025
10027
  }, [fetchToken]);
10026
- const state = useMemo5(() => {
10028
+ const state = useMemo7(() => {
10027
10029
  switch (kycTokenState.type) {
10028
10030
  case "IDLE":
10029
10031
  case "LOADING":
@@ -10660,7 +10662,7 @@ function SignOnlyScreen({
10660
10662
  }
10661
10663
 
10662
10664
  // src/client/hooks/requirements/tax-document/useTaxDocumentModalViewModel.ts
10663
- import { useCallback as useCallback10, useEffect as useEffect24, useMemo as useMemo6 } from "react";
10665
+ import { useCallback as useCallback10, useEffect as useEffect24, useMemo as useMemo8 } from "react";
10664
10666
 
10665
10667
  // src/client/hooks/requirements/data/useTaxDocument.ts
10666
10668
  import { useCallback as useCallback9, useEffect as useEffect23, useState as useState27 } from "react";
@@ -10869,7 +10871,7 @@ function useTaxDocumentModalViewModel({
10869
10871
  onClose();
10870
10872
  }
10871
10873
  }, [state]);
10872
- const uiState = useMemo6(() => {
10874
+ const uiState = useMemo8(() => {
10873
10875
  if (!isOpen || state.type === "SUBMITTED") {
10874
10876
  return { type: "hidden" };
10875
10877
  }
@@ -11124,7 +11126,7 @@ function Screen2({
11124
11126
  }
11125
11127
 
11126
11128
  // src/client/hooks/requirements/wallet/useConnectWalletModalViewModel.ts
11127
- import { useCallback as useCallback12, useEffect as useEffect26, useMemo as useMemo7 } from "react";
11129
+ import { useCallback as useCallback12, useEffect as useEffect26, useMemo as useMemo9 } from "react";
11128
11130
 
11129
11131
  // src/client/hooks/requirements/data/useConnectWallet.ts
11130
11132
  import { useCallback as useCallback11, useEffect as useEffect25, useRef as useRef16, useState as useState28 } from "react";
@@ -11343,7 +11345,7 @@ function useConnectWalletModalViewModel({
11343
11345
  onClose();
11344
11346
  }
11345
11347
  }, [state]);
11346
- const uiState = useMemo7(() => {
11348
+ const uiState = useMemo9(() => {
11347
11349
  if (!isOpen || state.type === "CONNECTED") {
11348
11350
  return { type: "hidden" };
11349
11351
  }
@@ -11409,7 +11411,7 @@ function ConnectWalletModalContainer({
11409
11411
  }
11410
11412
 
11411
11413
  // src/client/hooks/requirements/useRequirementsChecklistViewModel.ts
11412
- import { useCallback as useCallback15, useEffect as useEffect29, useMemo as useMemo8, useRef as useRef17, useState as useState31 } from "react";
11414
+ import { useCallback as useCallback15, useEffect as useEffect29, useMemo as useMemo10, useRef as useRef17, useState as useState31 } from "react";
11413
11415
 
11414
11416
  // src/client/hooks/requirements/data/useOptionAddresses.ts
11415
11417
  import { useCallback as useCallback13, useEffect as useEffect27, useState as useState29 } from "react";
@@ -11723,11 +11725,11 @@ function useRequirementsChecklistViewModel(options) {
11723
11725
  },
11724
11726
  [coinlist, offerId, refetch, log]
11725
11727
  );
11726
- const requirements = useMemo8(
11728
+ const requirements = useMemo10(
11727
11729
  () => requirementsState.type === "CONTENT" ? requirementsState.requirements[optionId] ?? [] : [],
11728
11730
  [requirementsState, optionId]
11729
11731
  );
11730
- const statusById = useMemo8(() => {
11732
+ const statusById = useMemo10(() => {
11731
11733
  if (requirementsState.type !== "CONTENT") {
11732
11734
  return /* @__PURE__ */ new Map();
11733
11735
  }
@@ -11736,7 +11738,7 @@ function useRequirementsChecklistViewModel(options) {
11736
11738
  requirementsState.statuses.filter((s) => ids.has(s.id)).map((s) => [s.id, s])
11737
11739
  );
11738
11740
  }, [requirementsState, requirements]);
11739
- const state = useMemo8(() => {
11741
+ const state = useMemo10(() => {
11740
11742
  switch (requirementsState.type) {
11741
11743
  case "LOADING":
11742
11744
  return { type: "loading" };