@agg-build/hooks 2.1.2 → 2.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/dist/{chunk-7UDYSDKQ.mjs → chunk-56RISN73.mjs} +250 -16
- package/dist/{chunk-FBYQBFFR.mjs → chunk-NZEXGOFC.mjs} +1 -1
- package/dist/{chunk-5VDUIUJB.mjs → chunk-SN4AO5D7.mjs} +1 -1
- package/dist/deposit.d.mts +1 -1
- package/dist/deposit.d.ts +1 -1
- package/dist/deposit.js +88 -18
- package/dist/deposit.mjs +30 -9
- package/dist/index.d.mts +109 -43
- package/dist/index.d.ts +109 -43
- package/dist/index.js +491 -107
- package/dist/index.mjs +202 -51
- package/dist/withdraw.js +49 -2
- package/dist/withdraw.mjs +2 -2
- package/package.json +2 -2
|
@@ -662,6 +662,8 @@ var enUsLabels = {
|
|
|
662
662
|
showOutcomeAria: (label) => `Show ${label} outcome`,
|
|
663
663
|
viewResolved: "View resolved",
|
|
664
664
|
hideResolved: "Hide resolved",
|
|
665
|
+
resolvingTitle: "Resolving market\u2026",
|
|
666
|
+
resolvingDescription: "This market has closed. We're waiting for final settlement data and will update the result once it's confirmed on-chain.",
|
|
665
667
|
volumeUnavailable: "Volume unavailable",
|
|
666
668
|
tabs: {
|
|
667
669
|
orderBook: "Order Book",
|
|
@@ -980,7 +982,51 @@ var enUsLabels = {
|
|
|
980
982
|
winningOutcome: (label) => `Winning outcome: ${label}`,
|
|
981
983
|
resolvedOutcome: (label) => `Resolved: ${label}`,
|
|
982
984
|
marketDetailsAriaByDate: (dateLabel) => `Market details for ${dateLabel}`,
|
|
983
|
-
marketDetailsAriaByQuestion: (question) => `Market details for ${question}
|
|
985
|
+
marketDetailsAriaByQuestion: (question) => `Market details for ${question}`,
|
|
986
|
+
sports: {
|
|
987
|
+
summaryAria: "Sports event summary",
|
|
988
|
+
sectionTabsAria: "Sports market sections",
|
|
989
|
+
lineSelectorAria: (marketTitle) => `Select line for ${marketTitle}`,
|
|
990
|
+
previousLineAria: (marketTitle) => `Show previous lines for ${marketTitle}`,
|
|
991
|
+
nextLineAria: (marketTitle) => `Show next lines for ${marketTitle}`,
|
|
992
|
+
comparisonToggleAria: (marketTitle, expanded) => `${expanded ? "Hide" : "Show"} venue comparison for ${marketTitle}`,
|
|
993
|
+
comparisonTitle: "Venue alternatives",
|
|
994
|
+
compareVenues: (count) => `Compare ${count} venues`,
|
|
995
|
+
marketCount: (count) => `${count} markets`,
|
|
996
|
+
venueCount: (count) => `${count} venues`,
|
|
997
|
+
volumeShort: "Vol.",
|
|
998
|
+
totalVolumeShort: "Total Vol.",
|
|
999
|
+
gameStarts: "Game starts",
|
|
1000
|
+
moreMarketsTitle: "More markets",
|
|
1001
|
+
gameLinesTab: "Game Lines",
|
|
1002
|
+
halvesTab: "Halves",
|
|
1003
|
+
exactScoreTab: "Exact Score",
|
|
1004
|
+
cornersTab: "Corners",
|
|
1005
|
+
goalsTab: "Goals",
|
|
1006
|
+
assistsTab: "Assists",
|
|
1007
|
+
shotsTab: "Shots",
|
|
1008
|
+
otherTab: "Other",
|
|
1009
|
+
moneylineTitle: "Moneyline",
|
|
1010
|
+
spreadTitle: "Spreads",
|
|
1011
|
+
totalTitle: "Totals",
|
|
1012
|
+
fullPeriod: "Regular time",
|
|
1013
|
+
firstHalfPeriod: "1st half",
|
|
1014
|
+
secondHalfPeriod: "2nd half",
|
|
1015
|
+
quarterOnePeriod: "1st quarter",
|
|
1016
|
+
quarterTwoPeriod: "2nd quarter",
|
|
1017
|
+
quarterThreePeriod: "3rd quarter",
|
|
1018
|
+
quarterFourPeriod: "4th quarter",
|
|
1019
|
+
overtimePeriod: "Overtime",
|
|
1020
|
+
otherPeriod: "Other",
|
|
1021
|
+
loadingTitle: "Loading section",
|
|
1022
|
+
loadingDescription: "Fetching the latest markets for this game.",
|
|
1023
|
+
emptyTitle: "No markets available",
|
|
1024
|
+
emptyDescription: (sectionLabel) => `There are no ${sectionLabel} markets yet.`,
|
|
1025
|
+
loadMore: "Load more",
|
|
1026
|
+
loadingMore: "Loading more",
|
|
1027
|
+
bestPriceBadge: "Best price",
|
|
1028
|
+
selectOutcomeAria: (marketTitle, outcomeLabel, priceLabel) => `Select ${outcomeLabel} in ${marketTitle} at ${priceLabel}`
|
|
1029
|
+
}
|
|
984
1030
|
},
|
|
985
1031
|
header: {
|
|
986
1032
|
bannerAria: "Site header",
|
|
@@ -1142,7 +1188,8 @@ var defaultAggUiConfig = {
|
|
|
1142
1188
|
showFeesBreakdown: false,
|
|
1143
1189
|
enableGradients: false,
|
|
1144
1190
|
enableVenueEventDiscoveryFilters: false,
|
|
1145
|
-
enableNotifications: true
|
|
1191
|
+
enableNotifications: true,
|
|
1192
|
+
showSportsMarkets: false
|
|
1146
1193
|
},
|
|
1147
1194
|
market: {
|
|
1148
1195
|
arbitrageThreshold: 0,
|
|
@@ -1173,7 +1220,7 @@ var mergeAggUiSearchConfig = (config) => {
|
|
|
1173
1220
|
};
|
|
1174
1221
|
};
|
|
1175
1222
|
var mergeAggUiConfig = (persisted, config) => {
|
|
1176
|
-
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;
|
|
1223
|
+
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;
|
|
1177
1224
|
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;
|
|
1178
1225
|
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;
|
|
1179
1226
|
const formatters = createFormatters(locale);
|
|
@@ -1195,27 +1242,28 @@ var mergeAggUiConfig = (persisted, config) => {
|
|
|
1195
1242
|
showFeesBreakdown: (_v = (_u = config == null ? void 0 : config.features) == null ? void 0 : _u.showFeesBreakdown) != null ? _v : defaultAggUiConfig.features.showFeesBreakdown,
|
|
1196
1243
|
enableGradients: (_x = (_w = config == null ? void 0 : config.features) == null ? void 0 : _w.enableGradients) != null ? _x : defaultAggUiConfig.features.enableGradients,
|
|
1197
1244
|
enableVenueEventDiscoveryFilters: (_z = (_y = config == null ? void 0 : config.features) == null ? void 0 : _y.enableVenueEventDiscoveryFilters) != null ? _z : defaultAggUiConfig.features.enableVenueEventDiscoveryFilters,
|
|
1198
|
-
enableNotifications: (_B = (_A = config == null ? void 0 : config.features) == null ? void 0 : _A.enableNotifications) != null ? _B : defaultAggUiConfig.features.enableNotifications
|
|
1245
|
+
enableNotifications: (_B = (_A = config == null ? void 0 : config.features) == null ? void 0 : _A.enableNotifications) != null ? _B : defaultAggUiConfig.features.enableNotifications,
|
|
1246
|
+
showSportsMarkets: (_D = (_C = config == null ? void 0 : config.features) == null ? void 0 : _C.showSportsMarkets) != null ? _D : defaultAggUiConfig.features.showSportsMarkets
|
|
1199
1247
|
},
|
|
1200
1248
|
market: {
|
|
1201
|
-
arbitrageThreshold: (
|
|
1202
|
-
maxMidpointIdsPerRequest: (
|
|
1249
|
+
arbitrageThreshold: (_F = (_E = config == null ? void 0 : config.market) == null ? void 0 : _E.arbitrageThreshold) != null ? _F : defaultAggUiConfig.market.arbitrageThreshold,
|
|
1250
|
+
maxMidpointIdsPerRequest: (_H = (_G = config == null ? void 0 : config.market) == null ? void 0 : _G.maxMidpointIdsPerRequest) != null ? _H : defaultAggUiConfig.market.maxMidpointIdsPerRequest
|
|
1203
1251
|
},
|
|
1204
1252
|
chart: {
|
|
1205
|
-
defaultChartTimeRange: (
|
|
1206
|
-
selectedChartTimeRange: (
|
|
1253
|
+
defaultChartTimeRange: (_J = (_I = config == null ? void 0 : config.chart) == null ? void 0 : _I.defaultChartTimeRange) != null ? _J : defaultAggUiConfig.chart.defaultChartTimeRange,
|
|
1254
|
+
selectedChartTimeRange: (_N = (_M = (_K = persisted.chart) == null ? void 0 : _K.selectedChartTimeRange) != null ? _M : (_L = config == null ? void 0 : config.chart) == null ? void 0 : _L.defaultChartTimeRange) != null ? _N : defaultAggUiConfig.chart.defaultChartTimeRange,
|
|
1207
1255
|
setSelectedChartTimeRange: defaultAggUiConfig.chart.setSelectedChartTimeRange
|
|
1208
1256
|
},
|
|
1209
1257
|
formatting: {
|
|
1210
|
-
formatNumber: (
|
|
1211
|
-
formatPercent: (
|
|
1212
|
-
formatCurrency: (
|
|
1213
|
-
formatCompactCurrency: (
|
|
1214
|
-
formatDate: (
|
|
1258
|
+
formatNumber: (_P = (_O = config == null ? void 0 : config.formatting) == null ? void 0 : _O.formatNumber) != null ? _P : formatters.formatNumber,
|
|
1259
|
+
formatPercent: (_R = (_Q = config == null ? void 0 : config.formatting) == null ? void 0 : _Q.formatPercent) != null ? _R : formatters.formatPercent,
|
|
1260
|
+
formatCurrency: (_T = (_S = config == null ? void 0 : config.formatting) == null ? void 0 : _S.formatCurrency) != null ? _T : formatters.formatCurrency,
|
|
1261
|
+
formatCompactCurrency: (_V = (_U = config == null ? void 0 : config.formatting) == null ? void 0 : _U.formatCompactCurrency) != null ? _V : formatters.formatCompactCurrency,
|
|
1262
|
+
formatDate: (_X = (_W = config == null ? void 0 : config.formatting) == null ? void 0 : _W.formatDate) != null ? _X : formatters.formatDate
|
|
1215
1263
|
},
|
|
1216
1264
|
search: mergeAggUiSearchConfig(config == null ? void 0 : config.search),
|
|
1217
1265
|
trading: {
|
|
1218
|
-
executionMode: (
|
|
1266
|
+
executionMode: (_Z = (_Y = config == null ? void 0 : config.trading) == null ? void 0 : _Y.executionMode) != null ? _Z : defaultAggUiConfig.trading.executionMode
|
|
1219
1267
|
},
|
|
1220
1268
|
walletActions: config == null ? void 0 : config.walletActions,
|
|
1221
1269
|
solanaRpcUrl: config == null ? void 0 : config.solanaRpcUrl
|
|
@@ -3870,6 +3918,7 @@ function mapOrderStatusToTerminalEvent(status) {
|
|
|
3870
3918
|
}
|
|
3871
3919
|
function useExecutionProgress({
|
|
3872
3920
|
orderIds,
|
|
3921
|
+
quoteId,
|
|
3873
3922
|
enabled,
|
|
3874
3923
|
mode
|
|
3875
3924
|
}) {
|
|
@@ -4045,17 +4094,202 @@ function useExecutionProgress({
|
|
|
4045
4094
|
return;
|
|
4046
4095
|
}
|
|
4047
4096
|
}, []);
|
|
4048
|
-
const
|
|
4097
|
+
const isStatusPolling = enabled && !!quoteId;
|
|
4098
|
+
const isListening = !isStatusPolling && enabled && !!orderIds && orderIds.length > 0;
|
|
4049
4099
|
useOnOrderSubmitted(isListening ? handleOrderSubmitted : null);
|
|
4050
4100
|
useOnBalanceUpdate(isListening ? handleBalanceUpdate : null);
|
|
4051
4101
|
useOnOrderEvent(isListening ? handleOrderEvent : null);
|
|
4052
4102
|
const client = useAggClient();
|
|
4053
4103
|
const terminalOrderIdsRef = useRef5(/* @__PURE__ */ new Set());
|
|
4054
4104
|
const pollInFlightRef = useRef5(false);
|
|
4105
|
+
const buildSubmittedOrdersFromStatus = useCallback7(
|
|
4106
|
+
(orders) => {
|
|
4107
|
+
return orders.map((order) => {
|
|
4108
|
+
var _a, _b;
|
|
4109
|
+
return {
|
|
4110
|
+
type: "order_submitted",
|
|
4111
|
+
venue: order.venue,
|
|
4112
|
+
orderId: order.orderId,
|
|
4113
|
+
side: "",
|
|
4114
|
+
price: Number((_b = (_a = order.executionPriceRaw) != null ? _a : order.quotedPriceRaw) != null ? _b : 0),
|
|
4115
|
+
size: 0,
|
|
4116
|
+
timestamp: new Date(order.updatedAt).getTime() / 1e3
|
|
4117
|
+
};
|
|
4118
|
+
});
|
|
4119
|
+
},
|
|
4120
|
+
[]
|
|
4121
|
+
);
|
|
4122
|
+
const buildTerminalEventsFromStatus = useCallback7(
|
|
4123
|
+
(status, fallbackOrderIds, fallbackTimestamp) => {
|
|
4124
|
+
const terminalEvents = status.orders.map((order) => {
|
|
4125
|
+
var _a, _b;
|
|
4126
|
+
const mappedEvent = (_a = order.event) != null ? _a : mapOrderStatusToTerminalEvent(order.status);
|
|
4127
|
+
if (!mappedEvent) return null;
|
|
4128
|
+
return {
|
|
4129
|
+
orderId: order.orderId,
|
|
4130
|
+
venue: order.venue,
|
|
4131
|
+
event: mappedEvent,
|
|
4132
|
+
filledAmountRaw: order.filledAmountRaw,
|
|
4133
|
+
remainingAmountRaw: order.remainingAmountRaw,
|
|
4134
|
+
actualSharesRaw: order.actualSharesRaw,
|
|
4135
|
+
actualToWinRaw: order.actualToWinRaw,
|
|
4136
|
+
quotedSharesRaw: order.quotedSharesRaw,
|
|
4137
|
+
quotedToWinRaw: order.quotedToWinRaw,
|
|
4138
|
+
executionPriceRaw: order.executionPriceRaw,
|
|
4139
|
+
quotedPriceRaw: order.quotedPriceRaw,
|
|
4140
|
+
errorReason: (_b = order.errorReason) != null ? _b : order.partialFillReason,
|
|
4141
|
+
timestamp: new Date(order.updatedAt).getTime() || fallbackTimestamp
|
|
4142
|
+
};
|
|
4143
|
+
}).filter((order) => order != null);
|
|
4144
|
+
if (!status.terminal || terminalEvents.length > 0 || !["failed", "cancelled", "expired"].includes(status.overallState)) {
|
|
4145
|
+
return terminalEvents;
|
|
4146
|
+
}
|
|
4147
|
+
return fallbackOrderIds.map((orderId) => {
|
|
4148
|
+
var _a;
|
|
4149
|
+
return {
|
|
4150
|
+
orderId,
|
|
4151
|
+
venue: "",
|
|
4152
|
+
event: "failed",
|
|
4153
|
+
errorReason: (_a = status.errorReason) != null ? _a : "Execution failed.",
|
|
4154
|
+
timestamp: fallbackTimestamp
|
|
4155
|
+
};
|
|
4156
|
+
});
|
|
4157
|
+
},
|
|
4158
|
+
[]
|
|
4159
|
+
);
|
|
4160
|
+
const setFatalPollingFailure = useCallback7((message, failedOrderIds) => {
|
|
4161
|
+
setDagProgress((prev) => {
|
|
4162
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4163
|
+
return {
|
|
4164
|
+
dagRunId: (_a = prev == null ? void 0 : prev.dagRunId) != null ? _a : "",
|
|
4165
|
+
totalSteps: (_b = prev == null ? void 0 : prev.totalSteps) != null ? _b : 0,
|
|
4166
|
+
currentSequence: (_c = prev == null ? void 0 : prev.currentSequence) != null ? _c : 0,
|
|
4167
|
+
currentStepType: (_d = prev == null ? void 0 : prev.currentStepType) != null ? _d : null,
|
|
4168
|
+
completedSequences: (_e = prev == null ? void 0 : prev.completedSequences) != null ? _e : [],
|
|
4169
|
+
stepTypes: (_f = prev == null ? void 0 : prev.stepTypes) != null ? _f : {},
|
|
4170
|
+
status: "failed",
|
|
4171
|
+
errorReason: message
|
|
4172
|
+
};
|
|
4173
|
+
});
|
|
4174
|
+
setTerminalOrderEvents((prev) => {
|
|
4175
|
+
const existingByOrderId = new Map(prev.map((event) => [event.orderId, event]));
|
|
4176
|
+
const timestamp = Date.now();
|
|
4177
|
+
for (const orderId of failedOrderIds) {
|
|
4178
|
+
if (existingByOrderId.has(orderId)) continue;
|
|
4179
|
+
existingByOrderId.set(orderId, {
|
|
4180
|
+
orderId,
|
|
4181
|
+
venue: "",
|
|
4182
|
+
event: "failed",
|
|
4183
|
+
errorReason: message,
|
|
4184
|
+
timestamp
|
|
4185
|
+
});
|
|
4186
|
+
}
|
|
4187
|
+
return Array.from(existingByOrderId.values()).sort(
|
|
4188
|
+
(left, right) => left.timestamp - right.timestamp
|
|
4189
|
+
);
|
|
4190
|
+
});
|
|
4191
|
+
}, []);
|
|
4055
4192
|
useEffect5(() => {
|
|
4056
4193
|
terminalOrderIdsRef.current = new Set(terminalOrderEvents.map((e) => e.orderId));
|
|
4057
4194
|
}, [terminalOrderEvents]);
|
|
4058
4195
|
useEffect5(() => {
|
|
4196
|
+
if (!isStatusPolling || !quoteId) return;
|
|
4197
|
+
let cancelled = false;
|
|
4198
|
+
let timeout = null;
|
|
4199
|
+
const stopPolling = () => {
|
|
4200
|
+
if (timeout !== null) {
|
|
4201
|
+
clearTimeout(timeout);
|
|
4202
|
+
timeout = null;
|
|
4203
|
+
}
|
|
4204
|
+
};
|
|
4205
|
+
const scheduleNextPoll = (delayMs) => {
|
|
4206
|
+
if (cancelled) return;
|
|
4207
|
+
timeout = setTimeout(() => {
|
|
4208
|
+
void pollExecutionStatus();
|
|
4209
|
+
}, delayMs != null ? delayMs : ORDER_POLL_INTERVAL_MS);
|
|
4210
|
+
};
|
|
4211
|
+
const pollExecutionStatus = () => __async(null, null, function* () {
|
|
4212
|
+
if (cancelled || pollInFlightRef.current) return;
|
|
4213
|
+
pollInFlightRef.current = true;
|
|
4214
|
+
try {
|
|
4215
|
+
const status = yield client.getExecutionStatus(__spreadValues({
|
|
4216
|
+
quoteId
|
|
4217
|
+
}, mode ? { mode } : {}));
|
|
4218
|
+
if (cancelled) return;
|
|
4219
|
+
const resolvedOrderIds = status.orderIds.length > 0 ? status.orderIds : orderIds != null ? orderIds : [];
|
|
4220
|
+
if (resolvedOrderIds.length > 0) {
|
|
4221
|
+
setPhase("order_submitted");
|
|
4222
|
+
}
|
|
4223
|
+
setSubmittedOrders(buildSubmittedOrdersFromStatus(status.orders));
|
|
4224
|
+
if (status.dagProgress) {
|
|
4225
|
+
setDagProgress(__spreadProps(__spreadValues({}, status.dagProgress), {
|
|
4226
|
+
stepTypes: Object.fromEntries(
|
|
4227
|
+
Object.entries(status.dagProgress.stepTypes).map(([sequence, stepType]) => [
|
|
4228
|
+
Number(sequence),
|
|
4229
|
+
stepType
|
|
4230
|
+
])
|
|
4231
|
+
)
|
|
4232
|
+
}));
|
|
4233
|
+
} else if (status.terminal && ["failed", "cancelled", "expired"].includes(status.overallState)) {
|
|
4234
|
+
setDagProgress((prev) => {
|
|
4235
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
4236
|
+
return {
|
|
4237
|
+
dagRunId: (_b = (_a = prev == null ? void 0 : prev.dagRunId) != null ? _a : status.executionId) != null ? _b : "",
|
|
4238
|
+
totalSteps: (_c = prev == null ? void 0 : prev.totalSteps) != null ? _c : status.steps.length,
|
|
4239
|
+
currentSequence: (_d = prev == null ? void 0 : prev.currentSequence) != null ? _d : 0,
|
|
4240
|
+
currentStepType: (_e = prev == null ? void 0 : prev.currentStepType) != null ? _e : null,
|
|
4241
|
+
completedSequences: (_f = prev == null ? void 0 : prev.completedSequences) != null ? _f : [],
|
|
4242
|
+
stepTypes: (_g = prev == null ? void 0 : prev.stepTypes) != null ? _g : {},
|
|
4243
|
+
status: "failed",
|
|
4244
|
+
errorReason: status.errorReason
|
|
4245
|
+
};
|
|
4246
|
+
});
|
|
4247
|
+
}
|
|
4248
|
+
const fallbackTimestamp = Date.now();
|
|
4249
|
+
const nextTerminalEvents = buildTerminalEventsFromStatus(
|
|
4250
|
+
status,
|
|
4251
|
+
resolvedOrderIds,
|
|
4252
|
+
fallbackTimestamp
|
|
4253
|
+
);
|
|
4254
|
+
setTerminalOrderEvents(nextTerminalEvents);
|
|
4255
|
+
if (status.terminal) {
|
|
4256
|
+
stopPolling();
|
|
4257
|
+
return;
|
|
4258
|
+
}
|
|
4259
|
+
scheduleNextPoll(status.pollAfterMs);
|
|
4260
|
+
} catch (error) {
|
|
4261
|
+
if (cancelled) return;
|
|
4262
|
+
const statusCode = typeof error === "object" && error != null && "status" in error && typeof error.status === "number" ? error.status : null;
|
|
4263
|
+
if (statusCode === 400 || statusCode === 401 || statusCode === 403) {
|
|
4264
|
+
setFatalPollingFailure(
|
|
4265
|
+
error instanceof Error ? error.message : "Execution status polling failed.",
|
|
4266
|
+
orderIds != null ? orderIds : []
|
|
4267
|
+
);
|
|
4268
|
+
stopPolling();
|
|
4269
|
+
return;
|
|
4270
|
+
}
|
|
4271
|
+
scheduleNextPoll(ORDER_POLL_INTERVAL_MS);
|
|
4272
|
+
} finally {
|
|
4273
|
+
pollInFlightRef.current = false;
|
|
4274
|
+
}
|
|
4275
|
+
});
|
|
4276
|
+
void pollExecutionStatus();
|
|
4277
|
+
return () => {
|
|
4278
|
+
cancelled = true;
|
|
4279
|
+
stopPolling();
|
|
4280
|
+
};
|
|
4281
|
+
}, [
|
|
4282
|
+
buildSubmittedOrdersFromStatus,
|
|
4283
|
+
buildTerminalEventsFromStatus,
|
|
4284
|
+
client,
|
|
4285
|
+
isStatusPolling,
|
|
4286
|
+
mode,
|
|
4287
|
+
orderIds,
|
|
4288
|
+
quoteId,
|
|
4289
|
+
setFatalPollingFailure
|
|
4290
|
+
]);
|
|
4291
|
+
useEffect5(() => {
|
|
4292
|
+
if (isStatusPolling) return;
|
|
4059
4293
|
if (!isListening || !(orderIds == null ? void 0 : orderIds.length)) return;
|
|
4060
4294
|
let cancelled = false;
|
|
4061
4295
|
let interval = null;
|
|
@@ -4143,7 +4377,7 @@ function useExecutionProgress({
|
|
|
4143
4377
|
cancelled = true;
|
|
4144
4378
|
stopPolling();
|
|
4145
4379
|
};
|
|
4146
|
-
}, [client, isListening, mode, orderIds]);
|
|
4380
|
+
}, [client, isListening, isStatusPolling, mode, orderIds]);
|
|
4147
4381
|
return { phase, submittedOrders, latestBalance, dagProgress, terminalOrderEvents };
|
|
4148
4382
|
}
|
|
4149
4383
|
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useOnWithdrawalLifecycle,
|
|
12
12
|
useSyncBalances,
|
|
13
13
|
useWithdrawManaged
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-56RISN73.mjs";
|
|
15
15
|
|
|
16
16
|
// src/withdraw/use-withdraw-flow.ts
|
|
17
17
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
package/dist/deposit.d.mts
CHANGED
|
@@ -189,7 +189,7 @@ declare function useDepositFlow(options: UseDepositFlowOptions): UseDepositFlowR
|
|
|
189
189
|
* Back-compat alias for callers that still want a single default endpoint.
|
|
190
190
|
* New code should prefer the full list and the failover helper.
|
|
191
191
|
*/
|
|
192
|
-
declare const DEFAULT_SOLANA_RPC_ENDPOINT
|
|
192
|
+
declare const DEFAULT_SOLANA_RPC_ENDPOINT = "https://solana-rpc.publicnode.com";
|
|
193
193
|
declare const SVM_CHAIN_IDS: ReadonlySet<number>;
|
|
194
194
|
|
|
195
195
|
export { DEFAULT_SOLANA_RPC_ENDPOINT, SVM_CHAIN_IDS, type UseDepositFlowOptions, type UseDepositFlowResult, type UseWalletSendTokenParams, type UseWalletTokenBalanceParams, type UseWalletTokenBalanceResult, type UseWalletTransactionStatusParams, type UseWalletTransactionStatusResult, type WalletTransactionStatus, normalizeWalletError, useDepositFlow, useWalletSendToken, useWalletTokenBalance, useWalletTransactionStatus };
|
package/dist/deposit.d.ts
CHANGED
|
@@ -189,7 +189,7 @@ declare function useDepositFlow(options: UseDepositFlowOptions): UseDepositFlowR
|
|
|
189
189
|
* Back-compat alias for callers that still want a single default endpoint.
|
|
190
190
|
* New code should prefer the full list and the failover helper.
|
|
191
191
|
*/
|
|
192
|
-
declare const DEFAULT_SOLANA_RPC_ENDPOINT
|
|
192
|
+
declare const DEFAULT_SOLANA_RPC_ENDPOINT = "https://solana-rpc.publicnode.com";
|
|
193
193
|
declare const SVM_CHAIN_IDS: ReadonlySet<number>;
|
|
194
194
|
|
|
195
195
|
export { DEFAULT_SOLANA_RPC_ENDPOINT, SVM_CHAIN_IDS, type UseDepositFlowOptions, type UseDepositFlowResult, type UseWalletSendTokenParams, type UseWalletTokenBalanceParams, type UseWalletTokenBalanceResult, type UseWalletTransactionStatusParams, type UseWalletTransactionStatusResult, type WalletTransactionStatus, normalizeWalletError, useDepositFlow, useWalletSendToken, useWalletTokenBalance, useWalletTransactionStatus };
|
package/dist/deposit.js
CHANGED
|
@@ -92,17 +92,18 @@ function normalizeWalletError(error, supportedChains) {
|
|
|
92
92
|
|
|
93
93
|
// src/deposit/use-wallet-token-balance.ts
|
|
94
94
|
var import_web32 = require("@solana/web3.js");
|
|
95
|
-
var
|
|
95
|
+
var import_react_query2 = require("@tanstack/react-query");
|
|
96
96
|
var import_viem = require("viem");
|
|
97
97
|
var import_wagmi = require("wagmi");
|
|
98
98
|
|
|
99
99
|
// src/deposit/constants.ts
|
|
100
100
|
var DEFAULT_SOLANA_RPC_ENDPOINTS = [
|
|
101
|
+
"https://solana-mainnet.g.alchemy.com/v2",
|
|
101
102
|
"https://solana-rpc.publicnode.com",
|
|
102
103
|
"https://api.mainnet.solana.com",
|
|
103
104
|
"https://rpc.ankr.com/solana"
|
|
104
105
|
];
|
|
105
|
-
var DEFAULT_SOLANA_RPC_ENDPOINT =
|
|
106
|
+
var DEFAULT_SOLANA_RPC_ENDPOINT = "https://solana-rpc.publicnode.com";
|
|
106
107
|
var SVM_CHAIN_IDS = /* @__PURE__ */ new Set([792703809]);
|
|
107
108
|
var MULTI_CHAIN_SOLANA_WALLET_NAMES = /* @__PURE__ */ new Set(["Phantom"]);
|
|
108
109
|
|
|
@@ -137,6 +138,7 @@ function useSvmAddress() {
|
|
|
137
138
|
// src/deposit/svm-connections.ts
|
|
138
139
|
var import_web3 = require("@solana/web3.js");
|
|
139
140
|
var import_react4 = require("react");
|
|
141
|
+
var import_react_query = require("@tanstack/react-query");
|
|
140
142
|
|
|
141
143
|
// src/core/providers/contexts.ts
|
|
142
144
|
var import_react2 = require("react");
|
|
@@ -597,6 +599,8 @@ var enUsLabels = {
|
|
|
597
599
|
showOutcomeAria: (label) => `Show ${label} outcome`,
|
|
598
600
|
viewResolved: "View resolved",
|
|
599
601
|
hideResolved: "Hide resolved",
|
|
602
|
+
resolvingTitle: "Resolving market\u2026",
|
|
603
|
+
resolvingDescription: "This market has closed. We're waiting for final settlement data and will update the result once it's confirmed on-chain.",
|
|
600
604
|
volumeUnavailable: "Volume unavailable",
|
|
601
605
|
tabs: {
|
|
602
606
|
orderBook: "Order Book",
|
|
@@ -915,7 +919,51 @@ var enUsLabels = {
|
|
|
915
919
|
winningOutcome: (label) => `Winning outcome: ${label}`,
|
|
916
920
|
resolvedOutcome: (label) => `Resolved: ${label}`,
|
|
917
921
|
marketDetailsAriaByDate: (dateLabel) => `Market details for ${dateLabel}`,
|
|
918
|
-
marketDetailsAriaByQuestion: (question) => `Market details for ${question}
|
|
922
|
+
marketDetailsAriaByQuestion: (question) => `Market details for ${question}`,
|
|
923
|
+
sports: {
|
|
924
|
+
summaryAria: "Sports event summary",
|
|
925
|
+
sectionTabsAria: "Sports market sections",
|
|
926
|
+
lineSelectorAria: (marketTitle) => `Select line for ${marketTitle}`,
|
|
927
|
+
previousLineAria: (marketTitle) => `Show previous lines for ${marketTitle}`,
|
|
928
|
+
nextLineAria: (marketTitle) => `Show next lines for ${marketTitle}`,
|
|
929
|
+
comparisonToggleAria: (marketTitle, expanded) => `${expanded ? "Hide" : "Show"} venue comparison for ${marketTitle}`,
|
|
930
|
+
comparisonTitle: "Venue alternatives",
|
|
931
|
+
compareVenues: (count) => `Compare ${count} venues`,
|
|
932
|
+
marketCount: (count) => `${count} markets`,
|
|
933
|
+
venueCount: (count) => `${count} venues`,
|
|
934
|
+
volumeShort: "Vol.",
|
|
935
|
+
totalVolumeShort: "Total Vol.",
|
|
936
|
+
gameStarts: "Game starts",
|
|
937
|
+
moreMarketsTitle: "More markets",
|
|
938
|
+
gameLinesTab: "Game Lines",
|
|
939
|
+
halvesTab: "Halves",
|
|
940
|
+
exactScoreTab: "Exact Score",
|
|
941
|
+
cornersTab: "Corners",
|
|
942
|
+
goalsTab: "Goals",
|
|
943
|
+
assistsTab: "Assists",
|
|
944
|
+
shotsTab: "Shots",
|
|
945
|
+
otherTab: "Other",
|
|
946
|
+
moneylineTitle: "Moneyline",
|
|
947
|
+
spreadTitle: "Spreads",
|
|
948
|
+
totalTitle: "Totals",
|
|
949
|
+
fullPeriod: "Regular time",
|
|
950
|
+
firstHalfPeriod: "1st half",
|
|
951
|
+
secondHalfPeriod: "2nd half",
|
|
952
|
+
quarterOnePeriod: "1st quarter",
|
|
953
|
+
quarterTwoPeriod: "2nd quarter",
|
|
954
|
+
quarterThreePeriod: "3rd quarter",
|
|
955
|
+
quarterFourPeriod: "4th quarter",
|
|
956
|
+
overtimePeriod: "Overtime",
|
|
957
|
+
otherPeriod: "Other",
|
|
958
|
+
loadingTitle: "Loading section",
|
|
959
|
+
loadingDescription: "Fetching the latest markets for this game.",
|
|
960
|
+
emptyTitle: "No markets available",
|
|
961
|
+
emptyDescription: (sectionLabel) => `There are no ${sectionLabel} markets yet.`,
|
|
962
|
+
loadMore: "Load more",
|
|
963
|
+
loadingMore: "Loading more",
|
|
964
|
+
bestPriceBadge: "Best price",
|
|
965
|
+
selectOutcomeAria: (marketTitle, outcomeLabel, priceLabel) => `Select ${outcomeLabel} in ${marketTitle} at ${priceLabel}`
|
|
966
|
+
}
|
|
919
967
|
},
|
|
920
968
|
header: {
|
|
921
969
|
bannerAria: "Site header",
|
|
@@ -1057,7 +1105,8 @@ var defaultAggUiConfig = {
|
|
|
1057
1105
|
showFeesBreakdown: false,
|
|
1058
1106
|
enableGradients: false,
|
|
1059
1107
|
enableVenueEventDiscoveryFilters: false,
|
|
1060
|
-
enableNotifications: true
|
|
1108
|
+
enableNotifications: true,
|
|
1109
|
+
showSportsMarkets: false
|
|
1061
1110
|
},
|
|
1062
1111
|
market: {
|
|
1063
1112
|
arbitrageThreshold: 0,
|
|
@@ -1170,6 +1219,9 @@ var useAggClient = () => {
|
|
|
1170
1219
|
}
|
|
1171
1220
|
return client;
|
|
1172
1221
|
};
|
|
1222
|
+
var useOptionalAggClient = () => {
|
|
1223
|
+
return (0, import_react3.useContext)(AggClientContext);
|
|
1224
|
+
};
|
|
1173
1225
|
var useAggUiConfig = () => {
|
|
1174
1226
|
return (0, import_react3.useContext)(AggUiContext);
|
|
1175
1227
|
};
|
|
@@ -1205,10 +1257,28 @@ function resolveSvmRpcEndpoints(partnerUrl) {
|
|
|
1205
1257
|
}
|
|
1206
1258
|
function useSvmConnections(commitment) {
|
|
1207
1259
|
const { solanaRpcUrl } = useAggUiConfig();
|
|
1260
|
+
const client = useOptionalAggClient();
|
|
1261
|
+
const { data: tokenData } = (0, import_react_query.useQuery)({
|
|
1262
|
+
queryKey: ["alchemy-rpc-token"],
|
|
1263
|
+
queryFn: () => client ? client.getRpcToken() : Promise.resolve({ token: "", expiresAt: 0 }),
|
|
1264
|
+
enabled: !!client,
|
|
1265
|
+
staleTime: 50 * 60 * 1e3
|
|
1266
|
+
// 50 minutes cache (token is valid for 1h)
|
|
1267
|
+
});
|
|
1268
|
+
const token = tokenData == null ? void 0 : tokenData.token;
|
|
1208
1269
|
return (0, import_react4.useMemo)(() => {
|
|
1209
1270
|
const endpoints = resolveSvmRpcEndpoints(solanaRpcUrl);
|
|
1210
|
-
return endpoints.map((url) =>
|
|
1211
|
-
|
|
1271
|
+
return endpoints.map((url) => {
|
|
1272
|
+
const headers = {};
|
|
1273
|
+
if (url.includes("alchemy.com") && token) {
|
|
1274
|
+
headers["Authorization"] = `Bearer ${token}`;
|
|
1275
|
+
}
|
|
1276
|
+
return new import_web3.Connection(url, {
|
|
1277
|
+
commitment,
|
|
1278
|
+
httpHeaders: Object.keys(headers).length > 0 ? headers : void 0
|
|
1279
|
+
});
|
|
1280
|
+
});
|
|
1281
|
+
}, [solanaRpcUrl, commitment, token]);
|
|
1212
1282
|
}
|
|
1213
1283
|
function withSvmFailover(connections, operation) {
|
|
1214
1284
|
return __async(this, null, function* () {
|
|
@@ -1303,7 +1373,7 @@ function useWalletTokenBalance({
|
|
|
1303
1373
|
const resolvedSvmAddress = detectedSvmAddress != null ? detectedSvmAddress : svmAddress;
|
|
1304
1374
|
const svmEnabled = isOpen && isSvm && !!resolvedSvmAddress && !!tokenAddress;
|
|
1305
1375
|
const svmConnections = useSvmConnections();
|
|
1306
|
-
const svmQuery = (0,
|
|
1376
|
+
const svmQuery = (0, import_react_query2.useQuery)({
|
|
1307
1377
|
queryKey: ["svm-token-balance", resolvedSvmAddress != null ? resolvedSvmAddress : null, tokenAddress != null ? tokenAddress : null, isOpen],
|
|
1308
1378
|
enabled: svmEnabled,
|
|
1309
1379
|
staleTime: SVM_BALANCE_STALE_TIME_MS,
|
|
@@ -1519,7 +1589,7 @@ function useWalletSendToken() {
|
|
|
1519
1589
|
}
|
|
1520
1590
|
|
|
1521
1591
|
// src/deposit/use-wallet-transaction-status.ts
|
|
1522
|
-
var
|
|
1592
|
+
var import_react_query3 = require("@tanstack/react-query");
|
|
1523
1593
|
var import_viem3 = require("viem");
|
|
1524
1594
|
var import_wagmi3 = require("wagmi");
|
|
1525
1595
|
function useWalletTransactionStatus({
|
|
@@ -1538,7 +1608,7 @@ function useWalletTransactionStatus({
|
|
|
1538
1608
|
}
|
|
1539
1609
|
});
|
|
1540
1610
|
const svmConnections = useSvmConnections("confirmed");
|
|
1541
|
-
const svmQuery = (0,
|
|
1611
|
+
const svmQuery = (0, import_react_query3.useQuery)({
|
|
1542
1612
|
queryKey: ["wallet-transaction-status", chainId != null ? chainId : null, txId != null ? txId : null],
|
|
1543
1613
|
enabled: isSvm && !!txId,
|
|
1544
1614
|
refetchInterval: (query) => query.state.data === "settled" || query.state.data === "error" ? false : 2e3,
|
|
@@ -1582,7 +1652,7 @@ var import_wallet_adapter_react3 = require("@solana/wallet-adapter-react");
|
|
|
1582
1652
|
|
|
1583
1653
|
// src/execution/use-deposit-addresses.ts
|
|
1584
1654
|
var import_react6 = require("react");
|
|
1585
|
-
var
|
|
1655
|
+
var import_react_query4 = require("@tanstack/react-query");
|
|
1586
1656
|
var SVM_CHAIN_IDS2 = /* @__PURE__ */ new Set([792703809]);
|
|
1587
1657
|
function getDepositAddress(chainId, data) {
|
|
1588
1658
|
return chainId !== void 0 && SVM_CHAIN_IDS2.has(chainId) ? data.svmAddress : data.evmAddress;
|
|
@@ -1606,7 +1676,7 @@ function useDepositAddresses(options) {
|
|
|
1606
1676
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
1607
1677
|
};
|
|
1608
1678
|
}, [enabled, poll, timeoutMs]);
|
|
1609
|
-
const query = (0,
|
|
1679
|
+
const query = (0, import_react_query4.useQuery)({
|
|
1610
1680
|
queryKey: executionKeys.depositAddresses(),
|
|
1611
1681
|
queryFn: () => client.getDepositAddresses(),
|
|
1612
1682
|
enabled,
|
|
@@ -1638,11 +1708,11 @@ function useDepositAddresses(options) {
|
|
|
1638
1708
|
}
|
|
1639
1709
|
|
|
1640
1710
|
// src/execution/use-sync-balances.ts
|
|
1641
|
-
var
|
|
1711
|
+
var import_react_query5 = require("@tanstack/react-query");
|
|
1642
1712
|
function useSyncBalances(options) {
|
|
1643
1713
|
const client = useAggClient();
|
|
1644
|
-
const queryClient = (0,
|
|
1645
|
-
return (0,
|
|
1714
|
+
const queryClient = (0, import_react_query5.useQueryClient)();
|
|
1715
|
+
return (0, import_react_query5.useMutation)({
|
|
1646
1716
|
mutationFn: () => client.syncManagedBalances(),
|
|
1647
1717
|
onSuccess: () => {
|
|
1648
1718
|
var _a;
|
|
@@ -1654,10 +1724,10 @@ function useSyncBalances(options) {
|
|
|
1654
1724
|
}
|
|
1655
1725
|
|
|
1656
1726
|
// src/use-ramp-quotes.ts
|
|
1657
|
-
var
|
|
1727
|
+
var import_react_query6 = require("@tanstack/react-query");
|
|
1658
1728
|
function useRampQuotes() {
|
|
1659
1729
|
const client = useAggClient();
|
|
1660
|
-
return (0,
|
|
1730
|
+
return (0, import_react_query6.useMutation)({
|
|
1661
1731
|
mutationFn: (params) => __async(null, null, function* () {
|
|
1662
1732
|
return client.getRampQuotes(params);
|
|
1663
1733
|
})
|
|
@@ -1665,10 +1735,10 @@ function useRampQuotes() {
|
|
|
1665
1735
|
}
|
|
1666
1736
|
|
|
1667
1737
|
// src/use-ramp-session.ts
|
|
1668
|
-
var
|
|
1738
|
+
var import_react_query7 = require("@tanstack/react-query");
|
|
1669
1739
|
function useRampSession() {
|
|
1670
1740
|
const client = useAggClient();
|
|
1671
|
-
return (0,
|
|
1741
|
+
return (0, import_react_query7.useMutation)({
|
|
1672
1742
|
mutationFn: (params) => __async(null, null, function* () {
|
|
1673
1743
|
return client.createRampSession(params);
|
|
1674
1744
|
})
|