@agg-build/hooks 1.2.11 → 1.3.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-JWPZNCGY.mjs → chunk-KXO3JOXF.mjs} +1 -1
- package/dist/{chunk-CWEJLBYY.mjs → chunk-OBHXWQ6L.mjs} +1 -1
- package/dist/{chunk-553OI6M2.mjs → chunk-VLYLQSDD.mjs} +211 -59
- package/dist/deposit.js +125 -20
- package/dist/deposit.mjs +2 -2
- package/dist/index.d.mts +311 -58
- package/dist/index.d.ts +311 -58
- package/dist/index.js +592 -230
- package/dist/index.mjs +283 -81
- package/dist/withdraw.d.mts +3 -3
- package/dist/withdraw.d.ts +3 -3
- package/dist/withdraw.js +128 -23
- package/dist/withdraw.mjs +2 -2
- package/package.json +2 -2
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
useOnWithdrawalLifecycle,
|
|
11
11
|
useSyncBalances,
|
|
12
12
|
useWithdrawManaged
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-VLYLQSDD.mjs";
|
|
14
14
|
|
|
15
15
|
// src/withdraw/use-withdraw-flow.ts
|
|
16
16
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
@@ -394,11 +394,8 @@ var enUsLabels = {
|
|
|
394
394
|
loadingDescription: "This may take a few minutes. You can safely close this window and check the status later in your activity.",
|
|
395
395
|
summary: {
|
|
396
396
|
requestedWithdrawal: "Requested withdrawal",
|
|
397
|
-
//
|
|
398
|
-
//
|
|
399
|
-
// would imply receipt before the lifecycle has confirmed. Keep it
|
|
400
|
-
// honest as the submitted amount until the multi-stable quote
|
|
401
|
-
// layer (PR-E) populates `expected.outputRaw`.
|
|
397
|
+
// Calling this "Amount received" would imply receipt before the
|
|
398
|
+
// lifecycle has confirmed. Keep it honest as the submitted amount.
|
|
402
399
|
amountReceived: "Amount",
|
|
403
400
|
network: "Network",
|
|
404
401
|
toWallet: "To wallet",
|
|
@@ -446,9 +443,8 @@ var enUsLabels = {
|
|
|
446
443
|
}
|
|
447
444
|
},
|
|
448
445
|
summary: {
|
|
449
|
-
// Lifecycle-honest:
|
|
450
|
-
//
|
|
451
|
-
// a guaranteed net output.
|
|
446
|
+
// Lifecycle-honest: this is the submitted amount, not a guaranteed net
|
|
447
|
+
// output.
|
|
452
448
|
amountReceived: "Amount",
|
|
453
449
|
network: "Network"
|
|
454
450
|
}
|
|
@@ -459,14 +455,21 @@ var enUsLabels = {
|
|
|
459
455
|
},
|
|
460
456
|
home: {
|
|
461
457
|
trending: "Trending",
|
|
462
|
-
topMarkets: "
|
|
458
|
+
topMarkets: "Trending",
|
|
463
459
|
newMarkets: "New Markets",
|
|
464
460
|
categoryTabsAria: "Home page category tabs"
|
|
465
461
|
},
|
|
466
462
|
userProfile: {
|
|
467
463
|
activity: {
|
|
468
464
|
depositType: "Deposit",
|
|
465
|
+
redeemType: "Claim",
|
|
469
466
|
withdrawalType: "Withdrawal",
|
|
467
|
+
redeemStatusTitles: {
|
|
468
|
+
pending: "Processing claim",
|
|
469
|
+
completed: "Successful claim",
|
|
470
|
+
failed: "Failed claim",
|
|
471
|
+
canceled: "Canceled claim"
|
|
472
|
+
},
|
|
470
473
|
depositTitles: {
|
|
471
474
|
connectedWallet: "Deposit from connected wallet",
|
|
472
475
|
externalWallet: "Deposit from external wallet",
|
|
@@ -537,6 +540,15 @@ var enUsLabels = {
|
|
|
537
540
|
eventList: {
|
|
538
541
|
matchedTab: "Matched",
|
|
539
542
|
allTab: "All",
|
|
543
|
+
sortByLabel: "Sort by",
|
|
544
|
+
sortBy24hVolume: "24h volume",
|
|
545
|
+
sortByTopArbitrage: "Top arbitrage",
|
|
546
|
+
sortByTotalVolume: "Total volume",
|
|
547
|
+
sortByEndingSoon: "Ending soon",
|
|
548
|
+
subcategoriesLabel: "Subcategories",
|
|
549
|
+
subcategoriesAll: "All",
|
|
550
|
+
subcategoriesOpenAria: "Open subcategories",
|
|
551
|
+
subcategoriesCloseAria: "Close subcategories",
|
|
540
552
|
loading: (title) => `Loading ${title}`,
|
|
541
553
|
tabsAria: (title) => `${title} tabs`,
|
|
542
554
|
emptyAria: "No events found",
|
|
@@ -565,12 +577,14 @@ var enUsLabels = {
|
|
|
565
577
|
unavailableTitle: "Market unavailable",
|
|
566
578
|
unavailableDescription: "We could not load this market right now.",
|
|
567
579
|
arbitrage: "Arbitrage",
|
|
568
|
-
priceGap: "Price Gap",
|
|
569
580
|
volumeSuffix: "Vol.",
|
|
570
581
|
marketSingular: "Market",
|
|
571
582
|
marketPlural: "Markets",
|
|
572
583
|
venueSingular: "Venue",
|
|
573
|
-
venuePlural: "Venues"
|
|
584
|
+
venuePlural: "Venues",
|
|
585
|
+
matched: "Matched",
|
|
586
|
+
matchedCount: (count) => `${count} ${count === 1 ? "Match" : "Matches"}`,
|
|
587
|
+
priceGap: "Price Gap"
|
|
574
588
|
},
|
|
575
589
|
eventItemDetails: {
|
|
576
590
|
loading: "Loading market details",
|
|
@@ -682,8 +696,8 @@ var enUsLabels = {
|
|
|
682
696
|
})}\xA2 avg. price`,
|
|
683
697
|
balance: (value) => `Balance ${value}`,
|
|
684
698
|
shares: (value) => `${value.toLocaleString("en-US", {
|
|
685
|
-
minimumFractionDigits: Number.isInteger(value) ? 0 :
|
|
686
|
-
maximumFractionDigits:
|
|
699
|
+
minimumFractionDigits: Number.isInteger(value) ? 0 : 1,
|
|
700
|
+
maximumFractionDigits: 2
|
|
687
701
|
})} shares`,
|
|
688
702
|
maxShares: "Max",
|
|
689
703
|
slippage: (value) => `Slippage: ${value}%`,
|
|
@@ -724,6 +738,18 @@ var enUsLabels = {
|
|
|
724
738
|
noOrderbooks: "No live orderbooks are available for this market right now.",
|
|
725
739
|
quoteUnavailable: "Quote temporarily unavailable. Please try again.",
|
|
726
740
|
quoteBalanceMismatch: "Quote balance mismatch. Try a different amount.",
|
|
741
|
+
serviceTemporarilyUnavailable: "Service temporarily unavailable. Please try again in a moment.",
|
|
742
|
+
orderDeadlineExpiredBeforeSubmission: "Order deadline expired before submission. Please try again.",
|
|
743
|
+
sellNoOnchainPosition: "You don't currently hold any on-chain shares of this outcome. If you just sold or redeemed elsewhere, your position display will refresh shortly \u2014 try again after that.",
|
|
744
|
+
venueQuoteUnfillable: "The venue couldn't fill this order at the quoted price right now. Try a smaller size, a higher slippage tolerance, or wait a moment and re-quote.",
|
|
745
|
+
venueMinOrderSize: "Order size is below the venue minimum. Try a larger amount.",
|
|
746
|
+
sourceBalanceChanged: "Your balance changed since the quote. Refresh and try again, or pick a smaller amount.",
|
|
747
|
+
venueMarketResolved: "This market just resolved. Pick a different market or wait for the next round.",
|
|
748
|
+
dflowWalletUnverified: "Your Solana wallet needs to be verified with dFlow before you can trade Kalshi markets. Verify at https://dflow.net/proof, then try again.",
|
|
749
|
+
venueNoQuotePath: "No active quote path for this market right now. Try a different size, or wait a moment and re-quote.",
|
|
750
|
+
solanaBlockhashExpired: "Solana transaction expired before submission. Please re-quote and try again.",
|
|
751
|
+
venueRateLimited: "The venue is rate-limiting requests right now. Please wait a moment and try again.",
|
|
752
|
+
serviceBlockedOrder: "Something on our side blocked this order. Please contact support if it keeps happening \u2014 retrying with the same quote will hit the same issue.",
|
|
727
753
|
selectedVenueUnavailable: "The venue you selected is no longer available on this route. Review the updated options and try again.",
|
|
728
754
|
engineUnavailable: "The routing engine is temporarily unavailable. Please try again in a moment.",
|
|
729
755
|
insufficientInputAmount: "Trade amount is too small to cover bridging and execution costs. Increase your spend or deposit funds on the destination chain.",
|
|
@@ -737,6 +763,7 @@ var enUsLabels = {
|
|
|
737
763
|
deposit: "Deposit",
|
|
738
764
|
kycRequired: "Verify to trade Kalshi",
|
|
739
765
|
kycNotVerifiedTooltip: "You have not been verified yet",
|
|
766
|
+
kycVerify: "Verify Identity",
|
|
740
767
|
kycVerifyModalTitle: "Verify Your Identity",
|
|
741
768
|
kycVerifyModalDescription: "To start trading on Kalshi, you'll need to complete identity verification through dFlow. It only takes a few minutes and helps us stay compliant with regulations.",
|
|
742
769
|
kycStartVerification: "Start Verification",
|
|
@@ -750,12 +777,15 @@ var enUsLabels = {
|
|
|
750
777
|
splitOrderDescription: "We split your order for the best price:",
|
|
751
778
|
viewAllRoutes: (count) => `View all (${count})`,
|
|
752
779
|
venueUnavailableInRegion: "Unavailable in your region",
|
|
780
|
+
verified: "Verified",
|
|
753
781
|
platformFee: "0% platform fees",
|
|
754
782
|
estimatedFees: "Estimated fees",
|
|
755
783
|
estimatedFeesTooltipAria: "Estimated fees breakdown",
|
|
756
|
-
feeBreakdownVenueFees: "Venue
|
|
757
|
-
feeBreakdownBridgeFees: "
|
|
758
|
-
feeBreakdownExecutionGas: "
|
|
784
|
+
feeBreakdownVenueFees: "Venue",
|
|
785
|
+
feeBreakdownBridgeFees: "Bridging",
|
|
786
|
+
feeBreakdownExecutionGas: "Gas",
|
|
787
|
+
feeBreakdownAggMarket: "agg.market",
|
|
788
|
+
feeBreakdownPlatformFeeBadge: "0% fee",
|
|
759
789
|
feeBreakdownTotalFees: "Total fees",
|
|
760
790
|
toWin: (tab) => tab === "buy" ? "To win" : "Payout",
|
|
761
791
|
buyingOutcome: (label) => `Buying ${label}`,
|
|
@@ -941,6 +971,70 @@ var enUsLabels = {
|
|
|
941
971
|
header: {
|
|
942
972
|
bannerAria: "Site header",
|
|
943
973
|
logoAria: "Home"
|
|
974
|
+
},
|
|
975
|
+
notifications: {
|
|
976
|
+
order: {
|
|
977
|
+
filledTitle: "Order filled",
|
|
978
|
+
filledMessage: ({ venueLabel, sideLabel, amountLabel, priceLabel }) => {
|
|
979
|
+
const action = sideLabel ? `${sideLabel} filled` : "Filled";
|
|
980
|
+
const amount = amountLabel ? ` ${amountLabel}` : "";
|
|
981
|
+
const price = priceLabel ? ` at ${priceLabel}` : "";
|
|
982
|
+
const venue = venueLabel ? ` on ${venueLabel}` : "";
|
|
983
|
+
return `${action}${amount}${price}${venue}`.trim();
|
|
984
|
+
},
|
|
985
|
+
partialFilledTitle: "Order partially filled",
|
|
986
|
+
partialFilledMessage: ({ venueLabel, sideLabel, amountLabel, priceLabel }) => {
|
|
987
|
+
const action = sideLabel ? `${sideLabel} partially filled` : "Partially filled";
|
|
988
|
+
const amount = amountLabel ? ` ${amountLabel}` : "";
|
|
989
|
+
const price = priceLabel ? ` at ${priceLabel}` : "";
|
|
990
|
+
const venue = venueLabel ? ` on ${venueLabel}` : "";
|
|
991
|
+
return `${action}${amount}${price}${venue}`.trim();
|
|
992
|
+
},
|
|
993
|
+
failedTitle: "Order failed",
|
|
994
|
+
failedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your order could not be completed. Please try again."
|
|
995
|
+
},
|
|
996
|
+
deposit: {
|
|
997
|
+
completedTitle: "Deposit complete",
|
|
998
|
+
completedMessage: ({ amountLabel, tokenLabel }) => {
|
|
999
|
+
if (amountLabel && tokenLabel) return `${amountLabel} ${tokenLabel} added to your balance.`;
|
|
1000
|
+
if (tokenLabel) return `Your ${tokenLabel} has been added to your balance.`;
|
|
1001
|
+
return "Your funds have been added to your balance.";
|
|
1002
|
+
},
|
|
1003
|
+
failedTitle: "Deposit failed",
|
|
1004
|
+
failedMessage: ({ amountLabel, tokenLabel }) => {
|
|
1005
|
+
const what = amountLabel && tokenLabel ? `${amountLabel} ${tokenLabel}` : "deposit";
|
|
1006
|
+
return `We couldn't complete your ${what}.`;
|
|
1007
|
+
}
|
|
1008
|
+
},
|
|
1009
|
+
withdrawal: {
|
|
1010
|
+
completedTitle: "Withdrawal complete",
|
|
1011
|
+
completedMessage: ({ amountLabel, tokenLabel }) => {
|
|
1012
|
+
if (amountLabel && tokenLabel) return `${amountLabel} ${tokenLabel} sent to your wallet.`;
|
|
1013
|
+
if (tokenLabel) return `Your ${tokenLabel} has been sent to your wallet.`;
|
|
1014
|
+
return "Your withdrawal has been sent to your wallet.";
|
|
1015
|
+
},
|
|
1016
|
+
partialTitle: "Withdrawal partially completed",
|
|
1017
|
+
partialMessage: ({ amountLabel, tokenLabel }) => {
|
|
1018
|
+
if (amountLabel && tokenLabel)
|
|
1019
|
+
return `Part of your ${tokenLabel} was sent. The remainder was returned to your balance.`;
|
|
1020
|
+
return "Part of your withdrawal was sent. The remainder was returned to your balance.";
|
|
1021
|
+
},
|
|
1022
|
+
failedTitle: "Withdrawal failed",
|
|
1023
|
+
failedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your funds have been returned to your balance."
|
|
1024
|
+
},
|
|
1025
|
+
claim: {
|
|
1026
|
+
pendingTitle: "Claim started",
|
|
1027
|
+
pendingMessage: "Claiming your winnings.",
|
|
1028
|
+
submittedTitle: "Claim submitted",
|
|
1029
|
+
submittedMessage: "Your claim was submitted. It may take a little while to finish.",
|
|
1030
|
+
successTitle: "Claim complete",
|
|
1031
|
+
successMessage: "Your winnings have been claimed.",
|
|
1032
|
+
partialTitle: "Claim partially completed",
|
|
1033
|
+
partialMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Some winnings could not be claimed. Please try again.",
|
|
1034
|
+
failedTitle: "Claim failed",
|
|
1035
|
+
failedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your winnings could not be claimed. Please try again.",
|
|
1036
|
+
missingOutcomeMessage: "This position is missing claimable outcome data. Please refresh."
|
|
1037
|
+
}
|
|
944
1038
|
}
|
|
945
1039
|
};
|
|
946
1040
|
var defaultAggUiLabelsByLocale = {
|
|
@@ -1030,8 +1124,11 @@ var defaultAggUiConfig = {
|
|
|
1030
1124
|
features: {
|
|
1031
1125
|
enableAnimations: true,
|
|
1032
1126
|
enableLiveUpdates: true,
|
|
1127
|
+
enablePriceGap: false,
|
|
1033
1128
|
showFeesBreakdown: false,
|
|
1034
|
-
enableGradients: false
|
|
1129
|
+
enableGradients: false,
|
|
1130
|
+
enableVenueEventDiscoveryFilters: false,
|
|
1131
|
+
enableNotifications: true
|
|
1035
1132
|
},
|
|
1036
1133
|
market: {
|
|
1037
1134
|
arbitrageThreshold: 0
|
|
@@ -1058,7 +1155,7 @@ var mergeAggUiSearchConfig = (config) => {
|
|
|
1058
1155
|
};
|
|
1059
1156
|
};
|
|
1060
1157
|
var mergeAggUiConfig = (persisted, config) => {
|
|
1061
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N;
|
|
1158
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T;
|
|
1062
1159
|
const locale = (_d = (_c = (_a = config == null ? void 0 : config.general) == null ? void 0 : _a.locale) != null ? _c : (_b = persisted.general) == null ? void 0 : _b.locale) != null ? _d : DEFAULT_LOCALE;
|
|
1063
1160
|
const theme = (_h = (_g = (_e = config == null ? void 0 : config.general) == null ? void 0 : _e.theme) != null ? _g : (_f = persisted.general) == null ? void 0 : _f.theme) != null ? _h : defaultAggUiConfig.general.theme;
|
|
1064
1161
|
const formatters = createFormatters(locale);
|
|
@@ -1076,23 +1173,26 @@ var mergeAggUiConfig = (persisted, config) => {
|
|
|
1076
1173
|
features: {
|
|
1077
1174
|
enableAnimations: (_p = (_o = config == null ? void 0 : config.features) == null ? void 0 : _o.enableAnimations) != null ? _p : defaultAggUiConfig.features.enableAnimations,
|
|
1078
1175
|
enableLiveUpdates: (_r = (_q = config == null ? void 0 : config.features) == null ? void 0 : _q.enableLiveUpdates) != null ? _r : defaultAggUiConfig.features.enableLiveUpdates,
|
|
1079
|
-
|
|
1080
|
-
|
|
1176
|
+
enablePriceGap: (_t = (_s = config == null ? void 0 : config.features) == null ? void 0 : _s.enablePriceGap) != null ? _t : defaultAggUiConfig.features.enablePriceGap,
|
|
1177
|
+
showFeesBreakdown: (_v = (_u = config == null ? void 0 : config.features) == null ? void 0 : _u.showFeesBreakdown) != null ? _v : defaultAggUiConfig.features.showFeesBreakdown,
|
|
1178
|
+
enableGradients: (_x = (_w = config == null ? void 0 : config.features) == null ? void 0 : _w.enableGradients) != null ? _x : defaultAggUiConfig.features.enableGradients,
|
|
1179
|
+
enableVenueEventDiscoveryFilters: (_z = (_y = config == null ? void 0 : config.features) == null ? void 0 : _y.enableVenueEventDiscoveryFilters) != null ? _z : defaultAggUiConfig.features.enableVenueEventDiscoveryFilters,
|
|
1180
|
+
enableNotifications: (_B = (_A = config == null ? void 0 : config.features) == null ? void 0 : _A.enableNotifications) != null ? _B : defaultAggUiConfig.features.enableNotifications
|
|
1081
1181
|
},
|
|
1082
1182
|
market: {
|
|
1083
|
-
arbitrageThreshold: (
|
|
1183
|
+
arbitrageThreshold: (_D = (_C = config == null ? void 0 : config.market) == null ? void 0 : _C.arbitrageThreshold) != null ? _D : defaultAggUiConfig.market.arbitrageThreshold
|
|
1084
1184
|
},
|
|
1085
1185
|
chart: {
|
|
1086
|
-
defaultChartTimeRange: (
|
|
1087
|
-
selectedChartTimeRange: (
|
|
1186
|
+
defaultChartTimeRange: (_F = (_E = config == null ? void 0 : config.chart) == null ? void 0 : _E.defaultChartTimeRange) != null ? _F : defaultAggUiConfig.chart.defaultChartTimeRange,
|
|
1187
|
+
selectedChartTimeRange: (_J = (_I = (_G = persisted.chart) == null ? void 0 : _G.selectedChartTimeRange) != null ? _I : (_H = config == null ? void 0 : config.chart) == null ? void 0 : _H.defaultChartTimeRange) != null ? _J : defaultAggUiConfig.chart.defaultChartTimeRange,
|
|
1088
1188
|
setSelectedChartTimeRange: defaultAggUiConfig.chart.setSelectedChartTimeRange
|
|
1089
1189
|
},
|
|
1090
1190
|
formatting: {
|
|
1091
|
-
formatNumber: (
|
|
1092
|
-
formatPercent: (
|
|
1093
|
-
formatCurrency: (
|
|
1094
|
-
formatCompactCurrency: (
|
|
1095
|
-
formatDate: (
|
|
1191
|
+
formatNumber: (_L = (_K = config == null ? void 0 : config.formatting) == null ? void 0 : _K.formatNumber) != null ? _L : formatters.formatNumber,
|
|
1192
|
+
formatPercent: (_N = (_M = config == null ? void 0 : config.formatting) == null ? void 0 : _M.formatPercent) != null ? _N : formatters.formatPercent,
|
|
1193
|
+
formatCurrency: (_P = (_O = config == null ? void 0 : config.formatting) == null ? void 0 : _O.formatCurrency) != null ? _P : formatters.formatCurrency,
|
|
1194
|
+
formatCompactCurrency: (_R = (_Q = config == null ? void 0 : config.formatting) == null ? void 0 : _Q.formatCompactCurrency) != null ? _R : formatters.formatCompactCurrency,
|
|
1195
|
+
formatDate: (_T = (_S = config == null ? void 0 : config.formatting) == null ? void 0 : _S.formatDate) != null ? _T : formatters.formatDate
|
|
1096
1196
|
},
|
|
1097
1197
|
search: mergeAggUiSearchConfig(config == null ? void 0 : config.search),
|
|
1098
1198
|
walletActions: config == null ? void 0 : config.walletActions,
|
|
@@ -1103,9 +1203,16 @@ var mergeAggUiConfig = (persisted, config) => {
|
|
|
1103
1203
|
// src/execution/query-keys.ts
|
|
1104
1204
|
var executionKeys = {
|
|
1105
1205
|
all: () => ["execution"],
|
|
1106
|
-
balances: () => ["execution", "balances"],
|
|
1107
|
-
positions: (cursor, limit, status) => ["execution", "positions", cursor != null ? cursor : null, limit != null ? limit : null, status != null ? status : null],
|
|
1206
|
+
balances: (mode) => mode ? ["execution", "balances", mode] : ["execution", "balances"],
|
|
1207
|
+
positions: (cursor, limit, status, mode) => mode ? ["execution", "positions", cursor != null ? cursor : null, limit != null ? limit : null, status != null ? status : null, mode] : ["execution", "positions", cursor != null ? cursor : null, limit != null ? limit : null, status != null ? status : null],
|
|
1108
1208
|
positionsPrefix: () => ["execution", "positions"],
|
|
1209
|
+
claimablePositionsCount: () => ["execution", "positions", "claimable-count"],
|
|
1210
|
+
/**
|
|
1211
|
+
* @deprecated Misnomer — claimable (redeemStatus "eligible") groups live in
|
|
1212
|
+
* the ACTIVE bucket, not closed (won-but-unclaimed stays Active until a
|
|
1213
|
+
* redeem stamps redeemedAt). Same key value as `claimablePositionsCount`;
|
|
1214
|
+
* kept so existing invalidation call sites keep matching.
|
|
1215
|
+
*/
|
|
1109
1216
|
claimableClosedPositionsCount: () => ["execution", "positions", "claimable-count"],
|
|
1110
1217
|
orders: (status, cursor, limit) => ["execution", "orders", status != null ? status : null, cursor != null ? cursor : null, limit != null ? limit : null],
|
|
1111
1218
|
ordersPrefix: () => ["execution", "orders"],
|
|
@@ -1156,7 +1263,8 @@ var shouldInvalidateBalancesForOrderEvent = (event, currentUserId) => {
|
|
|
1156
1263
|
return event.userId === currentUserId;
|
|
1157
1264
|
};
|
|
1158
1265
|
var userActivityQueryKeys = {
|
|
1159
|
-
all: () => ["user-activity"]
|
|
1266
|
+
all: () => ["user-activity"],
|
|
1267
|
+
feed: (type, limit) => ["user-activity", type != null ? type : "all", limit != null ? limit : 50]
|
|
1160
1268
|
};
|
|
1161
1269
|
var invalidateUserActivityQueries = (queryClient, options) => {
|
|
1162
1270
|
var _a;
|
|
@@ -1175,6 +1283,17 @@ var invalidateUserMoneyState = (queryClient, options) => {
|
|
|
1175
1283
|
invalidatePositionQueries(queryClient, { refetchType: options == null ? void 0 : options.refetchType });
|
|
1176
1284
|
invalidateUserActivityQueries(queryClient, { strategy: options == null ? void 0 : options.activityStrategy });
|
|
1177
1285
|
};
|
|
1286
|
+
var invalidateUserClaimState = (queryClient, options) => {
|
|
1287
|
+
var _a;
|
|
1288
|
+
const refetchType = (_a = options == null ? void 0 : options.refetchType) != null ? _a : "active";
|
|
1289
|
+
invalidateBalanceQueries(queryClient, { refetchType });
|
|
1290
|
+
invalidatePositionQueries(queryClient, { refetchType });
|
|
1291
|
+
queryClient.invalidateQueries({
|
|
1292
|
+
queryKey: executionKeys.claimablePositionsCount(),
|
|
1293
|
+
refetchType
|
|
1294
|
+
});
|
|
1295
|
+
invalidateUserActivityQueries(queryClient, { strategy: options == null ? void 0 : options.activityStrategy });
|
|
1296
|
+
};
|
|
1178
1297
|
|
|
1179
1298
|
// src/core/providers/balance-provider.tsx
|
|
1180
1299
|
import { useQuery } from "@tanstack/react-query";
|
|
@@ -1395,6 +1514,9 @@ var useAggClient = () => {
|
|
|
1395
1514
|
}
|
|
1396
1515
|
return client;
|
|
1397
1516
|
};
|
|
1517
|
+
var useOptionalAggClient = () => {
|
|
1518
|
+
return useContext3(AggClientContext);
|
|
1519
|
+
};
|
|
1398
1520
|
var useAggUiConfig = () => {
|
|
1399
1521
|
return useContext3(AggUiContext);
|
|
1400
1522
|
};
|
|
@@ -2972,8 +3094,20 @@ var AggUiProvider = ({ config, children }) => {
|
|
|
2972
3094
|
import { useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
2973
3095
|
|
|
2974
3096
|
// src/core/providers/auth-provider.tsx
|
|
3097
|
+
import { QueryClient, QueryClientContext } from "@tanstack/react-query";
|
|
2975
3098
|
import { useCallback as useCallback6, useContext as useContext6, useEffect as useEffect3, useMemo as useMemo5, useState as useState3 } from "react";
|
|
2976
3099
|
|
|
3100
|
+
// src/current-user-query.ts
|
|
3101
|
+
var CURRENT_USER_QUERY_KEY = ["current-user"];
|
|
3102
|
+
var CURRENT_USER_STALE_TIME_MS = 6e4;
|
|
3103
|
+
var fetchCurrentUserProfile = (queryClient, client, queryKey = CURRENT_USER_QUERY_KEY) => {
|
|
3104
|
+
return queryClient.fetchQuery({
|
|
3105
|
+
queryKey,
|
|
3106
|
+
queryFn: () => client.getCurrentUser(),
|
|
3107
|
+
staleTime: CURRENT_USER_STALE_TIME_MS
|
|
3108
|
+
});
|
|
3109
|
+
};
|
|
3110
|
+
|
|
2977
3111
|
// src/core/providers/auth-utils.ts
|
|
2978
3112
|
import { TurnstileChallengeError } from "@agg-build/sdk";
|
|
2979
3113
|
var createPlaceholderUserProfile = (input) => {
|
|
@@ -3128,6 +3262,9 @@ var replaceAuthCallbackUrl = (cleanupPath) => {
|
|
|
3128
3262
|
};
|
|
3129
3263
|
function AggAuthProvider({ children }) {
|
|
3130
3264
|
const client = useContext6(AggClientContext);
|
|
3265
|
+
const queryClientFromContext = useContext6(QueryClientContext);
|
|
3266
|
+
const fallbackQueryClient = useMemo5(() => new QueryClient(), []);
|
|
3267
|
+
const queryClient = queryClientFromContext && "fetchQuery" in queryClientFromContext ? queryClientFromContext : fallbackQueryClient;
|
|
3131
3268
|
const snapshot = getClientAuthSnapshot(client);
|
|
3132
3269
|
const [isAuthenticated, setIsAuthenticated] = useState3(snapshot.isAuthenticated);
|
|
3133
3270
|
const [user, setUser] = useState3(snapshot.user);
|
|
@@ -3142,12 +3279,15 @@ function AggAuthProvider({ children }) {
|
|
|
3142
3279
|
return provider === "wallet" || provider === "solana_wallet";
|
|
3143
3280
|
});
|
|
3144
3281
|
}, [user]);
|
|
3145
|
-
const refreshCurrentUser = useCallback6(
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3282
|
+
const refreshCurrentUser = useCallback6(
|
|
3283
|
+
(targetClient) => __async(null, null, function* () {
|
|
3284
|
+
const fullUser = yield fetchCurrentUserProfile(queryClient, targetClient);
|
|
3285
|
+
setIsAuthenticated(true);
|
|
3286
|
+
setUser(fullUser);
|
|
3287
|
+
return fullUser;
|
|
3288
|
+
}),
|
|
3289
|
+
[queryClient]
|
|
3290
|
+
);
|
|
3151
3291
|
useEffect3(() => {
|
|
3152
3292
|
const state = getClientAuthSnapshot(client);
|
|
3153
3293
|
setIsAuthenticated(state.isAuthenticated);
|
|
@@ -3418,10 +3558,10 @@ function useWithdrawManaged(options) {
|
|
|
3418
3558
|
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
3419
3559
|
function useManagedBalances(options) {
|
|
3420
3560
|
const client = useAggClient();
|
|
3421
|
-
const { enabled = true } = options != null ? options : {};
|
|
3561
|
+
const { enabled = true, mode } = options != null ? options : {};
|
|
3422
3562
|
const query = useQuery2({
|
|
3423
|
-
queryKey: executionKeys.balances(),
|
|
3424
|
-
queryFn: () => client.getManagedBalances(),
|
|
3563
|
+
queryKey: executionKeys.balances(mode),
|
|
3564
|
+
queryFn: () => client.getManagedBalances(mode ? { mode } : void 0),
|
|
3425
3565
|
enabled,
|
|
3426
3566
|
staleTime: 1e4,
|
|
3427
3567
|
gcTime: 5 * 6e4,
|
|
@@ -3437,10 +3577,10 @@ import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
|
3437
3577
|
function usePositions(options) {
|
|
3438
3578
|
var _a, _b, _c, _d;
|
|
3439
3579
|
const client = useAggClient();
|
|
3440
|
-
const { enabled = true, cursor, limit, status } = options != null ? options : {};
|
|
3580
|
+
const { enabled = true, cursor, limit, status, mode } = options != null ? options : {};
|
|
3441
3581
|
const query = useQuery3({
|
|
3442
|
-
queryKey: executionKeys.positions(cursor, limit, status),
|
|
3443
|
-
queryFn: () => client.getPositions({ cursor, limit, status }),
|
|
3582
|
+
queryKey: executionKeys.positions(cursor, limit, status, mode),
|
|
3583
|
+
queryFn: () => client.getPositions(__spreadValues({ cursor, limit, status }, mode ? { mode } : {})),
|
|
3444
3584
|
enabled,
|
|
3445
3585
|
staleTime: 1e4,
|
|
3446
3586
|
gcTime: 5 * 6e4,
|
|
@@ -3528,17 +3668,24 @@ function useSyncBalances(options) {
|
|
|
3528
3668
|
|
|
3529
3669
|
// src/execution/use-execution-progress.ts
|
|
3530
3670
|
import { useCallback as useCallback7, useEffect as useEffect5, useRef as useRef5, useState as useState5 } from "react";
|
|
3531
|
-
var TERMINAL_ORDER_STATUSES = /* @__PURE__ */ new Set([
|
|
3671
|
+
var TERMINAL_ORDER_STATUSES = /* @__PURE__ */ new Set([
|
|
3672
|
+
"filled",
|
|
3673
|
+
"partial_fill",
|
|
3674
|
+
"failed",
|
|
3675
|
+
"cancelled",
|
|
3676
|
+
"expired"
|
|
3677
|
+
]);
|
|
3532
3678
|
var ORDER_POLL_INTERVAL_MS = 5e3;
|
|
3533
3679
|
function mapOrderStatusToTerminalEvent(status) {
|
|
3534
3680
|
if (status === "filled") return "filled";
|
|
3535
3681
|
if (status === "partial_fill") return "partial_fill";
|
|
3536
|
-
if (status === "failed" || status === "cancelled") return "failed";
|
|
3682
|
+
if (status === "failed" || status === "cancelled" || status === "expired") return "failed";
|
|
3537
3683
|
return null;
|
|
3538
3684
|
}
|
|
3539
3685
|
function useExecutionProgress({
|
|
3540
3686
|
orderIds,
|
|
3541
|
-
enabled
|
|
3687
|
+
enabled,
|
|
3688
|
+
mode
|
|
3542
3689
|
}) {
|
|
3543
3690
|
const [phase, setPhase] = useState5("idle");
|
|
3544
3691
|
const [submittedOrders, setSubmittedOrders] = useState5([]);
|
|
@@ -3589,12 +3736,13 @@ function useExecutionProgress({
|
|
|
3589
3736
|
submittedOrderVenueByIdRef.current.set(msg.orderId, trimmedVenue);
|
|
3590
3737
|
}
|
|
3591
3738
|
const { event } = msg;
|
|
3592
|
-
if (event === "filled" || event === "partial_fill" || event === "failed" || event === "bridge_ws_subscribe_failed") {
|
|
3593
|
-
const mappedEvent = event === "
|
|
3739
|
+
if (event === "filled" || event === "partial_fill" || event === "failed" || event === "bridge_ws_subscribe_failed" || event === "expired" || event === "dag_cancelled") {
|
|
3740
|
+
const mappedEvent = event === "filled" || event === "partial_fill" ? event : "failed";
|
|
3594
3741
|
const resolvedVenue = trimmedVenue || submittedOrderVenueByIdRef.current.get(msg.orderId) || "";
|
|
3595
3742
|
if (resolvedVenue) {
|
|
3596
3743
|
submittedOrderVenueByIdRef.current.set(msg.orderId, resolvedVenue);
|
|
3597
3744
|
}
|
|
3745
|
+
const fallbackErrorReason = event === "bridge_ws_subscribe_failed" ? "Bridge event subscription failed." : event === "expired" ? "Order expired before it could be submitted." : event === "dag_cancelled" ? "Order was cancelled before submission." : void 0;
|
|
3598
3746
|
const nextTerminalEvent = {
|
|
3599
3747
|
orderId: msg.orderId,
|
|
3600
3748
|
venue: resolvedVenue,
|
|
@@ -3607,7 +3755,7 @@ function useExecutionProgress({
|
|
|
3607
3755
|
quotedToWinRaw: msg.quotedToWinRaw,
|
|
3608
3756
|
executionPriceRaw: msg.executionPriceRaw,
|
|
3609
3757
|
quotedPriceRaw: msg.quotedPriceRaw,
|
|
3610
|
-
errorReason:
|
|
3758
|
+
errorReason: (_a = msg.errorReason) != null ? _a : fallbackErrorReason,
|
|
3611
3759
|
timestamp: msg.timestamp
|
|
3612
3760
|
};
|
|
3613
3761
|
setTerminalOrderEvents((prev) => {
|
|
@@ -3745,7 +3893,10 @@ function useExecutionProgress({
|
|
|
3745
3893
|
pending.map((orderId) => __async(null, null, function* () {
|
|
3746
3894
|
var _a2, _b2;
|
|
3747
3895
|
try {
|
|
3748
|
-
const res = yield client.getExecutionOrders({
|
|
3896
|
+
const res = yield client.getExecutionOrders(__spreadValues({
|
|
3897
|
+
orderId,
|
|
3898
|
+
limit: 1
|
|
3899
|
+
}, mode ? { mode } : {}));
|
|
3749
3900
|
return (_b2 = (_a2 = res.data) == null ? void 0 : _a2[0]) != null ? _b2 : null;
|
|
3750
3901
|
} catch (e) {
|
|
3751
3902
|
return null;
|
|
@@ -3806,7 +3957,7 @@ function useExecutionProgress({
|
|
|
3806
3957
|
cancelled = true;
|
|
3807
3958
|
stopPolling();
|
|
3808
3959
|
};
|
|
3809
|
-
}, [client, isListening, orderIds]);
|
|
3960
|
+
}, [client, isListening, mode, orderIds]);
|
|
3810
3961
|
return { phase, submittedOrders, latestBalance, dagProgress, terminalOrderEvents };
|
|
3811
3962
|
}
|
|
3812
3963
|
|
|
@@ -3871,10 +4022,8 @@ var useRedeem = () => {
|
|
|
3871
4022
|
}
|
|
3872
4023
|
return response;
|
|
3873
4024
|
}),
|
|
3874
|
-
|
|
3875
|
-
queryClient
|
|
3876
|
-
queryClient.invalidateQueries({ queryKey: executionKeys.balances() });
|
|
3877
|
-
queryClient.invalidateQueries({ queryKey: executionKeys.claimableClosedPositionsCount() });
|
|
4025
|
+
onSettled: () => {
|
|
4026
|
+
invalidateUserClaimState(queryClient);
|
|
3878
4027
|
}
|
|
3879
4028
|
});
|
|
3880
4029
|
};
|
|
@@ -3887,13 +4036,13 @@ var useOnRedeemEvent2 = (listener) => {
|
|
|
3887
4036
|
// src/execution/use-redeem-eligible-count.ts
|
|
3888
4037
|
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
3889
4038
|
var CLAIMABLE_COUNT_PAGE_LIMIT = 100;
|
|
3890
|
-
var
|
|
4039
|
+
var getClaimablePositionsCount = (client) => __async(null, null, function* () {
|
|
3891
4040
|
var _a;
|
|
3892
4041
|
let total = 0;
|
|
3893
4042
|
let cursor;
|
|
3894
4043
|
do {
|
|
3895
4044
|
const page = yield client.getExecutionPositions({
|
|
3896
|
-
status: "
|
|
4045
|
+
status: "active",
|
|
3897
4046
|
limit: CLAIMABLE_COUNT_PAGE_LIMIT,
|
|
3898
4047
|
cursor
|
|
3899
4048
|
});
|
|
@@ -3911,8 +4060,8 @@ var useRedeemEligibleCount = () => {
|
|
|
3911
4060
|
const client = useAggClient();
|
|
3912
4061
|
const { isAuthenticated } = useAggAuthState();
|
|
3913
4062
|
const query = useQuery5({
|
|
3914
|
-
queryKey: executionKeys.
|
|
3915
|
-
queryFn: () =>
|
|
4063
|
+
queryKey: executionKeys.claimablePositionsCount(),
|
|
4064
|
+
queryFn: () => getClaimablePositionsCount(client),
|
|
3916
4065
|
enabled: isAuthenticated,
|
|
3917
4066
|
staleTime: 3e4,
|
|
3918
4067
|
refetchInterval: isAuthenticated ? 45e3 : false
|
|
@@ -4084,6 +4233,7 @@ export {
|
|
|
4084
4233
|
userActivityQueryKeys,
|
|
4085
4234
|
invalidateUserActivityQueries,
|
|
4086
4235
|
invalidateUserMoneyState,
|
|
4236
|
+
invalidateUserClaimState,
|
|
4087
4237
|
AggBalanceProvider,
|
|
4088
4238
|
EventListStateProvider,
|
|
4089
4239
|
useEventListState,
|
|
@@ -4097,6 +4247,7 @@ export {
|
|
|
4097
4247
|
applyOrderbookDepth,
|
|
4098
4248
|
marketDataKeys,
|
|
4099
4249
|
useAggClient,
|
|
4250
|
+
useOptionalAggClient,
|
|
4100
4251
|
useAggUiConfig,
|
|
4101
4252
|
useAggLabels,
|
|
4102
4253
|
useAggAuthContext,
|
|
@@ -4111,6 +4262,7 @@ export {
|
|
|
4111
4262
|
useAggWebSocketConnectionState,
|
|
4112
4263
|
useOnOrderSubmitted,
|
|
4113
4264
|
useOnBalanceUpdate,
|
|
4265
|
+
useOnOrderEvent,
|
|
4114
4266
|
useOnWithdrawalLifecycle,
|
|
4115
4267
|
DEFAULT_AGG_ROOT_CLASS_NAME,
|
|
4116
4268
|
CHART_TIME_RANGES,
|