@agg-build/hooks 4.7.4 → 4.10.0
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-FPBMOHIA.mjs → chunk-7DCOWPUQ.mjs} +1 -1
- package/dist/{chunk-DUZ3EJUK.mjs → chunk-MIWXPZNP.mjs} +1 -1
- package/dist/{chunk-HDPVTROR.mjs → chunk-SFSGE25P.mjs} +1000 -831
- package/dist/deposit.js +56 -1
- package/dist/deposit.mjs +2 -2
- package/dist/index.d.mts +211 -10
- package/dist/index.d.ts +211 -10
- package/dist/index.js +718 -471
- package/dist/index.mjs +179 -98
- package/dist/withdraw.js +60 -1
- package/dist/withdraw.mjs +2 -2
- package/package.json +2 -2
|
@@ -58,6 +58,7 @@ var Venue = /* @__PURE__ */ ((Venue2) => {
|
|
|
58
58
|
Venue2["limitless"] = "limitless";
|
|
59
59
|
Venue2["opinion"] = "opinion";
|
|
60
60
|
Venue2["predict"] = "predict";
|
|
61
|
+
Venue2["pred"] = "pred";
|
|
61
62
|
Venue2["probable"] = "probable";
|
|
62
63
|
Venue2["myriad"] = "myriad";
|
|
63
64
|
Venue2["hyperliquid"] = "hyperliquid";
|
|
@@ -71,12 +72,14 @@ var ACTIVE_VENUES = [
|
|
|
71
72
|
"limitless" /* limitless */,
|
|
72
73
|
"opinion" /* opinion */,
|
|
73
74
|
"predict" /* predict */,
|
|
75
|
+
"pred" /* pred */,
|
|
74
76
|
"probable" /* probable */,
|
|
75
77
|
"myriad" /* myriad */,
|
|
76
78
|
"hyperliquid" /* hyperliquid */,
|
|
77
|
-
"novig" /* novig
|
|
79
|
+
"novig" /* novig */,
|
|
80
|
+
"prophetx" /* prophetx */
|
|
78
81
|
];
|
|
79
|
-
var INACTIVE_VENUES = [
|
|
82
|
+
var INACTIVE_VENUES = [];
|
|
80
83
|
var ACTIVE_VENUE_SET = new Set(ACTIVE_VENUES);
|
|
81
84
|
var INACTIVE_VENUE_SET = new Set(INACTIVE_VENUES);
|
|
82
85
|
|
|
@@ -178,6 +181,7 @@ var VENUE_SORT_ORDER = [
|
|
|
178
181
|
"opinion" /* opinion */,
|
|
179
182
|
"limitless" /* limitless */,
|
|
180
183
|
"predict" /* predict */,
|
|
184
|
+
"pred" /* pred */,
|
|
181
185
|
"myriad" /* myriad */,
|
|
182
186
|
"hyperliquid" /* hyperliquid */
|
|
183
187
|
];
|
|
@@ -247,6 +251,7 @@ var enUsLabels = {
|
|
|
247
251
|
kalshi: "Kalshi",
|
|
248
252
|
opinion: "Opinion",
|
|
249
253
|
predict: "Predict",
|
|
254
|
+
pred: "PRED",
|
|
250
255
|
limitless: "Limitless",
|
|
251
256
|
probable: "Probable",
|
|
252
257
|
myriad: "Myriad",
|
|
@@ -876,7 +881,7 @@ var enUsLabels = {
|
|
|
876
881
|
venueMinOrderSize: "Order size is below the venue minimum. Try a larger amount.",
|
|
877
882
|
sourceBalanceChanged: "Your balance changed since the quote. Refresh and try again, or pick a smaller amount.",
|
|
878
883
|
venueMarketResolved: "This market just resolved. Pick a different market or wait for the next round.",
|
|
879
|
-
dflowWalletUnverified: "
|
|
884
|
+
dflowWalletUnverified: "This route is unavailable for your wallet. Check your account connection and try again.",
|
|
880
885
|
venueNoQuotePath: "No active quote path for this market right now. Try a different size, or wait a moment and re-quote.",
|
|
881
886
|
solanaBlockhashExpired: "Solana transaction expired before submission. Please re-quote and try again.",
|
|
882
887
|
venueRateLimited: "The venue is rate-limiting requests right now. Please wait a moment and try again.",
|
|
@@ -920,6 +925,25 @@ var enUsLabels = {
|
|
|
920
925
|
kycSuccessTitle: "Verification successful",
|
|
921
926
|
kycSuccessDescription: "Your identity has been confirmed and you now have full access to trade on Kalshi markets.",
|
|
922
927
|
kycSuccessDone: "Done",
|
|
928
|
+
sharedKyc: {
|
|
929
|
+
required: "KYC required",
|
|
930
|
+
completeToTrade: "Complete KYC to trade",
|
|
931
|
+
checkingStatus: "Checking verification status",
|
|
932
|
+
modal: {
|
|
933
|
+
ariaLabel: "Identity verification",
|
|
934
|
+
title: "Verify Your Identity",
|
|
935
|
+
freeDescription: "Complete a one-time identity verification to trade all KYC-required venues.",
|
|
936
|
+
pendingTitle: "Verification pending",
|
|
937
|
+
pendingDescription: "Your verification is being reviewed. Check back for approval before trading.",
|
|
938
|
+
checkStatus: "Check verification status",
|
|
939
|
+
startVerification: "Start verification",
|
|
940
|
+
doItLater: "Do it later",
|
|
941
|
+
successTitle: "Verification successful",
|
|
942
|
+
successDescription: "Your identity has been verified. You can now trade on all KYC-required venues.",
|
|
943
|
+
done: "Done",
|
|
944
|
+
error: "We couldn't confirm your verification."
|
|
945
|
+
}
|
|
946
|
+
},
|
|
923
947
|
connectKalshi: "Connect to trade Kalshi",
|
|
924
948
|
tradingAccessVenues: "Venues",
|
|
925
949
|
tradingAccessAvailable: "Available",
|
|
@@ -964,9 +988,13 @@ var enUsLabels = {
|
|
|
964
988
|
insufficientVenueInventory: (sharesLabel, priceLabel) => `Only ${sharesLabel} \xB7 ${priceLabel}`,
|
|
965
989
|
viewAllRoutes: (count) => `View all (${count})`,
|
|
966
990
|
venueUnavailableInRegion: "Unavailable in your region",
|
|
991
|
+
venueTemporarilyUnavailable: "Temporarily unavailable",
|
|
967
992
|
verified: "Verified",
|
|
968
993
|
platformFee: "0% platform fees",
|
|
969
994
|
estimatedFees: "Estimated fees",
|
|
995
|
+
executionReserve: "Execution reserve",
|
|
996
|
+
executionReserveTooltipAria: "Why funds are reserved",
|
|
997
|
+
executionReserveDescription: "Held for price movement or possible venue charges, not a confirmed fee. Unused funds are returned after execution.",
|
|
970
998
|
estimatedFeesTooltipAria: "Estimated fees breakdown",
|
|
971
999
|
feeBreakdownVenueFees: "Venue",
|
|
972
1000
|
feeBreakdownBridgeFees: "Bridging",
|
|
@@ -997,6 +1025,7 @@ var enUsLabels = {
|
|
|
997
1025
|
depositingFunds: (amount, tokenSymbol, destinationChain) => `Depositing ${amount} ${tokenSymbol} to ${destinationChain}...`,
|
|
998
1026
|
fundsDeposited: (amount, tokenSymbol, destinationChain) => `Deposited ${amount} ${tokenSymbol} to ${destinationChain}`,
|
|
999
1027
|
fillingOnVenue: (venueLabel) => `Filling on ${venueLabel}...`,
|
|
1028
|
+
orderStillSettling: "Still settling. This can take a bit \u2014 check your activity feed. You can keep trading.",
|
|
1000
1029
|
venueFilledAtPriceWithAmount: (venueLabel, amountLabel, priceLabel) => `${venueLabel} filled ${amountLabel} at ${priceLabel}`,
|
|
1001
1030
|
executionShares: (value) => `${value} shares`,
|
|
1002
1031
|
confirmTransactionInWallet: "Confirm the transaction in your wallet",
|
|
@@ -1241,6 +1270,35 @@ var enUsLabels = {
|
|
|
1241
1270
|
bannerAria: "Site header",
|
|
1242
1271
|
logoAria: "Home"
|
|
1243
1272
|
},
|
|
1273
|
+
paperTrading: {
|
|
1274
|
+
badge: "Paper trading",
|
|
1275
|
+
badgeTooltip: "Trade real prediction markets with simulated funds. No real money at risk.",
|
|
1276
|
+
profile: {
|
|
1277
|
+
buyingPower: "Paper Buying Power",
|
|
1278
|
+
earnings: "Paper Earnings",
|
|
1279
|
+
earningsCaption: "Keep what you earn"
|
|
1280
|
+
},
|
|
1281
|
+
onboarding: {
|
|
1282
|
+
stepEyebrow: ({ current, total }) => `STEP ${current} OF ${total}`,
|
|
1283
|
+
skip: "Skip",
|
|
1284
|
+
back: "Back",
|
|
1285
|
+
next: "Next",
|
|
1286
|
+
// Figma reads "Get Strated" (node 4772:31236) — a typo, not copy.
|
|
1287
|
+
done: "Get started",
|
|
1288
|
+
realMarkets: {
|
|
1289
|
+
title: "Real markets, real prices",
|
|
1290
|
+
body: "Follow live prediction markets and trade using real-time market prices from leading venues."
|
|
1291
|
+
},
|
|
1292
|
+
zeroRisk: {
|
|
1293
|
+
title: "Paper trading, zero risk",
|
|
1294
|
+
body: ({ amount }) => `Start with ${amount} in simulated funds. No deposit, no real money, and no risk.`
|
|
1295
|
+
},
|
|
1296
|
+
readyToTrade: {
|
|
1297
|
+
title: "You're ready to trade",
|
|
1298
|
+
body: "Pick a market, make your prediction, and track your performance."
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
},
|
|
1244
1302
|
notifications: {
|
|
1245
1303
|
order: {
|
|
1246
1304
|
filledTitle: "Order filled",
|
|
@@ -1588,91 +1646,504 @@ var invalidateUserClaimState = (queryClient, options) => {
|
|
|
1588
1646
|
invalidateUserActivityQueries(queryClient, { strategy: options == null ? void 0 : options.activityStrategy });
|
|
1589
1647
|
};
|
|
1590
1648
|
|
|
1591
|
-
// src/
|
|
1592
|
-
import {
|
|
1593
|
-
|
|
1649
|
+
// src/use-resolved-execution-mode.ts
|
|
1650
|
+
import { useContext as useContext7 } from "react";
|
|
1651
|
+
|
|
1652
|
+
// src/core/providers/agg-provider.tsx
|
|
1653
|
+
import { useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
1654
|
+
|
|
1655
|
+
// src/core/providers/auth-provider.tsx
|
|
1656
|
+
import { QueryClient, QueryClientContext } from "@tanstack/react-query";
|
|
1657
|
+
import { useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
1658
|
+
|
|
1659
|
+
// src/current-user-query.ts
|
|
1660
|
+
var CURRENT_USER_QUERY_KEY = ["current-user"];
|
|
1661
|
+
var CURRENT_USER_STALE_TIME_MS = 6e4;
|
|
1662
|
+
var fetchCurrentUserProfile = (queryClient, client, queryKey = CURRENT_USER_QUERY_KEY) => {
|
|
1663
|
+
return queryClient.fetchQuery({
|
|
1664
|
+
queryKey,
|
|
1665
|
+
queryFn: () => client.getCurrentUser(),
|
|
1666
|
+
staleTime: CURRENT_USER_STALE_TIME_MS
|
|
1667
|
+
});
|
|
1668
|
+
};
|
|
1669
|
+
|
|
1670
|
+
// src/core/providers/auth-utils.ts
|
|
1671
|
+
import { TurnstileChallengeError } from "@agg-build/sdk";
|
|
1672
|
+
var createPlaceholderUserProfile = (input) => {
|
|
1673
|
+
return {
|
|
1674
|
+
id: input.id,
|
|
1675
|
+
username: null,
|
|
1676
|
+
avatarUrl: null,
|
|
1677
|
+
externalId: null,
|
|
1678
|
+
isLocationBlocked: false,
|
|
1679
|
+
venueAccounts: null,
|
|
1680
|
+
accounts: [],
|
|
1681
|
+
wallets: []
|
|
1682
|
+
};
|
|
1683
|
+
};
|
|
1684
|
+
var createWalletSessionUser = (input) => {
|
|
1685
|
+
return __spreadProps(__spreadValues({}, createPlaceholderUserProfile({ id: input.id })), {
|
|
1686
|
+
accounts: [
|
|
1687
|
+
{
|
|
1688
|
+
type: "siwe" /* siwe */,
|
|
1689
|
+
provider: "wallet" /* wallet */,
|
|
1690
|
+
providerAccountId: input.address
|
|
1691
|
+
}
|
|
1692
|
+
]
|
|
1693
|
+
});
|
|
1694
|
+
};
|
|
1695
|
+
var getBrowserAuthLocation = () => {
|
|
1696
|
+
if (typeof window === "undefined") {
|
|
1697
|
+
return {
|
|
1698
|
+
domain: "localhost",
|
|
1699
|
+
uri: "http://localhost"
|
|
1700
|
+
};
|
|
1701
|
+
}
|
|
1702
|
+
return {
|
|
1703
|
+
domain: window.location.host,
|
|
1704
|
+
uri: window.location.origin
|
|
1705
|
+
};
|
|
1706
|
+
};
|
|
1707
|
+
var resolveAuthCallbackUrl = (callbackUrl) => {
|
|
1708
|
+
return callbackUrl instanceof URL ? callbackUrl : typeof callbackUrl === "string" ? new URL(
|
|
1709
|
+
callbackUrl,
|
|
1710
|
+
typeof window === "undefined" ? "http://localhost" : window.location.origin
|
|
1711
|
+
) : typeof window === "undefined" ? null : new URL(window.location.href);
|
|
1712
|
+
};
|
|
1713
|
+
var parseAuthCallbackCode = (callbackUrl) => {
|
|
1714
|
+
var _a;
|
|
1715
|
+
const resolvedUrl = resolveAuthCallbackUrl(callbackUrl);
|
|
1716
|
+
return (_a = resolvedUrl == null ? void 0 : resolvedUrl.searchParams.get("code")) != null ? _a : null;
|
|
1717
|
+
};
|
|
1718
|
+
var parseLinkConfirmToken = (callbackUrl) => {
|
|
1719
|
+
var _a;
|
|
1720
|
+
const resolvedUrl = resolveAuthCallbackUrl(callbackUrl);
|
|
1721
|
+
return (_a = resolvedUrl == null ? void 0 : resolvedUrl.searchParams.get("link_confirm_token")) != null ? _a : null;
|
|
1722
|
+
};
|
|
1723
|
+
var getAuthCallbackCleanupPath = (callbackUrl) => {
|
|
1724
|
+
const resolvedUrl = resolveAuthCallbackUrl(callbackUrl);
|
|
1725
|
+
if (!resolvedUrl) return null;
|
|
1726
|
+
const params = new URLSearchParams(resolvedUrl.search);
|
|
1727
|
+
params.delete("code");
|
|
1728
|
+
params.delete("link_confirm_token");
|
|
1729
|
+
const search = params.toString();
|
|
1730
|
+
return `${resolvedUrl.pathname}${search ? `?${search}` : ""}`;
|
|
1731
|
+
};
|
|
1732
|
+
var exchangeAuthCallbackCode = (client, callbackUrl) => __async(null, null, function* () {
|
|
1733
|
+
const code = parseAuthCallbackCode(callbackUrl);
|
|
1734
|
+
if (!code) return null;
|
|
1735
|
+
const result = yield client.exchangeAuthCode(code);
|
|
1736
|
+
return {
|
|
1737
|
+
cleanupPath: getAuthCallbackCleanupPath(callbackUrl),
|
|
1738
|
+
user: result.user
|
|
1739
|
+
};
|
|
1740
|
+
});
|
|
1741
|
+
var confirmLinkAccountCallback = (client, callbackUrl) => __async(null, null, function* () {
|
|
1742
|
+
const token = parseLinkConfirmToken(callbackUrl);
|
|
1743
|
+
if (!token) return null;
|
|
1744
|
+
yield client.linkAccountConfirm(token);
|
|
1745
|
+
return { cleanupPath: getAuthCallbackCleanupPath(callbackUrl) };
|
|
1746
|
+
});
|
|
1747
|
+
var parseAuthCallbackTokens = (callbackUrl) => {
|
|
1748
|
+
var _a, _b;
|
|
1749
|
+
const resolvedUrl = resolveAuthCallbackUrl(callbackUrl);
|
|
1750
|
+
if (!resolvedUrl) return null;
|
|
1751
|
+
const hash = resolvedUrl.hash.startsWith("#") ? resolvedUrl.hash.slice(1) : resolvedUrl.hash;
|
|
1752
|
+
if (!hash) return null;
|
|
1753
|
+
const params = new URLSearchParams(hash);
|
|
1754
|
+
const accessToken = params.get("access_token");
|
|
1755
|
+
const refreshToken = params.get("refresh_token");
|
|
1756
|
+
if (!accessToken || !refreshToken) return null;
|
|
1757
|
+
const userId = (_a = params.get("user_id")) != null ? _a : void 0;
|
|
1758
|
+
const tokenType = (_b = params.get("token_type")) != null ? _b : void 0;
|
|
1759
|
+
return {
|
|
1760
|
+
accessToken,
|
|
1761
|
+
refreshToken,
|
|
1762
|
+
tokenType,
|
|
1763
|
+
userId
|
|
1764
|
+
};
|
|
1765
|
+
};
|
|
1766
|
+
var createAuthCallbackSession = (tokens) => {
|
|
1767
|
+
return {
|
|
1768
|
+
accessToken: tokens.accessToken,
|
|
1769
|
+
refreshToken: tokens.refreshToken,
|
|
1770
|
+
user: tokens.userId ? createPlaceholderUserProfile({ id: tokens.userId }) : void 0
|
|
1771
|
+
};
|
|
1772
|
+
};
|
|
1773
|
+
var executeWalletAuthFlow = (input) => __async(null, null, function* () {
|
|
1774
|
+
var _a, _b, _c, _d;
|
|
1775
|
+
const address = input.options.address.trim();
|
|
1776
|
+
const chain = (_a = input.options.chain) != null ? _a : "ethereum";
|
|
1777
|
+
const provider = chain === "solana" ? "siws" : "siwe";
|
|
1778
|
+
const location = (_b = input.location) != null ? _b : getBrowserAuthLocation();
|
|
1779
|
+
const startResult = yield input.client.authStart(__spreadValues({
|
|
1780
|
+
provider
|
|
1781
|
+
}, input.options.turnstileToken ? { turnstileToken: input.options.turnstileToken } : {}));
|
|
1782
|
+
if (startResult.type === "challenge_required") {
|
|
1783
|
+
if (!startResult.siteKey) {
|
|
1784
|
+
throw new Error("Server returned challenge_required but no siteKey was provided.");
|
|
1785
|
+
}
|
|
1786
|
+
throw new TurnstileChallengeError(startResult.siteKey);
|
|
1787
|
+
}
|
|
1788
|
+
if (startResult.type !== "nonce") {
|
|
1789
|
+
throw new Error(`AGG auth start returned an unexpected "${startResult.type}" response`);
|
|
1790
|
+
}
|
|
1791
|
+
const message = chain === "solana" ? input.client.buildSiwsMessage({
|
|
1792
|
+
domain: location.domain,
|
|
1793
|
+
address,
|
|
1794
|
+
uri: location.uri,
|
|
1795
|
+
nonce: startResult.nonce,
|
|
1796
|
+
chainId: typeof input.options.chainId === "string" ? input.options.chainId : "mainnet",
|
|
1797
|
+
statement: (_c = startResult.statement) != null ? _c : input.options.statement
|
|
1798
|
+
}) : input.client.buildSiweMessage({
|
|
1799
|
+
domain: location.domain,
|
|
1800
|
+
// Any casing: `buildSiweMessage` applies the EIP-55 checksum itself.
|
|
1801
|
+
address,
|
|
1802
|
+
uri: location.uri,
|
|
1803
|
+
nonce: startResult.nonce,
|
|
1804
|
+
chainId: typeof input.options.chainId === "number" ? input.options.chainId : void 0,
|
|
1805
|
+
statement: (_d = startResult.statement) != null ? _d : input.options.statement
|
|
1806
|
+
});
|
|
1807
|
+
const signature = yield input.options.signMessage(message);
|
|
1808
|
+
const result = yield input.client.verify({ message, signature });
|
|
1809
|
+
return {
|
|
1810
|
+
accessToken: result.accessToken,
|
|
1811
|
+
refreshToken: result.refreshToken,
|
|
1812
|
+
user: createWalletSessionUser({
|
|
1813
|
+
id: result.user.id,
|
|
1814
|
+
address
|
|
1815
|
+
})
|
|
1816
|
+
};
|
|
1817
|
+
});
|
|
1594
1818
|
|
|
1595
1819
|
// src/core/providers/contexts.ts
|
|
1596
1820
|
import { createContext } from "react";
|
|
1597
1821
|
var AggClientContext = createContext(null);
|
|
1598
1822
|
var AggUiContext = createContext(defaultAggUiConfig);
|
|
1823
|
+
var AggExecutionModeContext = createContext(null);
|
|
1599
1824
|
var AggLabelsContext = createContext(defaultAggUiConfig.general.labels);
|
|
1600
1825
|
var AggAuthContext = createContext(null);
|
|
1601
1826
|
var AggBalanceContext = createContext(null);
|
|
1602
1827
|
|
|
1603
|
-
// src/core/providers/
|
|
1828
|
+
// src/core/providers/auth-provider.tsx
|
|
1604
1829
|
import { jsx } from "react/jsx-runtime";
|
|
1605
|
-
var
|
|
1606
|
-
0: "Paper",
|
|
1607
|
-
1: "Ethereum",
|
|
1608
|
-
10: "Optimism",
|
|
1609
|
-
56: "BNB",
|
|
1610
|
-
137: "Polygon",
|
|
1611
|
-
1337: "Hyperliquid",
|
|
1612
|
-
8453: "Base",
|
|
1613
|
-
42161: "Arbitrum",
|
|
1614
|
-
43114: "Avalanche",
|
|
1615
|
-
11155111: "Sepolia",
|
|
1616
|
-
792703809: "Solana"
|
|
1617
|
-
};
|
|
1618
|
-
var chainLabelFromId = (chainId) => {
|
|
1830
|
+
var getClientAuthSnapshot = (client) => {
|
|
1619
1831
|
var _a;
|
|
1620
|
-
return
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
if (!Number.isFinite(numeric)) return 0;
|
|
1625
|
-
return numeric / __pow(10, decimals);
|
|
1832
|
+
return {
|
|
1833
|
+
isAuthenticated: (_a = client == null ? void 0 : client.isAuthenticated) != null ? _a : false,
|
|
1834
|
+
user: client == null ? void 0 : client.user
|
|
1835
|
+
};
|
|
1626
1836
|
};
|
|
1627
|
-
var
|
|
1628
|
-
|
|
1629
|
-
return (_a = tokenSymbol == null ? void 0 : tokenSymbol.toUpperCase()) == null ? void 0 : _a.includes("USD");
|
|
1837
|
+
var toError = (value) => {
|
|
1838
|
+
return value instanceof Error ? value : new Error(String(value));
|
|
1630
1839
|
};
|
|
1631
|
-
var
|
|
1632
|
-
|
|
1633
|
-
|
|
1840
|
+
var replaceAuthCallbackUrl = (cleanupPath) => {
|
|
1841
|
+
if (!cleanupPath || typeof window === "undefined") return;
|
|
1842
|
+
window.history.replaceState(null, "", cleanupPath);
|
|
1634
1843
|
};
|
|
1635
|
-
function
|
|
1636
|
-
var _a;
|
|
1844
|
+
function AggAuthProvider({ children }) {
|
|
1637
1845
|
const client = useContext(AggClientContext);
|
|
1638
|
-
const
|
|
1639
|
-
const
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
const
|
|
1646
|
-
const
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1846
|
+
const queryClientFromContext = useContext(QueryClientContext);
|
|
1847
|
+
const fallbackQueryClient = useMemo(() => new QueryClient(), []);
|
|
1848
|
+
const queryClient = queryClientFromContext && "fetchQuery" in queryClientFromContext ? queryClientFromContext : fallbackQueryClient;
|
|
1849
|
+
const snapshot = getClientAuthSnapshot(client);
|
|
1850
|
+
const [isAuthenticated, setIsAuthenticated] = useState(snapshot.isAuthenticated);
|
|
1851
|
+
const [user, setUser] = useState(snapshot.user);
|
|
1852
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
1853
|
+
const [error, setError] = useState(null);
|
|
1854
|
+
const isWeb3User = useMemo(() => {
|
|
1855
|
+
const accounts = user == null ? void 0 : user.accounts;
|
|
1856
|
+
if (!Array.isArray(accounts)) return true;
|
|
1857
|
+
return accounts.some((account) => {
|
|
1858
|
+
var _a;
|
|
1859
|
+
const provider = String((_a = account.provider) != null ? _a : "").toLowerCase();
|
|
1860
|
+
return provider === "wallet" || provider === "solana_wallet";
|
|
1861
|
+
});
|
|
1862
|
+
}, [user]);
|
|
1863
|
+
const refreshCurrentUser = useCallback(
|
|
1864
|
+
(targetClient) => __async(null, null, function* () {
|
|
1865
|
+
const fullUser = yield fetchCurrentUserProfile(queryClient, targetClient);
|
|
1866
|
+
setIsAuthenticated(true);
|
|
1867
|
+
setUser(fullUser);
|
|
1868
|
+
return fullUser;
|
|
1656
1869
|
}),
|
|
1657
|
-
|
|
1658
|
-
staleTime: 60 * 1e3,
|
|
1659
|
-
refetchOnWindowFocus: "always",
|
|
1660
|
-
refetchOnReconnect: "always"
|
|
1661
|
-
});
|
|
1662
|
-
const managedBalancesData = balancesQuery.data;
|
|
1663
|
-
const managedBalances = useMemo(
|
|
1664
|
-
() => managedBalancesData != null ? managedBalancesData : EMPTY_MANAGED_BALANCES,
|
|
1665
|
-
[managedBalancesData]
|
|
1870
|
+
[queryClient]
|
|
1666
1871
|
);
|
|
1667
|
-
|
|
1668
|
-
|
|
1872
|
+
useEffect(() => {
|
|
1873
|
+
const state = getClientAuthSnapshot(client);
|
|
1874
|
+
setIsAuthenticated(state.isAuthenticated);
|
|
1875
|
+
setUser(state.user);
|
|
1876
|
+
setIsLoading(false);
|
|
1877
|
+
setError(null);
|
|
1878
|
+
if (!client) return;
|
|
1879
|
+
if (state.isAuthenticated) {
|
|
1880
|
+
refreshCurrentUser(client).catch(() => {
|
|
1881
|
+
client.clearAccessToken();
|
|
1882
|
+
});
|
|
1883
|
+
} else if (client.authStatus === "unknown") {
|
|
1884
|
+
client.refreshAccessToken().then(() => refreshCurrentUser(client)).catch(() => {
|
|
1885
|
+
client.clearAccessToken();
|
|
1886
|
+
});
|
|
1887
|
+
}
|
|
1888
|
+
}, [client, refreshCurrentUser]);
|
|
1889
|
+
useEffect(() => {
|
|
1890
|
+
if (!client) return;
|
|
1891
|
+
return client.onAuthStateChange((authenticated) => {
|
|
1892
|
+
setIsAuthenticated(authenticated);
|
|
1893
|
+
setUser(client.user);
|
|
1894
|
+
if (!authenticated) {
|
|
1895
|
+
setIsLoading(false);
|
|
1896
|
+
setError(null);
|
|
1897
|
+
}
|
|
1898
|
+
});
|
|
1899
|
+
}, [client]);
|
|
1900
|
+
const signIn = useCallback(
|
|
1901
|
+
(options) => __async(null, null, function* () {
|
|
1902
|
+
if (!client) {
|
|
1903
|
+
const missingClientError = new Error("Agg client is not configured in <AggProvider>");
|
|
1904
|
+
setError(missingClientError);
|
|
1905
|
+
throw missingClientError;
|
|
1906
|
+
}
|
|
1907
|
+
const address = options.address.trim();
|
|
1908
|
+
if (!address) {
|
|
1909
|
+
const missingAddressError = new Error("Wallet address is required");
|
|
1910
|
+
setError(missingAddressError);
|
|
1911
|
+
throw missingAddressError;
|
|
1912
|
+
}
|
|
1913
|
+
setIsLoading(true);
|
|
1914
|
+
setError(null);
|
|
1915
|
+
try {
|
|
1916
|
+
const result = yield executeWalletAuthFlow({
|
|
1917
|
+
client,
|
|
1918
|
+
options: __spreadProps(__spreadValues({}, options), {
|
|
1919
|
+
address
|
|
1920
|
+
})
|
|
1921
|
+
});
|
|
1922
|
+
client.setSession(result);
|
|
1923
|
+
setIsAuthenticated(true);
|
|
1924
|
+
setUser(result.user);
|
|
1925
|
+
yield refreshCurrentUser(client);
|
|
1926
|
+
} catch (signInError) {
|
|
1927
|
+
const resolvedError = toError(signInError);
|
|
1928
|
+
setError(resolvedError);
|
|
1929
|
+
throw resolvedError;
|
|
1930
|
+
} finally {
|
|
1931
|
+
setIsLoading(false);
|
|
1932
|
+
}
|
|
1933
|
+
}),
|
|
1934
|
+
[client, refreshCurrentUser]
|
|
1935
|
+
);
|
|
1936
|
+
const startAuth = useCallback(
|
|
1937
|
+
(options) => __async(null, null, function* () {
|
|
1938
|
+
if (!client) {
|
|
1939
|
+
const missingClientError = new Error("Agg client is not configured in <AggProvider>");
|
|
1940
|
+
setError(missingClientError);
|
|
1941
|
+
throw missingClientError;
|
|
1942
|
+
}
|
|
1943
|
+
setIsLoading(true);
|
|
1944
|
+
setError(null);
|
|
1945
|
+
try {
|
|
1946
|
+
return yield client.authStart(options);
|
|
1947
|
+
} catch (startAuthError) {
|
|
1948
|
+
const resolvedError = toError(startAuthError);
|
|
1949
|
+
setError(resolvedError);
|
|
1950
|
+
throw resolvedError;
|
|
1951
|
+
} finally {
|
|
1952
|
+
setIsLoading(false);
|
|
1953
|
+
}
|
|
1954
|
+
}),
|
|
1955
|
+
[client]
|
|
1956
|
+
);
|
|
1957
|
+
const setSession = useCallback(
|
|
1958
|
+
(session) => __async(null, null, function* () {
|
|
1959
|
+
if (!client) {
|
|
1960
|
+
const missingClientError = new Error("Agg client is not configured in <AggProvider>");
|
|
1961
|
+
setError(missingClientError);
|
|
1962
|
+
throw missingClientError;
|
|
1963
|
+
}
|
|
1964
|
+
setIsLoading(true);
|
|
1965
|
+
setError(null);
|
|
1966
|
+
try {
|
|
1967
|
+
client.setSession(session);
|
|
1968
|
+
const resolvedUser = yield refreshCurrentUser(client);
|
|
1969
|
+
setIsAuthenticated(true);
|
|
1970
|
+
setUser(resolvedUser);
|
|
1971
|
+
return resolvedUser;
|
|
1972
|
+
} catch (sessionError) {
|
|
1973
|
+
client.clearAccessToken();
|
|
1974
|
+
setIsAuthenticated(false);
|
|
1975
|
+
setUser(void 0);
|
|
1976
|
+
const resolvedError = toError(sessionError);
|
|
1977
|
+
setError(resolvedError);
|
|
1978
|
+
throw resolvedError;
|
|
1979
|
+
} finally {
|
|
1980
|
+
setIsLoading(false);
|
|
1981
|
+
}
|
|
1982
|
+
}),
|
|
1983
|
+
[client, refreshCurrentUser]
|
|
1984
|
+
);
|
|
1985
|
+
const handleAuthCallback = useCallback(
|
|
1986
|
+
(callbackUrl) => __async(null, null, function* () {
|
|
1987
|
+
if (!client) {
|
|
1988
|
+
const missingClientError = new Error("Agg client is not configured in <AggProvider>");
|
|
1989
|
+
setError(missingClientError);
|
|
1990
|
+
throw missingClientError;
|
|
1991
|
+
}
|
|
1992
|
+
setIsLoading(true);
|
|
1993
|
+
setError(null);
|
|
1994
|
+
try {
|
|
1995
|
+
const exchangedSession = yield exchangeAuthCallbackCode(client, callbackUrl);
|
|
1996
|
+
if (exchangedSession) {
|
|
1997
|
+
const resolvedUser2 = yield refreshCurrentUser(client);
|
|
1998
|
+
if (callbackUrl === void 0) {
|
|
1999
|
+
replaceAuthCallbackUrl(exchangedSession.cleanupPath);
|
|
2000
|
+
}
|
|
2001
|
+
return resolvedUser2;
|
|
2002
|
+
}
|
|
2003
|
+
const confirmedLink = yield confirmLinkAccountCallback(client, callbackUrl);
|
|
2004
|
+
if (confirmedLink) {
|
|
2005
|
+
const resolvedUser2 = yield refreshCurrentUser(client);
|
|
2006
|
+
if (callbackUrl === void 0) {
|
|
2007
|
+
replaceAuthCallbackUrl(confirmedLink.cleanupPath);
|
|
2008
|
+
}
|
|
2009
|
+
return resolvedUser2;
|
|
2010
|
+
}
|
|
2011
|
+
const tokens = parseAuthCallbackTokens(callbackUrl);
|
|
2012
|
+
if (!tokens) return null;
|
|
2013
|
+
client.setSession(createAuthCallbackSession(tokens));
|
|
2014
|
+
setIsAuthenticated(client.isAuthenticated);
|
|
2015
|
+
setUser(client.user);
|
|
2016
|
+
const resolvedUser = yield refreshCurrentUser(client);
|
|
2017
|
+
if (callbackUrl === void 0) {
|
|
2018
|
+
replaceAuthCallbackUrl(getAuthCallbackCleanupPath(callbackUrl));
|
|
2019
|
+
}
|
|
2020
|
+
return resolvedUser;
|
|
2021
|
+
} catch (callbackError) {
|
|
2022
|
+
const resolvedError = toError(callbackError);
|
|
2023
|
+
setError(resolvedError);
|
|
2024
|
+
throw resolvedError;
|
|
2025
|
+
} finally {
|
|
2026
|
+
setIsLoading(false);
|
|
2027
|
+
}
|
|
2028
|
+
}),
|
|
2029
|
+
[client, refreshCurrentUser]
|
|
2030
|
+
);
|
|
2031
|
+
const signOut = useCallback(() => __async(null, null, function* () {
|
|
2032
|
+
yield client == null ? void 0 : client.signOut();
|
|
2033
|
+
setIsAuthenticated(false);
|
|
2034
|
+
setUser(void 0);
|
|
2035
|
+
setError(null);
|
|
2036
|
+
}), [client]);
|
|
2037
|
+
const clearError = useCallback(() => {
|
|
2038
|
+
setError(null);
|
|
2039
|
+
}, []);
|
|
2040
|
+
const value = useMemo(() => {
|
|
2041
|
+
return {
|
|
2042
|
+
isAuthenticated,
|
|
2043
|
+
isWeb3User,
|
|
2044
|
+
user,
|
|
2045
|
+
isLoading,
|
|
2046
|
+
error,
|
|
2047
|
+
signIn,
|
|
2048
|
+
startAuth,
|
|
2049
|
+
setSession,
|
|
2050
|
+
handleAuthCallback,
|
|
2051
|
+
signOut,
|
|
2052
|
+
clearError
|
|
2053
|
+
};
|
|
2054
|
+
}, [
|
|
2055
|
+
clearError,
|
|
2056
|
+
error,
|
|
2057
|
+
handleAuthCallback,
|
|
2058
|
+
isAuthenticated,
|
|
2059
|
+
isWeb3User,
|
|
2060
|
+
isLoading,
|
|
2061
|
+
setSession,
|
|
2062
|
+
signIn,
|
|
2063
|
+
signOut,
|
|
2064
|
+
startAuth,
|
|
2065
|
+
user
|
|
2066
|
+
]);
|
|
2067
|
+
return /* @__PURE__ */ jsx(AggAuthContext.Provider, { value, children });
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
// src/core/providers/balance-provider.tsx
|
|
2071
|
+
import { useQuery } from "@tanstack/react-query";
|
|
2072
|
+
import { useCallback as useCallback2, useContext as useContext2, useMemo as useMemo2 } from "react";
|
|
2073
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
2074
|
+
var CHAIN_LABELS = {
|
|
2075
|
+
0: "Paper",
|
|
2076
|
+
1: "Ethereum",
|
|
2077
|
+
10: "Optimism",
|
|
2078
|
+
56: "BNB",
|
|
2079
|
+
137: "Polygon",
|
|
2080
|
+
1337: "Hyperliquid",
|
|
2081
|
+
8453: "Base",
|
|
2082
|
+
42161: "Arbitrum",
|
|
2083
|
+
43114: "Avalanche",
|
|
2084
|
+
11155111: "Sepolia",
|
|
2085
|
+
792703809: "Solana"
|
|
2086
|
+
};
|
|
2087
|
+
var chainLabelFromId = (chainId) => {
|
|
2088
|
+
var _a;
|
|
2089
|
+
return (_a = CHAIN_LABELS[chainId]) != null ? _a : `Chain ${chainId}`;
|
|
2090
|
+
};
|
|
2091
|
+
var toTokenUnits = (raw, decimals) => {
|
|
2092
|
+
const numeric = Number(raw);
|
|
2093
|
+
if (!Number.isFinite(numeric)) return 0;
|
|
2094
|
+
return numeric / __pow(10, decimals);
|
|
2095
|
+
};
|
|
2096
|
+
var isUsdBasedToken = (tokenSymbol) => {
|
|
2097
|
+
var _a;
|
|
2098
|
+
return (_a = tokenSymbol == null ? void 0 : tokenSymbol.toUpperCase()) == null ? void 0 : _a.includes("USD");
|
|
2099
|
+
};
|
|
2100
|
+
var EMPTY_MANAGED_BALANCES = {
|
|
2101
|
+
cash: [],
|
|
2102
|
+
positions: []
|
|
2103
|
+
};
|
|
2104
|
+
function AggBalanceProvider({ children }) {
|
|
2105
|
+
var _a;
|
|
2106
|
+
const client = useContext2(AggClientContext);
|
|
2107
|
+
const authContext = useContext2(AggAuthContext);
|
|
2108
|
+
const { executionMode } = useResolvedExecutionMode();
|
|
2109
|
+
if (!authContext) {
|
|
2110
|
+
throw new Error("AggBalanceProvider must be used within an <AggAuthProvider>");
|
|
2111
|
+
}
|
|
2112
|
+
const { isAuthenticated } = authContext;
|
|
2113
|
+
const queryExecutionMode = executionMode === "paper" ? "paper" : void 0;
|
|
2114
|
+
const balancesQuery = useQuery({
|
|
2115
|
+
queryKey: balanceQueryKeys.provider(queryExecutionMode),
|
|
2116
|
+
queryFn: () => __async(null, null, function* () {
|
|
2117
|
+
if (!client || !isAuthenticated) {
|
|
2118
|
+
return EMPTY_MANAGED_BALANCES;
|
|
2119
|
+
}
|
|
2120
|
+
return client.getManagedBalances(
|
|
2121
|
+
queryExecutionMode ? { mode: queryExecutionMode } : void 0
|
|
2122
|
+
);
|
|
2123
|
+
}),
|
|
2124
|
+
enabled: Boolean(client && isAuthenticated),
|
|
2125
|
+
staleTime: 60 * 1e3,
|
|
2126
|
+
// A matched fill can precede settlement and the API's next balance snapshot.
|
|
2127
|
+
// Keep visible clients converging even if that first invalidation reads old cash.
|
|
2128
|
+
refetchInterval: queryExecutionMode === "paper" ? false : 5e3,
|
|
2129
|
+
refetchIntervalInBackground: false,
|
|
2130
|
+
refetchOnWindowFocus: "always",
|
|
2131
|
+
refetchOnReconnect: "always"
|
|
2132
|
+
});
|
|
2133
|
+
const managedBalancesData = balancesQuery.data;
|
|
2134
|
+
const managedBalances = useMemo2(
|
|
2135
|
+
() => managedBalancesData != null ? managedBalancesData : EMPTY_MANAGED_BALANCES,
|
|
2136
|
+
[managedBalancesData]
|
|
2137
|
+
);
|
|
2138
|
+
const connectedVenues = useMemo2(() => {
|
|
2139
|
+
return Array.from(new Set(managedBalances.positions.map((position) => position.venue))).sort(
|
|
1669
2140
|
(a, b) => a.localeCompare(b)
|
|
1670
2141
|
);
|
|
1671
2142
|
}, [managedBalances.positions]);
|
|
1672
2143
|
const balancesError = managedBalancesData === void 0 ? balancesQuery.error : null;
|
|
1673
2144
|
const isBalancesLoading = balancesQuery.isLoading;
|
|
1674
2145
|
const refetchBalances = balancesQuery.refetch;
|
|
1675
|
-
const totalBalance =
|
|
2146
|
+
const totalBalance = useMemo2(() => {
|
|
1676
2147
|
const cash = managedBalances.cash;
|
|
1677
2148
|
return cash.reduce((sum, token) => {
|
|
1678
2149
|
if (!isUsdBasedToken(token.tokenSymbol)) return sum;
|
|
@@ -1686,7 +2157,7 @@ function AggBalanceProvider({ children }) {
|
|
|
1686
2157
|
return sum + tokenAcrossChains;
|
|
1687
2158
|
}, 0);
|
|
1688
2159
|
}, [managedBalances]);
|
|
1689
|
-
const availableBalance =
|
|
2160
|
+
const availableBalance = useMemo2(() => {
|
|
1690
2161
|
return managedBalances.cash.reduce((sum, token) => {
|
|
1691
2162
|
if (!isUsdBasedToken(token.tokenSymbol)) return sum;
|
|
1692
2163
|
if (token.availableRaw != null) {
|
|
@@ -1701,7 +2172,7 @@ function AggBalanceProvider({ children }) {
|
|
|
1701
2172
|
);
|
|
1702
2173
|
}, 0);
|
|
1703
2174
|
}, [managedBalances]);
|
|
1704
|
-
const reservedBalance =
|
|
2175
|
+
const reservedBalance = useMemo2(() => {
|
|
1705
2176
|
return managedBalances.cash.reduce((sum, token) => {
|
|
1706
2177
|
if (!isUsdBasedToken(token.tokenSymbol)) return sum;
|
|
1707
2178
|
if (token.reservedRaw != null) {
|
|
@@ -1716,7 +2187,7 @@ function AggBalanceProvider({ children }) {
|
|
|
1716
2187
|
);
|
|
1717
2188
|
}, 0);
|
|
1718
2189
|
}, [managedBalances]);
|
|
1719
|
-
const buildBalanceBreakdown =
|
|
2190
|
+
const buildBalanceBreakdown = useCallback2(
|
|
1720
2191
|
(rawForChain) => {
|
|
1721
2192
|
var _a2, _b;
|
|
1722
2193
|
const byChain = /* @__PURE__ */ new Map();
|
|
@@ -1744,16 +2215,16 @@ function AggBalanceProvider({ children }) {
|
|
|
1744
2215
|
},
|
|
1745
2216
|
[connectedVenues, managedBalances.cash]
|
|
1746
2217
|
);
|
|
1747
|
-
const balanceBreakdown =
|
|
2218
|
+
const balanceBreakdown = useMemo2(() => {
|
|
1748
2219
|
return buildBalanceBreakdown((chain) => chain.balanceRaw);
|
|
1749
2220
|
}, [buildBalanceBreakdown]);
|
|
1750
|
-
const availableBalanceBreakdown =
|
|
2221
|
+
const availableBalanceBreakdown = useMemo2(() => {
|
|
1751
2222
|
return buildBalanceBreakdown((chain) => {
|
|
1752
2223
|
var _a2;
|
|
1753
2224
|
return (_a2 = chain.availableRaw) != null ? _a2 : chain.balanceRaw;
|
|
1754
2225
|
});
|
|
1755
2226
|
}, [buildBalanceBreakdown]);
|
|
1756
|
-
const positionsBalanceTotal =
|
|
2227
|
+
const positionsBalanceTotal = useMemo2(() => {
|
|
1757
2228
|
const positions = managedBalances.positions;
|
|
1758
2229
|
const actualPositionsBalance = positions.reduce(
|
|
1759
2230
|
(sum, position) => sum + (Number.isFinite(position.balance) ? position.balance : 0),
|
|
@@ -1764,15 +2235,15 @@ function AggBalanceProvider({ children }) {
|
|
|
1764
2235
|
const kalshiVenueCash = (_a = managedBalances.venueCash) == null ? void 0 : _a.find((item) => item.venue === "kalshi");
|
|
1765
2236
|
const kalshiBalance = kalshiVenueCash ? kalshiVenueCash.balanceCents / 100 : null;
|
|
1766
2237
|
const kalshiPortfolioValue = (kalshiVenueCash == null ? void 0 : kalshiVenueCash.portfolioValueCents) == null ? null : kalshiVenueCash.portfolioValueCents / 100;
|
|
1767
|
-
const refetch =
|
|
2238
|
+
const refetch = useCallback2(() => {
|
|
1768
2239
|
if (!isAuthenticated) return;
|
|
1769
2240
|
void refetchBalances();
|
|
1770
2241
|
}, [isAuthenticated, refetchBalances]);
|
|
1771
|
-
const refetchConnectionStatus =
|
|
2242
|
+
const refetchConnectionStatus = useCallback2(() => {
|
|
1772
2243
|
if (!client || !isAuthenticated) return;
|
|
1773
2244
|
void client.getCurrentUser();
|
|
1774
2245
|
}, [client, isAuthenticated]);
|
|
1775
|
-
const value =
|
|
2246
|
+
const value = useMemo2(() => {
|
|
1776
2247
|
if (!isAuthenticated) {
|
|
1777
2248
|
return {
|
|
1778
2249
|
managedBalances,
|
|
@@ -1828,24 +2299,96 @@ function AggBalanceProvider({ children }) {
|
|
|
1828
2299
|
reservedBalance,
|
|
1829
2300
|
totalBalance
|
|
1830
2301
|
]);
|
|
1831
|
-
return /* @__PURE__ */
|
|
2302
|
+
return /* @__PURE__ */ jsx2(AggBalanceContext.Provider, { value, children });
|
|
1832
2303
|
}
|
|
1833
2304
|
|
|
1834
|
-
// src/core/providers/
|
|
1835
|
-
import {
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
2305
|
+
// src/core/providers/client-provider.tsx
|
|
2306
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
2307
|
+
function AggClientProvider({ client, children }) {
|
|
2308
|
+
return /* @__PURE__ */ jsx3(AggClientContext.Provider, { value: client != null ? client : null, children });
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
// src/core/providers/execution-mode-provider.tsx
|
|
2312
|
+
import { useMemo as useMemo3 } from "react";
|
|
2313
|
+
|
|
2314
|
+
// src/use-app-config.ts
|
|
2315
|
+
import { useQuery as useQuery2, useQueryClient } from "@tanstack/react-query";
|
|
2316
|
+
var FIVE_MINUTES = 5 * 60 * 1e3;
|
|
2317
|
+
var NO_APP_SCOPE = "__no-app__";
|
|
2318
|
+
var appConfigQueryKey = (appId) => ["agg", "app-config", appId != null ? appId : NO_APP_SCOPE];
|
|
2319
|
+
function useAppConfig() {
|
|
2320
|
+
const client = useAggClient();
|
|
2321
|
+
const query = useQuery2({
|
|
2322
|
+
queryKey: appConfigQueryKey(client.appId),
|
|
2323
|
+
queryFn: () => client.getAppConfig(),
|
|
2324
|
+
staleTime: FIVE_MINUTES,
|
|
2325
|
+
// Skipped entirely while the tab is unfocused — query-core only fires the
|
|
2326
|
+
// interval when `refetchIntervalInBackground` is set or the window is
|
|
2327
|
+
// focused — so a background tab costs nothing.
|
|
2328
|
+
refetchInterval: FIVE_MINUTES
|
|
2329
|
+
});
|
|
2330
|
+
return toAppConfigResult({
|
|
2331
|
+
data: query.data,
|
|
2332
|
+
isLoading: query.isLoading,
|
|
2333
|
+
error: query.error
|
|
2334
|
+
});
|
|
2335
|
+
}
|
|
2336
|
+
function useCachedAppConfig() {
|
|
2337
|
+
const queryClient = useQueryClient();
|
|
2338
|
+
const client = useOptionalAggClient();
|
|
2339
|
+
const queryKey = appConfigQueryKey(client == null ? void 0 : client.appId);
|
|
2340
|
+
const query = useQuery2({
|
|
2341
|
+
queryKey,
|
|
2342
|
+
enabled: false,
|
|
2343
|
+
initialData: () => queryClient.getQueryData(queryKey),
|
|
2344
|
+
staleTime: FIVE_MINUTES
|
|
2345
|
+
});
|
|
2346
|
+
return toAppConfigResult({
|
|
2347
|
+
data: query.data,
|
|
2348
|
+
isLoading: query.isLoading,
|
|
2349
|
+
error: query.error
|
|
2350
|
+
});
|
|
2351
|
+
}
|
|
2352
|
+
var toAppConfigResult = (query) => {
|
|
2353
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
2354
|
+
return {
|
|
2355
|
+
disabledVenues: (_b = (_a = query.data) == null ? void 0 : _a.disabledVenues) != null ? _b : [],
|
|
2356
|
+
disabledCategoryPresets: (_d = (_c = query.data) == null ? void 0 : _c.disabledCategoryPresets) != null ? _d : [],
|
|
2357
|
+
earlyAccessEnabled: (_f = (_e = query.data) == null ? void 0 : _e.earlyAccessEnabled) != null ? _f : false,
|
|
2358
|
+
authOptions: (_h = (_g = query.data) == null ? void 0 : _g.authOptions) != null ? _h : [],
|
|
2359
|
+
tradingMode: (_i = query.data) == null ? void 0 : _i.tradingMode,
|
|
2360
|
+
paperStartingBalance: (_j = query.data) == null ? void 0 : _j.paperStartingBalance,
|
|
2361
|
+
isLoading: query.isLoading,
|
|
2362
|
+
error: query.error
|
|
2363
|
+
};
|
|
2364
|
+
};
|
|
2365
|
+
|
|
2366
|
+
// src/core/providers/execution-mode-provider.tsx
|
|
2367
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
2368
|
+
function AggExecutionModeProvider({ children }) {
|
|
2369
|
+
const { tradingMode, paperStartingBalance, isLoading } = useAppConfig();
|
|
2370
|
+
const value = useMemo3(
|
|
2371
|
+
() => ({ tradingMode, paperStartingBalance, isLoading }),
|
|
2372
|
+
[tradingMode, paperStartingBalance, isLoading]
|
|
2373
|
+
);
|
|
2374
|
+
return /* @__PURE__ */ jsx4(AggExecutionModeContext.Provider, { value, children });
|
|
2375
|
+
}
|
|
2376
|
+
|
|
2377
|
+
// src/core/providers/event-list-state-context.tsx
|
|
2378
|
+
import { createContext as createContext2, useCallback as useCallback3, useContext as useContext3, useRef } from "react";
|
|
2379
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
2380
|
+
var STALENESS_THRESHOLD_MS = 5 * 60 * 1e3;
|
|
2381
|
+
var MAX_INITIAL_PAGES = 10;
|
|
1839
2382
|
var EventListStateContext = createContext2(null);
|
|
1840
2383
|
function EventListStateProvider({ children }) {
|
|
1841
2384
|
const snapshotRef = useRef(null);
|
|
1842
|
-
const capture =
|
|
2385
|
+
const capture = useCallback3((state) => {
|
|
1843
2386
|
snapshotRef.current = __spreadProps(__spreadValues({}, state), {
|
|
1844
2387
|
loadedPageCount: Math.min(state.loadedPageCount, MAX_INITIAL_PAGES),
|
|
1845
2388
|
capturedAt: Date.now()
|
|
1846
2389
|
});
|
|
1847
2390
|
}, []);
|
|
1848
|
-
const consume =
|
|
2391
|
+
const consume = useCallback3(() => {
|
|
1849
2392
|
const snapshot = snapshotRef.current;
|
|
1850
2393
|
snapshotRef.current = null;
|
|
1851
2394
|
if (!snapshot) return null;
|
|
@@ -1860,66 +2403,27 @@ function EventListStateProvider({ children }) {
|
|
|
1860
2403
|
capture: (...args) => value.current.capture(...args),
|
|
1861
2404
|
consume: () => value.current.consume()
|
|
1862
2405
|
}).current;
|
|
1863
|
-
return /* @__PURE__ */
|
|
2406
|
+
return /* @__PURE__ */ jsx5(EventListStateContext.Provider, { value: stableValue, children });
|
|
1864
2407
|
}
|
|
1865
2408
|
function useEventListState() {
|
|
1866
|
-
const context =
|
|
2409
|
+
const context = useContext3(EventListStateContext);
|
|
1867
2410
|
if (!context) {
|
|
1868
2411
|
throw new Error("useEventListState must be used within an <AggProvider>");
|
|
1869
2412
|
}
|
|
1870
2413
|
return context;
|
|
1871
2414
|
}
|
|
1872
2415
|
|
|
1873
|
-
// src/core/providers/hooks.ts
|
|
1874
|
-
import { useContext as useContext3 } from "react";
|
|
1875
|
-
var useAggClient = () => {
|
|
1876
|
-
const client = useContext3(AggClientContext);
|
|
1877
|
-
if (!client) {
|
|
1878
|
-
throw new Error("useAggClient must be used within an <AggProvider>");
|
|
1879
|
-
}
|
|
1880
|
-
return client;
|
|
1881
|
-
};
|
|
1882
|
-
var useOptionalAggClient = () => {
|
|
1883
|
-
return useContext3(AggClientContext);
|
|
1884
|
-
};
|
|
1885
|
-
var useAggUiConfig = () => {
|
|
1886
|
-
return useContext3(AggUiContext);
|
|
1887
|
-
};
|
|
1888
|
-
var useAggLabels = () => {
|
|
1889
|
-
return useContext3(AggLabelsContext);
|
|
1890
|
-
};
|
|
1891
|
-
var useAggAuthContext = () => {
|
|
1892
|
-
const context = useContext3(AggAuthContext);
|
|
1893
|
-
if (!context) {
|
|
1894
|
-
throw new Error("useAggAuthContext must be used within an <AggProvider>");
|
|
1895
|
-
}
|
|
1896
|
-
return context;
|
|
1897
|
-
};
|
|
1898
|
-
var useAggAuthState = useAggAuthContext;
|
|
1899
|
-
var useAggBalanceContext = () => {
|
|
1900
|
-
const context = useContext3(AggBalanceContext);
|
|
1901
|
-
if (!context) {
|
|
1902
|
-
throw new Error("useAggBalanceContext must be used within an <AggProvider>");
|
|
1903
|
-
}
|
|
1904
|
-
return context;
|
|
1905
|
-
};
|
|
1906
|
-
var useAggBalanceState = useAggBalanceContext;
|
|
1907
|
-
var useAggBalance = useAggBalanceContext;
|
|
1908
|
-
var useSdkUiConfig = useAggUiConfig;
|
|
1909
|
-
var useSdkLabels = useAggLabels;
|
|
1910
|
-
var useLabels = useAggLabels;
|
|
1911
|
-
|
|
1912
2416
|
// src/core/providers/ws-provider.tsx
|
|
1913
2417
|
import {
|
|
1914
2418
|
createContext as createContext3,
|
|
1915
|
-
useCallback as
|
|
1916
|
-
useContext as
|
|
1917
|
-
useEffect,
|
|
1918
|
-
useMemo as
|
|
2419
|
+
useCallback as useCallback4,
|
|
2420
|
+
useContext as useContext5,
|
|
2421
|
+
useEffect as useEffect2,
|
|
2422
|
+
useMemo as useMemo4,
|
|
1919
2423
|
useRef as useRef2,
|
|
1920
|
-
useState
|
|
2424
|
+
useState as useState2
|
|
1921
2425
|
} from "react";
|
|
1922
|
-
import { useQueryClient } from "@tanstack/react-query";
|
|
2426
|
+
import { useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
1923
2427
|
|
|
1924
2428
|
// src/market-data/chart-cache.ts
|
|
1925
2429
|
var MAX_CACHE_RETENTION_SECONDS = 7 * 30 * 24 * 60 * 60 + 14 * 24 * 60 * 60;
|
|
@@ -2460,8 +2964,47 @@ var marketDataKeys = {
|
|
|
2460
2964
|
}
|
|
2461
2965
|
};
|
|
2462
2966
|
|
|
2967
|
+
// src/core/providers/hooks.ts
|
|
2968
|
+
import { useContext as useContext4 } from "react";
|
|
2969
|
+
var useAggClient = () => {
|
|
2970
|
+
const client = useContext4(AggClientContext);
|
|
2971
|
+
if (!client) {
|
|
2972
|
+
throw new Error("useAggClient must be used within an <AggProvider>");
|
|
2973
|
+
}
|
|
2974
|
+
return client;
|
|
2975
|
+
};
|
|
2976
|
+
var useOptionalAggClient = () => {
|
|
2977
|
+
return useContext4(AggClientContext);
|
|
2978
|
+
};
|
|
2979
|
+
var useAggUiConfig = () => {
|
|
2980
|
+
return useContext4(AggUiContext);
|
|
2981
|
+
};
|
|
2982
|
+
var useAggLabels = () => {
|
|
2983
|
+
return useContext4(AggLabelsContext);
|
|
2984
|
+
};
|
|
2985
|
+
var useAggAuthContext = () => {
|
|
2986
|
+
const context = useContext4(AggAuthContext);
|
|
2987
|
+
if (!context) {
|
|
2988
|
+
throw new Error("useAggAuthContext must be used within an <AggProvider>");
|
|
2989
|
+
}
|
|
2990
|
+
return context;
|
|
2991
|
+
};
|
|
2992
|
+
var useAggAuthState = useAggAuthContext;
|
|
2993
|
+
var useAggBalanceContext = () => {
|
|
2994
|
+
const context = useContext4(AggBalanceContext);
|
|
2995
|
+
if (!context) {
|
|
2996
|
+
throw new Error("useAggBalanceContext must be used within an <AggProvider>");
|
|
2997
|
+
}
|
|
2998
|
+
return context;
|
|
2999
|
+
};
|
|
3000
|
+
var useAggBalanceState = useAggBalanceContext;
|
|
3001
|
+
var useAggBalance = useAggBalanceContext;
|
|
3002
|
+
var useSdkUiConfig = useAggUiConfig;
|
|
3003
|
+
var useSdkLabels = useAggLabels;
|
|
3004
|
+
var useLabels = useAggLabels;
|
|
3005
|
+
|
|
2463
3006
|
// src/core/providers/ws-provider.tsx
|
|
2464
|
-
import { jsx as
|
|
3007
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
2465
3008
|
var AggWebSocketContext = createContext3(null);
|
|
2466
3009
|
var AggWebSocketConnectionContext = createContext3(false);
|
|
2467
3010
|
var AggWsUserEventContext = createContext3(null);
|
|
@@ -2481,17 +3024,17 @@ var debugOrderbook = (enabled, event, payload) => {
|
|
|
2481
3024
|
console.debug(`[AggHooks][ws-provider] ${event}`, payload);
|
|
2482
3025
|
};
|
|
2483
3026
|
function useAggWebSocket() {
|
|
2484
|
-
return
|
|
3027
|
+
return useContext5(AggWebSocketContext);
|
|
2485
3028
|
}
|
|
2486
3029
|
function useAggWebSocketConnectionState() {
|
|
2487
|
-
return
|
|
3030
|
+
return useContext5(AggWebSocketConnectionContext);
|
|
2488
3031
|
}
|
|
2489
3032
|
function useOnOrderSubmitted(callback) {
|
|
2490
|
-
const listeners =
|
|
3033
|
+
const listeners = useContext5(AggWsUserEventContext);
|
|
2491
3034
|
const callbackRef = useRef2(callback);
|
|
2492
3035
|
callbackRef.current = callback;
|
|
2493
3036
|
const hasCallback = callback !== null;
|
|
2494
|
-
|
|
3037
|
+
useEffect2(() => {
|
|
2495
3038
|
if (!listeners || !callbackRef.current) return;
|
|
2496
3039
|
const handler = (msg) => {
|
|
2497
3040
|
var _a;
|
|
@@ -2501,11 +3044,11 @@ function useOnOrderSubmitted(callback) {
|
|
|
2501
3044
|
}, [listeners, hasCallback]);
|
|
2502
3045
|
}
|
|
2503
3046
|
function useOnBalanceUpdate(callback) {
|
|
2504
|
-
const listeners =
|
|
3047
|
+
const listeners = useContext5(AggWsUserEventContext);
|
|
2505
3048
|
const callbackRef = useRef2(callback);
|
|
2506
3049
|
callbackRef.current = callback;
|
|
2507
3050
|
const hasCallback = callback !== null;
|
|
2508
|
-
|
|
3051
|
+
useEffect2(() => {
|
|
2509
3052
|
if (!listeners || !callbackRef.current) return;
|
|
2510
3053
|
const handler = (msg) => {
|
|
2511
3054
|
var _a;
|
|
@@ -2515,11 +3058,11 @@ function useOnBalanceUpdate(callback) {
|
|
|
2515
3058
|
}, [listeners, hasCallback]);
|
|
2516
3059
|
}
|
|
2517
3060
|
function useOnOrderEvent(callback) {
|
|
2518
|
-
const listeners =
|
|
3061
|
+
const listeners = useContext5(AggWsUserEventContext);
|
|
2519
3062
|
const callbackRef = useRef2(callback);
|
|
2520
3063
|
callbackRef.current = callback;
|
|
2521
3064
|
const hasCallback = callback !== null;
|
|
2522
|
-
|
|
3065
|
+
useEffect2(() => {
|
|
2523
3066
|
if (!listeners || !callbackRef.current) return;
|
|
2524
3067
|
const handler = (msg) => {
|
|
2525
3068
|
var _a;
|
|
@@ -2529,11 +3072,11 @@ function useOnOrderEvent(callback) {
|
|
|
2529
3072
|
}, [listeners, hasCallback]);
|
|
2530
3073
|
}
|
|
2531
3074
|
function useOnRedeemEvent(callback) {
|
|
2532
|
-
const listeners =
|
|
3075
|
+
const listeners = useContext5(AggWsUserEventContext);
|
|
2533
3076
|
const callbackRef = useRef2(callback);
|
|
2534
3077
|
callbackRef.current = callback;
|
|
2535
3078
|
const hasCallback = callback !== null;
|
|
2536
|
-
|
|
3079
|
+
useEffect2(() => {
|
|
2537
3080
|
if (!listeners || !callbackRef.current) return;
|
|
2538
3081
|
const handler = (msg) => {
|
|
2539
3082
|
var _a;
|
|
@@ -2543,11 +3086,11 @@ function useOnRedeemEvent(callback) {
|
|
|
2543
3086
|
}, [listeners, hasCallback]);
|
|
2544
3087
|
}
|
|
2545
3088
|
function useOnWithdrawalLifecycle(callback) {
|
|
2546
|
-
const listeners =
|
|
3089
|
+
const listeners = useContext5(AggWsUserEventContext);
|
|
2547
3090
|
const callbackRef = useRef2(callback);
|
|
2548
3091
|
callbackRef.current = callback;
|
|
2549
3092
|
const hasCallback = callback !== null;
|
|
2550
|
-
|
|
3093
|
+
useEffect2(() => {
|
|
2551
3094
|
if (!listeners || !callbackRef.current) return;
|
|
2552
3095
|
const handler = (msg) => {
|
|
2553
3096
|
var _a;
|
|
@@ -2559,14 +3102,14 @@ function useOnWithdrawalLifecycle(callback) {
|
|
|
2559
3102
|
function AggWebSocketProvider({ children }) {
|
|
2560
3103
|
const client = useAggClient();
|
|
2561
3104
|
const { enableWebsocketsLogs } = useAggUiConfig();
|
|
2562
|
-
const queryClient =
|
|
2563
|
-
const [ws, setWs] =
|
|
2564
|
-
const [isConnected, setIsConnected] =
|
|
2565
|
-
const [isClientAuthenticated, setIsClientAuthenticated] =
|
|
3105
|
+
const queryClient = useQueryClient2();
|
|
3106
|
+
const [ws, setWs] = useState2(null);
|
|
3107
|
+
const [isConnected, setIsConnected] = useState2(false);
|
|
3108
|
+
const [isClientAuthenticated, setIsClientAuthenticated] = useState2(client.isAuthenticated);
|
|
2566
3109
|
const wsRef = useRef2(null);
|
|
2567
3110
|
const resyncDeadlineByMarketRef = useRef2(/* @__PURE__ */ new Map());
|
|
2568
3111
|
const lastBalanceInvalidationAtRef = useRef2(0);
|
|
2569
|
-
|
|
3112
|
+
useEffect2(() => {
|
|
2570
3113
|
setIsClientAuthenticated(client.isAuthenticated);
|
|
2571
3114
|
return client.onAuthStateChange((authenticated) => {
|
|
2572
3115
|
setIsClientAuthenticated(authenticated);
|
|
@@ -2579,7 +3122,7 @@ function AggWebSocketProvider({ children }) {
|
|
|
2579
3122
|
const withdrawalLifecycleListenersRef = useRef2(
|
|
2580
3123
|
/* @__PURE__ */ new Set()
|
|
2581
3124
|
);
|
|
2582
|
-
const userEventListeners =
|
|
3125
|
+
const userEventListeners = useMemo4(
|
|
2583
3126
|
() => ({
|
|
2584
3127
|
addOrderSubmittedListener: (cb) => {
|
|
2585
3128
|
orderSubmittedListenersRef.current.add(cb);
|
|
@@ -2614,7 +3157,7 @@ function AggWebSocketProvider({ children }) {
|
|
|
2614
3157
|
}),
|
|
2615
3158
|
[]
|
|
2616
3159
|
);
|
|
2617
|
-
const syncOrderbookQueries =
|
|
3160
|
+
const syncOrderbookQueries = useCallback4(
|
|
2618
3161
|
(marketId, updater) => {
|
|
2619
3162
|
var _a;
|
|
2620
3163
|
const queries = queryClient.getQueryCache().findAll({
|
|
@@ -2630,7 +3173,7 @@ function AggWebSocketProvider({ children }) {
|
|
|
2630
3173
|
},
|
|
2631
3174
|
[queryClient]
|
|
2632
3175
|
);
|
|
2633
|
-
const syncChartQueries =
|
|
3176
|
+
const syncChartQueries = useCallback4(
|
|
2634
3177
|
(marketId, updater) => {
|
|
2635
3178
|
const queries = queryClient.getQueryCache().findAll({
|
|
2636
3179
|
queryKey: marketDataKeys.chartPrefix(marketId)
|
|
@@ -2644,7 +3187,7 @@ function AggWebSocketProvider({ children }) {
|
|
|
2644
3187
|
},
|
|
2645
3188
|
[queryClient]
|
|
2646
3189
|
);
|
|
2647
|
-
const syncLiveQuery =
|
|
3190
|
+
const syncLiveQuery = useCallback4(
|
|
2648
3191
|
(marketId, updater) => {
|
|
2649
3192
|
queryClient.setQueryData(marketDataKeys.live(marketId), (previous) => {
|
|
2650
3193
|
return updater(previous);
|
|
@@ -2652,19 +3195,19 @@ function AggWebSocketProvider({ children }) {
|
|
|
2652
3195
|
},
|
|
2653
3196
|
[queryClient]
|
|
2654
3197
|
);
|
|
2655
|
-
const invalidateBalanceCaches =
|
|
3198
|
+
const invalidateBalanceCaches = useCallback4(() => {
|
|
2656
3199
|
const now = Date.now();
|
|
2657
3200
|
if (now - lastBalanceInvalidationAtRef.current < 750) return;
|
|
2658
3201
|
lastBalanceInvalidationAtRef.current = now;
|
|
2659
3202
|
invalidateBalanceQueries(queryClient);
|
|
2660
3203
|
}, [queryClient]);
|
|
2661
|
-
const invalidatePositionCaches =
|
|
3204
|
+
const invalidatePositionCaches = useCallback4(() => {
|
|
2662
3205
|
invalidatePositionQueries(queryClient);
|
|
2663
3206
|
}, [queryClient]);
|
|
2664
|
-
const invalidateActivityCaches =
|
|
3207
|
+
const invalidateActivityCaches = useCallback4(() => {
|
|
2665
3208
|
invalidateUserActivityQueries(queryClient);
|
|
2666
3209
|
}, [queryClient]);
|
|
2667
|
-
const invalidateResolutionCaches =
|
|
3210
|
+
const invalidateResolutionCaches = useCallback4(
|
|
2668
3211
|
(resolution) => {
|
|
2669
3212
|
const { outcomeId } = resolution;
|
|
2670
3213
|
syncLiveQuery(outcomeId, (previous) => {
|
|
@@ -2720,7 +3263,7 @@ function AggWebSocketProvider({ children }) {
|
|
|
2720
3263
|
},
|
|
2721
3264
|
[queryClient, syncLiveQuery]
|
|
2722
3265
|
);
|
|
2723
|
-
const callbacks =
|
|
3266
|
+
const callbacks = useMemo4(
|
|
2724
3267
|
() => ({
|
|
2725
3268
|
onSnapshot: (marketId, book) => {
|
|
2726
3269
|
const orderbook = createMarketOrderbookDataFromState(book);
|
|
@@ -2921,7 +3464,7 @@ function AggWebSocketProvider({ children }) {
|
|
|
2921
3464
|
syncOrderbookQueries
|
|
2922
3465
|
]
|
|
2923
3466
|
);
|
|
2924
|
-
|
|
3467
|
+
useEffect2(() => {
|
|
2925
3468
|
let instance = null;
|
|
2926
3469
|
const resyncDeadlineByMarket = resyncDeadlineByMarketRef.current;
|
|
2927
3470
|
try {
|
|
@@ -2947,16 +3490,89 @@ function AggWebSocketProvider({ children }) {
|
|
|
2947
3490
|
setIsConnected(false);
|
|
2948
3491
|
};
|
|
2949
3492
|
}, [callbacks, client, enableWebsocketsLogs, isClientAuthenticated]);
|
|
2950
|
-
return /* @__PURE__ */
|
|
3493
|
+
return /* @__PURE__ */ jsx6(AggWebSocketConnectionContext.Provider, { value: isConnected, children: /* @__PURE__ */ jsx6(AggWsUserEventContext.Provider, { value: userEventListeners, children: /* @__PURE__ */ jsx6(AggWebSocketContext.Provider, { value: ws, children }) }) });
|
|
2951
3494
|
}
|
|
2952
3495
|
|
|
3496
|
+
// src/core/providers/ui-provider.tsx
|
|
3497
|
+
import { useCallback as useCallback6, useEffect as useEffect3, useMemo as useMemo6, useState as useState3 } from "react";
|
|
3498
|
+
|
|
2953
3499
|
// src/core/ui-config/constants.ts
|
|
2954
3500
|
var DEFAULT_AGG_ROOT_CLASS_NAME = "agg-root";
|
|
2955
3501
|
var CHART_TIME_RANGES = ["1H", "6H", "1D", "1W", "1M", "ALL"];
|
|
2956
3502
|
|
|
3503
|
+
// src/core/ui-config/storage.ts
|
|
3504
|
+
var STORAGE_KEY = "agg_sdk_ui";
|
|
3505
|
+
var isBrowser = () => typeof window !== "undefined" && "localStorage" in window;
|
|
3506
|
+
var normalizeTheme = (value) => {
|
|
3507
|
+
if (value === "light" || value === "dark") {
|
|
3508
|
+
return value;
|
|
3509
|
+
}
|
|
3510
|
+
return void 0;
|
|
3511
|
+
};
|
|
3512
|
+
var normalizeChartTimeRange = (value) => {
|
|
3513
|
+
if (typeof value === "string" && CHART_TIME_RANGES.includes(value)) {
|
|
3514
|
+
return value;
|
|
3515
|
+
}
|
|
3516
|
+
return void 0;
|
|
3517
|
+
};
|
|
3518
|
+
var loadPersistedConfig = () => {
|
|
3519
|
+
var _a, _b, _c;
|
|
3520
|
+
if (!isBrowser()) return {};
|
|
3521
|
+
try {
|
|
3522
|
+
const raw = window.localStorage.getItem(STORAGE_KEY);
|
|
3523
|
+
if (!raw) return {};
|
|
3524
|
+
const parsed = JSON.parse(raw);
|
|
3525
|
+
const locale = typeof ((_a = parsed.general) == null ? void 0 : _a.locale) === "string" ? parsed.general.locale : void 0;
|
|
3526
|
+
const theme = normalizeTheme((_b = parsed.general) == null ? void 0 : _b.theme);
|
|
3527
|
+
const selectedChartTimeRange = normalizeChartTimeRange((_c = parsed.chart) == null ? void 0 : _c.selectedChartTimeRange);
|
|
3528
|
+
const result = {};
|
|
3529
|
+
if (locale || theme) {
|
|
3530
|
+
result.general = { locale, theme };
|
|
3531
|
+
}
|
|
3532
|
+
if (selectedChartTimeRange) {
|
|
3533
|
+
result.chart = { selectedChartTimeRange };
|
|
3534
|
+
}
|
|
3535
|
+
return result;
|
|
3536
|
+
} catch (e) {
|
|
3537
|
+
return {};
|
|
3538
|
+
}
|
|
3539
|
+
};
|
|
3540
|
+
var persistConfig = (config) => {
|
|
3541
|
+
if (!isBrowser()) return;
|
|
3542
|
+
const theme = normalizeTheme(config.theme);
|
|
3543
|
+
const selectedChartTimeRange = normalizeChartTimeRange(config.selectedChartTimeRange);
|
|
3544
|
+
const payload = __spreadValues({
|
|
3545
|
+
general: {
|
|
3546
|
+
locale: config.locale,
|
|
3547
|
+
theme
|
|
3548
|
+
}
|
|
3549
|
+
}, selectedChartTimeRange ? { chart: { selectedChartTimeRange } } : {});
|
|
3550
|
+
try {
|
|
3551
|
+
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(payload));
|
|
3552
|
+
} catch (e) {
|
|
3553
|
+
}
|
|
3554
|
+
};
|
|
3555
|
+
|
|
3556
|
+
// src/core/ui-config/theme-utils.ts
|
|
3557
|
+
var applyThemeToDocument = (theme) => {
|
|
3558
|
+
if (typeof document === "undefined") return;
|
|
3559
|
+
const isDark = theme === "dark";
|
|
3560
|
+
document.documentElement.dataset.aggTheme = theme;
|
|
3561
|
+
document.documentElement.classList.toggle("dark", isDark);
|
|
3562
|
+
document.documentElement.classList.toggle("agg-dark", isDark);
|
|
3563
|
+
document.documentElement.classList.toggle("light", !isDark);
|
|
3564
|
+
const aggRoots = document.querySelectorAll(".agg-root");
|
|
3565
|
+
aggRoots.forEach((rootElement) => {
|
|
3566
|
+
rootElement.dataset.aggTheme = theme;
|
|
3567
|
+
rootElement.classList.toggle("dark", isDark);
|
|
3568
|
+
rootElement.classList.toggle("agg-dark", isDark);
|
|
3569
|
+
rootElement.classList.toggle("light", !isDark);
|
|
3570
|
+
});
|
|
3571
|
+
};
|
|
3572
|
+
|
|
2957
3573
|
// src/core/providers/event-trading-context.tsx
|
|
2958
|
-
import { createContext as createContext4, useCallback as
|
|
2959
|
-
import { jsx as
|
|
3574
|
+
import { createContext as createContext4, useCallback as useCallback5, useContext as useContext6, useMemo as useMemo5, useReducer, useRef as useRef3 } from "react";
|
|
3575
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
2960
3576
|
var OPEN_TRADING_STATE = {
|
|
2961
3577
|
kind: "open",
|
|
2962
3578
|
status: "open" /* open */,
|
|
@@ -3293,7 +3909,7 @@ var initialState = {
|
|
|
3293
3909
|
};
|
|
3294
3910
|
var EventTradingContext = createContext4(void 0);
|
|
3295
3911
|
var useEventTradingContext = () => {
|
|
3296
|
-
return
|
|
3912
|
+
return useContext6(EventTradingContext);
|
|
3297
3913
|
};
|
|
3298
3914
|
var EventTradingProvider = ({
|
|
3299
3915
|
children,
|
|
@@ -3308,7 +3924,7 @@ var EventTradingProvider = ({
|
|
|
3308
3924
|
if (pendingAtomicSelection && ((_a = state.market) == null ? void 0 : _a.id) === pendingAtomicSelection.marketId && ((_b = state.outcome) == null ? void 0 : _b.id) === pendingAtomicSelection.outcomeId) {
|
|
3309
3925
|
pendingAtomicSelectionRef.current = null;
|
|
3310
3926
|
}
|
|
3311
|
-
const dispatch =
|
|
3927
|
+
const dispatch = useCallback5(
|
|
3312
3928
|
(action) => {
|
|
3313
3929
|
const prev = stateRef.current;
|
|
3314
3930
|
rawDispatch(action);
|
|
@@ -3317,19 +3933,19 @@ var EventTradingProvider = ({
|
|
|
3317
3933
|
},
|
|
3318
3934
|
[enableLogs]
|
|
3319
3935
|
);
|
|
3320
|
-
const initializeFromEvent =
|
|
3936
|
+
const initializeFromEvent = useCallback5(
|
|
3321
3937
|
(event) => dispatch({ type: "INITIALIZE_EVENT", event }),
|
|
3322
3938
|
[dispatch]
|
|
3323
3939
|
);
|
|
3324
|
-
const syncEvent =
|
|
3940
|
+
const syncEvent = useCallback5(
|
|
3325
3941
|
(event) => dispatch({ type: "SYNC_EVENT", event }),
|
|
3326
3942
|
[dispatch]
|
|
3327
3943
|
);
|
|
3328
|
-
const selectMarket =
|
|
3944
|
+
const selectMarket = useCallback5(
|
|
3329
3945
|
(marketId, market) => dispatch({ type: "SELECT_MARKET", marketId, market }),
|
|
3330
3946
|
[dispatch]
|
|
3331
3947
|
);
|
|
3332
|
-
const selectOutcome =
|
|
3948
|
+
const selectOutcome = useCallback5(
|
|
3333
3949
|
(outcomeId) => {
|
|
3334
3950
|
var _a2, _b2;
|
|
3335
3951
|
if (((_a2 = stateRef.current.outcome) == null ? void 0 : _a2.id) === outcomeId) return;
|
|
@@ -3338,7 +3954,7 @@ var EventTradingProvider = ({
|
|
|
3338
3954
|
},
|
|
3339
3955
|
[dispatch]
|
|
3340
3956
|
);
|
|
3341
|
-
const selectMarketAndOutcome =
|
|
3957
|
+
const selectMarketAndOutcome = useCallback5(
|
|
3342
3958
|
(marketId, outcomeId) => {
|
|
3343
3959
|
var _a2, _b2, _c, _d;
|
|
3344
3960
|
if (((_a2 = stateRef.current.market) == null ? void 0 : _a2.id) === marketId && ((_b2 = stateRef.current.outcome) == null ? void 0 : _b2.id) === outcomeId) {
|
|
@@ -3352,11 +3968,11 @@ var EventTradingProvider = ({
|
|
|
3352
3968
|
},
|
|
3353
3969
|
[dispatch]
|
|
3354
3970
|
);
|
|
3355
|
-
const setTradeSide =
|
|
3971
|
+
const setTradeSide = useCallback5(
|
|
3356
3972
|
(tradeSide) => dispatch({ type: "SET_TRADE_SIDE", tradeSide }),
|
|
3357
3973
|
[dispatch]
|
|
3358
3974
|
);
|
|
3359
|
-
const value =
|
|
3975
|
+
const value = useMemo5(
|
|
3360
3976
|
() => {
|
|
3361
3977
|
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
|
|
3362
3978
|
return {
|
|
@@ -3386,653 +4002,165 @@ var EventTradingProvider = ({
|
|
|
3386
4002
|
setTradeSide
|
|
3387
4003
|
]
|
|
3388
4004
|
);
|
|
3389
|
-
return /* @__PURE__ */
|
|
4005
|
+
return /* @__PURE__ */ jsx7(EventTradingContext.Provider, { value, children });
|
|
3390
4006
|
};
|
|
3391
4007
|
|
|
3392
4008
|
// src/core/providers/ui-provider.tsx
|
|
3393
|
-
import {
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
if (
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
return value;
|
|
4009
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
4010
|
+
var hasWarnedMissingAggStyles = false;
|
|
4011
|
+
var warnIfAggStylesAreMissing = () => {
|
|
4012
|
+
if (hasWarnedMissingAggStyles) return;
|
|
4013
|
+
if (typeof window === "undefined" || typeof document === "undefined") return;
|
|
4014
|
+
const rootElement = document.querySelector(`.${DEFAULT_AGG_ROOT_CLASS_NAME}`);
|
|
4015
|
+
if (!rootElement) return;
|
|
4016
|
+
const computedStyle = window.getComputedStyle(rootElement);
|
|
4017
|
+
const hasSemanticColorToken = computedStyle.getPropertyValue("--agg-color-primary").trim().length > 0;
|
|
4018
|
+
const hasTailwindColorToken = computedStyle.getPropertyValue("--color-agg-primary").trim().length > 0;
|
|
4019
|
+
const hasTailwindRadiusToken = computedStyle.getPropertyValue("--radius-agg-md").trim().length > 0;
|
|
4020
|
+
if (hasSemanticColorToken && hasTailwindColorToken && hasTailwindRadiusToken) {
|
|
4021
|
+
return;
|
|
3407
4022
|
}
|
|
3408
|
-
|
|
4023
|
+
hasWarnedMissingAggStyles = true;
|
|
4024
|
+
console.warn(
|
|
4025
|
+
'[agg] Missing AGG UI styles. Import "@agg-build/ui/styles.css" once at your app entrypoint so agg token utilities resolve correctly.'
|
|
4026
|
+
);
|
|
3409
4027
|
};
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
result.general = { locale, theme };
|
|
3423
|
-
}
|
|
3424
|
-
if (selectedChartTimeRange) {
|
|
3425
|
-
result.chart = { selectedChartTimeRange };
|
|
3426
|
-
}
|
|
3427
|
-
return result;
|
|
3428
|
-
} catch (e) {
|
|
3429
|
-
return {};
|
|
3430
|
-
}
|
|
3431
|
-
};
|
|
3432
|
-
var persistConfig = (config) => {
|
|
3433
|
-
if (!isBrowser()) return;
|
|
3434
|
-
const theme = normalizeTheme(config.theme);
|
|
3435
|
-
const selectedChartTimeRange = normalizeChartTimeRange(config.selectedChartTimeRange);
|
|
3436
|
-
const payload = __spreadValues({
|
|
3437
|
-
general: {
|
|
3438
|
-
locale: config.locale,
|
|
3439
|
-
theme
|
|
3440
|
-
}
|
|
3441
|
-
}, selectedChartTimeRange ? { chart: { selectedChartTimeRange } } : {});
|
|
3442
|
-
try {
|
|
3443
|
-
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(payload));
|
|
3444
|
-
} catch (e) {
|
|
3445
|
-
}
|
|
3446
|
-
};
|
|
3447
|
-
|
|
3448
|
-
// src/core/ui-config/theme-utils.ts
|
|
3449
|
-
var applyThemeToDocument = (theme) => {
|
|
3450
|
-
if (typeof document === "undefined") return;
|
|
3451
|
-
const isDark = theme === "dark";
|
|
3452
|
-
document.documentElement.dataset.aggTheme = theme;
|
|
3453
|
-
document.documentElement.classList.toggle("dark", isDark);
|
|
3454
|
-
document.documentElement.classList.toggle("agg-dark", isDark);
|
|
3455
|
-
document.documentElement.classList.toggle("light", !isDark);
|
|
3456
|
-
const aggRoots = document.querySelectorAll(".agg-root");
|
|
3457
|
-
aggRoots.forEach((rootElement) => {
|
|
3458
|
-
rootElement.dataset.aggTheme = theme;
|
|
3459
|
-
rootElement.classList.toggle("dark", isDark);
|
|
3460
|
-
rootElement.classList.toggle("agg-dark", isDark);
|
|
3461
|
-
rootElement.classList.toggle("light", !isDark);
|
|
3462
|
-
});
|
|
3463
|
-
};
|
|
3464
|
-
|
|
3465
|
-
// src/core/providers/ui-provider.tsx
|
|
3466
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
3467
|
-
var hasWarnedMissingAggStyles = false;
|
|
3468
|
-
var warnIfAggStylesAreMissing = () => {
|
|
3469
|
-
if (hasWarnedMissingAggStyles) return;
|
|
3470
|
-
if (typeof window === "undefined" || typeof document === "undefined") return;
|
|
3471
|
-
const rootElement = document.querySelector(`.${DEFAULT_AGG_ROOT_CLASS_NAME}`);
|
|
3472
|
-
if (!rootElement) return;
|
|
3473
|
-
const computedStyle = window.getComputedStyle(rootElement);
|
|
3474
|
-
const hasSemanticColorToken = computedStyle.getPropertyValue("--agg-color-primary").trim().length > 0;
|
|
3475
|
-
const hasTailwindColorToken = computedStyle.getPropertyValue("--color-agg-primary").trim().length > 0;
|
|
3476
|
-
const hasTailwindRadiusToken = computedStyle.getPropertyValue("--radius-agg-md").trim().length > 0;
|
|
3477
|
-
if (hasSemanticColorToken && hasTailwindColorToken && hasTailwindRadiusToken) {
|
|
3478
|
-
return;
|
|
3479
|
-
}
|
|
3480
|
-
hasWarnedMissingAggStyles = true;
|
|
3481
|
-
console.warn(
|
|
3482
|
-
'[agg] Missing AGG UI styles. Import "@agg-build/ui/styles.css" once at your app entrypoint so agg token utilities resolve correctly.'
|
|
3483
|
-
);
|
|
3484
|
-
};
|
|
3485
|
-
function logConfig(config, enableLogs) {
|
|
3486
|
-
if (!enableLogs) return;
|
|
3487
|
-
console.group(`[AggUiProvider]`);
|
|
3488
|
-
console.log("config", config);
|
|
3489
|
-
console.groupEnd();
|
|
3490
|
-
}
|
|
3491
|
-
var getSearchStateAfterSelect = (selectedEvent) => {
|
|
3492
|
-
return {
|
|
3493
|
-
value: "",
|
|
3494
|
-
result: selectedEvent,
|
|
3495
|
-
isShowingAllResults: false
|
|
3496
|
-
};
|
|
4028
|
+
function logConfig(config, enableLogs) {
|
|
4029
|
+
if (!enableLogs) return;
|
|
4030
|
+
console.group(`[AggUiProvider]`);
|
|
4031
|
+
console.log("config", config);
|
|
4032
|
+
console.groupEnd();
|
|
4033
|
+
}
|
|
4034
|
+
var getSearchStateAfterSelect = (selectedEvent) => {
|
|
4035
|
+
return {
|
|
4036
|
+
value: "",
|
|
4037
|
+
result: selectedEvent,
|
|
4038
|
+
isShowingAllResults: false
|
|
4039
|
+
};
|
|
3497
4040
|
};
|
|
3498
4041
|
var AggUiProvider = ({ config, children }) => {
|
|
3499
|
-
const persisted =
|
|
3500
|
-
const mergedConfig =
|
|
3501
|
-
const [selectedChartTimeRange, setSelectedChartTimeRange] =
|
|
4042
|
+
const persisted = useMemo6(() => loadPersistedConfig(), []);
|
|
4043
|
+
const mergedConfig = useMemo6(() => mergeAggUiConfig(persisted, config), [persisted, config]);
|
|
4044
|
+
const [selectedChartTimeRange, setSelectedChartTimeRange] = useState3(
|
|
3502
4045
|
mergedConfig.chart.selectedChartTimeRange
|
|
3503
4046
|
);
|
|
3504
|
-
const handleSetSelectedChartTimeRange =
|
|
3505
|
-
setSelectedChartTimeRange(range);
|
|
3506
|
-
}, []);
|
|
3507
|
-
const [searchValue, setSearchValue] =
|
|
3508
|
-
const [searchResult, setSearchResult] =
|
|
3509
|
-
const [isShowingAllResults, setIsShowingAllResults] =
|
|
3510
|
-
mergedConfig.search.isShowingAllResults
|
|
3511
|
-
);
|
|
3512
|
-
useEffect2(() => {
|
|
3513
|
-
setSearchValue(mergedConfig.search.value);
|
|
3514
|
-
}, [mergedConfig.search.value]);
|
|
3515
|
-
useEffect2(() => {
|
|
3516
|
-
setSearchResult(mergedConfig.search.result);
|
|
3517
|
-
}, [mergedConfig.search.result]);
|
|
3518
|
-
useEffect2(() => {
|
|
3519
|
-
setIsShowingAllResults(mergedConfig.search.isShowingAllResults);
|
|
3520
|
-
}, [mergedConfig.search.isShowingAllResults]);
|
|
3521
|
-
const handleSearchChange = useCallback5(
|
|
3522
|
-
(value) => {
|
|
3523
|
-
var _a, _b;
|
|
3524
|
-
setSearchValue(value);
|
|
3525
|
-
setSearchResult(null);
|
|
3526
|
-
setIsShowingAllResults(false);
|
|
3527
|
-
(_b = (_a = mergedConfig.search).onChange) == null ? void 0 : _b.call(_a, value);
|
|
3528
|
-
},
|
|
3529
|
-
[mergedConfig.search]
|
|
3530
|
-
);
|
|
3531
|
-
const handleSearchSelect = useCallback5(
|
|
3532
|
-
(value) => {
|
|
3533
|
-
var _a, _b;
|
|
3534
|
-
const nextSearchState = getSearchStateAfterSelect(value);
|
|
3535
|
-
setSearchValue(nextSearchState.value);
|
|
3536
|
-
setSearchResult(nextSearchState.result);
|
|
3537
|
-
setIsShowingAllResults(nextSearchState.isShowingAllResults);
|
|
3538
|
-
(_b = (_a = mergedConfig.search).onSelect) == null ? void 0 : _b.call(_a, value);
|
|
3539
|
-
},
|
|
3540
|
-
[mergedConfig.search]
|
|
3541
|
-
);
|
|
3542
|
-
const handleOpenResults = useCallback5(() => {
|
|
3543
|
-
var _a, _b;
|
|
3544
|
-
setIsShowingAllResults(true);
|
|
3545
|
-
(_b = (_a = mergedConfig.search).openResults) == null ? void 0 : _b.call(_a);
|
|
3546
|
-
}, [mergedConfig.search]);
|
|
3547
|
-
const handleCloseResults = useCallback5(() => {
|
|
3548
|
-
var _a, _b;
|
|
3549
|
-
setIsShowingAllResults(false);
|
|
3550
|
-
(_b = (_a = mergedConfig.search).closeResults) == null ? void 0 : _b.call(_a);
|
|
3551
|
-
}, [mergedConfig.search]);
|
|
3552
|
-
const resolvedConfig = useMemo4(() => {
|
|
3553
|
-
return __spreadProps(__spreadValues({}, mergedConfig), {
|
|
3554
|
-
chart: __spreadProps(__spreadValues({}, mergedConfig.chart), {
|
|
3555
|
-
selectedChartTimeRange,
|
|
3556
|
-
setSelectedChartTimeRange: handleSetSelectedChartTimeRange
|
|
3557
|
-
}),
|
|
3558
|
-
search: __spreadProps(__spreadValues({}, mergedConfig.search), {
|
|
3559
|
-
value: searchValue,
|
|
3560
|
-
onChange: handleSearchChange,
|
|
3561
|
-
onSelect: handleSearchSelect,
|
|
3562
|
-
openResults: handleOpenResults,
|
|
3563
|
-
closeResults: handleCloseResults,
|
|
3564
|
-
result: searchResult,
|
|
3565
|
-
isShowingAllResults
|
|
3566
|
-
})
|
|
3567
|
-
});
|
|
3568
|
-
}, [
|
|
3569
|
-
handleCloseResults,
|
|
3570
|
-
handleOpenResults,
|
|
3571
|
-
handleSearchChange,
|
|
3572
|
-
handleSearchSelect,
|
|
3573
|
-
handleSetSelectedChartTimeRange,
|
|
3574
|
-
isShowingAllResults,
|
|
3575
|
-
mergedConfig,
|
|
3576
|
-
searchResult,
|
|
3577
|
-
searchValue,
|
|
3578
|
-
selectedChartTimeRange
|
|
3579
|
-
]);
|
|
3580
|
-
useEffect2(() => {
|
|
3581
|
-
persistConfig({
|
|
3582
|
-
locale: resolvedConfig.general.locale,
|
|
3583
|
-
theme: resolvedConfig.general.theme,
|
|
3584
|
-
selectedChartTimeRange: resolvedConfig.chart.selectedChartTimeRange
|
|
3585
|
-
});
|
|
3586
|
-
}, [
|
|
3587
|
-
resolvedConfig.general.locale,
|
|
3588
|
-
resolvedConfig.general.theme,
|
|
3589
|
-
resolvedConfig.chart.selectedChartTimeRange
|
|
3590
|
-
]);
|
|
3591
|
-
useEffect2(() => {
|
|
3592
|
-
applyThemeToDocument(resolvedConfig.general.theme);
|
|
3593
|
-
}, [resolvedConfig.general.theme]);
|
|
3594
|
-
useEffect2(() => {
|
|
3595
|
-
warnIfAggStylesAreMissing();
|
|
3596
|
-
}, []);
|
|
3597
|
-
const resolvedRootClassName = [
|
|
3598
|
-
DEFAULT_AGG_ROOT_CLASS_NAME,
|
|
3599
|
-
resolvedConfig.general.theme === "dark" ? "dark" : null,
|
|
3600
|
-
resolvedConfig.general.rootClassName
|
|
3601
|
-
].filter(Boolean).join(" ");
|
|
3602
|
-
logConfig(resolvedConfig, resolvedConfig.enableLogs);
|
|
3603
|
-
return /* @__PURE__ */ jsx5(AggLabelsContext.Provider, { value: resolvedConfig.general.labels, children: /* @__PURE__ */ jsx5(AggUiContext.Provider, { value: resolvedConfig, children: /* @__PURE__ */ jsx5(EventTradingProvider, { enableLogs: resolvedConfig.enableLogs, children: /* @__PURE__ */ jsx5(
|
|
3604
|
-
"div",
|
|
3605
|
-
{
|
|
3606
|
-
className: resolvedRootClassName,
|
|
3607
|
-
"data-agg-animations": resolvedConfig.features.enableAnimations ? "true" : "false",
|
|
3608
|
-
"data-agg-gradients": resolvedConfig.features.enableGradients ? "true" : "false",
|
|
3609
|
-
"data-agg-theme": resolvedConfig.general.theme,
|
|
3610
|
-
children
|
|
3611
|
-
}
|
|
3612
|
-
) }) }) });
|
|
3613
|
-
};
|
|
3614
|
-
|
|
3615
|
-
// src/core/providers/agg-provider.tsx
|
|
3616
|
-
import { useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
3617
|
-
|
|
3618
|
-
// src/core/providers/auth-provider.tsx
|
|
3619
|
-
import { QueryClient, QueryClientContext } from "@tanstack/react-query";
|
|
3620
|
-
import { useCallback as useCallback6, useContext as useContext6, useEffect as useEffect3, useMemo as useMemo5, useState as useState3 } from "react";
|
|
3621
|
-
|
|
3622
|
-
// src/current-user-query.ts
|
|
3623
|
-
var CURRENT_USER_QUERY_KEY = ["current-user"];
|
|
3624
|
-
var CURRENT_USER_STALE_TIME_MS = 6e4;
|
|
3625
|
-
var fetchCurrentUserProfile = (queryClient, client, queryKey = CURRENT_USER_QUERY_KEY) => {
|
|
3626
|
-
return queryClient.fetchQuery({
|
|
3627
|
-
queryKey,
|
|
3628
|
-
queryFn: () => client.getCurrentUser(),
|
|
3629
|
-
staleTime: CURRENT_USER_STALE_TIME_MS
|
|
3630
|
-
});
|
|
3631
|
-
};
|
|
3632
|
-
|
|
3633
|
-
// src/core/providers/auth-utils.ts
|
|
3634
|
-
import { TurnstileChallengeError } from "@agg-build/sdk";
|
|
3635
|
-
var createPlaceholderUserProfile = (input) => {
|
|
3636
|
-
return {
|
|
3637
|
-
id: input.id,
|
|
3638
|
-
username: null,
|
|
3639
|
-
avatarUrl: null,
|
|
3640
|
-
externalId: null,
|
|
3641
|
-
isLocationBlocked: false,
|
|
3642
|
-
venueAccounts: null,
|
|
3643
|
-
accounts: [],
|
|
3644
|
-
wallets: []
|
|
3645
|
-
};
|
|
3646
|
-
};
|
|
3647
|
-
var createWalletSessionUser = (input) => {
|
|
3648
|
-
return __spreadProps(__spreadValues({}, createPlaceholderUserProfile({ id: input.id })), {
|
|
3649
|
-
accounts: [
|
|
3650
|
-
{
|
|
3651
|
-
type: "siwe" /* siwe */,
|
|
3652
|
-
provider: "wallet" /* wallet */,
|
|
3653
|
-
providerAccountId: input.address
|
|
3654
|
-
}
|
|
3655
|
-
]
|
|
3656
|
-
});
|
|
3657
|
-
};
|
|
3658
|
-
var getBrowserAuthLocation = () => {
|
|
3659
|
-
if (typeof window === "undefined") {
|
|
3660
|
-
return {
|
|
3661
|
-
domain: "localhost",
|
|
3662
|
-
uri: "http://localhost"
|
|
3663
|
-
};
|
|
3664
|
-
}
|
|
3665
|
-
return {
|
|
3666
|
-
domain: window.location.host,
|
|
3667
|
-
uri: window.location.origin
|
|
3668
|
-
};
|
|
3669
|
-
};
|
|
3670
|
-
var resolveAuthCallbackUrl = (callbackUrl) => {
|
|
3671
|
-
return callbackUrl instanceof URL ? callbackUrl : typeof callbackUrl === "string" ? new URL(
|
|
3672
|
-
callbackUrl,
|
|
3673
|
-
typeof window === "undefined" ? "http://localhost" : window.location.origin
|
|
3674
|
-
) : typeof window === "undefined" ? null : new URL(window.location.href);
|
|
3675
|
-
};
|
|
3676
|
-
var parseAuthCallbackCode = (callbackUrl) => {
|
|
3677
|
-
var _a;
|
|
3678
|
-
const resolvedUrl = resolveAuthCallbackUrl(callbackUrl);
|
|
3679
|
-
return (_a = resolvedUrl == null ? void 0 : resolvedUrl.searchParams.get("code")) != null ? _a : null;
|
|
3680
|
-
};
|
|
3681
|
-
var parseLinkConfirmToken = (callbackUrl) => {
|
|
3682
|
-
var _a;
|
|
3683
|
-
const resolvedUrl = resolveAuthCallbackUrl(callbackUrl);
|
|
3684
|
-
return (_a = resolvedUrl == null ? void 0 : resolvedUrl.searchParams.get("link_confirm_token")) != null ? _a : null;
|
|
3685
|
-
};
|
|
3686
|
-
var getAuthCallbackCleanupPath = (callbackUrl) => {
|
|
3687
|
-
const resolvedUrl = resolveAuthCallbackUrl(callbackUrl);
|
|
3688
|
-
if (!resolvedUrl) return null;
|
|
3689
|
-
const params = new URLSearchParams(resolvedUrl.search);
|
|
3690
|
-
params.delete("code");
|
|
3691
|
-
params.delete("link_confirm_token");
|
|
3692
|
-
const search = params.toString();
|
|
3693
|
-
return `${resolvedUrl.pathname}${search ? `?${search}` : ""}`;
|
|
3694
|
-
};
|
|
3695
|
-
var exchangeAuthCallbackCode = (client, callbackUrl) => __async(null, null, function* () {
|
|
3696
|
-
const code = parseAuthCallbackCode(callbackUrl);
|
|
3697
|
-
if (!code) return null;
|
|
3698
|
-
const result = yield client.exchangeAuthCode(code);
|
|
3699
|
-
return {
|
|
3700
|
-
cleanupPath: getAuthCallbackCleanupPath(callbackUrl),
|
|
3701
|
-
user: result.user
|
|
3702
|
-
};
|
|
3703
|
-
});
|
|
3704
|
-
var confirmLinkAccountCallback = (client, callbackUrl) => __async(null, null, function* () {
|
|
3705
|
-
const token = parseLinkConfirmToken(callbackUrl);
|
|
3706
|
-
if (!token) return null;
|
|
3707
|
-
yield client.linkAccountConfirm(token);
|
|
3708
|
-
return { cleanupPath: getAuthCallbackCleanupPath(callbackUrl) };
|
|
3709
|
-
});
|
|
3710
|
-
var parseAuthCallbackTokens = (callbackUrl) => {
|
|
3711
|
-
var _a, _b;
|
|
3712
|
-
const resolvedUrl = resolveAuthCallbackUrl(callbackUrl);
|
|
3713
|
-
if (!resolvedUrl) return null;
|
|
3714
|
-
const hash = resolvedUrl.hash.startsWith("#") ? resolvedUrl.hash.slice(1) : resolvedUrl.hash;
|
|
3715
|
-
if (!hash) return null;
|
|
3716
|
-
const params = new URLSearchParams(hash);
|
|
3717
|
-
const accessToken = params.get("access_token");
|
|
3718
|
-
const refreshToken = params.get("refresh_token");
|
|
3719
|
-
if (!accessToken || !refreshToken) return null;
|
|
3720
|
-
const userId = (_a = params.get("user_id")) != null ? _a : void 0;
|
|
3721
|
-
const tokenType = (_b = params.get("token_type")) != null ? _b : void 0;
|
|
3722
|
-
return {
|
|
3723
|
-
accessToken,
|
|
3724
|
-
refreshToken,
|
|
3725
|
-
tokenType,
|
|
3726
|
-
userId
|
|
3727
|
-
};
|
|
3728
|
-
};
|
|
3729
|
-
var createAuthCallbackSession = (tokens) => {
|
|
3730
|
-
return {
|
|
3731
|
-
accessToken: tokens.accessToken,
|
|
3732
|
-
refreshToken: tokens.refreshToken,
|
|
3733
|
-
user: tokens.userId ? createPlaceholderUserProfile({ id: tokens.userId }) : void 0
|
|
3734
|
-
};
|
|
3735
|
-
};
|
|
3736
|
-
var executeWalletAuthFlow = (input) => __async(null, null, function* () {
|
|
3737
|
-
var _a, _b, _c, _d;
|
|
3738
|
-
const address = input.options.address.trim();
|
|
3739
|
-
const chain = (_a = input.options.chain) != null ? _a : "ethereum";
|
|
3740
|
-
const provider = chain === "solana" ? "siws" : "siwe";
|
|
3741
|
-
const location = (_b = input.location) != null ? _b : getBrowserAuthLocation();
|
|
3742
|
-
const startResult = yield input.client.authStart(__spreadValues({
|
|
3743
|
-
provider
|
|
3744
|
-
}, input.options.turnstileToken ? { turnstileToken: input.options.turnstileToken } : {}));
|
|
3745
|
-
if (startResult.type === "challenge_required") {
|
|
3746
|
-
if (!startResult.siteKey) {
|
|
3747
|
-
throw new Error("Server returned challenge_required but no siteKey was provided.");
|
|
3748
|
-
}
|
|
3749
|
-
throw new TurnstileChallengeError(startResult.siteKey);
|
|
3750
|
-
}
|
|
3751
|
-
if (startResult.type !== "nonce") {
|
|
3752
|
-
throw new Error(`AGG auth start returned an unexpected "${startResult.type}" response`);
|
|
3753
|
-
}
|
|
3754
|
-
const message = chain === "solana" ? input.client.buildSiwsMessage({
|
|
3755
|
-
domain: location.domain,
|
|
3756
|
-
address,
|
|
3757
|
-
uri: location.uri,
|
|
3758
|
-
nonce: startResult.nonce,
|
|
3759
|
-
chainId: typeof input.options.chainId === "string" ? input.options.chainId : "mainnet",
|
|
3760
|
-
statement: (_c = startResult.statement) != null ? _c : input.options.statement
|
|
3761
|
-
}) : input.client.buildSiweMessage({
|
|
3762
|
-
domain: location.domain,
|
|
3763
|
-
// Any casing: `buildSiweMessage` applies the EIP-55 checksum itself.
|
|
3764
|
-
address,
|
|
3765
|
-
uri: location.uri,
|
|
3766
|
-
nonce: startResult.nonce,
|
|
3767
|
-
chainId: typeof input.options.chainId === "number" ? input.options.chainId : void 0,
|
|
3768
|
-
statement: (_d = startResult.statement) != null ? _d : input.options.statement
|
|
3769
|
-
});
|
|
3770
|
-
const signature = yield input.options.signMessage(message);
|
|
3771
|
-
const result = yield input.client.verify({ message, signature });
|
|
3772
|
-
return {
|
|
3773
|
-
accessToken: result.accessToken,
|
|
3774
|
-
refreshToken: result.refreshToken,
|
|
3775
|
-
user: createWalletSessionUser({
|
|
3776
|
-
id: result.user.id,
|
|
3777
|
-
address
|
|
3778
|
-
})
|
|
3779
|
-
};
|
|
3780
|
-
});
|
|
3781
|
-
|
|
3782
|
-
// src/core/providers/auth-provider.tsx
|
|
3783
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
3784
|
-
var getClientAuthSnapshot = (client) => {
|
|
3785
|
-
var _a;
|
|
3786
|
-
return {
|
|
3787
|
-
isAuthenticated: (_a = client == null ? void 0 : client.isAuthenticated) != null ? _a : false,
|
|
3788
|
-
user: client == null ? void 0 : client.user
|
|
3789
|
-
};
|
|
3790
|
-
};
|
|
3791
|
-
var toError = (value) => {
|
|
3792
|
-
return value instanceof Error ? value : new Error(String(value));
|
|
3793
|
-
};
|
|
3794
|
-
var replaceAuthCallbackUrl = (cleanupPath) => {
|
|
3795
|
-
if (!cleanupPath || typeof window === "undefined") return;
|
|
3796
|
-
window.history.replaceState(null, "", cleanupPath);
|
|
3797
|
-
};
|
|
3798
|
-
function AggAuthProvider({ children }) {
|
|
3799
|
-
const client = useContext6(AggClientContext);
|
|
3800
|
-
const queryClientFromContext = useContext6(QueryClientContext);
|
|
3801
|
-
const fallbackQueryClient = useMemo5(() => new QueryClient(), []);
|
|
3802
|
-
const queryClient = queryClientFromContext && "fetchQuery" in queryClientFromContext ? queryClientFromContext : fallbackQueryClient;
|
|
3803
|
-
const snapshot = getClientAuthSnapshot(client);
|
|
3804
|
-
const [isAuthenticated, setIsAuthenticated] = useState3(snapshot.isAuthenticated);
|
|
3805
|
-
const [user, setUser] = useState3(snapshot.user);
|
|
3806
|
-
const [isLoading, setIsLoading] = useState3(false);
|
|
3807
|
-
const [error, setError] = useState3(null);
|
|
3808
|
-
const isWeb3User = useMemo5(() => {
|
|
3809
|
-
const accounts = user == null ? void 0 : user.accounts;
|
|
3810
|
-
if (!Array.isArray(accounts)) return true;
|
|
3811
|
-
return accounts.some((account) => {
|
|
3812
|
-
var _a;
|
|
3813
|
-
const provider = String((_a = account.provider) != null ? _a : "").toLowerCase();
|
|
3814
|
-
return provider === "wallet" || provider === "solana_wallet";
|
|
3815
|
-
});
|
|
3816
|
-
}, [user]);
|
|
3817
|
-
const refreshCurrentUser = useCallback6(
|
|
3818
|
-
(targetClient) => __async(null, null, function* () {
|
|
3819
|
-
const fullUser = yield fetchCurrentUserProfile(queryClient, targetClient);
|
|
3820
|
-
setIsAuthenticated(true);
|
|
3821
|
-
setUser(fullUser);
|
|
3822
|
-
return fullUser;
|
|
3823
|
-
}),
|
|
3824
|
-
[queryClient]
|
|
3825
|
-
);
|
|
3826
|
-
useEffect3(() => {
|
|
3827
|
-
const state = getClientAuthSnapshot(client);
|
|
3828
|
-
setIsAuthenticated(state.isAuthenticated);
|
|
3829
|
-
setUser(state.user);
|
|
3830
|
-
setIsLoading(false);
|
|
3831
|
-
setError(null);
|
|
3832
|
-
if (!client) return;
|
|
3833
|
-
if (state.isAuthenticated) {
|
|
3834
|
-
refreshCurrentUser(client).catch(() => {
|
|
3835
|
-
client.clearAccessToken();
|
|
3836
|
-
});
|
|
3837
|
-
} else if (client.authStatus === "unknown") {
|
|
3838
|
-
client.refreshAccessToken().then(() => refreshCurrentUser(client)).catch(() => {
|
|
3839
|
-
client.clearAccessToken();
|
|
3840
|
-
});
|
|
3841
|
-
}
|
|
3842
|
-
}, [client, refreshCurrentUser]);
|
|
3843
|
-
useEffect3(() => {
|
|
3844
|
-
if (!client) return;
|
|
3845
|
-
return client.onAuthStateChange((authenticated) => {
|
|
3846
|
-
setIsAuthenticated(authenticated);
|
|
3847
|
-
setUser(client.user);
|
|
3848
|
-
if (!authenticated) {
|
|
3849
|
-
setIsLoading(false);
|
|
3850
|
-
setError(null);
|
|
3851
|
-
}
|
|
3852
|
-
});
|
|
3853
|
-
}, [client]);
|
|
3854
|
-
const signIn = useCallback6(
|
|
3855
|
-
(options) => __async(null, null, function* () {
|
|
3856
|
-
if (!client) {
|
|
3857
|
-
const missingClientError = new Error("Agg client is not configured in <AggProvider>");
|
|
3858
|
-
setError(missingClientError);
|
|
3859
|
-
throw missingClientError;
|
|
3860
|
-
}
|
|
3861
|
-
const address = options.address.trim();
|
|
3862
|
-
if (!address) {
|
|
3863
|
-
const missingAddressError = new Error("Wallet address is required");
|
|
3864
|
-
setError(missingAddressError);
|
|
3865
|
-
throw missingAddressError;
|
|
3866
|
-
}
|
|
3867
|
-
setIsLoading(true);
|
|
3868
|
-
setError(null);
|
|
3869
|
-
try {
|
|
3870
|
-
const result = yield executeWalletAuthFlow({
|
|
3871
|
-
client,
|
|
3872
|
-
options: __spreadProps(__spreadValues({}, options), {
|
|
3873
|
-
address
|
|
3874
|
-
})
|
|
3875
|
-
});
|
|
3876
|
-
client.setSession(result);
|
|
3877
|
-
setIsAuthenticated(true);
|
|
3878
|
-
setUser(result.user);
|
|
3879
|
-
yield refreshCurrentUser(client);
|
|
3880
|
-
} catch (signInError) {
|
|
3881
|
-
const resolvedError = toError(signInError);
|
|
3882
|
-
setError(resolvedError);
|
|
3883
|
-
throw resolvedError;
|
|
3884
|
-
} finally {
|
|
3885
|
-
setIsLoading(false);
|
|
3886
|
-
}
|
|
3887
|
-
}),
|
|
3888
|
-
[client, refreshCurrentUser]
|
|
3889
|
-
);
|
|
3890
|
-
const startAuth = useCallback6(
|
|
3891
|
-
(options) => __async(null, null, function* () {
|
|
3892
|
-
if (!client) {
|
|
3893
|
-
const missingClientError = new Error("Agg client is not configured in <AggProvider>");
|
|
3894
|
-
setError(missingClientError);
|
|
3895
|
-
throw missingClientError;
|
|
3896
|
-
}
|
|
3897
|
-
setIsLoading(true);
|
|
3898
|
-
setError(null);
|
|
3899
|
-
try {
|
|
3900
|
-
return yield client.authStart(options);
|
|
3901
|
-
} catch (startAuthError) {
|
|
3902
|
-
const resolvedError = toError(startAuthError);
|
|
3903
|
-
setError(resolvedError);
|
|
3904
|
-
throw resolvedError;
|
|
3905
|
-
} finally {
|
|
3906
|
-
setIsLoading(false);
|
|
3907
|
-
}
|
|
3908
|
-
}),
|
|
3909
|
-
[client]
|
|
4047
|
+
const handleSetSelectedChartTimeRange = useCallback6((range) => {
|
|
4048
|
+
setSelectedChartTimeRange(range);
|
|
4049
|
+
}, []);
|
|
4050
|
+
const [searchValue, setSearchValue] = useState3(mergedConfig.search.value);
|
|
4051
|
+
const [searchResult, setSearchResult] = useState3(mergedConfig.search.result);
|
|
4052
|
+
const [isShowingAllResults, setIsShowingAllResults] = useState3(
|
|
4053
|
+
mergedConfig.search.isShowingAllResults
|
|
3910
4054
|
);
|
|
3911
|
-
|
|
3912
|
-
(
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
setUser(void 0);
|
|
3930
|
-
const resolvedError = toError(sessionError);
|
|
3931
|
-
setError(resolvedError);
|
|
3932
|
-
throw resolvedError;
|
|
3933
|
-
} finally {
|
|
3934
|
-
setIsLoading(false);
|
|
3935
|
-
}
|
|
3936
|
-
}),
|
|
3937
|
-
[client, refreshCurrentUser]
|
|
4055
|
+
useEffect3(() => {
|
|
4056
|
+
setSearchValue(mergedConfig.search.value);
|
|
4057
|
+
}, [mergedConfig.search.value]);
|
|
4058
|
+
useEffect3(() => {
|
|
4059
|
+
setSearchResult(mergedConfig.search.result);
|
|
4060
|
+
}, [mergedConfig.search.result]);
|
|
4061
|
+
useEffect3(() => {
|
|
4062
|
+
setIsShowingAllResults(mergedConfig.search.isShowingAllResults);
|
|
4063
|
+
}, [mergedConfig.search.isShowingAllResults]);
|
|
4064
|
+
const handleSearchChange = useCallback6(
|
|
4065
|
+
(value) => {
|
|
4066
|
+
var _a, _b;
|
|
4067
|
+
setSearchValue(value);
|
|
4068
|
+
setSearchResult(null);
|
|
4069
|
+
setIsShowingAllResults(false);
|
|
4070
|
+
(_b = (_a = mergedConfig.search).onChange) == null ? void 0 : _b.call(_a, value);
|
|
4071
|
+
},
|
|
4072
|
+
[mergedConfig.search]
|
|
3938
4073
|
);
|
|
3939
|
-
const
|
|
3940
|
-
(
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
const exchangedSession = yield exchangeAuthCallbackCode(client, callbackUrl);
|
|
3950
|
-
if (exchangedSession) {
|
|
3951
|
-
const resolvedUser2 = yield refreshCurrentUser(client);
|
|
3952
|
-
if (callbackUrl === void 0) {
|
|
3953
|
-
replaceAuthCallbackUrl(exchangedSession.cleanupPath);
|
|
3954
|
-
}
|
|
3955
|
-
return resolvedUser2;
|
|
3956
|
-
}
|
|
3957
|
-
const confirmedLink = yield confirmLinkAccountCallback(client, callbackUrl);
|
|
3958
|
-
if (confirmedLink) {
|
|
3959
|
-
const resolvedUser2 = yield refreshCurrentUser(client);
|
|
3960
|
-
if (callbackUrl === void 0) {
|
|
3961
|
-
replaceAuthCallbackUrl(confirmedLink.cleanupPath);
|
|
3962
|
-
}
|
|
3963
|
-
return resolvedUser2;
|
|
3964
|
-
}
|
|
3965
|
-
const tokens = parseAuthCallbackTokens(callbackUrl);
|
|
3966
|
-
if (!tokens) return null;
|
|
3967
|
-
client.setSession(createAuthCallbackSession(tokens));
|
|
3968
|
-
setIsAuthenticated(client.isAuthenticated);
|
|
3969
|
-
setUser(client.user);
|
|
3970
|
-
const resolvedUser = yield refreshCurrentUser(client);
|
|
3971
|
-
if (callbackUrl === void 0) {
|
|
3972
|
-
replaceAuthCallbackUrl(getAuthCallbackCleanupPath(callbackUrl));
|
|
3973
|
-
}
|
|
3974
|
-
return resolvedUser;
|
|
3975
|
-
} catch (callbackError) {
|
|
3976
|
-
const resolvedError = toError(callbackError);
|
|
3977
|
-
setError(resolvedError);
|
|
3978
|
-
throw resolvedError;
|
|
3979
|
-
} finally {
|
|
3980
|
-
setIsLoading(false);
|
|
3981
|
-
}
|
|
3982
|
-
}),
|
|
3983
|
-
[client, refreshCurrentUser]
|
|
4074
|
+
const handleSearchSelect = useCallback6(
|
|
4075
|
+
(value) => {
|
|
4076
|
+
var _a, _b;
|
|
4077
|
+
const nextSearchState = getSearchStateAfterSelect(value);
|
|
4078
|
+
setSearchValue(nextSearchState.value);
|
|
4079
|
+
setSearchResult(nextSearchState.result);
|
|
4080
|
+
setIsShowingAllResults(nextSearchState.isShowingAllResults);
|
|
4081
|
+
(_b = (_a = mergedConfig.search).onSelect) == null ? void 0 : _b.call(_a, value);
|
|
4082
|
+
},
|
|
4083
|
+
[mergedConfig.search]
|
|
3984
4084
|
);
|
|
3985
|
-
const
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4085
|
+
const handleOpenResults = useCallback6(() => {
|
|
4086
|
+
var _a, _b;
|
|
4087
|
+
setIsShowingAllResults(true);
|
|
4088
|
+
(_b = (_a = mergedConfig.search).openResults) == null ? void 0 : _b.call(_a);
|
|
4089
|
+
}, [mergedConfig.search]);
|
|
4090
|
+
const handleCloseResults = useCallback6(() => {
|
|
4091
|
+
var _a, _b;
|
|
4092
|
+
setIsShowingAllResults(false);
|
|
4093
|
+
(_b = (_a = mergedConfig.search).closeResults) == null ? void 0 : _b.call(_a);
|
|
4094
|
+
}, [mergedConfig.search]);
|
|
4095
|
+
const resolvedConfig = useMemo6(() => {
|
|
4096
|
+
return __spreadProps(__spreadValues({}, mergedConfig), {
|
|
4097
|
+
chart: __spreadProps(__spreadValues({}, mergedConfig.chart), {
|
|
4098
|
+
selectedChartTimeRange,
|
|
4099
|
+
setSelectedChartTimeRange: handleSetSelectedChartTimeRange
|
|
4100
|
+
}),
|
|
4101
|
+
search: __spreadProps(__spreadValues({}, mergedConfig.search), {
|
|
4102
|
+
value: searchValue,
|
|
4103
|
+
onChange: handleSearchChange,
|
|
4104
|
+
onSelect: handleSearchSelect,
|
|
4105
|
+
openResults: handleOpenResults,
|
|
4106
|
+
closeResults: handleCloseResults,
|
|
4107
|
+
result: searchResult,
|
|
4108
|
+
isShowingAllResults
|
|
4109
|
+
})
|
|
4110
|
+
});
|
|
4008
4111
|
}, [
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
user
|
|
4112
|
+
handleCloseResults,
|
|
4113
|
+
handleOpenResults,
|
|
4114
|
+
handleSearchChange,
|
|
4115
|
+
handleSearchSelect,
|
|
4116
|
+
handleSetSelectedChartTimeRange,
|
|
4117
|
+
isShowingAllResults,
|
|
4118
|
+
mergedConfig,
|
|
4119
|
+
searchResult,
|
|
4120
|
+
searchValue,
|
|
4121
|
+
selectedChartTimeRange
|
|
4020
4122
|
]);
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4123
|
+
useEffect3(() => {
|
|
4124
|
+
persistConfig({
|
|
4125
|
+
locale: resolvedConfig.general.locale,
|
|
4126
|
+
theme: resolvedConfig.general.theme,
|
|
4127
|
+
selectedChartTimeRange: resolvedConfig.chart.selectedChartTimeRange
|
|
4128
|
+
});
|
|
4129
|
+
}, [
|
|
4130
|
+
resolvedConfig.general.locale,
|
|
4131
|
+
resolvedConfig.general.theme,
|
|
4132
|
+
resolvedConfig.chart.selectedChartTimeRange
|
|
4133
|
+
]);
|
|
4134
|
+
useEffect3(() => {
|
|
4135
|
+
applyThemeToDocument(resolvedConfig.general.theme);
|
|
4136
|
+
}, [resolvedConfig.general.theme]);
|
|
4137
|
+
useEffect3(() => {
|
|
4138
|
+
warnIfAggStylesAreMissing();
|
|
4139
|
+
}, []);
|
|
4140
|
+
const resolvedRootClassName = [
|
|
4141
|
+
DEFAULT_AGG_ROOT_CLASS_NAME,
|
|
4142
|
+
resolvedConfig.general.theme === "dark" ? "dark" : null,
|
|
4143
|
+
resolvedConfig.general.rootClassName
|
|
4144
|
+
].filter(Boolean).join(" ");
|
|
4145
|
+
logConfig(resolvedConfig, resolvedConfig.enableLogs);
|
|
4146
|
+
return /* @__PURE__ */ jsx8(AggLabelsContext.Provider, { value: resolvedConfig.general.labels, children: /* @__PURE__ */ jsx8(AggUiContext.Provider, { value: resolvedConfig, children: /* @__PURE__ */ jsx8(EventTradingProvider, { enableLogs: resolvedConfig.enableLogs, children: /* @__PURE__ */ jsx8(
|
|
4147
|
+
"div",
|
|
4148
|
+
{
|
|
4149
|
+
className: resolvedRootClassName,
|
|
4150
|
+
"data-agg-animations": resolvedConfig.features.enableAnimations ? "true" : "false",
|
|
4151
|
+
"data-agg-gradients": resolvedConfig.features.enableGradients ? "true" : "false",
|
|
4152
|
+
"data-agg-theme": resolvedConfig.general.theme,
|
|
4153
|
+
children
|
|
4154
|
+
}
|
|
4155
|
+
) }) }) });
|
|
4156
|
+
};
|
|
4029
4157
|
|
|
4030
4158
|
// src/core/providers/agg-provider.tsx
|
|
4031
|
-
import { jsx as
|
|
4159
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
4032
4160
|
var hasWarnedMissingQueryClient = false;
|
|
4033
4161
|
function useQueryClientCheck() {
|
|
4034
4162
|
try {
|
|
4035
|
-
|
|
4163
|
+
useQueryClient3();
|
|
4036
4164
|
} catch (e) {
|
|
4037
4165
|
if (!hasWarnedMissingQueryClient) {
|
|
4038
4166
|
hasWarnedMissingQueryClient = true;
|
|
@@ -4049,18 +4177,50 @@ var AggProvider = ({ client, config, children }) => {
|
|
|
4049
4177
|
"AggProvider requires a valid AggClient instance. Create one with createAggClient() and pass it via the 'client' prop."
|
|
4050
4178
|
);
|
|
4051
4179
|
}
|
|
4052
|
-
return /* @__PURE__ */
|
|
4180
|
+
return /* @__PURE__ */ jsx9(AggClientProvider, { client, children: /* @__PURE__ */ jsx9(AggUiProvider, { config, children: /* @__PURE__ */ jsx9(AggExecutionModeProvider, { children: /* @__PURE__ */ jsx9(EventListStateProvider, { children: /* @__PURE__ */ jsx9(AggWebSocketProvider, { children: /* @__PURE__ */ jsx9(AggAuthProvider, { children: /* @__PURE__ */ jsx9(AggBalanceProvider, { children }) }) }) }) }) }) });
|
|
4053
4181
|
};
|
|
4054
4182
|
|
|
4183
|
+
// src/use-resolved-execution-mode.ts
|
|
4184
|
+
function useResolvedExecutionMode(override) {
|
|
4185
|
+
var _a;
|
|
4186
|
+
const serverConfig = useContext7(AggExecutionModeContext);
|
|
4187
|
+
const tradingMode = serverConfig == null ? void 0 : serverConfig.tradingMode;
|
|
4188
|
+
const isLoading = (_a = serverConfig == null ? void 0 : serverConfig.isLoading) != null ? _a : false;
|
|
4189
|
+
const {
|
|
4190
|
+
trading: { executionMode: configuredExecutionMode }
|
|
4191
|
+
} = useAggUiConfig();
|
|
4192
|
+
const localMode = override != null ? override : configuredExecutionMode;
|
|
4193
|
+
const executionMode = tradingMode != null ? tradingMode : localMode === "paper" ? "paper" : "live";
|
|
4194
|
+
return {
|
|
4195
|
+
executionMode,
|
|
4196
|
+
isPaperMode: executionMode === "paper",
|
|
4197
|
+
isResolving: tradingMode === void 0 && isLoading
|
|
4198
|
+
};
|
|
4199
|
+
}
|
|
4200
|
+
|
|
4055
4201
|
// src/execution/use-execute-managed.ts
|
|
4056
|
-
import { useMutation, useQueryClient as
|
|
4202
|
+
import { useMutation, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
4057
4203
|
function useExecuteManaged(options) {
|
|
4058
4204
|
const client = useAggClient();
|
|
4059
|
-
const queryClient =
|
|
4205
|
+
const queryClient = useQueryClient4();
|
|
4060
4206
|
return useMutation({
|
|
4061
4207
|
mutationFn: (params) => client.executeManaged(params),
|
|
4062
4208
|
onSuccess: (data) => {
|
|
4063
4209
|
var _a;
|
|
4210
|
+
queryClient.setQueriesData({ queryKey: ["smart-route"] }, (route) => {
|
|
4211
|
+
var _a2;
|
|
4212
|
+
if (!route) return route;
|
|
4213
|
+
const consumedPrimary = route.quoteId === data.quoteId;
|
|
4214
|
+
const consumedComparison = (_a2 = route.venueSoloQuotes) == null ? void 0 : _a2.some(
|
|
4215
|
+
(quote) => quote.quoteId === data.quoteId
|
|
4216
|
+
);
|
|
4217
|
+
if (!consumedPrimary && !consumedComparison) return route;
|
|
4218
|
+
return __spreadValues(__spreadValues(__spreadValues({}, route), consumedPrimary ? { quoteId: "" } : {}), consumedComparison ? {
|
|
4219
|
+
venueSoloQuotes: route.venueSoloQuotes.map(
|
|
4220
|
+
(quote) => quote.quoteId === data.quoteId ? __spreadProps(__spreadValues({}, quote), { quoteId: "" }) : quote
|
|
4221
|
+
)
|
|
4222
|
+
} : {});
|
|
4223
|
+
});
|
|
4064
4224
|
queryClient.invalidateQueries({ queryKey: executionKeys.ordersPrefix() });
|
|
4065
4225
|
queryClient.invalidateQueries({ queryKey: executionKeys.positionsPrefix() });
|
|
4066
4226
|
invalidateBalanceQueries(queryClient);
|
|
@@ -4071,10 +4231,10 @@ function useExecuteManaged(options) {
|
|
|
4071
4231
|
}
|
|
4072
4232
|
|
|
4073
4233
|
// src/execution/use-place-limit-order.ts
|
|
4074
|
-
import { useMutation as useMutation2, useQueryClient as
|
|
4234
|
+
import { useMutation as useMutation2, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
|
4075
4235
|
function usePlaceLimitOrder(options) {
|
|
4076
4236
|
const client = useAggClient();
|
|
4077
|
-
const queryClient =
|
|
4237
|
+
const queryClient = useQueryClient5();
|
|
4078
4238
|
return useMutation2({
|
|
4079
4239
|
mutationFn: (params) => client.placeLimitOrder(params),
|
|
4080
4240
|
onSuccess: (data) => {
|
|
@@ -4090,10 +4250,10 @@ function usePlaceLimitOrder(options) {
|
|
|
4090
4250
|
}
|
|
4091
4251
|
|
|
4092
4252
|
// src/execution/use-cancel-managed-order.ts
|
|
4093
|
-
import { useMutation as useMutation3, useQueryClient as
|
|
4253
|
+
import { useMutation as useMutation3, useQueryClient as useQueryClient6 } from "@tanstack/react-query";
|
|
4094
4254
|
function useCancelManagedOrder(options) {
|
|
4095
4255
|
const client = useAggClient();
|
|
4096
|
-
const queryClient =
|
|
4256
|
+
const queryClient = useQueryClient6();
|
|
4097
4257
|
return useMutation3({
|
|
4098
4258
|
mutationFn: (orderId) => client.cancelManagedOrder(orderId),
|
|
4099
4259
|
onSuccess: (data, orderId) => {
|
|
@@ -4113,10 +4273,10 @@ function useCancelManagedOrder(options) {
|
|
|
4113
4273
|
}
|
|
4114
4274
|
|
|
4115
4275
|
// src/execution/use-withdraw-managed.ts
|
|
4116
|
-
import { useMutation as useMutation4, useQueryClient as
|
|
4276
|
+
import { useMutation as useMutation4, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
4117
4277
|
function useWithdrawManaged(options) {
|
|
4118
4278
|
const client = useAggClient();
|
|
4119
|
-
const queryClient =
|
|
4279
|
+
const queryClient = useQueryClient7();
|
|
4120
4280
|
return useMutation4({
|
|
4121
4281
|
mutationFn: (params) => client.withdrawManaged(params),
|
|
4122
4282
|
onSuccess: (data) => {
|
|
@@ -4129,15 +4289,19 @@ function useWithdrawManaged(options) {
|
|
|
4129
4289
|
}
|
|
4130
4290
|
|
|
4131
4291
|
// src/execution/use-managed-balances.ts
|
|
4132
|
-
import { useQuery as
|
|
4292
|
+
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
4133
4293
|
function useManagedBalances(options) {
|
|
4134
4294
|
const client = useAggClient();
|
|
4135
4295
|
const { enabled = true, mode } = options != null ? options : {};
|
|
4136
|
-
const query =
|
|
4296
|
+
const query = useQuery3({
|
|
4137
4297
|
queryKey: executionKeys.balances(mode),
|
|
4138
4298
|
queryFn: () => client.getManagedBalances(mode ? { mode } : void 0),
|
|
4139
4299
|
enabled,
|
|
4140
4300
|
staleTime: 1e4,
|
|
4301
|
+
// A matched fill can precede settlement and the API's next balance snapshot.
|
|
4302
|
+
// Keep visible clients converging even if that first invalidation reads old cash.
|
|
4303
|
+
refetchInterval: mode === "paper" ? false : 5e3,
|
|
4304
|
+
refetchIntervalInBackground: false,
|
|
4141
4305
|
gcTime: 5 * 6e4,
|
|
4142
4306
|
retry: 1
|
|
4143
4307
|
});
|
|
@@ -4147,12 +4311,12 @@ function useManagedBalances(options) {
|
|
|
4147
4311
|
}
|
|
4148
4312
|
|
|
4149
4313
|
// src/execution/use-positions.ts
|
|
4150
|
-
import { useQuery as
|
|
4314
|
+
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
4151
4315
|
function usePositions(options) {
|
|
4152
4316
|
var _a, _b, _c, _d;
|
|
4153
4317
|
const client = useAggClient();
|
|
4154
4318
|
const { enabled = true, cursor, limit, status, mode } = options != null ? options : {};
|
|
4155
|
-
const query =
|
|
4319
|
+
const query = useQuery4({
|
|
4156
4320
|
queryKey: executionKeys.positions(cursor, limit, status, mode),
|
|
4157
4321
|
queryFn: () => client.getPositions(__spreadValues({ cursor, limit, status }, mode ? { mode } : {})),
|
|
4158
4322
|
enabled,
|
|
@@ -4168,8 +4332,8 @@ function usePositions(options) {
|
|
|
4168
4332
|
}
|
|
4169
4333
|
|
|
4170
4334
|
// src/execution/use-deposit-addresses.ts
|
|
4171
|
-
import { useEffect as useEffect4, useMemo as
|
|
4172
|
-
import { useQuery as
|
|
4335
|
+
import { useEffect as useEffect4, useMemo as useMemo7, useRef as useRef4, useState as useState4 } from "react";
|
|
4336
|
+
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
4173
4337
|
var SVM_CHAIN_IDS = /* @__PURE__ */ new Set([792703809]);
|
|
4174
4338
|
function getDepositAddress(chainId, data) {
|
|
4175
4339
|
return chainId !== void 0 && SVM_CHAIN_IDS.has(chainId) ? data.svmAddress : data.evmAddress;
|
|
@@ -4193,7 +4357,7 @@ function useDepositAddresses(options) {
|
|
|
4193
4357
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
4194
4358
|
};
|
|
4195
4359
|
}, [enabled, poll, timeoutMs]);
|
|
4196
|
-
const query =
|
|
4360
|
+
const query = useQuery5({
|
|
4197
4361
|
queryKey: executionKeys.depositAddresses(),
|
|
4198
4362
|
queryFn: () => client.getDepositAddresses(),
|
|
4199
4363
|
enabled,
|
|
@@ -4209,9 +4373,9 @@ function useDepositAddresses(options) {
|
|
|
4209
4373
|
});
|
|
4210
4374
|
const isReady = ((_a = query.data) == null ? void 0 : _a.ready) === true;
|
|
4211
4375
|
const readyData = isReady ? query.data : void 0;
|
|
4212
|
-
const evmAddress =
|
|
4213
|
-
const svmAddress =
|
|
4214
|
-
const supportedChains =
|
|
4376
|
+
const evmAddress = useMemo7(() => readyData == null ? void 0 : readyData.evmAddress, [readyData]);
|
|
4377
|
+
const svmAddress = useMemo7(() => readyData == null ? void 0 : readyData.svmAddress, [readyData]);
|
|
4378
|
+
const supportedChains = useMemo7(() => readyData == null ? void 0 : readyData.supportedChains, [readyData]);
|
|
4215
4379
|
return __spreadProps(__spreadValues({}, query), {
|
|
4216
4380
|
isReady,
|
|
4217
4381
|
isTimedOut,
|
|
@@ -4225,10 +4389,10 @@ function useDepositAddresses(options) {
|
|
|
4225
4389
|
}
|
|
4226
4390
|
|
|
4227
4391
|
// src/execution/use-sync-balances.ts
|
|
4228
|
-
import { useMutation as useMutation5, useQueryClient as
|
|
4392
|
+
import { useMutation as useMutation5, useQueryClient as useQueryClient8 } from "@tanstack/react-query";
|
|
4229
4393
|
function useSyncBalances(options) {
|
|
4230
4394
|
const client = useAggClient();
|
|
4231
|
-
const queryClient =
|
|
4395
|
+
const queryClient = useQueryClient8();
|
|
4232
4396
|
return useMutation5({
|
|
4233
4397
|
mutationFn: () => client.syncManagedBalances(),
|
|
4234
4398
|
onSuccess: () => {
|
|
@@ -4957,13 +5121,13 @@ function useExecutionProgress({
|
|
|
4957
5121
|
}
|
|
4958
5122
|
|
|
4959
5123
|
// src/execution/use-balance-refill-policies.ts
|
|
4960
|
-
import { useMutation as useMutation6, useQuery as
|
|
5124
|
+
import { useMutation as useMutation6, useQuery as useQuery6, useQueryClient as useQueryClient9 } from "@tanstack/react-query";
|
|
4961
5125
|
function useBalanceRefillPolicies(options) {
|
|
4962
5126
|
var _a, _b;
|
|
4963
5127
|
const client = useAggClient();
|
|
4964
|
-
const queryClient =
|
|
5128
|
+
const queryClient = useQueryClient9();
|
|
4965
5129
|
const queryKey = executionKeys.balanceRefillPolicies();
|
|
4966
|
-
const query =
|
|
5130
|
+
const query = useQuery6({
|
|
4967
5131
|
queryKey,
|
|
4968
5132
|
queryFn: () => client.getBalanceRefillPolicies(),
|
|
4969
5133
|
enabled: (_a = options == null ? void 0 : options.enabled) != null ? _a : true,
|
|
@@ -5042,7 +5206,7 @@ var computeClosedPositionTotals = (group) => {
|
|
|
5042
5206
|
};
|
|
5043
5207
|
|
|
5044
5208
|
// src/execution/use-redeem.ts
|
|
5045
|
-
import { useMutation as useMutation7, useQueryClient as
|
|
5209
|
+
import { useMutation as useMutation7, useQueryClient as useQueryClient10 } from "@tanstack/react-query";
|
|
5046
5210
|
var RedeemRejectedError = class extends Error {
|
|
5047
5211
|
constructor(message, response) {
|
|
5048
5212
|
super(message);
|
|
@@ -5053,10 +5217,11 @@ var RedeemRejectedError = class extends Error {
|
|
|
5053
5217
|
var isLegRejected = (status) => status === "ineligible" || status === "rejected";
|
|
5054
5218
|
var useRedeem = () => {
|
|
5055
5219
|
const client = useAggClient();
|
|
5056
|
-
const queryClient =
|
|
5220
|
+
const queryClient = useQueryClient10();
|
|
5221
|
+
const { executionMode } = useResolvedExecutionMode();
|
|
5057
5222
|
return useMutation7({
|
|
5058
5223
|
mutationFn: (body) => __async(null, null, function* () {
|
|
5059
|
-
const response = yield client.redeem(body);
|
|
5224
|
+
const response = yield client.redeem(__spreadValues({ mode: executionMode }, body));
|
|
5060
5225
|
if (response.results.length > 0 && response.results.every((r) => isLegRejected(r.status))) {
|
|
5061
5226
|
const reasons = response.results.map((r) => r.reason).filter((r) => Boolean(r));
|
|
5062
5227
|
const message = reasons.length > 0 ? reasons.join("; ") : "Redeem rejected";
|
|
@@ -5076,7 +5241,7 @@ var useOnRedeemEvent2 = (listener) => {
|
|
|
5076
5241
|
};
|
|
5077
5242
|
|
|
5078
5243
|
// src/execution/use-redeem-eligible-count.ts
|
|
5079
|
-
import { useQuery as
|
|
5244
|
+
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
5080
5245
|
var CLAIMABLE_COUNT_PAGE_LIMIT = 100;
|
|
5081
5246
|
var getClaimablePositionsCount = (client) => __async(null, null, function* () {
|
|
5082
5247
|
var _a;
|
|
@@ -5101,7 +5266,7 @@ var useRedeemEligibleCount = () => {
|
|
|
5101
5266
|
var _a;
|
|
5102
5267
|
const client = useAggClient();
|
|
5103
5268
|
const { isAuthenticated } = useAggAuthState();
|
|
5104
|
-
const query =
|
|
5269
|
+
const query = useQuery7({
|
|
5105
5270
|
queryKey: executionKeys.claimablePositionsCount(),
|
|
5106
5271
|
queryFn: () => getClaimablePositionsCount(client),
|
|
5107
5272
|
enabled: isAuthenticated,
|
|
@@ -5113,7 +5278,7 @@ var useRedeemEligibleCount = () => {
|
|
|
5113
5278
|
};
|
|
5114
5279
|
|
|
5115
5280
|
// src/execution/use-redeem-lifecycles.ts
|
|
5116
|
-
import { useEffect as useEffect6, useMemo as
|
|
5281
|
+
import { useEffect as useEffect6, useMemo as useMemo8, useState as useState6 } from "react";
|
|
5117
5282
|
var computeDerivedState = (legs, expectedCount) => {
|
|
5118
5283
|
const legCount = Object.keys(legs).length;
|
|
5119
5284
|
let allTerminal = legCount === expectedCount;
|
|
@@ -5164,7 +5329,7 @@ var seedState = (input) => {
|
|
|
5164
5329
|
};
|
|
5165
5330
|
};
|
|
5166
5331
|
function useRedeemLifecycles(inputs) {
|
|
5167
|
-
const inputsByRedeemId =
|
|
5332
|
+
const inputsByRedeemId = useMemo8(() => {
|
|
5168
5333
|
const map = {};
|
|
5169
5334
|
for (const input of inputs) {
|
|
5170
5335
|
map[input.redeemId] = input;
|
|
@@ -5196,7 +5361,7 @@ function useRedeemLifecycles(inputs) {
|
|
|
5196
5361
|
});
|
|
5197
5362
|
}, [inputsByRedeemId]);
|
|
5198
5363
|
useOnRedeemEvent(
|
|
5199
|
-
|
|
5364
|
+
useMemo8(() => {
|
|
5200
5365
|
if (Object.keys(inputsByRedeemId).length === 0) return null;
|
|
5201
5366
|
return (event) => {
|
|
5202
5367
|
const input = inputsByRedeemId[event.redeemId];
|
|
@@ -5231,7 +5396,7 @@ function useRedeemLifecycles(inputs) {
|
|
|
5231
5396
|
}
|
|
5232
5397
|
|
|
5233
5398
|
// src/execution/use-redeem-lifecycle.ts
|
|
5234
|
-
import { useMemo as
|
|
5399
|
+
import { useMemo as useMemo9 } from "react";
|
|
5235
5400
|
var INITIAL_STATE = {
|
|
5236
5401
|
pending: true,
|
|
5237
5402
|
terminal: false,
|
|
@@ -5242,7 +5407,7 @@ var INITIAL_STATE = {
|
|
|
5242
5407
|
};
|
|
5243
5408
|
function useRedeemLifecycle(input) {
|
|
5244
5409
|
var _a;
|
|
5245
|
-
const inputs =
|
|
5410
|
+
const inputs = useMemo9(() => input ? [input] : [], [input]);
|
|
5246
5411
|
const map = useRedeemLifecycles(inputs);
|
|
5247
5412
|
if (!input) return INITIAL_STATE;
|
|
5248
5413
|
return (_a = map[input.redeemId]) != null ? _a : INITIAL_STATE;
|
|
@@ -5276,7 +5441,11 @@ export {
|
|
|
5276
5441
|
invalidateUserActivityQueries,
|
|
5277
5442
|
invalidateUserMoneyState,
|
|
5278
5443
|
invalidateUserClaimState,
|
|
5444
|
+
useResolvedExecutionMode,
|
|
5279
5445
|
AggBalanceProvider,
|
|
5446
|
+
appConfigQueryKey,
|
|
5447
|
+
useAppConfig,
|
|
5448
|
+
useCachedAppConfig,
|
|
5280
5449
|
EventListStateProvider,
|
|
5281
5450
|
useEventListState,
|
|
5282
5451
|
getIntervalSeconds,
|