@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.cjs
CHANGED
|
@@ -102,7 +102,6 @@ __export(client_exports, {
|
|
|
102
102
|
RequirementVariant: () => RequirementVariant,
|
|
103
103
|
RequirementsChecklistContainer: () => RequirementsChecklistContainer,
|
|
104
104
|
RequirementsChecklistView: () => RequirementsChecklistView,
|
|
105
|
-
SETTLES_LATER: () => SETTLES_LATER,
|
|
106
105
|
SlippagePicker: () => SlippagePicker,
|
|
107
106
|
SuperstateAmountView: () => SuperstateAmountView,
|
|
108
107
|
SuperstateOrderConfirmed: () => SuperstateOrderConfirmed,
|
|
@@ -158,7 +157,6 @@ __export(client_exports, {
|
|
|
158
157
|
useCentrifugeBuyReviewViewModel: () => useCentrifugeBuyReviewViewModel,
|
|
159
158
|
useCentrifugeBuyTransaction: () => useCentrifugeBuyTransaction,
|
|
160
159
|
useCentrifugeClaim: () => useCentrifugeClaim,
|
|
161
|
-
useCentrifugeQuote: () => useCentrifugeQuote,
|
|
162
160
|
useCentrifugeSidebarViewModel: () => useCentrifugeSidebarViewModel,
|
|
163
161
|
useCentrifugeVaultClaimViewModel: () => useCentrifugeVaultClaimViewModel,
|
|
164
162
|
useCentrifugeVaultPositions: () => useCentrifugeVaultPositions,
|
|
@@ -2055,37 +2053,6 @@ function requiredArray(value, field) {
|
|
|
2055
2053
|
}
|
|
2056
2054
|
|
|
2057
2055
|
// src/universal/types/providers/centrifuge/centrifuge.ts
|
|
2058
|
-
var CentrifugeVaultQuote = {
|
|
2059
|
-
fromDto: (dto) => {
|
|
2060
|
-
const spendDecimals = AssetDecimals(dto.spend_input_decimals);
|
|
2061
|
-
const shareDecimals = AssetDecimals(dto.share_decimals);
|
|
2062
|
-
return {
|
|
2063
|
-
chain: EthereumChain(dto.chain),
|
|
2064
|
-
symbol: AssetSymbol(dto.symbol),
|
|
2065
|
-
spendInputAmount: blockchainAmountFromRawOrThrow({
|
|
2066
|
-
label: "spend_input_amount",
|
|
2067
|
-
raw: dto.spend_input_amount,
|
|
2068
|
-
decimals: spendDecimals
|
|
2069
|
-
}),
|
|
2070
|
-
estimatedShares: blockchainAmountFromRawOrThrow({
|
|
2071
|
-
label: "estimated_shares",
|
|
2072
|
-
raw: dto.estimated_shares,
|
|
2073
|
-
decimals: shareDecimals
|
|
2074
|
-
}),
|
|
2075
|
-
indicativePrice: decimalOrNull(dto.indicative_price),
|
|
2076
|
-
minimumInputAmount: dto.minimum_input_amount === null ? null : blockchainAmountFromRawOrThrow({
|
|
2077
|
-
label: "minimum_input_amount",
|
|
2078
|
-
raw: dto.minimum_input_amount,
|
|
2079
|
-
decimals: spendDecimals
|
|
2080
|
-
}),
|
|
2081
|
-
orderability: parseOrderability(
|
|
2082
|
-
dto.can_order,
|
|
2083
|
-
dto.reasons,
|
|
2084
|
-
"CentrifugeVaultQuote"
|
|
2085
|
-
)
|
|
2086
|
-
};
|
|
2087
|
-
}
|
|
2088
|
-
};
|
|
2089
2056
|
var CentrifugeVaultStatus = {
|
|
2090
2057
|
fromDto: (dto) => ({
|
|
2091
2058
|
chain: EthereumChain(dto.chain),
|
|
@@ -2124,12 +2091,7 @@ var CentrifugeVaultBuyTransaction = {
|
|
|
2124
2091
|
}
|
|
2125
2092
|
return {
|
|
2126
2093
|
...parseTransactionCore(dto, "CentrifugeVaultBuyTransaction"),
|
|
2127
|
-
spendInputAmount
|
|
2128
|
-
estimatedShares: blockchainAmountFromRawOrThrow({
|
|
2129
|
-
label: "estimated_shares",
|
|
2130
|
-
raw: dto.estimated_shares,
|
|
2131
|
-
decimals: AssetDecimals(dto.share_decimals)
|
|
2132
|
-
})
|
|
2094
|
+
spendInputAmount
|
|
2133
2095
|
};
|
|
2134
2096
|
}
|
|
2135
2097
|
};
|
|
@@ -2253,19 +2215,6 @@ function parseTransactionCore(dto, model) {
|
|
|
2253
2215
|
}
|
|
2254
2216
|
|
|
2255
2217
|
// src/universal/api/frontline/providers/centrifuge/centrifuge.ts
|
|
2256
|
-
async function getCentrifugeVaultQuote(api, params) {
|
|
2257
|
-
const dto = await api.send({
|
|
2258
|
-
method: "GET",
|
|
2259
|
-
url: "/v1/centrifuge/vault/quote",
|
|
2260
|
-
queryParams: {
|
|
2261
|
-
symbol: params.symbol,
|
|
2262
|
-
chain: params.chain,
|
|
2263
|
-
amount: params.amount.raw.toString()
|
|
2264
|
-
},
|
|
2265
|
-
attributes: Attributes.protected()
|
|
2266
|
-
});
|
|
2267
|
-
return CentrifugeVaultQuote.fromDto(dto);
|
|
2268
|
-
}
|
|
2269
2218
|
async function getCentrifugeVaultStatus(api, params) {
|
|
2270
2219
|
const dto = await api.send({
|
|
2271
2220
|
method: "GET",
|
|
@@ -2345,12 +2294,6 @@ var CentrifugeNamespaceImpl = class {
|
|
|
2345
2294
|
this.ctx = ctx;
|
|
2346
2295
|
this.log = internalLogger(ctx.logger, "CENTRIFUGE");
|
|
2347
2296
|
}
|
|
2348
|
-
async getQuote(params) {
|
|
2349
|
-
return this.log.wrap("getQuote", params, async () => {
|
|
2350
|
-
await this.ctx.ensureUserAuthenticated();
|
|
2351
|
-
return getCentrifugeVaultQuote(this.ctx.api, params);
|
|
2352
|
-
});
|
|
2353
|
-
}
|
|
2354
2297
|
async getVaultStatus(params) {
|
|
2355
2298
|
return this.log.wrap("getVaultStatus", params, async () => {
|
|
2356
2299
|
await this.ctx.ensureUserAuthenticated();
|
|
@@ -2461,10 +2404,6 @@ async function fetchAllPages(fetchPage, baseParams) {
|
|
|
2461
2404
|
|
|
2462
2405
|
// src/universal/core/checkout/centrifuge/constants.ts
|
|
2463
2406
|
var CENTRIFUGE_POLL_INTERVAL_MS = 15e3;
|
|
2464
|
-
var CENTRIFUGE_INDICATIVE_QUOTE_AMOUNT = BlockchainAmount({
|
|
2465
|
-
raw: 100000000n,
|
|
2466
|
-
decimals: STABLE_DECIMALS
|
|
2467
|
-
});
|
|
2468
2407
|
|
|
2469
2408
|
// src/universal/core/checkout/centrifuge/vaults.ts
|
|
2470
2409
|
function resolveCentrifugeVaults(offer, lookup) {
|
|
@@ -6533,7 +6472,7 @@ function CoinListSignInCardContainer({
|
|
|
6533
6472
|
}
|
|
6534
6473
|
|
|
6535
6474
|
// src/client/components/checkout/CheckoutContainer.tsx
|
|
6536
|
-
var
|
|
6475
|
+
var import_react40 = require("react");
|
|
6537
6476
|
|
|
6538
6477
|
// src/client/components/checkout/shared/amount/CheckoutAmountInput.tsx
|
|
6539
6478
|
var import_react8 = require("react");
|
|
@@ -7446,9 +7385,7 @@ function AssetSummaryRow({
|
|
|
7446
7385
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
7447
7386
|
var TITLE2 = "Request placed";
|
|
7448
7387
|
var SUBTITLE = "Your request is placed. It settles later, at the price the fund sets then.";
|
|
7449
|
-
var ESTIMATED_SHARES_LABEL = "Estimated shares";
|
|
7450
7388
|
var AMOUNT_INVESTED_LABEL = "Amount invested";
|
|
7451
|
-
var INDICATIVE_PRICE_LABEL = "Indicative price";
|
|
7452
7389
|
var WALLET_LABEL = "Wallet";
|
|
7453
7390
|
var DONE_LABEL = "Done";
|
|
7454
7391
|
function CentrifugeBuyOrderPlaced({
|
|
@@ -7477,9 +7414,7 @@ function CentrifugeBuyOrderPlaced({
|
|
|
7477
7414
|
}
|
|
7478
7415
|
function detailRows(state) {
|
|
7479
7416
|
return [
|
|
7480
|
-
{ label: ESTIMATED_SHARES_LABEL, value: state.outputAmount },
|
|
7481
7417
|
{ label: AMOUNT_INVESTED_LABEL, value: state.totalCost },
|
|
7482
|
-
{ label: INDICATIVE_PRICE_LABEL, value: state.pricePerShare },
|
|
7483
7418
|
{ label: WALLET_LABEL, value: state.recipientAddress }
|
|
7484
7419
|
];
|
|
7485
7420
|
}
|
|
@@ -7523,48 +7458,11 @@ function CheckoutReviewDisclaimerLink({
|
|
|
7523
7458
|
);
|
|
7524
7459
|
}
|
|
7525
7460
|
|
|
7526
|
-
// src/client/components/checkout/shared/review/CheckoutReviewError.tsx
|
|
7527
|
-
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
7528
|
-
var RETRY_LABEL = "Try again";
|
|
7529
|
-
function CheckoutReviewError({
|
|
7530
|
-
title: title2,
|
|
7531
|
-
heading,
|
|
7532
|
-
description: description2,
|
|
7533
|
-
onRetry,
|
|
7534
|
-
className
|
|
7535
|
-
}) {
|
|
7536
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CheckoutStepCard, { state: "active", title: title2, className, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:items-center clcosdk:gap-4 clcosdk:py-8 clcosdk:text-center", children: [
|
|
7537
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:items-center clcosdk:gap-2", children: [
|
|
7538
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7539
|
-
"h3",
|
|
7540
|
-
{
|
|
7541
|
-
className: cn(
|
|
7542
|
-
typeClasses.h4,
|
|
7543
|
-
"clcosdk:font-medium clcosdk:text-text-primary"
|
|
7544
|
-
),
|
|
7545
|
-
children: heading
|
|
7546
|
-
}
|
|
7547
|
-
),
|
|
7548
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7549
|
-
"p",
|
|
7550
|
-
{
|
|
7551
|
-
className: cn(
|
|
7552
|
-
typeClasses.body,
|
|
7553
|
-
"clcosdk:max-w-md clcosdk:text-text-secondary"
|
|
7554
|
-
),
|
|
7555
|
-
children: description2
|
|
7556
|
-
}
|
|
7557
|
-
)
|
|
7558
|
-
] }),
|
|
7559
|
-
onRetry !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ClButton, { variant: "secondary", onClick: onRetry, children: RETRY_LABEL })
|
|
7560
|
-
] }) }) });
|
|
7561
|
-
}
|
|
7562
|
-
|
|
7563
7461
|
// src/client/components/checkout/shared/review/CheckoutReviewInfoIcon.tsx
|
|
7564
7462
|
var import_lucide_react5 = require("lucide-react");
|
|
7565
|
-
var
|
|
7463
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
7566
7464
|
function CheckoutReviewInfoIcon() {
|
|
7567
|
-
return /* @__PURE__ */ (0,
|
|
7465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7568
7466
|
import_lucide_react5.Info,
|
|
7569
7467
|
{
|
|
7570
7468
|
className: "clcosdk:size-4 clcosdk:text-text-secondary",
|
|
@@ -7573,85 +7471,8 @@ function CheckoutReviewInfoIcon() {
|
|
|
7573
7471
|
) });
|
|
7574
7472
|
}
|
|
7575
7473
|
|
|
7576
|
-
// src/client/components/design-system/Skeleton.tsx
|
|
7577
|
-
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
7578
|
-
var variantClasses = {
|
|
7579
|
-
text: "clcosdk:rounded-md",
|
|
7580
|
-
circular: "clcosdk:rounded-full",
|
|
7581
|
-
rectangular: "clcosdk:rounded-2xl"
|
|
7582
|
-
};
|
|
7583
|
-
function Skeleton({ variant = "text", className }) {
|
|
7584
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
7585
|
-
"div",
|
|
7586
|
-
{
|
|
7587
|
-
"aria-hidden": "true",
|
|
7588
|
-
className: cn(
|
|
7589
|
-
"clcosdk:animate-pulse clcosdk:bg-section",
|
|
7590
|
-
variantClasses[variant],
|
|
7591
|
-
className
|
|
7592
|
-
)
|
|
7593
|
-
}
|
|
7594
|
-
);
|
|
7595
|
-
}
|
|
7596
|
-
|
|
7597
|
-
// src/client/components/checkout/shared/review/CheckoutReviewLoading.tsx
|
|
7598
|
-
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
7599
|
-
var DETAIL_ROW_KEYS = ["first", "second", "third", "fourth"];
|
|
7600
|
-
function CheckoutReviewLoading({
|
|
7601
|
-
title: title2,
|
|
7602
|
-
statusLabel,
|
|
7603
|
-
detailRowCount,
|
|
7604
|
-
showTotal = true,
|
|
7605
|
-
className
|
|
7606
|
-
}) {
|
|
7607
|
-
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(CheckoutStepCard, { state: "active", title: title2, className, children: [
|
|
7608
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("output", { className: "clcosdk:sr-only", children: statusLabel }),
|
|
7609
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4 clcosdk:rounded-2xl clcosdk:border clcosdk:border-border clcosdk:p-4", children: [
|
|
7610
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Skeleton, { className: "clcosdk:h-3 clcosdk:w-20" }),
|
|
7611
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "clcosdk:flex clcosdk:items-center clcosdk:gap-3", children: [
|
|
7612
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
7613
|
-
Skeleton,
|
|
7614
|
-
{
|
|
7615
|
-
variant: "circular",
|
|
7616
|
-
className: "clcosdk:size-10 clcosdk:shrink-0"
|
|
7617
|
-
}
|
|
7618
|
-
),
|
|
7619
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-2", children: [
|
|
7620
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Skeleton, { className: "clcosdk:h-5 clcosdk:w-32" }),
|
|
7621
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Skeleton, { className: "clcosdk:h-3 clcosdk:w-24" })
|
|
7622
|
-
] })
|
|
7623
|
-
] })
|
|
7624
|
-
] }),
|
|
7625
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-3 clcosdk:px-2", children: DETAIL_ROW_KEYS.slice(0, detailRowCount).map((row) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
7626
|
-
"div",
|
|
7627
|
-
{
|
|
7628
|
-
className: "clcosdk:flex clcosdk:items-center clcosdk:justify-between clcosdk:gap-4",
|
|
7629
|
-
children: [
|
|
7630
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Skeleton, { className: "clcosdk:h-4 clcosdk:w-28" }),
|
|
7631
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Skeleton, { className: "clcosdk:h-4 clcosdk:w-24" })
|
|
7632
|
-
]
|
|
7633
|
-
},
|
|
7634
|
-
row
|
|
7635
|
-
)) }),
|
|
7636
|
-
showTotal && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
7637
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "clcosdk:h-px clcosdk:shrink-0 clcosdk:bg-divider" }),
|
|
7638
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "clcosdk:flex clcosdk:items-center clcosdk:justify-between clcosdk:gap-4 clcosdk:px-2", children: [
|
|
7639
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Skeleton, { className: "clcosdk:h-4 clcosdk:w-16" }),
|
|
7640
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Skeleton, { className: "clcosdk:h-4 clcosdk:w-20" })
|
|
7641
|
-
] })
|
|
7642
|
-
] }),
|
|
7643
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
7644
|
-
Skeleton,
|
|
7645
|
-
{
|
|
7646
|
-
variant: "rectangular",
|
|
7647
|
-
className: "clcosdk:h-[54px] clcosdk:w-full clcosdk:rounded-full"
|
|
7648
|
-
}
|
|
7649
|
-
)
|
|
7650
|
-
] }) });
|
|
7651
|
-
}
|
|
7652
|
-
|
|
7653
7474
|
// src/client/components/checkout/shared/review/CheckoutReviewQuoteLine.tsx
|
|
7654
|
-
var
|
|
7475
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
7655
7476
|
function CheckoutReviewQuoteLine({
|
|
7656
7477
|
tone,
|
|
7657
7478
|
children
|
|
@@ -7661,7 +7482,7 @@ function CheckoutReviewQuoteLine({
|
|
|
7661
7482
|
warning: "clcosdk:text-warning",
|
|
7662
7483
|
error: "clcosdk:text-error"
|
|
7663
7484
|
}[tone];
|
|
7664
|
-
return /* @__PURE__ */ (0,
|
|
7485
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
7665
7486
|
"p",
|
|
7666
7487
|
{
|
|
7667
7488
|
className: cn(
|
|
@@ -7676,7 +7497,7 @@ function CheckoutReviewQuoteLine({
|
|
|
7676
7497
|
|
|
7677
7498
|
// src/client/components/design-system/Tooltip.tsx
|
|
7678
7499
|
var import_react10 = require("react");
|
|
7679
|
-
var
|
|
7500
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
7680
7501
|
var positionClasses = {
|
|
7681
7502
|
top: "clcosdk:bottom-full clcosdk:mb-2",
|
|
7682
7503
|
bottom: "clcosdk:top-full clcosdk:mt-2"
|
|
@@ -7688,7 +7509,7 @@ function Tooltip({
|
|
|
7688
7509
|
className
|
|
7689
7510
|
}) {
|
|
7690
7511
|
const tooltipId = (0, import_react10.useId)();
|
|
7691
|
-
return /* @__PURE__ */ (0,
|
|
7512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
7692
7513
|
"span",
|
|
7693
7514
|
{
|
|
7694
7515
|
tabIndex: 0,
|
|
@@ -7703,7 +7524,7 @@ function Tooltip({
|
|
|
7703
7524
|
),
|
|
7704
7525
|
children: [
|
|
7705
7526
|
children,
|
|
7706
|
-
/* @__PURE__ */ (0,
|
|
7527
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
7707
7528
|
"span",
|
|
7708
7529
|
{
|
|
7709
7530
|
id: tooltipId,
|
|
@@ -7726,21 +7547,15 @@ function Tooltip({
|
|
|
7726
7547
|
}
|
|
7727
7548
|
|
|
7728
7549
|
// src/client/components/checkout/centrifuge/buy/review/CentrifugeBuyReviewView.tsx
|
|
7729
|
-
var
|
|
7550
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
7730
7551
|
var TITLE3 = "3. Review and confirm";
|
|
7731
7552
|
var YOU_INVEST_LABEL = "You invest";
|
|
7732
|
-
var APPROXIMATE_TOOLTIP = "An estimate. The fund prices the deposit later, so the shares can differ.";
|
|
7733
7553
|
var RECEIVING_WALLET_LABEL = "Receiving wallet";
|
|
7734
7554
|
var COINLIST_FEE_LABEL = "CoinList fee";
|
|
7735
7555
|
var COINLIST_FEE_TOOLTIP = "CoinList does not charge a fee on this deposit. The total is the amount you invest.";
|
|
7736
7556
|
var TOTAL_LABEL = "Total";
|
|
7737
|
-
var REFRESH_ESTIMATE_LABEL = "Refresh estimate";
|
|
7738
|
-
var REFRESHING_ESTIMATE_LABEL = "Refreshing estimate\u2026";
|
|
7739
|
-
var LOADING_STATUS = "Loading your request\u2026";
|
|
7740
|
-
var ERROR_TITLE = "Something went wrong";
|
|
7741
|
-
var ERROR_DESCRIPTION = "We couldn't load your request. Please try again.";
|
|
7742
7557
|
function CentrifugeBuyReviewView(props) {
|
|
7743
|
-
return /* @__PURE__ */ (0,
|
|
7558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CentrifugeReviewViewBody, { ...props }) });
|
|
7744
7559
|
}
|
|
7745
7560
|
function CentrifugeReviewViewBody({
|
|
7746
7561
|
state,
|
|
@@ -7749,7 +7564,7 @@ function CentrifugeReviewViewBody({
|
|
|
7749
7564
|
}) {
|
|
7750
7565
|
switch (state.type) {
|
|
7751
7566
|
case "incomplete":
|
|
7752
|
-
return /* @__PURE__ */ (0,
|
|
7567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
7753
7568
|
CheckoutStepCard,
|
|
7754
7569
|
{
|
|
7755
7570
|
state: "inactive",
|
|
@@ -7757,29 +7572,8 @@ function CentrifugeReviewViewBody({
|
|
|
7757
7572
|
className
|
|
7758
7573
|
}
|
|
7759
7574
|
);
|
|
7760
|
-
case "loading":
|
|
7761
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7762
|
-
CheckoutReviewLoading,
|
|
7763
|
-
{
|
|
7764
|
-
title: TITLE3,
|
|
7765
|
-
statusLabel: LOADING_STATUS,
|
|
7766
|
-
detailRowCount: 2,
|
|
7767
|
-
className
|
|
7768
|
-
}
|
|
7769
|
-
);
|
|
7770
|
-
case "error":
|
|
7771
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7772
|
-
CheckoutReviewError,
|
|
7773
|
-
{
|
|
7774
|
-
title: TITLE3,
|
|
7775
|
-
heading: ERROR_TITLE,
|
|
7776
|
-
description: ERROR_DESCRIPTION,
|
|
7777
|
-
onRetry: () => onEvent({ type: "ON_RETRY" }),
|
|
7778
|
-
className
|
|
7779
|
-
}
|
|
7780
|
-
);
|
|
7781
7575
|
case "active":
|
|
7782
|
-
return /* @__PURE__ */ (0,
|
|
7576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ActiveView2, { state, onEvent, className });
|
|
7783
7577
|
default: {
|
|
7784
7578
|
const exhaustive = state;
|
|
7785
7579
|
return exhaustive;
|
|
@@ -7791,52 +7585,34 @@ function ActiveView2({
|
|
|
7791
7585
|
onEvent,
|
|
7792
7586
|
className
|
|
7793
7587
|
}) {
|
|
7794
|
-
return /* @__PURE__ */ (0,
|
|
7795
|
-
/* @__PURE__ */ (0,
|
|
7796
|
-
/* @__PURE__ */ (0,
|
|
7797
|
-
/* @__PURE__ */ (0,
|
|
7798
|
-
/* @__PURE__ */ (0,
|
|
7799
|
-
/* @__PURE__ */ (0,
|
|
7800
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("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 }),
|
|
7801
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
7802
|
-
"span",
|
|
7803
|
-
{
|
|
7804
|
-
className: cn(
|
|
7805
|
-
typeClasses.bodySm,
|
|
7806
|
-
"clcosdk:flex clcosdk:min-w-0 clcosdk:items-center clcosdk:gap-1 clcosdk:text-text-secondary"
|
|
7807
|
-
),
|
|
7808
|
-
children: [
|
|
7809
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("span", { className: "clcosdk:min-w-0 clcosdk:break-words", children: [
|
|
7810
|
-
"\u2248 ",
|
|
7811
|
-
state.approximateAmount
|
|
7812
|
-
] }),
|
|
7813
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Tooltip, { content: APPROXIMATE_TOOLTIP, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CheckoutReviewInfoIcon, {}) })
|
|
7814
|
-
]
|
|
7815
|
-
}
|
|
7816
|
-
)
|
|
7817
|
-
] })
|
|
7588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(CheckoutStepCard, { state: "active", title: TITLE3, className, children: [
|
|
7589
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4 clcosdk:rounded-2xl clcosdk:border clcosdk:border-border clcosdk:p-4", children: [
|
|
7590
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: cn(typeClasses.bodySm, "clcosdk:text-text-secondary"), children: YOU_INVEST_LABEL }),
|
|
7591
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "clcosdk:flex clcosdk:min-w-0 clcosdk:items-center clcosdk:gap-3", children: [
|
|
7592
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AssetIcon, { asset: state.inputAsset, size: 40 }),
|
|
7593
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "clcosdk:flex clcosdk:min-w-0 clcosdk:flex-col clcosdk:gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("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 }) })
|
|
7818
7594
|
] })
|
|
7819
7595
|
] }),
|
|
7820
|
-
/* @__PURE__ */ (0,
|
|
7821
|
-
/* @__PURE__ */ (0,
|
|
7822
|
-
/* @__PURE__ */ (0,
|
|
7596
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4", children: [
|
|
7597
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-3 clcosdk:px-2", children: [
|
|
7598
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
7823
7599
|
DetailRow,
|
|
7824
7600
|
{
|
|
7825
7601
|
label: RECEIVING_WALLET_LABEL,
|
|
7826
7602
|
value: state.recipientAddress
|
|
7827
7603
|
}
|
|
7828
7604
|
),
|
|
7829
|
-
/* @__PURE__ */ (0,
|
|
7605
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
7830
7606
|
DetailRow,
|
|
7831
7607
|
{
|
|
7832
7608
|
label: COINLIST_FEE_LABEL,
|
|
7833
|
-
tooltip: /* @__PURE__ */ (0,
|
|
7609
|
+
tooltip: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Tooltip, { content: COINLIST_FEE_TOOLTIP, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CheckoutReviewInfoIcon, {}) }),
|
|
7834
7610
|
value: state.coinlistFee
|
|
7835
7611
|
}
|
|
7836
7612
|
)
|
|
7837
7613
|
] }),
|
|
7838
|
-
/* @__PURE__ */ (0,
|
|
7839
|
-
/* @__PURE__ */ (0,
|
|
7614
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "clcosdk:h-px clcosdk:shrink-0 clcosdk:bg-divider" }),
|
|
7615
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
7840
7616
|
DetailRow,
|
|
7841
7617
|
{
|
|
7842
7618
|
label: TOTAL_LABEL,
|
|
@@ -7846,15 +7622,8 @@ function ActiveView2({
|
|
|
7846
7622
|
}
|
|
7847
7623
|
)
|
|
7848
7624
|
] }),
|
|
7849
|
-
state.error !== null && /* @__PURE__ */ (0,
|
|
7850
|
-
/* @__PURE__ */ (0,
|
|
7851
|
-
EstimateRefresh,
|
|
7852
|
-
{
|
|
7853
|
-
isRefreshing: state.isRefreshing,
|
|
7854
|
-
onRefresh: () => onEvent({ type: "ON_REFRESH_ESTIMATE" })
|
|
7855
|
-
}
|
|
7856
|
-
),
|
|
7857
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7625
|
+
state.error !== null && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CheckoutReviewQuoteLine, { tone: "error", children: state.error }),
|
|
7626
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
7858
7627
|
ClButton,
|
|
7859
7628
|
{
|
|
7860
7629
|
variant: "gradient",
|
|
@@ -7867,41 +7636,27 @@ function ActiveView2({
|
|
|
7867
7636
|
children: "Place request"
|
|
7868
7637
|
}
|
|
7869
7638
|
),
|
|
7870
|
-
/* @__PURE__ */ (0,
|
|
7639
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Disclaimer, {})
|
|
7871
7640
|
] });
|
|
7872
7641
|
}
|
|
7873
|
-
function EstimateRefresh({
|
|
7874
|
-
isRefreshing,
|
|
7875
|
-
onRefresh
|
|
7876
|
-
}) {
|
|
7877
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CheckoutReviewQuoteLine, { tone: "muted", children: isRefreshing ? REFRESHING_ESTIMATE_LABEL : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
7878
|
-
"button",
|
|
7879
|
-
{
|
|
7880
|
-
type: "button",
|
|
7881
|
-
onClick: onRefresh,
|
|
7882
|
-
className: "clcosdk:cursor-pointer clcosdk:underline clcosdk:transition-opacity clcosdk:hover:opacity-80",
|
|
7883
|
-
children: REFRESH_ESTIMATE_LABEL
|
|
7884
|
-
}
|
|
7885
|
-
) });
|
|
7886
|
-
}
|
|
7887
7642
|
function Disclaimer() {
|
|
7888
|
-
return /* @__PURE__ */ (0,
|
|
7643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(CheckoutReviewDisclaimer, { children: [
|
|
7889
7644
|
"Your final token amount is determined by the share price when your investment is processed. By placing this order, you agree to CoinList's",
|
|
7890
7645
|
" ",
|
|
7891
|
-
/* @__PURE__ */ (0,
|
|
7646
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CheckoutReviewDisclaimerLink, { href: COINLIST_TOS_URL, children: "Terms of Service" }),
|
|
7892
7647
|
" ",
|
|
7893
7648
|
"and",
|
|
7894
7649
|
" ",
|
|
7895
|
-
/* @__PURE__ */ (0,
|
|
7650
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CheckoutReviewDisclaimerLink, { href: COINLIST_PRIVACY_URL, children: "Privacy Policy" }),
|
|
7896
7651
|
", and",
|
|
7897
7652
|
" ",
|
|
7898
|
-
/* @__PURE__ */ (0,
|
|
7653
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CheckoutReviewDisclaimerLink, { href: CENTRIFUGE_TOS_URL, children: "Centrifuge's Terms" }),
|
|
7899
7654
|
"."
|
|
7900
7655
|
] });
|
|
7901
7656
|
}
|
|
7902
7657
|
|
|
7903
7658
|
// src/client/components/checkout/centrifuge/shared/error/CentrifugeCheckoutError.tsx
|
|
7904
|
-
var
|
|
7659
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
7905
7660
|
var COPY = {
|
|
7906
7661
|
"unsupported-chain": {
|
|
7907
7662
|
title: "Not available on this network",
|
|
@@ -7917,7 +7672,7 @@ function CentrifugeCheckoutError({
|
|
|
7917
7672
|
className
|
|
7918
7673
|
}) {
|
|
7919
7674
|
const copy = COPY[reason];
|
|
7920
|
-
return /* @__PURE__ */ (0,
|
|
7675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
7921
7676
|
"div",
|
|
7922
7677
|
{
|
|
7923
7678
|
className: cn(
|
|
@@ -7925,8 +7680,8 @@ function CentrifugeCheckoutError({
|
|
|
7925
7680
|
"clcosdk:items-center clcosdk:gap-4 clcosdk:py-12 clcosdk:text-center",
|
|
7926
7681
|
className
|
|
7927
7682
|
),
|
|
7928
|
-
children: /* @__PURE__ */ (0,
|
|
7929
|
-
/* @__PURE__ */ (0,
|
|
7683
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:items-center clcosdk:gap-2", children: [
|
|
7684
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
7930
7685
|
"h2",
|
|
7931
7686
|
{
|
|
7932
7687
|
className: cn(
|
|
@@ -7936,7 +7691,7 @@ function CentrifugeCheckoutError({
|
|
|
7936
7691
|
children: copy.title
|
|
7937
7692
|
}
|
|
7938
7693
|
),
|
|
7939
|
-
/* @__PURE__ */ (0,
|
|
7694
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
7940
7695
|
"p",
|
|
7941
7696
|
{
|
|
7942
7697
|
className: cn(
|
|
@@ -7956,13 +7711,13 @@ var import_lucide_react6 = require("lucide-react");
|
|
|
7956
7711
|
var import_react11 = require("react");
|
|
7957
7712
|
|
|
7958
7713
|
// src/client/components/design-system/Card.tsx
|
|
7959
|
-
var
|
|
7714
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
7960
7715
|
var GAP_CLASS = {
|
|
7961
7716
|
md: "clcosdk:gap-4",
|
|
7962
7717
|
lg: "clcosdk:gap-6"
|
|
7963
7718
|
};
|
|
7964
7719
|
function Card({ children, gap = "lg", className }) {
|
|
7965
|
-
return /* @__PURE__ */ (0,
|
|
7720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
7966
7721
|
"div",
|
|
7967
7722
|
{
|
|
7968
7723
|
className: cn(
|
|
@@ -7979,7 +7734,7 @@ function Card({ children, gap = "lg", className }) {
|
|
|
7979
7734
|
}
|
|
7980
7735
|
|
|
7981
7736
|
// src/client/components/checkout/shared/sidebar/CheckoutSidebarCard.tsx
|
|
7982
|
-
var
|
|
7737
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
7983
7738
|
function CheckoutSidebarCard({
|
|
7984
7739
|
title: title2,
|
|
7985
7740
|
header,
|
|
@@ -7990,7 +7745,7 @@ function CheckoutSidebarCard({
|
|
|
7990
7745
|
}) {
|
|
7991
7746
|
const [expanded, setExpanded] = (0, import_react11.useState)(false);
|
|
7992
7747
|
const rowsId = (0, import_react11.useId)();
|
|
7993
|
-
return /* @__PURE__ */ (0,
|
|
7748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
7994
7749
|
Card,
|
|
7995
7750
|
{
|
|
7996
7751
|
className: cn(
|
|
@@ -7999,8 +7754,8 @@ function CheckoutSidebarCard({
|
|
|
7999
7754
|
className
|
|
8000
7755
|
),
|
|
8001
7756
|
children: [
|
|
8002
|
-
/* @__PURE__ */ (0,
|
|
8003
|
-
/* @__PURE__ */ (0,
|
|
7757
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "clcosdk:flex clcosdk:min-w-0 clcosdk:flex-col clcosdk:gap-4", children: [
|
|
7758
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8004
7759
|
"h2",
|
|
8005
7760
|
{
|
|
8006
7761
|
className: cn(
|
|
@@ -8012,7 +7767,7 @@ function CheckoutSidebarCard({
|
|
|
8012
7767
|
),
|
|
8013
7768
|
header
|
|
8014
7769
|
] }),
|
|
8015
|
-
/* @__PURE__ */ (0,
|
|
7770
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8016
7771
|
"div",
|
|
8017
7772
|
{
|
|
8018
7773
|
className: cn(
|
|
@@ -8021,7 +7776,7 @@ function CheckoutSidebarCard({
|
|
|
8021
7776
|
)
|
|
8022
7777
|
}
|
|
8023
7778
|
),
|
|
8024
|
-
/* @__PURE__ */ (0,
|
|
7779
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8025
7780
|
CheckoutDetailList,
|
|
8026
7781
|
{
|
|
8027
7782
|
id: rowsId,
|
|
@@ -8030,7 +7785,7 @@ function CheckoutSidebarCard({
|
|
|
8030
7785
|
className: cn("clcosdk:px-2", !expanded && "clcosdk:max-md:hidden")
|
|
8031
7786
|
}
|
|
8032
7787
|
),
|
|
8033
|
-
/* @__PURE__ */ (0,
|
|
7788
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
8034
7789
|
"button",
|
|
8035
7790
|
{
|
|
8036
7791
|
type: "button",
|
|
@@ -8049,7 +7804,7 @@ function CheckoutSidebarCard({
|
|
|
8049
7804
|
),
|
|
8050
7805
|
children: [
|
|
8051
7806
|
expanded ? hideDetailsLabel : showDetailsLabel,
|
|
8052
|
-
expanded ? /* @__PURE__ */ (0,
|
|
7807
|
+
expanded ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react6.ChevronUp, { className: "clcosdk:size-4", "aria-hidden": "true" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_lucide_react6.ChevronDown, { className: "clcosdk:size-4", "aria-hidden": "true" })
|
|
8053
7808
|
]
|
|
8054
7809
|
}
|
|
8055
7810
|
)
|
|
@@ -8058,8 +7813,29 @@ function CheckoutSidebarCard({
|
|
|
8058
7813
|
) });
|
|
8059
7814
|
}
|
|
8060
7815
|
|
|
7816
|
+
// src/client/components/design-system/Skeleton.tsx
|
|
7817
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
7818
|
+
var variantClasses = {
|
|
7819
|
+
text: "clcosdk:rounded-md",
|
|
7820
|
+
circular: "clcosdk:rounded-full",
|
|
7821
|
+
rectangular: "clcosdk:rounded-2xl"
|
|
7822
|
+
};
|
|
7823
|
+
function Skeleton({ variant = "text", className }) {
|
|
7824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
7825
|
+
"div",
|
|
7826
|
+
{
|
|
7827
|
+
"aria-hidden": "true",
|
|
7828
|
+
className: cn(
|
|
7829
|
+
"clcosdk:animate-pulse clcosdk:bg-section",
|
|
7830
|
+
variantClasses[variant],
|
|
7831
|
+
className
|
|
7832
|
+
)
|
|
7833
|
+
}
|
|
7834
|
+
);
|
|
7835
|
+
}
|
|
7836
|
+
|
|
8061
7837
|
// src/client/components/checkout/centrifuge/shared/sidebar/CentrifugeSidebarView.tsx
|
|
8062
|
-
var
|
|
7838
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
8063
7839
|
var TITLE4 = "Asset details";
|
|
8064
7840
|
var SHOW_DETAILS_LABEL = "Show details";
|
|
8065
7841
|
var HIDE_DETAILS_LABEL = "Hide details";
|
|
@@ -8074,11 +7850,11 @@ function CentrifugeSidebarView({
|
|
|
8074
7850
|
state,
|
|
8075
7851
|
className
|
|
8076
7852
|
}) {
|
|
8077
|
-
return /* @__PURE__ */ (0,
|
|
7853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
8078
7854
|
CheckoutSidebarCard,
|
|
8079
7855
|
{
|
|
8080
7856
|
title: TITLE4,
|
|
8081
|
-
header: /* @__PURE__ */ (0,
|
|
7857
|
+
header: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
8082
7858
|
AssetSummaryRow,
|
|
8083
7859
|
{
|
|
8084
7860
|
asset: state.asset,
|
|
@@ -8106,7 +7882,7 @@ function detailRows2(state) {
|
|
|
8106
7882
|
function minimumValue(minimum) {
|
|
8107
7883
|
switch (minimum.type) {
|
|
8108
7884
|
case "loading":
|
|
8109
|
-
return /* @__PURE__ */ (0,
|
|
7885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Skeleton, { className: "clcosdk:h-[1em] clcosdk:w-16" });
|
|
8110
7886
|
case "known":
|
|
8111
7887
|
return minimum.amount;
|
|
8112
7888
|
case "none":
|
|
@@ -8122,7 +7898,7 @@ function minimumValue(minimum) {
|
|
|
8122
7898
|
var import_lucide_react7 = require("lucide-react");
|
|
8123
7899
|
|
|
8124
7900
|
// src/client/components/checkout/shared/selection/SelectableOptionRow.tsx
|
|
8125
|
-
var
|
|
7901
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
8126
7902
|
function SelectableOptionRow({
|
|
8127
7903
|
selected,
|
|
8128
7904
|
disabled = false,
|
|
@@ -8139,7 +7915,7 @@ function SelectableOptionRow({
|
|
|
8139
7915
|
onSelect();
|
|
8140
7916
|
}
|
|
8141
7917
|
};
|
|
8142
|
-
return /* @__PURE__ */ (0,
|
|
7918
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
8143
7919
|
"div",
|
|
8144
7920
|
{
|
|
8145
7921
|
role: "button",
|
|
@@ -8159,17 +7935,17 @@ function SelectableOptionRow({
|
|
|
8159
7935
|
className
|
|
8160
7936
|
),
|
|
8161
7937
|
children: [
|
|
8162
|
-
/* @__PURE__ */ (0,
|
|
7938
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "clcosdk:flex clcosdk:min-w-0 clcosdk:items-center clcosdk:gap-3", children: [
|
|
8163
7939
|
icon,
|
|
8164
|
-
/* @__PURE__ */ (0,
|
|
7940
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "clcosdk:flex clcosdk:min-w-0 clcosdk:flex-col", children })
|
|
8165
7941
|
] }),
|
|
8166
|
-
/* @__PURE__ */ (0,
|
|
7942
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(RadioCircle, { selected })
|
|
8167
7943
|
]
|
|
8168
7944
|
}
|
|
8169
7945
|
) });
|
|
8170
7946
|
}
|
|
8171
7947
|
function RadioCircle({ selected }) {
|
|
8172
|
-
return /* @__PURE__ */ (0,
|
|
7948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
8173
7949
|
"svg",
|
|
8174
7950
|
{
|
|
8175
7951
|
width: "20",
|
|
@@ -8179,7 +7955,7 @@ function RadioCircle({ selected }) {
|
|
|
8179
7955
|
"aria-hidden": "true",
|
|
8180
7956
|
className: "clcosdk:shrink-0",
|
|
8181
7957
|
children: [
|
|
8182
|
-
/* @__PURE__ */ (0,
|
|
7958
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
8183
7959
|
"circle",
|
|
8184
7960
|
{
|
|
8185
7961
|
cx: "10",
|
|
@@ -8190,7 +7966,7 @@ function RadioCircle({ selected }) {
|
|
|
8190
7966
|
className: selected ? "clcosdk:text-text-primary" : "clcosdk:text-text-disabled"
|
|
8191
7967
|
}
|
|
8192
7968
|
),
|
|
8193
|
-
selected && /* @__PURE__ */ (0,
|
|
7969
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
8194
7970
|
"circle",
|
|
8195
7971
|
{
|
|
8196
7972
|
cx: "10",
|
|
@@ -8207,29 +7983,29 @@ function RadioCircle({ selected }) {
|
|
|
8207
7983
|
|
|
8208
7984
|
// src/client/components/design-system/MetaRow.tsx
|
|
8209
7985
|
var import_react12 = require("react");
|
|
8210
|
-
var
|
|
7986
|
+
var import_jsx_runtime38 = (
|
|
8211
7987
|
// biome-ignore lint/suspicious/noArrayIndexKey: positional separators, and the list is caller-authored JSX.
|
|
8212
7988
|
require("react/jsx-runtime")
|
|
8213
7989
|
);
|
|
8214
7990
|
function MetaRow({ children }) {
|
|
8215
7991
|
const items = import_react12.Children.toArray(children).filter(Boolean);
|
|
8216
|
-
return /* @__PURE__ */ (0,
|
|
8217
|
-
index > 0 && /* @__PURE__ */ (0,
|
|
7992
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "clcosdk:flex clcosdk:min-w-0 clcosdk:items-center clcosdk:gap-1.5", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_react12.Fragment, { children: [
|
|
7993
|
+
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(MetaDot, {}),
|
|
8218
7994
|
item
|
|
8219
7995
|
] }, index)) });
|
|
8220
7996
|
}
|
|
8221
7997
|
function MetaDot() {
|
|
8222
|
-
return /* @__PURE__ */ (0,
|
|
7998
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "clcosdk:h-1 clcosdk:w-1 clcosdk:shrink-0 clcosdk:rounded-full clcosdk:bg-text-disabled" });
|
|
8223
7999
|
}
|
|
8224
8000
|
|
|
8225
8001
|
// src/client/components/checkout/centrifuge/shared/wallet/CentrifugeWalletSelectView.tsx
|
|
8226
|
-
var
|
|
8002
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
8227
8003
|
var TITLE5 = "1. Choose your wallet";
|
|
8228
8004
|
var DEFAULT_DESCRIPTION = "Choose the wallet that funds this deposit.";
|
|
8229
8005
|
var EMBEDDED_WALLET_LABEL = "CoinList Wallet";
|
|
8230
8006
|
var EXTERNAL_WALLET_LABEL = "External wallet";
|
|
8231
8007
|
function CentrifugeWalletSelectView(props) {
|
|
8232
|
-
return /* @__PURE__ */ (0,
|
|
8008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CentrifugeWalletSelectViewBody, { ...props }) });
|
|
8233
8009
|
}
|
|
8234
8010
|
function CentrifugeWalletSelectViewBody({
|
|
8235
8011
|
state,
|
|
@@ -8239,7 +8015,7 @@ function CentrifugeWalletSelectViewBody({
|
|
|
8239
8015
|
}) {
|
|
8240
8016
|
switch (state.type) {
|
|
8241
8017
|
case "active":
|
|
8242
|
-
return /* @__PURE__ */ (0,
|
|
8018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8243
8019
|
ActiveView3,
|
|
8244
8020
|
{
|
|
8245
8021
|
state,
|
|
@@ -8249,7 +8025,7 @@ function CentrifugeWalletSelectViewBody({
|
|
|
8249
8025
|
}
|
|
8250
8026
|
);
|
|
8251
8027
|
case "completed":
|
|
8252
|
-
return /* @__PURE__ */ (0,
|
|
8028
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8253
8029
|
CompletedView2,
|
|
8254
8030
|
{
|
|
8255
8031
|
wallet: state.wallet,
|
|
@@ -8269,18 +8045,18 @@ function ActiveView3({
|
|
|
8269
8045
|
description: description2,
|
|
8270
8046
|
className
|
|
8271
8047
|
}) {
|
|
8272
|
-
return /* @__PURE__ */ (0,
|
|
8048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8273
8049
|
CheckoutStepCard,
|
|
8274
8050
|
{
|
|
8275
8051
|
state: "active",
|
|
8276
8052
|
title: TITLE5,
|
|
8277
|
-
description: /* @__PURE__ */ (0,
|
|
8053
|
+
description: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: cn(typeClasses.bodySm, "clcosdk:text-text-secondary"), children: description2 }),
|
|
8278
8054
|
className,
|
|
8279
|
-
footer: /* @__PURE__ */ (0,
|
|
8055
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8280
8056
|
CheckoutStepFooter,
|
|
8281
8057
|
{
|
|
8282
8058
|
error: state.error,
|
|
8283
|
-
cta: /* @__PURE__ */ (0,
|
|
8059
|
+
cta: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8284
8060
|
ClButton,
|
|
8285
8061
|
{
|
|
8286
8062
|
variant: "primary",
|
|
@@ -8292,8 +8068,8 @@ function ActiveView3({
|
|
|
8292
8068
|
)
|
|
8293
8069
|
}
|
|
8294
8070
|
),
|
|
8295
|
-
children: /* @__PURE__ */ (0,
|
|
8296
|
-
/* @__PURE__ */ (0,
|
|
8071
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4", children: [
|
|
8072
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8297
8073
|
ExternalWalletRow,
|
|
8298
8074
|
{
|
|
8299
8075
|
wallet: state.externalWallet,
|
|
@@ -8301,7 +8077,7 @@ function ActiveView3({
|
|
|
8301
8077
|
onEvent
|
|
8302
8078
|
}
|
|
8303
8079
|
),
|
|
8304
|
-
state.embeddedWallets.map((wallet) => /* @__PURE__ */ (0,
|
|
8080
|
+
state.embeddedWallets.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8305
8081
|
EmbeddedWalletRow,
|
|
8306
8082
|
{
|
|
8307
8083
|
wallet,
|
|
@@ -8319,13 +8095,13 @@ function ExternalWalletRow({
|
|
|
8319
8095
|
onEvent
|
|
8320
8096
|
}) {
|
|
8321
8097
|
if (wallet === null) {
|
|
8322
|
-
return /* @__PURE__ */ (0,
|
|
8098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8323
8099
|
SelectableOptionRow,
|
|
8324
8100
|
{
|
|
8325
8101
|
selected: false,
|
|
8326
8102
|
onSelect: () => onEvent({ type: "ON_CONNECT_WALLET" }),
|
|
8327
|
-
icon: /* @__PURE__ */ (0,
|
|
8328
|
-
children: /* @__PURE__ */ (0,
|
|
8103
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(WalletGlyph, {}),
|
|
8104
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8329
8105
|
"span",
|
|
8330
8106
|
{
|
|
8331
8107
|
className: cn(
|
|
@@ -8338,14 +8114,14 @@ function ExternalWalletRow({
|
|
|
8338
8114
|
}
|
|
8339
8115
|
);
|
|
8340
8116
|
}
|
|
8341
|
-
return /* @__PURE__ */ (0,
|
|
8117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
8342
8118
|
SelectableOptionRow,
|
|
8343
8119
|
{
|
|
8344
8120
|
selected: wallet.selected,
|
|
8345
8121
|
onSelect: () => onEvent({ type: "ON_SELECT_WALLET", value: { type: "external" } }),
|
|
8346
|
-
icon: /* @__PURE__ */ (0,
|
|
8122
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(WalletGlyph, {}),
|
|
8347
8123
|
children: [
|
|
8348
|
-
/* @__PURE__ */ (0,
|
|
8124
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8349
8125
|
"span",
|
|
8350
8126
|
{
|
|
8351
8127
|
className: cn(
|
|
@@ -8355,22 +8131,22 @@ function ExternalWalletRow({
|
|
|
8355
8131
|
children: wallet.address
|
|
8356
8132
|
}
|
|
8357
8133
|
),
|
|
8358
|
-
canDisconnect && /* @__PURE__ */ (0,
|
|
8134
|
+
canDisconnect && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8359
8135
|
DisconnectControl,
|
|
8360
8136
|
{
|
|
8361
8137
|
onDisconnect: () => onEvent({ type: "ON_DISCONNECT_WALLET" }),
|
|
8362
8138
|
className: "clcosdk:md:hidden"
|
|
8363
8139
|
}
|
|
8364
8140
|
),
|
|
8365
|
-
/* @__PURE__ */ (0,
|
|
8366
|
-
/* @__PURE__ */ (0,
|
|
8141
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "clcosdk:max-md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(MetaRow, { children: [
|
|
8142
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8367
8143
|
"span",
|
|
8368
8144
|
{
|
|
8369
8145
|
className: cn(typeClasses.subhead, "clcosdk:text-text-secondary"),
|
|
8370
8146
|
children: wallet.network
|
|
8371
8147
|
}
|
|
8372
8148
|
),
|
|
8373
|
-
canDisconnect && /* @__PURE__ */ (0,
|
|
8149
|
+
canDisconnect && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8374
8150
|
DisconnectControl,
|
|
8375
8151
|
{
|
|
8376
8152
|
onDisconnect: () => onEvent({ type: "ON_DISCONNECT_WALLET" })
|
|
@@ -8385,7 +8161,7 @@ function EmbeddedWalletRow({
|
|
|
8385
8161
|
wallet,
|
|
8386
8162
|
onEvent
|
|
8387
8163
|
}) {
|
|
8388
|
-
return /* @__PURE__ */ (0,
|
|
8164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
8389
8165
|
SelectableOptionRow,
|
|
8390
8166
|
{
|
|
8391
8167
|
selected: wallet.selected,
|
|
@@ -8393,9 +8169,9 @@ function EmbeddedWalletRow({
|
|
|
8393
8169
|
type: "ON_SELECT_WALLET",
|
|
8394
8170
|
value: { type: "embedded", address: wallet.walletAddress }
|
|
8395
8171
|
}),
|
|
8396
|
-
icon: /* @__PURE__ */ (0,
|
|
8172
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(WalletGlyph, {}),
|
|
8397
8173
|
children: [
|
|
8398
|
-
/* @__PURE__ */ (0,
|
|
8174
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8399
8175
|
"span",
|
|
8400
8176
|
{
|
|
8401
8177
|
className: cn(
|
|
@@ -8405,7 +8181,7 @@ function EmbeddedWalletRow({
|
|
|
8405
8181
|
children: EMBEDDED_WALLET_LABEL
|
|
8406
8182
|
}
|
|
8407
8183
|
),
|
|
8408
|
-
/* @__PURE__ */ (0,
|
|
8184
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8409
8185
|
"span",
|
|
8410
8186
|
{
|
|
8411
8187
|
className: cn(
|
|
@@ -8415,8 +8191,8 @@ function EmbeddedWalletRow({
|
|
|
8415
8191
|
children: wallet.address
|
|
8416
8192
|
}
|
|
8417
8193
|
),
|
|
8418
|
-
/* @__PURE__ */ (0,
|
|
8419
|
-
/* @__PURE__ */ (0,
|
|
8194
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "clcosdk:max-md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(MetaRow, { children: [
|
|
8195
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8420
8196
|
"span",
|
|
8421
8197
|
{
|
|
8422
8198
|
className: cn(
|
|
@@ -8426,7 +8202,7 @@ function EmbeddedWalletRow({
|
|
|
8426
8202
|
children: wallet.address
|
|
8427
8203
|
}
|
|
8428
8204
|
),
|
|
8429
|
-
/* @__PURE__ */ (0,
|
|
8205
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8430
8206
|
"span",
|
|
8431
8207
|
{
|
|
8432
8208
|
className: cn(
|
|
@@ -8446,10 +8222,10 @@ function CompletedView2({
|
|
|
8446
8222
|
onEvent,
|
|
8447
8223
|
className
|
|
8448
8224
|
}) {
|
|
8449
|
-
return /* @__PURE__ */ (0,
|
|
8225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CheckoutStepCard, { state: "completed", title: TITLE5, className, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8450
8226
|
CompletedStepSummary,
|
|
8451
8227
|
{
|
|
8452
|
-
icon: /* @__PURE__ */ (0,
|
|
8228
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(WalletGlyph, {}),
|
|
8453
8229
|
title: wallet.type === "embedded" ? EMBEDDED_WALLET_LABEL : wallet.address,
|
|
8454
8230
|
subtitle: wallet.type === "embedded" ? wallet.address : null,
|
|
8455
8231
|
editLabel: "Edit",
|
|
@@ -8461,7 +8237,7 @@ function DisconnectControl({
|
|
|
8461
8237
|
onDisconnect,
|
|
8462
8238
|
className
|
|
8463
8239
|
}) {
|
|
8464
|
-
return /* @__PURE__ */ (0,
|
|
8240
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8465
8241
|
"button",
|
|
8466
8242
|
{
|
|
8467
8243
|
type: "button",
|
|
@@ -8480,7 +8256,7 @@ function DisconnectControl({
|
|
|
8480
8256
|
);
|
|
8481
8257
|
}
|
|
8482
8258
|
function WalletGlyph() {
|
|
8483
|
-
return /* @__PURE__ */ (0,
|
|
8259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "clcosdk:flex clcosdk:size-10 clcosdk:shrink-0 clcosdk:items-center clcosdk:justify-center clcosdk:rounded-xl clcosdk:bg-section", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
8484
8260
|
import_lucide_react7.Wallet,
|
|
8485
8261
|
{
|
|
8486
8262
|
className: "clcosdk:size-5 clcosdk:text-text-primary",
|
|
@@ -8490,7 +8266,7 @@ function WalletGlyph() {
|
|
|
8490
8266
|
}
|
|
8491
8267
|
|
|
8492
8268
|
// src/client/components/checkout/centrifuge/buy/CentrifugeBuyCheckoutView.tsx
|
|
8493
|
-
var
|
|
8269
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
8494
8270
|
function CentrifugeBuyCheckoutView({
|
|
8495
8271
|
state,
|
|
8496
8272
|
onEvent,
|
|
@@ -8498,10 +8274,10 @@ function CentrifugeBuyCheckoutView({
|
|
|
8498
8274
|
}) {
|
|
8499
8275
|
switch (state.type) {
|
|
8500
8276
|
case "error":
|
|
8501
|
-
return /* @__PURE__ */ (0,
|
|
8277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CentrifugeCheckoutError, { reason: state.reason, className });
|
|
8502
8278
|
case "content":
|
|
8503
|
-
return /* @__PURE__ */ (0,
|
|
8504
|
-
/* @__PURE__ */ (0,
|
|
8279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(CoinListStyleScope, { children: [
|
|
8280
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
8505
8281
|
"div",
|
|
8506
8282
|
{
|
|
8507
8283
|
className: cn(
|
|
@@ -8510,22 +8286,22 @@ function CentrifugeBuyCheckoutView({
|
|
|
8510
8286
|
className
|
|
8511
8287
|
),
|
|
8512
8288
|
children: [
|
|
8513
|
-
/* @__PURE__ */ (0,
|
|
8514
|
-
/* @__PURE__ */ (0,
|
|
8289
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "clcosdk:order-2 clcosdk:flex clcosdk:min-w-0 clcosdk:flex-col clcosdk:gap-4 clcosdk:md:order-1", children: [
|
|
8290
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8515
8291
|
CentrifugeWalletSelectView,
|
|
8516
8292
|
{
|
|
8517
8293
|
state: state.wallet,
|
|
8518
8294
|
onEvent
|
|
8519
8295
|
}
|
|
8520
8296
|
),
|
|
8521
|
-
/* @__PURE__ */ (0,
|
|
8522
|
-
/* @__PURE__ */ (0,
|
|
8297
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CentrifugeBuyAmountView, { state: state.amount, onEvent }),
|
|
8298
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CentrifugeBuyReviewView, { state: state.review, onEvent })
|
|
8523
8299
|
] }),
|
|
8524
|
-
/* @__PURE__ */ (0,
|
|
8300
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("aside", { className: "clcosdk:order-1 clcosdk:min-w-0 clcosdk:md:order-2", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CentrifugeSidebarView, { state: state.sidebar }) })
|
|
8525
8301
|
]
|
|
8526
8302
|
}
|
|
8527
8303
|
),
|
|
8528
|
-
/* @__PURE__ */ (0,
|
|
8304
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
8529
8305
|
CentrifugeBuyOrderPlaced,
|
|
8530
8306
|
{
|
|
8531
8307
|
state: state.orderPlaced,
|
|
@@ -8541,7 +8317,7 @@ function CentrifugeBuyCheckoutView({
|
|
|
8541
8317
|
}
|
|
8542
8318
|
|
|
8543
8319
|
// src/client/hooks/checkout/centrifuge/buy/useCentrifugeBuyCheckoutViewModel.ts
|
|
8544
|
-
var
|
|
8320
|
+
var import_react19 = require("react");
|
|
8545
8321
|
|
|
8546
8322
|
// src/client/hooks/checkout/centrifuge/buy/amount/useCentrifugeBuyAmountViewModel.ts
|
|
8547
8323
|
var import_react14 = require("react");
|
|
@@ -8775,8 +8551,7 @@ function useCentrifugeBuyAmountViewModel({
|
|
|
8775
8551
|
const networkName = getNetworkName(chain);
|
|
8776
8552
|
const decimals = TOKEN_REGISTRY.erc20(INPUT_ASSET).decimals;
|
|
8777
8553
|
const parsed = parseBlockchainAmount(amountInput, decimals);
|
|
8778
|
-
const minimum = stepInput.type === "active" ? stepInput.
|
|
8779
|
-
const awaitingMinimum = stepInput.type === "active" && stepInput.awaitingMinimum;
|
|
8554
|
+
const minimum = stepInput.type === "active" ? minimumAmount(stepInput.minimumPurchaseUsd, decimals) : null;
|
|
8780
8555
|
const belowMinimum = minimum !== null && parsed.valid && parsed.amount.raw > 0n && parsed.amount.raw < minimum.raw ? minimumMessage(minimum, locale) : null;
|
|
8781
8556
|
const { balances, isLoading: balancesLoading } = useErc20TokenBalances({
|
|
8782
8557
|
address: stepInput.type === "incomplete" ? NO_WALLET : stepInput.wallet.address,
|
|
@@ -8834,12 +8609,12 @@ function useCentrifugeBuyAmountViewModel({
|
|
|
8834
8609
|
}
|
|
8835
8610
|
};
|
|
8836
8611
|
const confirmCta = (depositBlockedMessage) => {
|
|
8837
|
-
const blocked = depositBlockedMessage !== null || belowMinimum !== null ||
|
|
8612
|
+
const blocked = depositBlockedMessage !== null || belowMinimum !== null || balancesLoading || amountInput.trim() === "";
|
|
8838
8613
|
return blocked ? { type: "disabled" } : { type: "enabled" };
|
|
8839
8614
|
};
|
|
8840
8615
|
const confirmAmount = () => {
|
|
8841
8616
|
if (!enabled) return;
|
|
8842
|
-
if (stepInput.type !== "active"
|
|
8617
|
+
if (stepInput.type !== "active") return;
|
|
8843
8618
|
if (stepInput.depositBlockedMessage !== null) return;
|
|
8844
8619
|
const validated = validateCentrifugeBuyAmount({
|
|
8845
8620
|
input: amountInput,
|
|
@@ -8910,6 +8685,11 @@ function validateCentrifugeBuyAmount({
|
|
|
8910
8685
|
}
|
|
8911
8686
|
return { valid: true, amount: parsed.amount };
|
|
8912
8687
|
}
|
|
8688
|
+
function minimumAmount(minimumPurchaseUsd, decimals) {
|
|
8689
|
+
if (minimumPurchaseUsd === null) return null;
|
|
8690
|
+
const parsed = parseBlockchainAmount(String(minimumPurchaseUsd), decimals);
|
|
8691
|
+
return parsed.valid ? parsed.amount : null;
|
|
8692
|
+
}
|
|
8913
8693
|
function minimumMessage(minimum, locale) {
|
|
8914
8694
|
return `The minimum investment is ${assetAmount(
|
|
8915
8695
|
formatAmount(minimum, locale),
|
|
@@ -8919,15 +8699,11 @@ function minimumMessage(minimum, locale) {
|
|
|
8919
8699
|
|
|
8920
8700
|
// src/client/hooks/checkout/centrifuge/buy/review/useCentrifugeBuyReviewViewModel.ts
|
|
8921
8701
|
var import_react15 = require("react");
|
|
8922
|
-
var SETTLES_LATER = "Settles later, at the price the fund sets then.";
|
|
8923
8702
|
function useCentrifugeBuyReviewViewModel({
|
|
8924
8703
|
stepInput,
|
|
8925
8704
|
symbol,
|
|
8926
8705
|
chain,
|
|
8927
8706
|
vaultContracts,
|
|
8928
|
-
quoteState,
|
|
8929
|
-
onRefreshQuote,
|
|
8930
|
-
indicativePrice = null,
|
|
8931
8707
|
enabled = true,
|
|
8932
8708
|
onComplete
|
|
8933
8709
|
}) {
|
|
@@ -8942,11 +8718,8 @@ function useCentrifugeBuyReviewViewModel({
|
|
|
8942
8718
|
setFailure(null);
|
|
8943
8719
|
}
|
|
8944
8720
|
}, [stepInput.type]);
|
|
8945
|
-
const quote = stepInput.type === "active" ? quoteForAmount(quoteState, stepInput.amount) : null;
|
|
8946
8721
|
const uiState = () => {
|
|
8947
8722
|
if (stepInput.type !== "active") return { type: "incomplete" };
|
|
8948
|
-
if (quoteState.type === "ERROR") return { type: "error" };
|
|
8949
|
-
if (quote === null) return { type: "loading" };
|
|
8950
8723
|
const funding = TOKEN_REGISTRY.erc20(stepInput.inputAsset);
|
|
8951
8724
|
const invested = assetAmount(
|
|
8952
8725
|
formatAmount(stepInput.amount, locale),
|
|
@@ -8959,10 +8732,6 @@ function useCentrifugeBuyReviewViewModel({
|
|
|
8959
8732
|
iconUrl: stablecoinIconUrl(stepInput.inputAsset)
|
|
8960
8733
|
}),
|
|
8961
8734
|
investAmount: invested,
|
|
8962
|
-
approximateAmount: assetAmount(
|
|
8963
|
-
formatShareAmount(quote.estimatedShares, locale),
|
|
8964
|
-
symbol
|
|
8965
|
-
),
|
|
8966
8735
|
recipientAddress: shortenAddress(stepInput.wallet.address),
|
|
8967
8736
|
// This product charges none, so the fee row is a formatted zero in the funding token.
|
|
8968
8737
|
coinlistFee: assetAmount(
|
|
@@ -8973,7 +8742,6 @@ function useCentrifugeBuyReviewViewModel({
|
|
|
8973
8742
|
funding.symbol
|
|
8974
8743
|
),
|
|
8975
8744
|
total: invested,
|
|
8976
|
-
isRefreshing: quoteState.type === "CONTENT" && quoteState.isRefreshing,
|
|
8977
8745
|
placeRequestCta: placeRequestCta(
|
|
8978
8746
|
phase,
|
|
8979
8747
|
stepInput.depositBlockedMessage,
|
|
@@ -8984,9 +8752,7 @@ function useCentrifugeBuyReviewViewModel({
|
|
|
8984
8752
|
};
|
|
8985
8753
|
const placeRequest = async () => {
|
|
8986
8754
|
if (!enabled) return;
|
|
8987
|
-
if (stepInput.type !== "active" || phase !== null
|
|
8988
|
-
return;
|
|
8989
|
-
}
|
|
8755
|
+
if (stepInput.type !== "active" || phase !== null) return;
|
|
8990
8756
|
if (stepInput.depositBlockedMessage !== null) return;
|
|
8991
8757
|
if (failure?.type === "unconfirmed") return;
|
|
8992
8758
|
setFailure(null);
|
|
@@ -9038,37 +8804,19 @@ function useCentrifugeBuyReviewViewModel({
|
|
|
9038
8804
|
onComplete({
|
|
9039
8805
|
wallet: stepInput.wallet,
|
|
9040
8806
|
amount: stepInput.amount,
|
|
9041
|
-
indicativePrice,
|
|
9042
8807
|
transaction: placed.transaction,
|
|
9043
8808
|
txHash: placed.txHash
|
|
9044
8809
|
});
|
|
9045
8810
|
};
|
|
9046
8811
|
const onEvent = (event) => {
|
|
9047
8812
|
switch (event.type) {
|
|
9048
|
-
case "ON_REFRESH_ESTIMATE":
|
|
9049
|
-
case "ON_RETRY":
|
|
9050
|
-
if (!enabled) return;
|
|
9051
|
-
setFailure(
|
|
9052
|
-
(current) => current?.type === "unconfirmed" ? current : null
|
|
9053
|
-
);
|
|
9054
|
-
onRefreshQuote();
|
|
9055
|
-
return;
|
|
9056
8813
|
case "ON_PLACE_REQUEST":
|
|
9057
8814
|
void placeRequest();
|
|
9058
8815
|
return;
|
|
9059
|
-
default: {
|
|
9060
|
-
const exhaustive = event;
|
|
9061
|
-
return exhaustive;
|
|
9062
|
-
}
|
|
9063
8816
|
}
|
|
9064
8817
|
};
|
|
9065
8818
|
return { state: uiState(), onEvent };
|
|
9066
8819
|
}
|
|
9067
|
-
function quoteForAmount(state, amount) {
|
|
9068
|
-
if (state.type !== "CONTENT") return null;
|
|
9069
|
-
if (state.quote.spendInputAmount.raw !== amount.raw) return null;
|
|
9070
|
-
return state.quote;
|
|
9071
|
-
}
|
|
9072
8820
|
function placeRequestCta(phase, depositBlockedMessage, failure) {
|
|
9073
8821
|
if (phase !== null) return { type: "loading", message: phaseMessage(phase) };
|
|
9074
8822
|
return depositBlockedMessage !== null || failure?.type === "unconfirmed" ? { type: "disabled" } : { type: "enabled" };
|
|
@@ -9209,135 +8957,14 @@ function centrifugeVaultOrderingMessage(orderability) {
|
|
|
9209
8957
|
return reason === null ? null : centrifugeVaultOrderReasonMessage(reason);
|
|
9210
8958
|
}
|
|
9211
8959
|
|
|
9212
|
-
// src/client/hooks/checkout/centrifuge/shared/data/useCentrifugeQuote.ts
|
|
9213
|
-
var import_react16 = require("react");
|
|
9214
|
-
|
|
9215
|
-
// src/client/hooks/shared/centrifuge/centrifuge-load-error.ts
|
|
9216
|
-
function centrifugeLoadErrorReason(error) {
|
|
9217
|
-
return error instanceof NotAuthenticatedError ? "not-authenticated" : "generic-error";
|
|
9218
|
-
}
|
|
9219
|
-
|
|
9220
|
-
// src/client/hooks/checkout/centrifuge/shared/data/useCentrifugeQuote.ts
|
|
9221
|
-
var LOADING = { type: "LOADING" };
|
|
9222
|
-
function useCentrifugeQuote(options) {
|
|
9223
|
-
const {
|
|
9224
|
-
symbol,
|
|
9225
|
-
chain,
|
|
9226
|
-
amount,
|
|
9227
|
-
pollIntervalMs = CENTRIFUGE_POLL_INTERVAL_MS,
|
|
9228
|
-
data,
|
|
9229
|
-
enabled,
|
|
9230
|
-
reloadKey = 0
|
|
9231
|
-
} = options;
|
|
9232
|
-
const { coinlist, isReady } = useCoinList();
|
|
9233
|
-
const log = useLogger("useCentrifugeQuote");
|
|
9234
|
-
const [state, setState] = (0, import_react16.useState)(
|
|
9235
|
-
() => data === void 0 ? LOADING : { type: "CONTENT", quote: data, isRefreshing: false }
|
|
9236
|
-
);
|
|
9237
|
-
const fetchIdRef = (0, import_react16.useRef)(0);
|
|
9238
|
-
const isFetchingRef = (0, import_react16.useRef)(false);
|
|
9239
|
-
const hasQuoteRef = (0, import_react16.useRef)(data !== void 0);
|
|
9240
|
-
(0, import_react16.useEffect)(() => {
|
|
9241
|
-
if (!isReady || !enabled) return;
|
|
9242
|
-
void reloadKey;
|
|
9243
|
-
const currentFetchId = ++fetchIdRef.current;
|
|
9244
|
-
isFetchingRef.current = false;
|
|
9245
|
-
const load = async () => {
|
|
9246
|
-
if (isFetchingRef.current) return;
|
|
9247
|
-
isFetchingRef.current = true;
|
|
9248
|
-
setState(
|
|
9249
|
-
(previous) => previous.type === "CONTENT" ? { ...previous, isRefreshing: true } : previous
|
|
9250
|
-
);
|
|
9251
|
-
try {
|
|
9252
|
-
const quote = await coinlist.centrifuge.getQuote({
|
|
9253
|
-
symbol,
|
|
9254
|
-
chain,
|
|
9255
|
-
// Rebuilt from primitives the effect depends on, so an inline
|
|
9256
|
-
// `amount` from the checkout viewmodel does not restart the poll.
|
|
9257
|
-
amount: BlockchainAmount({
|
|
9258
|
-
raw: amount.raw,
|
|
9259
|
-
decimals: amount.decimals
|
|
9260
|
-
})
|
|
9261
|
-
});
|
|
9262
|
-
if (currentFetchId !== fetchIdRef.current) return;
|
|
9263
|
-
log.debug(() => ({
|
|
9264
|
-
msg: "settled",
|
|
9265
|
-
fields: { state: "CONTENT" }
|
|
9266
|
-
}));
|
|
9267
|
-
hasQuoteRef.current = true;
|
|
9268
|
-
setState({ type: "CONTENT", quote, isRefreshing: false });
|
|
9269
|
-
} catch (error) {
|
|
9270
|
-
if (currentFetchId !== fetchIdRef.current) return;
|
|
9271
|
-
const reason = centrifugeLoadErrorReason(error);
|
|
9272
|
-
if (hasQuoteRef.current) {
|
|
9273
|
-
log.warning(
|
|
9274
|
-
() => ({
|
|
9275
|
-
msg: "poll failed; keeping the last quote",
|
|
9276
|
-
fields: { reason }
|
|
9277
|
-
}),
|
|
9278
|
-
error
|
|
9279
|
-
);
|
|
9280
|
-
} else {
|
|
9281
|
-
log.failure(
|
|
9282
|
-
() => ({ msg: "settled", fields: { state: "ERROR", reason } }),
|
|
9283
|
-
error
|
|
9284
|
-
);
|
|
9285
|
-
}
|
|
9286
|
-
setState(
|
|
9287
|
-
(previous) => previous.type === "CONTENT" ? { ...previous, isRefreshing: false } : { type: "ERROR", reason }
|
|
9288
|
-
);
|
|
9289
|
-
} finally {
|
|
9290
|
-
if (currentFetchId === fetchIdRef.current) {
|
|
9291
|
-
isFetchingRef.current = false;
|
|
9292
|
-
}
|
|
9293
|
-
}
|
|
9294
|
-
};
|
|
9295
|
-
load();
|
|
9296
|
-
const interval = setInterval(load, pollIntervalMs);
|
|
9297
|
-
return () => {
|
|
9298
|
-
clearInterval(interval);
|
|
9299
|
-
++fetchIdRef.current;
|
|
9300
|
-
};
|
|
9301
|
-
}, [
|
|
9302
|
-
coinlist,
|
|
9303
|
-
isReady,
|
|
9304
|
-
enabled,
|
|
9305
|
-
symbol,
|
|
9306
|
-
chain,
|
|
9307
|
-
amount.raw,
|
|
9308
|
-
amount.decimals,
|
|
9309
|
-
pollIntervalMs,
|
|
9310
|
-
reloadKey,
|
|
9311
|
-
log
|
|
9312
|
-
]);
|
|
9313
|
-
return { state };
|
|
9314
|
-
}
|
|
9315
|
-
|
|
9316
|
-
// src/client/hooks/checkout/centrifuge/shared/indicative-price.ts
|
|
9317
|
-
var USD_FRACTION_DIGITS2 = 2;
|
|
9318
|
-
function formatIndicativeUsd(price, locale) {
|
|
9319
|
-
if (price === null || !/^\d+(\.\d+)?$/.test(price)) {
|
|
9320
|
-
return NA_AMOUNT_ASSET_UI;
|
|
9321
|
-
}
|
|
9322
|
-
return FormattedAmountAssetUi(
|
|
9323
|
-
new Intl.NumberFormat(locale, {
|
|
9324
|
-
style: "currency",
|
|
9325
|
-
currency: "USD",
|
|
9326
|
-
minimumFractionDigits: USD_FRACTION_DIGITS2,
|
|
9327
|
-
maximumFractionDigits: USD_FRACTION_DIGITS2
|
|
9328
|
-
}).format(Number(price))
|
|
9329
|
-
);
|
|
9330
|
-
}
|
|
9331
|
-
|
|
9332
8960
|
// src/client/hooks/checkout/centrifuge/shared/sidebar/useCentrifugeSidebarViewModel.ts
|
|
9333
|
-
var
|
|
8961
|
+
var USD_FRACTION_DIGITS2 = AssetDecimals(2);
|
|
9334
8962
|
var WHOLE_DOLLAR_DIGITS = AssetDecimals(0);
|
|
9335
8963
|
function useCentrifugeSidebarViewModel({
|
|
9336
8964
|
offer,
|
|
9337
8965
|
symbol,
|
|
9338
8966
|
chain,
|
|
9339
8967
|
tokenMetadata,
|
|
9340
|
-
quoteState,
|
|
9341
8968
|
underlyingFund,
|
|
9342
8969
|
apy
|
|
9343
8970
|
}) {
|
|
@@ -9352,44 +8979,36 @@ function useCentrifugeSidebarViewModel({
|
|
|
9352
8979
|
ticker: symbol,
|
|
9353
8980
|
underlyingFund,
|
|
9354
8981
|
assetType: offer.instrumentType,
|
|
9355
|
-
minimumInvestment: toMinimumUi(
|
|
8982
|
+
minimumInvestment: toMinimumUi(
|
|
8983
|
+
offer.options[0]?.minimumPurchaseUsd ?? null,
|
|
8984
|
+
locale
|
|
8985
|
+
),
|
|
9356
8986
|
networkName,
|
|
9357
8987
|
issuer: offer.issuer,
|
|
9358
8988
|
apy: apy === null ? null : FormattedPercentUi(apy)
|
|
9359
8989
|
};
|
|
9360
8990
|
return { state };
|
|
9361
8991
|
}
|
|
9362
|
-
function toMinimumUi(
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
type: "known",
|
|
9371
|
-
amount: formatMinimumUsd(
|
|
9372
|
-
quoteState.quote.minimumInputAmount,
|
|
9373
|
-
locale
|
|
9374
|
-
)
|
|
9375
|
-
};
|
|
9376
|
-
default: {
|
|
9377
|
-
const exhaustive = quoteState;
|
|
9378
|
-
return exhaustive;
|
|
9379
|
-
}
|
|
9380
|
-
}
|
|
8992
|
+
function toMinimumUi(minimumPurchaseUsd, locale) {
|
|
8993
|
+
if (minimumPurchaseUsd === null) return { type: "none" };
|
|
8994
|
+
const parsed = parseBlockchainAmount(
|
|
8995
|
+
String(minimumPurchaseUsd),
|
|
8996
|
+
STABLE_DECIMALS
|
|
8997
|
+
);
|
|
8998
|
+
if (!parsed.valid) return { type: "none" };
|
|
8999
|
+
return { type: "known", amount: formatMinimumUsd(parsed.amount, locale) };
|
|
9381
9000
|
}
|
|
9382
9001
|
function formatMinimumUsd(amount, locale) {
|
|
9383
9002
|
return usdAmount(
|
|
9384
9003
|
formatAmount(amount, locale, {
|
|
9385
|
-
maxFractionDigits:
|
|
9004
|
+
maxFractionDigits: USD_FRACTION_DIGITS2,
|
|
9386
9005
|
minFractionDigits: WHOLE_DOLLAR_DIGITS
|
|
9387
9006
|
})
|
|
9388
9007
|
);
|
|
9389
9008
|
}
|
|
9390
9009
|
|
|
9391
9010
|
// src/client/hooks/checkout/centrifuge/shared/wallet/useCentrifugeWalletSelectViewModel.ts
|
|
9392
|
-
var
|
|
9011
|
+
var import_react16 = require("react");
|
|
9393
9012
|
var CONNECT_FAILED = "Could not connect that wallet. Please try again.";
|
|
9394
9013
|
function useCentrifugeWalletSelectViewModel({
|
|
9395
9014
|
stepInput,
|
|
@@ -9399,8 +9018,8 @@ function useCentrifugeWalletSelectViewModel({
|
|
|
9399
9018
|
onEdit
|
|
9400
9019
|
}) {
|
|
9401
9020
|
const log = useLogger("useCentrifugeWalletSelectViewModel");
|
|
9402
|
-
const [selected, setSelected] = (0,
|
|
9403
|
-
const [error, setError] = (0,
|
|
9021
|
+
const [selected, setSelected] = (0, import_react16.useState)(null);
|
|
9022
|
+
const [error, setError] = (0, import_react16.useState)(null);
|
|
9404
9023
|
const networkName = getNetworkName(chain);
|
|
9405
9024
|
const selectedWallet = resolveWallet(wallets, selected);
|
|
9406
9025
|
const uiState = () => {
|
|
@@ -9530,21 +9149,21 @@ function toConfirmedWalletUi(wallets, wallet) {
|
|
|
9530
9149
|
}
|
|
9531
9150
|
|
|
9532
9151
|
// src/client/hooks/shared/useTokenMetadata.ts
|
|
9533
|
-
var
|
|
9152
|
+
var import_react17 = require("react");
|
|
9534
9153
|
var DISABLED_STATE = { type: "DISABLED" };
|
|
9535
9154
|
var LOADING_STATE = { type: "LOADING" };
|
|
9536
9155
|
function useTokenMetadata(options) {
|
|
9537
9156
|
const { chain, address, data, enabled = true } = options;
|
|
9538
9157
|
const { coinlist, isReady } = useCoinList();
|
|
9539
9158
|
const log = useLogger("useTokenMetadata");
|
|
9540
|
-
const [state, setState] = (0,
|
|
9159
|
+
const [state, setState] = (0, import_react17.useState)(
|
|
9541
9160
|
() => data !== void 0 ? { type: "CONTENT", tokenMetadata: data } : LOADING_STATE
|
|
9542
9161
|
);
|
|
9543
|
-
const [refetchCount, setRefetchCount] = (0,
|
|
9544
|
-
const refetch = (0,
|
|
9162
|
+
const [refetchCount, setRefetchCount] = (0, import_react17.useState)(0);
|
|
9163
|
+
const refetch = (0, import_react17.useCallback)(() => {
|
|
9545
9164
|
setRefetchCount((count) => count + 1);
|
|
9546
9165
|
}, []);
|
|
9547
|
-
(0,
|
|
9166
|
+
(0, import_react17.useEffect)(() => {
|
|
9548
9167
|
let isCancelled = false;
|
|
9549
9168
|
const seedActive = data !== void 0 && refetchCount === 0;
|
|
9550
9169
|
if (!isReady || !enabled || seedActive) {
|
|
@@ -9624,8 +9243,15 @@ function useCheckoutOfferTokenMetadata({
|
|
|
9624
9243
|
}
|
|
9625
9244
|
|
|
9626
9245
|
// src/client/hooks/shared/centrifuge/useCentrifugeVaultStatuses.ts
|
|
9627
|
-
var
|
|
9628
|
-
|
|
9246
|
+
var import_react18 = require("react");
|
|
9247
|
+
|
|
9248
|
+
// src/client/hooks/shared/centrifuge/centrifuge-load-error.ts
|
|
9249
|
+
function centrifugeLoadErrorReason(error) {
|
|
9250
|
+
return error instanceof NotAuthenticatedError ? "not-authenticated" : "generic-error";
|
|
9251
|
+
}
|
|
9252
|
+
|
|
9253
|
+
// src/client/hooks/shared/centrifuge/useCentrifugeVaultStatuses.ts
|
|
9254
|
+
var LOADING = { type: "LOADING" };
|
|
9629
9255
|
function useCentrifugeVaultStatuses(options) {
|
|
9630
9256
|
const {
|
|
9631
9257
|
vaults,
|
|
@@ -9636,8 +9262,8 @@ function useCentrifugeVaultStatuses(options) {
|
|
|
9636
9262
|
const { coinlist, isReady } = useCoinList();
|
|
9637
9263
|
const log = useLogger("useCentrifugeVaultStatus");
|
|
9638
9264
|
const key = vaults.map(vaultKey).join("|");
|
|
9639
|
-
const stableVaults = (0,
|
|
9640
|
-
const [states, setStates] = (0,
|
|
9265
|
+
const stableVaults = (0, import_react18.useMemo)(() => vaults, [key]);
|
|
9266
|
+
const [states, setStates] = (0, import_react18.useState)(
|
|
9641
9267
|
() => Object.fromEntries(
|
|
9642
9268
|
(data ?? []).map((status) => [
|
|
9643
9269
|
vaultKey(status),
|
|
@@ -9645,10 +9271,10 @@ function useCentrifugeVaultStatuses(options) {
|
|
|
9645
9271
|
])
|
|
9646
9272
|
)
|
|
9647
9273
|
);
|
|
9648
|
-
const fetchIdRef = (0,
|
|
9649
|
-
const inFlightRef = (0,
|
|
9650
|
-
const heldRef = (0,
|
|
9651
|
-
(0,
|
|
9274
|
+
const fetchIdRef = (0, import_react18.useRef)(0);
|
|
9275
|
+
const inFlightRef = (0, import_react18.useRef)(/* @__PURE__ */ new Set());
|
|
9276
|
+
const heldRef = (0, import_react18.useRef)(new Set((data ?? []).map(vaultKey)));
|
|
9277
|
+
(0, import_react18.useEffect)(() => {
|
|
9652
9278
|
if (!isReady || !enabled) return;
|
|
9653
9279
|
const currentFetchId = ++fetchIdRef.current;
|
|
9654
9280
|
inFlightRef.current = /* @__PURE__ */ new Set();
|
|
@@ -9708,7 +9334,7 @@ function useCentrifugeVaultStatuses(options) {
|
|
|
9708
9334
|
return {
|
|
9709
9335
|
statuses: stableVaults.map((vault) => ({
|
|
9710
9336
|
vault,
|
|
9711
|
-
state: states[vaultKey(vault)] ??
|
|
9337
|
+
state: states[vaultKey(vault)] ?? LOADING
|
|
9712
9338
|
}))
|
|
9713
9339
|
};
|
|
9714
9340
|
}
|
|
@@ -9740,11 +9366,10 @@ function useCentrifugeBuyCheckoutViewModel({
|
|
|
9740
9366
|
apy
|
|
9741
9367
|
}) {
|
|
9742
9368
|
const locale = useLocale();
|
|
9743
|
-
const [step, setStep] = (0,
|
|
9744
|
-
const [orderPlaced, setOrderPlaced] = (0,
|
|
9369
|
+
const [step, setStep] = (0, import_react19.useState)({ type: "wallet" });
|
|
9370
|
+
const [orderPlaced, setOrderPlaced] = (0, import_react19.useState)(
|
|
9745
9371
|
null
|
|
9746
9372
|
);
|
|
9747
|
-
const [quoteReloadKey, setQuoteReloadKey] = (0, import_react20.useState)(0);
|
|
9748
9373
|
const depositableHere = vaultProxy(offer.vaultContracts, chain) !== null;
|
|
9749
9374
|
const live = enabled && depositableHere;
|
|
9750
9375
|
const { state: statusState } = useCentrifugeVaultStatus({
|
|
@@ -9754,20 +9379,12 @@ function useCentrifugeBuyCheckoutViewModel({
|
|
|
9754
9379
|
});
|
|
9755
9380
|
const depositBlockedMessage = statusState.type === "CONTENT" ? centrifugeVaultOrderingMessage(statusState.status.orderability) : null;
|
|
9756
9381
|
const notOrderable = depositBlockedMessage !== null;
|
|
9757
|
-
const { state: quoteState } = useCentrifugeQuote({
|
|
9758
|
-
symbol,
|
|
9759
|
-
chain,
|
|
9760
|
-
amount: sidebarAmount(step),
|
|
9761
|
-
enabled: live && !notOrderable,
|
|
9762
|
-
reloadKey: quoteReloadKey
|
|
9763
|
-
});
|
|
9764
9382
|
const { state: outputTokenMetadataState } = useCheckoutOfferTokenMetadata({
|
|
9765
9383
|
offer,
|
|
9766
9384
|
chain,
|
|
9767
9385
|
enabled: live
|
|
9768
9386
|
});
|
|
9769
9387
|
const outputTokenMetadata = tokenMetadataOf(outputTokenMetadataState);
|
|
9770
|
-
const indicativePrice = indicativePriceOf(quoteState, sidebarAmount(step));
|
|
9771
9388
|
const atEntry = step.type === "wallet" && orderPlaced === null;
|
|
9772
9389
|
const errorReason = CentrifugeCheckoutErrorReason.of({
|
|
9773
9390
|
depositableHere,
|
|
@@ -9782,7 +9399,7 @@ function useCentrifugeBuyCheckoutViewModel({
|
|
|
9782
9399
|
onEdit: () => setStep({ type: "wallet" })
|
|
9783
9400
|
});
|
|
9784
9401
|
const amount = useCentrifugeBuyAmountViewModel({
|
|
9785
|
-
stepInput: amountStepInput(step, depositBlockedMessage,
|
|
9402
|
+
stepInput: amountStepInput(step, depositBlockedMessage, offer),
|
|
9786
9403
|
chain,
|
|
9787
9404
|
enabled: live,
|
|
9788
9405
|
onComplete: (confirmed) => setStep(
|
|
@@ -9804,15 +9421,11 @@ function useCentrifugeBuyCheckoutViewModel({
|
|
|
9804
9421
|
symbol,
|
|
9805
9422
|
chain,
|
|
9806
9423
|
vaultContracts: offer.vaultContracts,
|
|
9807
|
-
quoteState,
|
|
9808
|
-
onRefreshQuote: () => setQuoteReloadKey((key) => key + 1),
|
|
9809
|
-
indicativePrice,
|
|
9810
9424
|
enabled: live,
|
|
9811
9425
|
onComplete: (order) => {
|
|
9812
|
-
|
|
9813
|
-
setOrderPlaced(placed);
|
|
9426
|
+
setOrderPlaced(order);
|
|
9814
9427
|
setStep({ type: "wallet" });
|
|
9815
|
-
onOrderPlaced?.(
|
|
9428
|
+
onOrderPlaced?.(order);
|
|
9816
9429
|
}
|
|
9817
9430
|
});
|
|
9818
9431
|
const sidebar = useCentrifugeSidebarViewModel({
|
|
@@ -9820,7 +9433,6 @@ function useCentrifugeBuyCheckoutViewModel({
|
|
|
9820
9433
|
symbol,
|
|
9821
9434
|
chain,
|
|
9822
9435
|
tokenMetadata: outputTokenMetadata,
|
|
9823
|
-
quoteState,
|
|
9824
9436
|
underlyingFund,
|
|
9825
9437
|
apy
|
|
9826
9438
|
});
|
|
@@ -9851,8 +9463,6 @@ function useCentrifugeBuyCheckoutViewModel({
|
|
|
9851
9463
|
case "ON_EDIT_AMOUNT":
|
|
9852
9464
|
amount.onEvent(event);
|
|
9853
9465
|
return;
|
|
9854
|
-
case "ON_REFRESH_ESTIMATE":
|
|
9855
|
-
case "ON_RETRY":
|
|
9856
9466
|
case "ON_PLACE_REQUEST":
|
|
9857
9467
|
review.onEvent(event);
|
|
9858
9468
|
return;
|
|
@@ -9867,15 +9477,6 @@ function useCentrifugeBuyCheckoutViewModel({
|
|
|
9867
9477
|
};
|
|
9868
9478
|
return { state: uiState(), onEvent };
|
|
9869
9479
|
}
|
|
9870
|
-
function sidebarAmount(step) {
|
|
9871
|
-
if (step.type === "review") return step.amount;
|
|
9872
|
-
return CENTRIFUGE_INDICATIVE_QUOTE_AMOUNT;
|
|
9873
|
-
}
|
|
9874
|
-
function indicativePriceOf(quoteState, amount) {
|
|
9875
|
-
if (quoteState.type !== "CONTENT") return null;
|
|
9876
|
-
if (quoteState.quote.spendInputAmount.raw !== amount.raw) return null;
|
|
9877
|
-
return quoteState.quote.indicativePrice;
|
|
9878
|
-
}
|
|
9879
9480
|
function walletStepInput(step) {
|
|
9880
9481
|
switch (step.type) {
|
|
9881
9482
|
case "wallet":
|
|
@@ -9889,7 +9490,7 @@ function walletStepInput(step) {
|
|
|
9889
9490
|
}
|
|
9890
9491
|
}
|
|
9891
9492
|
}
|
|
9892
|
-
function amountStepInput(step, depositBlockedMessage,
|
|
9493
|
+
function amountStepInput(step, depositBlockedMessage, offer) {
|
|
9893
9494
|
switch (step.type) {
|
|
9894
9495
|
case "wallet":
|
|
9895
9496
|
return { type: "incomplete" };
|
|
@@ -9898,8 +9499,7 @@ function amountStepInput(step, depositBlockedMessage, quoteState) {
|
|
|
9898
9499
|
type: "active",
|
|
9899
9500
|
wallet: step.wallet,
|
|
9900
9501
|
depositBlockedMessage,
|
|
9901
|
-
|
|
9902
|
-
awaitingMinimum: quoteState.type === "LOADING"
|
|
9502
|
+
minimumPurchaseUsd: offer.options[0]?.minimumPurchaseUsd ?? null
|
|
9903
9503
|
};
|
|
9904
9504
|
case "review":
|
|
9905
9505
|
return {
|
|
@@ -9934,22 +9534,17 @@ function orderPlacedUi(order, offer, symbol, chain, locale) {
|
|
|
9934
9534
|
networkName,
|
|
9935
9535
|
tokenMetadata: null
|
|
9936
9536
|
}),
|
|
9937
|
-
outputAmount: assetAmount(
|
|
9938
|
-
formatShareAmount(order.transaction.estimatedShares, locale),
|
|
9939
|
-
symbol
|
|
9940
|
-
),
|
|
9941
9537
|
totalCost: assetAmount(
|
|
9942
9538
|
formatAmount(order.transaction.spendInputAmount, locale),
|
|
9943
9539
|
TOKEN_REGISTRY.erc20(USDC_SYMBOL).symbol
|
|
9944
9540
|
),
|
|
9945
|
-
pricePerShare: formatIndicativeUsd(order.indicativePrice, locale),
|
|
9946
9541
|
recipientAddress: shortenAddress(order.wallet.address),
|
|
9947
9542
|
txExplorerUrl: txExplorerUrl(chain, order.txHash)
|
|
9948
9543
|
};
|
|
9949
9544
|
}
|
|
9950
9545
|
|
|
9951
9546
|
// src/client/components/checkout/centrifuge/buy/CentrifugeBuyCheckoutContainer.tsx
|
|
9952
|
-
var
|
|
9547
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
9953
9548
|
function CentrifugeBuyCheckoutContainer({
|
|
9954
9549
|
offer,
|
|
9955
9550
|
symbol,
|
|
@@ -9971,7 +9566,7 @@ function CentrifugeBuyCheckoutContainer({
|
|
|
9971
9566
|
underlyingFund,
|
|
9972
9567
|
apy
|
|
9973
9568
|
});
|
|
9974
|
-
return /* @__PURE__ */ (0,
|
|
9569
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
9975
9570
|
CentrifugeBuyCheckoutView,
|
|
9976
9571
|
{
|
|
9977
9572
|
state,
|
|
@@ -9982,13 +9577,13 @@ function CentrifugeBuyCheckoutContainer({
|
|
|
9982
9577
|
}
|
|
9983
9578
|
|
|
9984
9579
|
// src/client/components/checkout/ondo/buy/amount/OndoBuyAmountView.tsx
|
|
9985
|
-
var
|
|
9580
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
9986
9581
|
var TITLE6 = "2. Enter amount";
|
|
9987
9582
|
var AMOUNT_LABEL2 = "Amount";
|
|
9988
9583
|
var AMOUNT_PLACEHOLDER2 = "0.00";
|
|
9989
9584
|
var REVIEW_NOTE2 = "You'll review your order details before purchasing.";
|
|
9990
9585
|
function OndoBuyAmountView(props) {
|
|
9991
|
-
return /* @__PURE__ */ (0,
|
|
9586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(OndoAmountViewBody, { ...props }) });
|
|
9992
9587
|
}
|
|
9993
9588
|
function OndoAmountViewBody({
|
|
9994
9589
|
state,
|
|
@@ -9997,7 +9592,7 @@ function OndoAmountViewBody({
|
|
|
9997
9592
|
}) {
|
|
9998
9593
|
switch (state.type) {
|
|
9999
9594
|
case "incomplete":
|
|
10000
|
-
return /* @__PURE__ */ (0,
|
|
9595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10001
9596
|
CheckoutStepCard,
|
|
10002
9597
|
{
|
|
10003
9598
|
state: "inactive",
|
|
@@ -10006,9 +9601,9 @@ function OndoAmountViewBody({
|
|
|
10006
9601
|
}
|
|
10007
9602
|
);
|
|
10008
9603
|
case "active":
|
|
10009
|
-
return /* @__PURE__ */ (0,
|
|
9604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ActiveView4, { state, onEvent, className });
|
|
10010
9605
|
case "complete":
|
|
10011
|
-
return /* @__PURE__ */ (0,
|
|
9606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CompletedView3, { state, onEvent, className });
|
|
10012
9607
|
default: {
|
|
10013
9608
|
const exhaustive = state;
|
|
10014
9609
|
return exhaustive;
|
|
@@ -10022,18 +9617,18 @@ function ActiveView4({
|
|
|
10022
9617
|
}) {
|
|
10023
9618
|
const isLoading = state.confirmCta.type === "loading";
|
|
10024
9619
|
const selectedAsset = state.inputAssets.find((asset) => asset.selected) ?? null;
|
|
10025
|
-
return /* @__PURE__ */ (0,
|
|
9620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
10026
9621
|
CheckoutStepCard,
|
|
10027
9622
|
{
|
|
10028
9623
|
state: "active",
|
|
10029
9624
|
title: TITLE6,
|
|
10030
9625
|
className,
|
|
10031
|
-
footer: /* @__PURE__ */ (0,
|
|
9626
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10032
9627
|
CheckoutStepFooter,
|
|
10033
9628
|
{
|
|
10034
9629
|
message: state.confirmCta.type === "loading" ? state.confirmCta.message : REVIEW_NOTE2,
|
|
10035
9630
|
error: state.error,
|
|
10036
|
-
cta: /* @__PURE__ */ (0,
|
|
9631
|
+
cta: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10037
9632
|
ClButton,
|
|
10038
9633
|
{
|
|
10039
9634
|
variant: "primary",
|
|
@@ -10048,7 +9643,7 @@ function ActiveView4({
|
|
|
10048
9643
|
}
|
|
10049
9644
|
),
|
|
10050
9645
|
children: [
|
|
10051
|
-
/* @__PURE__ */ (0,
|
|
9646
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10052
9647
|
CheckoutAmountInput,
|
|
10053
9648
|
{
|
|
10054
9649
|
label: AMOUNT_LABEL2,
|
|
@@ -10058,7 +9653,7 @@ function ActiveView4({
|
|
|
10058
9653
|
invalid: state.error !== null,
|
|
10059
9654
|
disabled: isLoading,
|
|
10060
9655
|
suffix: selectedAsset?.symbol,
|
|
10061
|
-
action: selectedAsset && /* @__PURE__ */ (0,
|
|
9656
|
+
action: selectedAsset && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10062
9657
|
CheckoutMaxButton,
|
|
10063
9658
|
{
|
|
10064
9659
|
disabled: isLoading,
|
|
@@ -10067,7 +9662,7 @@ function ActiveView4({
|
|
|
10067
9662
|
)
|
|
10068
9663
|
}
|
|
10069
9664
|
),
|
|
10070
|
-
state.inputAssets.length > 0 && /* @__PURE__ */ (0,
|
|
9665
|
+
state.inputAssets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10071
9666
|
CheckoutPayWithSection,
|
|
10072
9667
|
{
|
|
10073
9668
|
inputAssets: state.inputAssets,
|
|
@@ -10085,10 +9680,10 @@ function CompletedView3({
|
|
|
10085
9680
|
onEvent,
|
|
10086
9681
|
className
|
|
10087
9682
|
}) {
|
|
10088
|
-
return /* @__PURE__ */ (0,
|
|
9683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CheckoutStepCard, { state: "completed", title: TITLE6, className, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
10089
9684
|
CompletedStepSummary,
|
|
10090
9685
|
{
|
|
10091
|
-
icon: /* @__PURE__ */ (0,
|
|
9686
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(AssetIcon, { asset: state.inputAsset, size: 40 }),
|
|
10092
9687
|
title: state.amountFormatted,
|
|
10093
9688
|
editLabel: "Edit",
|
|
10094
9689
|
onEdit: () => onEvent({ type: "ON_EDIT_AMOUNT" })
|
|
@@ -10097,52 +9692,145 @@ function CompletedView3({
|
|
|
10097
9692
|
}
|
|
10098
9693
|
|
|
10099
9694
|
// src/client/components/checkout/ondo/buy/confirmation/OndoBuyOrderConfirmed.tsx
|
|
9695
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
9696
|
+
var TITLE7 = "Order confirmed";
|
|
9697
|
+
var SHARES_RECEIVED_LABEL = "Shares received";
|
|
9698
|
+
var TOTAL_COST_LABEL = "Total cost";
|
|
9699
|
+
var PRICE_PER_SHARE_LABEL = "Price per share";
|
|
9700
|
+
var DELIVERED_TO_LABEL = "Delivered to";
|
|
9701
|
+
var DONE_LABEL2 = "Done";
|
|
9702
|
+
var subtitle = (symbol) => `Your ${symbol} shares have been delivered to your wallet.`;
|
|
9703
|
+
function OndoBuyOrderConfirmed({
|
|
9704
|
+
state,
|
|
9705
|
+
onEvent,
|
|
9706
|
+
className
|
|
9707
|
+
}) {
|
|
9708
|
+
if (state.type === "hidden") {
|
|
9709
|
+
return null;
|
|
9710
|
+
}
|
|
9711
|
+
const onClose = () => onEvent({ type: "ON_CLOSE_ORDER_CONFIRMED" });
|
|
9712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
9713
|
+
CheckoutConfirmationDialog,
|
|
9714
|
+
{
|
|
9715
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(CheckoutSuccessGlyph, {}),
|
|
9716
|
+
title: TITLE7,
|
|
9717
|
+
subtitle: subtitle(state.outputAsset.symbol),
|
|
9718
|
+
header: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AssetSummaryRow, { asset: state.outputAsset, wrapIdentity: true }),
|
|
9719
|
+
rows: detailRows3(state),
|
|
9720
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
9721
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ClButton, { variant: "gradient", fullWidth: true, onClick: onClose, children: DONE_LABEL2 }),
|
|
9722
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(CheckoutExplorerLink, { url: state.txExplorerUrl })
|
|
9723
|
+
] }),
|
|
9724
|
+
onClose,
|
|
9725
|
+
className
|
|
9726
|
+
}
|
|
9727
|
+
) });
|
|
9728
|
+
}
|
|
9729
|
+
function detailRows3(state) {
|
|
9730
|
+
return [
|
|
9731
|
+
{ label: SHARES_RECEIVED_LABEL, value: state.outputAmount },
|
|
9732
|
+
{ label: TOTAL_COST_LABEL, value: state.totalCost },
|
|
9733
|
+
{ label: PRICE_PER_SHARE_LABEL, value: state.pricePerShare },
|
|
9734
|
+
{ label: DELIVERED_TO_LABEL, value: state.recipientAddress }
|
|
9735
|
+
];
|
|
9736
|
+
}
|
|
9737
|
+
|
|
9738
|
+
// src/client/components/checkout/ondo/shared/constants.ts
|
|
9739
|
+
var ONDO_TOS_URL = "https://docs.ondo.finance/legal/terms-of-service";
|
|
9740
|
+
|
|
9741
|
+
// src/client/components/checkout/shared/review/CheckoutReviewError.tsx
|
|
9742
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
9743
|
+
var RETRY_LABEL = "Try again";
|
|
9744
|
+
function CheckoutReviewError({
|
|
9745
|
+
title: title2,
|
|
9746
|
+
heading,
|
|
9747
|
+
description: description2,
|
|
9748
|
+
onRetry,
|
|
9749
|
+
className
|
|
9750
|
+
}) {
|
|
9751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CheckoutStepCard, { state: "active", title: title2, className, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:items-center clcosdk:gap-4 clcosdk:py-8 clcosdk:text-center", children: [
|
|
9752
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:items-center clcosdk:gap-2", children: [
|
|
9753
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
9754
|
+
"h3",
|
|
9755
|
+
{
|
|
9756
|
+
className: cn(
|
|
9757
|
+
typeClasses.h4,
|
|
9758
|
+
"clcosdk:font-medium clcosdk:text-text-primary"
|
|
9759
|
+
),
|
|
9760
|
+
children: heading
|
|
9761
|
+
}
|
|
9762
|
+
),
|
|
9763
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
9764
|
+
"p",
|
|
9765
|
+
{
|
|
9766
|
+
className: cn(
|
|
9767
|
+
typeClasses.body,
|
|
9768
|
+
"clcosdk:max-w-md clcosdk:text-text-secondary"
|
|
9769
|
+
),
|
|
9770
|
+
children: description2
|
|
9771
|
+
}
|
|
9772
|
+
)
|
|
9773
|
+
] }),
|
|
9774
|
+
onRetry !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ClButton, { variant: "secondary", onClick: onRetry, children: RETRY_LABEL })
|
|
9775
|
+
] }) }) });
|
|
9776
|
+
}
|
|
9777
|
+
|
|
9778
|
+
// src/client/components/checkout/shared/review/CheckoutReviewLoading.tsx
|
|
10100
9779
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
10101
|
-
var
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
10106
|
-
|
|
10107
|
-
var subtitle = (symbol) => `Your ${symbol} shares have been delivered to your wallet.`;
|
|
10108
|
-
function OndoBuyOrderConfirmed({
|
|
10109
|
-
state,
|
|
10110
|
-
onEvent,
|
|
9780
|
+
var DETAIL_ROW_KEYS = ["first", "second", "third", "fourth"];
|
|
9781
|
+
function CheckoutReviewLoading({
|
|
9782
|
+
title: title2,
|
|
9783
|
+
statusLabel,
|
|
9784
|
+
detailRowCount,
|
|
9785
|
+
showTotal = true,
|
|
10111
9786
|
className
|
|
10112
9787
|
}) {
|
|
10113
|
-
|
|
10114
|
-
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10122
|
-
|
|
10123
|
-
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
|
|
10131
|
-
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
|
|
10135
|
-
|
|
10136
|
-
|
|
10137
|
-
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
|
|
9788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(CheckoutStepCard, { state: "active", title: title2, className, children: [
|
|
9789
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("output", { className: "clcosdk:sr-only", children: statusLabel }),
|
|
9790
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-4 clcosdk:rounded-2xl clcosdk:border clcosdk:border-border clcosdk:p-4", children: [
|
|
9791
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Skeleton, { className: "clcosdk:h-3 clcosdk:w-20" }),
|
|
9792
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "clcosdk:flex clcosdk:items-center clcosdk:gap-3", children: [
|
|
9793
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
9794
|
+
Skeleton,
|
|
9795
|
+
{
|
|
9796
|
+
variant: "circular",
|
|
9797
|
+
className: "clcosdk:size-10 clcosdk:shrink-0"
|
|
9798
|
+
}
|
|
9799
|
+
),
|
|
9800
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-2", children: [
|
|
9801
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Skeleton, { className: "clcosdk:h-5 clcosdk:w-32" }),
|
|
9802
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Skeleton, { className: "clcosdk:h-3 clcosdk:w-24" })
|
|
9803
|
+
] })
|
|
9804
|
+
] })
|
|
9805
|
+
] }),
|
|
9806
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "clcosdk:flex clcosdk:flex-col clcosdk:gap-3 clcosdk:px-2", children: DETAIL_ROW_KEYS.slice(0, detailRowCount).map((row) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
9807
|
+
"div",
|
|
9808
|
+
{
|
|
9809
|
+
className: "clcosdk:flex clcosdk:items-center clcosdk:justify-between clcosdk:gap-4",
|
|
9810
|
+
children: [
|
|
9811
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Skeleton, { className: "clcosdk:h-4 clcosdk:w-28" }),
|
|
9812
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Skeleton, { className: "clcosdk:h-4 clcosdk:w-24" })
|
|
9813
|
+
]
|
|
9814
|
+
},
|
|
9815
|
+
row
|
|
9816
|
+
)) }),
|
|
9817
|
+
showTotal && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
|
|
9818
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "clcosdk:h-px clcosdk:shrink-0 clcosdk:bg-divider" }),
|
|
9819
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "clcosdk:flex clcosdk:items-center clcosdk:justify-between clcosdk:gap-4 clcosdk:px-2", children: [
|
|
9820
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Skeleton, { className: "clcosdk:h-4 clcosdk:w-16" }),
|
|
9821
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Skeleton, { className: "clcosdk:h-4 clcosdk:w-20" })
|
|
9822
|
+
] })
|
|
9823
|
+
] }),
|
|
9824
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
9825
|
+
Skeleton,
|
|
9826
|
+
{
|
|
9827
|
+
variant: "rectangular",
|
|
9828
|
+
className: "clcosdk:h-[54px] clcosdk:w-full clcosdk:rounded-full"
|
|
9829
|
+
}
|
|
9830
|
+
)
|
|
9831
|
+
] }) });
|
|
10141
9832
|
}
|
|
10142
9833
|
|
|
10143
|
-
// src/client/components/checkout/ondo/shared/constants.ts
|
|
10144
|
-
var ONDO_TOS_URL = "https://docs.ondo.finance/legal/terms-of-service";
|
|
10145
|
-
|
|
10146
9834
|
// src/client/components/checkout/ondo/buy/review/OndoBuyReviewView.tsx
|
|
10147
9835
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
10148
9836
|
var TITLE8 = "3. Review and confirm";
|
|
@@ -10154,9 +9842,9 @@ var COINLIST_FEE_LABEL2 = "CoinList fee";
|
|
|
10154
9842
|
var COINLIST_FEE_TOOLTIP2 = "CoinList's fee for this order. It is already included in the total you pay.";
|
|
10155
9843
|
var TOTAL_LABEL2 = "Total";
|
|
10156
9844
|
var REFRESH_QUOTE_LABEL = "Refresh quote";
|
|
10157
|
-
var
|
|
10158
|
-
var
|
|
10159
|
-
var
|
|
9845
|
+
var LOADING_STATUS = "Loading your order details\u2026";
|
|
9846
|
+
var ERROR_TITLE = "Something went wrong";
|
|
9847
|
+
var ERROR_DESCRIPTION = "We couldn't load your order details. Please try again.";
|
|
10160
9848
|
function OndoBuyReviewView(props) {
|
|
10161
9849
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(OndoReviewViewBody, { ...props }) });
|
|
10162
9850
|
}
|
|
@@ -10180,7 +9868,7 @@ function OndoReviewViewBody({
|
|
|
10180
9868
|
CheckoutReviewLoading,
|
|
10181
9869
|
{
|
|
10182
9870
|
title: TITLE8,
|
|
10183
|
-
statusLabel:
|
|
9871
|
+
statusLabel: LOADING_STATUS,
|
|
10184
9872
|
detailRowCount: 3,
|
|
10185
9873
|
className
|
|
10186
9874
|
}
|
|
@@ -10190,8 +9878,8 @@ function OndoReviewViewBody({
|
|
|
10190
9878
|
CheckoutReviewError,
|
|
10191
9879
|
{
|
|
10192
9880
|
title: TITLE8,
|
|
10193
|
-
heading:
|
|
10194
|
-
description:
|
|
9881
|
+
heading: ERROR_TITLE,
|
|
9882
|
+
description: ERROR_DESCRIPTION,
|
|
10195
9883
|
onRetry: () => onEvent({ type: "ON_RETRY" }),
|
|
10196
9884
|
className
|
|
10197
9885
|
}
|
|
@@ -10801,10 +10489,10 @@ function OndoBuyCheckoutView({
|
|
|
10801
10489
|
}
|
|
10802
10490
|
|
|
10803
10491
|
// src/client/hooks/checkout/ondo/buy/useOndoBuyCheckoutViewModel.ts
|
|
10804
|
-
var
|
|
10492
|
+
var import_react27 = require("react");
|
|
10805
10493
|
|
|
10806
10494
|
// src/client/hooks/checkout/ondo/buy/amount/useOndoBuyAmountViewModel.ts
|
|
10807
|
-
var
|
|
10495
|
+
var import_react20 = require("react");
|
|
10808
10496
|
var NO_WALLET2 = EvmWalletAddress(
|
|
10809
10497
|
"0x0000000000000000000000000000000000000000"
|
|
10810
10498
|
);
|
|
@@ -10822,13 +10510,13 @@ function useOndoBuyAmountViewModel({
|
|
|
10822
10510
|
}) {
|
|
10823
10511
|
const { coinlist } = useCoinList();
|
|
10824
10512
|
const locale = useLocale();
|
|
10825
|
-
const [amountInput, setAmountInput] = (0,
|
|
10826
|
-
const [selectedAsset, setSelectedAsset] = (0,
|
|
10513
|
+
const [amountInput, setAmountInput] = (0, import_react20.useState)("");
|
|
10514
|
+
const [selectedAsset, setSelectedAsset] = (0, import_react20.useState)(
|
|
10827
10515
|
ONDO_SUPPORTED_INPUT_ASSETS[0]
|
|
10828
10516
|
);
|
|
10829
|
-
const [error, setError] = (0,
|
|
10830
|
-
const [phase, setPhase] = (0,
|
|
10831
|
-
const preparationIdRef = (0,
|
|
10517
|
+
const [error, setError] = (0, import_react20.useState)(null);
|
|
10518
|
+
const [phase, setPhase] = (0, import_react20.useState)(null);
|
|
10519
|
+
const preparationIdRef = (0, import_react20.useRef)(0);
|
|
10832
10520
|
const isActive = stepInput.type === "active";
|
|
10833
10521
|
const networkName = getNetworkName(chain);
|
|
10834
10522
|
const marketClosed = isActive && stepInput.tradingStatus?.type === "not-tradable";
|
|
@@ -10838,7 +10526,7 @@ function useOndoBuyAmountViewModel({
|
|
|
10838
10526
|
assets: ONDO_SUPPORTED_INPUT_ASSETS,
|
|
10839
10527
|
enabled: enabled && isActive
|
|
10840
10528
|
});
|
|
10841
|
-
(0,
|
|
10529
|
+
(0, import_react20.useEffect)(() => {
|
|
10842
10530
|
if (stepInput.type === "incomplete") {
|
|
10843
10531
|
++preparationIdRef.current;
|
|
10844
10532
|
setAmountInput("");
|
|
@@ -11005,7 +10693,7 @@ function validateAmount({
|
|
|
11005
10693
|
if (balance !== null && amount.raw > balance) {
|
|
11006
10694
|
return { valid: false, error: `Insufficient ${symbol}.` };
|
|
11007
10695
|
}
|
|
11008
|
-
const minimum =
|
|
10696
|
+
const minimum = minimumAmount2(minimumPurchaseUsd, decimals);
|
|
11009
10697
|
if (minimum !== null && amount.raw < minimum.raw) {
|
|
11010
10698
|
return {
|
|
11011
10699
|
valid: false,
|
|
@@ -11021,7 +10709,7 @@ function validateAmount({
|
|
|
11021
10709
|
}
|
|
11022
10710
|
return { valid: true, amount };
|
|
11023
10711
|
}
|
|
11024
|
-
function
|
|
10712
|
+
function minimumAmount2(minimumPurchaseUsd, decimals) {
|
|
11025
10713
|
if (minimumPurchaseUsd === null) return null;
|
|
11026
10714
|
const parsed = parseBlockchainAmount(String(minimumPurchaseUsd), decimals);
|
|
11027
10715
|
return parsed.valid ? parsed.amount : null;
|
|
@@ -11097,10 +10785,10 @@ function preparationErrorMessage2(error) {
|
|
|
11097
10785
|
}
|
|
11098
10786
|
|
|
11099
10787
|
// src/client/hooks/checkout/ondo/buy/review/useOndoBuyReviewViewModel.ts
|
|
11100
|
-
var
|
|
10788
|
+
var import_react23 = require("react");
|
|
11101
10789
|
|
|
11102
10790
|
// src/client/hooks/checkout/ondo/buy/data/useOndoBuyTransaction.ts
|
|
11103
|
-
var
|
|
10791
|
+
var import_react21 = require("react");
|
|
11104
10792
|
|
|
11105
10793
|
// src/client/hooks/checkout/ondo/shared/data/ondo-load-error.ts
|
|
11106
10794
|
function ondoLoadErrorReason(error) {
|
|
@@ -11114,7 +10802,7 @@ function useOndoBuyTransaction(options) {
|
|
|
11114
10802
|
const { request, data, enabled } = options;
|
|
11115
10803
|
const { coinlist, isReady } = useCoinList();
|
|
11116
10804
|
const log = useLogger("useOndoBuyTransaction");
|
|
11117
|
-
const [state, setState] = (0,
|
|
10805
|
+
const [state, setState] = (0, import_react21.useState)(
|
|
11118
10806
|
() => data === void 0 ? { type: "LOADING" } : {
|
|
11119
10807
|
type: "CONTENT",
|
|
11120
10808
|
transaction: data,
|
|
@@ -11122,12 +10810,12 @@ function useOndoBuyTransaction(options) {
|
|
|
11122
10810
|
refreshError: null
|
|
11123
10811
|
}
|
|
11124
10812
|
);
|
|
11125
|
-
const fetchIdRef = (0,
|
|
11126
|
-
const isFetchingRef = (0,
|
|
10813
|
+
const fetchIdRef = (0, import_react21.useRef)(0);
|
|
10814
|
+
const isFetchingRef = (0, import_react21.useRef)(false);
|
|
11127
10815
|
const requestKey = request === null ? null : stableKey(request);
|
|
11128
|
-
const requestRef = (0,
|
|
10816
|
+
const requestRef = (0, import_react21.useRef)(request);
|
|
11129
10817
|
requestRef.current = request;
|
|
11130
|
-
const build = (0,
|
|
10818
|
+
const build = (0, import_react21.useCallback)(async () => {
|
|
11131
10819
|
const params = requestRef.current;
|
|
11132
10820
|
if (!isReady || !enabled || params === null) return;
|
|
11133
10821
|
if (isFetchingRef.current) return;
|
|
@@ -11163,7 +10851,7 @@ function useOndoBuyTransaction(options) {
|
|
|
11163
10851
|
isFetchingRef.current = false;
|
|
11164
10852
|
}
|
|
11165
10853
|
}, [coinlist, isReady, enabled, log]);
|
|
11166
|
-
(0,
|
|
10854
|
+
(0, import_react21.useEffect)(() => {
|
|
11167
10855
|
if (data === void 0) return;
|
|
11168
10856
|
++fetchIdRef.current;
|
|
11169
10857
|
setState({
|
|
@@ -11174,14 +10862,14 @@ function useOndoBuyTransaction(options) {
|
|
|
11174
10862
|
});
|
|
11175
10863
|
}, [data]);
|
|
11176
10864
|
const hasSeed = data !== void 0;
|
|
11177
|
-
(0,
|
|
10865
|
+
(0, import_react21.useEffect)(() => {
|
|
11178
10866
|
if (hasSeed || requestKey === null) return;
|
|
11179
10867
|
build();
|
|
11180
10868
|
return () => {
|
|
11181
10869
|
++fetchIdRef.current;
|
|
11182
10870
|
};
|
|
11183
10871
|
}, [build, requestKey, hasSeed]);
|
|
11184
|
-
const refetch = (0,
|
|
10872
|
+
const refetch = (0, import_react21.useCallback)(() => {
|
|
11185
10873
|
build();
|
|
11186
10874
|
}, [build]);
|
|
11187
10875
|
return { state, refetch };
|
|
@@ -11197,7 +10885,7 @@ function stableKey(request) {
|
|
|
11197
10885
|
}
|
|
11198
10886
|
|
|
11199
10887
|
// src/client/ui/hooks/useCountdown.ts
|
|
11200
|
-
var
|
|
10888
|
+
var import_react22 = require("react");
|
|
11201
10889
|
var DEFAULT_TICK_MS = 1e3;
|
|
11202
10890
|
function useCountdown({
|
|
11203
10891
|
until,
|
|
@@ -11205,8 +10893,8 @@ function useCountdown({
|
|
|
11205
10893
|
enabled = true
|
|
11206
10894
|
}) {
|
|
11207
10895
|
const untilMs = until?.getTime() ?? null;
|
|
11208
|
-
const [, tick] = (0,
|
|
11209
|
-
(0,
|
|
10896
|
+
const [, tick] = (0, import_react22.useReducer)(nextTick, 0);
|
|
10897
|
+
(0, import_react22.useEffect)(() => {
|
|
11210
10898
|
if (untilMs === null || !enabled || remainingSeconds(untilMs) === 0) return;
|
|
11211
10899
|
const interval = setInterval(() => {
|
|
11212
10900
|
tick();
|
|
@@ -11236,8 +10924,8 @@ function useOndoBuyReviewViewModel({
|
|
|
11236
10924
|
}) {
|
|
11237
10925
|
const { coinlist } = useCoinList();
|
|
11238
10926
|
const locale = useLocale();
|
|
11239
|
-
const [phase, setPhase] = (0,
|
|
11240
|
-
const [error, setError] = (0,
|
|
10927
|
+
const [phase, setPhase] = (0, import_react23.useState)(null);
|
|
10928
|
+
const [error, setError] = (0, import_react23.useState)(null);
|
|
11241
10929
|
const isActive = stepInput.type === "active";
|
|
11242
10930
|
const { state: transactionState, refetch } = useOndoBuyTransaction({
|
|
11243
10931
|
request: isActive ? {
|
|
@@ -11249,15 +10937,15 @@ function useOndoBuyReviewViewModel({
|
|
|
11249
10937
|
data: isActive ? stepInput.transaction : void 0,
|
|
11250
10938
|
enabled: enabled && isActive
|
|
11251
10939
|
});
|
|
11252
|
-
const executionIdRef = (0,
|
|
11253
|
-
(0,
|
|
10940
|
+
const executionIdRef = (0, import_react23.useRef)(0);
|
|
10941
|
+
(0, import_react23.useEffect)(() => {
|
|
11254
10942
|
if (stepInput.type === "incomplete") {
|
|
11255
10943
|
++executionIdRef.current;
|
|
11256
10944
|
setError(null);
|
|
11257
10945
|
}
|
|
11258
10946
|
}, [stepInput.type]);
|
|
11259
10947
|
const transaction = transactionState.type === "CONTENT" ? transactionState.transaction : null;
|
|
11260
|
-
const offerUntil = (0,
|
|
10948
|
+
const offerUntil = (0, import_react23.useMemo)(
|
|
11261
10949
|
() => transaction === null ? null : ondoQuoteOfferDeadline(transaction.expiresAt),
|
|
11262
10950
|
[transaction]
|
|
11263
10951
|
);
|
|
@@ -11446,8 +11134,8 @@ function executionErrorMessage(error) {
|
|
|
11446
11134
|
}
|
|
11447
11135
|
|
|
11448
11136
|
// src/client/hooks/checkout/ondo/shared/data/useOndoPrice.ts
|
|
11449
|
-
var
|
|
11450
|
-
var
|
|
11137
|
+
var import_react24 = require("react");
|
|
11138
|
+
var LOADING2 = { type: "LOADING" };
|
|
11451
11139
|
function useOndoPrice(options) {
|
|
11452
11140
|
const {
|
|
11453
11141
|
symbol,
|
|
@@ -11459,14 +11147,14 @@ function useOndoPrice(options) {
|
|
|
11459
11147
|
} = options;
|
|
11460
11148
|
const { coinlist, isReady } = useCoinList();
|
|
11461
11149
|
const log = useLogger("useOndoPrice");
|
|
11462
|
-
const [state, setState] = (0,
|
|
11463
|
-
() => data === void 0 ?
|
|
11150
|
+
const [state, setState] = (0, import_react24.useState)(
|
|
11151
|
+
() => data === void 0 ? LOADING2 : { type: "CONTENT", quote: data, isRefreshing: false }
|
|
11464
11152
|
);
|
|
11465
|
-
const fetchIdRef = (0,
|
|
11466
|
-
const isFetchingRef = (0,
|
|
11467
|
-
const hasQuoteRef = (0,
|
|
11153
|
+
const fetchIdRef = (0, import_react24.useRef)(0);
|
|
11154
|
+
const isFetchingRef = (0, import_react24.useRef)(false);
|
|
11155
|
+
const hasQuoteRef = (0, import_react24.useRef)(data !== void 0);
|
|
11468
11156
|
const sizeKey = quoteSizeKey(size);
|
|
11469
|
-
(0,
|
|
11157
|
+
(0, import_react24.useEffect)(() => {
|
|
11470
11158
|
if (!isReady || !enabled) return;
|
|
11471
11159
|
const size2 = quoteSizeFromKey(sizeKey);
|
|
11472
11160
|
const currentFetchId = ++fetchIdRef.current;
|
|
@@ -11539,11 +11227,11 @@ function quoteSizeFromKey(key) {
|
|
|
11539
11227
|
}
|
|
11540
11228
|
|
|
11541
11229
|
// src/client/hooks/checkout/ondo/shared/data/useOndoTradingStatus.ts
|
|
11542
|
-
var
|
|
11230
|
+
var import_react25 = require("react");
|
|
11543
11231
|
function isNotTradable(state) {
|
|
11544
11232
|
return state.type === "CONTENT" && state.status.type === "not-tradable";
|
|
11545
11233
|
}
|
|
11546
|
-
var
|
|
11234
|
+
var LOADING3 = { type: "LOADING" };
|
|
11547
11235
|
function useOndoTradingStatus(options) {
|
|
11548
11236
|
const {
|
|
11549
11237
|
symbol,
|
|
@@ -11554,13 +11242,13 @@ function useOndoTradingStatus(options) {
|
|
|
11554
11242
|
} = options;
|
|
11555
11243
|
const { coinlist, isReady } = useCoinList();
|
|
11556
11244
|
const log = useLogger("useOndoTradingStatus");
|
|
11557
|
-
const [state, setState] = (0,
|
|
11558
|
-
() => data === void 0 ?
|
|
11245
|
+
const [state, setState] = (0, import_react25.useState)(
|
|
11246
|
+
() => data === void 0 ? LOADING3 : { type: "CONTENT", status: data }
|
|
11559
11247
|
);
|
|
11560
|
-
const fetchIdRef = (0,
|
|
11561
|
-
const isFetchingRef = (0,
|
|
11562
|
-
const hasStatusRef = (0,
|
|
11563
|
-
(0,
|
|
11248
|
+
const fetchIdRef = (0, import_react25.useRef)(0);
|
|
11249
|
+
const isFetchingRef = (0, import_react25.useRef)(false);
|
|
11250
|
+
const hasStatusRef = (0, import_react25.useRef)(data !== void 0);
|
|
11251
|
+
(0, import_react25.useEffect)(() => {
|
|
11564
11252
|
if (!isReady || !enabled) return;
|
|
11565
11253
|
const currentFetchId = ++fetchIdRef.current;
|
|
11566
11254
|
isFetchingRef.current = false;
|
|
@@ -11706,7 +11394,7 @@ function toMarketUi(state) {
|
|
|
11706
11394
|
}
|
|
11707
11395
|
|
|
11708
11396
|
// src/client/hooks/checkout/ondo/shared/wallet/useOndoWalletSelectViewModel.ts
|
|
11709
|
-
var
|
|
11397
|
+
var import_react26 = require("react");
|
|
11710
11398
|
var CONNECT_FAILED2 = "Could not connect that wallet. Please try again.";
|
|
11711
11399
|
function useOndoWalletSelectViewModel({
|
|
11712
11400
|
stepInput,
|
|
@@ -11716,8 +11404,8 @@ function useOndoWalletSelectViewModel({
|
|
|
11716
11404
|
onEdit
|
|
11717
11405
|
}) {
|
|
11718
11406
|
const log = useLogger("useOndoWalletSelectViewModel");
|
|
11719
|
-
const [selected, setSelected] = (0,
|
|
11720
|
-
const [error, setError] = (0,
|
|
11407
|
+
const [selected, setSelected] = (0, import_react26.useState)(null);
|
|
11408
|
+
const [error, setError] = (0, import_react26.useState)(null);
|
|
11721
11409
|
const networkName = getNetworkName(chain);
|
|
11722
11410
|
const selectedWallet = resolveWallet2(wallets, selected);
|
|
11723
11411
|
const uiState = () => {
|
|
@@ -11856,8 +11544,8 @@ function useOndoBuyCheckoutViewModel({
|
|
|
11856
11544
|
onOrderConfirmed
|
|
11857
11545
|
}) {
|
|
11858
11546
|
const locale = useLocale();
|
|
11859
|
-
const [step, setStep] = (0,
|
|
11860
|
-
const [orderConfirmed, setOrderConfirmed] = (0,
|
|
11547
|
+
const [step, setStep] = (0, import_react27.useState)({ type: "wallet" });
|
|
11548
|
+
const [orderConfirmed, setOrderConfirmed] = (0, import_react27.useState)(null);
|
|
11861
11549
|
const swappableHere = swapSpender(offer.swapContracts, chain) !== null;
|
|
11862
11550
|
const live = enabled && swappableHere;
|
|
11863
11551
|
const { state: tradingStatusState } = useOndoTradingStatus({
|
|
@@ -12337,9 +12025,9 @@ var MINIMUM_RECEIVED_TOOLTIP = "The least this order will settle for, after fees
|
|
|
12337
12025
|
var COINLIST_FEE_LABEL3 = "Expected CoinList fee";
|
|
12338
12026
|
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.";
|
|
12339
12027
|
var REFRESH_QUOTE_LABEL2 = "Refresh quote";
|
|
12340
|
-
var
|
|
12341
|
-
var
|
|
12342
|
-
var
|
|
12028
|
+
var LOADING_STATUS2 = "Loading your order details\u2026";
|
|
12029
|
+
var ERROR_TITLE2 = "Something went wrong";
|
|
12030
|
+
var ERROR_DESCRIPTION2 = "We couldn't load your order details. Please try again.";
|
|
12343
12031
|
function OndoSellReviewView(props) {
|
|
12344
12032
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(OndoSellReviewViewBody, { ...props }) });
|
|
12345
12033
|
}
|
|
@@ -12365,7 +12053,7 @@ function OndoSellReviewViewBody({
|
|
|
12365
12053
|
CheckoutReviewLoading,
|
|
12366
12054
|
{
|
|
12367
12055
|
title: title2,
|
|
12368
|
-
statusLabel:
|
|
12056
|
+
statusLabel: LOADING_STATUS2,
|
|
12369
12057
|
detailRowCount: 3,
|
|
12370
12058
|
showTotal: false,
|
|
12371
12059
|
className
|
|
@@ -12376,8 +12064,8 @@ function OndoSellReviewViewBody({
|
|
|
12376
12064
|
CheckoutReviewError,
|
|
12377
12065
|
{
|
|
12378
12066
|
title: title2,
|
|
12379
|
-
heading:
|
|
12380
|
-
description:
|
|
12067
|
+
heading: ERROR_TITLE2,
|
|
12068
|
+
description: ERROR_DESCRIPTION2,
|
|
12381
12069
|
onRetry: () => onEvent({ type: "ON_SELL_RETRY" }),
|
|
12382
12070
|
className
|
|
12383
12071
|
}
|
|
@@ -12588,13 +12276,13 @@ function ContentView({
|
|
|
12588
12276
|
}
|
|
12589
12277
|
|
|
12590
12278
|
// src/client/hooks/checkout/ondo/sell/useOndoSellCheckoutViewModel.ts
|
|
12591
|
-
var
|
|
12279
|
+
var import_react32 = require("react");
|
|
12592
12280
|
|
|
12593
12281
|
// src/client/hooks/checkout/ondo/sell/amount/useOndoSellAmountViewModel.ts
|
|
12594
|
-
var
|
|
12282
|
+
var import_react29 = require("react");
|
|
12595
12283
|
|
|
12596
12284
|
// src/client/hooks/shared/erc20/useErc20Balance.ts
|
|
12597
|
-
var
|
|
12285
|
+
var import_react28 = require("react");
|
|
12598
12286
|
function useErc20Balance(options) {
|
|
12599
12287
|
const {
|
|
12600
12288
|
tokenAddress,
|
|
@@ -12605,12 +12293,12 @@ function useErc20Balance(options) {
|
|
|
12605
12293
|
} = options;
|
|
12606
12294
|
const { coinlist, isReady } = useCoinList();
|
|
12607
12295
|
const log = useLogger("useErc20Balance");
|
|
12608
|
-
const [balance, setBalance] = (0,
|
|
12609
|
-
const [isLoading, setIsLoading] = (0,
|
|
12610
|
-
const fetchIdRef = (0,
|
|
12611
|
-
const isFetchingRef = (0,
|
|
12612
|
-
const hasReadRef = (0,
|
|
12613
|
-
(0,
|
|
12296
|
+
const [balance, setBalance] = (0, import_react28.useState)(null);
|
|
12297
|
+
const [isLoading, setIsLoading] = (0, import_react28.useState)(true);
|
|
12298
|
+
const fetchIdRef = (0, import_react28.useRef)(0);
|
|
12299
|
+
const isFetchingRef = (0, import_react28.useRef)(false);
|
|
12300
|
+
const hasReadRef = (0, import_react28.useRef)(false);
|
|
12301
|
+
(0, import_react28.useEffect)(() => {
|
|
12614
12302
|
if (!isReady) return;
|
|
12615
12303
|
setBalance(null);
|
|
12616
12304
|
hasReadRef.current = false;
|
|
@@ -12694,10 +12382,10 @@ function useOndoSellAmountViewModel({
|
|
|
12694
12382
|
}) {
|
|
12695
12383
|
const { coinlist } = useCoinList();
|
|
12696
12384
|
const locale = useLocale();
|
|
12697
|
-
const [amountInput, setAmountInput] = (0,
|
|
12698
|
-
const [error, setError] = (0,
|
|
12699
|
-
const [phase, setPhase] = (0,
|
|
12700
|
-
const preparationIdRef = (0,
|
|
12385
|
+
const [amountInput, setAmountInput] = (0, import_react29.useState)("");
|
|
12386
|
+
const [error, setError] = (0, import_react29.useState)(null);
|
|
12387
|
+
const [phase, setPhase] = (0, import_react29.useState)(null);
|
|
12388
|
+
const preparationIdRef = (0, import_react29.useRef)(0);
|
|
12701
12389
|
const isActive = stepInput.type === "active";
|
|
12702
12390
|
const networkName = getNetworkName(chain);
|
|
12703
12391
|
const sellAsset2 = isActive ? stepInput.sellAsset : null;
|
|
@@ -12708,7 +12396,7 @@ function useOndoSellAmountViewModel({
|
|
|
12708
12396
|
chain,
|
|
12709
12397
|
enabled: enabled && isActive && sellAsset2 !== null
|
|
12710
12398
|
});
|
|
12711
|
-
(0,
|
|
12399
|
+
(0, import_react29.useEffect)(() => {
|
|
12712
12400
|
if (stepInput.type === "incomplete") {
|
|
12713
12401
|
++preparationIdRef.current;
|
|
12714
12402
|
setAmountInput("");
|
|
@@ -12945,15 +12633,15 @@ function preparationErrorMessage3(error) {
|
|
|
12945
12633
|
}
|
|
12946
12634
|
|
|
12947
12635
|
// src/client/hooks/checkout/ondo/sell/review/useOndoSellReviewViewModel.ts
|
|
12948
|
-
var
|
|
12636
|
+
var import_react31 = require("react");
|
|
12949
12637
|
|
|
12950
12638
|
// src/client/hooks/checkout/ondo/sell/data/useOndoSellTransaction.ts
|
|
12951
|
-
var
|
|
12639
|
+
var import_react30 = require("react");
|
|
12952
12640
|
function useOndoSellTransaction(options) {
|
|
12953
12641
|
const { request, data, enabled } = options;
|
|
12954
12642
|
const { coinlist, isReady } = useCoinList();
|
|
12955
12643
|
const log = useLogger("useOndoSellTransaction");
|
|
12956
|
-
const [state, setState] = (0,
|
|
12644
|
+
const [state, setState] = (0, import_react30.useState)(
|
|
12957
12645
|
() => data === void 0 ? { type: "LOADING" } : {
|
|
12958
12646
|
type: "CONTENT",
|
|
12959
12647
|
transaction: data,
|
|
@@ -12961,12 +12649,12 @@ function useOndoSellTransaction(options) {
|
|
|
12961
12649
|
refreshError: null
|
|
12962
12650
|
}
|
|
12963
12651
|
);
|
|
12964
|
-
const fetchIdRef = (0,
|
|
12965
|
-
const isFetchingRef = (0,
|
|
12652
|
+
const fetchIdRef = (0, import_react30.useRef)(0);
|
|
12653
|
+
const isFetchingRef = (0, import_react30.useRef)(false);
|
|
12966
12654
|
const requestKey = request === null ? null : stableKey2(request);
|
|
12967
|
-
const requestRef = (0,
|
|
12655
|
+
const requestRef = (0, import_react30.useRef)(request);
|
|
12968
12656
|
requestRef.current = request;
|
|
12969
|
-
const build = (0,
|
|
12657
|
+
const build = (0, import_react30.useCallback)(async () => {
|
|
12970
12658
|
const params = requestRef.current;
|
|
12971
12659
|
if (!isReady || !enabled || params === null) return;
|
|
12972
12660
|
if (isFetchingRef.current) return;
|
|
@@ -13002,7 +12690,7 @@ function useOndoSellTransaction(options) {
|
|
|
13002
12690
|
isFetchingRef.current = false;
|
|
13003
12691
|
}
|
|
13004
12692
|
}, [coinlist, isReady, enabled, log]);
|
|
13005
|
-
(0,
|
|
12693
|
+
(0, import_react30.useEffect)(() => {
|
|
13006
12694
|
if (data === void 0) return;
|
|
13007
12695
|
++fetchIdRef.current;
|
|
13008
12696
|
setState({
|
|
@@ -13013,14 +12701,14 @@ function useOndoSellTransaction(options) {
|
|
|
13013
12701
|
});
|
|
13014
12702
|
}, [data]);
|
|
13015
12703
|
const hasSeed = data !== void 0;
|
|
13016
|
-
(0,
|
|
12704
|
+
(0, import_react30.useEffect)(() => {
|
|
13017
12705
|
if (hasSeed || requestKey === null) return;
|
|
13018
12706
|
build();
|
|
13019
12707
|
return () => {
|
|
13020
12708
|
++fetchIdRef.current;
|
|
13021
12709
|
};
|
|
13022
12710
|
}, [build, requestKey, hasSeed]);
|
|
13023
|
-
const refetch = (0,
|
|
12711
|
+
const refetch = (0, import_react30.useCallback)(() => {
|
|
13024
12712
|
build();
|
|
13025
12713
|
}, [build]);
|
|
13026
12714
|
return { state, refetch };
|
|
@@ -13045,8 +12733,8 @@ function useOndoSellReviewViewModel({
|
|
|
13045
12733
|
}) {
|
|
13046
12734
|
const { coinlist } = useCoinList();
|
|
13047
12735
|
const locale = useLocale();
|
|
13048
|
-
const [phase, setPhase] = (0,
|
|
13049
|
-
const [error, setError] = (0,
|
|
12736
|
+
const [phase, setPhase] = (0, import_react31.useState)(null);
|
|
12737
|
+
const [error, setError] = (0, import_react31.useState)(null);
|
|
13050
12738
|
const isActive = stepInput.type === "active";
|
|
13051
12739
|
const { state: transactionState, refetch } = useOndoSellTransaction({
|
|
13052
12740
|
request: isActive ? {
|
|
@@ -13058,15 +12746,15 @@ function useOndoSellReviewViewModel({
|
|
|
13058
12746
|
data: isActive ? stepInput.transaction : void 0,
|
|
13059
12747
|
enabled: enabled && isActive
|
|
13060
12748
|
});
|
|
13061
|
-
const executionIdRef = (0,
|
|
13062
|
-
(0,
|
|
12749
|
+
const executionIdRef = (0, import_react31.useRef)(0);
|
|
12750
|
+
(0, import_react31.useEffect)(() => {
|
|
13063
12751
|
if (stepInput.type === "incomplete") {
|
|
13064
12752
|
++executionIdRef.current;
|
|
13065
12753
|
setError(null);
|
|
13066
12754
|
}
|
|
13067
12755
|
}, [stepInput.type]);
|
|
13068
12756
|
const transaction = transactionState.type === "CONTENT" ? transactionState.transaction : null;
|
|
13069
|
-
const offerUntil = (0,
|
|
12757
|
+
const offerUntil = (0, import_react31.useMemo)(
|
|
13070
12758
|
() => transaction === null ? null : ondoQuoteOfferDeadline(transaction.expiresAt),
|
|
13071
12759
|
[transaction]
|
|
13072
12760
|
);
|
|
@@ -13272,12 +12960,12 @@ function useOndoSellCheckoutViewModel({
|
|
|
13272
12960
|
onOrderConfirmed
|
|
13273
12961
|
}) {
|
|
13274
12962
|
const locale = useLocale();
|
|
13275
|
-
const [initialStep] = (0,
|
|
12963
|
+
const [initialStep] = (0, import_react32.useState)(
|
|
13276
12964
|
() => wallets.preselected === null ? { type: "wallet" } : { type: "amount", wallet: wallets.preselected }
|
|
13277
12965
|
);
|
|
13278
|
-
const [step, setStep] = (0,
|
|
12966
|
+
const [step, setStep] = (0, import_react32.useState)(initialStep);
|
|
13279
12967
|
const hasWalletStep = initialStep.type === "wallet";
|
|
13280
|
-
const [orderConfirmed, setOrderConfirmed] = (0,
|
|
12968
|
+
const [orderConfirmed, setOrderConfirmed] = (0, import_react32.useState)(null);
|
|
13281
12969
|
const swappableHere = swapSpender(offer.swapContracts, chain) !== null;
|
|
13282
12970
|
const live = enabled && swappableHere;
|
|
13283
12971
|
const { state: tradingStatusState } = useOndoTradingStatus({
|
|
@@ -13704,7 +13392,7 @@ var SUPERSTATE_TOS_URL = "https://superstate.com/terms";
|
|
|
13704
13392
|
|
|
13705
13393
|
// src/client/components/checkout/superstate/swap/review/SlippagePicker.tsx
|
|
13706
13394
|
var import_lucide_react9 = require("lucide-react");
|
|
13707
|
-
var
|
|
13395
|
+
var import_react33 = require("react");
|
|
13708
13396
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
13709
13397
|
function SlippagePicker({
|
|
13710
13398
|
slippage,
|
|
@@ -13713,7 +13401,7 @@ function SlippagePicker({
|
|
|
13713
13401
|
onSelect,
|
|
13714
13402
|
className
|
|
13715
13403
|
}) {
|
|
13716
|
-
const optionsId = (0,
|
|
13404
|
+
const optionsId = (0, import_react33.useId)();
|
|
13717
13405
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
13718
13406
|
"div",
|
|
13719
13407
|
{
|
|
@@ -13820,9 +13508,9 @@ var COINLIST_FEE_LABEL4 = "CoinList fee";
|
|
|
13820
13508
|
var COINLIST_FEE_TOOLTIP4 = "Transaction fee charged by CoinList";
|
|
13821
13509
|
var TOTAL_LABEL3 = "Total";
|
|
13822
13510
|
var PROCESSING_NOTICE = "Processing onchain. Don't close or refresh this page.";
|
|
13823
|
-
var
|
|
13824
|
-
var
|
|
13825
|
-
var
|
|
13511
|
+
var LOADING_STATUS3 = "Loading your order details\u2026";
|
|
13512
|
+
var ERROR_TITLE3 = "Unable to load quote";
|
|
13513
|
+
var ERROR_DESCRIPTION3 = "We're having trouble fetching a price right now. Please try again.";
|
|
13826
13514
|
function SuperstateReviewView(props) {
|
|
13827
13515
|
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(CoinListStyleScope, { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(SuperstateReviewViewBody, { ...props }) });
|
|
13828
13516
|
}
|
|
@@ -13846,7 +13534,7 @@ function SuperstateReviewViewBody({
|
|
|
13846
13534
|
CheckoutReviewLoading,
|
|
13847
13535
|
{
|
|
13848
13536
|
title: TITLE16,
|
|
13849
|
-
statusLabel:
|
|
13537
|
+
statusLabel: LOADING_STATUS3,
|
|
13850
13538
|
detailRowCount: 3,
|
|
13851
13539
|
className
|
|
13852
13540
|
}
|
|
@@ -13856,8 +13544,8 @@ function SuperstateReviewViewBody({
|
|
|
13856
13544
|
CheckoutReviewError,
|
|
13857
13545
|
{
|
|
13858
13546
|
title: TITLE16,
|
|
13859
|
-
heading:
|
|
13860
|
-
description:
|
|
13547
|
+
heading: ERROR_TITLE3,
|
|
13548
|
+
description: ERROR_DESCRIPTION3,
|
|
13861
13549
|
className
|
|
13862
13550
|
}
|
|
13863
13551
|
);
|
|
@@ -14372,8 +14060,8 @@ function WalletGlyph3() {
|
|
|
14372
14060
|
|
|
14373
14061
|
// src/client/components/checkout/superstate/swap/SuperstateSwapCheckoutView.tsx
|
|
14374
14062
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
14375
|
-
var
|
|
14376
|
-
var
|
|
14063
|
+
var ERROR_TITLE4 = "Failed to load";
|
|
14064
|
+
var ERROR_DESCRIPTION4 = "Something went wrong while loading this sale. Please try again.";
|
|
14377
14065
|
var UNSUPPORTED_CHAIN_TITLE2 = "Not available on this network";
|
|
14378
14066
|
var UNSUPPORTED_CHAIN_DESCRIPTION2 = "This sale cannot be traded on the selected network.";
|
|
14379
14067
|
var RETRY_LABEL2 = "Try again";
|
|
@@ -14449,7 +14137,7 @@ function ErrorView({
|
|
|
14449
14137
|
typeClasses.h3,
|
|
14450
14138
|
"clcosdk:font-medium clcosdk:text-text-primary"
|
|
14451
14139
|
),
|
|
14452
|
-
children: canRetry ?
|
|
14140
|
+
children: canRetry ? ERROR_TITLE4 : UNSUPPORTED_CHAIN_TITLE2
|
|
14453
14141
|
}
|
|
14454
14142
|
),
|
|
14455
14143
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
@@ -14459,7 +14147,7 @@ function ErrorView({
|
|
|
14459
14147
|
typeClasses.body,
|
|
14460
14148
|
"clcosdk:max-w-md clcosdk:text-text-secondary"
|
|
14461
14149
|
),
|
|
14462
|
-
children: canRetry ?
|
|
14150
|
+
children: canRetry ? ERROR_DESCRIPTION4 : UNSUPPORTED_CHAIN_DESCRIPTION2
|
|
14463
14151
|
}
|
|
14464
14152
|
)
|
|
14465
14153
|
] }),
|
|
@@ -14477,10 +14165,10 @@ function ErrorView({
|
|
|
14477
14165
|
}
|
|
14478
14166
|
|
|
14479
14167
|
// src/client/hooks/checkout/superstate/swap/useSuperstateSwapCheckoutViewModel.ts
|
|
14480
|
-
var
|
|
14168
|
+
var import_react39 = require("react");
|
|
14481
14169
|
|
|
14482
14170
|
// src/client/hooks/checkout/superstate/swap/amount/useSuperstateAmountViewModel.ts
|
|
14483
|
-
var
|
|
14171
|
+
var import_react34 = require("react");
|
|
14484
14172
|
var NO_WALLET4 = EvmWalletAddress(
|
|
14485
14173
|
"0x0000000000000000000000000000000000000000"
|
|
14486
14174
|
);
|
|
@@ -14494,11 +14182,11 @@ function useSuperstateAmountViewModel({
|
|
|
14494
14182
|
enabled = true
|
|
14495
14183
|
}) {
|
|
14496
14184
|
const locale = useLocale();
|
|
14497
|
-
const [amountInput, setAmountInput] = (0,
|
|
14498
|
-
const [selectedAsset, setSelectedAsset] = (0,
|
|
14185
|
+
const [amountInput, setAmountInput] = (0, import_react34.useState)("");
|
|
14186
|
+
const [selectedAsset, setSelectedAsset] = (0, import_react34.useState)(
|
|
14499
14187
|
SUPERSTATE_SUPPORTED_INPUT_ASSETS[0]
|
|
14500
14188
|
);
|
|
14501
|
-
const [error, setError] = (0,
|
|
14189
|
+
const [error, setError] = (0, import_react34.useState)(null);
|
|
14502
14190
|
const isActive = stepInput.type === "active";
|
|
14503
14191
|
const networkName = getNetworkName(chain);
|
|
14504
14192
|
const { balances, isLoading: balancesLoading } = useErc20TokenBalances({
|
|
@@ -14511,7 +14199,7 @@ function useSuperstateAmountViewModel({
|
|
|
14511
14199
|
// on this step satisfies the first and not the second.
|
|
14512
14200
|
enabled: enabled && isActive
|
|
14513
14201
|
});
|
|
14514
|
-
(0,
|
|
14202
|
+
(0, import_react34.useEffect)(() => {
|
|
14515
14203
|
if (stepInput.type === "incomplete") {
|
|
14516
14204
|
setAmountInput("");
|
|
14517
14205
|
setSelectedAsset(SUPERSTATE_SUPPORTED_INPUT_ASSETS[0]);
|
|
@@ -14659,20 +14347,20 @@ function validateSuperstateAmount({
|
|
|
14659
14347
|
}
|
|
14660
14348
|
|
|
14661
14349
|
// src/client/hooks/checkout/superstate/swap/data/useSwapOutputToken.ts
|
|
14662
|
-
var
|
|
14350
|
+
var import_react35 = require("react");
|
|
14663
14351
|
var LOADING_STATE2 = { type: "LOADING" };
|
|
14664
14352
|
function useSwapOutputToken(options) {
|
|
14665
14353
|
const { contractAddress, chain, enabled } = options;
|
|
14666
14354
|
const { coinlist, isReady } = useCoinList();
|
|
14667
14355
|
const log = useLogger("useSwapOutputToken");
|
|
14668
|
-
const [outputTokenState, setOutputTokenState] = (0,
|
|
14669
|
-
const [retryCount, setRetryCount] = (0,
|
|
14670
|
-
const fetchIdRef = (0,
|
|
14671
|
-
const refetch = (0,
|
|
14356
|
+
const [outputTokenState, setOutputTokenState] = (0, import_react35.useState)(LOADING_STATE2);
|
|
14357
|
+
const [retryCount, setRetryCount] = (0, import_react35.useState)(0);
|
|
14358
|
+
const fetchIdRef = (0, import_react35.useRef)(0);
|
|
14359
|
+
const refetch = (0, import_react35.useCallback)(() => {
|
|
14672
14360
|
setOutputTokenState(LOADING_STATE2);
|
|
14673
14361
|
setRetryCount((count) => count + 1);
|
|
14674
14362
|
}, []);
|
|
14675
|
-
(0,
|
|
14363
|
+
(0, import_react35.useEffect)(() => {
|
|
14676
14364
|
if (!enabled || !isReady) return;
|
|
14677
14365
|
const currentFetchId = ++fetchIdRef.current;
|
|
14678
14366
|
const load = async () => {
|
|
@@ -14705,7 +14393,7 @@ function useSwapOutputToken(options) {
|
|
|
14705
14393
|
}
|
|
14706
14394
|
|
|
14707
14395
|
// src/client/hooks/checkout/superstate/swap/data/useSwapQuote.ts
|
|
14708
|
-
var
|
|
14396
|
+
var import_react36 = require("react");
|
|
14709
14397
|
function useSwapQuote(options) {
|
|
14710
14398
|
const {
|
|
14711
14399
|
contractAddress,
|
|
@@ -14718,13 +14406,13 @@ function useSwapQuote(options) {
|
|
|
14718
14406
|
} = options;
|
|
14719
14407
|
const { coinlist, isReady } = useCoinList();
|
|
14720
14408
|
const log = useLogger("useSwapQuote");
|
|
14721
|
-
const [quote, setQuote] = (0,
|
|
14722
|
-
const [isLoading, setIsLoading] = (0,
|
|
14723
|
-
const [isRefreshing, setIsRefreshing] = (0,
|
|
14724
|
-
const isFetchingRef = (0,
|
|
14725
|
-
const hasQuoteRef = (0,
|
|
14726
|
-
const fetchIdRef = (0,
|
|
14727
|
-
(0,
|
|
14409
|
+
const [quote, setQuote] = (0, import_react36.useState)(null);
|
|
14410
|
+
const [isLoading, setIsLoading] = (0, import_react36.useState)(true);
|
|
14411
|
+
const [isRefreshing, setIsRefreshing] = (0, import_react36.useState)(false);
|
|
14412
|
+
const isFetchingRef = (0, import_react36.useRef)(false);
|
|
14413
|
+
const hasQuoteRef = (0, import_react36.useRef)(false);
|
|
14414
|
+
const fetchIdRef = (0, import_react36.useRef)(0);
|
|
14415
|
+
(0, import_react36.useEffect)(() => {
|
|
14728
14416
|
if (!isReady) return;
|
|
14729
14417
|
if (!enabled) {
|
|
14730
14418
|
setIsLoading(false);
|
|
@@ -14794,7 +14482,7 @@ function useSwapQuote(options) {
|
|
|
14794
14482
|
}
|
|
14795
14483
|
|
|
14796
14484
|
// src/client/hooks/checkout/superstate/swap/review/useSuperstateReviewViewModel.ts
|
|
14797
|
-
var
|
|
14485
|
+
var import_react37 = require("react");
|
|
14798
14486
|
function useSuperstateReviewViewModel({
|
|
14799
14487
|
stepInput,
|
|
14800
14488
|
contractAddress,
|
|
@@ -14804,11 +14492,11 @@ function useSuperstateReviewViewModel({
|
|
|
14804
14492
|
}) {
|
|
14805
14493
|
const { coinlist, isReady } = useCoinList();
|
|
14806
14494
|
const locale = useLocale();
|
|
14807
|
-
const [slippageBps, setSlippageBps] = (0,
|
|
14808
|
-
const [slippageExpanded, setSlippageExpanded] = (0,
|
|
14809
|
-
const [phase, setPhase] = (0,
|
|
14810
|
-
const [error, setError] = (0,
|
|
14811
|
-
(0,
|
|
14495
|
+
const [slippageBps, setSlippageBps] = (0, import_react37.useState)(DEFAULT_SLIPPAGE_BPS);
|
|
14496
|
+
const [slippageExpanded, setSlippageExpanded] = (0, import_react37.useState)(false);
|
|
14497
|
+
const [phase, setPhase] = (0, import_react37.useState)(null);
|
|
14498
|
+
const [error, setError] = (0, import_react37.useState)(null);
|
|
14499
|
+
(0, import_react37.useEffect)(() => {
|
|
14812
14500
|
if (stepInput.type === "incomplete") {
|
|
14813
14501
|
setSlippageBps(DEFAULT_SLIPPAGE_BPS);
|
|
14814
14502
|
setSlippageExpanded(false);
|
|
@@ -15139,7 +14827,7 @@ function priceUi(quote, outputToken, locale) {
|
|
|
15139
14827
|
}
|
|
15140
14828
|
|
|
15141
14829
|
// src/client/hooks/checkout/superstate/swap/wallet/useSuperstateWalletViewModel.ts
|
|
15142
|
-
var
|
|
14830
|
+
var import_react38 = require("react");
|
|
15143
14831
|
var CONNECT_FAILED3 = "Could not connect that wallet. Please try again.";
|
|
15144
14832
|
function useSuperstateWalletViewModel({
|
|
15145
14833
|
stepInput,
|
|
@@ -15152,12 +14840,12 @@ function useSuperstateWalletViewModel({
|
|
|
15152
14840
|
}) {
|
|
15153
14841
|
const { coinlist, isReady } = useCoinList();
|
|
15154
14842
|
const log = useLogger("useSuperstateWalletViewModel");
|
|
15155
|
-
const [selected, setSelected] = (0,
|
|
15156
|
-
const [phase, setPhase] = (0,
|
|
15157
|
-
const [error, setError] = (0,
|
|
14843
|
+
const [selected, setSelected] = (0, import_react38.useState)(null);
|
|
14844
|
+
const [phase, setPhase] = (0, import_react38.useState)(null);
|
|
14845
|
+
const [error, setError] = (0, import_react38.useState)(null);
|
|
15158
14846
|
const networkName = getNetworkName(chain);
|
|
15159
14847
|
const selectedWallet = resolveWallet3(wallets, selected);
|
|
15160
|
-
(0,
|
|
14848
|
+
(0, import_react38.useEffect)(() => {
|
|
15161
14849
|
if (stepInput.type === "completed") {
|
|
15162
14850
|
setPhase(null);
|
|
15163
14851
|
setError(null);
|
|
@@ -15376,8 +15064,8 @@ function useSuperstateSwapCheckoutViewModel({
|
|
|
15376
15064
|
}) {
|
|
15377
15065
|
const locale = useLocale();
|
|
15378
15066
|
const contractAddress = superstateSwapContractAddress(chain);
|
|
15379
|
-
const [step, setStep] = (0,
|
|
15380
|
-
const [orderConfirmed, setOrderConfirmed] = (0,
|
|
15067
|
+
const [step, setStep] = (0, import_react39.useState)({ type: "wallet" });
|
|
15068
|
+
const [orderConfirmed, setOrderConfirmed] = (0, import_react39.useState)(null);
|
|
15381
15069
|
const { inputAmount, inputTokenAddress } = quoteInput(step, chain);
|
|
15382
15070
|
const live = enabled && contractAddress !== null;
|
|
15383
15071
|
const contract = contractAddress ?? NO_CONTRACT;
|
|
@@ -15697,7 +15385,7 @@ function OndoCheckoutContainer({
|
|
|
15697
15385
|
enabled,
|
|
15698
15386
|
className
|
|
15699
15387
|
}) {
|
|
15700
|
-
const [side] = (0,
|
|
15388
|
+
const [side] = (0, import_react40.useState)(() => config.side());
|
|
15701
15389
|
const ondoSymbol = config.symbol(offer);
|
|
15702
15390
|
return renderOndoSide(side, {
|
|
15703
15391
|
buy: () => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
@@ -16311,7 +15999,7 @@ function Divider2() {
|
|
|
16311
15999
|
}
|
|
16312
16000
|
|
|
16313
16001
|
// src/client/hooks/claim/centrifuge/vault/useCentrifugeVaultClaimViewModel.ts
|
|
16314
|
-
var
|
|
16002
|
+
var import_react46 = require("react");
|
|
16315
16003
|
|
|
16316
16004
|
// src/client/hooks/claim/centrifuge/vault/centrifuge-vault-claim-ui-mapper.ts
|
|
16317
16005
|
var CentrifugeVaultClaimUiMapper = {
|
|
@@ -16598,13 +16286,13 @@ function shareAmount(amount, vault, locale) {
|
|
|
16598
16286
|
}
|
|
16599
16287
|
|
|
16600
16288
|
// src/client/hooks/claim/centrifuge/vault/data/useCentrifugeClaim.ts
|
|
16601
|
-
var
|
|
16289
|
+
var import_react41 = require("react");
|
|
16602
16290
|
var IDLE = { type: "IDLE" };
|
|
16603
16291
|
function useCentrifugeClaim() {
|
|
16604
16292
|
const { coinlist } = useCoinList();
|
|
16605
|
-
const [state, setState] = (0,
|
|
16606
|
-
const runRef = (0,
|
|
16607
|
-
const claim = (0,
|
|
16293
|
+
const [state, setState] = (0, import_react41.useState)(IDLE);
|
|
16294
|
+
const runRef = (0, import_react41.useRef)(0);
|
|
16295
|
+
const claim = (0, import_react41.useCallback)(
|
|
16608
16296
|
async (params) => {
|
|
16609
16297
|
const run = ++runRef.current;
|
|
16610
16298
|
const current = () => run === runRef.current;
|
|
@@ -16626,7 +16314,7 @@ function useCentrifugeClaim() {
|
|
|
16626
16314
|
},
|
|
16627
16315
|
[coinlist]
|
|
16628
16316
|
);
|
|
16629
|
-
const reset = (0,
|
|
16317
|
+
const reset = (0, import_react41.useCallback)(() => {
|
|
16630
16318
|
++runRef.current;
|
|
16631
16319
|
setState(IDLE);
|
|
16632
16320
|
}, []);
|
|
@@ -16634,12 +16322,12 @@ function useCentrifugeClaim() {
|
|
|
16634
16322
|
}
|
|
16635
16323
|
|
|
16636
16324
|
// src/client/hooks/claim/centrifuge/vault/data/useCentrifugeVaultPositions.ts
|
|
16637
|
-
var
|
|
16325
|
+
var import_react43 = require("react");
|
|
16638
16326
|
|
|
16639
16327
|
// src/client/ui/hooks/usePageVisible.ts
|
|
16640
|
-
var
|
|
16328
|
+
var import_react42 = require("react");
|
|
16641
16329
|
function usePageVisible() {
|
|
16642
|
-
return (0,
|
|
16330
|
+
return (0, import_react42.useSyncExternalStore)(subscribe, isPageVisible, () => true);
|
|
16643
16331
|
}
|
|
16644
16332
|
function subscribe(onChange) {
|
|
16645
16333
|
document.addEventListener("visibilitychange", onChange);
|
|
@@ -16650,7 +16338,7 @@ function isPageVisible() {
|
|
|
16650
16338
|
}
|
|
16651
16339
|
|
|
16652
16340
|
// src/client/hooks/claim/centrifuge/vault/data/useCentrifugeVaultPositions.ts
|
|
16653
|
-
var
|
|
16341
|
+
var LOADING4 = { type: "LOADING" };
|
|
16654
16342
|
var DISABLED = {
|
|
16655
16343
|
type: "CONTENT",
|
|
16656
16344
|
legs: []
|
|
@@ -16668,20 +16356,20 @@ function useCentrifugeVaultPositions(options) {
|
|
|
16668
16356
|
const log = useLogger("useCentrifugeVaultPositions");
|
|
16669
16357
|
const visible = usePageVisible();
|
|
16670
16358
|
const key = requestsKey(vaults, walletAddresses);
|
|
16671
|
-
const requests = (0,
|
|
16672
|
-
const readsRef = (0,
|
|
16359
|
+
const requests = (0, import_react43.useMemo)(() => readRequests(vaults, walletAddresses), [key]);
|
|
16360
|
+
const readsRef = (0, import_react43.useRef)(
|
|
16673
16361
|
new Map((data ?? []).map((read) => [readKey(requestOf(read)), read]))
|
|
16674
16362
|
);
|
|
16675
|
-
const [state, setState] = (0,
|
|
16676
|
-
() => !enabled ? DISABLED : data === void 0 ?
|
|
16363
|
+
const [state, setState] = (0, import_react43.useState)(
|
|
16364
|
+
() => !enabled ? DISABLED : data === void 0 ? LOADING4 : contentOf(readsRef)
|
|
16677
16365
|
);
|
|
16678
|
-
const [refetchCount, setRefetchCount] = (0,
|
|
16679
|
-
const skipFirstFetchRef = (0,
|
|
16680
|
-
const generationRef = (0,
|
|
16681
|
-
const readSeqRef = (0,
|
|
16682
|
-
const latestReadRef = (0,
|
|
16683
|
-
const refetch = (0,
|
|
16684
|
-
const fetchRead = (0,
|
|
16366
|
+
const [refetchCount, setRefetchCount] = (0, import_react43.useState)(0);
|
|
16367
|
+
const skipFirstFetchRef = (0, import_react43.useRef)(data !== void 0);
|
|
16368
|
+
const generationRef = (0, import_react43.useRef)(0);
|
|
16369
|
+
const readSeqRef = (0, import_react43.useRef)(0);
|
|
16370
|
+
const latestReadRef = (0, import_react43.useRef)(/* @__PURE__ */ new Map());
|
|
16371
|
+
const refetch = (0, import_react43.useCallback)(() => setRefetchCount((n) => n + 1), []);
|
|
16372
|
+
const fetchRead = (0, import_react43.useCallback)(
|
|
16685
16373
|
async (request) => {
|
|
16686
16374
|
const params = {
|
|
16687
16375
|
symbol: request.symbol,
|
|
@@ -16707,7 +16395,7 @@ function useCentrifugeVaultPositions(options) {
|
|
|
16707
16395
|
},
|
|
16708
16396
|
[coinlist]
|
|
16709
16397
|
);
|
|
16710
|
-
const load = (0,
|
|
16398
|
+
const load = (0, import_react43.useCallback)(
|
|
16711
16399
|
async (batch, generation) => {
|
|
16712
16400
|
const issued = batch.map((request) => {
|
|
16713
16401
|
const seq = ++readSeqRef.current;
|
|
@@ -16752,7 +16440,7 @@ function useCentrifugeVaultPositions(options) {
|
|
|
16752
16440
|
},
|
|
16753
16441
|
[fetchRead, log]
|
|
16754
16442
|
);
|
|
16755
|
-
(0,
|
|
16443
|
+
(0, import_react43.useEffect)(() => {
|
|
16756
16444
|
if (!isReady || !enabled || !visible) return;
|
|
16757
16445
|
const generation = ++generationRef.current;
|
|
16758
16446
|
const wanted = new Set(requests.map(readKey));
|
|
@@ -16764,10 +16452,10 @@ function useCentrifugeVaultPositions(options) {
|
|
|
16764
16452
|
setState(contentOf(readsRef));
|
|
16765
16453
|
return;
|
|
16766
16454
|
}
|
|
16767
|
-
if (readsRef.current.size === 0) setState(
|
|
16455
|
+
if (readsRef.current.size === 0) setState(LOADING4);
|
|
16768
16456
|
void load(requests, generation);
|
|
16769
16457
|
}, [isReady, enabled, visible, requests, refetchCount, load]);
|
|
16770
|
-
(0,
|
|
16458
|
+
(0, import_react43.useEffect)(() => {
|
|
16771
16459
|
if (!isReady || !enabled || !visible) return;
|
|
16772
16460
|
const interval = setInterval(() => {
|
|
16773
16461
|
const pending = requests.filter((request) => {
|
|
@@ -16778,7 +16466,7 @@ function useCentrifugeVaultPositions(options) {
|
|
|
16778
16466
|
}, pollIntervalMs);
|
|
16779
16467
|
return () => clearInterval(interval);
|
|
16780
16468
|
}, [isReady, enabled, visible, requests, pollIntervalMs, load]);
|
|
16781
|
-
(0,
|
|
16469
|
+
(0, import_react43.useEffect)(() => {
|
|
16782
16470
|
if (!enabled) {
|
|
16783
16471
|
++generationRef.current;
|
|
16784
16472
|
setState(DISABLED);
|
|
@@ -16817,10 +16505,10 @@ function contentOf(readsRef) {
|
|
|
16817
16505
|
}
|
|
16818
16506
|
|
|
16819
16507
|
// src/client/hooks/shared/useExternalWalletRequest.ts
|
|
16820
|
-
var
|
|
16508
|
+
var import_react44 = require("react");
|
|
16821
16509
|
function useExternalWalletRequest(adapter) {
|
|
16822
16510
|
const log = useLogger("useExternalWalletRequest");
|
|
16823
|
-
const [request, setRequest] = (0,
|
|
16511
|
+
const [request, setRequest] = (0, import_react44.useState)("idle");
|
|
16824
16512
|
const run = async (steps) => {
|
|
16825
16513
|
if (adapter === null) return;
|
|
16826
16514
|
setRequest("pending");
|
|
@@ -16846,21 +16534,21 @@ function useExternalWalletRequest(adapter) {
|
|
|
16846
16534
|
}
|
|
16847
16535
|
|
|
16848
16536
|
// src/client/hooks/shared/useTokenRegistry.ts
|
|
16849
|
-
var
|
|
16537
|
+
var import_react45 = require("react");
|
|
16850
16538
|
var DISABLED_STATE2 = { type: "DISABLED" };
|
|
16851
16539
|
var LOADING_STATE3 = { type: "LOADING" };
|
|
16852
16540
|
function useTokenRegistry(options = {}) {
|
|
16853
16541
|
const { data, enabled = true } = options;
|
|
16854
16542
|
const { coinlist, isReady } = useCoinList();
|
|
16855
16543
|
const log = useLogger("useTokenRegistry");
|
|
16856
|
-
const [state, setState] = (0,
|
|
16544
|
+
const [state, setState] = (0, import_react45.useState)(
|
|
16857
16545
|
() => data !== void 0 ? { type: "CONTENT", registry: TokenRegistrySnapshot.fromTokens(data) } : LOADING_STATE3
|
|
16858
16546
|
);
|
|
16859
|
-
const [refetchCount, setRefetchCount] = (0,
|
|
16860
|
-
const refetch = (0,
|
|
16547
|
+
const [refetchCount, setRefetchCount] = (0, import_react45.useState)(0);
|
|
16548
|
+
const refetch = (0, import_react45.useCallback)(() => {
|
|
16861
16549
|
setRefetchCount((count) => count + 1);
|
|
16862
16550
|
}, []);
|
|
16863
|
-
(0,
|
|
16551
|
+
(0, import_react45.useEffect)(() => {
|
|
16864
16552
|
let isCancelled = false;
|
|
16865
16553
|
const seedActive = data !== void 0 && refetchCount === 0;
|
|
16866
16554
|
if (!isReady || !enabled || seedActive) {
|
|
@@ -16937,8 +16625,8 @@ function useCentrifugeVaultClaimViewModel({
|
|
|
16937
16625
|
enabled: vaultsReady && visible && legs.some(CentrifugeVaultLeg.isActive)
|
|
16938
16626
|
});
|
|
16939
16627
|
const claimHook = useCentrifugeClaim();
|
|
16940
|
-
const [claiming, setClaiming] = (0,
|
|
16941
|
-
const [claimsInFlight, setClaimsInFlight] = (0,
|
|
16628
|
+
const [claiming, setClaiming] = (0, import_react46.useState)(null);
|
|
16629
|
+
const [claimsInFlight, setClaimsInFlight] = (0, import_react46.useState)(() => /* @__PURE__ */ new Set());
|
|
16942
16630
|
const walletRequest = useExternalWalletRequest(wallets.externalAdapter);
|
|
16943
16631
|
const state = CentrifugeVaultClaimUiMapper.toUiState({
|
|
16944
16632
|
offer,
|
|
@@ -17030,7 +16718,7 @@ function removeClaimInFlight(ids, legId) {
|
|
|
17030
16718
|
function useCentrifugeVaults(offer, registry) {
|
|
17031
16719
|
const log = useLogger("useCentrifugeVaultClaimViewModel");
|
|
17032
16720
|
const snapshot = registry.type === "CONTENT" ? registry.registry : null;
|
|
17033
|
-
const resolutions = (0,
|
|
16721
|
+
const resolutions = (0, import_react46.useMemo)(
|
|
17034
16722
|
() => snapshot === null ? [] : resolveCentrifugeVaults(
|
|
17035
16723
|
offer,
|
|
17036
16724
|
(token) => TokenRegistrySnapshot.get(snapshot, token)
|
|
@@ -17040,7 +16728,7 @@ function useCentrifugeVaults(offer, registry) {
|
|
|
17040
16728
|
const unresolved = resolutions.flatMap(
|
|
17041
16729
|
(r) => r.type === "unresolved" ? [`${r.chain}:${r.missing}`] : []
|
|
17042
16730
|
).join("|");
|
|
17043
|
-
(0,
|
|
16731
|
+
(0, import_react46.useEffect)(() => {
|
|
17044
16732
|
if (unresolved === "") return;
|
|
17045
16733
|
log.warn(() => ({
|
|
17046
16734
|
msg: "vault chains left out",
|
|
@@ -17579,19 +17267,19 @@ function EmptyState() {
|
|
|
17579
17267
|
}
|
|
17580
17268
|
|
|
17581
17269
|
// src/client/hooks/offers/grid/useOffersGridViewModel.ts
|
|
17582
|
-
var
|
|
17270
|
+
var import_react48 = require("react");
|
|
17583
17271
|
|
|
17584
17272
|
// src/client/hooks/offers/data/useOffers.ts
|
|
17585
|
-
var
|
|
17273
|
+
var import_react47 = require("react");
|
|
17586
17274
|
var LOADING_STATE4 = { type: "LOADING" };
|
|
17587
17275
|
function useOffers(options = {}) {
|
|
17588
17276
|
const { coinlist, isReady } = useCoinList();
|
|
17589
17277
|
const log = useLogger("useOffers");
|
|
17590
17278
|
const { data: serverOffers, enabled = true } = options;
|
|
17591
|
-
const [offersState, setOffersState] = (0,
|
|
17279
|
+
const [offersState, setOffersState] = (0, import_react47.useState)(
|
|
17592
17280
|
serverOffers !== void 0 ? { type: "CONTENT", offers: serverOffers } : LOADING_STATE4
|
|
17593
17281
|
);
|
|
17594
|
-
(0,
|
|
17282
|
+
(0, import_react47.useEffect)(() => {
|
|
17595
17283
|
let isCancelled = false;
|
|
17596
17284
|
if (!enabled) {
|
|
17597
17285
|
return () => {
|
|
@@ -17715,11 +17403,11 @@ function useOffersGridViewModel(options = {}) {
|
|
|
17715
17403
|
data: data?.tokens,
|
|
17716
17404
|
enabled
|
|
17717
17405
|
});
|
|
17718
|
-
const state = (0,
|
|
17406
|
+
const state = (0, import_react48.useMemo)(
|
|
17719
17407
|
() => toUiState(offersState, registryState, onOfferClick !== void 0),
|
|
17720
17408
|
[offersState, registryState, onOfferClick]
|
|
17721
17409
|
);
|
|
17722
|
-
const onEvent = (0,
|
|
17410
|
+
const onEvent = (0, import_react48.useCallback)(
|
|
17723
17411
|
(event) => {
|
|
17724
17412
|
switch (event.type) {
|
|
17725
17413
|
case "ON_OFFER_CLICK": {
|
|
@@ -17794,13 +17482,13 @@ function OffersGridContainer({
|
|
|
17794
17482
|
}
|
|
17795
17483
|
|
|
17796
17484
|
// src/client/components/requirements/ConnectedWalletList.tsx
|
|
17797
|
-
var
|
|
17485
|
+
var import_react49 = require("react");
|
|
17798
17486
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
17799
17487
|
function ConnectedWalletRow({
|
|
17800
17488
|
wallet,
|
|
17801
17489
|
onRemove
|
|
17802
17490
|
}) {
|
|
17803
|
-
const [state, setState] = (0,
|
|
17491
|
+
const [state, setState] = (0, import_react49.useState)("idle");
|
|
17804
17492
|
const remove = async () => {
|
|
17805
17493
|
if (!onRemove) return;
|
|
17806
17494
|
setState("removing");
|
|
@@ -17988,24 +17676,24 @@ function toError(error) {
|
|
|
17988
17676
|
}
|
|
17989
17677
|
|
|
17990
17678
|
// src/client/hooks/requirements/identity-verification/useIdentityVerificationViewModel.ts
|
|
17991
|
-
var
|
|
17679
|
+
var import_react51 = require("react");
|
|
17992
17680
|
|
|
17993
17681
|
// src/client/hooks/requirements/data/useKycToken.ts
|
|
17994
|
-
var
|
|
17682
|
+
var import_react50 = require("react");
|
|
17995
17683
|
var IDLE_STATE = { type: "IDLE" };
|
|
17996
17684
|
var LOADING_STATE5 = { type: "LOADING" };
|
|
17997
17685
|
function useKycToken(levelName, reset) {
|
|
17998
17686
|
const { coinlist } = useCoinList();
|
|
17999
17687
|
const log = useLogger("useKycToken");
|
|
18000
|
-
const [kycTokenState, setKycTokenState] = (0,
|
|
18001
|
-
const resetPendingRef = (0,
|
|
18002
|
-
const tokenIssuedRef = (0,
|
|
18003
|
-
(0,
|
|
17688
|
+
const [kycTokenState, setKycTokenState] = (0, import_react50.useState)(IDLE_STATE);
|
|
17689
|
+
const resetPendingRef = (0, import_react50.useRef)(reset === true);
|
|
17690
|
+
const tokenIssuedRef = (0, import_react50.useRef)(false);
|
|
17691
|
+
(0, import_react50.useEffect)(() => {
|
|
18004
17692
|
if (!tokenIssuedRef.current) {
|
|
18005
17693
|
resetPendingRef.current = reset === true;
|
|
18006
17694
|
}
|
|
18007
17695
|
}, [reset]);
|
|
18008
|
-
const fetchToken = (0,
|
|
17696
|
+
const fetchToken = (0, import_react50.useCallback)(async () => {
|
|
18009
17697
|
setKycTokenState(LOADING_STATE5);
|
|
18010
17698
|
try {
|
|
18011
17699
|
const kycToken = await coinlist.requirements.createKycToken({
|
|
@@ -18039,8 +17727,8 @@ var GENERIC_ERROR_MESSAGE2 = "Unable to start identity verification right now. P
|
|
|
18039
17727
|
function useIdentityVerificationViewModel(options = {}) {
|
|
18040
17728
|
const { levelName, reset, locale, onSubmitted, onError } = options;
|
|
18041
17729
|
const { kycTokenState, fetchToken } = useKycToken(levelName, reset);
|
|
18042
|
-
const fetchedRef = (0,
|
|
18043
|
-
(0,
|
|
17730
|
+
const fetchedRef = (0, import_react51.useRef)(false);
|
|
17731
|
+
(0, import_react51.useEffect)(() => {
|
|
18044
17732
|
if (fetchedRef.current) {
|
|
18045
17733
|
return;
|
|
18046
17734
|
}
|
|
@@ -18048,7 +17736,7 @@ function useIdentityVerificationViewModel(options = {}) {
|
|
|
18048
17736
|
fetchToken().catch(() => {
|
|
18049
17737
|
});
|
|
18050
17738
|
}, [fetchToken]);
|
|
18051
|
-
const state = (0,
|
|
17739
|
+
const state = (0, import_react51.useMemo)(() => {
|
|
18052
17740
|
switch (kycTokenState.type) {
|
|
18053
17741
|
case "IDLE":
|
|
18054
17742
|
case "LOADING":
|
|
@@ -18074,7 +17762,7 @@ function useIdentityVerificationViewModel(options = {}) {
|
|
|
18074
17762
|
}
|
|
18075
17763
|
}
|
|
18076
17764
|
}, [kycTokenState, locale, fetchToken]);
|
|
18077
|
-
const onEvent = (0,
|
|
17765
|
+
const onEvent = (0, import_react51.useCallback)(
|
|
18078
17766
|
(event) => {
|
|
18079
17767
|
switch (event.type) {
|
|
18080
17768
|
case "ON_RETRY":
|
|
@@ -18766,10 +18454,10 @@ function SignOnlyScreen({
|
|
|
18766
18454
|
}
|
|
18767
18455
|
|
|
18768
18456
|
// src/client/hooks/requirements/tax-document/useTaxDocumentModalViewModel.ts
|
|
18769
|
-
var
|
|
18457
|
+
var import_react53 = require("react");
|
|
18770
18458
|
|
|
18771
18459
|
// src/client/hooks/requirements/data/useTaxDocument.ts
|
|
18772
|
-
var
|
|
18460
|
+
var import_react52 = require("react");
|
|
18773
18461
|
var IDLE_SIGN = { type: "idle", error: null };
|
|
18774
18462
|
var LOADING_STATE6 = { type: "LOADING" };
|
|
18775
18463
|
var SIGN_FAILED_MESSAGE = "Unable to sign document. Please try again.";
|
|
@@ -18844,8 +18532,8 @@ function useTaxDocument({
|
|
|
18844
18532
|
}) {
|
|
18845
18533
|
const { coinlist, isReady } = useCoinList();
|
|
18846
18534
|
const log = useLogger("useTaxDocument");
|
|
18847
|
-
const [state, setState] = (0,
|
|
18848
|
-
(0,
|
|
18535
|
+
const [state, setState] = (0, import_react52.useState)(LOADING_STATE6);
|
|
18536
|
+
(0, import_react52.useEffect)(() => {
|
|
18849
18537
|
let isCancelled = false;
|
|
18850
18538
|
if (!isOpen) {
|
|
18851
18539
|
return () => {
|
|
@@ -18886,7 +18574,7 @@ function useTaxDocument({
|
|
|
18886
18574
|
isCancelled = true;
|
|
18887
18575
|
};
|
|
18888
18576
|
}, [coinlist, isReady, isOpen, log]);
|
|
18889
|
-
const onEditField = (0,
|
|
18577
|
+
const onEditField = (0, import_react52.useCallback)(
|
|
18890
18578
|
(field, value) => {
|
|
18891
18579
|
setState(
|
|
18892
18580
|
(prev) => prev.type === "EDITING" ? { ...prev, fields: { ...prev.fields, [field]: value } } : prev
|
|
@@ -18894,7 +18582,7 @@ function useTaxDocument({
|
|
|
18894
18582
|
},
|
|
18895
18583
|
[]
|
|
18896
18584
|
);
|
|
18897
|
-
const onStartEdit = (0,
|
|
18585
|
+
const onStartEdit = (0, import_react52.useCallback)(() => {
|
|
18898
18586
|
setState(
|
|
18899
18587
|
(prev) => prev.type === "REVIEW" ? {
|
|
18900
18588
|
type: "EDITING",
|
|
@@ -18905,7 +18593,7 @@ function useTaxDocument({
|
|
|
18905
18593
|
} : prev
|
|
18906
18594
|
);
|
|
18907
18595
|
}, []);
|
|
18908
|
-
const onSaveEdit = (0,
|
|
18596
|
+
const onSaveEdit = (0, import_react52.useCallback)(() => {
|
|
18909
18597
|
setState(
|
|
18910
18598
|
(prev) => prev.type === "EDITING" ? {
|
|
18911
18599
|
type: "REVIEW",
|
|
@@ -18916,7 +18604,7 @@ function useTaxDocument({
|
|
|
18916
18604
|
} : prev
|
|
18917
18605
|
);
|
|
18918
18606
|
}, []);
|
|
18919
|
-
const onCancelEdit = (0,
|
|
18607
|
+
const onCancelEdit = (0, import_react52.useCallback)(() => {
|
|
18920
18608
|
setState(
|
|
18921
18609
|
(prev) => prev.type === "EDITING" ? {
|
|
18922
18610
|
type: "REVIEW",
|
|
@@ -18927,7 +18615,7 @@ function useTaxDocument({
|
|
|
18927
18615
|
} : prev
|
|
18928
18616
|
);
|
|
18929
18617
|
}, []);
|
|
18930
|
-
const onSign = (0,
|
|
18618
|
+
const onSign = (0, import_react52.useCallback)(() => {
|
|
18931
18619
|
if (state.type !== "REVIEW" && state.type !== "SIGN_ONLY") return;
|
|
18932
18620
|
if (state.type === "REVIEW" && state.fields.dob.trim() !== "" && !isValidUsDate(state.fields.dob)) {
|
|
18933
18621
|
setState({
|
|
@@ -18969,19 +18657,19 @@ function useTaxDocumentModalViewModel({
|
|
|
18969
18657
|
onSubmitted
|
|
18970
18658
|
}) {
|
|
18971
18659
|
const { state, onEditField, onStartEdit, onSaveEdit, onCancelEdit, onSign } = useTaxDocument({ isOpen });
|
|
18972
|
-
(0,
|
|
18660
|
+
(0, import_react53.useEffect)(() => {
|
|
18973
18661
|
if (state.type === "SUBMITTED") {
|
|
18974
18662
|
onSubmitted?.(state.submission);
|
|
18975
18663
|
onClose();
|
|
18976
18664
|
}
|
|
18977
18665
|
}, [state]);
|
|
18978
|
-
const uiState = (0,
|
|
18666
|
+
const uiState = (0, import_react53.useMemo)(() => {
|
|
18979
18667
|
if (!isOpen || state.type === "SUBMITTED") {
|
|
18980
18668
|
return { type: "hidden" };
|
|
18981
18669
|
}
|
|
18982
18670
|
return { type: "content", title: toTitle(state), screen: toScreen(state) };
|
|
18983
18671
|
}, [isOpen, state]);
|
|
18984
|
-
const onEvent = (0,
|
|
18672
|
+
const onEvent = (0, import_react53.useCallback)(
|
|
18985
18673
|
(event) => {
|
|
18986
18674
|
switch (event.type) {
|
|
18987
18675
|
case "ON_CLOSE":
|
|
@@ -19120,14 +18808,14 @@ function VerificationOverlayBody({
|
|
|
19120
18808
|
}
|
|
19121
18809
|
|
|
19122
18810
|
// src/client/components/requirements/wallet/ConnectWalletModalView.tsx
|
|
19123
|
-
var
|
|
18811
|
+
var import_react54 = require("react");
|
|
19124
18812
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
19125
18813
|
function ConnectWalletModalView({
|
|
19126
18814
|
state,
|
|
19127
18815
|
onEvent,
|
|
19128
18816
|
className
|
|
19129
18817
|
}) {
|
|
19130
|
-
const titleId = (0,
|
|
18818
|
+
const titleId = (0, import_react54.useId)();
|
|
19131
18819
|
if (state.type === "hidden") {
|
|
19132
18820
|
return null;
|
|
19133
18821
|
}
|
|
@@ -19230,10 +18918,10 @@ function Screen2({
|
|
|
19230
18918
|
}
|
|
19231
18919
|
|
|
19232
18920
|
// src/client/hooks/requirements/wallet/useConnectWalletModalViewModel.ts
|
|
19233
|
-
var
|
|
18921
|
+
var import_react56 = require("react");
|
|
19234
18922
|
|
|
19235
18923
|
// src/client/hooks/requirements/data/useConnectWallet.ts
|
|
19236
|
-
var
|
|
18924
|
+
var import_react55 = require("react");
|
|
19237
18925
|
|
|
19238
18926
|
// src/client/core/wallets/connect-external-wallet.ts
|
|
19239
18927
|
var DEFAULT_STATEMENT = "Sign this message to prove you own this wallet. This does not cost gas or move funds.";
|
|
@@ -19364,24 +19052,24 @@ function useConnectWallet({
|
|
|
19364
19052
|
statement
|
|
19365
19053
|
}) {
|
|
19366
19054
|
const { coinlist } = useCoinList();
|
|
19367
|
-
const [state, setState] = (0,
|
|
19055
|
+
const [state, setState] = (0, import_react55.useState)(
|
|
19368
19056
|
() => wallet ? { type: "READY", address: wallet.address, sign: IDLE_SIGN2 } : { type: "NEEDS_WALLET" }
|
|
19369
19057
|
);
|
|
19370
|
-
const attempt = (0,
|
|
19371
|
-
(0,
|
|
19058
|
+
const attempt = (0, import_react55.useRef)(0);
|
|
19059
|
+
(0, import_react55.useEffect)(() => {
|
|
19372
19060
|
attempt.current += 1;
|
|
19373
19061
|
if (!isOpen) return;
|
|
19374
19062
|
setState(
|
|
19375
19063
|
wallet ? { type: "READY", address: wallet.address, sign: IDLE_SIGN2 } : { type: "NEEDS_WALLET" }
|
|
19376
19064
|
);
|
|
19377
19065
|
}, [isOpen, wallet?.address]);
|
|
19378
|
-
(0,
|
|
19066
|
+
(0, import_react55.useEffect)(
|
|
19379
19067
|
() => () => {
|
|
19380
19068
|
attempt.current += 1;
|
|
19381
19069
|
},
|
|
19382
19070
|
[]
|
|
19383
19071
|
);
|
|
19384
|
-
const onSign = (0,
|
|
19072
|
+
const onSign = (0, import_react55.useCallback)(() => {
|
|
19385
19073
|
if (!wallet || state.type !== "READY") return;
|
|
19386
19074
|
attempt.current += 1;
|
|
19387
19075
|
const gen = attempt.current;
|
|
@@ -19443,13 +19131,13 @@ function useConnectWalletModalViewModel({
|
|
|
19443
19131
|
challengeType,
|
|
19444
19132
|
statement
|
|
19445
19133
|
});
|
|
19446
|
-
(0,
|
|
19134
|
+
(0, import_react56.useEffect)(() => {
|
|
19447
19135
|
if (state.type === "CONNECTED") {
|
|
19448
19136
|
onConnected?.(state.binding);
|
|
19449
19137
|
onClose();
|
|
19450
19138
|
}
|
|
19451
19139
|
}, [state]);
|
|
19452
|
-
const uiState = (0,
|
|
19140
|
+
const uiState = (0, import_react56.useMemo)(() => {
|
|
19453
19141
|
if (!isOpen || state.type === "CONNECTED") {
|
|
19454
19142
|
return { type: "hidden" };
|
|
19455
19143
|
}
|
|
@@ -19474,7 +19162,7 @@ function useConnectWalletModalViewModel({
|
|
|
19474
19162
|
canRequestConnect
|
|
19475
19163
|
};
|
|
19476
19164
|
}, [isOpen, state, onRequestConnect]);
|
|
19477
|
-
const onEvent = (0,
|
|
19165
|
+
const onEvent = (0, import_react56.useCallback)(
|
|
19478
19166
|
(event) => {
|
|
19479
19167
|
switch (event.type) {
|
|
19480
19168
|
case "ON_CLOSE":
|
|
@@ -19515,10 +19203,10 @@ function ConnectWalletModalContainer({
|
|
|
19515
19203
|
}
|
|
19516
19204
|
|
|
19517
19205
|
// src/client/hooks/requirements/useRequirementsChecklistViewModel.ts
|
|
19518
|
-
var
|
|
19206
|
+
var import_react59 = require("react");
|
|
19519
19207
|
|
|
19520
19208
|
// src/client/hooks/requirements/data/useOptionAddresses.ts
|
|
19521
|
-
var
|
|
19209
|
+
var import_react57 = require("react");
|
|
19522
19210
|
var LOADING_STATE7 = { type: "LOADING" };
|
|
19523
19211
|
var EMPTY_STATE = {
|
|
19524
19212
|
type: "CONTENT",
|
|
@@ -19528,19 +19216,19 @@ function useOptionAddresses(offerId, offerOptionId, options = {}) {
|
|
|
19528
19216
|
const { coinlist, isReady } = useCoinList();
|
|
19529
19217
|
const log = useLogger("useOptionAddresses");
|
|
19530
19218
|
const { data, enabled = true } = options;
|
|
19531
|
-
const [addressesState, setAddressesState] = (0,
|
|
19219
|
+
const [addressesState, setAddressesState] = (0, import_react57.useState)(
|
|
19532
19220
|
data !== void 0 ? { type: "CONTENT", addresses: data } : LOADING_STATE7
|
|
19533
19221
|
);
|
|
19534
|
-
const [fetchKey, setFetchKey] = (0,
|
|
19535
|
-
const refetch = (0,
|
|
19536
|
-
const disconnect = (0,
|
|
19222
|
+
const [fetchKey, setFetchKey] = (0, import_react57.useState)(0);
|
|
19223
|
+
const refetch = (0, import_react57.useCallback)(() => setFetchKey((k) => k + 1), []);
|
|
19224
|
+
const disconnect = (0, import_react57.useCallback)(
|
|
19537
19225
|
async (addressId) => {
|
|
19538
19226
|
await coinlist.wallets.remove({ offerId, addressId });
|
|
19539
19227
|
refetch();
|
|
19540
19228
|
},
|
|
19541
19229
|
[coinlist, offerId, refetch]
|
|
19542
19230
|
);
|
|
19543
|
-
(0,
|
|
19231
|
+
(0, import_react57.useEffect)(() => {
|
|
19544
19232
|
let isCancelled = false;
|
|
19545
19233
|
if (!enabled) {
|
|
19546
19234
|
setAddressesState(
|
|
@@ -19596,18 +19284,18 @@ function useOptionAddresses(offerId, offerOptionId, options = {}) {
|
|
|
19596
19284
|
}
|
|
19597
19285
|
|
|
19598
19286
|
// src/client/hooks/requirements/data/useRequirements.ts
|
|
19599
|
-
var
|
|
19287
|
+
var import_react58 = require("react");
|
|
19600
19288
|
var LOADING_STATE8 = { type: "LOADING" };
|
|
19601
19289
|
function useRequirements(offerId, options = {}) {
|
|
19602
19290
|
const { coinlist, isReady } = useCoinList();
|
|
19603
19291
|
const log = useLogger("useRequirements");
|
|
19604
19292
|
const { data, enabled = true } = options;
|
|
19605
|
-
const [requirementsState, setRequirementsState] = (0,
|
|
19293
|
+
const [requirementsState, setRequirementsState] = (0, import_react58.useState)(
|
|
19606
19294
|
data !== void 0 ? { type: "CONTENT", ...data } : LOADING_STATE8
|
|
19607
19295
|
);
|
|
19608
|
-
const [fetchKey, setFetchKey] = (0,
|
|
19609
|
-
const refetch = (0,
|
|
19610
|
-
(0,
|
|
19296
|
+
const [fetchKey, setFetchKey] = (0, import_react58.useState)(0);
|
|
19297
|
+
const refetch = (0, import_react58.useCallback)(() => setFetchKey((k) => k + 1), []);
|
|
19298
|
+
(0, import_react58.useEffect)(() => {
|
|
19611
19299
|
let isCancelled = false;
|
|
19612
19300
|
if (!enabled) {
|
|
19613
19301
|
return () => {
|
|
@@ -19801,19 +19489,19 @@ function useRequirementsChecklistViewModel(options) {
|
|
|
19801
19489
|
data,
|
|
19802
19490
|
enabled
|
|
19803
19491
|
});
|
|
19804
|
-
const [expandedId, setExpandedId] = (0,
|
|
19805
|
-
const [taxDocumentOpen, setTaxDocumentOpen] = (0,
|
|
19806
|
-
const [connectWalletOpen, setConnectWalletOpen] = (0,
|
|
19807
|
-
const [verifyingRequirementId, setVerifyingRequirementId] = (0,
|
|
19808
|
-
const isMountedRef = (0,
|
|
19809
|
-
(0,
|
|
19492
|
+
const [expandedId, setExpandedId] = (0, import_react59.useState)(null);
|
|
19493
|
+
const [taxDocumentOpen, setTaxDocumentOpen] = (0, import_react59.useState)(false);
|
|
19494
|
+
const [connectWalletOpen, setConnectWalletOpen] = (0, import_react59.useState)(false);
|
|
19495
|
+
const [verifyingRequirementId, setVerifyingRequirementId] = (0, import_react59.useState)(null);
|
|
19496
|
+
const isMountedRef = (0, import_react59.useRef)(true);
|
|
19497
|
+
(0, import_react59.useEffect)(() => {
|
|
19810
19498
|
isMountedRef.current = true;
|
|
19811
19499
|
return () => {
|
|
19812
19500
|
isMountedRef.current = false;
|
|
19813
19501
|
};
|
|
19814
19502
|
}, []);
|
|
19815
|
-
const [hasWalletRequirement, setHasWalletRequirement] = (0,
|
|
19816
|
-
(0,
|
|
19503
|
+
const [hasWalletRequirement, setHasWalletRequirement] = (0, import_react59.useState)(false);
|
|
19504
|
+
(0, import_react59.useEffect)(() => {
|
|
19817
19505
|
if (requirementsState.type === "CONTENT") {
|
|
19818
19506
|
setHasWalletRequirement(
|
|
19819
19507
|
(requirementsState.requirements[optionId] ?? []).some(
|
|
@@ -19829,14 +19517,14 @@ function useRequirementsChecklistViewModel(options) {
|
|
|
19829
19517
|
} = useOptionAddresses(offerId, optionId, {
|
|
19830
19518
|
enabled: enabled && hasWalletRequirement
|
|
19831
19519
|
});
|
|
19832
|
-
const removeWallet = (0,
|
|
19520
|
+
const removeWallet = (0, import_react59.useCallback)(
|
|
19833
19521
|
async (addressId) => {
|
|
19834
19522
|
await disconnect(OfferOptionAddressId(addressId));
|
|
19835
19523
|
refetch();
|
|
19836
19524
|
},
|
|
19837
19525
|
[disconnect, refetch]
|
|
19838
19526
|
);
|
|
19839
|
-
const awaitVerificationResult = (0,
|
|
19527
|
+
const awaitVerificationResult = (0, import_react59.useCallback)(
|
|
19840
19528
|
(requirementId, statusBeforeSubmit) => {
|
|
19841
19529
|
void (async () => {
|
|
19842
19530
|
const deadline = Date.now() + VERIFICATION_POLL_TIMEOUT_MS;
|
|
@@ -19863,11 +19551,11 @@ function useRequirementsChecklistViewModel(options) {
|
|
|
19863
19551
|
},
|
|
19864
19552
|
[coinlist, offerId, refetch, log]
|
|
19865
19553
|
);
|
|
19866
|
-
const requirements = (0,
|
|
19554
|
+
const requirements = (0, import_react59.useMemo)(
|
|
19867
19555
|
() => requirementsState.type === "CONTENT" ? requirementsState.requirements[optionId] ?? [] : [],
|
|
19868
19556
|
[requirementsState, optionId]
|
|
19869
19557
|
);
|
|
19870
|
-
const statusById = (0,
|
|
19558
|
+
const statusById = (0, import_react59.useMemo)(() => {
|
|
19871
19559
|
if (requirementsState.type !== "CONTENT") {
|
|
19872
19560
|
return /* @__PURE__ */ new Map();
|
|
19873
19561
|
}
|
|
@@ -19876,7 +19564,7 @@ function useRequirementsChecklistViewModel(options) {
|
|
|
19876
19564
|
requirementsState.statuses.filter((s) => ids.has(s.id)).map((s) => [s.id, s])
|
|
19877
19565
|
);
|
|
19878
19566
|
}, [requirementsState, requirements]);
|
|
19879
|
-
const state = (0,
|
|
19567
|
+
const state = (0, import_react59.useMemo)(() => {
|
|
19880
19568
|
switch (requirementsState.type) {
|
|
19881
19569
|
case "LOADING":
|
|
19882
19570
|
return { type: "loading", title: title2, description: description2 };
|
|
@@ -19945,7 +19633,7 @@ function useRequirementsChecklistViewModel(options) {
|
|
|
19945
19633
|
identityVerificationOptions,
|
|
19946
19634
|
removeWallet
|
|
19947
19635
|
]);
|
|
19948
|
-
const handleRequirementAction = (0,
|
|
19636
|
+
const handleRequirementAction = (0, import_react59.useCallback)(
|
|
19949
19637
|
(requirement) => {
|
|
19950
19638
|
const inlineVerification = statusById.get(requirement.id)?.kycLevel !== void 0 && onRequirementActionOverride === void 0;
|
|
19951
19639
|
if (inlineVerification) {
|
|
@@ -19977,7 +19665,7 @@ function useRequirementsChecklistViewModel(options) {
|
|
|
19977
19665
|
coinlist
|
|
19978
19666
|
]
|
|
19979
19667
|
);
|
|
19980
|
-
const onEvent = (0,
|
|
19668
|
+
const onEvent = (0, import_react59.useCallback)(
|
|
19981
19669
|
(event) => {
|
|
19982
19670
|
switch (event.type) {
|
|
19983
19671
|
case "ON_TOGGLE_ITEM":
|
|
@@ -20283,18 +19971,18 @@ function pinoClientLogger(options) {
|
|
|
20283
19971
|
}
|
|
20284
19972
|
|
|
20285
19973
|
// src/client/hooks/auth/useCompleteOAuth.ts
|
|
20286
|
-
var
|
|
19974
|
+
var import_react60 = require("react");
|
|
20287
19975
|
function useCompleteOAuth(options) {
|
|
20288
19976
|
const { coinlist } = useCoinList();
|
|
20289
19977
|
const log = useLogger("useCompleteOAuth");
|
|
20290
|
-
const postOAuthCompleteRef = (0,
|
|
20291
|
-
const onFailureRef = (0,
|
|
20292
|
-
const onSuccessRef = (0,
|
|
19978
|
+
const postOAuthCompleteRef = (0, import_react60.useRef)(options.postOAuthComplete);
|
|
19979
|
+
const onFailureRef = (0, import_react60.useRef)(options.onFailure);
|
|
19980
|
+
const onSuccessRef = (0, import_react60.useRef)(options.onSuccess);
|
|
20293
19981
|
postOAuthCompleteRef.current = options.postOAuthComplete;
|
|
20294
19982
|
onFailureRef.current = options.onFailure;
|
|
20295
19983
|
onSuccessRef.current = options.onSuccess;
|
|
20296
|
-
const hasStartedExchangeRef = (0,
|
|
20297
|
-
(0,
|
|
19984
|
+
const hasStartedExchangeRef = (0, import_react60.useRef)(false);
|
|
19985
|
+
(0, import_react60.useEffect)(() => {
|
|
20298
19986
|
if (typeof window === "undefined") return;
|
|
20299
19987
|
const params = new URLSearchParams(window.location.search);
|
|
20300
19988
|
if (!params.has("code") && !params.has("error")) return;
|
|
@@ -20358,12 +20046,12 @@ function useCompleteOAuth(options) {
|
|
|
20358
20046
|
}
|
|
20359
20047
|
|
|
20360
20048
|
// src/client/hooks/checkout/centrifuge/buy/data/useCentrifugeBuyTransaction.ts
|
|
20361
|
-
var
|
|
20049
|
+
var import_react61 = require("react");
|
|
20362
20050
|
function useCentrifugeBuyTransaction(options) {
|
|
20363
20051
|
const { request, data, enabled } = options;
|
|
20364
20052
|
const { coinlist, isReady } = useCoinList();
|
|
20365
20053
|
const log = useLogger("useCentrifugeBuyTransaction");
|
|
20366
|
-
const [state, setState] = (0,
|
|
20054
|
+
const [state, setState] = (0, import_react61.useState)(
|
|
20367
20055
|
() => data === void 0 ? { type: "LOADING" } : {
|
|
20368
20056
|
type: "CONTENT",
|
|
20369
20057
|
transaction: data,
|
|
@@ -20371,12 +20059,12 @@ function useCentrifugeBuyTransaction(options) {
|
|
|
20371
20059
|
refreshError: null
|
|
20372
20060
|
}
|
|
20373
20061
|
);
|
|
20374
|
-
const fetchIdRef = (0,
|
|
20375
|
-
const isFetchingRef = (0,
|
|
20062
|
+
const fetchIdRef = (0, import_react61.useRef)(0);
|
|
20063
|
+
const isFetchingRef = (0, import_react61.useRef)(false);
|
|
20376
20064
|
const requestKey = request === null ? null : stableKey3(request);
|
|
20377
|
-
const requestRef = (0,
|
|
20065
|
+
const requestRef = (0, import_react61.useRef)(request);
|
|
20378
20066
|
requestRef.current = request;
|
|
20379
|
-
const build = (0,
|
|
20067
|
+
const build = (0, import_react61.useCallback)(async () => {
|
|
20380
20068
|
const params = requestRef.current;
|
|
20381
20069
|
if (!isReady || !enabled || params === null) return;
|
|
20382
20070
|
if (isFetchingRef.current) return;
|
|
@@ -20411,7 +20099,7 @@ function useCentrifugeBuyTransaction(options) {
|
|
|
20411
20099
|
}
|
|
20412
20100
|
}
|
|
20413
20101
|
}, [coinlist, isReady, enabled, log]);
|
|
20414
|
-
(0,
|
|
20102
|
+
(0, import_react61.useEffect)(() => {
|
|
20415
20103
|
if (data === void 0) return;
|
|
20416
20104
|
++fetchIdRef.current;
|
|
20417
20105
|
setState({
|
|
@@ -20422,7 +20110,7 @@ function useCentrifugeBuyTransaction(options) {
|
|
|
20422
20110
|
});
|
|
20423
20111
|
}, [data]);
|
|
20424
20112
|
const hasSeed = data !== void 0;
|
|
20425
|
-
(0,
|
|
20113
|
+
(0, import_react61.useEffect)(() => {
|
|
20426
20114
|
if (hasSeed || requestKey === null) return;
|
|
20427
20115
|
isFetchingRef.current = false;
|
|
20428
20116
|
build();
|
|
@@ -20430,7 +20118,7 @@ function useCentrifugeBuyTransaction(options) {
|
|
|
20430
20118
|
++fetchIdRef.current;
|
|
20431
20119
|
};
|
|
20432
20120
|
}, [build, requestKey, hasSeed]);
|
|
20433
|
-
const refetch = (0,
|
|
20121
|
+
const refetch = (0, import_react61.useCallback)(() => {
|
|
20434
20122
|
build();
|
|
20435
20123
|
}, [build]);
|
|
20436
20124
|
return { state, refetch };
|
|
@@ -20446,16 +20134,16 @@ function stableKey3(request) {
|
|
|
20446
20134
|
}
|
|
20447
20135
|
|
|
20448
20136
|
// src/client/hooks/checkout/coin-list/token-sale/data/useParticipations.ts
|
|
20449
|
-
var
|
|
20137
|
+
var import_react62 = require("react");
|
|
20450
20138
|
var LOADING_STATE9 = { type: "LOADING" };
|
|
20451
20139
|
function useParticipations(offerId, options = {}) {
|
|
20452
20140
|
const { coinlist, isReady } = useCoinList();
|
|
20453
20141
|
const log = useLogger("useParticipations");
|
|
20454
20142
|
const { data, enabled = true } = options;
|
|
20455
|
-
const [participationsState, setParticipationsState] = (0,
|
|
20143
|
+
const [participationsState, setParticipationsState] = (0, import_react62.useState)(
|
|
20456
20144
|
data !== void 0 ? { type: "CONTENT", participations: data } : LOADING_STATE9
|
|
20457
20145
|
);
|
|
20458
|
-
(0,
|
|
20146
|
+
(0, import_react62.useEffect)(() => {
|
|
20459
20147
|
let isCancelled = false;
|
|
20460
20148
|
if (!enabled) {
|
|
20461
20149
|
return () => {
|
|
@@ -20502,16 +20190,16 @@ function useParticipations(offerId, options = {}) {
|
|
|
20502
20190
|
}
|
|
20503
20191
|
|
|
20504
20192
|
// src/client/hooks/offers/data/useOfferDetails.ts
|
|
20505
|
-
var
|
|
20193
|
+
var import_react63 = require("react");
|
|
20506
20194
|
var LOADING_STATE10 = { type: "LOADING" };
|
|
20507
20195
|
function useOfferDetails(offerId, options = {}) {
|
|
20508
20196
|
const { coinlist, isReady } = useCoinList();
|
|
20509
20197
|
const log = useLogger("useOfferDetails");
|
|
20510
20198
|
const { data, enabled = true } = options;
|
|
20511
|
-
const [offerDetailsState, setOfferDetailsState] = (0,
|
|
20199
|
+
const [offerDetailsState, setOfferDetailsState] = (0, import_react63.useState)(
|
|
20512
20200
|
data !== void 0 ? { type: "CONTENT", offerDetail: data } : LOADING_STATE10
|
|
20513
20201
|
);
|
|
20514
|
-
(0,
|
|
20202
|
+
(0, import_react63.useEffect)(() => {
|
|
20515
20203
|
let isCancelled = false;
|
|
20516
20204
|
if (!enabled) {
|
|
20517
20205
|
return () => {
|
|
@@ -20661,7 +20349,6 @@ function formatMonthYear(date, locale) {
|
|
|
20661
20349
|
RequirementVariant,
|
|
20662
20350
|
RequirementsChecklistContainer,
|
|
20663
20351
|
RequirementsChecklistView,
|
|
20664
|
-
SETTLES_LATER,
|
|
20665
20352
|
SlippagePicker,
|
|
20666
20353
|
SuperstateAmountView,
|
|
20667
20354
|
SuperstateOrderConfirmed,
|
|
@@ -20717,7 +20404,6 @@ function formatMonthYear(date, locale) {
|
|
|
20717
20404
|
useCentrifugeBuyReviewViewModel,
|
|
20718
20405
|
useCentrifugeBuyTransaction,
|
|
20719
20406
|
useCentrifugeClaim,
|
|
20720
|
-
useCentrifugeQuote,
|
|
20721
20407
|
useCentrifugeSidebarViewModel,
|
|
20722
20408
|
useCentrifugeVaultClaimViewModel,
|
|
20723
20409
|
useCentrifugeVaultPositions,
|