@agg-build/hooks 2.4.6 → 2.6.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-X32MRBHC.mjs → chunk-DP6VYGAX.mjs} +1 -1
- package/dist/{chunk-4IRZFXAC.mjs → chunk-Q4FRCMP6.mjs} +1 -1
- package/dist/{chunk-CAG2RCHR.mjs → chunk-TJRQ55UC.mjs} +239 -46
- package/dist/deposit.js +87 -0
- package/dist/deposit.mjs +2 -2
- package/dist/index.d.mts +209 -4
- package/dist/index.d.ts +209 -4
- package/dist/index.js +467 -132
- package/dist/index.mjs +172 -31
- package/dist/withdraw.js +87 -0
- package/dist/withdraw.mjs +2 -2
- package/package.json +2 -2
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useOnWithdrawalLifecycle,
|
|
12
12
|
useSyncBalances,
|
|
13
13
|
useWithdrawManaged
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-TJRQ55UC.mjs";
|
|
15
15
|
|
|
16
16
|
// src/withdraw/use-withdraw-flow.ts
|
|
17
17
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
@@ -475,8 +475,16 @@ var enUsLabels = {
|
|
|
475
475
|
categoryTabsAria: "Home page category tabs"
|
|
476
476
|
},
|
|
477
477
|
userProfile: {
|
|
478
|
+
tabs: {
|
|
479
|
+
positions: "Positions",
|
|
480
|
+
openOrders: "Open orders",
|
|
481
|
+
activity: "Activity"
|
|
482
|
+
},
|
|
478
483
|
balance: {
|
|
479
484
|
availableBalance: "Available Balance",
|
|
485
|
+
reservedForOpenOrders: (amount) => `${amount} reserved for open orders`,
|
|
486
|
+
positionsValue: "Positions Value",
|
|
487
|
+
kalshiBalance: "Kalshi Balance",
|
|
480
488
|
balanceByNetwork: "Balance by network",
|
|
481
489
|
paperModeNetwork: "Paper",
|
|
482
490
|
paperModeWarning: "Paper mode is enabled. These are simulated funds for paper trading.",
|
|
@@ -559,6 +567,25 @@ var enUsLabels = {
|
|
|
559
567
|
avgPrefix: "avg",
|
|
560
568
|
nowPrefix: "now",
|
|
561
569
|
finalPrefix: "final"
|
|
570
|
+
},
|
|
571
|
+
openOrders: {
|
|
572
|
+
marketHeader: "Market",
|
|
573
|
+
limitPriceHeader: "Limit price",
|
|
574
|
+
filledHeader: "Filled",
|
|
575
|
+
totalHeader: "Total",
|
|
576
|
+
filledShort: "Filled",
|
|
577
|
+
totalShort: "Total",
|
|
578
|
+
expirationHeader: "Expiration",
|
|
579
|
+
goodTilCanceled: "Good 'til canceled",
|
|
580
|
+
expired: "Expired",
|
|
581
|
+
cancel: "Cancel",
|
|
582
|
+
cancelOrderAria: (orderId) => `Cancel order ${orderId}`,
|
|
583
|
+
loading: "Loading open orders",
|
|
584
|
+
loadingMore: "Loading more open orders",
|
|
585
|
+
errorTitle: "Unable to load open orders",
|
|
586
|
+
errorDescription: "Please try again in a moment.",
|
|
587
|
+
emptyTitle: "No open orders",
|
|
588
|
+
emptyDescription: "Your open limit orders will appear here."
|
|
562
589
|
}
|
|
563
590
|
},
|
|
564
591
|
eventList: {
|
|
@@ -792,6 +819,24 @@ var enUsLabels = {
|
|
|
792
819
|
noBidsAboveMinPrice: "No venue bids above the minimum price.",
|
|
793
820
|
signInToTrade: "Sign in to trade",
|
|
794
821
|
deposit: "Deposit",
|
|
822
|
+
addFundsToKalshi: "Add funds to Kalshi",
|
|
823
|
+
fundKalshiModal: {
|
|
824
|
+
ariaLabel: "Fund your Kalshi account",
|
|
825
|
+
title: "Fund Your Kalshi Account",
|
|
826
|
+
description: "Kalshi manages its own account balances, so funds can't be deposited through agg.market. Add funds directly in Kalshi, then return here to trade with your updated balance.",
|
|
827
|
+
howItWorks: "How it works",
|
|
828
|
+
kalshiLinkLabel: "Kalshi",
|
|
829
|
+
kalshiUrl: "https://kalshi.com",
|
|
830
|
+
firstStepPrefix: "Go to",
|
|
831
|
+
firstStepSuffix: "and sign in to your account.",
|
|
832
|
+
remainingSteps: [
|
|
833
|
+
"Click Add Funds.",
|
|
834
|
+
"Complete your deposit using your preferred payment method.",
|
|
835
|
+
"Return here - your Kalshi balance will be available automatically."
|
|
836
|
+
],
|
|
837
|
+
doItLater: "I'll do it later",
|
|
838
|
+
done: "Done"
|
|
839
|
+
},
|
|
795
840
|
kycRequired: "Verify to trade Kalshi",
|
|
796
841
|
kycNotVerifiedTooltip: "You have not been verified yet",
|
|
797
842
|
kycVerify: "Verify Identity",
|
|
@@ -802,8 +847,35 @@ var enUsLabels = {
|
|
|
802
847
|
kycSuccessTitle: "Verification successful",
|
|
803
848
|
kycSuccessDescription: "Your identity has been confirmed and you now have full access to trade on Kalshi markets.",
|
|
804
849
|
kycSuccessDone: "Done",
|
|
850
|
+
connectKalshi: "Connect to trade Kalshi",
|
|
851
|
+
tradingAccessVenues: "Venues",
|
|
852
|
+
tradingAccessAvailable: "Available",
|
|
853
|
+
tradingAccessAddKalshiAccount: "Add Kalshi Account",
|
|
805
854
|
outcome: (label) => `Outcome: ${label}`,
|
|
806
855
|
smartRouting: "Smart Routing",
|
|
856
|
+
orderTypeMarket: "Market",
|
|
857
|
+
orderTypeLimit: "Limit",
|
|
858
|
+
orderTypeAria: "Order type",
|
|
859
|
+
limitPrice: "Limit price",
|
|
860
|
+
limitPriceInputAria: "Limit price in cents",
|
|
861
|
+
limitPriceInvalid: "Limit price must be greater than 0 and less than 100.",
|
|
862
|
+
limitPriceDecreaseAria: "Decrease limit price",
|
|
863
|
+
limitPriceIncreaseAria: "Increase limit price",
|
|
864
|
+
expiration: "Expiration",
|
|
865
|
+
expirationGoodTilCanceled: "Good 'til canceled",
|
|
866
|
+
expirationFiveMinutes: "5m",
|
|
867
|
+
expirationOneHour: "1h",
|
|
868
|
+
expirationEndOfDay: "End of day (EST)",
|
|
869
|
+
expirationCustom: "Custom",
|
|
870
|
+
expirationMenuAria: "Choose expiration",
|
|
871
|
+
expirationOptions: "Expiration options",
|
|
872
|
+
expirationDateAria: "Limit order expiration date",
|
|
873
|
+
expirationStartTime: "Start time",
|
|
874
|
+
expirationStartTimeHint: "24-hour format",
|
|
875
|
+
expirationCancel: "Cancel",
|
|
876
|
+
expirationApply: "Apply",
|
|
877
|
+
limitOrderPlacedTitle: "Limit order placed",
|
|
878
|
+
limitOrderPlacedDescription: "Your limit order has been submitted.",
|
|
807
879
|
orderSplitting: "Order Splitting",
|
|
808
880
|
splitOrderDescription: "We split your order for the best price:",
|
|
809
881
|
viewAllRoutes: (count) => `View all (${count})`,
|
|
@@ -970,6 +1042,11 @@ var enUsLabels = {
|
|
|
970
1042
|
cancel: "Cancel",
|
|
971
1043
|
verifyConnection: "Verify Connection"
|
|
972
1044
|
},
|
|
1045
|
+
success: {
|
|
1046
|
+
title: "Kalshi Account Connected",
|
|
1047
|
+
description: "Your Kalshi account is now connected to AGG. You can start trading Kalshi markets.",
|
|
1048
|
+
done: "Done"
|
|
1049
|
+
},
|
|
973
1050
|
fallbackError: "Verification failed. Please check your credentials and try again."
|
|
974
1051
|
}
|
|
975
1052
|
},
|
|
@@ -1019,6 +1096,9 @@ var enUsLabels = {
|
|
|
1019
1096
|
moreMarketsTitle: "More markets",
|
|
1020
1097
|
gameLinesTab: "Game Lines",
|
|
1021
1098
|
halvesTab: "Halves",
|
|
1099
|
+
quartersTab: "Quarters",
|
|
1100
|
+
setsTab: "Sets",
|
|
1101
|
+
playerPropsTab: "Player Props",
|
|
1022
1102
|
exactScoreTab: "Exact Score",
|
|
1023
1103
|
cornersTab: "Corners",
|
|
1024
1104
|
goalsTab: "Goals",
|
|
@@ -1069,6 +1149,12 @@ var enUsLabels = {
|
|
|
1069
1149
|
const venue = venueLabel ? ` on ${venueLabel}` : "";
|
|
1070
1150
|
return `${action}${amount}${price}${venue}`.trim();
|
|
1071
1151
|
},
|
|
1152
|
+
cancelledTitle: "Order canceled",
|
|
1153
|
+
cancelledMessage: "Your open order was canceled.",
|
|
1154
|
+
cancelPendingTitle: "Cancellation submitted",
|
|
1155
|
+
cancelPendingMessage: "Your cancellation request is being processed.",
|
|
1156
|
+
cancelFailedTitle: "Cancellation failed",
|
|
1157
|
+
cancelFailedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your open order could not be canceled. Please try again.",
|
|
1072
1158
|
failedTitle: "Order failed",
|
|
1073
1159
|
failedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your order could not be completed. Please try again."
|
|
1074
1160
|
},
|
|
@@ -1208,6 +1294,7 @@ var defaultAggUiConfig = {
|
|
|
1208
1294
|
enableGradients: false,
|
|
1209
1295
|
enableVenueEventDiscoveryFilters: false,
|
|
1210
1296
|
enableNotifications: true,
|
|
1297
|
+
showLimitOrders: false,
|
|
1211
1298
|
showSportsMarkets: false
|
|
1212
1299
|
},
|
|
1213
1300
|
market: {
|
|
@@ -1239,7 +1326,7 @@ var mergeAggUiSearchConfig = (config) => {
|
|
|
1239
1326
|
};
|
|
1240
1327
|
};
|
|
1241
1328
|
var mergeAggUiConfig = (persisted, config) => {
|
|
1242
|
-
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, _U, _V, _W, _X, _Y, _Z
|
|
1329
|
+
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, _U, _V, _W, _X, _Y, _Z, __, _$;
|
|
1243
1330
|
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;
|
|
1244
1331
|
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;
|
|
1245
1332
|
const formatters = createFormatters(locale);
|
|
@@ -1262,27 +1349,28 @@ var mergeAggUiConfig = (persisted, config) => {
|
|
|
1262
1349
|
enableGradients: (_x = (_w = config == null ? void 0 : config.features) == null ? void 0 : _w.enableGradients) != null ? _x : defaultAggUiConfig.features.enableGradients,
|
|
1263
1350
|
enableVenueEventDiscoveryFilters: (_z = (_y = config == null ? void 0 : config.features) == null ? void 0 : _y.enableVenueEventDiscoveryFilters) != null ? _z : defaultAggUiConfig.features.enableVenueEventDiscoveryFilters,
|
|
1264
1351
|
enableNotifications: (_B = (_A = config == null ? void 0 : config.features) == null ? void 0 : _A.enableNotifications) != null ? _B : defaultAggUiConfig.features.enableNotifications,
|
|
1265
|
-
|
|
1352
|
+
showLimitOrders: (_D = (_C = config == null ? void 0 : config.features) == null ? void 0 : _C.showLimitOrders) != null ? _D : defaultAggUiConfig.features.showLimitOrders,
|
|
1353
|
+
showSportsMarkets: (_F = (_E = config == null ? void 0 : config.features) == null ? void 0 : _E.showSportsMarkets) != null ? _F : defaultAggUiConfig.features.showSportsMarkets
|
|
1266
1354
|
},
|
|
1267
1355
|
market: {
|
|
1268
|
-
arbitrageThreshold: (
|
|
1269
|
-
maxMidpointIdsPerRequest: (
|
|
1356
|
+
arbitrageThreshold: (_H = (_G = config == null ? void 0 : config.market) == null ? void 0 : _G.arbitrageThreshold) != null ? _H : defaultAggUiConfig.market.arbitrageThreshold,
|
|
1357
|
+
maxMidpointIdsPerRequest: (_J = (_I = config == null ? void 0 : config.market) == null ? void 0 : _I.maxMidpointIdsPerRequest) != null ? _J : defaultAggUiConfig.market.maxMidpointIdsPerRequest
|
|
1270
1358
|
},
|
|
1271
1359
|
chart: {
|
|
1272
|
-
defaultChartTimeRange: (
|
|
1273
|
-
selectedChartTimeRange: (
|
|
1360
|
+
defaultChartTimeRange: (_L = (_K = config == null ? void 0 : config.chart) == null ? void 0 : _K.defaultChartTimeRange) != null ? _L : defaultAggUiConfig.chart.defaultChartTimeRange,
|
|
1361
|
+
selectedChartTimeRange: (_P = (_O = (_M = persisted.chart) == null ? void 0 : _M.selectedChartTimeRange) != null ? _O : (_N = config == null ? void 0 : config.chart) == null ? void 0 : _N.defaultChartTimeRange) != null ? _P : defaultAggUiConfig.chart.defaultChartTimeRange,
|
|
1274
1362
|
setSelectedChartTimeRange: defaultAggUiConfig.chart.setSelectedChartTimeRange
|
|
1275
1363
|
},
|
|
1276
1364
|
formatting: {
|
|
1277
|
-
formatNumber: (
|
|
1278
|
-
formatPercent: (
|
|
1279
|
-
formatCurrency: (
|
|
1280
|
-
formatCompactCurrency: (
|
|
1281
|
-
formatDate: (
|
|
1365
|
+
formatNumber: (_R = (_Q = config == null ? void 0 : config.formatting) == null ? void 0 : _Q.formatNumber) != null ? _R : formatters.formatNumber,
|
|
1366
|
+
formatPercent: (_T = (_S = config == null ? void 0 : config.formatting) == null ? void 0 : _S.formatPercent) != null ? _T : formatters.formatPercent,
|
|
1367
|
+
formatCurrency: (_V = (_U = config == null ? void 0 : config.formatting) == null ? void 0 : _U.formatCurrency) != null ? _V : formatters.formatCurrency,
|
|
1368
|
+
formatCompactCurrency: (_X = (_W = config == null ? void 0 : config.formatting) == null ? void 0 : _W.formatCompactCurrency) != null ? _X : formatters.formatCompactCurrency,
|
|
1369
|
+
formatDate: (_Z = (_Y = config == null ? void 0 : config.formatting) == null ? void 0 : _Y.formatDate) != null ? _Z : formatters.formatDate
|
|
1282
1370
|
},
|
|
1283
1371
|
search: mergeAggUiSearchConfig(config == null ? void 0 : config.search),
|
|
1284
1372
|
trading: {
|
|
1285
|
-
executionMode: (
|
|
1373
|
+
executionMode: (_$ = (__ = config == null ? void 0 : config.trading) == null ? void 0 : __.executionMode) != null ? _$ : defaultAggUiConfig.trading.executionMode
|
|
1286
1374
|
},
|
|
1287
1375
|
walletActions: config == null ? void 0 : config.walletActions,
|
|
1288
1376
|
solanaRpcUrl: config == null ? void 0 : config.solanaRpcUrl
|
|
@@ -1429,6 +1517,7 @@ var EMPTY_MANAGED_BALANCES = {
|
|
|
1429
1517
|
positions: []
|
|
1430
1518
|
};
|
|
1431
1519
|
function AggBalanceProvider({ children }) {
|
|
1520
|
+
var _a;
|
|
1432
1521
|
const client = useContext(AggClientContext);
|
|
1433
1522
|
const authContext = useContext(AggAuthContext);
|
|
1434
1523
|
const {
|
|
@@ -1473,39 +1562,81 @@ function AggBalanceProvider({ children }) {
|
|
|
1473
1562
|
if (!isUsdBasedToken(token.tokenSymbol)) return sum;
|
|
1474
1563
|
const tokenAcrossChains = token.chains.reduce(
|
|
1475
1564
|
(chainSum, chain) => {
|
|
1476
|
-
var
|
|
1477
|
-
return chainSum + toTokenUnits(chain.balanceRaw, (
|
|
1565
|
+
var _a2;
|
|
1566
|
+
return chainSum + toTokenUnits(chain.balanceRaw, (_a2 = chain.decimals) != null ? _a2 : token.decimals);
|
|
1478
1567
|
},
|
|
1479
1568
|
0
|
|
1480
1569
|
);
|
|
1481
1570
|
return sum + tokenAcrossChains;
|
|
1482
1571
|
}, 0);
|
|
1483
1572
|
}, [managedBalances]);
|
|
1484
|
-
const
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
if (!isUsdBasedToken(token.tokenSymbol)) continue;
|
|
1490
|
-
for (const chain of token.chains) {
|
|
1491
|
-
const current = (_a = byChain.get(chain.chainId)) != null ? _a : {
|
|
1492
|
-
label: chainLabelFromId(chain.chainId),
|
|
1493
|
-
balance: 0,
|
|
1494
|
-
accountCount: 0
|
|
1495
|
-
};
|
|
1496
|
-
current.balance += toTokenUnits(chain.balanceRaw, (_b = chain.decimals) != null ? _b : token.decimals);
|
|
1497
|
-
current.accountCount += 1;
|
|
1498
|
-
byChain.set(chain.chainId, current);
|
|
1573
|
+
const availableBalance = useMemo(() => {
|
|
1574
|
+
return managedBalances.cash.reduce((sum, token) => {
|
|
1575
|
+
if (!isUsdBasedToken(token.tokenSymbol)) return sum;
|
|
1576
|
+
if (token.availableRaw != null) {
|
|
1577
|
+
return sum + toTokenUnits(token.availableRaw, token.decimals);
|
|
1499
1578
|
}
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
})
|
|
1508
|
-
}, [
|
|
1579
|
+
return sum + token.chains.reduce(
|
|
1580
|
+
(chainSum, chain) => {
|
|
1581
|
+
var _a2, _b;
|
|
1582
|
+
return chainSum + toTokenUnits((_a2 = chain.availableRaw) != null ? _a2 : chain.balanceRaw, (_b = chain.decimals) != null ? _b : token.decimals);
|
|
1583
|
+
},
|
|
1584
|
+
0
|
|
1585
|
+
);
|
|
1586
|
+
}, 0);
|
|
1587
|
+
}, [managedBalances]);
|
|
1588
|
+
const reservedBalance = useMemo(() => {
|
|
1589
|
+
return managedBalances.cash.reduce((sum, token) => {
|
|
1590
|
+
if (!isUsdBasedToken(token.tokenSymbol)) return sum;
|
|
1591
|
+
if (token.reservedRaw != null) {
|
|
1592
|
+
return sum + toTokenUnits(token.reservedRaw, token.decimals);
|
|
1593
|
+
}
|
|
1594
|
+
return sum + token.chains.reduce(
|
|
1595
|
+
(chainSum, chain) => {
|
|
1596
|
+
var _a2, _b;
|
|
1597
|
+
return chainSum + toTokenUnits((_a2 = chain.heldRaw) != null ? _a2 : "0", (_b = chain.decimals) != null ? _b : token.decimals);
|
|
1598
|
+
},
|
|
1599
|
+
0
|
|
1600
|
+
);
|
|
1601
|
+
}, 0);
|
|
1602
|
+
}, [managedBalances]);
|
|
1603
|
+
const buildBalanceBreakdown = useCallback(
|
|
1604
|
+
(rawForChain) => {
|
|
1605
|
+
var _a2, _b;
|
|
1606
|
+
const byChain = /* @__PURE__ */ new Map();
|
|
1607
|
+
const cash = managedBalances.cash;
|
|
1608
|
+
for (const token of cash) {
|
|
1609
|
+
if (!isUsdBasedToken(token.tokenSymbol)) continue;
|
|
1610
|
+
for (const chain of token.chains) {
|
|
1611
|
+
const current = (_a2 = byChain.get(chain.chainId)) != null ? _a2 : {
|
|
1612
|
+
label: chainLabelFromId(chain.chainId),
|
|
1613
|
+
balance: 0,
|
|
1614
|
+
accountCount: 0
|
|
1615
|
+
};
|
|
1616
|
+
current.balance += toTokenUnits(rawForChain(chain), (_b = chain.decimals) != null ? _b : token.decimals);
|
|
1617
|
+
current.accountCount += 1;
|
|
1618
|
+
byChain.set(chain.chainId, current);
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
return Array.from(byChain.entries()).sort((a, b) => a[1].label.localeCompare(b[1].label)).map(([chainId, value2]) => ({
|
|
1622
|
+
key: String(chainId),
|
|
1623
|
+
label: value2.label,
|
|
1624
|
+
balance: value2.balance,
|
|
1625
|
+
accountCount: value2.accountCount,
|
|
1626
|
+
venues: connectedVenues.length > 0 ? connectedVenues : void 0
|
|
1627
|
+
}));
|
|
1628
|
+
},
|
|
1629
|
+
[connectedVenues, managedBalances.cash]
|
|
1630
|
+
);
|
|
1631
|
+
const balanceBreakdown = useMemo(() => {
|
|
1632
|
+
return buildBalanceBreakdown((chain) => chain.balanceRaw);
|
|
1633
|
+
}, [buildBalanceBreakdown]);
|
|
1634
|
+
const availableBalanceBreakdown = useMemo(() => {
|
|
1635
|
+
return buildBalanceBreakdown((chain) => {
|
|
1636
|
+
var _a2;
|
|
1637
|
+
return (_a2 = chain.availableRaw) != null ? _a2 : chain.balanceRaw;
|
|
1638
|
+
});
|
|
1639
|
+
}, [buildBalanceBreakdown]);
|
|
1509
1640
|
const positionsBalanceTotal = useMemo(() => {
|
|
1510
1641
|
const positions = managedBalances.positions;
|
|
1511
1642
|
return positions.reduce(
|
|
@@ -1513,6 +1644,9 @@ function AggBalanceProvider({ children }) {
|
|
|
1513
1644
|
0
|
|
1514
1645
|
);
|
|
1515
1646
|
}, [managedBalances]);
|
|
1647
|
+
const kalshiVenueCash = (_a = managedBalances.venueCash) == null ? void 0 : _a.find((item) => item.venue === "kalshi");
|
|
1648
|
+
const kalshiBalance = kalshiVenueCash ? kalshiVenueCash.balanceCents / 100 : null;
|
|
1649
|
+
const kalshiPortfolioValue = (kalshiVenueCash == null ? void 0 : kalshiVenueCash.portfolioValueCents) == null ? null : kalshiVenueCash.portfolioValueCents / 100;
|
|
1516
1650
|
const refetch = useCallback(() => {
|
|
1517
1651
|
if (!isAuthenticated) return;
|
|
1518
1652
|
void refetchBalances();
|
|
@@ -1526,8 +1660,13 @@ function AggBalanceProvider({ children }) {
|
|
|
1526
1660
|
return {
|
|
1527
1661
|
managedBalances,
|
|
1528
1662
|
totalBalance: 0,
|
|
1663
|
+
availableBalance: 0,
|
|
1664
|
+
reservedBalance: 0,
|
|
1529
1665
|
positionsBalanceTotal: 0,
|
|
1666
|
+
kalshiBalance: null,
|
|
1667
|
+
kalshiPortfolioValue: null,
|
|
1530
1668
|
balanceBreakdown: [],
|
|
1669
|
+
availableBalanceBreakdown: [],
|
|
1531
1670
|
connectedVenues: [],
|
|
1532
1671
|
isLoading: false,
|
|
1533
1672
|
error: null,
|
|
@@ -1539,8 +1678,13 @@ function AggBalanceProvider({ children }) {
|
|
|
1539
1678
|
return {
|
|
1540
1679
|
managedBalances,
|
|
1541
1680
|
totalBalance,
|
|
1681
|
+
availableBalance,
|
|
1682
|
+
reservedBalance,
|
|
1542
1683
|
positionsBalanceTotal,
|
|
1684
|
+
kalshiBalance,
|
|
1685
|
+
kalshiPortfolioValue,
|
|
1543
1686
|
balanceBreakdown,
|
|
1687
|
+
availableBalanceBreakdown,
|
|
1544
1688
|
connectedVenues,
|
|
1545
1689
|
isLoading: isBalancesLoading,
|
|
1546
1690
|
error,
|
|
@@ -1549,14 +1693,19 @@ function AggBalanceProvider({ children }) {
|
|
|
1549
1693
|
};
|
|
1550
1694
|
}, [
|
|
1551
1695
|
balanceBreakdown,
|
|
1696
|
+
availableBalance,
|
|
1697
|
+
availableBalanceBreakdown,
|
|
1552
1698
|
balancesError,
|
|
1553
1699
|
connectedVenues,
|
|
1554
1700
|
isBalancesLoading,
|
|
1555
1701
|
isAuthenticated,
|
|
1702
|
+
kalshiBalance,
|
|
1703
|
+
kalshiPortfolioValue,
|
|
1556
1704
|
managedBalances,
|
|
1557
1705
|
positionsBalanceTotal,
|
|
1558
1706
|
refetch,
|
|
1559
1707
|
refetchConnectionStatus,
|
|
1708
|
+
reservedBalance,
|
|
1560
1709
|
totalBalance
|
|
1561
1710
|
]);
|
|
1562
1711
|
return /* @__PURE__ */ jsx(AggBalanceContext.Provider, { value, children });
|
|
@@ -3811,12 +3960,54 @@ function useExecuteManaged(options) {
|
|
|
3811
3960
|
});
|
|
3812
3961
|
}
|
|
3813
3962
|
|
|
3814
|
-
// src/execution/use-
|
|
3963
|
+
// src/execution/use-place-limit-order.ts
|
|
3815
3964
|
import { useMutation as useMutation3, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
3816
|
-
function
|
|
3965
|
+
function usePlaceLimitOrder(options) {
|
|
3817
3966
|
const client = useAggClient();
|
|
3818
3967
|
const queryClient = useQueryClient4();
|
|
3819
3968
|
return useMutation3({
|
|
3969
|
+
mutationFn: (params) => client.placeLimitOrder(params),
|
|
3970
|
+
onSuccess: (data) => {
|
|
3971
|
+
var _a;
|
|
3972
|
+
queryClient.invalidateQueries({ queryKey: executionKeys.ordersPrefix() });
|
|
3973
|
+
queryClient.invalidateQueries({ queryKey: ["execution-orders"] });
|
|
3974
|
+
queryClient.invalidateQueries({ queryKey: executionKeys.positionsPrefix() });
|
|
3975
|
+
invalidateBalanceQueries(queryClient);
|
|
3976
|
+
(_a = options == null ? void 0 : options.onSuccess) == null ? void 0 : _a.call(options, data);
|
|
3977
|
+
},
|
|
3978
|
+
onError: options == null ? void 0 : options.onError
|
|
3979
|
+
});
|
|
3980
|
+
}
|
|
3981
|
+
|
|
3982
|
+
// src/execution/use-cancel-managed-order.ts
|
|
3983
|
+
import { useMutation as useMutation4, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
|
3984
|
+
function useCancelManagedOrder(options) {
|
|
3985
|
+
const client = useAggClient();
|
|
3986
|
+
const queryClient = useQueryClient5();
|
|
3987
|
+
return useMutation4({
|
|
3988
|
+
mutationFn: (orderId) => client.cancelManagedOrder(orderId),
|
|
3989
|
+
onSuccess: (data, orderId) => {
|
|
3990
|
+
var _a;
|
|
3991
|
+
queryClient.invalidateQueries({ queryKey: executionKeys.ordersPrefix() });
|
|
3992
|
+
queryClient.invalidateQueries({ queryKey: ["execution-orders"] });
|
|
3993
|
+
invalidatePositionQueries(queryClient);
|
|
3994
|
+
invalidateBalanceQueries(queryClient);
|
|
3995
|
+
invalidateUserActivityQueries(queryClient);
|
|
3996
|
+
(_a = options == null ? void 0 : options.onSuccess) == null ? void 0 : _a.call(options, data, orderId);
|
|
3997
|
+
},
|
|
3998
|
+
onError: (error, orderId) => {
|
|
3999
|
+
var _a;
|
|
4000
|
+
(_a = options == null ? void 0 : options.onError) == null ? void 0 : _a.call(options, error, orderId);
|
|
4001
|
+
}
|
|
4002
|
+
});
|
|
4003
|
+
}
|
|
4004
|
+
|
|
4005
|
+
// src/execution/use-withdraw-managed.ts
|
|
4006
|
+
import { useMutation as useMutation5, useQueryClient as useQueryClient6 } from "@tanstack/react-query";
|
|
4007
|
+
function useWithdrawManaged(options) {
|
|
4008
|
+
const client = useAggClient();
|
|
4009
|
+
const queryClient = useQueryClient6();
|
|
4010
|
+
return useMutation5({
|
|
3820
4011
|
mutationFn: (params) => client.withdrawManaged(params),
|
|
3821
4012
|
onSuccess: (data) => {
|
|
3822
4013
|
var _a;
|
|
@@ -3924,11 +4115,11 @@ function useDepositAddresses(options) {
|
|
|
3924
4115
|
}
|
|
3925
4116
|
|
|
3926
4117
|
// src/execution/use-sync-balances.ts
|
|
3927
|
-
import { useMutation as
|
|
4118
|
+
import { useMutation as useMutation6, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
3928
4119
|
function useSyncBalances(options) {
|
|
3929
4120
|
const client = useAggClient();
|
|
3930
|
-
const queryClient =
|
|
3931
|
-
return
|
|
4121
|
+
const queryClient = useQueryClient7();
|
|
4122
|
+
return useMutation6({
|
|
3932
4123
|
mutationFn: () => client.syncManagedBalances(),
|
|
3933
4124
|
onSuccess: () => {
|
|
3934
4125
|
var _a;
|
|
@@ -4459,7 +4650,7 @@ var computeClosedPositionTotals = (group) => {
|
|
|
4459
4650
|
};
|
|
4460
4651
|
|
|
4461
4652
|
// src/execution/use-redeem.ts
|
|
4462
|
-
import { useMutation as
|
|
4653
|
+
import { useMutation as useMutation7, useQueryClient as useQueryClient8 } from "@tanstack/react-query";
|
|
4463
4654
|
var RedeemRejectedError = class extends Error {
|
|
4464
4655
|
constructor(message, response) {
|
|
4465
4656
|
super(message);
|
|
@@ -4470,8 +4661,8 @@ var RedeemRejectedError = class extends Error {
|
|
|
4470
4661
|
var isLegRejected = (status) => status === "ineligible" || status === "rejected";
|
|
4471
4662
|
var useRedeem = () => {
|
|
4472
4663
|
const client = useAggClient();
|
|
4473
|
-
const queryClient =
|
|
4474
|
-
return
|
|
4664
|
+
const queryClient = useQueryClient8();
|
|
4665
|
+
return useMutation7({
|
|
4475
4666
|
mutationFn: (body) => __async(null, null, function* () {
|
|
4476
4667
|
const response = yield client.redeem(body);
|
|
4477
4668
|
if (response.results.length > 0 && response.results.every((r) => isLegRejected(r.status))) {
|
|
@@ -4738,6 +4929,8 @@ export {
|
|
|
4738
4929
|
AggProvider,
|
|
4739
4930
|
useQuoteManaged,
|
|
4740
4931
|
useExecuteManaged,
|
|
4932
|
+
usePlaceLimitOrder,
|
|
4933
|
+
useCancelManagedOrder,
|
|
4741
4934
|
useWithdrawManaged,
|
|
4742
4935
|
useManagedBalances,
|
|
4743
4936
|
usePositions,
|
package/dist/deposit.js
CHANGED
|
@@ -400,8 +400,16 @@ var enUsLabels = {
|
|
|
400
400
|
categoryTabsAria: "Home page category tabs"
|
|
401
401
|
},
|
|
402
402
|
userProfile: {
|
|
403
|
+
tabs: {
|
|
404
|
+
positions: "Positions",
|
|
405
|
+
openOrders: "Open orders",
|
|
406
|
+
activity: "Activity"
|
|
407
|
+
},
|
|
403
408
|
balance: {
|
|
404
409
|
availableBalance: "Available Balance",
|
|
410
|
+
reservedForOpenOrders: (amount) => `${amount} reserved for open orders`,
|
|
411
|
+
positionsValue: "Positions Value",
|
|
412
|
+
kalshiBalance: "Kalshi Balance",
|
|
405
413
|
balanceByNetwork: "Balance by network",
|
|
406
414
|
paperModeNetwork: "Paper",
|
|
407
415
|
paperModeWarning: "Paper mode is enabled. These are simulated funds for paper trading.",
|
|
@@ -484,6 +492,25 @@ var enUsLabels = {
|
|
|
484
492
|
avgPrefix: "avg",
|
|
485
493
|
nowPrefix: "now",
|
|
486
494
|
finalPrefix: "final"
|
|
495
|
+
},
|
|
496
|
+
openOrders: {
|
|
497
|
+
marketHeader: "Market",
|
|
498
|
+
limitPriceHeader: "Limit price",
|
|
499
|
+
filledHeader: "Filled",
|
|
500
|
+
totalHeader: "Total",
|
|
501
|
+
filledShort: "Filled",
|
|
502
|
+
totalShort: "Total",
|
|
503
|
+
expirationHeader: "Expiration",
|
|
504
|
+
goodTilCanceled: "Good 'til canceled",
|
|
505
|
+
expired: "Expired",
|
|
506
|
+
cancel: "Cancel",
|
|
507
|
+
cancelOrderAria: (orderId) => `Cancel order ${orderId}`,
|
|
508
|
+
loading: "Loading open orders",
|
|
509
|
+
loadingMore: "Loading more open orders",
|
|
510
|
+
errorTitle: "Unable to load open orders",
|
|
511
|
+
errorDescription: "Please try again in a moment.",
|
|
512
|
+
emptyTitle: "No open orders",
|
|
513
|
+
emptyDescription: "Your open limit orders will appear here."
|
|
487
514
|
}
|
|
488
515
|
},
|
|
489
516
|
eventList: {
|
|
@@ -717,6 +744,24 @@ var enUsLabels = {
|
|
|
717
744
|
noBidsAboveMinPrice: "No venue bids above the minimum price.",
|
|
718
745
|
signInToTrade: "Sign in to trade",
|
|
719
746
|
deposit: "Deposit",
|
|
747
|
+
addFundsToKalshi: "Add funds to Kalshi",
|
|
748
|
+
fundKalshiModal: {
|
|
749
|
+
ariaLabel: "Fund your Kalshi account",
|
|
750
|
+
title: "Fund Your Kalshi Account",
|
|
751
|
+
description: "Kalshi manages its own account balances, so funds can't be deposited through agg.market. Add funds directly in Kalshi, then return here to trade with your updated balance.",
|
|
752
|
+
howItWorks: "How it works",
|
|
753
|
+
kalshiLinkLabel: "Kalshi",
|
|
754
|
+
kalshiUrl: "https://kalshi.com",
|
|
755
|
+
firstStepPrefix: "Go to",
|
|
756
|
+
firstStepSuffix: "and sign in to your account.",
|
|
757
|
+
remainingSteps: [
|
|
758
|
+
"Click Add Funds.",
|
|
759
|
+
"Complete your deposit using your preferred payment method.",
|
|
760
|
+
"Return here - your Kalshi balance will be available automatically."
|
|
761
|
+
],
|
|
762
|
+
doItLater: "I'll do it later",
|
|
763
|
+
done: "Done"
|
|
764
|
+
},
|
|
720
765
|
kycRequired: "Verify to trade Kalshi",
|
|
721
766
|
kycNotVerifiedTooltip: "You have not been verified yet",
|
|
722
767
|
kycVerify: "Verify Identity",
|
|
@@ -727,8 +772,35 @@ var enUsLabels = {
|
|
|
727
772
|
kycSuccessTitle: "Verification successful",
|
|
728
773
|
kycSuccessDescription: "Your identity has been confirmed and you now have full access to trade on Kalshi markets.",
|
|
729
774
|
kycSuccessDone: "Done",
|
|
775
|
+
connectKalshi: "Connect to trade Kalshi",
|
|
776
|
+
tradingAccessVenues: "Venues",
|
|
777
|
+
tradingAccessAvailable: "Available",
|
|
778
|
+
tradingAccessAddKalshiAccount: "Add Kalshi Account",
|
|
730
779
|
outcome: (label) => `Outcome: ${label}`,
|
|
731
780
|
smartRouting: "Smart Routing",
|
|
781
|
+
orderTypeMarket: "Market",
|
|
782
|
+
orderTypeLimit: "Limit",
|
|
783
|
+
orderTypeAria: "Order type",
|
|
784
|
+
limitPrice: "Limit price",
|
|
785
|
+
limitPriceInputAria: "Limit price in cents",
|
|
786
|
+
limitPriceInvalid: "Limit price must be greater than 0 and less than 100.",
|
|
787
|
+
limitPriceDecreaseAria: "Decrease limit price",
|
|
788
|
+
limitPriceIncreaseAria: "Increase limit price",
|
|
789
|
+
expiration: "Expiration",
|
|
790
|
+
expirationGoodTilCanceled: "Good 'til canceled",
|
|
791
|
+
expirationFiveMinutes: "5m",
|
|
792
|
+
expirationOneHour: "1h",
|
|
793
|
+
expirationEndOfDay: "End of day (EST)",
|
|
794
|
+
expirationCustom: "Custom",
|
|
795
|
+
expirationMenuAria: "Choose expiration",
|
|
796
|
+
expirationOptions: "Expiration options",
|
|
797
|
+
expirationDateAria: "Limit order expiration date",
|
|
798
|
+
expirationStartTime: "Start time",
|
|
799
|
+
expirationStartTimeHint: "24-hour format",
|
|
800
|
+
expirationCancel: "Cancel",
|
|
801
|
+
expirationApply: "Apply",
|
|
802
|
+
limitOrderPlacedTitle: "Limit order placed",
|
|
803
|
+
limitOrderPlacedDescription: "Your limit order has been submitted.",
|
|
732
804
|
orderSplitting: "Order Splitting",
|
|
733
805
|
splitOrderDescription: "We split your order for the best price:",
|
|
734
806
|
viewAllRoutes: (count) => `View all (${count})`,
|
|
@@ -895,6 +967,11 @@ var enUsLabels = {
|
|
|
895
967
|
cancel: "Cancel",
|
|
896
968
|
verifyConnection: "Verify Connection"
|
|
897
969
|
},
|
|
970
|
+
success: {
|
|
971
|
+
title: "Kalshi Account Connected",
|
|
972
|
+
description: "Your Kalshi account is now connected to AGG. You can start trading Kalshi markets.",
|
|
973
|
+
done: "Done"
|
|
974
|
+
},
|
|
898
975
|
fallbackError: "Verification failed. Please check your credentials and try again."
|
|
899
976
|
}
|
|
900
977
|
},
|
|
@@ -944,6 +1021,9 @@ var enUsLabels = {
|
|
|
944
1021
|
moreMarketsTitle: "More markets",
|
|
945
1022
|
gameLinesTab: "Game Lines",
|
|
946
1023
|
halvesTab: "Halves",
|
|
1024
|
+
quartersTab: "Quarters",
|
|
1025
|
+
setsTab: "Sets",
|
|
1026
|
+
playerPropsTab: "Player Props",
|
|
947
1027
|
exactScoreTab: "Exact Score",
|
|
948
1028
|
cornersTab: "Corners",
|
|
949
1029
|
goalsTab: "Goals",
|
|
@@ -994,6 +1074,12 @@ var enUsLabels = {
|
|
|
994
1074
|
const venue = venueLabel ? ` on ${venueLabel}` : "";
|
|
995
1075
|
return `${action}${amount}${price}${venue}`.trim();
|
|
996
1076
|
},
|
|
1077
|
+
cancelledTitle: "Order canceled",
|
|
1078
|
+
cancelledMessage: "Your open order was canceled.",
|
|
1079
|
+
cancelPendingTitle: "Cancellation submitted",
|
|
1080
|
+
cancelPendingMessage: "Your cancellation request is being processed.",
|
|
1081
|
+
cancelFailedTitle: "Cancellation failed",
|
|
1082
|
+
cancelFailedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your open order could not be canceled. Please try again.",
|
|
997
1083
|
failedTitle: "Order failed",
|
|
998
1084
|
failedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your order could not be completed. Please try again."
|
|
999
1085
|
},
|
|
@@ -1113,6 +1199,7 @@ var defaultAggUiConfig = {
|
|
|
1113
1199
|
enableGradients: false,
|
|
1114
1200
|
enableVenueEventDiscoveryFilters: false,
|
|
1115
1201
|
enableNotifications: true,
|
|
1202
|
+
showLimitOrders: false,
|
|
1116
1203
|
showSportsMarkets: false
|
|
1117
1204
|
},
|
|
1118
1205
|
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-Q4FRCMP6.mjs";
|
|
5
5
|
import {
|
|
6
6
|
__async,
|
|
7
7
|
useAggAuthState,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useDepositAddresses,
|
|
12
12
|
useOptionalAggClient,
|
|
13
13
|
useSyncBalances
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-TJRQ55UC.mjs";
|
|
15
15
|
|
|
16
16
|
// src/deposit/normalize-wallet-error.ts
|
|
17
17
|
function normalizeWalletError(error, supportedChains) {
|