@agg-build/hooks 1.2.12 → 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",
@@ -440,12 +443,14 @@ var enUsLabels = {
440
443
  unavailableTitle: "Market unavailable",
441
444
  unavailableDescription: "We could not load this market right now.",
442
445
  arbitrage: "Arbitrage",
443
- priceGap: "Price Gap",
444
446
  volumeSuffix: "Vol.",
445
447
  marketSingular: "Market",
446
448
  marketPlural: "Markets",
447
449
  venueSingular: "Venue",
448
- venuePlural: "Venues"
450
+ venuePlural: "Venues",
451
+ matched: "Matched",
452
+ matchedCount: (count) => `${count} ${count === 1 ? "Match" : "Matches"}`,
453
+ priceGap: "Price Gap"
449
454
  },
450
455
  eventItemDetails: {
451
456
  loading: "Loading market details",
@@ -557,8 +562,8 @@ var enUsLabels = {
557
562
  })}\xA2 avg. price`,
558
563
  balance: (value) => `Balance ${value}`,
559
564
  shares: (value) => `${value.toLocaleString("en-US", {
560
- minimumFractionDigits: Number.isInteger(value) ? 0 : 2,
561
- maximumFractionDigits: 6
565
+ minimumFractionDigits: Number.isInteger(value) ? 0 : 1,
566
+ maximumFractionDigits: 2
562
567
  })} shares`,
563
568
  maxShares: "Max",
564
569
  slippage: (value) => `Slippage: ${value}%`,
@@ -642,9 +647,11 @@ var enUsLabels = {
642
647
  platformFee: "0% platform fees",
643
648
  estimatedFees: "Estimated fees",
644
649
  estimatedFeesTooltipAria: "Estimated fees breakdown",
645
- feeBreakdownVenueFees: "Venue fees",
646
- feeBreakdownBridgeFees: "Bridge fees",
647
- feeBreakdownExecutionGas: "Execution gas",
650
+ feeBreakdownVenueFees: "Venue",
651
+ feeBreakdownBridgeFees: "Bridging",
652
+ feeBreakdownExecutionGas: "Gas",
653
+ feeBreakdownAggMarket: "agg.market",
654
+ feeBreakdownPlatformFeeBadge: "0% fee",
648
655
  feeBreakdownTotalFees: "Total fees",
649
656
  toWin: (tab) => tab === "buy" ? "To win" : "Payout",
650
657
  buyingOutcome: (label) => `Buying ${label}`,
@@ -880,6 +887,19 @@ var enUsLabels = {
880
887
  },
881
888
  failedTitle: "Withdrawal failed",
882
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."
883
903
  }
884
904
  }
885
905
  };
@@ -950,6 +970,7 @@ var defaultAggUiConfig = {
950
970
  features: {
951
971
  enableAnimations: true,
952
972
  enableLiveUpdates: true,
973
+ enablePriceGap: false,
953
974
  showFeesBreakdown: false,
954
975
  enableGradients: false,
955
976
  enableVenueEventDiscoveryFilters: false,
@@ -978,9 +999,16 @@ var AggBalanceContext = (0, import_react.createContext)(null);
978
999
  // src/execution/query-keys.ts
979
1000
  var executionKeys = {
980
1001
  all: () => ["execution"],
981
- balances: () => ["execution", "balances"],
982
- 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],
983
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
+ */
984
1012
  claimableClosedPositionsCount: () => ["execution", "positions", "claimable-count"],
985
1013
  orders: (status, cursor, limit) => ["execution", "orders", status != null ? status : null, cursor != null ? cursor : null, limit != null ? limit : null],
986
1014
  ordersPrefix: () => ["execution", "orders"],
@@ -1025,7 +1053,8 @@ var invalidatePositionQueries = (queryClient, options) => {
1025
1053
  });
1026
1054
  };
1027
1055
  var userActivityQueryKeys = {
1028
- all: () => ["user-activity"]
1056
+ all: () => ["user-activity"],
1057
+ feed: (type, limit) => ["user-activity", type != null ? type : "all", limit != null ? limit : 50]
1029
1058
  };
1030
1059
  var invalidateUserActivityQueries = (queryClient, options) => {
1031
1060
  var _a;
@@ -1113,10 +1142,10 @@ function useWithdrawManaged(options) {
1113
1142
  var import_react_query3 = require("@tanstack/react-query");
1114
1143
  function useManagedBalances(options) {
1115
1144
  const client = useAggClient();
1116
- const { enabled = true } = options != null ? options : {};
1145
+ const { enabled = true, mode } = options != null ? options : {};
1117
1146
  const query = (0, import_react_query3.useQuery)({
1118
- queryKey: executionKeys.balances(),
1119
- queryFn: () => client.getManagedBalances(),
1147
+ queryKey: executionKeys.balances(mode),
1148
+ queryFn: () => client.getManagedBalances(mode ? { mode } : void 0),
1120
1149
  enabled,
1121
1150
  staleTime: 1e4,
1122
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-V34QGQBO.mjs";
5
+ } from "./chunk-OBHXWQ6L.mjs";
6
6
  import {
7
7
  useDepositAddresses,
8
8
  useManagedBalances,
9
9
  useWithdrawManaged
10
- } from "./chunk-2C7JR5OH.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.12",
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": {