@agg-build/hooks 1.0.1 → 1.2.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/README.md +1 -1
- package/dist/{chunk-PALQVBAQ.mjs → chunk-FKTRXKYA.mjs} +1 -1
- package/dist/{chunk-QXBQRWFF.mjs → chunk-KSSPFJM2.mjs} +2 -2
- package/dist/{chunk-BWXNOWAS.mjs → chunk-U3DRHUR5.mjs} +42 -14
- package/dist/deposit.js +31 -4
- package/dist/deposit.mjs +2 -2
- package/dist/index.d.mts +32 -2
- package/dist/index.d.ts +32 -2
- package/dist/index.js +62 -25
- package/dist/index.mjs +22 -13
- package/dist/withdraw.js +32 -5
- package/dist/withdraw.mjs +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -335,7 +335,7 @@ Import from `@agg-build/hooks/deposit` to keep wallet-heavy hooks out of your ma
|
|
|
335
335
|
|
|
336
336
|
- `enableLogs` / `enableWebsocketsLogs` — turn on debug logging
|
|
337
337
|
- `general` — `locale`, `theme` (`"light" | "dark"`), `rootClassName`, `labels`
|
|
338
|
-
- `features` — `showVenueLogo`, `enableAnimations`, `enableLiveUpdates`, `enableGradients`
|
|
338
|
+
- `features` — `showVenueLogo`, `enableAnimations`, `enableLiveUpdates`, `showFeesBreakdown`, `enableGradients`
|
|
339
339
|
- `market` — `arbitrageThreshold`
|
|
340
340
|
- `chart` — `defaultChartTimeRange`, `selectedChartTimeRange`
|
|
341
341
|
- `search` — provider-owned search state + callbacks for host-app routing/analytics
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
useOnWithdrawalLifecycle,
|
|
11
11
|
useSyncBalances,
|
|
12
12
|
useWithdrawManaged
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-U3DRHUR5.mjs";
|
|
14
14
|
|
|
15
15
|
// src/withdraw/use-withdraw-flow.ts
|
|
16
16
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
@@ -69,7 +69,7 @@ var parseTokenAmountToRaw = (amount, decimals) => {
|
|
|
69
69
|
return null;
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
-
var shortenAddress = (address) => address.length > 12 ? `${address.slice(0, 6)}
|
|
72
|
+
var shortenAddress = (address) => address.length > 12 ? `${address.slice(0, 6)}...${address.slice(-4)}` : address;
|
|
73
73
|
function useWithdrawFlow(options) {
|
|
74
74
|
var _a, _b;
|
|
75
75
|
const { open, onOpenChange } = options;
|
|
@@ -463,21 +463,37 @@ var enUsLabels = {
|
|
|
463
463
|
withdrawalTitle: (tokenSymbol) => `Withdraw ${tokenSymbol}`
|
|
464
464
|
},
|
|
465
465
|
positions: {
|
|
466
|
+
activeFilter: "Active",
|
|
467
|
+
closedFilter: "Closed",
|
|
468
|
+
marketHeader: "Market",
|
|
466
469
|
totalTradedHeader: "Total traded",
|
|
470
|
+
currentValueHeader: "Current value",
|
|
471
|
+
statusHeader: "Status",
|
|
472
|
+
resolutionHeader: "Resolution",
|
|
473
|
+
payoutHeader: "Payout",
|
|
474
|
+
resultHeader: "Result",
|
|
467
475
|
amountWonHeader: "Amount won",
|
|
468
476
|
claimHeader: "Claim",
|
|
469
477
|
claim: "Claim",
|
|
470
478
|
claimed: "Claimed",
|
|
471
479
|
pending: "Pending",
|
|
480
|
+
open: "Open",
|
|
472
481
|
won: "Won",
|
|
473
482
|
lost: "Lost",
|
|
483
|
+
sold: "Sold",
|
|
474
484
|
resolved: "Resolved",
|
|
475
485
|
marketClosed: "Market closed",
|
|
476
|
-
closed: "Closed"
|
|
486
|
+
closed: "Closed",
|
|
487
|
+
searchPlaceholder: "Search...",
|
|
488
|
+
noResults: "No results",
|
|
489
|
+
avgPrefix: "avg",
|
|
490
|
+
nowPrefix: "now",
|
|
491
|
+
finalPrefix: "final"
|
|
477
492
|
}
|
|
478
493
|
},
|
|
479
494
|
eventList: {
|
|
480
495
|
matchedTab: "Matched",
|
|
496
|
+
allTab: "All",
|
|
481
497
|
loading: (title) => `Loading ${title}`,
|
|
482
498
|
tabsAria: (title) => `${title} tabs`,
|
|
483
499
|
emptyAria: "No events found",
|
|
@@ -606,9 +622,11 @@ var enUsLabels = {
|
|
|
606
622
|
settlementDescriptionLabel: "Description",
|
|
607
623
|
settlementRulesPrimaryLabel: "Resolution rules",
|
|
608
624
|
settlementRulesSecondaryLabel: "Additional rules",
|
|
625
|
+
settlementPrimaryRulesLabel: "Resolution rules",
|
|
626
|
+
settlementEmpty: "No settlement details available.",
|
|
609
627
|
disclaimer: "By trading, you agree to the Terms of Use of each exchange.",
|
|
610
628
|
geoBlockTermsLink: "Terms of Use",
|
|
611
|
-
geoBlockGenericMessage: "
|
|
629
|
+
geoBlockGenericMessage: "None of the venues for this market are available in your region. See ",
|
|
612
630
|
geoBlockVenueMessage: (venueLabel) => `Trading on ${venueLabel} is not available in your region. See `,
|
|
613
631
|
geoBlockMessageSuffix: " for more information.",
|
|
614
632
|
geoBlockModalAriaLabel: "Geo-restricted location",
|
|
@@ -624,6 +642,7 @@ var enUsLabels = {
|
|
|
624
642
|
minimumFractionDigits: Number.isInteger(value) ? 0 : 2,
|
|
625
643
|
maximumFractionDigits: 6
|
|
626
644
|
})} shares`,
|
|
645
|
+
maxShares: "Max",
|
|
627
646
|
slippage: (value) => `Slippage: ${value}%`,
|
|
628
647
|
editSlippage: (value) => `Edit ${value}`,
|
|
629
648
|
collapseSlippage: (value) => `Collapse ${value}`,
|
|
@@ -670,7 +689,8 @@ var enUsLabels = {
|
|
|
670
689
|
insufficientPositionGeneric: "You don't have enough shares to sell.",
|
|
671
690
|
insufficientSellDepth: "Not enough bid liquidity on the matched venues for this sell amount.",
|
|
672
691
|
noBidsAboveMinPrice: "No venue bids above the minimum price.",
|
|
673
|
-
|
|
692
|
+
signInToTrade: "Sign in to trade",
|
|
693
|
+
deposit: "Deposit",
|
|
674
694
|
kycRequired: "Verify to trade Kalshi",
|
|
675
695
|
kycNotVerifiedTooltip: "You have not been verified yet",
|
|
676
696
|
kycVerifyModalTitle: "Verify Your Identity",
|
|
@@ -685,8 +705,14 @@ var enUsLabels = {
|
|
|
685
705
|
orderSplitting: "Order Splitting",
|
|
686
706
|
splitOrderDescription: "We split your order for the best price:",
|
|
687
707
|
viewAllRoutes: (count) => `View all (${count})`,
|
|
688
|
-
hideRoutes: "Hide routes",
|
|
689
708
|
venueUnavailableInRegion: "Unavailable in your region",
|
|
709
|
+
platformFee: "0% platform fees",
|
|
710
|
+
estimatedFees: "Estimated fees",
|
|
711
|
+
estimatedFeesTooltipAria: "Estimated fees breakdown",
|
|
712
|
+
feeBreakdownVenueFees: "Venue fees",
|
|
713
|
+
feeBreakdownBridgeFees: "Bridge fees",
|
|
714
|
+
feeBreakdownExecutionGas: "Execution gas",
|
|
715
|
+
feeBreakdownTotalFees: "Total fees",
|
|
690
716
|
toWin: (tab) => tab === "buy" ? "To win" : "Payout",
|
|
691
717
|
buyingOutcome: (label) => `Buying ${label}`,
|
|
692
718
|
sellingOutcome: (label) => `Selling ${label}`,
|
|
@@ -958,6 +984,7 @@ var defaultAggUiConfig = {
|
|
|
958
984
|
features: {
|
|
959
985
|
enableAnimations: true,
|
|
960
986
|
enableLiveUpdates: true,
|
|
987
|
+
showFeesBreakdown: false,
|
|
961
988
|
enableGradients: false
|
|
962
989
|
},
|
|
963
990
|
market: {
|
|
@@ -985,7 +1012,7 @@ var mergeAggUiSearchConfig = (config) => {
|
|
|
985
1012
|
};
|
|
986
1013
|
};
|
|
987
1014
|
var mergeAggUiConfig = (persisted, config) => {
|
|
988
|
-
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;
|
|
1015
|
+
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;
|
|
989
1016
|
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;
|
|
990
1017
|
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;
|
|
991
1018
|
const formatters = createFormatters(locale);
|
|
@@ -1002,22 +1029,23 @@ var mergeAggUiConfig = (persisted, config) => {
|
|
|
1002
1029
|
features: {
|
|
1003
1030
|
enableAnimations: (_o = (_n = config == null ? void 0 : config.features) == null ? void 0 : _n.enableAnimations) != null ? _o : defaultAggUiConfig.features.enableAnimations,
|
|
1004
1031
|
enableLiveUpdates: (_q = (_p = config == null ? void 0 : config.features) == null ? void 0 : _p.enableLiveUpdates) != null ? _q : defaultAggUiConfig.features.enableLiveUpdates,
|
|
1005
|
-
|
|
1032
|
+
showFeesBreakdown: (_s = (_r = config == null ? void 0 : config.features) == null ? void 0 : _r.showFeesBreakdown) != null ? _s : defaultAggUiConfig.features.showFeesBreakdown,
|
|
1033
|
+
enableGradients: (_u = (_t = config == null ? void 0 : config.features) == null ? void 0 : _t.enableGradients) != null ? _u : defaultAggUiConfig.features.enableGradients
|
|
1006
1034
|
},
|
|
1007
1035
|
market: {
|
|
1008
|
-
arbitrageThreshold: (
|
|
1036
|
+
arbitrageThreshold: (_w = (_v = config == null ? void 0 : config.market) == null ? void 0 : _v.arbitrageThreshold) != null ? _w : defaultAggUiConfig.market.arbitrageThreshold
|
|
1009
1037
|
},
|
|
1010
1038
|
chart: {
|
|
1011
|
-
defaultChartTimeRange: (
|
|
1012
|
-
selectedChartTimeRange: (
|
|
1039
|
+
defaultChartTimeRange: (_y = (_x = config == null ? void 0 : config.chart) == null ? void 0 : _x.defaultChartTimeRange) != null ? _y : defaultAggUiConfig.chart.defaultChartTimeRange,
|
|
1040
|
+
selectedChartTimeRange: (_C = (_B = (_z = persisted.chart) == null ? void 0 : _z.selectedChartTimeRange) != null ? _B : (_A = config == null ? void 0 : config.chart) == null ? void 0 : _A.defaultChartTimeRange) != null ? _C : defaultAggUiConfig.chart.defaultChartTimeRange,
|
|
1013
1041
|
setSelectedChartTimeRange: defaultAggUiConfig.chart.setSelectedChartTimeRange
|
|
1014
1042
|
},
|
|
1015
1043
|
formatting: {
|
|
1016
|
-
formatNumber: (
|
|
1017
|
-
formatPercent: (
|
|
1018
|
-
formatCurrency: (
|
|
1019
|
-
formatCompactCurrency: (
|
|
1020
|
-
formatDate: (
|
|
1044
|
+
formatNumber: (_E = (_D = config == null ? void 0 : config.formatting) == null ? void 0 : _D.formatNumber) != null ? _E : formatters.formatNumber,
|
|
1045
|
+
formatPercent: (_G = (_F = config == null ? void 0 : config.formatting) == null ? void 0 : _F.formatPercent) != null ? _G : formatters.formatPercent,
|
|
1046
|
+
formatCurrency: (_I = (_H = config == null ? void 0 : config.formatting) == null ? void 0 : _H.formatCurrency) != null ? _I : formatters.formatCurrency,
|
|
1047
|
+
formatCompactCurrency: (_K = (_J = config == null ? void 0 : config.formatting) == null ? void 0 : _J.formatCompactCurrency) != null ? _K : formatters.formatCompactCurrency,
|
|
1048
|
+
formatDate: (_M = (_L = config == null ? void 0 : config.formatting) == null ? void 0 : _L.formatDate) != null ? _M : formatters.formatDate
|
|
1021
1049
|
},
|
|
1022
1050
|
search: mergeAggUiSearchConfig(config == null ? void 0 : config.search),
|
|
1023
1051
|
walletActions: config == null ? void 0 : config.walletActions,
|
package/dist/deposit.js
CHANGED
|
@@ -369,21 +369,37 @@ var enUsLabels = {
|
|
|
369
369
|
withdrawalTitle: (tokenSymbol) => `Withdraw ${tokenSymbol}`
|
|
370
370
|
},
|
|
371
371
|
positions: {
|
|
372
|
+
activeFilter: "Active",
|
|
373
|
+
closedFilter: "Closed",
|
|
374
|
+
marketHeader: "Market",
|
|
372
375
|
totalTradedHeader: "Total traded",
|
|
376
|
+
currentValueHeader: "Current value",
|
|
377
|
+
statusHeader: "Status",
|
|
378
|
+
resolutionHeader: "Resolution",
|
|
379
|
+
payoutHeader: "Payout",
|
|
380
|
+
resultHeader: "Result",
|
|
373
381
|
amountWonHeader: "Amount won",
|
|
374
382
|
claimHeader: "Claim",
|
|
375
383
|
claim: "Claim",
|
|
376
384
|
claimed: "Claimed",
|
|
377
385
|
pending: "Pending",
|
|
386
|
+
open: "Open",
|
|
378
387
|
won: "Won",
|
|
379
388
|
lost: "Lost",
|
|
389
|
+
sold: "Sold",
|
|
380
390
|
resolved: "Resolved",
|
|
381
391
|
marketClosed: "Market closed",
|
|
382
|
-
closed: "Closed"
|
|
392
|
+
closed: "Closed",
|
|
393
|
+
searchPlaceholder: "Search...",
|
|
394
|
+
noResults: "No results",
|
|
395
|
+
avgPrefix: "avg",
|
|
396
|
+
nowPrefix: "now",
|
|
397
|
+
finalPrefix: "final"
|
|
383
398
|
}
|
|
384
399
|
},
|
|
385
400
|
eventList: {
|
|
386
401
|
matchedTab: "Matched",
|
|
402
|
+
allTab: "All",
|
|
387
403
|
loading: (title) => `Loading ${title}`,
|
|
388
404
|
tabsAria: (title) => `${title} tabs`,
|
|
389
405
|
emptyAria: "No events found",
|
|
@@ -512,9 +528,11 @@ var enUsLabels = {
|
|
|
512
528
|
settlementDescriptionLabel: "Description",
|
|
513
529
|
settlementRulesPrimaryLabel: "Resolution rules",
|
|
514
530
|
settlementRulesSecondaryLabel: "Additional rules",
|
|
531
|
+
settlementPrimaryRulesLabel: "Resolution rules",
|
|
532
|
+
settlementEmpty: "No settlement details available.",
|
|
515
533
|
disclaimer: "By trading, you agree to the Terms of Use of each exchange.",
|
|
516
534
|
geoBlockTermsLink: "Terms of Use",
|
|
517
|
-
geoBlockGenericMessage: "
|
|
535
|
+
geoBlockGenericMessage: "None of the venues for this market are available in your region. See ",
|
|
518
536
|
geoBlockVenueMessage: (venueLabel) => `Trading on ${venueLabel} is not available in your region. See `,
|
|
519
537
|
geoBlockMessageSuffix: " for more information.",
|
|
520
538
|
geoBlockModalAriaLabel: "Geo-restricted location",
|
|
@@ -530,6 +548,7 @@ var enUsLabels = {
|
|
|
530
548
|
minimumFractionDigits: Number.isInteger(value) ? 0 : 2,
|
|
531
549
|
maximumFractionDigits: 6
|
|
532
550
|
})} shares`,
|
|
551
|
+
maxShares: "Max",
|
|
533
552
|
slippage: (value) => `Slippage: ${value}%`,
|
|
534
553
|
editSlippage: (value) => `Edit ${value}`,
|
|
535
554
|
collapseSlippage: (value) => `Collapse ${value}`,
|
|
@@ -576,7 +595,8 @@ var enUsLabels = {
|
|
|
576
595
|
insufficientPositionGeneric: "You don't have enough shares to sell.",
|
|
577
596
|
insufficientSellDepth: "Not enough bid liquidity on the matched venues for this sell amount.",
|
|
578
597
|
noBidsAboveMinPrice: "No venue bids above the minimum price.",
|
|
579
|
-
|
|
598
|
+
signInToTrade: "Sign in to trade",
|
|
599
|
+
deposit: "Deposit",
|
|
580
600
|
kycRequired: "Verify to trade Kalshi",
|
|
581
601
|
kycNotVerifiedTooltip: "You have not been verified yet",
|
|
582
602
|
kycVerifyModalTitle: "Verify Your Identity",
|
|
@@ -591,8 +611,14 @@ var enUsLabels = {
|
|
|
591
611
|
orderSplitting: "Order Splitting",
|
|
592
612
|
splitOrderDescription: "We split your order for the best price:",
|
|
593
613
|
viewAllRoutes: (count) => `View all (${count})`,
|
|
594
|
-
hideRoutes: "Hide routes",
|
|
595
614
|
venueUnavailableInRegion: "Unavailable in your region",
|
|
615
|
+
platformFee: "0% platform fees",
|
|
616
|
+
estimatedFees: "Estimated fees",
|
|
617
|
+
estimatedFeesTooltipAria: "Estimated fees breakdown",
|
|
618
|
+
feeBreakdownVenueFees: "Venue fees",
|
|
619
|
+
feeBreakdownBridgeFees: "Bridge fees",
|
|
620
|
+
feeBreakdownExecutionGas: "Execution gas",
|
|
621
|
+
feeBreakdownTotalFees: "Total fees",
|
|
596
622
|
toWin: (tab) => tab === "buy" ? "To win" : "Payout",
|
|
597
623
|
buyingOutcome: (label) => `Buying ${label}`,
|
|
598
624
|
sellingOutcome: (label) => `Selling ${label}`,
|
|
@@ -844,6 +870,7 @@ var defaultAggUiConfig = {
|
|
|
844
870
|
features: {
|
|
845
871
|
enableAnimations: true,
|
|
846
872
|
enableLiveUpdates: true,
|
|
873
|
+
showFeesBreakdown: false,
|
|
847
874
|
enableGradients: false
|
|
848
875
|
},
|
|
849
876
|
market: {
|
package/dist/deposit.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useRampQuotes,
|
|
3
3
|
useRampSession
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FKTRXKYA.mjs";
|
|
5
5
|
import {
|
|
6
6
|
__async,
|
|
7
7
|
getWalletAddressFromUserProfile,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
useAggUiConfig,
|
|
11
11
|
useDepositAddresses,
|
|
12
12
|
useSyncBalances
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-U3DRHUR5.mjs";
|
|
14
14
|
|
|
15
15
|
// src/deposit/normalize-wallet-error.ts
|
|
16
16
|
function normalizeWalletError(error, supportedChains) {
|
package/dist/index.d.mts
CHANGED
|
@@ -101,6 +101,7 @@ type UserProfile = {
|
|
|
101
101
|
kycStatus: string;
|
|
102
102
|
}[] | null;
|
|
103
103
|
};
|
|
104
|
+
type PriceSource = "orderbook" | "cached" | "entry" | "settled";
|
|
104
105
|
type UnifiedBalanceResponse = {
|
|
105
106
|
cash: {
|
|
106
107
|
tokenSymbol: string;
|
|
@@ -182,6 +183,7 @@ type PositionGroup = {
|
|
|
182
183
|
currentPrice: number;
|
|
183
184
|
totalValue: number;
|
|
184
185
|
unrealizedPnlPercent: number;
|
|
186
|
+
priceSource: PriceSource;
|
|
185
187
|
}[];
|
|
186
188
|
};
|
|
187
189
|
targetMarketId: string;
|
|
@@ -593,21 +595,37 @@ interface AggUiLabels {
|
|
|
593
595
|
withdrawalTitle: (tokenSymbol: string) => string;
|
|
594
596
|
};
|
|
595
597
|
positions: {
|
|
598
|
+
activeFilter: string;
|
|
599
|
+
closedFilter: string;
|
|
600
|
+
marketHeader: string;
|
|
596
601
|
totalTradedHeader: string;
|
|
602
|
+
currentValueHeader: string;
|
|
603
|
+
statusHeader: string;
|
|
604
|
+
resolutionHeader: string;
|
|
605
|
+
payoutHeader: string;
|
|
606
|
+
resultHeader: string;
|
|
597
607
|
amountWonHeader: string;
|
|
598
608
|
claimHeader: string;
|
|
599
609
|
claim: string;
|
|
600
610
|
claimed: string;
|
|
601
611
|
pending: string;
|
|
612
|
+
open: string;
|
|
602
613
|
won: string;
|
|
603
614
|
lost: string;
|
|
615
|
+
sold: string;
|
|
604
616
|
resolved: string;
|
|
605
617
|
marketClosed: string;
|
|
606
618
|
closed: string;
|
|
619
|
+
searchPlaceholder: string;
|
|
620
|
+
noResults: string;
|
|
621
|
+
avgPrefix: string;
|
|
622
|
+
nowPrefix: string;
|
|
623
|
+
finalPrefix: string;
|
|
607
624
|
};
|
|
608
625
|
};
|
|
609
626
|
eventList: {
|
|
610
627
|
matchedTab: string;
|
|
628
|
+
allTab: string;
|
|
611
629
|
loading: (title: string) => string;
|
|
612
630
|
tabsAria: (title: string) => string;
|
|
613
631
|
emptyAria: string;
|
|
@@ -736,6 +754,8 @@ interface AggUiLabels {
|
|
|
736
754
|
settlementDescriptionLabel: string;
|
|
737
755
|
settlementRulesPrimaryLabel: string;
|
|
738
756
|
settlementRulesSecondaryLabel: string;
|
|
757
|
+
settlementPrimaryRulesLabel: string;
|
|
758
|
+
settlementEmpty: string;
|
|
739
759
|
disclaimer: string;
|
|
740
760
|
geoBlockTermsLink: string;
|
|
741
761
|
geoBlockGenericMessage: string;
|
|
@@ -748,6 +768,7 @@ interface AggUiLabels {
|
|
|
748
768
|
averagePrice: (value: number) => string;
|
|
749
769
|
balance: (value: string) => string;
|
|
750
770
|
shares: (value: number) => string;
|
|
771
|
+
maxShares: string;
|
|
751
772
|
slippage: (value: number) => string;
|
|
752
773
|
editSlippage: (value: string) => string;
|
|
753
774
|
collapseSlippage: (value: string) => string;
|
|
@@ -794,7 +815,8 @@ interface AggUiLabels {
|
|
|
794
815
|
insufficientPositionGeneric: string;
|
|
795
816
|
insufficientSellDepth: string;
|
|
796
817
|
noBidsAboveMinPrice: string;
|
|
797
|
-
|
|
818
|
+
signInToTrade: string;
|
|
819
|
+
deposit: string;
|
|
798
820
|
kycRequired: string;
|
|
799
821
|
kycNotVerifiedTooltip: string;
|
|
800
822
|
kycVerifyModalTitle: string;
|
|
@@ -809,8 +831,14 @@ interface AggUiLabels {
|
|
|
809
831
|
orderSplitting: string;
|
|
810
832
|
splitOrderDescription: string;
|
|
811
833
|
viewAllRoutes: (count: number) => string;
|
|
812
|
-
hideRoutes: string;
|
|
813
834
|
venueUnavailableInRegion: string;
|
|
835
|
+
platformFee: string;
|
|
836
|
+
estimatedFees: string;
|
|
837
|
+
estimatedFeesTooltipAria: string;
|
|
838
|
+
feeBreakdownVenueFees: string;
|
|
839
|
+
feeBreakdownBridgeFees: string;
|
|
840
|
+
feeBreakdownExecutionGas: string;
|
|
841
|
+
feeBreakdownTotalFees: string;
|
|
814
842
|
toWin: (tab: "buy" | "sell") => string;
|
|
815
843
|
buyingOutcome: (label: string) => string;
|
|
816
844
|
sellingOutcome: (label: string) => string;
|
|
@@ -1009,6 +1037,8 @@ interface AggUiFeatureFlagsConfig {
|
|
|
1009
1037
|
enableAnimations: boolean;
|
|
1010
1038
|
/** Enable live updates */
|
|
1011
1039
|
enableLiveUpdates: boolean;
|
|
1040
|
+
/** Enable fee UI in trading flows */
|
|
1041
|
+
showFeesBreakdown: boolean;
|
|
1012
1042
|
/** Enable gradients */
|
|
1013
1043
|
enableGradients: boolean;
|
|
1014
1044
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -101,6 +101,7 @@ type UserProfile = {
|
|
|
101
101
|
kycStatus: string;
|
|
102
102
|
}[] | null;
|
|
103
103
|
};
|
|
104
|
+
type PriceSource = "orderbook" | "cached" | "entry" | "settled";
|
|
104
105
|
type UnifiedBalanceResponse = {
|
|
105
106
|
cash: {
|
|
106
107
|
tokenSymbol: string;
|
|
@@ -182,6 +183,7 @@ type PositionGroup = {
|
|
|
182
183
|
currentPrice: number;
|
|
183
184
|
totalValue: number;
|
|
184
185
|
unrealizedPnlPercent: number;
|
|
186
|
+
priceSource: PriceSource;
|
|
185
187
|
}[];
|
|
186
188
|
};
|
|
187
189
|
targetMarketId: string;
|
|
@@ -593,21 +595,37 @@ interface AggUiLabels {
|
|
|
593
595
|
withdrawalTitle: (tokenSymbol: string) => string;
|
|
594
596
|
};
|
|
595
597
|
positions: {
|
|
598
|
+
activeFilter: string;
|
|
599
|
+
closedFilter: string;
|
|
600
|
+
marketHeader: string;
|
|
596
601
|
totalTradedHeader: string;
|
|
602
|
+
currentValueHeader: string;
|
|
603
|
+
statusHeader: string;
|
|
604
|
+
resolutionHeader: string;
|
|
605
|
+
payoutHeader: string;
|
|
606
|
+
resultHeader: string;
|
|
597
607
|
amountWonHeader: string;
|
|
598
608
|
claimHeader: string;
|
|
599
609
|
claim: string;
|
|
600
610
|
claimed: string;
|
|
601
611
|
pending: string;
|
|
612
|
+
open: string;
|
|
602
613
|
won: string;
|
|
603
614
|
lost: string;
|
|
615
|
+
sold: string;
|
|
604
616
|
resolved: string;
|
|
605
617
|
marketClosed: string;
|
|
606
618
|
closed: string;
|
|
619
|
+
searchPlaceholder: string;
|
|
620
|
+
noResults: string;
|
|
621
|
+
avgPrefix: string;
|
|
622
|
+
nowPrefix: string;
|
|
623
|
+
finalPrefix: string;
|
|
607
624
|
};
|
|
608
625
|
};
|
|
609
626
|
eventList: {
|
|
610
627
|
matchedTab: string;
|
|
628
|
+
allTab: string;
|
|
611
629
|
loading: (title: string) => string;
|
|
612
630
|
tabsAria: (title: string) => string;
|
|
613
631
|
emptyAria: string;
|
|
@@ -736,6 +754,8 @@ interface AggUiLabels {
|
|
|
736
754
|
settlementDescriptionLabel: string;
|
|
737
755
|
settlementRulesPrimaryLabel: string;
|
|
738
756
|
settlementRulesSecondaryLabel: string;
|
|
757
|
+
settlementPrimaryRulesLabel: string;
|
|
758
|
+
settlementEmpty: string;
|
|
739
759
|
disclaimer: string;
|
|
740
760
|
geoBlockTermsLink: string;
|
|
741
761
|
geoBlockGenericMessage: string;
|
|
@@ -748,6 +768,7 @@ interface AggUiLabels {
|
|
|
748
768
|
averagePrice: (value: number) => string;
|
|
749
769
|
balance: (value: string) => string;
|
|
750
770
|
shares: (value: number) => string;
|
|
771
|
+
maxShares: string;
|
|
751
772
|
slippage: (value: number) => string;
|
|
752
773
|
editSlippage: (value: string) => string;
|
|
753
774
|
collapseSlippage: (value: string) => string;
|
|
@@ -794,7 +815,8 @@ interface AggUiLabels {
|
|
|
794
815
|
insufficientPositionGeneric: string;
|
|
795
816
|
insufficientSellDepth: string;
|
|
796
817
|
noBidsAboveMinPrice: string;
|
|
797
|
-
|
|
818
|
+
signInToTrade: string;
|
|
819
|
+
deposit: string;
|
|
798
820
|
kycRequired: string;
|
|
799
821
|
kycNotVerifiedTooltip: string;
|
|
800
822
|
kycVerifyModalTitle: string;
|
|
@@ -809,8 +831,14 @@ interface AggUiLabels {
|
|
|
809
831
|
orderSplitting: string;
|
|
810
832
|
splitOrderDescription: string;
|
|
811
833
|
viewAllRoutes: (count: number) => string;
|
|
812
|
-
hideRoutes: string;
|
|
813
834
|
venueUnavailableInRegion: string;
|
|
835
|
+
platformFee: string;
|
|
836
|
+
estimatedFees: string;
|
|
837
|
+
estimatedFeesTooltipAria: string;
|
|
838
|
+
feeBreakdownVenueFees: string;
|
|
839
|
+
feeBreakdownBridgeFees: string;
|
|
840
|
+
feeBreakdownExecutionGas: string;
|
|
841
|
+
feeBreakdownTotalFees: string;
|
|
814
842
|
toWin: (tab: "buy" | "sell") => string;
|
|
815
843
|
buyingOutcome: (label: string) => string;
|
|
816
844
|
sellingOutcome: (label: string) => string;
|
|
@@ -1009,6 +1037,8 @@ interface AggUiFeatureFlagsConfig {
|
|
|
1009
1037
|
enableAnimations: boolean;
|
|
1010
1038
|
/** Enable live updates */
|
|
1011
1039
|
enableLiveUpdates: boolean;
|
|
1040
|
+
/** Enable fee UI in trading flows */
|
|
1041
|
+
showFeesBreakdown: boolean;
|
|
1012
1042
|
/** Enable gradients */
|
|
1013
1043
|
enableGradients: boolean;
|
|
1014
1044
|
}
|
package/dist/index.js
CHANGED
|
@@ -741,21 +741,37 @@ var enUsLabels = {
|
|
|
741
741
|
withdrawalTitle: (tokenSymbol) => `Withdraw ${tokenSymbol}`
|
|
742
742
|
},
|
|
743
743
|
positions: {
|
|
744
|
+
activeFilter: "Active",
|
|
745
|
+
closedFilter: "Closed",
|
|
746
|
+
marketHeader: "Market",
|
|
744
747
|
totalTradedHeader: "Total traded",
|
|
748
|
+
currentValueHeader: "Current value",
|
|
749
|
+
statusHeader: "Status",
|
|
750
|
+
resolutionHeader: "Resolution",
|
|
751
|
+
payoutHeader: "Payout",
|
|
752
|
+
resultHeader: "Result",
|
|
745
753
|
amountWonHeader: "Amount won",
|
|
746
754
|
claimHeader: "Claim",
|
|
747
755
|
claim: "Claim",
|
|
748
756
|
claimed: "Claimed",
|
|
749
757
|
pending: "Pending",
|
|
758
|
+
open: "Open",
|
|
750
759
|
won: "Won",
|
|
751
760
|
lost: "Lost",
|
|
761
|
+
sold: "Sold",
|
|
752
762
|
resolved: "Resolved",
|
|
753
763
|
marketClosed: "Market closed",
|
|
754
|
-
closed: "Closed"
|
|
764
|
+
closed: "Closed",
|
|
765
|
+
searchPlaceholder: "Search...",
|
|
766
|
+
noResults: "No results",
|
|
767
|
+
avgPrefix: "avg",
|
|
768
|
+
nowPrefix: "now",
|
|
769
|
+
finalPrefix: "final"
|
|
755
770
|
}
|
|
756
771
|
},
|
|
757
772
|
eventList: {
|
|
758
773
|
matchedTab: "Matched",
|
|
774
|
+
allTab: "All",
|
|
759
775
|
loading: (title) => `Loading ${title}`,
|
|
760
776
|
tabsAria: (title) => `${title} tabs`,
|
|
761
777
|
emptyAria: "No events found",
|
|
@@ -884,9 +900,11 @@ var enUsLabels = {
|
|
|
884
900
|
settlementDescriptionLabel: "Description",
|
|
885
901
|
settlementRulesPrimaryLabel: "Resolution rules",
|
|
886
902
|
settlementRulesSecondaryLabel: "Additional rules",
|
|
903
|
+
settlementPrimaryRulesLabel: "Resolution rules",
|
|
904
|
+
settlementEmpty: "No settlement details available.",
|
|
887
905
|
disclaimer: "By trading, you agree to the Terms of Use of each exchange.",
|
|
888
906
|
geoBlockTermsLink: "Terms of Use",
|
|
889
|
-
geoBlockGenericMessage: "
|
|
907
|
+
geoBlockGenericMessage: "None of the venues for this market are available in your region. See ",
|
|
890
908
|
geoBlockVenueMessage: (venueLabel) => `Trading on ${venueLabel} is not available in your region. See `,
|
|
891
909
|
geoBlockMessageSuffix: " for more information.",
|
|
892
910
|
geoBlockModalAriaLabel: "Geo-restricted location",
|
|
@@ -902,6 +920,7 @@ var enUsLabels = {
|
|
|
902
920
|
minimumFractionDigits: Number.isInteger(value) ? 0 : 2,
|
|
903
921
|
maximumFractionDigits: 6
|
|
904
922
|
})} shares`,
|
|
923
|
+
maxShares: "Max",
|
|
905
924
|
slippage: (value) => `Slippage: ${value}%`,
|
|
906
925
|
editSlippage: (value) => `Edit ${value}`,
|
|
907
926
|
collapseSlippage: (value) => `Collapse ${value}`,
|
|
@@ -948,7 +967,8 @@ var enUsLabels = {
|
|
|
948
967
|
insufficientPositionGeneric: "You don't have enough shares to sell.",
|
|
949
968
|
insufficientSellDepth: "Not enough bid liquidity on the matched venues for this sell amount.",
|
|
950
969
|
noBidsAboveMinPrice: "No venue bids above the minimum price.",
|
|
951
|
-
|
|
970
|
+
signInToTrade: "Sign in to trade",
|
|
971
|
+
deposit: "Deposit",
|
|
952
972
|
kycRequired: "Verify to trade Kalshi",
|
|
953
973
|
kycNotVerifiedTooltip: "You have not been verified yet",
|
|
954
974
|
kycVerifyModalTitle: "Verify Your Identity",
|
|
@@ -963,8 +983,14 @@ var enUsLabels = {
|
|
|
963
983
|
orderSplitting: "Order Splitting",
|
|
964
984
|
splitOrderDescription: "We split your order for the best price:",
|
|
965
985
|
viewAllRoutes: (count) => `View all (${count})`,
|
|
966
|
-
hideRoutes: "Hide routes",
|
|
967
986
|
venueUnavailableInRegion: "Unavailable in your region",
|
|
987
|
+
platformFee: "0% platform fees",
|
|
988
|
+
estimatedFees: "Estimated fees",
|
|
989
|
+
estimatedFeesTooltipAria: "Estimated fees breakdown",
|
|
990
|
+
feeBreakdownVenueFees: "Venue fees",
|
|
991
|
+
feeBreakdownBridgeFees: "Bridge fees",
|
|
992
|
+
feeBreakdownExecutionGas: "Execution gas",
|
|
993
|
+
feeBreakdownTotalFees: "Total fees",
|
|
968
994
|
toWin: (tab) => tab === "buy" ? "To win" : "Payout",
|
|
969
995
|
buyingOutcome: (label) => `Buying ${label}`,
|
|
970
996
|
sellingOutcome: (label) => `Selling ${label}`,
|
|
@@ -1236,6 +1262,7 @@ var defaultAggUiConfig = {
|
|
|
1236
1262
|
features: {
|
|
1237
1263
|
enableAnimations: true,
|
|
1238
1264
|
enableLiveUpdates: true,
|
|
1265
|
+
showFeesBreakdown: false,
|
|
1239
1266
|
enableGradients: false
|
|
1240
1267
|
},
|
|
1241
1268
|
market: {
|
|
@@ -1263,7 +1290,7 @@ var mergeAggUiSearchConfig = (config) => {
|
|
|
1263
1290
|
};
|
|
1264
1291
|
};
|
|
1265
1292
|
var mergeAggUiConfig = (persisted, config) => {
|
|
1266
|
-
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;
|
|
1293
|
+
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;
|
|
1267
1294
|
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;
|
|
1268
1295
|
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;
|
|
1269
1296
|
const formatters = createFormatters(locale);
|
|
@@ -1280,22 +1307,23 @@ var mergeAggUiConfig = (persisted, config) => {
|
|
|
1280
1307
|
features: {
|
|
1281
1308
|
enableAnimations: (_o = (_n = config == null ? void 0 : config.features) == null ? void 0 : _n.enableAnimations) != null ? _o : defaultAggUiConfig.features.enableAnimations,
|
|
1282
1309
|
enableLiveUpdates: (_q = (_p = config == null ? void 0 : config.features) == null ? void 0 : _p.enableLiveUpdates) != null ? _q : defaultAggUiConfig.features.enableLiveUpdates,
|
|
1283
|
-
|
|
1310
|
+
showFeesBreakdown: (_s = (_r = config == null ? void 0 : config.features) == null ? void 0 : _r.showFeesBreakdown) != null ? _s : defaultAggUiConfig.features.showFeesBreakdown,
|
|
1311
|
+
enableGradients: (_u = (_t = config == null ? void 0 : config.features) == null ? void 0 : _t.enableGradients) != null ? _u : defaultAggUiConfig.features.enableGradients
|
|
1284
1312
|
},
|
|
1285
1313
|
market: {
|
|
1286
|
-
arbitrageThreshold: (
|
|
1314
|
+
arbitrageThreshold: (_w = (_v = config == null ? void 0 : config.market) == null ? void 0 : _v.arbitrageThreshold) != null ? _w : defaultAggUiConfig.market.arbitrageThreshold
|
|
1287
1315
|
},
|
|
1288
1316
|
chart: {
|
|
1289
|
-
defaultChartTimeRange: (
|
|
1290
|
-
selectedChartTimeRange: (
|
|
1317
|
+
defaultChartTimeRange: (_y = (_x = config == null ? void 0 : config.chart) == null ? void 0 : _x.defaultChartTimeRange) != null ? _y : defaultAggUiConfig.chart.defaultChartTimeRange,
|
|
1318
|
+
selectedChartTimeRange: (_C = (_B = (_z = persisted.chart) == null ? void 0 : _z.selectedChartTimeRange) != null ? _B : (_A = config == null ? void 0 : config.chart) == null ? void 0 : _A.defaultChartTimeRange) != null ? _C : defaultAggUiConfig.chart.defaultChartTimeRange,
|
|
1291
1319
|
setSelectedChartTimeRange: defaultAggUiConfig.chart.setSelectedChartTimeRange
|
|
1292
1320
|
},
|
|
1293
1321
|
formatting: {
|
|
1294
|
-
formatNumber: (
|
|
1295
|
-
formatPercent: (
|
|
1296
|
-
formatCurrency: (
|
|
1297
|
-
formatCompactCurrency: (
|
|
1298
|
-
formatDate: (
|
|
1322
|
+
formatNumber: (_E = (_D = config == null ? void 0 : config.formatting) == null ? void 0 : _D.formatNumber) != null ? _E : formatters.formatNumber,
|
|
1323
|
+
formatPercent: (_G = (_F = config == null ? void 0 : config.formatting) == null ? void 0 : _F.formatPercent) != null ? _G : formatters.formatPercent,
|
|
1324
|
+
formatCurrency: (_I = (_H = config == null ? void 0 : config.formatting) == null ? void 0 : _H.formatCurrency) != null ? _I : formatters.formatCurrency,
|
|
1325
|
+
formatCompactCurrency: (_K = (_J = config == null ? void 0 : config.formatting) == null ? void 0 : _J.formatCompactCurrency) != null ? _K : formatters.formatCompactCurrency,
|
|
1326
|
+
formatDate: (_M = (_L = config == null ? void 0 : config.formatting) == null ? void 0 : _L.formatDate) != null ? _M : formatters.formatDate
|
|
1299
1327
|
},
|
|
1300
1328
|
search: mergeAggUiSearchConfig(config == null ? void 0 : config.search),
|
|
1301
1329
|
walletActions: config == null ? void 0 : config.walletActions,
|
|
@@ -3793,7 +3821,7 @@ var parseTokenAmountToRaw = (amount, decimals) => {
|
|
|
3793
3821
|
return null;
|
|
3794
3822
|
}
|
|
3795
3823
|
};
|
|
3796
|
-
var shortenAddress = (address) => address.length > 12 ? `${address.slice(0, 6)}
|
|
3824
|
+
var shortenAddress = (address) => address.length > 12 ? `${address.slice(0, 6)}...${address.slice(-4)}` : address;
|
|
3797
3825
|
function useWithdrawFlow(options) {
|
|
3798
3826
|
var _a, _b;
|
|
3799
3827
|
const { open, onOpenChange } = options;
|
|
@@ -5767,6 +5795,12 @@ function computePriceGaps(input) {
|
|
|
5767
5795
|
|
|
5768
5796
|
// src/use-viewport-midpoints.ts
|
|
5769
5797
|
var import_react29 = require("react");
|
|
5798
|
+
var normalizeOutcomeLabel = (value) => value.trim().toLowerCase();
|
|
5799
|
+
var resolveYesMidpoint = (outcomes) => {
|
|
5800
|
+
if (!(outcomes == null ? void 0 : outcomes.length)) return void 0;
|
|
5801
|
+
const yesOutcome = outcomes.find((outcome) => normalizeOutcomeLabel(outcome.label) === "yes");
|
|
5802
|
+
return yesOutcome == null ? void 0 : yesOutcome.midpoint;
|
|
5803
|
+
};
|
|
5770
5804
|
var resolveUncachedVisibleMarketIds = (visibleMarkets, cache, inFlightIds) => {
|
|
5771
5805
|
const idsToFetch = [];
|
|
5772
5806
|
for (const market of visibleMarkets) {
|
|
@@ -5782,8 +5816,9 @@ var buildCachedMidpointEntries = (requestedVenueMarketIds, rows) => {
|
|
|
5782
5816
|
const nextCacheEntries = /* @__PURE__ */ new Map();
|
|
5783
5817
|
for (const venueMarketId of requestedVenueMarketIds) {
|
|
5784
5818
|
const item = rowsByVenueMarketId.get(venueMarketId);
|
|
5785
|
-
|
|
5786
|
-
|
|
5819
|
+
const yesMidpoint = resolveYesMidpoint(item == null ? void 0 : item.outcomes);
|
|
5820
|
+
nextCacheEntries.set(venueMarketId, __spreadProps(__spreadValues({}, (item == null ? void 0 : item.venue) ? { venue: item.venue } : {}), {
|
|
5821
|
+
midpoint: (_a = yesMidpoint != null ? yesMidpoint : item == null ? void 0 : item.midpoint) != null ? _a : null,
|
|
5787
5822
|
spread: (_b = item == null ? void 0 : item.spread) != null ? _b : null,
|
|
5788
5823
|
matched: ((_c = item == null ? void 0 : item.matched) != null ? _c : []).map((matched) => {
|
|
5789
5824
|
var _a2, _b2;
|
|
@@ -5793,7 +5828,7 @@ var buildCachedMidpointEntries = (requestedVenueMarketIds, rows) => {
|
|
|
5793
5828
|
spread: (_b2 = matched.spread) != null ? _b2 : null
|
|
5794
5829
|
}, matched.venue ? { venue: matched.venue } : {});
|
|
5795
5830
|
})
|
|
5796
|
-
});
|
|
5831
|
+
}));
|
|
5797
5832
|
}
|
|
5798
5833
|
return nextCacheEntries;
|
|
5799
5834
|
};
|
|
@@ -5832,24 +5867,26 @@ function useViewportMidpoints(visibleMarkets) {
|
|
|
5832
5867
|
};
|
|
5833
5868
|
}, [visibleFp, cache]);
|
|
5834
5869
|
const { prices, venueByOutcomeId } = (0, import_react29.useMemo)(() => {
|
|
5835
|
-
var _a, _b;
|
|
5870
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5836
5871
|
const map = /* @__PURE__ */ new Map();
|
|
5837
5872
|
const venueMap = /* @__PURE__ */ new Map();
|
|
5838
5873
|
for (const market of visibleMarkets) {
|
|
5839
5874
|
const entry = cache.get(market.id);
|
|
5840
5875
|
if (!entry) continue;
|
|
5841
5876
|
let mid = entry.midpoint;
|
|
5842
|
-
let midVenue = market.venue;
|
|
5877
|
+
let midVenue = (_a = entry.venue) != null ? _a : market.venue;
|
|
5843
5878
|
for (const m of entry.matched) {
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5879
|
+
const matchedFromCache = (_b = cache.get(m.venueMarketId)) == null ? void 0 : _b.midpoint;
|
|
5880
|
+
const candidateMidpoint = matchedFromCache != null ? matchedFromCache : m.midpoint;
|
|
5881
|
+
if (candidateMidpoint == null) continue;
|
|
5882
|
+
if (mid == null || candidateMidpoint < mid) {
|
|
5883
|
+
mid = candidateMidpoint;
|
|
5884
|
+
midVenue = (_e = (_d = (_c = cache.get(m.venueMarketId)) == null ? void 0 : _c.venue) != null ? _d : m.venue) != null ? _e : market.venue;
|
|
5848
5885
|
}
|
|
5849
5886
|
}
|
|
5850
5887
|
if (mid == null) continue;
|
|
5851
5888
|
for (const outcome of market.venueMarketOutcomes) {
|
|
5852
|
-
const isYes = ((
|
|
5889
|
+
const isYes = ((_f = outcome.label) == null ? void 0 : _f.toLowerCase()) === "yes";
|
|
5853
5890
|
map.set(outcome.id, isYes ? mid : 1 - mid);
|
|
5854
5891
|
venueMap.set(outcome.id, midVenue);
|
|
5855
5892
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useRampQuotes,
|
|
3
3
|
useRampSession
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FKTRXKYA.mjs";
|
|
5
5
|
import {
|
|
6
6
|
useWithdrawFlow,
|
|
7
7
|
useWithdrawalLifecycle
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KSSPFJM2.mjs";
|
|
9
9
|
import {
|
|
10
10
|
AggAuthContext,
|
|
11
11
|
AggBalanceProvider,
|
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
useSdkUiConfig,
|
|
83
83
|
useSyncBalances,
|
|
84
84
|
useWithdrawManaged
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-U3DRHUR5.mjs";
|
|
86
86
|
|
|
87
87
|
// src/index.ts
|
|
88
88
|
import { QueryClient as QueryClient4, QueryClientProvider, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
@@ -1755,6 +1755,12 @@ function computePriceGaps(input) {
|
|
|
1755
1755
|
|
|
1756
1756
|
// src/use-viewport-midpoints.ts
|
|
1757
1757
|
import { useEffect as useEffect8, useMemo as useMemo10, useRef as useRef4, useState as useState7 } from "react";
|
|
1758
|
+
var normalizeOutcomeLabel = (value) => value.trim().toLowerCase();
|
|
1759
|
+
var resolveYesMidpoint = (outcomes) => {
|
|
1760
|
+
if (!(outcomes == null ? void 0 : outcomes.length)) return void 0;
|
|
1761
|
+
const yesOutcome = outcomes.find((outcome) => normalizeOutcomeLabel(outcome.label) === "yes");
|
|
1762
|
+
return yesOutcome == null ? void 0 : yesOutcome.midpoint;
|
|
1763
|
+
};
|
|
1758
1764
|
var resolveUncachedVisibleMarketIds = (visibleMarkets, cache, inFlightIds) => {
|
|
1759
1765
|
const idsToFetch = [];
|
|
1760
1766
|
for (const market of visibleMarkets) {
|
|
@@ -1770,8 +1776,9 @@ var buildCachedMidpointEntries = (requestedVenueMarketIds, rows) => {
|
|
|
1770
1776
|
const nextCacheEntries = /* @__PURE__ */ new Map();
|
|
1771
1777
|
for (const venueMarketId of requestedVenueMarketIds) {
|
|
1772
1778
|
const item = rowsByVenueMarketId.get(venueMarketId);
|
|
1773
|
-
|
|
1774
|
-
|
|
1779
|
+
const yesMidpoint = resolveYesMidpoint(item == null ? void 0 : item.outcomes);
|
|
1780
|
+
nextCacheEntries.set(venueMarketId, __spreadProps(__spreadValues({}, (item == null ? void 0 : item.venue) ? { venue: item.venue } : {}), {
|
|
1781
|
+
midpoint: (_a = yesMidpoint != null ? yesMidpoint : item == null ? void 0 : item.midpoint) != null ? _a : null,
|
|
1775
1782
|
spread: (_b = item == null ? void 0 : item.spread) != null ? _b : null,
|
|
1776
1783
|
matched: ((_c = item == null ? void 0 : item.matched) != null ? _c : []).map((matched) => {
|
|
1777
1784
|
var _a2, _b2;
|
|
@@ -1781,7 +1788,7 @@ var buildCachedMidpointEntries = (requestedVenueMarketIds, rows) => {
|
|
|
1781
1788
|
spread: (_b2 = matched.spread) != null ? _b2 : null
|
|
1782
1789
|
}, matched.venue ? { venue: matched.venue } : {});
|
|
1783
1790
|
})
|
|
1784
|
-
});
|
|
1791
|
+
}));
|
|
1785
1792
|
}
|
|
1786
1793
|
return nextCacheEntries;
|
|
1787
1794
|
};
|
|
@@ -1820,24 +1827,26 @@ function useViewportMidpoints(visibleMarkets) {
|
|
|
1820
1827
|
};
|
|
1821
1828
|
}, [visibleFp, cache]);
|
|
1822
1829
|
const { prices, venueByOutcomeId } = useMemo10(() => {
|
|
1823
|
-
var _a, _b;
|
|
1830
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1824
1831
|
const map = /* @__PURE__ */ new Map();
|
|
1825
1832
|
const venueMap = /* @__PURE__ */ new Map();
|
|
1826
1833
|
for (const market of visibleMarkets) {
|
|
1827
1834
|
const entry = cache.get(market.id);
|
|
1828
1835
|
if (!entry) continue;
|
|
1829
1836
|
let mid = entry.midpoint;
|
|
1830
|
-
let midVenue = market.venue;
|
|
1837
|
+
let midVenue = (_a = entry.venue) != null ? _a : market.venue;
|
|
1831
1838
|
for (const m of entry.matched) {
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1839
|
+
const matchedFromCache = (_b = cache.get(m.venueMarketId)) == null ? void 0 : _b.midpoint;
|
|
1840
|
+
const candidateMidpoint = matchedFromCache != null ? matchedFromCache : m.midpoint;
|
|
1841
|
+
if (candidateMidpoint == null) continue;
|
|
1842
|
+
if (mid == null || candidateMidpoint < mid) {
|
|
1843
|
+
mid = candidateMidpoint;
|
|
1844
|
+
midVenue = (_e = (_d = (_c = cache.get(m.venueMarketId)) == null ? void 0 : _c.venue) != null ? _d : m.venue) != null ? _e : market.venue;
|
|
1836
1845
|
}
|
|
1837
1846
|
}
|
|
1838
1847
|
if (mid == null) continue;
|
|
1839
1848
|
for (const outcome of market.venueMarketOutcomes) {
|
|
1840
|
-
const isYes = ((
|
|
1849
|
+
const isYes = ((_f = outcome.label) == null ? void 0 : _f.toLowerCase()) === "yes";
|
|
1841
1850
|
map.set(outcome.id, isYes ? mid : 1 - mid);
|
|
1842
1851
|
venueMap.set(outcome.id, midVenue);
|
|
1843
1852
|
}
|
package/dist/withdraw.js
CHANGED
|
@@ -328,21 +328,37 @@ var enUsLabels = {
|
|
|
328
328
|
withdrawalTitle: (tokenSymbol) => `Withdraw ${tokenSymbol}`
|
|
329
329
|
},
|
|
330
330
|
positions: {
|
|
331
|
+
activeFilter: "Active",
|
|
332
|
+
closedFilter: "Closed",
|
|
333
|
+
marketHeader: "Market",
|
|
331
334
|
totalTradedHeader: "Total traded",
|
|
335
|
+
currentValueHeader: "Current value",
|
|
336
|
+
statusHeader: "Status",
|
|
337
|
+
resolutionHeader: "Resolution",
|
|
338
|
+
payoutHeader: "Payout",
|
|
339
|
+
resultHeader: "Result",
|
|
332
340
|
amountWonHeader: "Amount won",
|
|
333
341
|
claimHeader: "Claim",
|
|
334
342
|
claim: "Claim",
|
|
335
343
|
claimed: "Claimed",
|
|
336
344
|
pending: "Pending",
|
|
345
|
+
open: "Open",
|
|
337
346
|
won: "Won",
|
|
338
347
|
lost: "Lost",
|
|
348
|
+
sold: "Sold",
|
|
339
349
|
resolved: "Resolved",
|
|
340
350
|
marketClosed: "Market closed",
|
|
341
|
-
closed: "Closed"
|
|
351
|
+
closed: "Closed",
|
|
352
|
+
searchPlaceholder: "Search...",
|
|
353
|
+
noResults: "No results",
|
|
354
|
+
avgPrefix: "avg",
|
|
355
|
+
nowPrefix: "now",
|
|
356
|
+
finalPrefix: "final"
|
|
342
357
|
}
|
|
343
358
|
},
|
|
344
359
|
eventList: {
|
|
345
360
|
matchedTab: "Matched",
|
|
361
|
+
allTab: "All",
|
|
346
362
|
loading: (title) => `Loading ${title}`,
|
|
347
363
|
tabsAria: (title) => `${title} tabs`,
|
|
348
364
|
emptyAria: "No events found",
|
|
@@ -471,9 +487,11 @@ var enUsLabels = {
|
|
|
471
487
|
settlementDescriptionLabel: "Description",
|
|
472
488
|
settlementRulesPrimaryLabel: "Resolution rules",
|
|
473
489
|
settlementRulesSecondaryLabel: "Additional rules",
|
|
490
|
+
settlementPrimaryRulesLabel: "Resolution rules",
|
|
491
|
+
settlementEmpty: "No settlement details available.",
|
|
474
492
|
disclaimer: "By trading, you agree to the Terms of Use of each exchange.",
|
|
475
493
|
geoBlockTermsLink: "Terms of Use",
|
|
476
|
-
geoBlockGenericMessage: "
|
|
494
|
+
geoBlockGenericMessage: "None of the venues for this market are available in your region. See ",
|
|
477
495
|
geoBlockVenueMessage: (venueLabel) => `Trading on ${venueLabel} is not available in your region. See `,
|
|
478
496
|
geoBlockMessageSuffix: " for more information.",
|
|
479
497
|
geoBlockModalAriaLabel: "Geo-restricted location",
|
|
@@ -489,6 +507,7 @@ var enUsLabels = {
|
|
|
489
507
|
minimumFractionDigits: Number.isInteger(value) ? 0 : 2,
|
|
490
508
|
maximumFractionDigits: 6
|
|
491
509
|
})} shares`,
|
|
510
|
+
maxShares: "Max",
|
|
492
511
|
slippage: (value) => `Slippage: ${value}%`,
|
|
493
512
|
editSlippage: (value) => `Edit ${value}`,
|
|
494
513
|
collapseSlippage: (value) => `Collapse ${value}`,
|
|
@@ -535,7 +554,8 @@ var enUsLabels = {
|
|
|
535
554
|
insufficientPositionGeneric: "You don't have enough shares to sell.",
|
|
536
555
|
insufficientSellDepth: "Not enough bid liquidity on the matched venues for this sell amount.",
|
|
537
556
|
noBidsAboveMinPrice: "No venue bids above the minimum price.",
|
|
538
|
-
|
|
557
|
+
signInToTrade: "Sign in to trade",
|
|
558
|
+
deposit: "Deposit",
|
|
539
559
|
kycRequired: "Verify to trade Kalshi",
|
|
540
560
|
kycNotVerifiedTooltip: "You have not been verified yet",
|
|
541
561
|
kycVerifyModalTitle: "Verify Your Identity",
|
|
@@ -550,8 +570,14 @@ var enUsLabels = {
|
|
|
550
570
|
orderSplitting: "Order Splitting",
|
|
551
571
|
splitOrderDescription: "We split your order for the best price:",
|
|
552
572
|
viewAllRoutes: (count) => `View all (${count})`,
|
|
553
|
-
hideRoutes: "Hide routes",
|
|
554
573
|
venueUnavailableInRegion: "Unavailable in your region",
|
|
574
|
+
platformFee: "0% platform fees",
|
|
575
|
+
estimatedFees: "Estimated fees",
|
|
576
|
+
estimatedFeesTooltipAria: "Estimated fees breakdown",
|
|
577
|
+
feeBreakdownVenueFees: "Venue fees",
|
|
578
|
+
feeBreakdownBridgeFees: "Bridge fees",
|
|
579
|
+
feeBreakdownExecutionGas: "Execution gas",
|
|
580
|
+
feeBreakdownTotalFees: "Total fees",
|
|
555
581
|
toWin: (tab) => tab === "buy" ? "To win" : "Payout",
|
|
556
582
|
buyingOutcome: (label) => `Buying ${label}`,
|
|
557
583
|
sellingOutcome: (label) => `Selling ${label}`,
|
|
@@ -803,6 +829,7 @@ var defaultAggUiConfig = {
|
|
|
803
829
|
features: {
|
|
804
830
|
enableAnimations: true,
|
|
805
831
|
enableLiveUpdates: true,
|
|
832
|
+
showFeesBreakdown: false,
|
|
806
833
|
enableGradients: false
|
|
807
834
|
},
|
|
808
835
|
market: {
|
|
@@ -1079,7 +1106,7 @@ var parseTokenAmountToRaw = (amount, decimals) => {
|
|
|
1079
1106
|
return null;
|
|
1080
1107
|
}
|
|
1081
1108
|
};
|
|
1082
|
-
var shortenAddress = (address) => address.length > 12 ? `${address.slice(0, 6)}
|
|
1109
|
+
var shortenAddress = (address) => address.length > 12 ? `${address.slice(0, 6)}...${address.slice(-4)}` : address;
|
|
1083
1110
|
function useWithdrawFlow(options) {
|
|
1084
1111
|
var _a, _b;
|
|
1085
1112
|
const { open, onOpenChange } = options;
|
package/dist/withdraw.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useWithdrawFlow,
|
|
3
3
|
useWithdrawalLifecycle
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KSSPFJM2.mjs";
|
|
5
5
|
import {
|
|
6
6
|
useDepositAddresses,
|
|
7
7
|
useManagedBalances,
|
|
8
8
|
useWithdrawManaged
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-U3DRHUR5.mjs";
|
|
10
10
|
export {
|
|
11
11
|
useDepositAddresses,
|
|
12
12
|
useManagedBalances,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agg-build/hooks",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.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.0
|
|
86
|
+
"@agg-build/sdk": "^1.2.0"
|
|
87
87
|
},
|
|
88
88
|
"peerDependenciesMeta": {
|
|
89
89
|
"@solana/wallet-adapter-react": {
|