@coinlist-co/react 0.12.2-rc.9fb6364 → 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-STAHYDLY.js → chunk-45LAPB7U.js} +2 -2
- package/dist/{chunk-BNMF2HMW.js → chunk-HDJEDOS4.js} +1 -1
- package/dist/chunk-HDJEDOS4.js.map +1 -0
- package/dist/{chunk-KRA6EM2L.js → chunk-M7WDZZPX.js} +11 -2
- package/dist/chunk-M7WDZZPX.js.map +1 -0
- package/dist/client/index.cjs +74 -11
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +80 -28
- package/dist/client/index.d.ts +80 -28
- package/dist/client/index.js +70 -14
- package/dist/client/index.js.map +1 -1
- package/dist/server/index.cjs +5 -4
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +20 -5
- package/dist/server/index.d.ts +20 -5
- package/dist/server/index.js +7 -6
- package/dist/server/index.js.map +1 -1
- package/dist/{time-BY3apBpc.d.cts → time-BOCS1TbH.d.cts} +1 -1
- package/dist/{time-B5YOQxuh.d.ts → time-C7mhO5_a.d.ts} +1 -1
- package/dist/{token-registry-snapshot-C1NxdBmF.d.ts → token-registry-snapshot-C-Qs3Lgs.d.ts} +1 -1
- package/dist/{token-registry-snapshot-DyjrA32p.d.cts → token-registry-snapshot-CpzLmsc2.d.cts} +1 -1
- package/dist/{tokens-namespace-BJfFeowE.d.cts → tokens-namespace-DrwRi0AQ.d.cts} +11 -0
- package/dist/{tokens-namespace-BJfFeowE.d.ts → tokens-namespace-DrwRi0AQ.d.ts} +11 -0
- package/dist/universal/index.cjs +10 -0
- package/dist/universal/index.cjs.map +1 -1
- package/dist/universal/index.d.cts +26 -6
- package/dist/universal/index.d.ts +26 -6
- package/dist/universal/index.js +6 -2
- package/package.json +1 -1
- package/dist/chunk-BNMF2HMW.js.map +0 -1
- package/dist/chunk-KRA6EM2L.js.map +0 -1
- /package/dist/{chunk-STAHYDLY.js.map → chunk-45LAPB7U.js.map} +0 -0
package/dist/client/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
notifySessionExpired,
|
|
8
8
|
publicClients,
|
|
9
9
|
systemDelay
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-45LAPB7U.js";
|
|
11
11
|
import {
|
|
12
12
|
AuthorizationCode,
|
|
13
13
|
CodeVerifier,
|
|
@@ -36,12 +36,13 @@ import {
|
|
|
36
36
|
decodeSwappedOutputAmount,
|
|
37
37
|
formattedPricePerShare,
|
|
38
38
|
generatePKCEParams,
|
|
39
|
+
isOndoNotTradableError,
|
|
39
40
|
isSwapAvailable,
|
|
40
41
|
offerDisplayTokens,
|
|
41
42
|
ondoQuoteOfferDeadline,
|
|
42
43
|
superstateSwapContractAddress,
|
|
43
44
|
swapSpender
|
|
44
|
-
} from "../chunk-
|
|
45
|
+
} from "../chunk-M7WDZZPX.js";
|
|
45
46
|
import {
|
|
46
47
|
API_VERSION,
|
|
47
48
|
AssetDecimals,
|
|
@@ -94,7 +95,7 @@ import {
|
|
|
94
95
|
shortenAddress,
|
|
95
96
|
txExplorerUrl,
|
|
96
97
|
usdAmount
|
|
97
|
-
} from "../chunk-
|
|
98
|
+
} from "../chunk-HDJEDOS4.js";
|
|
98
99
|
|
|
99
100
|
// src/client/CoinListProvider.tsx
|
|
100
101
|
import {
|
|
@@ -3021,6 +3022,8 @@ function InfoIcon() {
|
|
|
3021
3022
|
import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3022
3023
|
var UNSUPPORTED_CHAIN_TITLE = "Not available on this network";
|
|
3023
3024
|
var UNSUPPORTED_CHAIN_DESCRIPTION = "Ondo orders cannot be placed on the selected network.";
|
|
3025
|
+
var NOT_TRADABLE_TITLE = "Trading is closed right now";
|
|
3026
|
+
var NOT_TRADABLE_DESCRIPTION = "This asset cannot be traded at the moment. Come back when the market opens.";
|
|
3024
3027
|
function OndoCheckoutError({
|
|
3025
3028
|
reason,
|
|
3026
3029
|
className
|
|
@@ -3062,6 +3065,8 @@ function title(reason) {
|
|
|
3062
3065
|
switch (reason) {
|
|
3063
3066
|
case "unsupported-chain":
|
|
3064
3067
|
return UNSUPPORTED_CHAIN_TITLE;
|
|
3068
|
+
case "not-tradable":
|
|
3069
|
+
return NOT_TRADABLE_TITLE;
|
|
3065
3070
|
default: {
|
|
3066
3071
|
const exhaustive = reason;
|
|
3067
3072
|
return exhaustive;
|
|
@@ -3072,6 +3077,8 @@ function description(reason) {
|
|
|
3072
3077
|
switch (reason) {
|
|
3073
3078
|
case "unsupported-chain":
|
|
3074
3079
|
return UNSUPPORTED_CHAIN_DESCRIPTION;
|
|
3080
|
+
case "not-tradable":
|
|
3081
|
+
return NOT_TRADABLE_DESCRIPTION;
|
|
3075
3082
|
default: {
|
|
3076
3083
|
const exhaustive = reason;
|
|
3077
3084
|
return exhaustive;
|
|
@@ -4200,7 +4207,9 @@ import { useCallback as useCallback2, useEffect as useEffect5, useRef as useRef4
|
|
|
4200
4207
|
|
|
4201
4208
|
// src/client/hooks/checkout/ondo/shared/data/ondo-load-error.ts
|
|
4202
4209
|
function ondoLoadErrorReason(error) {
|
|
4203
|
-
|
|
4210
|
+
if (error instanceof NotAuthenticatedError) return "not-authenticated";
|
|
4211
|
+
if (isOndoNotTradableError(error)) return "not-tradable";
|
|
4212
|
+
return "generic-error";
|
|
4204
4213
|
}
|
|
4205
4214
|
|
|
4206
4215
|
// src/client/hooks/checkout/ondo/buy/data/useOndoBuyTransaction.ts
|
|
@@ -4505,6 +4514,8 @@ function refreshErrorMessage(reason) {
|
|
|
4505
4514
|
switch (reason) {
|
|
4506
4515
|
case "not-authenticated":
|
|
4507
4516
|
return "Sign in to refresh this quote.";
|
|
4517
|
+
case "not-tradable":
|
|
4518
|
+
return "Trading is paused for this asset. Try again when the market opens.";
|
|
4508
4519
|
case "generic-error":
|
|
4509
4520
|
return "Could not refresh the quote.";
|
|
4510
4521
|
default: {
|
|
@@ -4632,6 +4643,9 @@ function quoteSizeFromKey(key) {
|
|
|
4632
4643
|
|
|
4633
4644
|
// src/client/hooks/checkout/ondo/shared/data/useOndoTradingStatus.ts
|
|
4634
4645
|
import { useEffect as useEffect9, useRef as useRef7, useState as useState8 } from "react";
|
|
4646
|
+
function isNotTradable(state) {
|
|
4647
|
+
return state.type === "CONTENT" && state.status.type === "not-tradable";
|
|
4648
|
+
}
|
|
4635
4649
|
var LOADING2 = { type: "LOADING" };
|
|
4636
4650
|
function useOndoTradingStatus(options) {
|
|
4637
4651
|
const {
|
|
@@ -4701,6 +4715,30 @@ function useOndoTradingStatus(options) {
|
|
|
4701
4715
|
return { state };
|
|
4702
4716
|
}
|
|
4703
4717
|
|
|
4718
|
+
// src/client/hooks/checkout/ondo/shared/ondo-checkout-error.types.ts
|
|
4719
|
+
var OndoCheckoutErrorReason = {
|
|
4720
|
+
/**
|
|
4721
|
+
* Which reason, if any, replaces the whole checkout. `null` means the steps
|
|
4722
|
+
* render.
|
|
4723
|
+
*
|
|
4724
|
+
* `unsupported-chain` wins because it is settled at mount: no market state
|
|
4725
|
+
* can make a chain with no contract tradable. `not-tradable` needs both a
|
|
4726
|
+
* market *known* to be closed and a user still at the start of the flow,
|
|
4727
|
+
* with no order confirmation on screen. Past the first step a pause belongs
|
|
4728
|
+
* to the step it interrupts, and a just-placed order's dialog must not be
|
|
4729
|
+
* hidden by a market that closed after it filled.
|
|
4730
|
+
*/
|
|
4731
|
+
of: ({
|
|
4732
|
+
swappableHere,
|
|
4733
|
+
notTradable,
|
|
4734
|
+
atEntry
|
|
4735
|
+
}) => {
|
|
4736
|
+
if (!swappableHere) return "unsupported-chain";
|
|
4737
|
+
if (notTradable && atEntry) return "not-tradable";
|
|
4738
|
+
return null;
|
|
4739
|
+
}
|
|
4740
|
+
};
|
|
4741
|
+
|
|
4704
4742
|
// src/client/hooks/checkout/ondo/shared/sidebar/useOndoSidebarViewModel.ts
|
|
4705
4743
|
var MARKET_OPEN = "Market open";
|
|
4706
4744
|
var MARKET_CLOSED2 = "Market closed";
|
|
@@ -5019,18 +5057,19 @@ function useOndoBuyCheckoutViewModel({
|
|
|
5019
5057
|
const [orderConfirmed, setOrderConfirmed] = useState11(null);
|
|
5020
5058
|
const swappableHere = swapSpender(offer.swapContracts, chain) !== null;
|
|
5021
5059
|
const live = enabled && swappableHere;
|
|
5022
|
-
const { state:
|
|
5060
|
+
const { state: tradingStatusState } = useOndoTradingStatus({
|
|
5023
5061
|
symbol: ondoSymbol,
|
|
5024
5062
|
side: "buy",
|
|
5025
|
-
size: priceSize(step),
|
|
5026
5063
|
pollIntervalMs: ONDO_POLL_INTERVAL_MS,
|
|
5027
5064
|
enabled: live
|
|
5028
5065
|
});
|
|
5029
|
-
const
|
|
5066
|
+
const notTradable = isNotTradable(tradingStatusState);
|
|
5067
|
+
const { state: priceState } = useOndoPrice({
|
|
5030
5068
|
symbol: ondoSymbol,
|
|
5031
5069
|
side: "buy",
|
|
5070
|
+
size: priceSize(step),
|
|
5032
5071
|
pollIntervalMs: ONDO_POLL_INTERVAL_MS,
|
|
5033
|
-
enabled: live
|
|
5072
|
+
enabled: live && !notTradable
|
|
5034
5073
|
});
|
|
5035
5074
|
const { state: outputTokenMetadataState } = useCheckoutOfferTokenMetadata({
|
|
5036
5075
|
offer,
|
|
@@ -5108,7 +5147,12 @@ function useOndoBuyCheckoutViewModel({
|
|
|
5108
5147
|
priceState,
|
|
5109
5148
|
tradingStatusState
|
|
5110
5149
|
});
|
|
5111
|
-
const
|
|
5150
|
+
const errorReason = OndoCheckoutErrorReason.of({
|
|
5151
|
+
swappableHere,
|
|
5152
|
+
notTradable,
|
|
5153
|
+
atEntry: step.type === "wallet" && orderConfirmed === null
|
|
5154
|
+
});
|
|
5155
|
+
const state = errorReason !== null ? { type: "error", reason: errorReason } : {
|
|
5112
5156
|
type: "content",
|
|
5113
5157
|
wallet: walletState,
|
|
5114
5158
|
amount: amountState,
|
|
@@ -6565,6 +6609,8 @@ function refreshErrorMessage2(reason) {
|
|
|
6565
6609
|
switch (reason) {
|
|
6566
6610
|
case "not-authenticated":
|
|
6567
6611
|
return "Sign in to refresh this quote.";
|
|
6612
|
+
case "not-tradable":
|
|
6613
|
+
return "Trading is paused for this asset. Try again when the market opens.";
|
|
6568
6614
|
case "generic-error":
|
|
6569
6615
|
return "Could not refresh the quote.";
|
|
6570
6616
|
default: {
|
|
@@ -6618,18 +6664,19 @@ function useOndoSellCheckoutViewModel({
|
|
|
6618
6664
|
const [orderConfirmed, setOrderConfirmed] = useState16(null);
|
|
6619
6665
|
const swappableHere = swapSpender(offer.swapContracts, chain) !== null;
|
|
6620
6666
|
const live = enabled && swappableHere;
|
|
6621
|
-
const { state:
|
|
6667
|
+
const { state: tradingStatusState } = useOndoTradingStatus({
|
|
6622
6668
|
symbol: ondoSymbol,
|
|
6623
6669
|
side: "sell",
|
|
6624
|
-
size: priceSize2(step),
|
|
6625
6670
|
pollIntervalMs: ONDO_POLL_INTERVAL_MS,
|
|
6626
6671
|
enabled: live
|
|
6627
6672
|
});
|
|
6628
|
-
const
|
|
6673
|
+
const notTradable = isNotTradable(tradingStatusState);
|
|
6674
|
+
const { state: priceState } = useOndoPrice({
|
|
6629
6675
|
symbol: ondoSymbol,
|
|
6630
6676
|
side: "sell",
|
|
6677
|
+
size: priceSize2(step),
|
|
6631
6678
|
pollIntervalMs: ONDO_POLL_INTERVAL_MS,
|
|
6632
|
-
enabled: live
|
|
6679
|
+
enabled: live && !notTradable
|
|
6633
6680
|
});
|
|
6634
6681
|
const { state: inputTokenMetadataState } = useCheckoutOfferTokenMetadata({
|
|
6635
6682
|
offer,
|
|
@@ -6707,7 +6754,14 @@ function useOndoSellCheckoutViewModel({
|
|
|
6707
6754
|
priceState,
|
|
6708
6755
|
tradingStatusState
|
|
6709
6756
|
});
|
|
6710
|
-
const
|
|
6757
|
+
const errorReason = OndoCheckoutErrorReason.of({
|
|
6758
|
+
swappableHere,
|
|
6759
|
+
notTradable,
|
|
6760
|
+
// The step the flow opened on, which for a preselected wallet is the
|
|
6761
|
+
// amount rather than a wallet step it never had.
|
|
6762
|
+
atEntry: step.type === initialStep.type && orderConfirmed === null
|
|
6763
|
+
});
|
|
6764
|
+
const state = errorReason !== null ? { type: "error", reason: errorReason } : {
|
|
6711
6765
|
type: "content",
|
|
6712
6766
|
wallet: hasWalletStep ? walletState : null,
|
|
6713
6767
|
amount: amountState,
|
|
@@ -12711,6 +12765,7 @@ export {
|
|
|
12711
12765
|
OndoBuyOrderConfirmed,
|
|
12712
12766
|
OndoBuyReviewView,
|
|
12713
12767
|
OndoCheckoutError,
|
|
12768
|
+
OndoCheckoutErrorReason,
|
|
12714
12769
|
OndoSellAmountView,
|
|
12715
12770
|
OndoSellCheckoutContainer,
|
|
12716
12771
|
OndoSellCheckoutView,
|
|
@@ -12750,6 +12805,7 @@ export {
|
|
|
12750
12805
|
formatCountdown,
|
|
12751
12806
|
formatMonthYear,
|
|
12752
12807
|
formatSaleCardCountdown,
|
|
12808
|
+
isNotTradable,
|
|
12753
12809
|
offerAssetIconUrl,
|
|
12754
12810
|
offerIconUrl,
|
|
12755
12811
|
offerTokenIdentifier,
|