@agg-build/hooks 2.4.4 → 2.5.1
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-STOMNDHO.mjs → chunk-5NJBAP42.mjs} +229 -44
- package/dist/{chunk-KVMLKTGS.mjs → chunk-DPY6RZNW.mjs} +1 -1
- package/dist/{chunk-RMGSLCL3.mjs → chunk-PK2JGXQV.mjs} +1 -1
- package/dist/deposit.js +57 -0
- package/dist/deposit.mjs +2 -2
- package/dist/index.d.mts +119 -3
- package/dist/index.d.ts +119 -3
- package/dist/index.js +309 -122
- package/dist/index.mjs +7 -3
- package/dist/withdraw.js +57 -0
- package/dist/withdraw.mjs +2 -2
- package/package.json +2 -2
|
@@ -63,6 +63,18 @@ var Venue = /* @__PURE__ */ ((Venue2) => {
|
|
|
63
63
|
Venue2["hyperliquid"] = "hyperliquid";
|
|
64
64
|
return Venue2;
|
|
65
65
|
})(Venue || {});
|
|
66
|
+
var ACTIVE_VENUES = [
|
|
67
|
+
"polymarket" /* polymarket */,
|
|
68
|
+
"limitless" /* limitless */,
|
|
69
|
+
"opinion" /* opinion */,
|
|
70
|
+
"predict" /* predict */,
|
|
71
|
+
"probable" /* probable */,
|
|
72
|
+
"myriad" /* myriad */,
|
|
73
|
+
"hyperliquid" /* hyperliquid */
|
|
74
|
+
];
|
|
75
|
+
var INACTIVE_VENUES = ["kalshi" /* kalshi */];
|
|
76
|
+
var ACTIVE_VENUE_SET = new Set(ACTIVE_VENUES);
|
|
77
|
+
var INACTIVE_VENUE_SET = new Set(INACTIVE_VENUES);
|
|
66
78
|
|
|
67
79
|
// ../common/src/enums/market-status.ts
|
|
68
80
|
var MatchStatus = /* @__PURE__ */ ((MatchStatus2) => {
|
|
@@ -463,8 +475,14 @@ var enUsLabels = {
|
|
|
463
475
|
categoryTabsAria: "Home page category tabs"
|
|
464
476
|
},
|
|
465
477
|
userProfile: {
|
|
478
|
+
tabs: {
|
|
479
|
+
positions: "Positions",
|
|
480
|
+
openOrders: "Open orders",
|
|
481
|
+
activity: "Activity"
|
|
482
|
+
},
|
|
466
483
|
balance: {
|
|
467
484
|
availableBalance: "Available Balance",
|
|
485
|
+
reservedForOpenOrders: (amount) => `${amount} reserved for open orders`,
|
|
468
486
|
balanceByNetwork: "Balance by network",
|
|
469
487
|
paperModeNetwork: "Paper",
|
|
470
488
|
paperModeWarning: "Paper mode is enabled. These are simulated funds for paper trading.",
|
|
@@ -547,6 +565,25 @@ var enUsLabels = {
|
|
|
547
565
|
avgPrefix: "avg",
|
|
548
566
|
nowPrefix: "now",
|
|
549
567
|
finalPrefix: "final"
|
|
568
|
+
},
|
|
569
|
+
openOrders: {
|
|
570
|
+
marketHeader: "Market",
|
|
571
|
+
limitPriceHeader: "Limit price",
|
|
572
|
+
filledHeader: "Filled",
|
|
573
|
+
totalHeader: "Total",
|
|
574
|
+
filledShort: "Filled",
|
|
575
|
+
totalShort: "Total",
|
|
576
|
+
expirationHeader: "Expiration",
|
|
577
|
+
goodTilCanceled: "Good 'til canceled",
|
|
578
|
+
expired: "Expired",
|
|
579
|
+
cancel: "Cancel",
|
|
580
|
+
cancelOrderAria: (orderId) => `Cancel order ${orderId}`,
|
|
581
|
+
loading: "Loading open orders",
|
|
582
|
+
loadingMore: "Loading more open orders",
|
|
583
|
+
errorTitle: "Unable to load open orders",
|
|
584
|
+
errorDescription: "Please try again in a moment.",
|
|
585
|
+
emptyTitle: "No open orders",
|
|
586
|
+
emptyDescription: "Your open limit orders will appear here."
|
|
550
587
|
}
|
|
551
588
|
},
|
|
552
589
|
eventList: {
|
|
@@ -688,6 +725,7 @@ var enUsLabels = {
|
|
|
688
725
|
trading: {
|
|
689
726
|
settlementSection: "Settlement",
|
|
690
727
|
settlementDifferencesTitle: "Key differences across venues",
|
|
728
|
+
settlementFullRulesTitle: "Full rules by venue",
|
|
691
729
|
settlementCriticalDifferenceLabel: "Critical",
|
|
692
730
|
settlementValueUnavailable: "Not provided",
|
|
693
731
|
settlementLoading: "Loading settlement",
|
|
@@ -744,6 +782,7 @@ var enUsLabels = {
|
|
|
744
782
|
orderDisabledNoOutcome: "Select an outcome to place an order.",
|
|
745
783
|
orderDisabledNoEvent: "No event selected.",
|
|
746
784
|
insufficientBalance: "Insufficient balance",
|
|
785
|
+
lowLiquidityWarning: "This market has low liquidity, which may impact execution price for larger orders.",
|
|
747
786
|
refreshQuote: "Refresh Quote",
|
|
748
787
|
confirmOrder: "Confirm Order",
|
|
749
788
|
withdrawSubmitted: "Withdrawal submitted",
|
|
@@ -790,6 +829,29 @@ var enUsLabels = {
|
|
|
790
829
|
kycSuccessDone: "Done",
|
|
791
830
|
outcome: (label) => `Outcome: ${label}`,
|
|
792
831
|
smartRouting: "Smart Routing",
|
|
832
|
+
orderTypeMarket: "Market",
|
|
833
|
+
orderTypeLimit: "Limit",
|
|
834
|
+
orderTypeAria: "Order type",
|
|
835
|
+
limitPrice: "Limit price",
|
|
836
|
+
limitPriceInputAria: "Limit price in cents",
|
|
837
|
+
limitPriceInvalid: "Limit price must be greater than 0 and less than 100.",
|
|
838
|
+
limitPriceDecreaseAria: "Decrease limit price",
|
|
839
|
+
limitPriceIncreaseAria: "Increase limit price",
|
|
840
|
+
expiration: "Expiration",
|
|
841
|
+
expirationGoodTilCanceled: "Good 'til canceled",
|
|
842
|
+
expirationFiveMinutes: "5m",
|
|
843
|
+
expirationOneHour: "1h",
|
|
844
|
+
expirationEndOfDay: "End of day (EST)",
|
|
845
|
+
expirationCustom: "Custom",
|
|
846
|
+
expirationMenuAria: "Choose expiration",
|
|
847
|
+
expirationOptions: "Expiration options",
|
|
848
|
+
expirationDateAria: "Limit order expiration date",
|
|
849
|
+
expirationStartTime: "Start time",
|
|
850
|
+
expirationStartTimeHint: "24-hour format",
|
|
851
|
+
expirationCancel: "Cancel",
|
|
852
|
+
expirationApply: "Apply",
|
|
853
|
+
limitOrderPlacedTitle: "Limit order placed",
|
|
854
|
+
limitOrderPlacedDescription: "Your limit order has been submitted.",
|
|
793
855
|
orderSplitting: "Order Splitting",
|
|
794
856
|
splitOrderDescription: "We split your order for the best price:",
|
|
795
857
|
viewAllRoutes: (count) => `View all (${count})`,
|
|
@@ -1055,6 +1117,12 @@ var enUsLabels = {
|
|
|
1055
1117
|
const venue = venueLabel ? ` on ${venueLabel}` : "";
|
|
1056
1118
|
return `${action}${amount}${price}${venue}`.trim();
|
|
1057
1119
|
},
|
|
1120
|
+
cancelledTitle: "Order canceled",
|
|
1121
|
+
cancelledMessage: "Your open order was canceled.",
|
|
1122
|
+
cancelPendingTitle: "Cancellation submitted",
|
|
1123
|
+
cancelPendingMessage: "Your cancellation request is being processed.",
|
|
1124
|
+
cancelFailedTitle: "Cancellation failed",
|
|
1125
|
+
cancelFailedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your open order could not be canceled. Please try again.",
|
|
1058
1126
|
failedTitle: "Order failed",
|
|
1059
1127
|
failedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your order could not be completed. Please try again."
|
|
1060
1128
|
},
|
|
@@ -1194,6 +1262,7 @@ var defaultAggUiConfig = {
|
|
|
1194
1262
|
enableGradients: false,
|
|
1195
1263
|
enableVenueEventDiscoveryFilters: false,
|
|
1196
1264
|
enableNotifications: true,
|
|
1265
|
+
showLimitOrders: false,
|
|
1197
1266
|
showSportsMarkets: false
|
|
1198
1267
|
},
|
|
1199
1268
|
market: {
|
|
@@ -1225,7 +1294,7 @@ var mergeAggUiSearchConfig = (config) => {
|
|
|
1225
1294
|
};
|
|
1226
1295
|
};
|
|
1227
1296
|
var mergeAggUiConfig = (persisted, config) => {
|
|
1228
|
-
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
|
|
1297
|
+
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, __, _$;
|
|
1229
1298
|
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;
|
|
1230
1299
|
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;
|
|
1231
1300
|
const formatters = createFormatters(locale);
|
|
@@ -1248,27 +1317,28 @@ var mergeAggUiConfig = (persisted, config) => {
|
|
|
1248
1317
|
enableGradients: (_x = (_w = config == null ? void 0 : config.features) == null ? void 0 : _w.enableGradients) != null ? _x : defaultAggUiConfig.features.enableGradients,
|
|
1249
1318
|
enableVenueEventDiscoveryFilters: (_z = (_y = config == null ? void 0 : config.features) == null ? void 0 : _y.enableVenueEventDiscoveryFilters) != null ? _z : defaultAggUiConfig.features.enableVenueEventDiscoveryFilters,
|
|
1250
1319
|
enableNotifications: (_B = (_A = config == null ? void 0 : config.features) == null ? void 0 : _A.enableNotifications) != null ? _B : defaultAggUiConfig.features.enableNotifications,
|
|
1251
|
-
|
|
1320
|
+
showLimitOrders: (_D = (_C = config == null ? void 0 : config.features) == null ? void 0 : _C.showLimitOrders) != null ? _D : defaultAggUiConfig.features.showLimitOrders,
|
|
1321
|
+
showSportsMarkets: (_F = (_E = config == null ? void 0 : config.features) == null ? void 0 : _E.showSportsMarkets) != null ? _F : defaultAggUiConfig.features.showSportsMarkets
|
|
1252
1322
|
},
|
|
1253
1323
|
market: {
|
|
1254
|
-
arbitrageThreshold: (
|
|
1255
|
-
maxMidpointIdsPerRequest: (
|
|
1324
|
+
arbitrageThreshold: (_H = (_G = config == null ? void 0 : config.market) == null ? void 0 : _G.arbitrageThreshold) != null ? _H : defaultAggUiConfig.market.arbitrageThreshold,
|
|
1325
|
+
maxMidpointIdsPerRequest: (_J = (_I = config == null ? void 0 : config.market) == null ? void 0 : _I.maxMidpointIdsPerRequest) != null ? _J : defaultAggUiConfig.market.maxMidpointIdsPerRequest
|
|
1256
1326
|
},
|
|
1257
1327
|
chart: {
|
|
1258
|
-
defaultChartTimeRange: (
|
|
1259
|
-
selectedChartTimeRange: (
|
|
1328
|
+
defaultChartTimeRange: (_L = (_K = config == null ? void 0 : config.chart) == null ? void 0 : _K.defaultChartTimeRange) != null ? _L : defaultAggUiConfig.chart.defaultChartTimeRange,
|
|
1329
|
+
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,
|
|
1260
1330
|
setSelectedChartTimeRange: defaultAggUiConfig.chart.setSelectedChartTimeRange
|
|
1261
1331
|
},
|
|
1262
1332
|
formatting: {
|
|
1263
|
-
formatNumber: (
|
|
1264
|
-
formatPercent: (
|
|
1265
|
-
formatCurrency: (
|
|
1266
|
-
formatCompactCurrency: (
|
|
1267
|
-
formatDate: (
|
|
1333
|
+
formatNumber: (_R = (_Q = config == null ? void 0 : config.formatting) == null ? void 0 : _Q.formatNumber) != null ? _R : formatters.formatNumber,
|
|
1334
|
+
formatPercent: (_T = (_S = config == null ? void 0 : config.formatting) == null ? void 0 : _S.formatPercent) != null ? _T : formatters.formatPercent,
|
|
1335
|
+
formatCurrency: (_V = (_U = config == null ? void 0 : config.formatting) == null ? void 0 : _U.formatCurrency) != null ? _V : formatters.formatCurrency,
|
|
1336
|
+
formatCompactCurrency: (_X = (_W = config == null ? void 0 : config.formatting) == null ? void 0 : _W.formatCompactCurrency) != null ? _X : formatters.formatCompactCurrency,
|
|
1337
|
+
formatDate: (_Z = (_Y = config == null ? void 0 : config.formatting) == null ? void 0 : _Y.formatDate) != null ? _Z : formatters.formatDate
|
|
1268
1338
|
},
|
|
1269
1339
|
search: mergeAggUiSearchConfig(config == null ? void 0 : config.search),
|
|
1270
1340
|
trading: {
|
|
1271
|
-
executionMode: (
|
|
1341
|
+
executionMode: (_$ = (__ = config == null ? void 0 : config.trading) == null ? void 0 : __.executionMode) != null ? _$ : defaultAggUiConfig.trading.executionMode
|
|
1272
1342
|
},
|
|
1273
1343
|
walletActions: config == null ? void 0 : config.walletActions,
|
|
1274
1344
|
solanaRpcUrl: config == null ? void 0 : config.solanaRpcUrl
|
|
@@ -1467,31 +1537,73 @@ function AggBalanceProvider({ children }) {
|
|
|
1467
1537
|
return sum + tokenAcrossChains;
|
|
1468
1538
|
}, 0);
|
|
1469
1539
|
}, [managedBalances]);
|
|
1470
|
-
const
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
if (!isUsdBasedToken(token.tokenSymbol)) continue;
|
|
1476
|
-
for (const chain of token.chains) {
|
|
1477
|
-
const current = (_a = byChain.get(chain.chainId)) != null ? _a : {
|
|
1478
|
-
label: chainLabelFromId(chain.chainId),
|
|
1479
|
-
balance: 0,
|
|
1480
|
-
accountCount: 0
|
|
1481
|
-
};
|
|
1482
|
-
current.balance += toTokenUnits(chain.balanceRaw, (_b = chain.decimals) != null ? _b : token.decimals);
|
|
1483
|
-
current.accountCount += 1;
|
|
1484
|
-
byChain.set(chain.chainId, current);
|
|
1540
|
+
const availableBalance = useMemo(() => {
|
|
1541
|
+
return managedBalances.cash.reduce((sum, token) => {
|
|
1542
|
+
if (!isUsdBasedToken(token.tokenSymbol)) return sum;
|
|
1543
|
+
if (token.availableRaw != null) {
|
|
1544
|
+
return sum + toTokenUnits(token.availableRaw, token.decimals);
|
|
1485
1545
|
}
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
})
|
|
1494
|
-
}, [
|
|
1546
|
+
return sum + token.chains.reduce(
|
|
1547
|
+
(chainSum, chain) => {
|
|
1548
|
+
var _a, _b;
|
|
1549
|
+
return chainSum + toTokenUnits((_a = chain.availableRaw) != null ? _a : chain.balanceRaw, (_b = chain.decimals) != null ? _b : token.decimals);
|
|
1550
|
+
},
|
|
1551
|
+
0
|
|
1552
|
+
);
|
|
1553
|
+
}, 0);
|
|
1554
|
+
}, [managedBalances]);
|
|
1555
|
+
const reservedBalance = useMemo(() => {
|
|
1556
|
+
return managedBalances.cash.reduce((sum, token) => {
|
|
1557
|
+
if (!isUsdBasedToken(token.tokenSymbol)) return sum;
|
|
1558
|
+
if (token.reservedRaw != null) {
|
|
1559
|
+
return sum + toTokenUnits(token.reservedRaw, token.decimals);
|
|
1560
|
+
}
|
|
1561
|
+
return sum + token.chains.reduce(
|
|
1562
|
+
(chainSum, chain) => {
|
|
1563
|
+
var _a, _b;
|
|
1564
|
+
return chainSum + toTokenUnits((_a = chain.heldRaw) != null ? _a : "0", (_b = chain.decimals) != null ? _b : token.decimals);
|
|
1565
|
+
},
|
|
1566
|
+
0
|
|
1567
|
+
);
|
|
1568
|
+
}, 0);
|
|
1569
|
+
}, [managedBalances]);
|
|
1570
|
+
const buildBalanceBreakdown = useCallback(
|
|
1571
|
+
(rawForChain) => {
|
|
1572
|
+
var _a, _b;
|
|
1573
|
+
const byChain = /* @__PURE__ */ new Map();
|
|
1574
|
+
const cash = managedBalances.cash;
|
|
1575
|
+
for (const token of cash) {
|
|
1576
|
+
if (!isUsdBasedToken(token.tokenSymbol)) continue;
|
|
1577
|
+
for (const chain of token.chains) {
|
|
1578
|
+
const current = (_a = byChain.get(chain.chainId)) != null ? _a : {
|
|
1579
|
+
label: chainLabelFromId(chain.chainId),
|
|
1580
|
+
balance: 0,
|
|
1581
|
+
accountCount: 0
|
|
1582
|
+
};
|
|
1583
|
+
current.balance += toTokenUnits(rawForChain(chain), (_b = chain.decimals) != null ? _b : token.decimals);
|
|
1584
|
+
current.accountCount += 1;
|
|
1585
|
+
byChain.set(chain.chainId, current);
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
return Array.from(byChain.entries()).sort((a, b) => a[1].label.localeCompare(b[1].label)).map(([chainId, value2]) => ({
|
|
1589
|
+
key: String(chainId),
|
|
1590
|
+
label: value2.label,
|
|
1591
|
+
balance: value2.balance,
|
|
1592
|
+
accountCount: value2.accountCount,
|
|
1593
|
+
venues: connectedVenues.length > 0 ? connectedVenues : void 0
|
|
1594
|
+
}));
|
|
1595
|
+
},
|
|
1596
|
+
[connectedVenues, managedBalances.cash]
|
|
1597
|
+
);
|
|
1598
|
+
const balanceBreakdown = useMemo(() => {
|
|
1599
|
+
return buildBalanceBreakdown((chain) => chain.balanceRaw);
|
|
1600
|
+
}, [buildBalanceBreakdown]);
|
|
1601
|
+
const availableBalanceBreakdown = useMemo(() => {
|
|
1602
|
+
return buildBalanceBreakdown((chain) => {
|
|
1603
|
+
var _a;
|
|
1604
|
+
return (_a = chain.availableRaw) != null ? _a : chain.balanceRaw;
|
|
1605
|
+
});
|
|
1606
|
+
}, [buildBalanceBreakdown]);
|
|
1495
1607
|
const positionsBalanceTotal = useMemo(() => {
|
|
1496
1608
|
const positions = managedBalances.positions;
|
|
1497
1609
|
return positions.reduce(
|
|
@@ -1512,8 +1624,11 @@ function AggBalanceProvider({ children }) {
|
|
|
1512
1624
|
return {
|
|
1513
1625
|
managedBalances,
|
|
1514
1626
|
totalBalance: 0,
|
|
1627
|
+
availableBalance: 0,
|
|
1628
|
+
reservedBalance: 0,
|
|
1515
1629
|
positionsBalanceTotal: 0,
|
|
1516
1630
|
balanceBreakdown: [],
|
|
1631
|
+
availableBalanceBreakdown: [],
|
|
1517
1632
|
connectedVenues: [],
|
|
1518
1633
|
isLoading: false,
|
|
1519
1634
|
error: null,
|
|
@@ -1525,8 +1640,11 @@ function AggBalanceProvider({ children }) {
|
|
|
1525
1640
|
return {
|
|
1526
1641
|
managedBalances,
|
|
1527
1642
|
totalBalance,
|
|
1643
|
+
availableBalance,
|
|
1644
|
+
reservedBalance,
|
|
1528
1645
|
positionsBalanceTotal,
|
|
1529
1646
|
balanceBreakdown,
|
|
1647
|
+
availableBalanceBreakdown,
|
|
1530
1648
|
connectedVenues,
|
|
1531
1649
|
isLoading: isBalancesLoading,
|
|
1532
1650
|
error,
|
|
@@ -1535,6 +1653,8 @@ function AggBalanceProvider({ children }) {
|
|
|
1535
1653
|
};
|
|
1536
1654
|
}, [
|
|
1537
1655
|
balanceBreakdown,
|
|
1656
|
+
availableBalance,
|
|
1657
|
+
availableBalanceBreakdown,
|
|
1538
1658
|
balancesError,
|
|
1539
1659
|
connectedVenues,
|
|
1540
1660
|
isBalancesLoading,
|
|
@@ -1543,6 +1663,7 @@ function AggBalanceProvider({ children }) {
|
|
|
1543
1663
|
positionsBalanceTotal,
|
|
1544
1664
|
refetch,
|
|
1545
1665
|
refetchConnectionStatus,
|
|
1666
|
+
reservedBalance,
|
|
1546
1667
|
totalBalance
|
|
1547
1668
|
]);
|
|
1548
1669
|
return /* @__PURE__ */ jsx(AggBalanceContext.Provider, { value, children });
|
|
@@ -3395,11 +3516,17 @@ var parseAuthCallbackCode = (callbackUrl) => {
|
|
|
3395
3516
|
const resolvedUrl = resolveAuthCallbackUrl(callbackUrl);
|
|
3396
3517
|
return (_a = resolvedUrl == null ? void 0 : resolvedUrl.searchParams.get("code")) != null ? _a : null;
|
|
3397
3518
|
};
|
|
3519
|
+
var parseLinkConfirmToken = (callbackUrl) => {
|
|
3520
|
+
var _a;
|
|
3521
|
+
const resolvedUrl = resolveAuthCallbackUrl(callbackUrl);
|
|
3522
|
+
return (_a = resolvedUrl == null ? void 0 : resolvedUrl.searchParams.get("link_confirm_token")) != null ? _a : null;
|
|
3523
|
+
};
|
|
3398
3524
|
var getAuthCallbackCleanupPath = (callbackUrl) => {
|
|
3399
3525
|
const resolvedUrl = resolveAuthCallbackUrl(callbackUrl);
|
|
3400
3526
|
if (!resolvedUrl) return null;
|
|
3401
3527
|
const params = new URLSearchParams(resolvedUrl.search);
|
|
3402
3528
|
params.delete("code");
|
|
3529
|
+
params.delete("link_confirm_token");
|
|
3403
3530
|
const search = params.toString();
|
|
3404
3531
|
return `${resolvedUrl.pathname}${search ? `?${search}` : ""}`;
|
|
3405
3532
|
};
|
|
@@ -3412,6 +3539,12 @@ var exchangeAuthCallbackCode = (client, callbackUrl) => __async(null, null, func
|
|
|
3412
3539
|
user: result.user
|
|
3413
3540
|
};
|
|
3414
3541
|
});
|
|
3542
|
+
var confirmLinkAccountCallback = (client, callbackUrl) => __async(null, null, function* () {
|
|
3543
|
+
const token = parseLinkConfirmToken(callbackUrl);
|
|
3544
|
+
if (!token) return null;
|
|
3545
|
+
yield client.linkAccountConfirm(token);
|
|
3546
|
+
return { cleanupPath: getAuthCallbackCleanupPath(callbackUrl) };
|
|
3547
|
+
});
|
|
3415
3548
|
var parseAuthCallbackTokens = (callbackUrl) => {
|
|
3416
3549
|
var _a, _b;
|
|
3417
3550
|
const resolvedUrl = resolveAuthCallbackUrl(callbackUrl);
|
|
@@ -3658,6 +3791,14 @@ function AggAuthProvider({ children }) {
|
|
|
3658
3791
|
}
|
|
3659
3792
|
return resolvedUser2;
|
|
3660
3793
|
}
|
|
3794
|
+
const confirmedLink = yield confirmLinkAccountCallback(client, callbackUrl);
|
|
3795
|
+
if (confirmedLink) {
|
|
3796
|
+
const resolvedUser2 = yield refreshCurrentUser(client);
|
|
3797
|
+
if (callbackUrl === void 0) {
|
|
3798
|
+
replaceAuthCallbackUrl(confirmedLink.cleanupPath);
|
|
3799
|
+
}
|
|
3800
|
+
return resolvedUser2;
|
|
3801
|
+
}
|
|
3661
3802
|
const tokens = parseAuthCallbackTokens(callbackUrl);
|
|
3662
3803
|
if (!tokens) return null;
|
|
3663
3804
|
client.setSession(createAuthCallbackSession(tokens));
|
|
@@ -3777,12 +3918,54 @@ function useExecuteManaged(options) {
|
|
|
3777
3918
|
});
|
|
3778
3919
|
}
|
|
3779
3920
|
|
|
3780
|
-
// src/execution/use-
|
|
3921
|
+
// src/execution/use-place-limit-order.ts
|
|
3781
3922
|
import { useMutation as useMutation3, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
3782
|
-
function
|
|
3923
|
+
function usePlaceLimitOrder(options) {
|
|
3783
3924
|
const client = useAggClient();
|
|
3784
3925
|
const queryClient = useQueryClient4();
|
|
3785
3926
|
return useMutation3({
|
|
3927
|
+
mutationFn: (params) => client.placeLimitOrder(params),
|
|
3928
|
+
onSuccess: (data) => {
|
|
3929
|
+
var _a;
|
|
3930
|
+
queryClient.invalidateQueries({ queryKey: executionKeys.ordersPrefix() });
|
|
3931
|
+
queryClient.invalidateQueries({ queryKey: ["execution-orders"] });
|
|
3932
|
+
queryClient.invalidateQueries({ queryKey: executionKeys.positionsPrefix() });
|
|
3933
|
+
invalidateBalanceQueries(queryClient);
|
|
3934
|
+
(_a = options == null ? void 0 : options.onSuccess) == null ? void 0 : _a.call(options, data);
|
|
3935
|
+
},
|
|
3936
|
+
onError: options == null ? void 0 : options.onError
|
|
3937
|
+
});
|
|
3938
|
+
}
|
|
3939
|
+
|
|
3940
|
+
// src/execution/use-cancel-managed-order.ts
|
|
3941
|
+
import { useMutation as useMutation4, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
|
3942
|
+
function useCancelManagedOrder(options) {
|
|
3943
|
+
const client = useAggClient();
|
|
3944
|
+
const queryClient = useQueryClient5();
|
|
3945
|
+
return useMutation4({
|
|
3946
|
+
mutationFn: (orderId) => client.cancelManagedOrder(orderId),
|
|
3947
|
+
onSuccess: (data, orderId) => {
|
|
3948
|
+
var _a;
|
|
3949
|
+
queryClient.invalidateQueries({ queryKey: executionKeys.ordersPrefix() });
|
|
3950
|
+
queryClient.invalidateQueries({ queryKey: ["execution-orders"] });
|
|
3951
|
+
invalidatePositionQueries(queryClient);
|
|
3952
|
+
invalidateBalanceQueries(queryClient);
|
|
3953
|
+
invalidateUserActivityQueries(queryClient);
|
|
3954
|
+
(_a = options == null ? void 0 : options.onSuccess) == null ? void 0 : _a.call(options, data, orderId);
|
|
3955
|
+
},
|
|
3956
|
+
onError: (error, orderId) => {
|
|
3957
|
+
var _a;
|
|
3958
|
+
(_a = options == null ? void 0 : options.onError) == null ? void 0 : _a.call(options, error, orderId);
|
|
3959
|
+
}
|
|
3960
|
+
});
|
|
3961
|
+
}
|
|
3962
|
+
|
|
3963
|
+
// src/execution/use-withdraw-managed.ts
|
|
3964
|
+
import { useMutation as useMutation5, useQueryClient as useQueryClient6 } from "@tanstack/react-query";
|
|
3965
|
+
function useWithdrawManaged(options) {
|
|
3966
|
+
const client = useAggClient();
|
|
3967
|
+
const queryClient = useQueryClient6();
|
|
3968
|
+
return useMutation5({
|
|
3786
3969
|
mutationFn: (params) => client.withdrawManaged(params),
|
|
3787
3970
|
onSuccess: (data) => {
|
|
3788
3971
|
var _a;
|
|
@@ -3890,11 +4073,11 @@ function useDepositAddresses(options) {
|
|
|
3890
4073
|
}
|
|
3891
4074
|
|
|
3892
4075
|
// src/execution/use-sync-balances.ts
|
|
3893
|
-
import { useMutation as
|
|
4076
|
+
import { useMutation as useMutation6, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
3894
4077
|
function useSyncBalances(options) {
|
|
3895
4078
|
const client = useAggClient();
|
|
3896
|
-
const queryClient =
|
|
3897
|
-
return
|
|
4079
|
+
const queryClient = useQueryClient7();
|
|
4080
|
+
return useMutation6({
|
|
3898
4081
|
mutationFn: () => client.syncManagedBalances(),
|
|
3899
4082
|
onSuccess: () => {
|
|
3900
4083
|
var _a;
|
|
@@ -4425,7 +4608,7 @@ var computeClosedPositionTotals = (group) => {
|
|
|
4425
4608
|
};
|
|
4426
4609
|
|
|
4427
4610
|
// src/execution/use-redeem.ts
|
|
4428
|
-
import { useMutation as
|
|
4611
|
+
import { useMutation as useMutation7, useQueryClient as useQueryClient8 } from "@tanstack/react-query";
|
|
4429
4612
|
var RedeemRejectedError = class extends Error {
|
|
4430
4613
|
constructor(message, response) {
|
|
4431
4614
|
super(message);
|
|
@@ -4436,8 +4619,8 @@ var RedeemRejectedError = class extends Error {
|
|
|
4436
4619
|
var isLegRejected = (status) => status === "ineligible" || status === "rejected";
|
|
4437
4620
|
var useRedeem = () => {
|
|
4438
4621
|
const client = useAggClient();
|
|
4439
|
-
const queryClient =
|
|
4440
|
-
return
|
|
4622
|
+
const queryClient = useQueryClient8();
|
|
4623
|
+
return useMutation7({
|
|
4441
4624
|
mutationFn: (body) => __async(null, null, function* () {
|
|
4442
4625
|
const response = yield client.redeem(body);
|
|
4443
4626
|
if (response.results.length > 0 && response.results.every((r) => isLegRejected(r.status))) {
|
|
@@ -4704,6 +4887,8 @@ export {
|
|
|
4704
4887
|
AggProvider,
|
|
4705
4888
|
useQuoteManaged,
|
|
4706
4889
|
useExecuteManaged,
|
|
4890
|
+
usePlaceLimitOrder,
|
|
4891
|
+
useCancelManagedOrder,
|
|
4707
4892
|
useWithdrawManaged,
|
|
4708
4893
|
useManagedBalances,
|
|
4709
4894
|
usePositions,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useOnWithdrawalLifecycle,
|
|
12
12
|
useSyncBalances,
|
|
13
13
|
useWithdrawManaged
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-5NJBAP42.mjs";
|
|
15
15
|
|
|
16
16
|
// src/withdraw/use-withdraw-flow.ts
|
|
17
17
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
package/dist/deposit.js
CHANGED
|
@@ -400,8 +400,14 @@ 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`,
|
|
405
411
|
balanceByNetwork: "Balance by network",
|
|
406
412
|
paperModeNetwork: "Paper",
|
|
407
413
|
paperModeWarning: "Paper mode is enabled. These are simulated funds for paper trading.",
|
|
@@ -484,6 +490,25 @@ var enUsLabels = {
|
|
|
484
490
|
avgPrefix: "avg",
|
|
485
491
|
nowPrefix: "now",
|
|
486
492
|
finalPrefix: "final"
|
|
493
|
+
},
|
|
494
|
+
openOrders: {
|
|
495
|
+
marketHeader: "Market",
|
|
496
|
+
limitPriceHeader: "Limit price",
|
|
497
|
+
filledHeader: "Filled",
|
|
498
|
+
totalHeader: "Total",
|
|
499
|
+
filledShort: "Filled",
|
|
500
|
+
totalShort: "Total",
|
|
501
|
+
expirationHeader: "Expiration",
|
|
502
|
+
goodTilCanceled: "Good 'til canceled",
|
|
503
|
+
expired: "Expired",
|
|
504
|
+
cancel: "Cancel",
|
|
505
|
+
cancelOrderAria: (orderId) => `Cancel order ${orderId}`,
|
|
506
|
+
loading: "Loading open orders",
|
|
507
|
+
loadingMore: "Loading more open orders",
|
|
508
|
+
errorTitle: "Unable to load open orders",
|
|
509
|
+
errorDescription: "Please try again in a moment.",
|
|
510
|
+
emptyTitle: "No open orders",
|
|
511
|
+
emptyDescription: "Your open limit orders will appear here."
|
|
487
512
|
}
|
|
488
513
|
},
|
|
489
514
|
eventList: {
|
|
@@ -625,6 +650,7 @@ var enUsLabels = {
|
|
|
625
650
|
trading: {
|
|
626
651
|
settlementSection: "Settlement",
|
|
627
652
|
settlementDifferencesTitle: "Key differences across venues",
|
|
653
|
+
settlementFullRulesTitle: "Full rules by venue",
|
|
628
654
|
settlementCriticalDifferenceLabel: "Critical",
|
|
629
655
|
settlementValueUnavailable: "Not provided",
|
|
630
656
|
settlementLoading: "Loading settlement",
|
|
@@ -681,6 +707,7 @@ var enUsLabels = {
|
|
|
681
707
|
orderDisabledNoOutcome: "Select an outcome to place an order.",
|
|
682
708
|
orderDisabledNoEvent: "No event selected.",
|
|
683
709
|
insufficientBalance: "Insufficient balance",
|
|
710
|
+
lowLiquidityWarning: "This market has low liquidity, which may impact execution price for larger orders.",
|
|
684
711
|
refreshQuote: "Refresh Quote",
|
|
685
712
|
confirmOrder: "Confirm Order",
|
|
686
713
|
withdrawSubmitted: "Withdrawal submitted",
|
|
@@ -727,6 +754,29 @@ var enUsLabels = {
|
|
|
727
754
|
kycSuccessDone: "Done",
|
|
728
755
|
outcome: (label) => `Outcome: ${label}`,
|
|
729
756
|
smartRouting: "Smart Routing",
|
|
757
|
+
orderTypeMarket: "Market",
|
|
758
|
+
orderTypeLimit: "Limit",
|
|
759
|
+
orderTypeAria: "Order type",
|
|
760
|
+
limitPrice: "Limit price",
|
|
761
|
+
limitPriceInputAria: "Limit price in cents",
|
|
762
|
+
limitPriceInvalid: "Limit price must be greater than 0 and less than 100.",
|
|
763
|
+
limitPriceDecreaseAria: "Decrease limit price",
|
|
764
|
+
limitPriceIncreaseAria: "Increase limit price",
|
|
765
|
+
expiration: "Expiration",
|
|
766
|
+
expirationGoodTilCanceled: "Good 'til canceled",
|
|
767
|
+
expirationFiveMinutes: "5m",
|
|
768
|
+
expirationOneHour: "1h",
|
|
769
|
+
expirationEndOfDay: "End of day (EST)",
|
|
770
|
+
expirationCustom: "Custom",
|
|
771
|
+
expirationMenuAria: "Choose expiration",
|
|
772
|
+
expirationOptions: "Expiration options",
|
|
773
|
+
expirationDateAria: "Limit order expiration date",
|
|
774
|
+
expirationStartTime: "Start time",
|
|
775
|
+
expirationStartTimeHint: "24-hour format",
|
|
776
|
+
expirationCancel: "Cancel",
|
|
777
|
+
expirationApply: "Apply",
|
|
778
|
+
limitOrderPlacedTitle: "Limit order placed",
|
|
779
|
+
limitOrderPlacedDescription: "Your limit order has been submitted.",
|
|
730
780
|
orderSplitting: "Order Splitting",
|
|
731
781
|
splitOrderDescription: "We split your order for the best price:",
|
|
732
782
|
viewAllRoutes: (count) => `View all (${count})`,
|
|
@@ -992,6 +1042,12 @@ var enUsLabels = {
|
|
|
992
1042
|
const venue = venueLabel ? ` on ${venueLabel}` : "";
|
|
993
1043
|
return `${action}${amount}${price}${venue}`.trim();
|
|
994
1044
|
},
|
|
1045
|
+
cancelledTitle: "Order canceled",
|
|
1046
|
+
cancelledMessage: "Your open order was canceled.",
|
|
1047
|
+
cancelPendingTitle: "Cancellation submitted",
|
|
1048
|
+
cancelPendingMessage: "Your cancellation request is being processed.",
|
|
1049
|
+
cancelFailedTitle: "Cancellation failed",
|
|
1050
|
+
cancelFailedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your open order could not be canceled. Please try again.",
|
|
995
1051
|
failedTitle: "Order failed",
|
|
996
1052
|
failedMessage: (errorReason) => errorReason && errorReason.length > 0 ? errorReason : "Your order could not be completed. Please try again."
|
|
997
1053
|
},
|
|
@@ -1111,6 +1167,7 @@ var defaultAggUiConfig = {
|
|
|
1111
1167
|
enableGradients: false,
|
|
1112
1168
|
enableVenueEventDiscoveryFilters: false,
|
|
1113
1169
|
enableNotifications: true,
|
|
1170
|
+
showLimitOrders: false,
|
|
1114
1171
|
showSportsMarkets: false
|
|
1115
1172
|
},
|
|
1116
1173
|
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-DPY6RZNW.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-5NJBAP42.mjs";
|
|
15
15
|
|
|
16
16
|
// src/deposit/normalize-wallet-error.ts
|
|
17
17
|
function normalizeWalletError(error, supportedChains) {
|