@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.
@@ -10,9 +10,8 @@ type WithdrawSelectOption = {
10
10
  type WithdrawSummary = {
11
11
  /**
12
12
  * The amount the user submitted for withdrawal — NOT a confirmed payout
13
- * figure. The API today returns `pricingStatus: "unquoted"` with no fee
14
- * or net-output guarantee, so labeling this "received" was misleading.
15
- * The label string is "Amount" until the multi-stable quote layer ships.
13
+ * figure. A preflight quote can still fail or settle partially later, so
14
+ * labeling this "received" was misleading.
16
15
  */
17
16
  amountReceived: string;
18
17
  network: string;
@@ -140,6 +139,7 @@ declare function useWithdrawManaged(options?: UseWithdrawManagedOptions): _tanst
140
139
 
141
140
  interface UseManagedBalancesOptions {
142
141
  enabled?: boolean;
142
+ mode?: "live" | "paper";
143
143
  }
144
144
  /**
145
145
  * Query hook for fetching unified managed wallet balances across all chains.
@@ -10,9 +10,8 @@ type WithdrawSelectOption = {
10
10
  type WithdrawSummary = {
11
11
  /**
12
12
  * The amount the user submitted for withdrawal — NOT a confirmed payout
13
- * figure. The API today returns `pricingStatus: "unquoted"` with no fee
14
- * or net-output guarantee, so labeling this "received" was misleading.
15
- * The label string is "Amount" until the multi-stable quote layer ships.
13
+ * figure. A preflight quote can still fail or settle partially later, so
14
+ * labeling this "received" was misleading.
16
15
  */
17
16
  amountReceived: string;
18
17
  network: string;
@@ -140,6 +139,7 @@ declare function useWithdrawManaged(options?: UseWithdrawManagedOptions): _tanst
140
139
 
141
140
  interface UseManagedBalancesOptions {
142
141
  enabled?: boolean;
142
+ mode?: "live" | "paper";
143
143
  }
144
144
  /**
145
145
  * Query hook for fetching unified managed wallet balances across all chains.
package/dist/withdraw.js CHANGED
@@ -260,11 +260,8 @@ var enUsLabels = {
260
260
  loadingDescription: "This may take a few minutes. You can safely close this window and check the status later in your activity.",
261
261
  summary: {
262
262
  requestedWithdrawal: "Requested withdrawal",
263
- // The response is `pricingStatus: "unquoted"` we don't know net
264
- // output until on-chain settlement. Calling this "Amount received"
265
- // would imply receipt before the lifecycle has confirmed. Keep it
266
- // honest as the submitted amount until the multi-stable quote
267
- // layer (PR-E) populates `expected.outputRaw`.
263
+ // Calling this "Amount received" would imply receipt before the
264
+ // lifecycle has confirmed. Keep it honest as the submitted amount.
268
265
  amountReceived: "Amount",
269
266
  network: "Network",
270
267
  toWallet: "To wallet",
@@ -312,9 +309,8 @@ var enUsLabels = {
312
309
  }
313
310
  },
314
311
  summary: {
315
- // Lifecycle-honest: until quoting is live (PR-E) the response is
316
- // `pricingStatus: "unquoted"` so this is the submitted amount, not
317
- // a guaranteed net output.
312
+ // Lifecycle-honest: this is the submitted amount, not a guaranteed net
313
+ // output.
318
314
  amountReceived: "Amount",
319
315
  network: "Network"
320
316
  }
@@ -325,14 +321,21 @@ var enUsLabels = {
325
321
  },
326
322
  home: {
327
323
  trending: "Trending",
328
- topMarkets: "Top Markets",
324
+ topMarkets: "Trending",
329
325
  newMarkets: "New Markets",
330
326
  categoryTabsAria: "Home page category tabs"
331
327
  },
332
328
  userProfile: {
333
329
  activity: {
334
330
  depositType: "Deposit",
331
+ redeemType: "Claim",
335
332
  withdrawalType: "Withdrawal",
333
+ redeemStatusTitles: {
334
+ pending: "Processing claim",
335
+ completed: "Successful claim",
336
+ failed: "Failed claim",
337
+ canceled: "Canceled claim"
338
+ },
336
339
  depositTitles: {
337
340
  connectedWallet: "Deposit from connected wallet",
338
341
  externalWallet: "Deposit from external wallet",
@@ -403,6 +406,15 @@ var enUsLabels = {
403
406
  eventList: {
404
407
  matchedTab: "Matched",
405
408
  allTab: "All",
409
+ sortByLabel: "Sort by",
410
+ sortBy24hVolume: "24h volume",
411
+ sortByTopArbitrage: "Top arbitrage",
412
+ sortByTotalVolume: "Total volume",
413
+ sortByEndingSoon: "Ending soon",
414
+ subcategoriesLabel: "Subcategories",
415
+ subcategoriesAll: "All",
416
+ subcategoriesOpenAria: "Open subcategories",
417
+ subcategoriesCloseAria: "Close subcategories",
406
418
  loading: (title) => `Loading ${title}`,
407
419
  tabsAria: (title) => `${title} tabs`,
408
420
  emptyAria: "No events found",
@@ -431,12 +443,14 @@ var enUsLabels = {
431
443
  unavailableTitle: "Market unavailable",
432
444
  unavailableDescription: "We could not load this market right now.",
433
445
  arbitrage: "Arbitrage",
434
- priceGap: "Price Gap",
435
446
  volumeSuffix: "Vol.",
436
447
  marketSingular: "Market",
437
448
  marketPlural: "Markets",
438
449
  venueSingular: "Venue",
439
- venuePlural: "Venues"
450
+ venuePlural: "Venues",
451
+ matched: "Matched",
452
+ matchedCount: (count) => `${count} ${count === 1 ? "Match" : "Matches"}`,
453
+ priceGap: "Price Gap"
440
454
  },
441
455
  eventItemDetails: {
442
456
  loading: "Loading market details",
@@ -548,8 +562,8 @@ var enUsLabels = {
548
562
  })}\xA2 avg. price`,
549
563
  balance: (value) => `Balance ${value}`,
550
564
  shares: (value) => `${value.toLocaleString("en-US", {
551
- minimumFractionDigits: Number.isInteger(value) ? 0 : 2,
552
- maximumFractionDigits: 6
565
+ minimumFractionDigits: Number.isInteger(value) ? 0 : 1,
566
+ maximumFractionDigits: 2
553
567
  })} shares`,
554
568
  maxShares: "Max",
555
569
  slippage: (value) => `Slippage: ${value}%`,
@@ -590,6 +604,18 @@ var enUsLabels = {
590
604
  noOrderbooks: "No live orderbooks are available for this market right now.",
591
605
  quoteUnavailable: "Quote temporarily unavailable. Please try again.",
592
606
  quoteBalanceMismatch: "Quote balance mismatch. Try a different amount.",
607
+ serviceTemporarilyUnavailable: "Service temporarily unavailable. Please try again in a moment.",
608
+ orderDeadlineExpiredBeforeSubmission: "Order deadline expired before submission. Please try again.",
609
+ 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.",
610
+ 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.",
611
+ venueMinOrderSize: "Order size is below the venue minimum. Try a larger amount.",
612
+ sourceBalanceChanged: "Your balance changed since the quote. Refresh and try again, or pick a smaller amount.",
613
+ venueMarketResolved: "This market just resolved. Pick a different market or wait for the next round.",
614
+ 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.",
615
+ venueNoQuotePath: "No active quote path for this market right now. Try a different size, or wait a moment and re-quote.",
616
+ solanaBlockhashExpired: "Solana transaction expired before submission. Please re-quote and try again.",
617
+ venueRateLimited: "The venue is rate-limiting requests right now. Please wait a moment and try again.",
618
+ 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.",
593
619
  selectedVenueUnavailable: "The venue you selected is no longer available on this route. Review the updated options and try again.",
594
620
  engineUnavailable: "The routing engine is temporarily unavailable. Please try again in a moment.",
595
621
  insufficientInputAmount: "Trade amount is too small to cover bridging and execution costs. Increase your spend or deposit funds on the destination chain.",
@@ -603,6 +629,7 @@ var enUsLabels = {
603
629
  deposit: "Deposit",
604
630
  kycRequired: "Verify to trade Kalshi",
605
631
  kycNotVerifiedTooltip: "You have not been verified yet",
632
+ kycVerify: "Verify Identity",
606
633
  kycVerifyModalTitle: "Verify Your Identity",
607
634
  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.",
608
635
  kycStartVerification: "Start Verification",
@@ -616,12 +643,15 @@ var enUsLabels = {
616
643
  splitOrderDescription: "We split your order for the best price:",
617
644
  viewAllRoutes: (count) => `View all (${count})`,
618
645
  venueUnavailableInRegion: "Unavailable in your region",
646
+ verified: "Verified",
619
647
  platformFee: "0% platform fees",
620
648
  estimatedFees: "Estimated fees",
621
649
  estimatedFeesTooltipAria: "Estimated fees breakdown",
622
- feeBreakdownVenueFees: "Venue fees",
623
- feeBreakdownBridgeFees: "Bridge fees",
624
- feeBreakdownExecutionGas: "Execution gas",
650
+ feeBreakdownVenueFees: "Venue",
651
+ feeBreakdownBridgeFees: "Bridging",
652
+ feeBreakdownExecutionGas: "Gas",
653
+ feeBreakdownAggMarket: "agg.market",
654
+ feeBreakdownPlatformFeeBadge: "0% fee",
625
655
  feeBreakdownTotalFees: "Total fees",
626
656
  toWin: (tab) => tab === "buy" ? "To win" : "Payout",
627
657
  buyingOutcome: (label) => `Buying ${label}`,
@@ -807,6 +837,70 @@ var enUsLabels = {
807
837
  header: {
808
838
  bannerAria: "Site header",
809
839
  logoAria: "Home"
840
+ },
841
+ notifications: {
842
+ order: {
843
+ filledTitle: "Order filled",
844
+ filledMessage: ({ venueLabel, sideLabel, amountLabel, priceLabel }) => {
845
+ const action = sideLabel ? `${sideLabel} filled` : "Filled";
846
+ const amount = amountLabel ? ` ${amountLabel}` : "";
847
+ const price = priceLabel ? ` at ${priceLabel}` : "";
848
+ const venue = venueLabel ? ` on ${venueLabel}` : "";
849
+ return `${action}${amount}${price}${venue}`.trim();
850
+ },
851
+ partialFilledTitle: "Order partially filled",
852
+ partialFilledMessage: ({ venueLabel, sideLabel, amountLabel, priceLabel }) => {
853
+ const action = sideLabel ? `${sideLabel} partially filled` : "Partially filled";
854
+ const amount = amountLabel ? ` ${amountLabel}` : "";
855
+ const price = priceLabel ? ` at ${priceLabel}` : "";
856
+ const venue = venueLabel ? ` on ${venueLabel}` : "";
857
+ return `${action}${amount}${price}${venue}`.trim();
858
+ },
859
+ failedTitle: "Order failed",
860
+ failedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your order could not be completed. Please try again."
861
+ },
862
+ deposit: {
863
+ completedTitle: "Deposit complete",
864
+ completedMessage: ({ amountLabel, tokenLabel }) => {
865
+ if (amountLabel && tokenLabel) return `${amountLabel} ${tokenLabel} added to your balance.`;
866
+ if (tokenLabel) return `Your ${tokenLabel} has been added to your balance.`;
867
+ return "Your funds have been added to your balance.";
868
+ },
869
+ failedTitle: "Deposit failed",
870
+ failedMessage: ({ amountLabel, tokenLabel }) => {
871
+ const what = amountLabel && tokenLabel ? `${amountLabel} ${tokenLabel}` : "deposit";
872
+ return `We couldn't complete your ${what}.`;
873
+ }
874
+ },
875
+ withdrawal: {
876
+ completedTitle: "Withdrawal complete",
877
+ completedMessage: ({ amountLabel, tokenLabel }) => {
878
+ if (amountLabel && tokenLabel) return `${amountLabel} ${tokenLabel} sent to your wallet.`;
879
+ if (tokenLabel) return `Your ${tokenLabel} has been sent to your wallet.`;
880
+ return "Your withdrawal has been sent to your wallet.";
881
+ },
882
+ partialTitle: "Withdrawal partially completed",
883
+ partialMessage: ({ amountLabel, tokenLabel }) => {
884
+ if (amountLabel && tokenLabel)
885
+ return `Part of your ${tokenLabel} was sent. The remainder was returned to your balance.`;
886
+ return "Part of your withdrawal was sent. The remainder was returned to your balance.";
887
+ },
888
+ failedTitle: "Withdrawal failed",
889
+ failedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your funds have been returned to your balance."
890
+ },
891
+ claim: {
892
+ pendingTitle: "Claim started",
893
+ pendingMessage: "Claiming your winnings.",
894
+ submittedTitle: "Claim submitted",
895
+ submittedMessage: "Your claim was submitted. It may take a little while to finish.",
896
+ successTitle: "Claim complete",
897
+ successMessage: "Your winnings have been claimed.",
898
+ partialTitle: "Claim partially completed",
899
+ partialMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Some winnings could not be claimed. Please try again.",
900
+ failedTitle: "Claim failed",
901
+ failedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your winnings could not be claimed. Please try again.",
902
+ missingOutcomeMessage: "This position is missing claimable outcome data. Please refresh."
903
+ }
810
904
  }
811
905
  };
812
906
  var defaultAggUiLabelsByLocale = {
@@ -876,8 +970,11 @@ var defaultAggUiConfig = {
876
970
  features: {
877
971
  enableAnimations: true,
878
972
  enableLiveUpdates: true,
973
+ enablePriceGap: false,
879
974
  showFeesBreakdown: false,
880
- enableGradients: false
975
+ enableGradients: false,
976
+ enableVenueEventDiscoveryFilters: false,
977
+ enableNotifications: true
881
978
  },
882
979
  market: {
883
980
  arbitrageThreshold: 0
@@ -902,9 +999,16 @@ var AggBalanceContext = (0, import_react.createContext)(null);
902
999
  // src/execution/query-keys.ts
903
1000
  var executionKeys = {
904
1001
  all: () => ["execution"],
905
- balances: () => ["execution", "balances"],
906
- positions: (cursor, limit, status) => ["execution", "positions", cursor != null ? cursor : null, limit != null ? limit : null, status != null ? status : null],
1002
+ balances: (mode) => mode ? ["execution", "balances", mode] : ["execution", "balances"],
1003
+ 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],
907
1004
  positionsPrefix: () => ["execution", "positions"],
1005
+ claimablePositionsCount: () => ["execution", "positions", "claimable-count"],
1006
+ /**
1007
+ * @deprecated Misnomer — claimable (redeemStatus "eligible") groups live in
1008
+ * the ACTIVE bucket, not closed (won-but-unclaimed stays Active until a
1009
+ * redeem stamps redeemedAt). Same key value as `claimablePositionsCount`;
1010
+ * kept so existing invalidation call sites keep matching.
1011
+ */
908
1012
  claimableClosedPositionsCount: () => ["execution", "positions", "claimable-count"],
909
1013
  orders: (status, cursor, limit) => ["execution", "orders", status != null ? status : null, cursor != null ? cursor : null, limit != null ? limit : null],
910
1014
  ordersPrefix: () => ["execution", "orders"],
@@ -949,7 +1053,8 @@ var invalidatePositionQueries = (queryClient, options) => {
949
1053
  });
950
1054
  };
951
1055
  var userActivityQueryKeys = {
952
- all: () => ["user-activity"]
1056
+ all: () => ["user-activity"],
1057
+ feed: (type, limit) => ["user-activity", type != null ? type : "all", limit != null ? limit : 50]
953
1058
  };
954
1059
  var invalidateUserActivityQueries = (queryClient, options) => {
955
1060
  var _a;
@@ -1037,10 +1142,10 @@ function useWithdrawManaged(options) {
1037
1142
  var import_react_query3 = require("@tanstack/react-query");
1038
1143
  function useManagedBalances(options) {
1039
1144
  const client = useAggClient();
1040
- const { enabled = true } = options != null ? options : {};
1145
+ const { enabled = true, mode } = options != null ? options : {};
1041
1146
  const query = (0, import_react_query3.useQuery)({
1042
- queryKey: executionKeys.balances(),
1043
- queryFn: () => client.getManagedBalances(),
1147
+ queryKey: executionKeys.balances(mode),
1148
+ queryFn: () => client.getManagedBalances(mode ? { mode } : void 0),
1044
1149
  enabled,
1045
1150
  staleTime: 1e4,
1046
1151
  gcTime: 5 * 6e4,
package/dist/withdraw.mjs CHANGED
@@ -2,12 +2,12 @@ import {
2
2
  useWithdrawEstimate,
3
3
  useWithdrawFlow,
4
4
  useWithdrawalLifecycle
5
- } from "./chunk-CWEJLBYY.mjs";
5
+ } from "./chunk-OBHXWQ6L.mjs";
6
6
  import {
7
7
  useDepositAddresses,
8
8
  useManagedBalances,
9
9
  useWithdrawManaged
10
- } from "./chunk-553OI6M2.mjs";
10
+ } from "./chunk-VLYLQSDD.mjs";
11
11
  export {
12
12
  useDepositAddresses,
13
13
  useManagedBalances,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agg-build/hooks",
3
- "version": "1.2.11",
3
+ "version": "1.3.0",
4
4
  "description": "React hooks and providers for the AGG prediction market aggregator. Wraps @agg-build/sdk with TanStack Query, shared session state, and live WebSocket data.",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",
@@ -83,7 +83,7 @@
83
83
  "react": "^18.0.0 || ^19.0.0",
84
84
  "viem": "^2.0.0",
85
85
  "wagmi": "^3.0.0 || ^2.0.0",
86
- "@agg-build/sdk": "^1.2.11"
86
+ "@agg-build/sdk": "^1.3.0"
87
87
  },
88
88
  "peerDependenciesMeta": {
89
89
  "@solana/wallet-adapter-react": {