@coinlist-co/react 0.12.2-rc.818bed6 → 0.12.2-rc.8a0d02a
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-2HCSM3FB.js → chunk-3WW5FLT7.js} +2 -2
- package/dist/{chunk-YMDYLYL3.js → chunk-C6GF7MDF.js} +2 -58
- package/dist/chunk-C6GF7MDF.js.map +1 -0
- package/dist/{chunk-OUFI3D3Q.js → chunk-IZJ4JSSC.js} +2 -8
- package/dist/{chunk-OUFI3D3Q.js.map → chunk-IZJ4JSSC.js.map} +1 -1
- package/dist/client/index.cjs +598 -912
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +41 -174
- package/dist/client/index.d.ts +41 -174
- package/dist/client/index.js +524 -777
- package/dist/client/index.js.map +1 -1
- package/dist/server/index.cjs +1 -56
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +3 -6
- package/dist/server/index.d.ts +3 -6
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/{time-DJU6E8KK.d.cts → time-CVZpAkGY.d.cts} +10 -75
- package/dist/{time-DJU6E8KK.d.ts → time-CVZpAkGY.d.ts} +10 -75
- package/dist/{token-registry-snapshot-DGG5N27C.d.ts → token-registry-snapshot-BkwA8KmD.d.ts} +1 -1
- package/dist/{token-registry-snapshot-B0xCp3GD.d.cts → token-registry-snapshot-bR14QehS.d.cts} +1 -1
- package/dist/universal/index.cjs +1 -64
- package/dist/universal/index.cjs.map +1 -1
- package/dist/universal/index.d.cts +8 -22
- package/dist/universal/index.d.ts +8 -22
- package/dist/universal/index.js +2 -6
- package/package.json +1 -1
- package/dist/chunk-YMDYLYL3.js.map +0 -1
- /package/dist/{chunk-2HCSM3FB.js.map → chunk-3WW5FLT7.js.map} +0 -0
package/dist/client/index.js
CHANGED
|
@@ -7,10 +7,9 @@ import {
|
|
|
7
7
|
notifySessionExpired,
|
|
8
8
|
publicClients,
|
|
9
9
|
systemDelay
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-3WW5FLT7.js";
|
|
11
11
|
import {
|
|
12
12
|
AuthorizationCode,
|
|
13
|
-
CENTRIFUGE_INDICATIVE_QUOTE_AMOUNT,
|
|
14
13
|
CENTRIFUGE_POLL_INTERVAL_MS,
|
|
15
14
|
CodeVerifier,
|
|
16
15
|
DEFAULT_AMOUNT_TO_COMPUTE_PRICE,
|
|
@@ -46,7 +45,7 @@ import {
|
|
|
46
45
|
resolveCentrifugeVaults,
|
|
47
46
|
superstateSwapContractAddress,
|
|
48
47
|
swapSpender
|
|
49
|
-
} from "../chunk-
|
|
48
|
+
} from "../chunk-IZJ4JSSC.js";
|
|
50
49
|
import {
|
|
51
50
|
API_VERSION,
|
|
52
51
|
AssetDecimals,
|
|
@@ -78,6 +77,7 @@ import {
|
|
|
78
77
|
OndoNamespaceImpl,
|
|
79
78
|
PUBLIC_API_BASE_URL,
|
|
80
79
|
RequirementsNamespaceImpl,
|
|
80
|
+
STABLE_DECIMALS,
|
|
81
81
|
SUPERSTATE_SWAP_ABI,
|
|
82
82
|
SUPPORT_NEW_TICKET_URL,
|
|
83
83
|
Seconds,
|
|
@@ -105,7 +105,7 @@ import {
|
|
|
105
105
|
shortenAddress,
|
|
106
106
|
txExplorerUrl,
|
|
107
107
|
usdAmount
|
|
108
|
-
} from "../chunk-
|
|
108
|
+
} from "../chunk-C6GF7MDF.js";
|
|
109
109
|
|
|
110
110
|
// src/client/CoinListProvider.tsx
|
|
111
111
|
import {
|
|
@@ -1953,7 +1953,7 @@ function CoinListSignInCardContainer({
|
|
|
1953
1953
|
}
|
|
1954
1954
|
|
|
1955
1955
|
// src/client/components/checkout/CheckoutContainer.tsx
|
|
1956
|
-
import { useState as
|
|
1956
|
+
import { useState as useState28 } from "react";
|
|
1957
1957
|
|
|
1958
1958
|
// src/client/components/checkout/shared/amount/CheckoutAmountInput.tsx
|
|
1959
1959
|
import { useId } from "react";
|
|
@@ -2866,9 +2866,7 @@ function AssetSummaryRow({
|
|
|
2866
2866
|
import { Fragment as Fragment4, jsx as jsx26, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2867
2867
|
var TITLE2 = "Request placed";
|
|
2868
2868
|
var SUBTITLE = "Your request is placed. It settles later, at the price the fund sets then.";
|
|
2869
|
-
var ESTIMATED_SHARES_LABEL = "Estimated shares";
|
|
2870
2869
|
var AMOUNT_INVESTED_LABEL = "Amount invested";
|
|
2871
|
-
var INDICATIVE_PRICE_LABEL = "Indicative price";
|
|
2872
2870
|
var WALLET_LABEL = "Wallet";
|
|
2873
2871
|
var DONE_LABEL = "Done";
|
|
2874
2872
|
function CentrifugeBuyOrderPlaced({
|
|
@@ -2897,9 +2895,7 @@ function CentrifugeBuyOrderPlaced({
|
|
|
2897
2895
|
}
|
|
2898
2896
|
function detailRows(state) {
|
|
2899
2897
|
return [
|
|
2900
|
-
{ label: ESTIMATED_SHARES_LABEL, value: state.outputAmount },
|
|
2901
2898
|
{ label: AMOUNT_INVESTED_LABEL, value: state.totalCost },
|
|
2902
|
-
{ label: INDICATIVE_PRICE_LABEL, value: state.pricePerShare },
|
|
2903
2899
|
{ label: WALLET_LABEL, value: state.recipientAddress }
|
|
2904
2900
|
];
|
|
2905
2901
|
}
|
|
@@ -2943,48 +2939,11 @@ function CheckoutReviewDisclaimerLink({
|
|
|
2943
2939
|
);
|
|
2944
2940
|
}
|
|
2945
2941
|
|
|
2946
|
-
// src/client/components/checkout/shared/review/CheckoutReviewError.tsx
|
|
2947
|
-
import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2948
|
-
var RETRY_LABEL = "Try again";
|
|
2949
|
-
function CheckoutReviewError({
|
|
2950
|
-
title: title2,
|
|
2951
|
-
heading,
|
|
2952
|
-
description: description2,
|
|
2953
|
-
onRetry,
|
|
2954
|
-
className
|
|
2955
|
-
}) {
|
|
2956
|
-
return /* @__PURE__ */ jsx28(CoinListStyleScope, { children: /* @__PURE__ */ jsx28(CheckoutStepCard, { state: "active", title: title2, className, children: /* @__PURE__ */ jsxs19("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:items-center clcosdk:gap-4 clcosdk:py-8 clcosdk:text-center", children: [
|
|
2957
|
-
/* @__PURE__ */ jsxs19("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:items-center clcosdk:gap-2", children: [
|
|
2958
|
-
/* @__PURE__ */ jsx28(
|
|
2959
|
-
"h3",
|
|
2960
|
-
{
|
|
2961
|
-
className: cn(
|
|
2962
|
-
typeClasses.h4,
|
|
2963
|
-
"clcosdk:font-medium clcosdk:text-text-primary"
|
|
2964
|
-
),
|
|
2965
|
-
children: heading
|
|
2966
|
-
}
|
|
2967
|
-
),
|
|
2968
|
-
/* @__PURE__ */ jsx28(
|
|
2969
|
-
"p",
|
|
2970
|
-
{
|
|
2971
|
-
className: cn(
|
|
2972
|
-
typeClasses.body,
|
|
2973
|
-
"clcosdk:max-w-md clcosdk:text-text-secondary"
|
|
2974
|
-
),
|
|
2975
|
-
children: description2
|
|
2976
|
-
}
|
|
2977
|
-
)
|
|
2978
|
-
] }),
|
|
2979
|
-
onRetry !== void 0 && /* @__PURE__ */ jsx28(ClButton, { variant: "secondary", onClick: onRetry, children: RETRY_LABEL })
|
|
2980
|
-
] }) }) });
|
|
2981
|
-
}
|
|
2982
|
-
|
|
2983
2942
|
// src/client/components/checkout/shared/review/CheckoutReviewInfoIcon.tsx
|
|
2984
2943
|
import { Info as Info2 } from "lucide-react";
|
|
2985
|
-
import { jsx as
|
|
2944
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
2986
2945
|
function CheckoutReviewInfoIcon() {
|
|
2987
|
-
return /* @__PURE__ */
|
|
2946
|
+
return /* @__PURE__ */ jsx28(CoinListStyleScope, { children: /* @__PURE__ */ jsx28(
|
|
2988
2947
|
Info2,
|
|
2989
2948
|
{
|
|
2990
2949
|
className: "clcosdk:size-4 clcosdk:text-text-secondary",
|
|
@@ -2993,85 +2952,8 @@ function CheckoutReviewInfoIcon() {
|
|
|
2993
2952
|
) });
|
|
2994
2953
|
}
|
|
2995
2954
|
|
|
2996
|
-
// src/client/components/design-system/Skeleton.tsx
|
|
2997
|
-
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
2998
|
-
var variantClasses = {
|
|
2999
|
-
text: "clcosdk:rounded-md",
|
|
3000
|
-
circular: "clcosdk:rounded-full",
|
|
3001
|
-
rectangular: "clcosdk:rounded-2xl"
|
|
3002
|
-
};
|
|
3003
|
-
function Skeleton({ variant = "text", className }) {
|
|
3004
|
-
return /* @__PURE__ */ jsx30(
|
|
3005
|
-
"div",
|
|
3006
|
-
{
|
|
3007
|
-
"aria-hidden": "true",
|
|
3008
|
-
className: cn(
|
|
3009
|
-
"clcosdk:animate-pulse clcosdk:bg-section",
|
|
3010
|
-
variantClasses[variant],
|
|
3011
|
-
className
|
|
3012
|
-
)
|
|
3013
|
-
}
|
|
3014
|
-
);
|
|
3015
|
-
}
|
|
3016
|
-
|
|
3017
|
-
// src/client/components/checkout/shared/review/CheckoutReviewLoading.tsx
|
|
3018
|
-
import { Fragment as Fragment5, jsx as jsx31, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3019
|
-
var DETAIL_ROW_KEYS = ["first", "second", "third", "fourth"];
|
|
3020
|
-
function CheckoutReviewLoading({
|
|
3021
|
-
title: title2,
|
|
3022
|
-
statusLabel,
|
|
3023
|
-
detailRowCount,
|
|
3024
|
-
showTotal = true,
|
|
3025
|
-
className
|
|
3026
|
-
}) {
|
|
3027
|
-
return /* @__PURE__ */ jsx31(CoinListStyleScope, { children: /* @__PURE__ */ jsxs20(CheckoutStepCard, { state: "active", title: title2, className, children: [
|
|
3028
|
-
/* @__PURE__ */ jsx31("output", { className: "clcosdk:sr-only", children: statusLabel }),
|
|
3029
|
-
/* @__PURE__ */ jsxs20("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4 clcosdk:rounded-2xl clcosdk:border clcosdk:border-border clcosdk:p-4", children: [
|
|
3030
|
-
/* @__PURE__ */ jsx31(Skeleton, { className: "clcosdk:h-3 clcosdk:w-20" }),
|
|
3031
|
-
/* @__PURE__ */ jsxs20("div", { className: "clcosdk:flex clcosdk:items-center clcosdk:gap-3", children: [
|
|
3032
|
-
/* @__PURE__ */ jsx31(
|
|
3033
|
-
Skeleton,
|
|
3034
|
-
{
|
|
3035
|
-
variant: "circular",
|
|
3036
|
-
className: "clcosdk:size-10 clcosdk:shrink-0"
|
|
3037
|
-
}
|
|
3038
|
-
),
|
|
3039
|
-
/* @__PURE__ */ jsxs20("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-2", children: [
|
|
3040
|
-
/* @__PURE__ */ jsx31(Skeleton, { className: "clcosdk:h-5 clcosdk:w-32" }),
|
|
3041
|
-
/* @__PURE__ */ jsx31(Skeleton, { className: "clcosdk:h-3 clcosdk:w-24" })
|
|
3042
|
-
] })
|
|
3043
|
-
] })
|
|
3044
|
-
] }),
|
|
3045
|
-
/* @__PURE__ */ jsx31("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-3 clcosdk:px-2", children: DETAIL_ROW_KEYS.slice(0, detailRowCount).map((row) => /* @__PURE__ */ jsxs20(
|
|
3046
|
-
"div",
|
|
3047
|
-
{
|
|
3048
|
-
className: "clcosdk:flex clcosdk:items-center clcosdk:justify-between clcosdk:gap-4",
|
|
3049
|
-
children: [
|
|
3050
|
-
/* @__PURE__ */ jsx31(Skeleton, { className: "clcosdk:h-4 clcosdk:w-28" }),
|
|
3051
|
-
/* @__PURE__ */ jsx31(Skeleton, { className: "clcosdk:h-4 clcosdk:w-24" })
|
|
3052
|
-
]
|
|
3053
|
-
},
|
|
3054
|
-
row
|
|
3055
|
-
)) }),
|
|
3056
|
-
showTotal && /* @__PURE__ */ jsxs20(Fragment5, { children: [
|
|
3057
|
-
/* @__PURE__ */ jsx31("div", { className: "clcosdk:h-px clcosdk:shrink-0 clcosdk:bg-divider" }),
|
|
3058
|
-
/* @__PURE__ */ jsxs20("div", { className: "clcosdk:flex clcosdk:items-center clcosdk:justify-between clcosdk:gap-4 clcosdk:px-2", children: [
|
|
3059
|
-
/* @__PURE__ */ jsx31(Skeleton, { className: "clcosdk:h-4 clcosdk:w-16" }),
|
|
3060
|
-
/* @__PURE__ */ jsx31(Skeleton, { className: "clcosdk:h-4 clcosdk:w-20" })
|
|
3061
|
-
] })
|
|
3062
|
-
] }),
|
|
3063
|
-
/* @__PURE__ */ jsx31(
|
|
3064
|
-
Skeleton,
|
|
3065
|
-
{
|
|
3066
|
-
variant: "rectangular",
|
|
3067
|
-
className: "clcosdk:h-[54px] clcosdk:w-full clcosdk:rounded-full"
|
|
3068
|
-
}
|
|
3069
|
-
)
|
|
3070
|
-
] }) });
|
|
3071
|
-
}
|
|
3072
|
-
|
|
3073
2955
|
// src/client/components/checkout/shared/review/CheckoutReviewQuoteLine.tsx
|
|
3074
|
-
import { jsx as
|
|
2956
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
3075
2957
|
function CheckoutReviewQuoteLine({
|
|
3076
2958
|
tone,
|
|
3077
2959
|
children
|
|
@@ -3081,7 +2963,7 @@ function CheckoutReviewQuoteLine({
|
|
|
3081
2963
|
warning: "clcosdk:text-warning",
|
|
3082
2964
|
error: "clcosdk:text-error"
|
|
3083
2965
|
}[tone];
|
|
3084
|
-
return /* @__PURE__ */
|
|
2966
|
+
return /* @__PURE__ */ jsx29(CoinListStyleScope, { children: /* @__PURE__ */ jsx29(
|
|
3085
2967
|
"p",
|
|
3086
2968
|
{
|
|
3087
2969
|
className: cn(
|
|
@@ -3096,7 +2978,7 @@ function CheckoutReviewQuoteLine({
|
|
|
3096
2978
|
|
|
3097
2979
|
// src/client/components/design-system/Tooltip.tsx
|
|
3098
2980
|
import { useId as useId2 } from "react";
|
|
3099
|
-
import { jsx as
|
|
2981
|
+
import { jsx as jsx30, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3100
2982
|
var positionClasses = {
|
|
3101
2983
|
top: "clcosdk:bottom-full clcosdk:mb-2",
|
|
3102
2984
|
bottom: "clcosdk:top-full clcosdk:mt-2"
|
|
@@ -3108,7 +2990,7 @@ function Tooltip({
|
|
|
3108
2990
|
className
|
|
3109
2991
|
}) {
|
|
3110
2992
|
const tooltipId = useId2();
|
|
3111
|
-
return /* @__PURE__ */
|
|
2993
|
+
return /* @__PURE__ */ jsxs19(
|
|
3112
2994
|
"span",
|
|
3113
2995
|
{
|
|
3114
2996
|
tabIndex: 0,
|
|
@@ -3123,7 +3005,7 @@ function Tooltip({
|
|
|
3123
3005
|
),
|
|
3124
3006
|
children: [
|
|
3125
3007
|
children,
|
|
3126
|
-
/* @__PURE__ */
|
|
3008
|
+
/* @__PURE__ */ jsx30(
|
|
3127
3009
|
"span",
|
|
3128
3010
|
{
|
|
3129
3011
|
id: tooltipId,
|
|
@@ -3146,21 +3028,15 @@ function Tooltip({
|
|
|
3146
3028
|
}
|
|
3147
3029
|
|
|
3148
3030
|
// src/client/components/checkout/centrifuge/buy/review/CentrifugeBuyReviewView.tsx
|
|
3149
|
-
import { jsx as
|
|
3031
|
+
import { jsx as jsx31, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3150
3032
|
var TITLE3 = "3. Review and confirm";
|
|
3151
3033
|
var YOU_INVEST_LABEL = "You invest";
|
|
3152
|
-
var APPROXIMATE_TOOLTIP = "An estimate. The fund prices the deposit later, so the shares can differ.";
|
|
3153
3034
|
var RECEIVING_WALLET_LABEL = "Receiving wallet";
|
|
3154
3035
|
var COINLIST_FEE_LABEL = "CoinList fee";
|
|
3155
3036
|
var COINLIST_FEE_TOOLTIP = "CoinList does not charge a fee on this deposit. The total is the amount you invest.";
|
|
3156
3037
|
var TOTAL_LABEL = "Total";
|
|
3157
|
-
var REFRESH_ESTIMATE_LABEL = "Refresh estimate";
|
|
3158
|
-
var REFRESHING_ESTIMATE_LABEL = "Refreshing estimate\u2026";
|
|
3159
|
-
var LOADING_STATUS = "Loading your request\u2026";
|
|
3160
|
-
var ERROR_TITLE = "Something went wrong";
|
|
3161
|
-
var ERROR_DESCRIPTION = "We couldn't load your request. Please try again.";
|
|
3162
3038
|
function CentrifugeBuyReviewView(props) {
|
|
3163
|
-
return /* @__PURE__ */
|
|
3039
|
+
return /* @__PURE__ */ jsx31(CoinListStyleScope, { children: /* @__PURE__ */ jsx31(CentrifugeReviewViewBody, { ...props }) });
|
|
3164
3040
|
}
|
|
3165
3041
|
function CentrifugeReviewViewBody({
|
|
3166
3042
|
state,
|
|
@@ -3169,7 +3045,7 @@ function CentrifugeReviewViewBody({
|
|
|
3169
3045
|
}) {
|
|
3170
3046
|
switch (state.type) {
|
|
3171
3047
|
case "incomplete":
|
|
3172
|
-
return /* @__PURE__ */
|
|
3048
|
+
return /* @__PURE__ */ jsx31(
|
|
3173
3049
|
CheckoutStepCard,
|
|
3174
3050
|
{
|
|
3175
3051
|
state: "inactive",
|
|
@@ -3177,29 +3053,8 @@ function CentrifugeReviewViewBody({
|
|
|
3177
3053
|
className
|
|
3178
3054
|
}
|
|
3179
3055
|
);
|
|
3180
|
-
case "loading":
|
|
3181
|
-
return /* @__PURE__ */ jsx34(
|
|
3182
|
-
CheckoutReviewLoading,
|
|
3183
|
-
{
|
|
3184
|
-
title: TITLE3,
|
|
3185
|
-
statusLabel: LOADING_STATUS,
|
|
3186
|
-
detailRowCount: 2,
|
|
3187
|
-
className
|
|
3188
|
-
}
|
|
3189
|
-
);
|
|
3190
|
-
case "error":
|
|
3191
|
-
return /* @__PURE__ */ jsx34(
|
|
3192
|
-
CheckoutReviewError,
|
|
3193
|
-
{
|
|
3194
|
-
title: TITLE3,
|
|
3195
|
-
heading: ERROR_TITLE,
|
|
3196
|
-
description: ERROR_DESCRIPTION,
|
|
3197
|
-
onRetry: () => onEvent({ type: "ON_RETRY" }),
|
|
3198
|
-
className
|
|
3199
|
-
}
|
|
3200
|
-
);
|
|
3201
3056
|
case "active":
|
|
3202
|
-
return /* @__PURE__ */
|
|
3057
|
+
return /* @__PURE__ */ jsx31(ActiveView2, { state, onEvent, className });
|
|
3203
3058
|
default: {
|
|
3204
3059
|
const exhaustive = state;
|
|
3205
3060
|
return exhaustive;
|
|
@@ -3211,52 +3066,34 @@ function ActiveView2({
|
|
|
3211
3066
|
onEvent,
|
|
3212
3067
|
className
|
|
3213
3068
|
}) {
|
|
3214
|
-
return /* @__PURE__ */
|
|
3215
|
-
/* @__PURE__ */
|
|
3216
|
-
/* @__PURE__ */
|
|
3217
|
-
/* @__PURE__ */
|
|
3218
|
-
/* @__PURE__ */
|
|
3219
|
-
/* @__PURE__ */
|
|
3220
|
-
/* @__PURE__ */ jsx34("span", { className: "clcosdk:min-w-0 clcosdk:break-words clcosdk:text-[22px] clcosdk:leading-[130%] clcosdk:font-medium clcosdk:text-text-primary", children: state.investAmount }),
|
|
3221
|
-
/* @__PURE__ */ jsxs22(
|
|
3222
|
-
"span",
|
|
3223
|
-
{
|
|
3224
|
-
className: cn(
|
|
3225
|
-
typeClasses.bodySm,
|
|
3226
|
-
"clcosdk:flex clcosdk:min-w-0 clcosdk:items-center clcosdk:gap-1 clcosdk:text-text-secondary"
|
|
3227
|
-
),
|
|
3228
|
-
children: [
|
|
3229
|
-
/* @__PURE__ */ jsxs22("span", { className: "clcosdk:min-w-0 clcosdk:break-words", children: [
|
|
3230
|
-
"\u2248 ",
|
|
3231
|
-
state.approximateAmount
|
|
3232
|
-
] }),
|
|
3233
|
-
/* @__PURE__ */ jsx34(Tooltip, { content: APPROXIMATE_TOOLTIP, children: /* @__PURE__ */ jsx34(CheckoutReviewInfoIcon, {}) })
|
|
3234
|
-
]
|
|
3235
|
-
}
|
|
3236
|
-
)
|
|
3237
|
-
] })
|
|
3069
|
+
return /* @__PURE__ */ jsxs20(CheckoutStepCard, { state: "active", title: TITLE3, className, children: [
|
|
3070
|
+
/* @__PURE__ */ jsxs20("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4 clcosdk:rounded-2xl clcosdk:border clcosdk:border-border clcosdk:p-4", children: [
|
|
3071
|
+
/* @__PURE__ */ jsx31("span", { className: cn(typeClasses.bodySm, "clcosdk:text-text-secondary"), children: YOU_INVEST_LABEL }),
|
|
3072
|
+
/* @__PURE__ */ jsxs20("div", { className: "clcosdk:flex clcosdk:min-w-0 clcosdk:items-center clcosdk:gap-3", children: [
|
|
3073
|
+
/* @__PURE__ */ jsx31(AssetIcon, { asset: state.inputAsset, size: 40 }),
|
|
3074
|
+
/* @__PURE__ */ jsx31("div", { className: "clcosdk:flex clcosdk:min-w-0 clcosdk:flex-col clcosdk:gap-1", children: /* @__PURE__ */ jsx31("span", { className: "clcosdk:min-w-0 clcosdk:break-words clcosdk:text-[22px] clcosdk:leading-[130%] clcosdk:font-medium clcosdk:text-text-primary", children: state.investAmount }) })
|
|
3238
3075
|
] })
|
|
3239
3076
|
] }),
|
|
3240
|
-
/* @__PURE__ */
|
|
3241
|
-
/* @__PURE__ */
|
|
3242
|
-
/* @__PURE__ */
|
|
3077
|
+
/* @__PURE__ */ jsxs20("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4", children: [
|
|
3078
|
+
/* @__PURE__ */ jsxs20("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-3 clcosdk:px-2", children: [
|
|
3079
|
+
/* @__PURE__ */ jsx31(
|
|
3243
3080
|
DetailRow,
|
|
3244
3081
|
{
|
|
3245
3082
|
label: RECEIVING_WALLET_LABEL,
|
|
3246
3083
|
value: state.recipientAddress
|
|
3247
3084
|
}
|
|
3248
3085
|
),
|
|
3249
|
-
/* @__PURE__ */
|
|
3086
|
+
/* @__PURE__ */ jsx31(
|
|
3250
3087
|
DetailRow,
|
|
3251
3088
|
{
|
|
3252
3089
|
label: COINLIST_FEE_LABEL,
|
|
3253
|
-
tooltip: /* @__PURE__ */
|
|
3090
|
+
tooltip: /* @__PURE__ */ jsx31(Tooltip, { content: COINLIST_FEE_TOOLTIP, children: /* @__PURE__ */ jsx31(CheckoutReviewInfoIcon, {}) }),
|
|
3254
3091
|
value: state.coinlistFee
|
|
3255
3092
|
}
|
|
3256
3093
|
)
|
|
3257
3094
|
] }),
|
|
3258
|
-
/* @__PURE__ */
|
|
3259
|
-
/* @__PURE__ */
|
|
3095
|
+
/* @__PURE__ */ jsx31("div", { className: "clcosdk:h-px clcosdk:shrink-0 clcosdk:bg-divider" }),
|
|
3096
|
+
/* @__PURE__ */ jsx31(
|
|
3260
3097
|
DetailRow,
|
|
3261
3098
|
{
|
|
3262
3099
|
label: TOTAL_LABEL,
|
|
@@ -3266,15 +3103,8 @@ function ActiveView2({
|
|
|
3266
3103
|
}
|
|
3267
3104
|
)
|
|
3268
3105
|
] }),
|
|
3269
|
-
state.error !== null && /* @__PURE__ */
|
|
3270
|
-
/* @__PURE__ */
|
|
3271
|
-
EstimateRefresh,
|
|
3272
|
-
{
|
|
3273
|
-
isRefreshing: state.isRefreshing,
|
|
3274
|
-
onRefresh: () => onEvent({ type: "ON_REFRESH_ESTIMATE" })
|
|
3275
|
-
}
|
|
3276
|
-
),
|
|
3277
|
-
/* @__PURE__ */ jsx34(
|
|
3106
|
+
state.error !== null && /* @__PURE__ */ jsx31(CheckoutReviewQuoteLine, { tone: "error", children: state.error }),
|
|
3107
|
+
/* @__PURE__ */ jsx31(
|
|
3278
3108
|
ClButton,
|
|
3279
3109
|
{
|
|
3280
3110
|
variant: "gradient",
|
|
@@ -3287,41 +3117,27 @@ function ActiveView2({
|
|
|
3287
3117
|
children: "Place request"
|
|
3288
3118
|
}
|
|
3289
3119
|
),
|
|
3290
|
-
/* @__PURE__ */
|
|
3120
|
+
/* @__PURE__ */ jsx31(Disclaimer, {})
|
|
3291
3121
|
] });
|
|
3292
3122
|
}
|
|
3293
|
-
function EstimateRefresh({
|
|
3294
|
-
isRefreshing,
|
|
3295
|
-
onRefresh
|
|
3296
|
-
}) {
|
|
3297
|
-
return /* @__PURE__ */ jsx34(CheckoutReviewQuoteLine, { tone: "muted", children: isRefreshing ? REFRESHING_ESTIMATE_LABEL : /* @__PURE__ */ jsx34(
|
|
3298
|
-
"button",
|
|
3299
|
-
{
|
|
3300
|
-
type: "button",
|
|
3301
|
-
onClick: onRefresh,
|
|
3302
|
-
className: "clcosdk:cursor-pointer clcosdk:underline clcosdk:transition-opacity clcosdk:hover:opacity-80",
|
|
3303
|
-
children: REFRESH_ESTIMATE_LABEL
|
|
3304
|
-
}
|
|
3305
|
-
) });
|
|
3306
|
-
}
|
|
3307
3123
|
function Disclaimer() {
|
|
3308
|
-
return /* @__PURE__ */
|
|
3124
|
+
return /* @__PURE__ */ jsxs20(CheckoutReviewDisclaimer, { children: [
|
|
3309
3125
|
"Your final token amount is determined by the share price when your investment is processed. By placing this order, you agree to CoinList's",
|
|
3310
3126
|
" ",
|
|
3311
|
-
/* @__PURE__ */
|
|
3127
|
+
/* @__PURE__ */ jsx31(CheckoutReviewDisclaimerLink, { href: COINLIST_TOS_URL, children: "Terms of Service" }),
|
|
3312
3128
|
" ",
|
|
3313
3129
|
"and",
|
|
3314
3130
|
" ",
|
|
3315
|
-
/* @__PURE__ */
|
|
3131
|
+
/* @__PURE__ */ jsx31(CheckoutReviewDisclaimerLink, { href: COINLIST_PRIVACY_URL, children: "Privacy Policy" }),
|
|
3316
3132
|
", and",
|
|
3317
3133
|
" ",
|
|
3318
|
-
/* @__PURE__ */
|
|
3134
|
+
/* @__PURE__ */ jsx31(CheckoutReviewDisclaimerLink, { href: CENTRIFUGE_TOS_URL, children: "Centrifuge's Terms" }),
|
|
3319
3135
|
"."
|
|
3320
3136
|
] });
|
|
3321
3137
|
}
|
|
3322
3138
|
|
|
3323
3139
|
// src/client/components/checkout/centrifuge/shared/error/CentrifugeCheckoutError.tsx
|
|
3324
|
-
import { jsx as
|
|
3140
|
+
import { jsx as jsx32, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3325
3141
|
var COPY = {
|
|
3326
3142
|
"unsupported-chain": {
|
|
3327
3143
|
title: "Not available on this network",
|
|
@@ -3337,7 +3153,7 @@ function CentrifugeCheckoutError({
|
|
|
3337
3153
|
className
|
|
3338
3154
|
}) {
|
|
3339
3155
|
const copy = COPY[reason];
|
|
3340
|
-
return /* @__PURE__ */
|
|
3156
|
+
return /* @__PURE__ */ jsx32(CoinListStyleScope, { children: /* @__PURE__ */ jsx32(
|
|
3341
3157
|
"div",
|
|
3342
3158
|
{
|
|
3343
3159
|
className: cn(
|
|
@@ -3345,8 +3161,8 @@ function CentrifugeCheckoutError({
|
|
|
3345
3161
|
"clcosdk:items-center clcosdk:gap-4 clcosdk:py-12 clcosdk:text-center",
|
|
3346
3162
|
className
|
|
3347
3163
|
),
|
|
3348
|
-
children: /* @__PURE__ */
|
|
3349
|
-
/* @__PURE__ */
|
|
3164
|
+
children: /* @__PURE__ */ jsxs21("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:items-center clcosdk:gap-2", children: [
|
|
3165
|
+
/* @__PURE__ */ jsx32(
|
|
3350
3166
|
"h2",
|
|
3351
3167
|
{
|
|
3352
3168
|
className: cn(
|
|
@@ -3356,7 +3172,7 @@ function CentrifugeCheckoutError({
|
|
|
3356
3172
|
children: copy.title
|
|
3357
3173
|
}
|
|
3358
3174
|
),
|
|
3359
|
-
/* @__PURE__ */
|
|
3175
|
+
/* @__PURE__ */ jsx32(
|
|
3360
3176
|
"p",
|
|
3361
3177
|
{
|
|
3362
3178
|
className: cn(
|
|
@@ -3376,13 +3192,13 @@ import { ChevronDown, ChevronUp } from "lucide-react";
|
|
|
3376
3192
|
import { useId as useId3, useState as useState2 } from "react";
|
|
3377
3193
|
|
|
3378
3194
|
// src/client/components/design-system/Card.tsx
|
|
3379
|
-
import { jsx as
|
|
3195
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
3380
3196
|
var GAP_CLASS = {
|
|
3381
3197
|
md: "clcosdk:gap-4",
|
|
3382
3198
|
lg: "clcosdk:gap-6"
|
|
3383
3199
|
};
|
|
3384
3200
|
function Card({ children, gap = "lg", className }) {
|
|
3385
|
-
return /* @__PURE__ */
|
|
3201
|
+
return /* @__PURE__ */ jsx33(
|
|
3386
3202
|
"div",
|
|
3387
3203
|
{
|
|
3388
3204
|
className: cn(
|
|
@@ -3399,7 +3215,7 @@ function Card({ children, gap = "lg", className }) {
|
|
|
3399
3215
|
}
|
|
3400
3216
|
|
|
3401
3217
|
// src/client/components/checkout/shared/sidebar/CheckoutSidebarCard.tsx
|
|
3402
|
-
import { jsx as
|
|
3218
|
+
import { jsx as jsx34, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3403
3219
|
function CheckoutSidebarCard({
|
|
3404
3220
|
title: title2,
|
|
3405
3221
|
header,
|
|
@@ -3410,7 +3226,7 @@ function CheckoutSidebarCard({
|
|
|
3410
3226
|
}) {
|
|
3411
3227
|
const [expanded, setExpanded] = useState2(false);
|
|
3412
3228
|
const rowsId = useId3();
|
|
3413
|
-
return /* @__PURE__ */
|
|
3229
|
+
return /* @__PURE__ */ jsx34(CoinListStyleScope, { children: /* @__PURE__ */ jsxs22(
|
|
3414
3230
|
Card,
|
|
3415
3231
|
{
|
|
3416
3232
|
className: cn(
|
|
@@ -3419,8 +3235,8 @@ function CheckoutSidebarCard({
|
|
|
3419
3235
|
className
|
|
3420
3236
|
),
|
|
3421
3237
|
children: [
|
|
3422
|
-
/* @__PURE__ */
|
|
3423
|
-
/* @__PURE__ */
|
|
3238
|
+
/* @__PURE__ */ jsxs22("div", { className: "clcosdk:flex clcosdk:min-w-0 clcosdk:flex-col clcosdk:gap-4", children: [
|
|
3239
|
+
/* @__PURE__ */ jsx34(
|
|
3424
3240
|
"h2",
|
|
3425
3241
|
{
|
|
3426
3242
|
className: cn(
|
|
@@ -3432,7 +3248,7 @@ function CheckoutSidebarCard({
|
|
|
3432
3248
|
),
|
|
3433
3249
|
header
|
|
3434
3250
|
] }),
|
|
3435
|
-
/* @__PURE__ */
|
|
3251
|
+
/* @__PURE__ */ jsx34(
|
|
3436
3252
|
"div",
|
|
3437
3253
|
{
|
|
3438
3254
|
className: cn(
|
|
@@ -3441,7 +3257,7 @@ function CheckoutSidebarCard({
|
|
|
3441
3257
|
)
|
|
3442
3258
|
}
|
|
3443
3259
|
),
|
|
3444
|
-
/* @__PURE__ */
|
|
3260
|
+
/* @__PURE__ */ jsx34(
|
|
3445
3261
|
CheckoutDetailList,
|
|
3446
3262
|
{
|
|
3447
3263
|
id: rowsId,
|
|
@@ -3450,7 +3266,7 @@ function CheckoutSidebarCard({
|
|
|
3450
3266
|
className: cn("clcosdk:px-2", !expanded && "clcosdk:max-md:hidden")
|
|
3451
3267
|
}
|
|
3452
3268
|
),
|
|
3453
|
-
/* @__PURE__ */
|
|
3269
|
+
/* @__PURE__ */ jsxs22(
|
|
3454
3270
|
"button",
|
|
3455
3271
|
{
|
|
3456
3272
|
type: "button",
|
|
@@ -3469,7 +3285,7 @@ function CheckoutSidebarCard({
|
|
|
3469
3285
|
),
|
|
3470
3286
|
children: [
|
|
3471
3287
|
expanded ? hideDetailsLabel : showDetailsLabel,
|
|
3472
|
-
expanded ? /* @__PURE__ */
|
|
3288
|
+
expanded ? /* @__PURE__ */ jsx34(ChevronUp, { className: "clcosdk:size-4", "aria-hidden": "true" }) : /* @__PURE__ */ jsx34(ChevronDown, { className: "clcosdk:size-4", "aria-hidden": "true" })
|
|
3473
3289
|
]
|
|
3474
3290
|
}
|
|
3475
3291
|
)
|
|
@@ -3478,8 +3294,29 @@ function CheckoutSidebarCard({
|
|
|
3478
3294
|
) });
|
|
3479
3295
|
}
|
|
3480
3296
|
|
|
3297
|
+
// src/client/components/design-system/Skeleton.tsx
|
|
3298
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
3299
|
+
var variantClasses = {
|
|
3300
|
+
text: "clcosdk:rounded-md",
|
|
3301
|
+
circular: "clcosdk:rounded-full",
|
|
3302
|
+
rectangular: "clcosdk:rounded-2xl"
|
|
3303
|
+
};
|
|
3304
|
+
function Skeleton({ variant = "text", className }) {
|
|
3305
|
+
return /* @__PURE__ */ jsx35(
|
|
3306
|
+
"div",
|
|
3307
|
+
{
|
|
3308
|
+
"aria-hidden": "true",
|
|
3309
|
+
className: cn(
|
|
3310
|
+
"clcosdk:animate-pulse clcosdk:bg-section",
|
|
3311
|
+
variantClasses[variant],
|
|
3312
|
+
className
|
|
3313
|
+
)
|
|
3314
|
+
}
|
|
3315
|
+
);
|
|
3316
|
+
}
|
|
3317
|
+
|
|
3481
3318
|
// src/client/components/checkout/centrifuge/shared/sidebar/CentrifugeSidebarView.tsx
|
|
3482
|
-
import { jsx as
|
|
3319
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
3483
3320
|
var TITLE4 = "Asset details";
|
|
3484
3321
|
var SHOW_DETAILS_LABEL = "Show details";
|
|
3485
3322
|
var HIDE_DETAILS_LABEL = "Hide details";
|
|
@@ -3494,11 +3331,11 @@ function CentrifugeSidebarView({
|
|
|
3494
3331
|
state,
|
|
3495
3332
|
className
|
|
3496
3333
|
}) {
|
|
3497
|
-
return /* @__PURE__ */
|
|
3334
|
+
return /* @__PURE__ */ jsx36(CoinListStyleScope, { children: /* @__PURE__ */ jsx36(
|
|
3498
3335
|
CheckoutSidebarCard,
|
|
3499
3336
|
{
|
|
3500
3337
|
title: TITLE4,
|
|
3501
|
-
header: /* @__PURE__ */
|
|
3338
|
+
header: /* @__PURE__ */ jsx36(
|
|
3502
3339
|
AssetSummaryRow,
|
|
3503
3340
|
{
|
|
3504
3341
|
asset: state.asset,
|
|
@@ -3526,7 +3363,7 @@ function detailRows2(state) {
|
|
|
3526
3363
|
function minimumValue(minimum) {
|
|
3527
3364
|
switch (minimum.type) {
|
|
3528
3365
|
case "loading":
|
|
3529
|
-
return /* @__PURE__ */
|
|
3366
|
+
return /* @__PURE__ */ jsx36(Skeleton, { className: "clcosdk:h-[1em] clcosdk:w-16" });
|
|
3530
3367
|
case "known":
|
|
3531
3368
|
return minimum.amount;
|
|
3532
3369
|
case "none":
|
|
@@ -3542,7 +3379,7 @@ function minimumValue(minimum) {
|
|
|
3542
3379
|
import { Wallet } from "lucide-react";
|
|
3543
3380
|
|
|
3544
3381
|
// src/client/components/checkout/shared/selection/SelectableOptionRow.tsx
|
|
3545
|
-
import { jsx as
|
|
3382
|
+
import { jsx as jsx37, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3546
3383
|
function SelectableOptionRow({
|
|
3547
3384
|
selected,
|
|
3548
3385
|
disabled = false,
|
|
@@ -3559,7 +3396,7 @@ function SelectableOptionRow({
|
|
|
3559
3396
|
onSelect();
|
|
3560
3397
|
}
|
|
3561
3398
|
};
|
|
3562
|
-
return /* @__PURE__ */
|
|
3399
|
+
return /* @__PURE__ */ jsx37(CoinListStyleScope, { children: /* @__PURE__ */ jsxs23(
|
|
3563
3400
|
"div",
|
|
3564
3401
|
{
|
|
3565
3402
|
role: "button",
|
|
@@ -3579,17 +3416,17 @@ function SelectableOptionRow({
|
|
|
3579
3416
|
className
|
|
3580
3417
|
),
|
|
3581
3418
|
children: [
|
|
3582
|
-
/* @__PURE__ */
|
|
3419
|
+
/* @__PURE__ */ jsxs23("div", { className: "clcosdk:flex clcosdk:min-w-0 clcosdk:items-center clcosdk:gap-3", children: [
|
|
3583
3420
|
icon,
|
|
3584
|
-
/* @__PURE__ */
|
|
3421
|
+
/* @__PURE__ */ jsx37("div", { className: "clcosdk:flex clcosdk:min-w-0 clcosdk:flex-col", children })
|
|
3585
3422
|
] }),
|
|
3586
|
-
/* @__PURE__ */
|
|
3423
|
+
/* @__PURE__ */ jsx37(RadioCircle, { selected })
|
|
3587
3424
|
]
|
|
3588
3425
|
}
|
|
3589
3426
|
) });
|
|
3590
3427
|
}
|
|
3591
3428
|
function RadioCircle({ selected }) {
|
|
3592
|
-
return /* @__PURE__ */
|
|
3429
|
+
return /* @__PURE__ */ jsxs23(
|
|
3593
3430
|
"svg",
|
|
3594
3431
|
{
|
|
3595
3432
|
width: "20",
|
|
@@ -3599,7 +3436,7 @@ function RadioCircle({ selected }) {
|
|
|
3599
3436
|
"aria-hidden": "true",
|
|
3600
3437
|
className: "clcosdk:shrink-0",
|
|
3601
3438
|
children: [
|
|
3602
|
-
/* @__PURE__ */
|
|
3439
|
+
/* @__PURE__ */ jsx37(
|
|
3603
3440
|
"circle",
|
|
3604
3441
|
{
|
|
3605
3442
|
cx: "10",
|
|
@@ -3610,7 +3447,7 @@ function RadioCircle({ selected }) {
|
|
|
3610
3447
|
className: selected ? "clcosdk:text-text-primary" : "clcosdk:text-text-disabled"
|
|
3611
3448
|
}
|
|
3612
3449
|
),
|
|
3613
|
-
selected && /* @__PURE__ */
|
|
3450
|
+
selected && /* @__PURE__ */ jsx37(
|
|
3614
3451
|
"circle",
|
|
3615
3452
|
{
|
|
3616
3453
|
cx: "10",
|
|
@@ -3626,30 +3463,30 @@ function RadioCircle({ selected }) {
|
|
|
3626
3463
|
}
|
|
3627
3464
|
|
|
3628
3465
|
// src/client/components/design-system/MetaRow.tsx
|
|
3629
|
-
import { Children, Fragment as
|
|
3630
|
-
import { jsx as
|
|
3466
|
+
import { Children, Fragment as Fragment5 } from "react";
|
|
3467
|
+
import { jsx as jsx38, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3631
3468
|
function MetaRow({ children }) {
|
|
3632
3469
|
const items = Children.toArray(children).filter(Boolean);
|
|
3633
|
-
return /* @__PURE__ */
|
|
3470
|
+
return /* @__PURE__ */ jsx38("div", { className: "clcosdk:flex clcosdk:min-w-0 clcosdk:items-center clcosdk:gap-1.5", children: items.map((item, index) => (
|
|
3634
3471
|
// biome-ignore lint/suspicious/noArrayIndexKey: positional separators, and the list is caller-authored JSX.
|
|
3635
|
-
/* @__PURE__ */
|
|
3636
|
-
index > 0 && /* @__PURE__ */
|
|
3472
|
+
/* @__PURE__ */ jsxs24(Fragment5, { children: [
|
|
3473
|
+
index > 0 && /* @__PURE__ */ jsx38(MetaDot, {}),
|
|
3637
3474
|
item
|
|
3638
3475
|
] }, index)
|
|
3639
3476
|
)) });
|
|
3640
3477
|
}
|
|
3641
3478
|
function MetaDot() {
|
|
3642
|
-
return /* @__PURE__ */
|
|
3479
|
+
return /* @__PURE__ */ jsx38("span", { className: "clcosdk:h-1 clcosdk:w-1 clcosdk:shrink-0 clcosdk:rounded-full clcosdk:bg-text-disabled" });
|
|
3643
3480
|
}
|
|
3644
3481
|
|
|
3645
3482
|
// src/client/components/checkout/centrifuge/shared/wallet/CentrifugeWalletSelectView.tsx
|
|
3646
|
-
import { jsx as
|
|
3483
|
+
import { jsx as jsx39, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3647
3484
|
var TITLE5 = "1. Choose your wallet";
|
|
3648
3485
|
var DEFAULT_DESCRIPTION = "Choose the wallet that funds this deposit.";
|
|
3649
3486
|
var EMBEDDED_WALLET_LABEL = "CoinList Wallet";
|
|
3650
3487
|
var EXTERNAL_WALLET_LABEL = "External wallet";
|
|
3651
3488
|
function CentrifugeWalletSelectView(props) {
|
|
3652
|
-
return /* @__PURE__ */
|
|
3489
|
+
return /* @__PURE__ */ jsx39(CoinListStyleScope, { children: /* @__PURE__ */ jsx39(CentrifugeWalletSelectViewBody, { ...props }) });
|
|
3653
3490
|
}
|
|
3654
3491
|
function CentrifugeWalletSelectViewBody({
|
|
3655
3492
|
state,
|
|
@@ -3659,7 +3496,7 @@ function CentrifugeWalletSelectViewBody({
|
|
|
3659
3496
|
}) {
|
|
3660
3497
|
switch (state.type) {
|
|
3661
3498
|
case "active":
|
|
3662
|
-
return /* @__PURE__ */
|
|
3499
|
+
return /* @__PURE__ */ jsx39(
|
|
3663
3500
|
ActiveView3,
|
|
3664
3501
|
{
|
|
3665
3502
|
state,
|
|
@@ -3669,7 +3506,7 @@ function CentrifugeWalletSelectViewBody({
|
|
|
3669
3506
|
}
|
|
3670
3507
|
);
|
|
3671
3508
|
case "completed":
|
|
3672
|
-
return /* @__PURE__ */
|
|
3509
|
+
return /* @__PURE__ */ jsx39(
|
|
3673
3510
|
CompletedView2,
|
|
3674
3511
|
{
|
|
3675
3512
|
wallet: state.wallet,
|
|
@@ -3689,18 +3526,18 @@ function ActiveView3({
|
|
|
3689
3526
|
description: description2,
|
|
3690
3527
|
className
|
|
3691
3528
|
}) {
|
|
3692
|
-
return /* @__PURE__ */
|
|
3529
|
+
return /* @__PURE__ */ jsx39(
|
|
3693
3530
|
CheckoutStepCard,
|
|
3694
3531
|
{
|
|
3695
3532
|
state: "active",
|
|
3696
3533
|
title: TITLE5,
|
|
3697
|
-
description: /* @__PURE__ */
|
|
3534
|
+
description: /* @__PURE__ */ jsx39("p", { className: cn(typeClasses.bodySm, "clcosdk:text-text-secondary"), children: description2 }),
|
|
3698
3535
|
className,
|
|
3699
|
-
footer: /* @__PURE__ */
|
|
3536
|
+
footer: /* @__PURE__ */ jsx39(
|
|
3700
3537
|
CheckoutStepFooter,
|
|
3701
3538
|
{
|
|
3702
3539
|
error: state.error,
|
|
3703
|
-
cta: /* @__PURE__ */
|
|
3540
|
+
cta: /* @__PURE__ */ jsx39(
|
|
3704
3541
|
ClButton,
|
|
3705
3542
|
{
|
|
3706
3543
|
variant: "primary",
|
|
@@ -3712,8 +3549,8 @@ function ActiveView3({
|
|
|
3712
3549
|
)
|
|
3713
3550
|
}
|
|
3714
3551
|
),
|
|
3715
|
-
children: /* @__PURE__ */
|
|
3716
|
-
/* @__PURE__ */
|
|
3552
|
+
children: /* @__PURE__ */ jsxs25("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4", children: [
|
|
3553
|
+
/* @__PURE__ */ jsx39(
|
|
3717
3554
|
ExternalWalletRow,
|
|
3718
3555
|
{
|
|
3719
3556
|
wallet: state.externalWallet,
|
|
@@ -3721,7 +3558,7 @@ function ActiveView3({
|
|
|
3721
3558
|
onEvent
|
|
3722
3559
|
}
|
|
3723
3560
|
),
|
|
3724
|
-
state.embeddedWallets.map((wallet) => /* @__PURE__ */
|
|
3561
|
+
state.embeddedWallets.map((wallet) => /* @__PURE__ */ jsx39(
|
|
3725
3562
|
EmbeddedWalletRow,
|
|
3726
3563
|
{
|
|
3727
3564
|
wallet,
|
|
@@ -3739,13 +3576,13 @@ function ExternalWalletRow({
|
|
|
3739
3576
|
onEvent
|
|
3740
3577
|
}) {
|
|
3741
3578
|
if (wallet === null) {
|
|
3742
|
-
return /* @__PURE__ */
|
|
3579
|
+
return /* @__PURE__ */ jsx39(
|
|
3743
3580
|
SelectableOptionRow,
|
|
3744
3581
|
{
|
|
3745
3582
|
selected: false,
|
|
3746
3583
|
onSelect: () => onEvent({ type: "ON_CONNECT_WALLET" }),
|
|
3747
|
-
icon: /* @__PURE__ */
|
|
3748
|
-
children: /* @__PURE__ */
|
|
3584
|
+
icon: /* @__PURE__ */ jsx39(WalletGlyph, {}),
|
|
3585
|
+
children: /* @__PURE__ */ jsx39(
|
|
3749
3586
|
"span",
|
|
3750
3587
|
{
|
|
3751
3588
|
className: cn(
|
|
@@ -3758,14 +3595,14 @@ function ExternalWalletRow({
|
|
|
3758
3595
|
}
|
|
3759
3596
|
);
|
|
3760
3597
|
}
|
|
3761
|
-
return /* @__PURE__ */
|
|
3598
|
+
return /* @__PURE__ */ jsxs25(
|
|
3762
3599
|
SelectableOptionRow,
|
|
3763
3600
|
{
|
|
3764
3601
|
selected: wallet.selected,
|
|
3765
3602
|
onSelect: () => onEvent({ type: "ON_SELECT_WALLET", value: { type: "external" } }),
|
|
3766
|
-
icon: /* @__PURE__ */
|
|
3603
|
+
icon: /* @__PURE__ */ jsx39(WalletGlyph, {}),
|
|
3767
3604
|
children: [
|
|
3768
|
-
/* @__PURE__ */
|
|
3605
|
+
/* @__PURE__ */ jsx39(
|
|
3769
3606
|
"span",
|
|
3770
3607
|
{
|
|
3771
3608
|
className: cn(
|
|
@@ -3775,22 +3612,22 @@ function ExternalWalletRow({
|
|
|
3775
3612
|
children: wallet.address
|
|
3776
3613
|
}
|
|
3777
3614
|
),
|
|
3778
|
-
canDisconnect && /* @__PURE__ */
|
|
3615
|
+
canDisconnect && /* @__PURE__ */ jsx39(
|
|
3779
3616
|
DisconnectControl,
|
|
3780
3617
|
{
|
|
3781
3618
|
onDisconnect: () => onEvent({ type: "ON_DISCONNECT_WALLET" }),
|
|
3782
3619
|
className: "clcosdk:md:hidden"
|
|
3783
3620
|
}
|
|
3784
3621
|
),
|
|
3785
|
-
/* @__PURE__ */
|
|
3786
|
-
/* @__PURE__ */
|
|
3622
|
+
/* @__PURE__ */ jsx39("div", { className: "clcosdk:max-md:hidden", children: /* @__PURE__ */ jsxs25(MetaRow, { children: [
|
|
3623
|
+
/* @__PURE__ */ jsx39(
|
|
3787
3624
|
"span",
|
|
3788
3625
|
{
|
|
3789
3626
|
className: cn(typeClasses.subhead, "clcosdk:text-text-secondary"),
|
|
3790
3627
|
children: wallet.network
|
|
3791
3628
|
}
|
|
3792
3629
|
),
|
|
3793
|
-
canDisconnect && /* @__PURE__ */
|
|
3630
|
+
canDisconnect && /* @__PURE__ */ jsx39(
|
|
3794
3631
|
DisconnectControl,
|
|
3795
3632
|
{
|
|
3796
3633
|
onDisconnect: () => onEvent({ type: "ON_DISCONNECT_WALLET" })
|
|
@@ -3805,7 +3642,7 @@ function EmbeddedWalletRow({
|
|
|
3805
3642
|
wallet,
|
|
3806
3643
|
onEvent
|
|
3807
3644
|
}) {
|
|
3808
|
-
return /* @__PURE__ */
|
|
3645
|
+
return /* @__PURE__ */ jsxs25(
|
|
3809
3646
|
SelectableOptionRow,
|
|
3810
3647
|
{
|
|
3811
3648
|
selected: wallet.selected,
|
|
@@ -3813,9 +3650,9 @@ function EmbeddedWalletRow({
|
|
|
3813
3650
|
type: "ON_SELECT_WALLET",
|
|
3814
3651
|
value: { type: "embedded", address: wallet.walletAddress }
|
|
3815
3652
|
}),
|
|
3816
|
-
icon: /* @__PURE__ */
|
|
3653
|
+
icon: /* @__PURE__ */ jsx39(WalletGlyph, {}),
|
|
3817
3654
|
children: [
|
|
3818
|
-
/* @__PURE__ */
|
|
3655
|
+
/* @__PURE__ */ jsx39(
|
|
3819
3656
|
"span",
|
|
3820
3657
|
{
|
|
3821
3658
|
className: cn(
|
|
@@ -3825,7 +3662,7 @@ function EmbeddedWalletRow({
|
|
|
3825
3662
|
children: EMBEDDED_WALLET_LABEL
|
|
3826
3663
|
}
|
|
3827
3664
|
),
|
|
3828
|
-
/* @__PURE__ */
|
|
3665
|
+
/* @__PURE__ */ jsx39(
|
|
3829
3666
|
"span",
|
|
3830
3667
|
{
|
|
3831
3668
|
className: cn(
|
|
@@ -3835,8 +3672,8 @@ function EmbeddedWalletRow({
|
|
|
3835
3672
|
children: wallet.address
|
|
3836
3673
|
}
|
|
3837
3674
|
),
|
|
3838
|
-
/* @__PURE__ */
|
|
3839
|
-
/* @__PURE__ */
|
|
3675
|
+
/* @__PURE__ */ jsx39("div", { className: "clcosdk:max-md:hidden", children: /* @__PURE__ */ jsxs25(MetaRow, { children: [
|
|
3676
|
+
/* @__PURE__ */ jsx39(
|
|
3840
3677
|
"span",
|
|
3841
3678
|
{
|
|
3842
3679
|
className: cn(
|
|
@@ -3846,7 +3683,7 @@ function EmbeddedWalletRow({
|
|
|
3846
3683
|
children: wallet.address
|
|
3847
3684
|
}
|
|
3848
3685
|
),
|
|
3849
|
-
/* @__PURE__ */
|
|
3686
|
+
/* @__PURE__ */ jsx39(
|
|
3850
3687
|
"span",
|
|
3851
3688
|
{
|
|
3852
3689
|
className: cn(
|
|
@@ -3866,10 +3703,10 @@ function CompletedView2({
|
|
|
3866
3703
|
onEvent,
|
|
3867
3704
|
className
|
|
3868
3705
|
}) {
|
|
3869
|
-
return /* @__PURE__ */
|
|
3706
|
+
return /* @__PURE__ */ jsx39(CheckoutStepCard, { state: "completed", title: TITLE5, className, children: /* @__PURE__ */ jsx39(
|
|
3870
3707
|
CompletedStepSummary,
|
|
3871
3708
|
{
|
|
3872
|
-
icon: /* @__PURE__ */
|
|
3709
|
+
icon: /* @__PURE__ */ jsx39(WalletGlyph, {}),
|
|
3873
3710
|
title: wallet.type === "embedded" ? EMBEDDED_WALLET_LABEL : wallet.address,
|
|
3874
3711
|
subtitle: wallet.type === "embedded" ? wallet.address : null,
|
|
3875
3712
|
editLabel: "Edit",
|
|
@@ -3881,7 +3718,7 @@ function DisconnectControl({
|
|
|
3881
3718
|
onDisconnect,
|
|
3882
3719
|
className
|
|
3883
3720
|
}) {
|
|
3884
|
-
return /* @__PURE__ */
|
|
3721
|
+
return /* @__PURE__ */ jsx39(
|
|
3885
3722
|
"button",
|
|
3886
3723
|
{
|
|
3887
3724
|
type: "button",
|
|
@@ -3900,7 +3737,7 @@ function DisconnectControl({
|
|
|
3900
3737
|
);
|
|
3901
3738
|
}
|
|
3902
3739
|
function WalletGlyph() {
|
|
3903
|
-
return /* @__PURE__ */
|
|
3740
|
+
return /* @__PURE__ */ jsx39("div", { className: "clcosdk:flex clcosdk:size-10 clcosdk:shrink-0 clcosdk:items-center clcosdk:justify-center clcosdk:rounded-xl clcosdk:bg-section", children: /* @__PURE__ */ jsx39(
|
|
3904
3741
|
Wallet,
|
|
3905
3742
|
{
|
|
3906
3743
|
className: "clcosdk:size-5 clcosdk:text-text-primary",
|
|
@@ -3910,7 +3747,7 @@ function WalletGlyph() {
|
|
|
3910
3747
|
}
|
|
3911
3748
|
|
|
3912
3749
|
// src/client/components/checkout/centrifuge/buy/CentrifugeBuyCheckoutView.tsx
|
|
3913
|
-
import { jsx as
|
|
3750
|
+
import { jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3914
3751
|
function CentrifugeBuyCheckoutView({
|
|
3915
3752
|
state,
|
|
3916
3753
|
onEvent,
|
|
@@ -3918,10 +3755,10 @@ function CentrifugeBuyCheckoutView({
|
|
|
3918
3755
|
}) {
|
|
3919
3756
|
switch (state.type) {
|
|
3920
3757
|
case "error":
|
|
3921
|
-
return /* @__PURE__ */
|
|
3758
|
+
return /* @__PURE__ */ jsx40(CentrifugeCheckoutError, { reason: state.reason, className });
|
|
3922
3759
|
case "content":
|
|
3923
|
-
return /* @__PURE__ */
|
|
3924
|
-
/* @__PURE__ */
|
|
3760
|
+
return /* @__PURE__ */ jsxs26(CoinListStyleScope, { children: [
|
|
3761
|
+
/* @__PURE__ */ jsxs26(
|
|
3925
3762
|
"div",
|
|
3926
3763
|
{
|
|
3927
3764
|
className: cn(
|
|
@@ -3930,22 +3767,22 @@ function CentrifugeBuyCheckoutView({
|
|
|
3930
3767
|
className
|
|
3931
3768
|
),
|
|
3932
3769
|
children: [
|
|
3933
|
-
/* @__PURE__ */
|
|
3934
|
-
/* @__PURE__ */
|
|
3770
|
+
/* @__PURE__ */ jsxs26("div", { className: "clcosdk:order-2 clcosdk:flex clcosdk:min-w-0 clcosdk:flex-col clcosdk:gap-4 clcosdk:md:order-1", children: [
|
|
3771
|
+
/* @__PURE__ */ jsx40(
|
|
3935
3772
|
CentrifugeWalletSelectView,
|
|
3936
3773
|
{
|
|
3937
3774
|
state: state.wallet,
|
|
3938
3775
|
onEvent
|
|
3939
3776
|
}
|
|
3940
3777
|
),
|
|
3941
|
-
/* @__PURE__ */
|
|
3942
|
-
/* @__PURE__ */
|
|
3778
|
+
/* @__PURE__ */ jsx40(CentrifugeBuyAmountView, { state: state.amount, onEvent }),
|
|
3779
|
+
/* @__PURE__ */ jsx40(CentrifugeBuyReviewView, { state: state.review, onEvent })
|
|
3943
3780
|
] }),
|
|
3944
|
-
/* @__PURE__ */
|
|
3781
|
+
/* @__PURE__ */ jsx40("aside", { className: "clcosdk:order-1 clcosdk:min-w-0 clcosdk:md:order-2", children: /* @__PURE__ */ jsx40(CentrifugeSidebarView, { state: state.sidebar }) })
|
|
3945
3782
|
]
|
|
3946
3783
|
}
|
|
3947
3784
|
),
|
|
3948
|
-
/* @__PURE__ */
|
|
3785
|
+
/* @__PURE__ */ jsx40(
|
|
3949
3786
|
CentrifugeBuyOrderPlaced,
|
|
3950
3787
|
{
|
|
3951
3788
|
state: state.orderPlaced,
|
|
@@ -3961,7 +3798,7 @@ function CentrifugeBuyCheckoutView({
|
|
|
3961
3798
|
}
|
|
3962
3799
|
|
|
3963
3800
|
// src/client/hooks/checkout/centrifuge/buy/useCentrifugeBuyCheckoutViewModel.ts
|
|
3964
|
-
import { useState as
|
|
3801
|
+
import { useState as useState9 } from "react";
|
|
3965
3802
|
|
|
3966
3803
|
// src/client/hooks/checkout/centrifuge/buy/amount/useCentrifugeBuyAmountViewModel.ts
|
|
3967
3804
|
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
@@ -4195,8 +4032,7 @@ function useCentrifugeBuyAmountViewModel({
|
|
|
4195
4032
|
const networkName = getNetworkName(chain);
|
|
4196
4033
|
const decimals = TOKEN_REGISTRY.erc20(INPUT_ASSET).decimals;
|
|
4197
4034
|
const parsed = parseBlockchainAmount(amountInput, decimals);
|
|
4198
|
-
const minimum = stepInput.type === "active" ? stepInput.
|
|
4199
|
-
const awaitingMinimum = stepInput.type === "active" && stepInput.awaitingMinimum;
|
|
4035
|
+
const minimum = stepInput.type === "active" ? minimumAmount(stepInput.minimumPurchaseUsd, decimals) : null;
|
|
4200
4036
|
const belowMinimum = minimum !== null && parsed.valid && parsed.amount.raw > 0n && parsed.amount.raw < minimum.raw ? minimumMessage(minimum, locale) : null;
|
|
4201
4037
|
const { balances, isLoading: balancesLoading } = useErc20TokenBalances({
|
|
4202
4038
|
address: stepInput.type === "incomplete" ? NO_WALLET : stepInput.wallet.address,
|
|
@@ -4254,12 +4090,12 @@ function useCentrifugeBuyAmountViewModel({
|
|
|
4254
4090
|
}
|
|
4255
4091
|
};
|
|
4256
4092
|
const confirmCta = (depositBlockedMessage) => {
|
|
4257
|
-
const blocked = depositBlockedMessage !== null || belowMinimum !== null ||
|
|
4093
|
+
const blocked = depositBlockedMessage !== null || belowMinimum !== null || balancesLoading || amountInput.trim() === "";
|
|
4258
4094
|
return blocked ? { type: "disabled" } : { type: "enabled" };
|
|
4259
4095
|
};
|
|
4260
4096
|
const confirmAmount = () => {
|
|
4261
4097
|
if (!enabled) return;
|
|
4262
|
-
if (stepInput.type !== "active"
|
|
4098
|
+
if (stepInput.type !== "active") return;
|
|
4263
4099
|
if (stepInput.depositBlockedMessage !== null) return;
|
|
4264
4100
|
const validated = validateCentrifugeBuyAmount({
|
|
4265
4101
|
input: amountInput,
|
|
@@ -4330,6 +4166,11 @@ function validateCentrifugeBuyAmount({
|
|
|
4330
4166
|
}
|
|
4331
4167
|
return { valid: true, amount: parsed.amount };
|
|
4332
4168
|
}
|
|
4169
|
+
function minimumAmount(minimumPurchaseUsd, decimals) {
|
|
4170
|
+
if (minimumPurchaseUsd === null) return null;
|
|
4171
|
+
const parsed = parseBlockchainAmount(String(minimumPurchaseUsd), decimals);
|
|
4172
|
+
return parsed.valid ? parsed.amount : null;
|
|
4173
|
+
}
|
|
4333
4174
|
function minimumMessage(minimum, locale) {
|
|
4334
4175
|
return `The minimum investment is ${assetAmount(
|
|
4335
4176
|
formatAmount(minimum, locale),
|
|
@@ -4339,15 +4180,11 @@ function minimumMessage(minimum, locale) {
|
|
|
4339
4180
|
|
|
4340
4181
|
// src/client/hooks/checkout/centrifuge/buy/review/useCentrifugeBuyReviewViewModel.ts
|
|
4341
4182
|
import { useEffect as useEffect5, useRef as useRef3, useState as useState5 } from "react";
|
|
4342
|
-
var SETTLES_LATER = "Settles later, at the price the fund sets then.";
|
|
4343
4183
|
function useCentrifugeBuyReviewViewModel({
|
|
4344
4184
|
stepInput,
|
|
4345
4185
|
symbol,
|
|
4346
4186
|
chain,
|
|
4347
4187
|
vaultContracts,
|
|
4348
|
-
quoteState,
|
|
4349
|
-
onRefreshQuote,
|
|
4350
|
-
indicativePrice = null,
|
|
4351
4188
|
enabled = true,
|
|
4352
4189
|
onComplete
|
|
4353
4190
|
}) {
|
|
@@ -4362,11 +4199,8 @@ function useCentrifugeBuyReviewViewModel({
|
|
|
4362
4199
|
setFailure(null);
|
|
4363
4200
|
}
|
|
4364
4201
|
}, [stepInput.type]);
|
|
4365
|
-
const quote = stepInput.type === "active" ? quoteForAmount(quoteState, stepInput.amount) : null;
|
|
4366
4202
|
const uiState = () => {
|
|
4367
4203
|
if (stepInput.type !== "active") return { type: "incomplete" };
|
|
4368
|
-
if (quoteState.type === "ERROR") return { type: "error" };
|
|
4369
|
-
if (quote === null) return { type: "loading" };
|
|
4370
4204
|
const funding = TOKEN_REGISTRY.erc20(stepInput.inputAsset);
|
|
4371
4205
|
const invested = assetAmount(
|
|
4372
4206
|
formatAmount(stepInput.amount, locale),
|
|
@@ -4379,10 +4213,6 @@ function useCentrifugeBuyReviewViewModel({
|
|
|
4379
4213
|
iconUrl: stablecoinIconUrl(stepInput.inputAsset)
|
|
4380
4214
|
}),
|
|
4381
4215
|
investAmount: invested,
|
|
4382
|
-
approximateAmount: assetAmount(
|
|
4383
|
-
formatShareAmount(quote.estimatedShares, locale),
|
|
4384
|
-
symbol
|
|
4385
|
-
),
|
|
4386
4216
|
recipientAddress: shortenAddress(stepInput.wallet.address),
|
|
4387
4217
|
// This product charges none, so the fee row is a formatted zero in the funding token.
|
|
4388
4218
|
coinlistFee: assetAmount(
|
|
@@ -4393,7 +4223,6 @@ function useCentrifugeBuyReviewViewModel({
|
|
|
4393
4223
|
funding.symbol
|
|
4394
4224
|
),
|
|
4395
4225
|
total: invested,
|
|
4396
|
-
isRefreshing: quoteState.type === "CONTENT" && quoteState.isRefreshing,
|
|
4397
4226
|
placeRequestCta: placeRequestCta(
|
|
4398
4227
|
phase,
|
|
4399
4228
|
stepInput.depositBlockedMessage,
|
|
@@ -4404,9 +4233,7 @@ function useCentrifugeBuyReviewViewModel({
|
|
|
4404
4233
|
};
|
|
4405
4234
|
const placeRequest = async () => {
|
|
4406
4235
|
if (!enabled) return;
|
|
4407
|
-
if (stepInput.type !== "active" || phase !== null
|
|
4408
|
-
return;
|
|
4409
|
-
}
|
|
4236
|
+
if (stepInput.type !== "active" || phase !== null) return;
|
|
4410
4237
|
if (stepInput.depositBlockedMessage !== null) return;
|
|
4411
4238
|
if (failure?.type === "unconfirmed") return;
|
|
4412
4239
|
setFailure(null);
|
|
@@ -4458,37 +4285,19 @@ function useCentrifugeBuyReviewViewModel({
|
|
|
4458
4285
|
onComplete({
|
|
4459
4286
|
wallet: stepInput.wallet,
|
|
4460
4287
|
amount: stepInput.amount,
|
|
4461
|
-
indicativePrice,
|
|
4462
4288
|
transaction: placed.transaction,
|
|
4463
4289
|
txHash: placed.txHash
|
|
4464
4290
|
});
|
|
4465
4291
|
};
|
|
4466
4292
|
const onEvent = (event) => {
|
|
4467
4293
|
switch (event.type) {
|
|
4468
|
-
case "ON_REFRESH_ESTIMATE":
|
|
4469
|
-
case "ON_RETRY":
|
|
4470
|
-
if (!enabled) return;
|
|
4471
|
-
setFailure(
|
|
4472
|
-
(current) => current?.type === "unconfirmed" ? current : null
|
|
4473
|
-
);
|
|
4474
|
-
onRefreshQuote();
|
|
4475
|
-
return;
|
|
4476
4294
|
case "ON_PLACE_REQUEST":
|
|
4477
4295
|
void placeRequest();
|
|
4478
4296
|
return;
|
|
4479
|
-
default: {
|
|
4480
|
-
const exhaustive = event;
|
|
4481
|
-
return exhaustive;
|
|
4482
|
-
}
|
|
4483
4297
|
}
|
|
4484
4298
|
};
|
|
4485
4299
|
return { state: uiState(), onEvent };
|
|
4486
4300
|
}
|
|
4487
|
-
function quoteForAmount(state, amount) {
|
|
4488
|
-
if (state.type !== "CONTENT") return null;
|
|
4489
|
-
if (state.quote.spendInputAmount.raw !== amount.raw) return null;
|
|
4490
|
-
return state.quote;
|
|
4491
|
-
}
|
|
4492
4301
|
function placeRequestCta(phase, depositBlockedMessage, failure) {
|
|
4493
4302
|
if (phase !== null) return { type: "loading", message: phaseMessage(phase) };
|
|
4494
4303
|
return depositBlockedMessage !== null || failure?.type === "unconfirmed" ? { type: "disabled" } : { type: "enabled" };
|
|
@@ -4619,145 +4428,24 @@ function centrifugeVaultOrderReasonMessage(reason) {
|
|
|
4619
4428
|
}
|
|
4620
4429
|
function primaryCentrifugeVaultOrderReason(reasons) {
|
|
4621
4430
|
if (reasons.length === 0) return null;
|
|
4622
|
-
return reasons.reduce(
|
|
4623
|
-
(best, reason) => ORDER_REASON_SEVERITY[reason] < ORDER_REASON_SEVERITY[best] ? reason : best
|
|
4624
|
-
);
|
|
4625
|
-
}
|
|
4626
|
-
function centrifugeVaultOrderingMessage(orderability) {
|
|
4627
|
-
if (orderability.type === "orderable") return null;
|
|
4628
|
-
const reason = primaryCentrifugeVaultOrderReason(orderability.reasons);
|
|
4629
|
-
return reason === null ? null : centrifugeVaultOrderReasonMessage(reason);
|
|
4630
|
-
}
|
|
4631
|
-
|
|
4632
|
-
// src/client/hooks/checkout/centrifuge/shared/data/useCentrifugeQuote.ts
|
|
4633
|
-
import { useEffect as useEffect6, useRef as useRef4, useState as useState6 } from "react";
|
|
4634
|
-
|
|
4635
|
-
// src/client/hooks/shared/centrifuge/centrifuge-load-error.ts
|
|
4636
|
-
function centrifugeLoadErrorReason(error) {
|
|
4637
|
-
return error instanceof NotAuthenticatedError ? "not-authenticated" : "generic-error";
|
|
4638
|
-
}
|
|
4639
|
-
|
|
4640
|
-
// src/client/hooks/checkout/centrifuge/shared/data/useCentrifugeQuote.ts
|
|
4641
|
-
var LOADING = { type: "LOADING" };
|
|
4642
|
-
function useCentrifugeQuote(options) {
|
|
4643
|
-
const {
|
|
4644
|
-
symbol,
|
|
4645
|
-
chain,
|
|
4646
|
-
amount,
|
|
4647
|
-
pollIntervalMs = CENTRIFUGE_POLL_INTERVAL_MS,
|
|
4648
|
-
data,
|
|
4649
|
-
enabled,
|
|
4650
|
-
reloadKey = 0
|
|
4651
|
-
} = options;
|
|
4652
|
-
const { coinlist, isReady } = useCoinList();
|
|
4653
|
-
const log = useLogger("useCentrifugeQuote");
|
|
4654
|
-
const [state, setState] = useState6(
|
|
4655
|
-
() => data === void 0 ? LOADING : { type: "CONTENT", quote: data, isRefreshing: false }
|
|
4656
|
-
);
|
|
4657
|
-
const fetchIdRef = useRef4(0);
|
|
4658
|
-
const isFetchingRef = useRef4(false);
|
|
4659
|
-
const hasQuoteRef = useRef4(data !== void 0);
|
|
4660
|
-
useEffect6(() => {
|
|
4661
|
-
if (!isReady || !enabled) return;
|
|
4662
|
-
void reloadKey;
|
|
4663
|
-
const currentFetchId = ++fetchIdRef.current;
|
|
4664
|
-
isFetchingRef.current = false;
|
|
4665
|
-
const load = async () => {
|
|
4666
|
-
if (isFetchingRef.current) return;
|
|
4667
|
-
isFetchingRef.current = true;
|
|
4668
|
-
setState(
|
|
4669
|
-
(previous) => previous.type === "CONTENT" ? { ...previous, isRefreshing: true } : previous
|
|
4670
|
-
);
|
|
4671
|
-
try {
|
|
4672
|
-
const quote = await coinlist.centrifuge.getQuote({
|
|
4673
|
-
symbol,
|
|
4674
|
-
chain,
|
|
4675
|
-
// Rebuilt from primitives the effect depends on, so an inline
|
|
4676
|
-
// `amount` from the checkout viewmodel does not restart the poll.
|
|
4677
|
-
amount: BlockchainAmount({
|
|
4678
|
-
raw: amount.raw,
|
|
4679
|
-
decimals: amount.decimals
|
|
4680
|
-
})
|
|
4681
|
-
});
|
|
4682
|
-
if (currentFetchId !== fetchIdRef.current) return;
|
|
4683
|
-
log.debug(() => ({
|
|
4684
|
-
msg: "settled",
|
|
4685
|
-
fields: { state: "CONTENT" }
|
|
4686
|
-
}));
|
|
4687
|
-
hasQuoteRef.current = true;
|
|
4688
|
-
setState({ type: "CONTENT", quote, isRefreshing: false });
|
|
4689
|
-
} catch (error) {
|
|
4690
|
-
if (currentFetchId !== fetchIdRef.current) return;
|
|
4691
|
-
const reason = centrifugeLoadErrorReason(error);
|
|
4692
|
-
if (hasQuoteRef.current) {
|
|
4693
|
-
log.warning(
|
|
4694
|
-
() => ({
|
|
4695
|
-
msg: "poll failed; keeping the last quote",
|
|
4696
|
-
fields: { reason }
|
|
4697
|
-
}),
|
|
4698
|
-
error
|
|
4699
|
-
);
|
|
4700
|
-
} else {
|
|
4701
|
-
log.failure(
|
|
4702
|
-
() => ({ msg: "settled", fields: { state: "ERROR", reason } }),
|
|
4703
|
-
error
|
|
4704
|
-
);
|
|
4705
|
-
}
|
|
4706
|
-
setState(
|
|
4707
|
-
(previous) => previous.type === "CONTENT" ? { ...previous, isRefreshing: false } : { type: "ERROR", reason }
|
|
4708
|
-
);
|
|
4709
|
-
} finally {
|
|
4710
|
-
if (currentFetchId === fetchIdRef.current) {
|
|
4711
|
-
isFetchingRef.current = false;
|
|
4712
|
-
}
|
|
4713
|
-
}
|
|
4714
|
-
};
|
|
4715
|
-
load();
|
|
4716
|
-
const interval = setInterval(load, pollIntervalMs);
|
|
4717
|
-
return () => {
|
|
4718
|
-
clearInterval(interval);
|
|
4719
|
-
++fetchIdRef.current;
|
|
4720
|
-
};
|
|
4721
|
-
}, [
|
|
4722
|
-
coinlist,
|
|
4723
|
-
isReady,
|
|
4724
|
-
enabled,
|
|
4725
|
-
symbol,
|
|
4726
|
-
chain,
|
|
4727
|
-
amount.raw,
|
|
4728
|
-
amount.decimals,
|
|
4729
|
-
pollIntervalMs,
|
|
4730
|
-
reloadKey,
|
|
4731
|
-
log
|
|
4732
|
-
]);
|
|
4733
|
-
return { state };
|
|
4734
|
-
}
|
|
4735
|
-
|
|
4736
|
-
// src/client/hooks/checkout/centrifuge/shared/indicative-price.ts
|
|
4737
|
-
var USD_FRACTION_DIGITS = 2;
|
|
4738
|
-
function formatIndicativeUsd(price, locale) {
|
|
4739
|
-
if (price === null || !/^\d+(\.\d+)?$/.test(price)) {
|
|
4740
|
-
return NA_AMOUNT_ASSET_UI;
|
|
4741
|
-
}
|
|
4742
|
-
return FormattedAmountAssetUi(
|
|
4743
|
-
new Intl.NumberFormat(locale, {
|
|
4744
|
-
style: "currency",
|
|
4745
|
-
currency: "USD",
|
|
4746
|
-
minimumFractionDigits: USD_FRACTION_DIGITS,
|
|
4747
|
-
maximumFractionDigits: USD_FRACTION_DIGITS
|
|
4748
|
-
}).format(Number(price))
|
|
4431
|
+
return reasons.reduce(
|
|
4432
|
+
(best, reason) => ORDER_REASON_SEVERITY[reason] < ORDER_REASON_SEVERITY[best] ? reason : best
|
|
4749
4433
|
);
|
|
4750
4434
|
}
|
|
4435
|
+
function centrifugeVaultOrderingMessage(orderability) {
|
|
4436
|
+
if (orderability.type === "orderable") return null;
|
|
4437
|
+
const reason = primaryCentrifugeVaultOrderReason(orderability.reasons);
|
|
4438
|
+
return reason === null ? null : centrifugeVaultOrderReasonMessage(reason);
|
|
4439
|
+
}
|
|
4751
4440
|
|
|
4752
4441
|
// src/client/hooks/checkout/centrifuge/shared/sidebar/useCentrifugeSidebarViewModel.ts
|
|
4753
|
-
var
|
|
4442
|
+
var USD_FRACTION_DIGITS = AssetDecimals(2);
|
|
4754
4443
|
var WHOLE_DOLLAR_DIGITS = AssetDecimals(0);
|
|
4755
4444
|
function useCentrifugeSidebarViewModel({
|
|
4756
4445
|
offer,
|
|
4757
4446
|
symbol,
|
|
4758
4447
|
chain,
|
|
4759
4448
|
tokenMetadata,
|
|
4760
|
-
quoteState,
|
|
4761
4449
|
underlyingFund,
|
|
4762
4450
|
apy
|
|
4763
4451
|
}) {
|
|
@@ -4772,44 +4460,36 @@ function useCentrifugeSidebarViewModel({
|
|
|
4772
4460
|
ticker: symbol,
|
|
4773
4461
|
underlyingFund,
|
|
4774
4462
|
assetType: offer.instrumentType,
|
|
4775
|
-
minimumInvestment: toMinimumUi(
|
|
4463
|
+
minimumInvestment: toMinimumUi(
|
|
4464
|
+
offer.options[0]?.minimumPurchaseUsd ?? null,
|
|
4465
|
+
locale
|
|
4466
|
+
),
|
|
4776
4467
|
networkName,
|
|
4777
4468
|
issuer: offer.issuer,
|
|
4778
4469
|
apy: apy === null ? null : FormattedPercentUi(apy)
|
|
4779
4470
|
};
|
|
4780
4471
|
return { state };
|
|
4781
4472
|
}
|
|
4782
|
-
function toMinimumUi(
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
type: "known",
|
|
4791
|
-
amount: formatMinimumUsd(
|
|
4792
|
-
quoteState.quote.minimumInputAmount,
|
|
4793
|
-
locale
|
|
4794
|
-
)
|
|
4795
|
-
};
|
|
4796
|
-
default: {
|
|
4797
|
-
const exhaustive = quoteState;
|
|
4798
|
-
return exhaustive;
|
|
4799
|
-
}
|
|
4800
|
-
}
|
|
4473
|
+
function toMinimumUi(minimumPurchaseUsd, locale) {
|
|
4474
|
+
if (minimumPurchaseUsd === null) return { type: "none" };
|
|
4475
|
+
const parsed = parseBlockchainAmount(
|
|
4476
|
+
String(minimumPurchaseUsd),
|
|
4477
|
+
STABLE_DECIMALS
|
|
4478
|
+
);
|
|
4479
|
+
if (!parsed.valid) return { type: "none" };
|
|
4480
|
+
return { type: "known", amount: formatMinimumUsd(parsed.amount, locale) };
|
|
4801
4481
|
}
|
|
4802
4482
|
function formatMinimumUsd(amount, locale) {
|
|
4803
4483
|
return usdAmount(
|
|
4804
4484
|
formatAmount(amount, locale, {
|
|
4805
|
-
maxFractionDigits:
|
|
4485
|
+
maxFractionDigits: USD_FRACTION_DIGITS,
|
|
4806
4486
|
minFractionDigits: WHOLE_DOLLAR_DIGITS
|
|
4807
4487
|
})
|
|
4808
4488
|
);
|
|
4809
4489
|
}
|
|
4810
4490
|
|
|
4811
4491
|
// src/client/hooks/checkout/centrifuge/shared/wallet/useCentrifugeWalletSelectViewModel.ts
|
|
4812
|
-
import { useState as
|
|
4492
|
+
import { useState as useState6 } from "react";
|
|
4813
4493
|
var CONNECT_FAILED = "Could not connect that wallet. Please try again.";
|
|
4814
4494
|
function useCentrifugeWalletSelectViewModel({
|
|
4815
4495
|
stepInput,
|
|
@@ -4819,8 +4499,8 @@ function useCentrifugeWalletSelectViewModel({
|
|
|
4819
4499
|
onEdit
|
|
4820
4500
|
}) {
|
|
4821
4501
|
const log = useLogger("useCentrifugeWalletSelectViewModel");
|
|
4822
|
-
const [selected, setSelected] =
|
|
4823
|
-
const [error, setError] =
|
|
4502
|
+
const [selected, setSelected] = useState6(null);
|
|
4503
|
+
const [error, setError] = useState6(null);
|
|
4824
4504
|
const networkName = getNetworkName(chain);
|
|
4825
4505
|
const selectedWallet = resolveWallet(wallets, selected);
|
|
4826
4506
|
const uiState = () => {
|
|
@@ -4950,21 +4630,21 @@ function toConfirmedWalletUi(wallets, wallet) {
|
|
|
4950
4630
|
}
|
|
4951
4631
|
|
|
4952
4632
|
// src/client/hooks/shared/useTokenMetadata.ts
|
|
4953
|
-
import { useCallback as useCallback2, useEffect as
|
|
4633
|
+
import { useCallback as useCallback2, useEffect as useEffect6, useState as useState7 } from "react";
|
|
4954
4634
|
var DISABLED_STATE = { type: "DISABLED" };
|
|
4955
4635
|
var LOADING_STATE = { type: "LOADING" };
|
|
4956
4636
|
function useTokenMetadata(options) {
|
|
4957
4637
|
const { chain, address, data, enabled = true } = options;
|
|
4958
4638
|
const { coinlist, isReady } = useCoinList();
|
|
4959
4639
|
const log = useLogger("useTokenMetadata");
|
|
4960
|
-
const [state, setState] =
|
|
4640
|
+
const [state, setState] = useState7(
|
|
4961
4641
|
() => data !== void 0 ? { type: "CONTENT", tokenMetadata: data } : LOADING_STATE
|
|
4962
4642
|
);
|
|
4963
|
-
const [refetchCount, setRefetchCount] =
|
|
4643
|
+
const [refetchCount, setRefetchCount] = useState7(0);
|
|
4964
4644
|
const refetch = useCallback2(() => {
|
|
4965
4645
|
setRefetchCount((count) => count + 1);
|
|
4966
4646
|
}, []);
|
|
4967
|
-
|
|
4647
|
+
useEffect6(() => {
|
|
4968
4648
|
let isCancelled = false;
|
|
4969
4649
|
const seedActive = data !== void 0 && refetchCount === 0;
|
|
4970
4650
|
if (!isReady || !enabled || seedActive) {
|
|
@@ -5044,8 +4724,15 @@ function useCheckoutOfferTokenMetadata({
|
|
|
5044
4724
|
}
|
|
5045
4725
|
|
|
5046
4726
|
// src/client/hooks/shared/centrifuge/useCentrifugeVaultStatuses.ts
|
|
5047
|
-
import { useEffect as
|
|
5048
|
-
|
|
4727
|
+
import { useEffect as useEffect7, useMemo as useMemo4, useRef as useRef4, useState as useState8 } from "react";
|
|
4728
|
+
|
|
4729
|
+
// src/client/hooks/shared/centrifuge/centrifuge-load-error.ts
|
|
4730
|
+
function centrifugeLoadErrorReason(error) {
|
|
4731
|
+
return error instanceof NotAuthenticatedError ? "not-authenticated" : "generic-error";
|
|
4732
|
+
}
|
|
4733
|
+
|
|
4734
|
+
// src/client/hooks/shared/centrifuge/useCentrifugeVaultStatuses.ts
|
|
4735
|
+
var LOADING = { type: "LOADING" };
|
|
5049
4736
|
function useCentrifugeVaultStatuses(options) {
|
|
5050
4737
|
const {
|
|
5051
4738
|
vaults,
|
|
@@ -5057,7 +4744,7 @@ function useCentrifugeVaultStatuses(options) {
|
|
|
5057
4744
|
const log = useLogger("useCentrifugeVaultStatus");
|
|
5058
4745
|
const key = vaults.map(vaultKey).join("|");
|
|
5059
4746
|
const stableVaults = useMemo4(() => vaults, [key]);
|
|
5060
|
-
const [states, setStates] =
|
|
4747
|
+
const [states, setStates] = useState8(
|
|
5061
4748
|
() => Object.fromEntries(
|
|
5062
4749
|
(data ?? []).map((status) => [
|
|
5063
4750
|
vaultKey(status),
|
|
@@ -5065,10 +4752,10 @@ function useCentrifugeVaultStatuses(options) {
|
|
|
5065
4752
|
])
|
|
5066
4753
|
)
|
|
5067
4754
|
);
|
|
5068
|
-
const fetchIdRef =
|
|
5069
|
-
const inFlightRef =
|
|
5070
|
-
const heldRef =
|
|
5071
|
-
|
|
4755
|
+
const fetchIdRef = useRef4(0);
|
|
4756
|
+
const inFlightRef = useRef4(/* @__PURE__ */ new Set());
|
|
4757
|
+
const heldRef = useRef4(new Set((data ?? []).map(vaultKey)));
|
|
4758
|
+
useEffect7(() => {
|
|
5072
4759
|
if (!isReady || !enabled) return;
|
|
5073
4760
|
const currentFetchId = ++fetchIdRef.current;
|
|
5074
4761
|
inFlightRef.current = /* @__PURE__ */ new Set();
|
|
@@ -5128,7 +4815,7 @@ function useCentrifugeVaultStatuses(options) {
|
|
|
5128
4815
|
return {
|
|
5129
4816
|
statuses: stableVaults.map((vault) => ({
|
|
5130
4817
|
vault,
|
|
5131
|
-
state: states[vaultKey(vault)] ??
|
|
4818
|
+
state: states[vaultKey(vault)] ?? LOADING
|
|
5132
4819
|
}))
|
|
5133
4820
|
};
|
|
5134
4821
|
}
|
|
@@ -5160,11 +4847,10 @@ function useCentrifugeBuyCheckoutViewModel({
|
|
|
5160
4847
|
apy
|
|
5161
4848
|
}) {
|
|
5162
4849
|
const locale = useLocale();
|
|
5163
|
-
const [step, setStep] =
|
|
5164
|
-
const [orderPlaced, setOrderPlaced] =
|
|
4850
|
+
const [step, setStep] = useState9({ type: "wallet" });
|
|
4851
|
+
const [orderPlaced, setOrderPlaced] = useState9(
|
|
5165
4852
|
null
|
|
5166
4853
|
);
|
|
5167
|
-
const [quoteReloadKey, setQuoteReloadKey] = useState10(0);
|
|
5168
4854
|
const depositableHere = vaultProxy(offer.vaultContracts, chain) !== null;
|
|
5169
4855
|
const live = enabled && depositableHere;
|
|
5170
4856
|
const { state: statusState } = useCentrifugeVaultStatus({
|
|
@@ -5174,20 +4860,12 @@ function useCentrifugeBuyCheckoutViewModel({
|
|
|
5174
4860
|
});
|
|
5175
4861
|
const depositBlockedMessage = statusState.type === "CONTENT" ? centrifugeVaultOrderingMessage(statusState.status.orderability) : null;
|
|
5176
4862
|
const notOrderable = depositBlockedMessage !== null;
|
|
5177
|
-
const { state: quoteState } = useCentrifugeQuote({
|
|
5178
|
-
symbol,
|
|
5179
|
-
chain,
|
|
5180
|
-
amount: sidebarAmount(step),
|
|
5181
|
-
enabled: live && !notOrderable,
|
|
5182
|
-
reloadKey: quoteReloadKey
|
|
5183
|
-
});
|
|
5184
4863
|
const { state: outputTokenMetadataState } = useCheckoutOfferTokenMetadata({
|
|
5185
4864
|
offer,
|
|
5186
4865
|
chain,
|
|
5187
4866
|
enabled: live
|
|
5188
4867
|
});
|
|
5189
4868
|
const outputTokenMetadata = tokenMetadataOf(outputTokenMetadataState);
|
|
5190
|
-
const indicativePrice = indicativePriceOf(quoteState, sidebarAmount(step));
|
|
5191
4869
|
const atEntry = step.type === "wallet" && orderPlaced === null;
|
|
5192
4870
|
const errorReason = CentrifugeCheckoutErrorReason.of({
|
|
5193
4871
|
depositableHere,
|
|
@@ -5202,7 +4880,7 @@ function useCentrifugeBuyCheckoutViewModel({
|
|
|
5202
4880
|
onEdit: () => setStep({ type: "wallet" })
|
|
5203
4881
|
});
|
|
5204
4882
|
const amount = useCentrifugeBuyAmountViewModel({
|
|
5205
|
-
stepInput: amountStepInput(step, depositBlockedMessage,
|
|
4883
|
+
stepInput: amountStepInput(step, depositBlockedMessage, offer),
|
|
5206
4884
|
chain,
|
|
5207
4885
|
enabled: live,
|
|
5208
4886
|
onComplete: (confirmed) => setStep(
|
|
@@ -5224,15 +4902,11 @@ function useCentrifugeBuyCheckoutViewModel({
|
|
|
5224
4902
|
symbol,
|
|
5225
4903
|
chain,
|
|
5226
4904
|
vaultContracts: offer.vaultContracts,
|
|
5227
|
-
quoteState,
|
|
5228
|
-
onRefreshQuote: () => setQuoteReloadKey((key) => key + 1),
|
|
5229
|
-
indicativePrice,
|
|
5230
4905
|
enabled: live,
|
|
5231
4906
|
onComplete: (order) => {
|
|
5232
|
-
|
|
5233
|
-
setOrderPlaced(placed);
|
|
4907
|
+
setOrderPlaced(order);
|
|
5234
4908
|
setStep({ type: "wallet" });
|
|
5235
|
-
onOrderPlaced?.(
|
|
4909
|
+
onOrderPlaced?.(order);
|
|
5236
4910
|
}
|
|
5237
4911
|
});
|
|
5238
4912
|
const sidebar = useCentrifugeSidebarViewModel({
|
|
@@ -5240,7 +4914,6 @@ function useCentrifugeBuyCheckoutViewModel({
|
|
|
5240
4914
|
symbol,
|
|
5241
4915
|
chain,
|
|
5242
4916
|
tokenMetadata: outputTokenMetadata,
|
|
5243
|
-
quoteState,
|
|
5244
4917
|
underlyingFund,
|
|
5245
4918
|
apy
|
|
5246
4919
|
});
|
|
@@ -5271,8 +4944,6 @@ function useCentrifugeBuyCheckoutViewModel({
|
|
|
5271
4944
|
case "ON_EDIT_AMOUNT":
|
|
5272
4945
|
amount.onEvent(event);
|
|
5273
4946
|
return;
|
|
5274
|
-
case "ON_REFRESH_ESTIMATE":
|
|
5275
|
-
case "ON_RETRY":
|
|
5276
4947
|
case "ON_PLACE_REQUEST":
|
|
5277
4948
|
review.onEvent(event);
|
|
5278
4949
|
return;
|
|
@@ -5287,15 +4958,6 @@ function useCentrifugeBuyCheckoutViewModel({
|
|
|
5287
4958
|
};
|
|
5288
4959
|
return { state: uiState(), onEvent };
|
|
5289
4960
|
}
|
|
5290
|
-
function sidebarAmount(step) {
|
|
5291
|
-
if (step.type === "review") return step.amount;
|
|
5292
|
-
return CENTRIFUGE_INDICATIVE_QUOTE_AMOUNT;
|
|
5293
|
-
}
|
|
5294
|
-
function indicativePriceOf(quoteState, amount) {
|
|
5295
|
-
if (quoteState.type !== "CONTENT") return null;
|
|
5296
|
-
if (quoteState.quote.spendInputAmount.raw !== amount.raw) return null;
|
|
5297
|
-
return quoteState.quote.indicativePrice;
|
|
5298
|
-
}
|
|
5299
4961
|
function walletStepInput(step) {
|
|
5300
4962
|
switch (step.type) {
|
|
5301
4963
|
case "wallet":
|
|
@@ -5309,7 +4971,7 @@ function walletStepInput(step) {
|
|
|
5309
4971
|
}
|
|
5310
4972
|
}
|
|
5311
4973
|
}
|
|
5312
|
-
function amountStepInput(step, depositBlockedMessage,
|
|
4974
|
+
function amountStepInput(step, depositBlockedMessage, offer) {
|
|
5313
4975
|
switch (step.type) {
|
|
5314
4976
|
case "wallet":
|
|
5315
4977
|
return { type: "incomplete" };
|
|
@@ -5318,8 +4980,7 @@ function amountStepInput(step, depositBlockedMessage, quoteState) {
|
|
|
5318
4980
|
type: "active",
|
|
5319
4981
|
wallet: step.wallet,
|
|
5320
4982
|
depositBlockedMessage,
|
|
5321
|
-
|
|
5322
|
-
awaitingMinimum: quoteState.type === "LOADING"
|
|
4983
|
+
minimumPurchaseUsd: offer.options[0]?.minimumPurchaseUsd ?? null
|
|
5323
4984
|
};
|
|
5324
4985
|
case "review":
|
|
5325
4986
|
return {
|
|
@@ -5354,22 +5015,17 @@ function orderPlacedUi(order, offer, symbol, chain, locale) {
|
|
|
5354
5015
|
networkName,
|
|
5355
5016
|
tokenMetadata: null
|
|
5356
5017
|
}),
|
|
5357
|
-
outputAmount: assetAmount(
|
|
5358
|
-
formatShareAmount(order.transaction.estimatedShares, locale),
|
|
5359
|
-
symbol
|
|
5360
|
-
),
|
|
5361
5018
|
totalCost: assetAmount(
|
|
5362
5019
|
formatAmount(order.transaction.spendInputAmount, locale),
|
|
5363
5020
|
TOKEN_REGISTRY.erc20(USDC_SYMBOL).symbol
|
|
5364
5021
|
),
|
|
5365
|
-
pricePerShare: formatIndicativeUsd(order.indicativePrice, locale),
|
|
5366
5022
|
recipientAddress: shortenAddress(order.wallet.address),
|
|
5367
5023
|
txExplorerUrl: txExplorerUrl(chain, order.txHash)
|
|
5368
5024
|
};
|
|
5369
5025
|
}
|
|
5370
5026
|
|
|
5371
5027
|
// src/client/components/checkout/centrifuge/buy/CentrifugeBuyCheckoutContainer.tsx
|
|
5372
|
-
import { jsx as
|
|
5028
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
5373
5029
|
function CentrifugeBuyCheckoutContainer({
|
|
5374
5030
|
offer,
|
|
5375
5031
|
symbol,
|
|
@@ -5391,7 +5047,7 @@ function CentrifugeBuyCheckoutContainer({
|
|
|
5391
5047
|
underlyingFund,
|
|
5392
5048
|
apy
|
|
5393
5049
|
});
|
|
5394
|
-
return /* @__PURE__ */
|
|
5050
|
+
return /* @__PURE__ */ jsx41(
|
|
5395
5051
|
CentrifugeBuyCheckoutView,
|
|
5396
5052
|
{
|
|
5397
5053
|
state,
|
|
@@ -5402,13 +5058,13 @@ function CentrifugeBuyCheckoutContainer({
|
|
|
5402
5058
|
}
|
|
5403
5059
|
|
|
5404
5060
|
// src/client/components/checkout/ondo/buy/amount/OndoBuyAmountView.tsx
|
|
5405
|
-
import { jsx as
|
|
5061
|
+
import { jsx as jsx42, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
5406
5062
|
var TITLE6 = "2. Enter amount";
|
|
5407
5063
|
var AMOUNT_LABEL2 = "Amount";
|
|
5408
5064
|
var AMOUNT_PLACEHOLDER2 = "0.00";
|
|
5409
5065
|
var REVIEW_NOTE2 = "You'll review your order details before purchasing.";
|
|
5410
5066
|
function OndoBuyAmountView(props) {
|
|
5411
|
-
return /* @__PURE__ */
|
|
5067
|
+
return /* @__PURE__ */ jsx42(CoinListStyleScope, { children: /* @__PURE__ */ jsx42(OndoAmountViewBody, { ...props }) });
|
|
5412
5068
|
}
|
|
5413
5069
|
function OndoAmountViewBody({
|
|
5414
5070
|
state,
|
|
@@ -5417,7 +5073,7 @@ function OndoAmountViewBody({
|
|
|
5417
5073
|
}) {
|
|
5418
5074
|
switch (state.type) {
|
|
5419
5075
|
case "incomplete":
|
|
5420
|
-
return /* @__PURE__ */
|
|
5076
|
+
return /* @__PURE__ */ jsx42(
|
|
5421
5077
|
CheckoutStepCard,
|
|
5422
5078
|
{
|
|
5423
5079
|
state: "inactive",
|
|
@@ -5426,9 +5082,9 @@ function OndoAmountViewBody({
|
|
|
5426
5082
|
}
|
|
5427
5083
|
);
|
|
5428
5084
|
case "active":
|
|
5429
|
-
return /* @__PURE__ */
|
|
5085
|
+
return /* @__PURE__ */ jsx42(ActiveView4, { state, onEvent, className });
|
|
5430
5086
|
case "complete":
|
|
5431
|
-
return /* @__PURE__ */
|
|
5087
|
+
return /* @__PURE__ */ jsx42(CompletedView3, { state, onEvent, className });
|
|
5432
5088
|
default: {
|
|
5433
5089
|
const exhaustive = state;
|
|
5434
5090
|
return exhaustive;
|
|
@@ -5442,18 +5098,18 @@ function ActiveView4({
|
|
|
5442
5098
|
}) {
|
|
5443
5099
|
const isLoading = state.confirmCta.type === "loading";
|
|
5444
5100
|
const selectedAsset = state.inputAssets.find((asset) => asset.selected) ?? null;
|
|
5445
|
-
return /* @__PURE__ */
|
|
5101
|
+
return /* @__PURE__ */ jsxs27(
|
|
5446
5102
|
CheckoutStepCard,
|
|
5447
5103
|
{
|
|
5448
5104
|
state: "active",
|
|
5449
5105
|
title: TITLE6,
|
|
5450
5106
|
className,
|
|
5451
|
-
footer: /* @__PURE__ */
|
|
5107
|
+
footer: /* @__PURE__ */ jsx42(
|
|
5452
5108
|
CheckoutStepFooter,
|
|
5453
5109
|
{
|
|
5454
5110
|
message: state.confirmCta.type === "loading" ? state.confirmCta.message : REVIEW_NOTE2,
|
|
5455
5111
|
error: state.error,
|
|
5456
|
-
cta: /* @__PURE__ */
|
|
5112
|
+
cta: /* @__PURE__ */ jsx42(
|
|
5457
5113
|
ClButton,
|
|
5458
5114
|
{
|
|
5459
5115
|
variant: "primary",
|
|
@@ -5468,7 +5124,7 @@ function ActiveView4({
|
|
|
5468
5124
|
}
|
|
5469
5125
|
),
|
|
5470
5126
|
children: [
|
|
5471
|
-
/* @__PURE__ */
|
|
5127
|
+
/* @__PURE__ */ jsx42(
|
|
5472
5128
|
CheckoutAmountInput,
|
|
5473
5129
|
{
|
|
5474
5130
|
label: AMOUNT_LABEL2,
|
|
@@ -5478,7 +5134,7 @@ function ActiveView4({
|
|
|
5478
5134
|
invalid: state.error !== null,
|
|
5479
5135
|
disabled: isLoading,
|
|
5480
5136
|
suffix: selectedAsset?.symbol,
|
|
5481
|
-
action: selectedAsset && /* @__PURE__ */
|
|
5137
|
+
action: selectedAsset && /* @__PURE__ */ jsx42(
|
|
5482
5138
|
CheckoutMaxButton,
|
|
5483
5139
|
{
|
|
5484
5140
|
disabled: isLoading,
|
|
@@ -5487,7 +5143,7 @@ function ActiveView4({
|
|
|
5487
5143
|
)
|
|
5488
5144
|
}
|
|
5489
5145
|
),
|
|
5490
|
-
state.inputAssets.length > 0 && /* @__PURE__ */
|
|
5146
|
+
state.inputAssets.length > 0 && /* @__PURE__ */ jsx42(
|
|
5491
5147
|
CheckoutPayWithSection,
|
|
5492
5148
|
{
|
|
5493
5149
|
inputAssets: state.inputAssets,
|
|
@@ -5505,10 +5161,10 @@ function CompletedView3({
|
|
|
5505
5161
|
onEvent,
|
|
5506
5162
|
className
|
|
5507
5163
|
}) {
|
|
5508
|
-
return /* @__PURE__ */
|
|
5164
|
+
return /* @__PURE__ */ jsx42(CheckoutStepCard, { state: "completed", title: TITLE6, className, children: /* @__PURE__ */ jsx42(
|
|
5509
5165
|
CompletedStepSummary,
|
|
5510
5166
|
{
|
|
5511
|
-
icon: /* @__PURE__ */
|
|
5167
|
+
icon: /* @__PURE__ */ jsx42(AssetIcon, { asset: state.inputAsset, size: 40 }),
|
|
5512
5168
|
title: state.amountFormatted,
|
|
5513
5169
|
editLabel: "Edit",
|
|
5514
5170
|
onEdit: () => onEvent({ type: "ON_EDIT_AMOUNT" })
|
|
@@ -5517,7 +5173,7 @@ function CompletedView3({
|
|
|
5517
5173
|
}
|
|
5518
5174
|
|
|
5519
5175
|
// src/client/components/checkout/ondo/buy/confirmation/OndoBuyOrderConfirmed.tsx
|
|
5520
|
-
import { Fragment as
|
|
5176
|
+
import { Fragment as Fragment6, jsx as jsx43, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
5521
5177
|
var TITLE7 = "Order confirmed";
|
|
5522
5178
|
var SHARES_RECEIVED_LABEL = "Shares received";
|
|
5523
5179
|
var TOTAL_COST_LABEL = "Total cost";
|
|
@@ -5534,17 +5190,17 @@ function OndoBuyOrderConfirmed({
|
|
|
5534
5190
|
return null;
|
|
5535
5191
|
}
|
|
5536
5192
|
const onClose = () => onEvent({ type: "ON_CLOSE_ORDER_CONFIRMED" });
|
|
5537
|
-
return /* @__PURE__ */
|
|
5193
|
+
return /* @__PURE__ */ jsx43(CoinListStyleScope, { children: /* @__PURE__ */ jsx43(
|
|
5538
5194
|
CheckoutConfirmationDialog,
|
|
5539
5195
|
{
|
|
5540
|
-
icon: /* @__PURE__ */
|
|
5196
|
+
icon: /* @__PURE__ */ jsx43(CheckoutSuccessGlyph, {}),
|
|
5541
5197
|
title: TITLE7,
|
|
5542
5198
|
subtitle: subtitle(state.outputAsset.symbol),
|
|
5543
|
-
header: /* @__PURE__ */
|
|
5199
|
+
header: /* @__PURE__ */ jsx43(AssetSummaryRow, { asset: state.outputAsset, wrapIdentity: true }),
|
|
5544
5200
|
rows: detailRows3(state),
|
|
5545
|
-
actions: /* @__PURE__ */
|
|
5546
|
-
/* @__PURE__ */
|
|
5547
|
-
/* @__PURE__ */
|
|
5201
|
+
actions: /* @__PURE__ */ jsxs28(Fragment6, { children: [
|
|
5202
|
+
/* @__PURE__ */ jsx43(ClButton, { variant: "gradient", fullWidth: true, onClick: onClose, children: DONE_LABEL2 }),
|
|
5203
|
+
/* @__PURE__ */ jsx43(CheckoutExplorerLink, { url: state.txExplorerUrl })
|
|
5548
5204
|
] }),
|
|
5549
5205
|
onClose,
|
|
5550
5206
|
className
|
|
@@ -5563,6 +5219,99 @@ function detailRows3(state) {
|
|
|
5563
5219
|
// src/client/components/checkout/ondo/shared/constants.ts
|
|
5564
5220
|
var ONDO_TOS_URL = "https://docs.ondo.finance/legal/terms-of-service";
|
|
5565
5221
|
|
|
5222
|
+
// src/client/components/checkout/shared/review/CheckoutReviewError.tsx
|
|
5223
|
+
import { jsx as jsx44, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
5224
|
+
var RETRY_LABEL = "Try again";
|
|
5225
|
+
function CheckoutReviewError({
|
|
5226
|
+
title: title2,
|
|
5227
|
+
heading,
|
|
5228
|
+
description: description2,
|
|
5229
|
+
onRetry,
|
|
5230
|
+
className
|
|
5231
|
+
}) {
|
|
5232
|
+
return /* @__PURE__ */ jsx44(CoinListStyleScope, { children: /* @__PURE__ */ jsx44(CheckoutStepCard, { state: "active", title: title2, className, children: /* @__PURE__ */ jsxs29("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:items-center clcosdk:gap-4 clcosdk:py-8 clcosdk:text-center", children: [
|
|
5233
|
+
/* @__PURE__ */ jsxs29("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:items-center clcosdk:gap-2", children: [
|
|
5234
|
+
/* @__PURE__ */ jsx44(
|
|
5235
|
+
"h3",
|
|
5236
|
+
{
|
|
5237
|
+
className: cn(
|
|
5238
|
+
typeClasses.h4,
|
|
5239
|
+
"clcosdk:font-medium clcosdk:text-text-primary"
|
|
5240
|
+
),
|
|
5241
|
+
children: heading
|
|
5242
|
+
}
|
|
5243
|
+
),
|
|
5244
|
+
/* @__PURE__ */ jsx44(
|
|
5245
|
+
"p",
|
|
5246
|
+
{
|
|
5247
|
+
className: cn(
|
|
5248
|
+
typeClasses.body,
|
|
5249
|
+
"clcosdk:max-w-md clcosdk:text-text-secondary"
|
|
5250
|
+
),
|
|
5251
|
+
children: description2
|
|
5252
|
+
}
|
|
5253
|
+
)
|
|
5254
|
+
] }),
|
|
5255
|
+
onRetry !== void 0 && /* @__PURE__ */ jsx44(ClButton, { variant: "secondary", onClick: onRetry, children: RETRY_LABEL })
|
|
5256
|
+
] }) }) });
|
|
5257
|
+
}
|
|
5258
|
+
|
|
5259
|
+
// src/client/components/checkout/shared/review/CheckoutReviewLoading.tsx
|
|
5260
|
+
import { Fragment as Fragment7, jsx as jsx45, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
5261
|
+
var DETAIL_ROW_KEYS = ["first", "second", "third", "fourth"];
|
|
5262
|
+
function CheckoutReviewLoading({
|
|
5263
|
+
title: title2,
|
|
5264
|
+
statusLabel,
|
|
5265
|
+
detailRowCount,
|
|
5266
|
+
showTotal = true,
|
|
5267
|
+
className
|
|
5268
|
+
}) {
|
|
5269
|
+
return /* @__PURE__ */ jsx45(CoinListStyleScope, { children: /* @__PURE__ */ jsxs30(CheckoutStepCard, { state: "active", title: title2, className, children: [
|
|
5270
|
+
/* @__PURE__ */ jsx45("output", { className: "clcosdk:sr-only", children: statusLabel }),
|
|
5271
|
+
/* @__PURE__ */ jsxs30("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4 clcosdk:rounded-2xl clcosdk:border clcosdk:border-border clcosdk:p-4", children: [
|
|
5272
|
+
/* @__PURE__ */ jsx45(Skeleton, { className: "clcosdk:h-3 clcosdk:w-20" }),
|
|
5273
|
+
/* @__PURE__ */ jsxs30("div", { className: "clcosdk:flex clcosdk:items-center clcosdk:gap-3", children: [
|
|
5274
|
+
/* @__PURE__ */ jsx45(
|
|
5275
|
+
Skeleton,
|
|
5276
|
+
{
|
|
5277
|
+
variant: "circular",
|
|
5278
|
+
className: "clcosdk:size-10 clcosdk:shrink-0"
|
|
5279
|
+
}
|
|
5280
|
+
),
|
|
5281
|
+
/* @__PURE__ */ jsxs30("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-2", children: [
|
|
5282
|
+
/* @__PURE__ */ jsx45(Skeleton, { className: "clcosdk:h-5 clcosdk:w-32" }),
|
|
5283
|
+
/* @__PURE__ */ jsx45(Skeleton, { className: "clcosdk:h-3 clcosdk:w-24" })
|
|
5284
|
+
] })
|
|
5285
|
+
] })
|
|
5286
|
+
] }),
|
|
5287
|
+
/* @__PURE__ */ jsx45("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-3 clcosdk:px-2", children: DETAIL_ROW_KEYS.slice(0, detailRowCount).map((row) => /* @__PURE__ */ jsxs30(
|
|
5288
|
+
"div",
|
|
5289
|
+
{
|
|
5290
|
+
className: "clcosdk:flex clcosdk:items-center clcosdk:justify-between clcosdk:gap-4",
|
|
5291
|
+
children: [
|
|
5292
|
+
/* @__PURE__ */ jsx45(Skeleton, { className: "clcosdk:h-4 clcosdk:w-28" }),
|
|
5293
|
+
/* @__PURE__ */ jsx45(Skeleton, { className: "clcosdk:h-4 clcosdk:w-24" })
|
|
5294
|
+
]
|
|
5295
|
+
},
|
|
5296
|
+
row
|
|
5297
|
+
)) }),
|
|
5298
|
+
showTotal && /* @__PURE__ */ jsxs30(Fragment7, { children: [
|
|
5299
|
+
/* @__PURE__ */ jsx45("div", { className: "clcosdk:h-px clcosdk:shrink-0 clcosdk:bg-divider" }),
|
|
5300
|
+
/* @__PURE__ */ jsxs30("div", { className: "clcosdk:flex clcosdk:items-center clcosdk:justify-between clcosdk:gap-4 clcosdk:px-2", children: [
|
|
5301
|
+
/* @__PURE__ */ jsx45(Skeleton, { className: "clcosdk:h-4 clcosdk:w-16" }),
|
|
5302
|
+
/* @__PURE__ */ jsx45(Skeleton, { className: "clcosdk:h-4 clcosdk:w-20" })
|
|
5303
|
+
] })
|
|
5304
|
+
] }),
|
|
5305
|
+
/* @__PURE__ */ jsx45(
|
|
5306
|
+
Skeleton,
|
|
5307
|
+
{
|
|
5308
|
+
variant: "rectangular",
|
|
5309
|
+
className: "clcosdk:h-[54px] clcosdk:w-full clcosdk:rounded-full"
|
|
5310
|
+
}
|
|
5311
|
+
)
|
|
5312
|
+
] }) });
|
|
5313
|
+
}
|
|
5314
|
+
|
|
5566
5315
|
// src/client/components/checkout/ondo/buy/review/OndoBuyReviewView.tsx
|
|
5567
5316
|
import { jsx as jsx46, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
5568
5317
|
var TITLE8 = "3. Review and confirm";
|
|
@@ -5574,9 +5323,9 @@ var COINLIST_FEE_LABEL2 = "CoinList fee";
|
|
|
5574
5323
|
var COINLIST_FEE_TOOLTIP2 = "CoinList's fee for this order. It is already included in the total you pay.";
|
|
5575
5324
|
var TOTAL_LABEL2 = "Total";
|
|
5576
5325
|
var REFRESH_QUOTE_LABEL = "Refresh quote";
|
|
5577
|
-
var
|
|
5578
|
-
var
|
|
5579
|
-
var
|
|
5326
|
+
var LOADING_STATUS = "Loading your order details\u2026";
|
|
5327
|
+
var ERROR_TITLE = "Something went wrong";
|
|
5328
|
+
var ERROR_DESCRIPTION = "We couldn't load your order details. Please try again.";
|
|
5580
5329
|
function OndoBuyReviewView(props) {
|
|
5581
5330
|
return /* @__PURE__ */ jsx46(CoinListStyleScope, { children: /* @__PURE__ */ jsx46(OndoReviewViewBody, { ...props }) });
|
|
5582
5331
|
}
|
|
@@ -5600,7 +5349,7 @@ function OndoReviewViewBody({
|
|
|
5600
5349
|
CheckoutReviewLoading,
|
|
5601
5350
|
{
|
|
5602
5351
|
title: TITLE8,
|
|
5603
|
-
statusLabel:
|
|
5352
|
+
statusLabel: LOADING_STATUS,
|
|
5604
5353
|
detailRowCount: 3,
|
|
5605
5354
|
className
|
|
5606
5355
|
}
|
|
@@ -5610,8 +5359,8 @@ function OndoReviewViewBody({
|
|
|
5610
5359
|
CheckoutReviewError,
|
|
5611
5360
|
{
|
|
5612
5361
|
title: TITLE8,
|
|
5613
|
-
heading:
|
|
5614
|
-
description:
|
|
5362
|
+
heading: ERROR_TITLE,
|
|
5363
|
+
description: ERROR_DESCRIPTION,
|
|
5615
5364
|
onRetry: () => onEvent({ type: "ON_RETRY" }),
|
|
5616
5365
|
className
|
|
5617
5366
|
}
|
|
@@ -6221,10 +5970,10 @@ function OndoBuyCheckoutView({
|
|
|
6221
5970
|
}
|
|
6222
5971
|
|
|
6223
5972
|
// src/client/hooks/checkout/ondo/buy/useOndoBuyCheckoutViewModel.ts
|
|
6224
|
-
import { useState as
|
|
5973
|
+
import { useState as useState16 } from "react";
|
|
6225
5974
|
|
|
6226
5975
|
// src/client/hooks/checkout/ondo/buy/amount/useOndoBuyAmountViewModel.ts
|
|
6227
|
-
import { useEffect as
|
|
5976
|
+
import { useEffect as useEffect8, useRef as useRef5, useState as useState10 } from "react";
|
|
6228
5977
|
var NO_WALLET2 = EvmWalletAddress(
|
|
6229
5978
|
"0x0000000000000000000000000000000000000000"
|
|
6230
5979
|
);
|
|
@@ -6242,13 +5991,13 @@ function useOndoBuyAmountViewModel({
|
|
|
6242
5991
|
}) {
|
|
6243
5992
|
const { coinlist } = useCoinList();
|
|
6244
5993
|
const locale = useLocale();
|
|
6245
|
-
const [amountInput, setAmountInput] =
|
|
6246
|
-
const [selectedAsset, setSelectedAsset] =
|
|
5994
|
+
const [amountInput, setAmountInput] = useState10("");
|
|
5995
|
+
const [selectedAsset, setSelectedAsset] = useState10(
|
|
6247
5996
|
ONDO_SUPPORTED_INPUT_ASSETS[0]
|
|
6248
5997
|
);
|
|
6249
|
-
const [error, setError] =
|
|
6250
|
-
const [phase, setPhase] =
|
|
6251
|
-
const preparationIdRef =
|
|
5998
|
+
const [error, setError] = useState10(null);
|
|
5999
|
+
const [phase, setPhase] = useState10(null);
|
|
6000
|
+
const preparationIdRef = useRef5(0);
|
|
6252
6001
|
const isActive = stepInput.type === "active";
|
|
6253
6002
|
const networkName = getNetworkName(chain);
|
|
6254
6003
|
const marketClosed = isActive && stepInput.tradingStatus?.type === "not-tradable";
|
|
@@ -6258,7 +6007,7 @@ function useOndoBuyAmountViewModel({
|
|
|
6258
6007
|
assets: ONDO_SUPPORTED_INPUT_ASSETS,
|
|
6259
6008
|
enabled: enabled && isActive
|
|
6260
6009
|
});
|
|
6261
|
-
|
|
6010
|
+
useEffect8(() => {
|
|
6262
6011
|
if (stepInput.type === "incomplete") {
|
|
6263
6012
|
++preparationIdRef.current;
|
|
6264
6013
|
setAmountInput("");
|
|
@@ -6425,7 +6174,7 @@ function validateAmount({
|
|
|
6425
6174
|
if (balance !== null && amount.raw > balance) {
|
|
6426
6175
|
return { valid: false, error: `Insufficient ${symbol}.` };
|
|
6427
6176
|
}
|
|
6428
|
-
const minimum =
|
|
6177
|
+
const minimum = minimumAmount2(minimumPurchaseUsd, decimals);
|
|
6429
6178
|
if (minimum !== null && amount.raw < minimum.raw) {
|
|
6430
6179
|
return {
|
|
6431
6180
|
valid: false,
|
|
@@ -6441,7 +6190,7 @@ function validateAmount({
|
|
|
6441
6190
|
}
|
|
6442
6191
|
return { valid: true, amount };
|
|
6443
6192
|
}
|
|
6444
|
-
function
|
|
6193
|
+
function minimumAmount2(minimumPurchaseUsd, decimals) {
|
|
6445
6194
|
if (minimumPurchaseUsd === null) return null;
|
|
6446
6195
|
const parsed = parseBlockchainAmount(String(minimumPurchaseUsd), decimals);
|
|
6447
6196
|
return parsed.valid ? parsed.amount : null;
|
|
@@ -6517,10 +6266,10 @@ function preparationErrorMessage2(error) {
|
|
|
6517
6266
|
}
|
|
6518
6267
|
|
|
6519
6268
|
// src/client/hooks/checkout/ondo/buy/review/useOndoBuyReviewViewModel.ts
|
|
6520
|
-
import { useEffect as
|
|
6269
|
+
import { useEffect as useEffect11, useMemo as useMemo5, useRef as useRef7, useState as useState12 } from "react";
|
|
6521
6270
|
|
|
6522
6271
|
// src/client/hooks/checkout/ondo/buy/data/useOndoBuyTransaction.ts
|
|
6523
|
-
import { useCallback as useCallback3, useEffect as
|
|
6272
|
+
import { useCallback as useCallback3, useEffect as useEffect9, useRef as useRef6, useState as useState11 } from "react";
|
|
6524
6273
|
|
|
6525
6274
|
// src/client/hooks/checkout/ondo/shared/data/ondo-load-error.ts
|
|
6526
6275
|
function ondoLoadErrorReason(error) {
|
|
@@ -6534,7 +6283,7 @@ function useOndoBuyTransaction(options) {
|
|
|
6534
6283
|
const { request, data, enabled } = options;
|
|
6535
6284
|
const { coinlist, isReady } = useCoinList();
|
|
6536
6285
|
const log = useLogger("useOndoBuyTransaction");
|
|
6537
|
-
const [state, setState] =
|
|
6286
|
+
const [state, setState] = useState11(
|
|
6538
6287
|
() => data === void 0 ? { type: "LOADING" } : {
|
|
6539
6288
|
type: "CONTENT",
|
|
6540
6289
|
transaction: data,
|
|
@@ -6542,10 +6291,10 @@ function useOndoBuyTransaction(options) {
|
|
|
6542
6291
|
refreshError: null
|
|
6543
6292
|
}
|
|
6544
6293
|
);
|
|
6545
|
-
const fetchIdRef =
|
|
6546
|
-
const isFetchingRef =
|
|
6294
|
+
const fetchIdRef = useRef6(0);
|
|
6295
|
+
const isFetchingRef = useRef6(false);
|
|
6547
6296
|
const requestKey = request === null ? null : stableKey(request);
|
|
6548
|
-
const requestRef =
|
|
6297
|
+
const requestRef = useRef6(request);
|
|
6549
6298
|
requestRef.current = request;
|
|
6550
6299
|
const build = useCallback3(async () => {
|
|
6551
6300
|
const params = requestRef.current;
|
|
@@ -6583,7 +6332,7 @@ function useOndoBuyTransaction(options) {
|
|
|
6583
6332
|
isFetchingRef.current = false;
|
|
6584
6333
|
}
|
|
6585
6334
|
}, [coinlist, isReady, enabled, log]);
|
|
6586
|
-
|
|
6335
|
+
useEffect9(() => {
|
|
6587
6336
|
if (data === void 0) return;
|
|
6588
6337
|
++fetchIdRef.current;
|
|
6589
6338
|
setState({
|
|
@@ -6594,7 +6343,7 @@ function useOndoBuyTransaction(options) {
|
|
|
6594
6343
|
});
|
|
6595
6344
|
}, [data]);
|
|
6596
6345
|
const hasSeed = data !== void 0;
|
|
6597
|
-
|
|
6346
|
+
useEffect9(() => {
|
|
6598
6347
|
if (hasSeed || requestKey === null) return;
|
|
6599
6348
|
build();
|
|
6600
6349
|
return () => {
|
|
@@ -6617,7 +6366,7 @@ function stableKey(request) {
|
|
|
6617
6366
|
}
|
|
6618
6367
|
|
|
6619
6368
|
// src/client/ui/hooks/useCountdown.ts
|
|
6620
|
-
import { useEffect as
|
|
6369
|
+
import { useEffect as useEffect10, useReducer } from "react";
|
|
6621
6370
|
var DEFAULT_TICK_MS = 1e3;
|
|
6622
6371
|
function useCountdown({
|
|
6623
6372
|
until,
|
|
@@ -6626,7 +6375,7 @@ function useCountdown({
|
|
|
6626
6375
|
}) {
|
|
6627
6376
|
const untilMs = until?.getTime() ?? null;
|
|
6628
6377
|
const [, tick] = useReducer(nextTick, 0);
|
|
6629
|
-
|
|
6378
|
+
useEffect10(() => {
|
|
6630
6379
|
if (untilMs === null || !enabled || remainingSeconds(untilMs) === 0) return;
|
|
6631
6380
|
const interval = setInterval(() => {
|
|
6632
6381
|
tick();
|
|
@@ -6656,8 +6405,8 @@ function useOndoBuyReviewViewModel({
|
|
|
6656
6405
|
}) {
|
|
6657
6406
|
const { coinlist } = useCoinList();
|
|
6658
6407
|
const locale = useLocale();
|
|
6659
|
-
const [phase, setPhase] =
|
|
6660
|
-
const [error, setError] =
|
|
6408
|
+
const [phase, setPhase] = useState12(null);
|
|
6409
|
+
const [error, setError] = useState12(null);
|
|
6661
6410
|
const isActive = stepInput.type === "active";
|
|
6662
6411
|
const { state: transactionState, refetch } = useOndoBuyTransaction({
|
|
6663
6412
|
request: isActive ? {
|
|
@@ -6669,8 +6418,8 @@ function useOndoBuyReviewViewModel({
|
|
|
6669
6418
|
data: isActive ? stepInput.transaction : void 0,
|
|
6670
6419
|
enabled: enabled && isActive
|
|
6671
6420
|
});
|
|
6672
|
-
const executionIdRef =
|
|
6673
|
-
|
|
6421
|
+
const executionIdRef = useRef7(0);
|
|
6422
|
+
useEffect11(() => {
|
|
6674
6423
|
if (stepInput.type === "incomplete") {
|
|
6675
6424
|
++executionIdRef.current;
|
|
6676
6425
|
setError(null);
|
|
@@ -6866,8 +6615,8 @@ function executionErrorMessage(error) {
|
|
|
6866
6615
|
}
|
|
6867
6616
|
|
|
6868
6617
|
// src/client/hooks/checkout/ondo/shared/data/useOndoPrice.ts
|
|
6869
|
-
import { useEffect as
|
|
6870
|
-
var
|
|
6618
|
+
import { useEffect as useEffect12, useRef as useRef8, useState as useState13 } from "react";
|
|
6619
|
+
var LOADING2 = { type: "LOADING" };
|
|
6871
6620
|
function useOndoPrice(options) {
|
|
6872
6621
|
const {
|
|
6873
6622
|
symbol,
|
|
@@ -6879,14 +6628,14 @@ function useOndoPrice(options) {
|
|
|
6879
6628
|
} = options;
|
|
6880
6629
|
const { coinlist, isReady } = useCoinList();
|
|
6881
6630
|
const log = useLogger("useOndoPrice");
|
|
6882
|
-
const [state, setState] =
|
|
6883
|
-
() => data === void 0 ?
|
|
6631
|
+
const [state, setState] = useState13(
|
|
6632
|
+
() => data === void 0 ? LOADING2 : { type: "CONTENT", quote: data, isRefreshing: false }
|
|
6884
6633
|
);
|
|
6885
|
-
const fetchIdRef =
|
|
6886
|
-
const isFetchingRef =
|
|
6887
|
-
const hasQuoteRef =
|
|
6634
|
+
const fetchIdRef = useRef8(0);
|
|
6635
|
+
const isFetchingRef = useRef8(false);
|
|
6636
|
+
const hasQuoteRef = useRef8(data !== void 0);
|
|
6888
6637
|
const sizeKey = quoteSizeKey(size);
|
|
6889
|
-
|
|
6638
|
+
useEffect12(() => {
|
|
6890
6639
|
if (!isReady || !enabled) return;
|
|
6891
6640
|
const size2 = quoteSizeFromKey(sizeKey);
|
|
6892
6641
|
const currentFetchId = ++fetchIdRef.current;
|
|
@@ -6959,11 +6708,11 @@ function quoteSizeFromKey(key) {
|
|
|
6959
6708
|
}
|
|
6960
6709
|
|
|
6961
6710
|
// src/client/hooks/checkout/ondo/shared/data/useOndoTradingStatus.ts
|
|
6962
|
-
import { useEffect as
|
|
6711
|
+
import { useEffect as useEffect13, useRef as useRef9, useState as useState14 } from "react";
|
|
6963
6712
|
function isNotTradable(state) {
|
|
6964
6713
|
return state.type === "CONTENT" && state.status.type === "not-tradable";
|
|
6965
6714
|
}
|
|
6966
|
-
var
|
|
6715
|
+
var LOADING3 = { type: "LOADING" };
|
|
6967
6716
|
function useOndoTradingStatus(options) {
|
|
6968
6717
|
const {
|
|
6969
6718
|
symbol,
|
|
@@ -6974,13 +6723,13 @@ function useOndoTradingStatus(options) {
|
|
|
6974
6723
|
} = options;
|
|
6975
6724
|
const { coinlist, isReady } = useCoinList();
|
|
6976
6725
|
const log = useLogger("useOndoTradingStatus");
|
|
6977
|
-
const [state, setState] =
|
|
6978
|
-
() => data === void 0 ?
|
|
6726
|
+
const [state, setState] = useState14(
|
|
6727
|
+
() => data === void 0 ? LOADING3 : { type: "CONTENT", status: data }
|
|
6979
6728
|
);
|
|
6980
|
-
const fetchIdRef =
|
|
6981
|
-
const isFetchingRef =
|
|
6982
|
-
const hasStatusRef =
|
|
6983
|
-
|
|
6729
|
+
const fetchIdRef = useRef9(0);
|
|
6730
|
+
const isFetchingRef = useRef9(false);
|
|
6731
|
+
const hasStatusRef = useRef9(data !== void 0);
|
|
6732
|
+
useEffect13(() => {
|
|
6984
6733
|
if (!isReady || !enabled) return;
|
|
6985
6734
|
const currentFetchId = ++fetchIdRef.current;
|
|
6986
6735
|
isFetchingRef.current = false;
|
|
@@ -7126,7 +6875,7 @@ function toMarketUi(state) {
|
|
|
7126
6875
|
}
|
|
7127
6876
|
|
|
7128
6877
|
// src/client/hooks/checkout/ondo/shared/wallet/useOndoWalletSelectViewModel.ts
|
|
7129
|
-
import { useState as
|
|
6878
|
+
import { useState as useState15 } from "react";
|
|
7130
6879
|
var CONNECT_FAILED2 = "Could not connect that wallet. Please try again.";
|
|
7131
6880
|
function useOndoWalletSelectViewModel({
|
|
7132
6881
|
stepInput,
|
|
@@ -7136,8 +6885,8 @@ function useOndoWalletSelectViewModel({
|
|
|
7136
6885
|
onEdit
|
|
7137
6886
|
}) {
|
|
7138
6887
|
const log = useLogger("useOndoWalletSelectViewModel");
|
|
7139
|
-
const [selected, setSelected] =
|
|
7140
|
-
const [error, setError] =
|
|
6888
|
+
const [selected, setSelected] = useState15(null);
|
|
6889
|
+
const [error, setError] = useState15(null);
|
|
7141
6890
|
const networkName = getNetworkName(chain);
|
|
7142
6891
|
const selectedWallet = resolveWallet2(wallets, selected);
|
|
7143
6892
|
const uiState = () => {
|
|
@@ -7276,8 +7025,8 @@ function useOndoBuyCheckoutViewModel({
|
|
|
7276
7025
|
onOrderConfirmed
|
|
7277
7026
|
}) {
|
|
7278
7027
|
const locale = useLocale();
|
|
7279
|
-
const [step, setStep] =
|
|
7280
|
-
const [orderConfirmed, setOrderConfirmed] =
|
|
7028
|
+
const [step, setStep] = useState16({ type: "wallet" });
|
|
7029
|
+
const [orderConfirmed, setOrderConfirmed] = useState16(null);
|
|
7281
7030
|
const swappableHere = swapSpender(offer.swapContracts, chain) !== null;
|
|
7282
7031
|
const live = enabled && swappableHere;
|
|
7283
7032
|
const { state: tradingStatusState } = useOndoTradingStatus({
|
|
@@ -7757,9 +7506,9 @@ var MINIMUM_RECEIVED_TOOLTIP = "The least this order will settle for, after fees
|
|
|
7757
7506
|
var COINLIST_FEE_LABEL3 = "Expected CoinList fee";
|
|
7758
7507
|
var COINLIST_FEE_TOOLTIP3 = "CoinList's fee at the amount you're expected to receive. It comes out of your proceeds; at the minimum it is slightly smaller.";
|
|
7759
7508
|
var REFRESH_QUOTE_LABEL2 = "Refresh quote";
|
|
7760
|
-
var
|
|
7761
|
-
var
|
|
7762
|
-
var
|
|
7509
|
+
var LOADING_STATUS2 = "Loading your order details\u2026";
|
|
7510
|
+
var ERROR_TITLE2 = "Something went wrong";
|
|
7511
|
+
var ERROR_DESCRIPTION2 = "We couldn't load your order details. Please try again.";
|
|
7763
7512
|
function OndoSellReviewView(props) {
|
|
7764
7513
|
return /* @__PURE__ */ jsx55(CoinListStyleScope, { children: /* @__PURE__ */ jsx55(OndoSellReviewViewBody, { ...props }) });
|
|
7765
7514
|
}
|
|
@@ -7785,7 +7534,7 @@ function OndoSellReviewViewBody({
|
|
|
7785
7534
|
CheckoutReviewLoading,
|
|
7786
7535
|
{
|
|
7787
7536
|
title: title2,
|
|
7788
|
-
statusLabel:
|
|
7537
|
+
statusLabel: LOADING_STATUS2,
|
|
7789
7538
|
detailRowCount: 3,
|
|
7790
7539
|
showTotal: false,
|
|
7791
7540
|
className
|
|
@@ -7796,8 +7545,8 @@ function OndoSellReviewViewBody({
|
|
|
7796
7545
|
CheckoutReviewError,
|
|
7797
7546
|
{
|
|
7798
7547
|
title: title2,
|
|
7799
|
-
heading:
|
|
7800
|
-
description:
|
|
7548
|
+
heading: ERROR_TITLE2,
|
|
7549
|
+
description: ERROR_DESCRIPTION2,
|
|
7801
7550
|
onRetry: () => onEvent({ type: "ON_SELL_RETRY" }),
|
|
7802
7551
|
className
|
|
7803
7552
|
}
|
|
@@ -8008,13 +7757,13 @@ function ContentView({
|
|
|
8008
7757
|
}
|
|
8009
7758
|
|
|
8010
7759
|
// src/client/hooks/checkout/ondo/sell/useOndoSellCheckoutViewModel.ts
|
|
8011
|
-
import { useState as
|
|
7760
|
+
import { useState as useState21 } from "react";
|
|
8012
7761
|
|
|
8013
7762
|
// src/client/hooks/checkout/ondo/sell/amount/useOndoSellAmountViewModel.ts
|
|
8014
|
-
import { useEffect as
|
|
7763
|
+
import { useEffect as useEffect15, useRef as useRef11, useState as useState18 } from "react";
|
|
8015
7764
|
|
|
8016
7765
|
// src/client/hooks/shared/erc20/useErc20Balance.ts
|
|
8017
|
-
import { useEffect as
|
|
7766
|
+
import { useEffect as useEffect14, useRef as useRef10, useState as useState17 } from "react";
|
|
8018
7767
|
function useErc20Balance(options) {
|
|
8019
7768
|
const {
|
|
8020
7769
|
tokenAddress,
|
|
@@ -8025,12 +7774,12 @@ function useErc20Balance(options) {
|
|
|
8025
7774
|
} = options;
|
|
8026
7775
|
const { coinlist, isReady } = useCoinList();
|
|
8027
7776
|
const log = useLogger("useErc20Balance");
|
|
8028
|
-
const [balance, setBalance] =
|
|
8029
|
-
const [isLoading, setIsLoading] =
|
|
8030
|
-
const fetchIdRef =
|
|
8031
|
-
const isFetchingRef =
|
|
8032
|
-
const hasReadRef =
|
|
8033
|
-
|
|
7777
|
+
const [balance, setBalance] = useState17(null);
|
|
7778
|
+
const [isLoading, setIsLoading] = useState17(true);
|
|
7779
|
+
const fetchIdRef = useRef10(0);
|
|
7780
|
+
const isFetchingRef = useRef10(false);
|
|
7781
|
+
const hasReadRef = useRef10(false);
|
|
7782
|
+
useEffect14(() => {
|
|
8034
7783
|
if (!isReady) return;
|
|
8035
7784
|
setBalance(null);
|
|
8036
7785
|
hasReadRef.current = false;
|
|
@@ -8114,10 +7863,10 @@ function useOndoSellAmountViewModel({
|
|
|
8114
7863
|
}) {
|
|
8115
7864
|
const { coinlist } = useCoinList();
|
|
8116
7865
|
const locale = useLocale();
|
|
8117
|
-
const [amountInput, setAmountInput] =
|
|
8118
|
-
const [error, setError] =
|
|
8119
|
-
const [phase, setPhase] =
|
|
8120
|
-
const preparationIdRef =
|
|
7866
|
+
const [amountInput, setAmountInput] = useState18("");
|
|
7867
|
+
const [error, setError] = useState18(null);
|
|
7868
|
+
const [phase, setPhase] = useState18(null);
|
|
7869
|
+
const preparationIdRef = useRef11(0);
|
|
8121
7870
|
const isActive = stepInput.type === "active";
|
|
8122
7871
|
const networkName = getNetworkName(chain);
|
|
8123
7872
|
const sellAsset2 = isActive ? stepInput.sellAsset : null;
|
|
@@ -8128,7 +7877,7 @@ function useOndoSellAmountViewModel({
|
|
|
8128
7877
|
chain,
|
|
8129
7878
|
enabled: enabled && isActive && sellAsset2 !== null
|
|
8130
7879
|
});
|
|
8131
|
-
|
|
7880
|
+
useEffect15(() => {
|
|
8132
7881
|
if (stepInput.type === "incomplete") {
|
|
8133
7882
|
++preparationIdRef.current;
|
|
8134
7883
|
setAmountInput("");
|
|
@@ -8365,15 +8114,15 @@ function preparationErrorMessage3(error) {
|
|
|
8365
8114
|
}
|
|
8366
8115
|
|
|
8367
8116
|
// src/client/hooks/checkout/ondo/sell/review/useOndoSellReviewViewModel.ts
|
|
8368
|
-
import { useEffect as
|
|
8117
|
+
import { useEffect as useEffect17, useMemo as useMemo6, useRef as useRef13, useState as useState20 } from "react";
|
|
8369
8118
|
|
|
8370
8119
|
// src/client/hooks/checkout/ondo/sell/data/useOndoSellTransaction.ts
|
|
8371
|
-
import { useCallback as useCallback4, useEffect as
|
|
8120
|
+
import { useCallback as useCallback4, useEffect as useEffect16, useRef as useRef12, useState as useState19 } from "react";
|
|
8372
8121
|
function useOndoSellTransaction(options) {
|
|
8373
8122
|
const { request, data, enabled } = options;
|
|
8374
8123
|
const { coinlist, isReady } = useCoinList();
|
|
8375
8124
|
const log = useLogger("useOndoSellTransaction");
|
|
8376
|
-
const [state, setState] =
|
|
8125
|
+
const [state, setState] = useState19(
|
|
8377
8126
|
() => data === void 0 ? { type: "LOADING" } : {
|
|
8378
8127
|
type: "CONTENT",
|
|
8379
8128
|
transaction: data,
|
|
@@ -8381,10 +8130,10 @@ function useOndoSellTransaction(options) {
|
|
|
8381
8130
|
refreshError: null
|
|
8382
8131
|
}
|
|
8383
8132
|
);
|
|
8384
|
-
const fetchIdRef =
|
|
8385
|
-
const isFetchingRef =
|
|
8133
|
+
const fetchIdRef = useRef12(0);
|
|
8134
|
+
const isFetchingRef = useRef12(false);
|
|
8386
8135
|
const requestKey = request === null ? null : stableKey2(request);
|
|
8387
|
-
const requestRef =
|
|
8136
|
+
const requestRef = useRef12(request);
|
|
8388
8137
|
requestRef.current = request;
|
|
8389
8138
|
const build = useCallback4(async () => {
|
|
8390
8139
|
const params = requestRef.current;
|
|
@@ -8422,7 +8171,7 @@ function useOndoSellTransaction(options) {
|
|
|
8422
8171
|
isFetchingRef.current = false;
|
|
8423
8172
|
}
|
|
8424
8173
|
}, [coinlist, isReady, enabled, log]);
|
|
8425
|
-
|
|
8174
|
+
useEffect16(() => {
|
|
8426
8175
|
if (data === void 0) return;
|
|
8427
8176
|
++fetchIdRef.current;
|
|
8428
8177
|
setState({
|
|
@@ -8433,7 +8182,7 @@ function useOndoSellTransaction(options) {
|
|
|
8433
8182
|
});
|
|
8434
8183
|
}, [data]);
|
|
8435
8184
|
const hasSeed = data !== void 0;
|
|
8436
|
-
|
|
8185
|
+
useEffect16(() => {
|
|
8437
8186
|
if (hasSeed || requestKey === null) return;
|
|
8438
8187
|
build();
|
|
8439
8188
|
return () => {
|
|
@@ -8465,8 +8214,8 @@ function useOndoSellReviewViewModel({
|
|
|
8465
8214
|
}) {
|
|
8466
8215
|
const { coinlist } = useCoinList();
|
|
8467
8216
|
const locale = useLocale();
|
|
8468
|
-
const [phase, setPhase] =
|
|
8469
|
-
const [error, setError] =
|
|
8217
|
+
const [phase, setPhase] = useState20(null);
|
|
8218
|
+
const [error, setError] = useState20(null);
|
|
8470
8219
|
const isActive = stepInput.type === "active";
|
|
8471
8220
|
const { state: transactionState, refetch } = useOndoSellTransaction({
|
|
8472
8221
|
request: isActive ? {
|
|
@@ -8478,8 +8227,8 @@ function useOndoSellReviewViewModel({
|
|
|
8478
8227
|
data: isActive ? stepInput.transaction : void 0,
|
|
8479
8228
|
enabled: enabled && isActive
|
|
8480
8229
|
});
|
|
8481
|
-
const executionIdRef =
|
|
8482
|
-
|
|
8230
|
+
const executionIdRef = useRef13(0);
|
|
8231
|
+
useEffect17(() => {
|
|
8483
8232
|
if (stepInput.type === "incomplete") {
|
|
8484
8233
|
++executionIdRef.current;
|
|
8485
8234
|
setError(null);
|
|
@@ -8692,12 +8441,12 @@ function useOndoSellCheckoutViewModel({
|
|
|
8692
8441
|
onOrderConfirmed
|
|
8693
8442
|
}) {
|
|
8694
8443
|
const locale = useLocale();
|
|
8695
|
-
const [initialStep] =
|
|
8444
|
+
const [initialStep] = useState21(
|
|
8696
8445
|
() => wallets.preselected === null ? { type: "wallet" } : { type: "amount", wallet: wallets.preselected }
|
|
8697
8446
|
);
|
|
8698
|
-
const [step, setStep] =
|
|
8447
|
+
const [step, setStep] = useState21(initialStep);
|
|
8699
8448
|
const hasWalletStep = initialStep.type === "wallet";
|
|
8700
|
-
const [orderConfirmed, setOrderConfirmed] =
|
|
8449
|
+
const [orderConfirmed, setOrderConfirmed] = useState21(null);
|
|
8701
8450
|
const swappableHere = swapSpender(offer.swapContracts, chain) !== null;
|
|
8702
8451
|
const live = enabled && swappableHere;
|
|
8703
8452
|
const { state: tradingStatusState } = useOndoTradingStatus({
|
|
@@ -9240,9 +8989,9 @@ var COINLIST_FEE_LABEL4 = "CoinList fee";
|
|
|
9240
8989
|
var COINLIST_FEE_TOOLTIP4 = "Transaction fee charged by CoinList";
|
|
9241
8990
|
var TOTAL_LABEL3 = "Total";
|
|
9242
8991
|
var PROCESSING_NOTICE = "Processing onchain. Don't close or refresh this page.";
|
|
9243
|
-
var
|
|
9244
|
-
var
|
|
9245
|
-
var
|
|
8992
|
+
var LOADING_STATUS3 = "Loading your order details\u2026";
|
|
8993
|
+
var ERROR_TITLE3 = "Unable to load quote";
|
|
8994
|
+
var ERROR_DESCRIPTION3 = "We're having trouble fetching a price right now. Please try again.";
|
|
9246
8995
|
function SuperstateReviewView(props) {
|
|
9247
8996
|
return /* @__PURE__ */ jsx61(CoinListStyleScope, { children: /* @__PURE__ */ jsx61(SuperstateReviewViewBody, { ...props }) });
|
|
9248
8997
|
}
|
|
@@ -9266,7 +9015,7 @@ function SuperstateReviewViewBody({
|
|
|
9266
9015
|
CheckoutReviewLoading,
|
|
9267
9016
|
{
|
|
9268
9017
|
title: TITLE16,
|
|
9269
|
-
statusLabel:
|
|
9018
|
+
statusLabel: LOADING_STATUS3,
|
|
9270
9019
|
detailRowCount: 3,
|
|
9271
9020
|
className
|
|
9272
9021
|
}
|
|
@@ -9276,8 +9025,8 @@ function SuperstateReviewViewBody({
|
|
|
9276
9025
|
CheckoutReviewError,
|
|
9277
9026
|
{
|
|
9278
9027
|
title: TITLE16,
|
|
9279
|
-
heading:
|
|
9280
|
-
description:
|
|
9028
|
+
heading: ERROR_TITLE3,
|
|
9029
|
+
description: ERROR_DESCRIPTION3,
|
|
9281
9030
|
className
|
|
9282
9031
|
}
|
|
9283
9032
|
);
|
|
@@ -9792,8 +9541,8 @@ function WalletGlyph3() {
|
|
|
9792
9541
|
|
|
9793
9542
|
// src/client/components/checkout/superstate/swap/SuperstateSwapCheckoutView.tsx
|
|
9794
9543
|
import { jsx as jsx64, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
9795
|
-
var
|
|
9796
|
-
var
|
|
9544
|
+
var ERROR_TITLE4 = "Failed to load";
|
|
9545
|
+
var ERROR_DESCRIPTION4 = "Something went wrong while loading this sale. Please try again.";
|
|
9797
9546
|
var UNSUPPORTED_CHAIN_TITLE2 = "Not available on this network";
|
|
9798
9547
|
var UNSUPPORTED_CHAIN_DESCRIPTION2 = "This sale cannot be traded on the selected network.";
|
|
9799
9548
|
var RETRY_LABEL2 = "Try again";
|
|
@@ -9869,7 +9618,7 @@ function ErrorView({
|
|
|
9869
9618
|
typeClasses.h3,
|
|
9870
9619
|
"clcosdk:font-medium clcosdk:text-text-primary"
|
|
9871
9620
|
),
|
|
9872
|
-
children: canRetry ?
|
|
9621
|
+
children: canRetry ? ERROR_TITLE4 : UNSUPPORTED_CHAIN_TITLE2
|
|
9873
9622
|
}
|
|
9874
9623
|
),
|
|
9875
9624
|
/* @__PURE__ */ jsx64(
|
|
@@ -9879,7 +9628,7 @@ function ErrorView({
|
|
|
9879
9628
|
typeClasses.body,
|
|
9880
9629
|
"clcosdk:max-w-md clcosdk:text-text-secondary"
|
|
9881
9630
|
),
|
|
9882
|
-
children: canRetry ?
|
|
9631
|
+
children: canRetry ? ERROR_DESCRIPTION4 : UNSUPPORTED_CHAIN_DESCRIPTION2
|
|
9883
9632
|
}
|
|
9884
9633
|
)
|
|
9885
9634
|
] }),
|
|
@@ -9897,10 +9646,10 @@ function ErrorView({
|
|
|
9897
9646
|
}
|
|
9898
9647
|
|
|
9899
9648
|
// src/client/hooks/checkout/superstate/swap/useSuperstateSwapCheckoutViewModel.ts
|
|
9900
|
-
import { useState as
|
|
9649
|
+
import { useState as useState27 } from "react";
|
|
9901
9650
|
|
|
9902
9651
|
// src/client/hooks/checkout/superstate/swap/amount/useSuperstateAmountViewModel.ts
|
|
9903
|
-
import { useEffect as
|
|
9652
|
+
import { useEffect as useEffect18, useState as useState22 } from "react";
|
|
9904
9653
|
var NO_WALLET4 = EvmWalletAddress(
|
|
9905
9654
|
"0x0000000000000000000000000000000000000000"
|
|
9906
9655
|
);
|
|
@@ -9914,11 +9663,11 @@ function useSuperstateAmountViewModel({
|
|
|
9914
9663
|
enabled = true
|
|
9915
9664
|
}) {
|
|
9916
9665
|
const locale = useLocale();
|
|
9917
|
-
const [amountInput, setAmountInput] =
|
|
9918
|
-
const [selectedAsset, setSelectedAsset] =
|
|
9666
|
+
const [amountInput, setAmountInput] = useState22("");
|
|
9667
|
+
const [selectedAsset, setSelectedAsset] = useState22(
|
|
9919
9668
|
SUPERSTATE_SUPPORTED_INPUT_ASSETS[0]
|
|
9920
9669
|
);
|
|
9921
|
-
const [error, setError] =
|
|
9670
|
+
const [error, setError] = useState22(null);
|
|
9922
9671
|
const isActive = stepInput.type === "active";
|
|
9923
9672
|
const networkName = getNetworkName(chain);
|
|
9924
9673
|
const { balances, isLoading: balancesLoading } = useErc20TokenBalances({
|
|
@@ -9931,7 +9680,7 @@ function useSuperstateAmountViewModel({
|
|
|
9931
9680
|
// on this step satisfies the first and not the second.
|
|
9932
9681
|
enabled: enabled && isActive
|
|
9933
9682
|
});
|
|
9934
|
-
|
|
9683
|
+
useEffect18(() => {
|
|
9935
9684
|
if (stepInput.type === "incomplete") {
|
|
9936
9685
|
setAmountInput("");
|
|
9937
9686
|
setSelectedAsset(SUPERSTATE_SUPPORTED_INPUT_ASSETS[0]);
|
|
@@ -10079,20 +9828,20 @@ function validateSuperstateAmount({
|
|
|
10079
9828
|
}
|
|
10080
9829
|
|
|
10081
9830
|
// src/client/hooks/checkout/superstate/swap/data/useSwapOutputToken.ts
|
|
10082
|
-
import { useCallback as useCallback5, useEffect as
|
|
9831
|
+
import { useCallback as useCallback5, useEffect as useEffect19, useRef as useRef14, useState as useState23 } from "react";
|
|
10083
9832
|
var LOADING_STATE2 = { type: "LOADING" };
|
|
10084
9833
|
function useSwapOutputToken(options) {
|
|
10085
9834
|
const { contractAddress, chain, enabled } = options;
|
|
10086
9835
|
const { coinlist, isReady } = useCoinList();
|
|
10087
9836
|
const log = useLogger("useSwapOutputToken");
|
|
10088
|
-
const [outputTokenState, setOutputTokenState] =
|
|
10089
|
-
const [retryCount, setRetryCount] =
|
|
10090
|
-
const fetchIdRef =
|
|
9837
|
+
const [outputTokenState, setOutputTokenState] = useState23(LOADING_STATE2);
|
|
9838
|
+
const [retryCount, setRetryCount] = useState23(0);
|
|
9839
|
+
const fetchIdRef = useRef14(0);
|
|
10091
9840
|
const refetch = useCallback5(() => {
|
|
10092
9841
|
setOutputTokenState(LOADING_STATE2);
|
|
10093
9842
|
setRetryCount((count) => count + 1);
|
|
10094
9843
|
}, []);
|
|
10095
|
-
|
|
9844
|
+
useEffect19(() => {
|
|
10096
9845
|
if (!enabled || !isReady) return;
|
|
10097
9846
|
const currentFetchId = ++fetchIdRef.current;
|
|
10098
9847
|
const load = async () => {
|
|
@@ -10125,7 +9874,7 @@ function useSwapOutputToken(options) {
|
|
|
10125
9874
|
}
|
|
10126
9875
|
|
|
10127
9876
|
// src/client/hooks/checkout/superstate/swap/data/useSwapQuote.ts
|
|
10128
|
-
import { useEffect as
|
|
9877
|
+
import { useEffect as useEffect20, useRef as useRef15, useState as useState24 } from "react";
|
|
10129
9878
|
function useSwapQuote(options) {
|
|
10130
9879
|
const {
|
|
10131
9880
|
contractAddress,
|
|
@@ -10138,13 +9887,13 @@ function useSwapQuote(options) {
|
|
|
10138
9887
|
} = options;
|
|
10139
9888
|
const { coinlist, isReady } = useCoinList();
|
|
10140
9889
|
const log = useLogger("useSwapQuote");
|
|
10141
|
-
const [quote, setQuote] =
|
|
10142
|
-
const [isLoading, setIsLoading] =
|
|
10143
|
-
const [isRefreshing, setIsRefreshing] =
|
|
10144
|
-
const isFetchingRef =
|
|
10145
|
-
const hasQuoteRef =
|
|
10146
|
-
const fetchIdRef =
|
|
10147
|
-
|
|
9890
|
+
const [quote, setQuote] = useState24(null);
|
|
9891
|
+
const [isLoading, setIsLoading] = useState24(true);
|
|
9892
|
+
const [isRefreshing, setIsRefreshing] = useState24(false);
|
|
9893
|
+
const isFetchingRef = useRef15(false);
|
|
9894
|
+
const hasQuoteRef = useRef15(false);
|
|
9895
|
+
const fetchIdRef = useRef15(0);
|
|
9896
|
+
useEffect20(() => {
|
|
10148
9897
|
if (!isReady) return;
|
|
10149
9898
|
if (!enabled) {
|
|
10150
9899
|
setIsLoading(false);
|
|
@@ -10214,7 +9963,7 @@ function useSwapQuote(options) {
|
|
|
10214
9963
|
}
|
|
10215
9964
|
|
|
10216
9965
|
// src/client/hooks/checkout/superstate/swap/review/useSuperstateReviewViewModel.ts
|
|
10217
|
-
import { useEffect as
|
|
9966
|
+
import { useEffect as useEffect21, useState as useState25 } from "react";
|
|
10218
9967
|
function useSuperstateReviewViewModel({
|
|
10219
9968
|
stepInput,
|
|
10220
9969
|
contractAddress,
|
|
@@ -10224,11 +9973,11 @@ function useSuperstateReviewViewModel({
|
|
|
10224
9973
|
}) {
|
|
10225
9974
|
const { coinlist, isReady } = useCoinList();
|
|
10226
9975
|
const locale = useLocale();
|
|
10227
|
-
const [slippageBps, setSlippageBps] =
|
|
10228
|
-
const [slippageExpanded, setSlippageExpanded] =
|
|
10229
|
-
const [phase, setPhase] =
|
|
10230
|
-
const [error, setError] =
|
|
10231
|
-
|
|
9976
|
+
const [slippageBps, setSlippageBps] = useState25(DEFAULT_SLIPPAGE_BPS);
|
|
9977
|
+
const [slippageExpanded, setSlippageExpanded] = useState25(false);
|
|
9978
|
+
const [phase, setPhase] = useState25(null);
|
|
9979
|
+
const [error, setError] = useState25(null);
|
|
9980
|
+
useEffect21(() => {
|
|
10232
9981
|
if (stepInput.type === "incomplete") {
|
|
10233
9982
|
setSlippageBps(DEFAULT_SLIPPAGE_BPS);
|
|
10234
9983
|
setSlippageExpanded(false);
|
|
@@ -10559,7 +10308,7 @@ function priceUi(quote, outputToken, locale) {
|
|
|
10559
10308
|
}
|
|
10560
10309
|
|
|
10561
10310
|
// src/client/hooks/checkout/superstate/swap/wallet/useSuperstateWalletViewModel.ts
|
|
10562
|
-
import { useEffect as
|
|
10311
|
+
import { useEffect as useEffect22, useState as useState26 } from "react";
|
|
10563
10312
|
var CONNECT_FAILED3 = "Could not connect that wallet. Please try again.";
|
|
10564
10313
|
function useSuperstateWalletViewModel({
|
|
10565
10314
|
stepInput,
|
|
@@ -10572,12 +10321,12 @@ function useSuperstateWalletViewModel({
|
|
|
10572
10321
|
}) {
|
|
10573
10322
|
const { coinlist, isReady } = useCoinList();
|
|
10574
10323
|
const log = useLogger("useSuperstateWalletViewModel");
|
|
10575
|
-
const [selected, setSelected] =
|
|
10576
|
-
const [phase, setPhase] =
|
|
10577
|
-
const [error, setError] =
|
|
10324
|
+
const [selected, setSelected] = useState26(null);
|
|
10325
|
+
const [phase, setPhase] = useState26(null);
|
|
10326
|
+
const [error, setError] = useState26(null);
|
|
10578
10327
|
const networkName = getNetworkName(chain);
|
|
10579
10328
|
const selectedWallet = resolveWallet3(wallets, selected);
|
|
10580
|
-
|
|
10329
|
+
useEffect22(() => {
|
|
10581
10330
|
if (stepInput.type === "completed") {
|
|
10582
10331
|
setPhase(null);
|
|
10583
10332
|
setError(null);
|
|
@@ -10796,8 +10545,8 @@ function useSuperstateSwapCheckoutViewModel({
|
|
|
10796
10545
|
}) {
|
|
10797
10546
|
const locale = useLocale();
|
|
10798
10547
|
const contractAddress = superstateSwapContractAddress(chain);
|
|
10799
|
-
const [step, setStep] =
|
|
10800
|
-
const [orderConfirmed, setOrderConfirmed] =
|
|
10548
|
+
const [step, setStep] = useState27({ type: "wallet" });
|
|
10549
|
+
const [orderConfirmed, setOrderConfirmed] = useState27(null);
|
|
10801
10550
|
const { inputAmount, inputTokenAddress } = quoteInput(step, chain);
|
|
10802
10551
|
const live = enabled && contractAddress !== null;
|
|
10803
10552
|
const contract = contractAddress ?? NO_CONTRACT;
|
|
@@ -11117,7 +10866,7 @@ function OndoCheckoutContainer({
|
|
|
11117
10866
|
enabled,
|
|
11118
10867
|
className
|
|
11119
10868
|
}) {
|
|
11120
|
-
const [side] =
|
|
10869
|
+
const [side] = useState28(() => config.side());
|
|
11121
10870
|
const ondoSymbol = config.symbol(offer);
|
|
11122
10871
|
return renderOndoSide(side, {
|
|
11123
10872
|
buy: () => /* @__PURE__ */ jsx66(
|
|
@@ -11731,7 +11480,7 @@ function Divider2() {
|
|
|
11731
11480
|
}
|
|
11732
11481
|
|
|
11733
11482
|
// src/client/hooks/claim/centrifuge/vault/useCentrifugeVaultClaimViewModel.ts
|
|
11734
|
-
import { useEffect as
|
|
11483
|
+
import { useEffect as useEffect25, useMemo as useMemo8, useState as useState33 } from "react";
|
|
11735
11484
|
|
|
11736
11485
|
// src/client/hooks/claim/centrifuge/vault/centrifuge-vault-claim-ui-mapper.ts
|
|
11737
11486
|
var CentrifugeVaultClaimUiMapper = {
|
|
@@ -12018,12 +11767,12 @@ function shareAmount(amount, vault, locale) {
|
|
|
12018
11767
|
}
|
|
12019
11768
|
|
|
12020
11769
|
// src/client/hooks/claim/centrifuge/vault/data/useCentrifugeClaim.ts
|
|
12021
|
-
import { useCallback as useCallback6, useRef as
|
|
11770
|
+
import { useCallback as useCallback6, useRef as useRef16, useState as useState29 } from "react";
|
|
12022
11771
|
var IDLE = { type: "IDLE" };
|
|
12023
11772
|
function useCentrifugeClaim() {
|
|
12024
11773
|
const { coinlist } = useCoinList();
|
|
12025
|
-
const [state, setState] =
|
|
12026
|
-
const runRef =
|
|
11774
|
+
const [state, setState] = useState29(IDLE);
|
|
11775
|
+
const runRef = useRef16(0);
|
|
12027
11776
|
const claim = useCallback6(
|
|
12028
11777
|
async (params) => {
|
|
12029
11778
|
const run = ++runRef.current;
|
|
@@ -12054,7 +11803,7 @@ function useCentrifugeClaim() {
|
|
|
12054
11803
|
}
|
|
12055
11804
|
|
|
12056
11805
|
// src/client/hooks/claim/centrifuge/vault/data/useCentrifugeVaultPositions.ts
|
|
12057
|
-
import { useCallback as useCallback7, useEffect as
|
|
11806
|
+
import { useCallback as useCallback7, useEffect as useEffect23, useMemo as useMemo7, useRef as useRef17, useState as useState30 } from "react";
|
|
12058
11807
|
|
|
12059
11808
|
// src/client/ui/hooks/usePageVisible.ts
|
|
12060
11809
|
import { useSyncExternalStore } from "react";
|
|
@@ -12070,7 +11819,7 @@ function isPageVisible() {
|
|
|
12070
11819
|
}
|
|
12071
11820
|
|
|
12072
11821
|
// src/client/hooks/claim/centrifuge/vault/data/useCentrifugeVaultPositions.ts
|
|
12073
|
-
var
|
|
11822
|
+
var LOADING4 = { type: "LOADING" };
|
|
12074
11823
|
var DISABLED = {
|
|
12075
11824
|
type: "CONTENT",
|
|
12076
11825
|
legs: []
|
|
@@ -12089,17 +11838,17 @@ function useCentrifugeVaultPositions(options) {
|
|
|
12089
11838
|
const visible = usePageVisible();
|
|
12090
11839
|
const key = requestsKey(vaults, walletAddresses);
|
|
12091
11840
|
const requests = useMemo7(() => readRequests(vaults, walletAddresses), [key]);
|
|
12092
|
-
const readsRef =
|
|
11841
|
+
const readsRef = useRef17(
|
|
12093
11842
|
new Map((data ?? []).map((read) => [readKey(requestOf(read)), read]))
|
|
12094
11843
|
);
|
|
12095
|
-
const [state, setState] =
|
|
12096
|
-
() => !enabled ? DISABLED : data === void 0 ?
|
|
11844
|
+
const [state, setState] = useState30(
|
|
11845
|
+
() => !enabled ? DISABLED : data === void 0 ? LOADING4 : contentOf(readsRef)
|
|
12097
11846
|
);
|
|
12098
|
-
const [refetchCount, setRefetchCount] =
|
|
12099
|
-
const skipFirstFetchRef =
|
|
12100
|
-
const generationRef =
|
|
12101
|
-
const readSeqRef =
|
|
12102
|
-
const latestReadRef =
|
|
11847
|
+
const [refetchCount, setRefetchCount] = useState30(0);
|
|
11848
|
+
const skipFirstFetchRef = useRef17(data !== void 0);
|
|
11849
|
+
const generationRef = useRef17(0);
|
|
11850
|
+
const readSeqRef = useRef17(0);
|
|
11851
|
+
const latestReadRef = useRef17(/* @__PURE__ */ new Map());
|
|
12103
11852
|
const refetch = useCallback7(() => setRefetchCount((n) => n + 1), []);
|
|
12104
11853
|
const fetchRead = useCallback7(
|
|
12105
11854
|
async (request) => {
|
|
@@ -12172,7 +11921,7 @@ function useCentrifugeVaultPositions(options) {
|
|
|
12172
11921
|
},
|
|
12173
11922
|
[fetchRead, log]
|
|
12174
11923
|
);
|
|
12175
|
-
|
|
11924
|
+
useEffect23(() => {
|
|
12176
11925
|
if (!isReady || !enabled || !visible) return;
|
|
12177
11926
|
const generation = ++generationRef.current;
|
|
12178
11927
|
const wanted = new Set(requests.map(readKey));
|
|
@@ -12184,10 +11933,10 @@ function useCentrifugeVaultPositions(options) {
|
|
|
12184
11933
|
setState(contentOf(readsRef));
|
|
12185
11934
|
return;
|
|
12186
11935
|
}
|
|
12187
|
-
if (readsRef.current.size === 0) setState(
|
|
11936
|
+
if (readsRef.current.size === 0) setState(LOADING4);
|
|
12188
11937
|
void load(requests, generation);
|
|
12189
11938
|
}, [isReady, enabled, visible, requests, refetchCount, load]);
|
|
12190
|
-
|
|
11939
|
+
useEffect23(() => {
|
|
12191
11940
|
if (!isReady || !enabled || !visible) return;
|
|
12192
11941
|
const interval = setInterval(() => {
|
|
12193
11942
|
const pending = requests.filter((request) => {
|
|
@@ -12198,7 +11947,7 @@ function useCentrifugeVaultPositions(options) {
|
|
|
12198
11947
|
}, pollIntervalMs);
|
|
12199
11948
|
return () => clearInterval(interval);
|
|
12200
11949
|
}, [isReady, enabled, visible, requests, pollIntervalMs, load]);
|
|
12201
|
-
|
|
11950
|
+
useEffect23(() => {
|
|
12202
11951
|
if (!enabled) {
|
|
12203
11952
|
++generationRef.current;
|
|
12204
11953
|
setState(DISABLED);
|
|
@@ -12237,10 +11986,10 @@ function contentOf(readsRef) {
|
|
|
12237
11986
|
}
|
|
12238
11987
|
|
|
12239
11988
|
// src/client/hooks/shared/useExternalWalletRequest.ts
|
|
12240
|
-
import { useState as
|
|
11989
|
+
import { useState as useState31 } from "react";
|
|
12241
11990
|
function useExternalWalletRequest(adapter) {
|
|
12242
11991
|
const log = useLogger("useExternalWalletRequest");
|
|
12243
|
-
const [request, setRequest] =
|
|
11992
|
+
const [request, setRequest] = useState31("idle");
|
|
12244
11993
|
const run = async (steps) => {
|
|
12245
11994
|
if (adapter === null) return;
|
|
12246
11995
|
setRequest("pending");
|
|
@@ -12266,21 +12015,21 @@ function useExternalWalletRequest(adapter) {
|
|
|
12266
12015
|
}
|
|
12267
12016
|
|
|
12268
12017
|
// src/client/hooks/shared/useTokenRegistry.ts
|
|
12269
|
-
import { useCallback as useCallback8, useEffect as
|
|
12018
|
+
import { useCallback as useCallback8, useEffect as useEffect24, useState as useState32 } from "react";
|
|
12270
12019
|
var DISABLED_STATE2 = { type: "DISABLED" };
|
|
12271
12020
|
var LOADING_STATE3 = { type: "LOADING" };
|
|
12272
12021
|
function useTokenRegistry(options = {}) {
|
|
12273
12022
|
const { data, enabled = true } = options;
|
|
12274
12023
|
const { coinlist, isReady } = useCoinList();
|
|
12275
12024
|
const log = useLogger("useTokenRegistry");
|
|
12276
|
-
const [state, setState] =
|
|
12025
|
+
const [state, setState] = useState32(
|
|
12277
12026
|
() => data !== void 0 ? { type: "CONTENT", registry: TokenRegistrySnapshot.fromTokens(data) } : LOADING_STATE3
|
|
12278
12027
|
);
|
|
12279
|
-
const [refetchCount, setRefetchCount] =
|
|
12028
|
+
const [refetchCount, setRefetchCount] = useState32(0);
|
|
12280
12029
|
const refetch = useCallback8(() => {
|
|
12281
12030
|
setRefetchCount((count) => count + 1);
|
|
12282
12031
|
}, []);
|
|
12283
|
-
|
|
12032
|
+
useEffect24(() => {
|
|
12284
12033
|
let isCancelled = false;
|
|
12285
12034
|
const seedActive = data !== void 0 && refetchCount === 0;
|
|
12286
12035
|
if (!isReady || !enabled || seedActive) {
|
|
@@ -12357,8 +12106,8 @@ function useCentrifugeVaultClaimViewModel({
|
|
|
12357
12106
|
enabled: vaultsReady && visible && legs.some(CentrifugeVaultLeg.isActive)
|
|
12358
12107
|
});
|
|
12359
12108
|
const claimHook = useCentrifugeClaim();
|
|
12360
|
-
const [claiming, setClaiming] =
|
|
12361
|
-
const [claimsInFlight, setClaimsInFlight] =
|
|
12109
|
+
const [claiming, setClaiming] = useState33(null);
|
|
12110
|
+
const [claimsInFlight, setClaimsInFlight] = useState33(() => /* @__PURE__ */ new Set());
|
|
12362
12111
|
const walletRequest = useExternalWalletRequest(wallets.externalAdapter);
|
|
12363
12112
|
const state = CentrifugeVaultClaimUiMapper.toUiState({
|
|
12364
12113
|
offer,
|
|
@@ -12460,7 +12209,7 @@ function useCentrifugeVaults(offer, registry) {
|
|
|
12460
12209
|
const unresolved = resolutions.flatMap(
|
|
12461
12210
|
(r) => r.type === "unresolved" ? [`${r.chain}:${r.missing}`] : []
|
|
12462
12211
|
).join("|");
|
|
12463
|
-
|
|
12212
|
+
useEffect25(() => {
|
|
12464
12213
|
if (unresolved === "") return;
|
|
12465
12214
|
log.warn(() => ({
|
|
12466
12215
|
msg: "vault chains left out",
|
|
@@ -13002,16 +12751,16 @@ function EmptyState() {
|
|
|
13002
12751
|
import { useCallback as useCallback9, useMemo as useMemo9 } from "react";
|
|
13003
12752
|
|
|
13004
12753
|
// src/client/hooks/offers/data/useOffers.ts
|
|
13005
|
-
import { useEffect as
|
|
12754
|
+
import { useEffect as useEffect26, useState as useState34 } from "react";
|
|
13006
12755
|
var LOADING_STATE4 = { type: "LOADING" };
|
|
13007
12756
|
function useOffers(options = {}) {
|
|
13008
12757
|
const { coinlist, isReady } = useCoinList();
|
|
13009
12758
|
const log = useLogger("useOffers");
|
|
13010
12759
|
const { data: serverOffers, enabled = true } = options;
|
|
13011
|
-
const [offersState, setOffersState] =
|
|
12760
|
+
const [offersState, setOffersState] = useState34(
|
|
13012
12761
|
serverOffers !== void 0 ? { type: "CONTENT", offers: serverOffers } : LOADING_STATE4
|
|
13013
12762
|
);
|
|
13014
|
-
|
|
12763
|
+
useEffect26(() => {
|
|
13015
12764
|
let isCancelled = false;
|
|
13016
12765
|
if (!enabled) {
|
|
13017
12766
|
return () => {
|
|
@@ -13214,13 +12963,13 @@ function OffersGridContainer({
|
|
|
13214
12963
|
}
|
|
13215
12964
|
|
|
13216
12965
|
// src/client/components/requirements/ConnectedWalletList.tsx
|
|
13217
|
-
import { useState as
|
|
12966
|
+
import { useState as useState35 } from "react";
|
|
13218
12967
|
import { jsx as jsx79, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
13219
12968
|
function ConnectedWalletRow({
|
|
13220
12969
|
wallet,
|
|
13221
12970
|
onRemove
|
|
13222
12971
|
}) {
|
|
13223
|
-
const [state, setState] =
|
|
12972
|
+
const [state, setState] = useState35("idle");
|
|
13224
12973
|
const remove = async () => {
|
|
13225
12974
|
if (!onRemove) return;
|
|
13226
12975
|
setState("removing");
|
|
@@ -13408,19 +13157,19 @@ function toError(error) {
|
|
|
13408
13157
|
}
|
|
13409
13158
|
|
|
13410
13159
|
// src/client/hooks/requirements/identity-verification/useIdentityVerificationViewModel.ts
|
|
13411
|
-
import { useCallback as useCallback11, useEffect as
|
|
13160
|
+
import { useCallback as useCallback11, useEffect as useEffect28, useMemo as useMemo10, useRef as useRef19 } from "react";
|
|
13412
13161
|
|
|
13413
13162
|
// src/client/hooks/requirements/data/useKycToken.ts
|
|
13414
|
-
import { useCallback as useCallback10, useEffect as
|
|
13163
|
+
import { useCallback as useCallback10, useEffect as useEffect27, useRef as useRef18, useState as useState36 } from "react";
|
|
13415
13164
|
var IDLE_STATE = { type: "IDLE" };
|
|
13416
13165
|
var LOADING_STATE5 = { type: "LOADING" };
|
|
13417
13166
|
function useKycToken(levelName, reset) {
|
|
13418
13167
|
const { coinlist } = useCoinList();
|
|
13419
13168
|
const log = useLogger("useKycToken");
|
|
13420
|
-
const [kycTokenState, setKycTokenState] =
|
|
13421
|
-
const resetPendingRef =
|
|
13422
|
-
const tokenIssuedRef =
|
|
13423
|
-
|
|
13169
|
+
const [kycTokenState, setKycTokenState] = useState36(IDLE_STATE);
|
|
13170
|
+
const resetPendingRef = useRef18(reset === true);
|
|
13171
|
+
const tokenIssuedRef = useRef18(false);
|
|
13172
|
+
useEffect27(() => {
|
|
13424
13173
|
if (!tokenIssuedRef.current) {
|
|
13425
13174
|
resetPendingRef.current = reset === true;
|
|
13426
13175
|
}
|
|
@@ -13459,8 +13208,8 @@ var GENERIC_ERROR_MESSAGE2 = "Unable to start identity verification right now. P
|
|
|
13459
13208
|
function useIdentityVerificationViewModel(options = {}) {
|
|
13460
13209
|
const { levelName, reset, locale, onSubmitted, onError } = options;
|
|
13461
13210
|
const { kycTokenState, fetchToken } = useKycToken(levelName, reset);
|
|
13462
|
-
const fetchedRef =
|
|
13463
|
-
|
|
13211
|
+
const fetchedRef = useRef19(false);
|
|
13212
|
+
useEffect28(() => {
|
|
13464
13213
|
if (fetchedRef.current) {
|
|
13465
13214
|
return;
|
|
13466
13215
|
}
|
|
@@ -14186,10 +13935,10 @@ function SignOnlyScreen({
|
|
|
14186
13935
|
}
|
|
14187
13936
|
|
|
14188
13937
|
// src/client/hooks/requirements/tax-document/useTaxDocumentModalViewModel.ts
|
|
14189
|
-
import { useCallback as useCallback13, useEffect as
|
|
13938
|
+
import { useCallback as useCallback13, useEffect as useEffect30, useMemo as useMemo11 } from "react";
|
|
14190
13939
|
|
|
14191
13940
|
// src/client/hooks/requirements/data/useTaxDocument.ts
|
|
14192
|
-
import { useCallback as useCallback12, useEffect as
|
|
13941
|
+
import { useCallback as useCallback12, useEffect as useEffect29, useState as useState37 } from "react";
|
|
14193
13942
|
var IDLE_SIGN = { type: "idle", error: null };
|
|
14194
13943
|
var LOADING_STATE6 = { type: "LOADING" };
|
|
14195
13944
|
var SIGN_FAILED_MESSAGE = "Unable to sign document. Please try again.";
|
|
@@ -14264,8 +14013,8 @@ function useTaxDocument({
|
|
|
14264
14013
|
}) {
|
|
14265
14014
|
const { coinlist, isReady } = useCoinList();
|
|
14266
14015
|
const log = useLogger("useTaxDocument");
|
|
14267
|
-
const [state, setState] =
|
|
14268
|
-
|
|
14016
|
+
const [state, setState] = useState37(LOADING_STATE6);
|
|
14017
|
+
useEffect29(() => {
|
|
14269
14018
|
let isCancelled = false;
|
|
14270
14019
|
if (!isOpen) {
|
|
14271
14020
|
return () => {
|
|
@@ -14389,7 +14138,7 @@ function useTaxDocumentModalViewModel({
|
|
|
14389
14138
|
onSubmitted
|
|
14390
14139
|
}) {
|
|
14391
14140
|
const { state, onEditField, onStartEdit, onSaveEdit, onCancelEdit, onSign } = useTaxDocument({ isOpen });
|
|
14392
|
-
|
|
14141
|
+
useEffect30(() => {
|
|
14393
14142
|
if (state.type === "SUBMITTED") {
|
|
14394
14143
|
onSubmitted?.(state.submission);
|
|
14395
14144
|
onClose();
|
|
@@ -14650,10 +14399,10 @@ function Screen2({
|
|
|
14650
14399
|
}
|
|
14651
14400
|
|
|
14652
14401
|
// src/client/hooks/requirements/wallet/useConnectWalletModalViewModel.ts
|
|
14653
|
-
import { useCallback as useCallback15, useEffect as
|
|
14402
|
+
import { useCallback as useCallback15, useEffect as useEffect32, useMemo as useMemo12 } from "react";
|
|
14654
14403
|
|
|
14655
14404
|
// src/client/hooks/requirements/data/useConnectWallet.ts
|
|
14656
|
-
import { useCallback as useCallback14, useEffect as
|
|
14405
|
+
import { useCallback as useCallback14, useEffect as useEffect31, useRef as useRef20, useState as useState38 } from "react";
|
|
14657
14406
|
|
|
14658
14407
|
// src/client/core/wallets/connect-external-wallet.ts
|
|
14659
14408
|
var DEFAULT_STATEMENT = "Sign this message to prove you own this wallet. This does not cost gas or move funds.";
|
|
@@ -14784,18 +14533,18 @@ function useConnectWallet({
|
|
|
14784
14533
|
statement
|
|
14785
14534
|
}) {
|
|
14786
14535
|
const { coinlist } = useCoinList();
|
|
14787
|
-
const [state, setState] =
|
|
14536
|
+
const [state, setState] = useState38(
|
|
14788
14537
|
() => wallet ? { type: "READY", address: wallet.address, sign: IDLE_SIGN2 } : { type: "NEEDS_WALLET" }
|
|
14789
14538
|
);
|
|
14790
|
-
const attempt =
|
|
14791
|
-
|
|
14539
|
+
const attempt = useRef20(0);
|
|
14540
|
+
useEffect31(() => {
|
|
14792
14541
|
attempt.current += 1;
|
|
14793
14542
|
if (!isOpen) return;
|
|
14794
14543
|
setState(
|
|
14795
14544
|
wallet ? { type: "READY", address: wallet.address, sign: IDLE_SIGN2 } : { type: "NEEDS_WALLET" }
|
|
14796
14545
|
);
|
|
14797
14546
|
}, [isOpen, wallet?.address]);
|
|
14798
|
-
|
|
14547
|
+
useEffect31(
|
|
14799
14548
|
() => () => {
|
|
14800
14549
|
attempt.current += 1;
|
|
14801
14550
|
},
|
|
@@ -14863,7 +14612,7 @@ function useConnectWalletModalViewModel({
|
|
|
14863
14612
|
challengeType,
|
|
14864
14613
|
statement
|
|
14865
14614
|
});
|
|
14866
|
-
|
|
14615
|
+
useEffect32(() => {
|
|
14867
14616
|
if (state.type === "CONNECTED") {
|
|
14868
14617
|
onConnected?.(state.binding);
|
|
14869
14618
|
onClose();
|
|
@@ -14935,10 +14684,10 @@ function ConnectWalletModalContainer({
|
|
|
14935
14684
|
}
|
|
14936
14685
|
|
|
14937
14686
|
// src/client/hooks/requirements/useRequirementsChecklistViewModel.ts
|
|
14938
|
-
import { useCallback as useCallback18, useEffect as
|
|
14687
|
+
import { useCallback as useCallback18, useEffect as useEffect35, useMemo as useMemo13, useRef as useRef21, useState as useState41 } from "react";
|
|
14939
14688
|
|
|
14940
14689
|
// src/client/hooks/requirements/data/useOptionAddresses.ts
|
|
14941
|
-
import { useCallback as useCallback16, useEffect as
|
|
14690
|
+
import { useCallback as useCallback16, useEffect as useEffect33, useState as useState39 } from "react";
|
|
14942
14691
|
var LOADING_STATE7 = { type: "LOADING" };
|
|
14943
14692
|
var EMPTY_STATE = {
|
|
14944
14693
|
type: "CONTENT",
|
|
@@ -14948,10 +14697,10 @@ function useOptionAddresses(offerId, offerOptionId, options = {}) {
|
|
|
14948
14697
|
const { coinlist, isReady } = useCoinList();
|
|
14949
14698
|
const log = useLogger("useOptionAddresses");
|
|
14950
14699
|
const { data, enabled = true } = options;
|
|
14951
|
-
const [addressesState, setAddressesState] =
|
|
14700
|
+
const [addressesState, setAddressesState] = useState39(
|
|
14952
14701
|
data !== void 0 ? { type: "CONTENT", addresses: data } : LOADING_STATE7
|
|
14953
14702
|
);
|
|
14954
|
-
const [fetchKey, setFetchKey] =
|
|
14703
|
+
const [fetchKey, setFetchKey] = useState39(0);
|
|
14955
14704
|
const refetch = useCallback16(() => setFetchKey((k) => k + 1), []);
|
|
14956
14705
|
const disconnect = useCallback16(
|
|
14957
14706
|
async (addressId) => {
|
|
@@ -14960,7 +14709,7 @@ function useOptionAddresses(offerId, offerOptionId, options = {}) {
|
|
|
14960
14709
|
},
|
|
14961
14710
|
[coinlist, offerId, refetch]
|
|
14962
14711
|
);
|
|
14963
|
-
|
|
14712
|
+
useEffect33(() => {
|
|
14964
14713
|
let isCancelled = false;
|
|
14965
14714
|
if (!enabled) {
|
|
14966
14715
|
setAddressesState(
|
|
@@ -15016,18 +14765,18 @@ function useOptionAddresses(offerId, offerOptionId, options = {}) {
|
|
|
15016
14765
|
}
|
|
15017
14766
|
|
|
15018
14767
|
// src/client/hooks/requirements/data/useRequirements.ts
|
|
15019
|
-
import { useCallback as useCallback17, useEffect as
|
|
14768
|
+
import { useCallback as useCallback17, useEffect as useEffect34, useState as useState40 } from "react";
|
|
15020
14769
|
var LOADING_STATE8 = { type: "LOADING" };
|
|
15021
14770
|
function useRequirements(offerId, options = {}) {
|
|
15022
14771
|
const { coinlist, isReady } = useCoinList();
|
|
15023
14772
|
const log = useLogger("useRequirements");
|
|
15024
14773
|
const { data, enabled = true } = options;
|
|
15025
|
-
const [requirementsState, setRequirementsState] =
|
|
14774
|
+
const [requirementsState, setRequirementsState] = useState40(
|
|
15026
14775
|
data !== void 0 ? { type: "CONTENT", ...data } : LOADING_STATE8
|
|
15027
14776
|
);
|
|
15028
|
-
const [fetchKey, setFetchKey] =
|
|
14777
|
+
const [fetchKey, setFetchKey] = useState40(0);
|
|
15029
14778
|
const refetch = useCallback17(() => setFetchKey((k) => k + 1), []);
|
|
15030
|
-
|
|
14779
|
+
useEffect34(() => {
|
|
15031
14780
|
let isCancelled = false;
|
|
15032
14781
|
if (!enabled) {
|
|
15033
14782
|
return () => {
|
|
@@ -15221,19 +14970,19 @@ function useRequirementsChecklistViewModel(options) {
|
|
|
15221
14970
|
data,
|
|
15222
14971
|
enabled
|
|
15223
14972
|
});
|
|
15224
|
-
const [expandedId, setExpandedId] =
|
|
15225
|
-
const [taxDocumentOpen, setTaxDocumentOpen] =
|
|
15226
|
-
const [connectWalletOpen, setConnectWalletOpen] =
|
|
15227
|
-
const [verifyingRequirementId, setVerifyingRequirementId] =
|
|
15228
|
-
const isMountedRef =
|
|
15229
|
-
|
|
14973
|
+
const [expandedId, setExpandedId] = useState41(null);
|
|
14974
|
+
const [taxDocumentOpen, setTaxDocumentOpen] = useState41(false);
|
|
14975
|
+
const [connectWalletOpen, setConnectWalletOpen] = useState41(false);
|
|
14976
|
+
const [verifyingRequirementId, setVerifyingRequirementId] = useState41(null);
|
|
14977
|
+
const isMountedRef = useRef21(true);
|
|
14978
|
+
useEffect35(() => {
|
|
15230
14979
|
isMountedRef.current = true;
|
|
15231
14980
|
return () => {
|
|
15232
14981
|
isMountedRef.current = false;
|
|
15233
14982
|
};
|
|
15234
14983
|
}, []);
|
|
15235
|
-
const [hasWalletRequirement, setHasWalletRequirement] =
|
|
15236
|
-
|
|
14984
|
+
const [hasWalletRequirement, setHasWalletRequirement] = useState41(false);
|
|
14985
|
+
useEffect35(() => {
|
|
15237
14986
|
if (requirementsState.type === "CONTENT") {
|
|
15238
14987
|
setHasWalletRequirement(
|
|
15239
14988
|
(requirementsState.requirements[optionId] ?? []).some(
|
|
@@ -15575,18 +15324,18 @@ function pinoClientLogger(options) {
|
|
|
15575
15324
|
}
|
|
15576
15325
|
|
|
15577
15326
|
// src/client/hooks/auth/useCompleteOAuth.ts
|
|
15578
|
-
import { useEffect as
|
|
15327
|
+
import { useEffect as useEffect36, useRef as useRef22 } from "react";
|
|
15579
15328
|
function useCompleteOAuth(options) {
|
|
15580
15329
|
const { coinlist } = useCoinList();
|
|
15581
15330
|
const log = useLogger("useCompleteOAuth");
|
|
15582
|
-
const postOAuthCompleteRef =
|
|
15583
|
-
const onFailureRef =
|
|
15584
|
-
const onSuccessRef =
|
|
15331
|
+
const postOAuthCompleteRef = useRef22(options.postOAuthComplete);
|
|
15332
|
+
const onFailureRef = useRef22(options.onFailure);
|
|
15333
|
+
const onSuccessRef = useRef22(options.onSuccess);
|
|
15585
15334
|
postOAuthCompleteRef.current = options.postOAuthComplete;
|
|
15586
15335
|
onFailureRef.current = options.onFailure;
|
|
15587
15336
|
onSuccessRef.current = options.onSuccess;
|
|
15588
|
-
const hasStartedExchangeRef =
|
|
15589
|
-
|
|
15337
|
+
const hasStartedExchangeRef = useRef22(false);
|
|
15338
|
+
useEffect36(() => {
|
|
15590
15339
|
if (typeof window === "undefined") return;
|
|
15591
15340
|
const params = new URLSearchParams(window.location.search);
|
|
15592
15341
|
if (!params.has("code") && !params.has("error")) return;
|
|
@@ -15650,12 +15399,12 @@ function useCompleteOAuth(options) {
|
|
|
15650
15399
|
}
|
|
15651
15400
|
|
|
15652
15401
|
// src/client/hooks/checkout/centrifuge/buy/data/useCentrifugeBuyTransaction.ts
|
|
15653
|
-
import { useCallback as useCallback19, useEffect as
|
|
15402
|
+
import { useCallback as useCallback19, useEffect as useEffect37, useRef as useRef23, useState as useState42 } from "react";
|
|
15654
15403
|
function useCentrifugeBuyTransaction(options) {
|
|
15655
15404
|
const { request, data, enabled } = options;
|
|
15656
15405
|
const { coinlist, isReady } = useCoinList();
|
|
15657
15406
|
const log = useLogger("useCentrifugeBuyTransaction");
|
|
15658
|
-
const [state, setState] =
|
|
15407
|
+
const [state, setState] = useState42(
|
|
15659
15408
|
() => data === void 0 ? { type: "LOADING" } : {
|
|
15660
15409
|
type: "CONTENT",
|
|
15661
15410
|
transaction: data,
|
|
@@ -15663,10 +15412,10 @@ function useCentrifugeBuyTransaction(options) {
|
|
|
15663
15412
|
refreshError: null
|
|
15664
15413
|
}
|
|
15665
15414
|
);
|
|
15666
|
-
const fetchIdRef =
|
|
15667
|
-
const isFetchingRef =
|
|
15415
|
+
const fetchIdRef = useRef23(0);
|
|
15416
|
+
const isFetchingRef = useRef23(false);
|
|
15668
15417
|
const requestKey = request === null ? null : stableKey3(request);
|
|
15669
|
-
const requestRef =
|
|
15418
|
+
const requestRef = useRef23(request);
|
|
15670
15419
|
requestRef.current = request;
|
|
15671
15420
|
const build = useCallback19(async () => {
|
|
15672
15421
|
const params = requestRef.current;
|
|
@@ -15703,7 +15452,7 @@ function useCentrifugeBuyTransaction(options) {
|
|
|
15703
15452
|
}
|
|
15704
15453
|
}
|
|
15705
15454
|
}, [coinlist, isReady, enabled, log]);
|
|
15706
|
-
|
|
15455
|
+
useEffect37(() => {
|
|
15707
15456
|
if (data === void 0) return;
|
|
15708
15457
|
++fetchIdRef.current;
|
|
15709
15458
|
setState({
|
|
@@ -15714,7 +15463,7 @@ function useCentrifugeBuyTransaction(options) {
|
|
|
15714
15463
|
});
|
|
15715
15464
|
}, [data]);
|
|
15716
15465
|
const hasSeed = data !== void 0;
|
|
15717
|
-
|
|
15466
|
+
useEffect37(() => {
|
|
15718
15467
|
if (hasSeed || requestKey === null) return;
|
|
15719
15468
|
isFetchingRef.current = false;
|
|
15720
15469
|
build();
|
|
@@ -15738,16 +15487,16 @@ function stableKey3(request) {
|
|
|
15738
15487
|
}
|
|
15739
15488
|
|
|
15740
15489
|
// src/client/hooks/checkout/coin-list/token-sale/data/useParticipations.ts
|
|
15741
|
-
import { useEffect as
|
|
15490
|
+
import { useEffect as useEffect38, useState as useState43 } from "react";
|
|
15742
15491
|
var LOADING_STATE9 = { type: "LOADING" };
|
|
15743
15492
|
function useParticipations(offerId, options = {}) {
|
|
15744
15493
|
const { coinlist, isReady } = useCoinList();
|
|
15745
15494
|
const log = useLogger("useParticipations");
|
|
15746
15495
|
const { data, enabled = true } = options;
|
|
15747
|
-
const [participationsState, setParticipationsState] =
|
|
15496
|
+
const [participationsState, setParticipationsState] = useState43(
|
|
15748
15497
|
data !== void 0 ? { type: "CONTENT", participations: data } : LOADING_STATE9
|
|
15749
15498
|
);
|
|
15750
|
-
|
|
15499
|
+
useEffect38(() => {
|
|
15751
15500
|
let isCancelled = false;
|
|
15752
15501
|
if (!enabled) {
|
|
15753
15502
|
return () => {
|
|
@@ -15794,16 +15543,16 @@ function useParticipations(offerId, options = {}) {
|
|
|
15794
15543
|
}
|
|
15795
15544
|
|
|
15796
15545
|
// src/client/hooks/offers/data/useOfferDetails.ts
|
|
15797
|
-
import { useEffect as
|
|
15546
|
+
import { useEffect as useEffect39, useState as useState44 } from "react";
|
|
15798
15547
|
var LOADING_STATE10 = { type: "LOADING" };
|
|
15799
15548
|
function useOfferDetails(offerId, options = {}) {
|
|
15800
15549
|
const { coinlist, isReady } = useCoinList();
|
|
15801
15550
|
const log = useLogger("useOfferDetails");
|
|
15802
15551
|
const { data, enabled = true } = options;
|
|
15803
|
-
const [offerDetailsState, setOfferDetailsState] =
|
|
15552
|
+
const [offerDetailsState, setOfferDetailsState] = useState44(
|
|
15804
15553
|
data !== void 0 ? { type: "CONTENT", offerDetail: data } : LOADING_STATE10
|
|
15805
15554
|
);
|
|
15806
|
-
|
|
15555
|
+
useEffect39(() => {
|
|
15807
15556
|
let isCancelled = false;
|
|
15808
15557
|
if (!enabled) {
|
|
15809
15558
|
return () => {
|
|
@@ -15952,7 +15701,6 @@ export {
|
|
|
15952
15701
|
RequirementVariant,
|
|
15953
15702
|
RequirementsChecklistContainer,
|
|
15954
15703
|
RequirementsChecklistView,
|
|
15955
|
-
SETTLES_LATER,
|
|
15956
15704
|
SlippagePicker,
|
|
15957
15705
|
SuperstateAmountView,
|
|
15958
15706
|
SuperstateOrderConfirmed,
|
|
@@ -16008,7 +15756,6 @@ export {
|
|
|
16008
15756
|
useCentrifugeBuyReviewViewModel,
|
|
16009
15757
|
useCentrifugeBuyTransaction,
|
|
16010
15758
|
useCentrifugeClaim,
|
|
16011
|
-
useCentrifugeQuote,
|
|
16012
15759
|
useCentrifugeSidebarViewModel,
|
|
16013
15760
|
useCentrifugeVaultClaimViewModel,
|
|
16014
15761
|
useCentrifugeVaultPositions,
|