@agg-build/hooks 4.11.0 → 4.17.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/index.d.mts +61 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +9 -3
- package/dist/index.mjs +9 -3
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -250,6 +250,51 @@ type OrderListItem = {
|
|
|
250
250
|
* or a venue-specific tag.
|
|
251
251
|
*/
|
|
252
252
|
partialFillReason: string | null;
|
|
253
|
+
/**
|
|
254
|
+
* Fee breakdown. Optional so paper-trading orders, which have no venue
|
|
255
|
+
* fees, no bridges and no app-fee charge, stay valid without fabricating
|
|
256
|
+
* a zeroed breakdown that would read as "this trade was free".
|
|
257
|
+
*
|
|
258
|
+
* `quoted` is what the route promised at accept time; `actual` is money
|
|
259
|
+
* that moved. `actual.appFee` and `actual.bridge` are TRADE-level and
|
|
260
|
+
* shared by every order under one `actual.dagRunId` — group by it before
|
|
261
|
+
* summing. `quoted.venueFeeRaw` and `actual.venueFeeRaw` are per-leg.
|
|
262
|
+
*/
|
|
263
|
+
fees?: {
|
|
264
|
+
/**
|
|
265
|
+
* How the venue charges: `"fill"`, `"fill_in_game_only"`,
|
|
266
|
+
* `"winnings"`, `"exit"`, or null when the schedule cannot be
|
|
267
|
+
* expressed as a rate. Decides what the venue-fee figures mean.
|
|
268
|
+
*/
|
|
269
|
+
venueFeeBasis: string | null;
|
|
270
|
+
quoted: {
|
|
271
|
+
/** 6-dec USD atoms. Null when the router emitted no fee for this leg. */
|
|
272
|
+
venueFeeRaw: string | null;
|
|
273
|
+
/** Worst-case partner fee if the route fills 100%. */
|
|
274
|
+
appFeeRaw: string | null;
|
|
275
|
+
appFeeBips: number | null;
|
|
276
|
+
};
|
|
277
|
+
actual: {
|
|
278
|
+
/** Null until the order reaches a DAG run. */
|
|
279
|
+
dagRunId: string | null;
|
|
280
|
+
/** Venue-reported fee, 6-dec USD atoms. Null = unknown, never free. */
|
|
281
|
+
venueFeeRaw: string | null;
|
|
282
|
+
appFee: {
|
|
283
|
+
bips: number;
|
|
284
|
+
/** floor(filled × bips / 10_000). */
|
|
285
|
+
dueRaw: string;
|
|
286
|
+
/** Below `dueRaw` on `under_collected`, "0" on skips. */
|
|
287
|
+
collectedRaw: string;
|
|
288
|
+
status: string;
|
|
289
|
+
} | null;
|
|
290
|
+
bridge: {
|
|
291
|
+
relayFeeUsd: string | null;
|
|
292
|
+
originGasCostUsd: string | null;
|
|
293
|
+
operationCount: number;
|
|
294
|
+
pricedOperationCount: number;
|
|
295
|
+
} | null;
|
|
296
|
+
};
|
|
297
|
+
} | undefined;
|
|
253
298
|
txHash: string | null;
|
|
254
299
|
errorMessage: string | null;
|
|
255
300
|
dagRunId: string | null;
|
|
@@ -309,6 +354,8 @@ type VenueMarket = {
|
|
|
309
354
|
title?: string | null | undefined;
|
|
310
355
|
externalIdentifier?: string | null | undefined;
|
|
311
356
|
winner?: boolean | null | undefined;
|
|
357
|
+
/** Per-share USDC payout of this outcome in [0, 1] once settled; source of truth over `winner` when set. */
|
|
358
|
+
payoutPerShare?: number | null | undefined;
|
|
312
359
|
/** Counterpart outcomes on matched sibling markets — only populated
|
|
313
360
|
* on the parent (queried) market's outcomes. Each entry is a
|
|
314
361
|
* `{ venueMarketId, venueMarketOutcomeId }` ref into the same
|
|
@@ -348,6 +395,16 @@ type VenueMarket = {
|
|
|
348
395
|
marketSubtype?: string | null | undefined;
|
|
349
396
|
/** Line value for spread/total markets (e.g., 2.5 for totals, 3 for spreads). */
|
|
350
397
|
lineValue?: number | null | undefined;
|
|
398
|
+
/** Per-market minimum order size in shares/contracts, where AGG ingests one:
|
|
399
|
+
* Polymarket (the market's own floor) and PRED (0.001); null elsewhere.
|
|
400
|
+
* POST /execution/limit-orders validates `sizeRaw` against it on Polymarket.
|
|
401
|
+
* `null` means no value was ingested — NOT that the market is unconstrained;
|
|
402
|
+
* other venues enforce floors this field does not carry. */
|
|
403
|
+
minOrderSize?: number | null | undefined;
|
|
404
|
+
/** Price increment from venue metadata — a seed, not a guarantee. Prefer the
|
|
405
|
+
* runtime-inferred `tick` from the orderbook endpoints when aligning a limit
|
|
406
|
+
* price: the live grid can be finer than this. */
|
|
407
|
+
tickSize?: number | null | undefined;
|
|
351
408
|
matchedVenueMarkets?: {
|
|
352
409
|
id: string;
|
|
353
410
|
venue: Venue;
|
|
@@ -365,6 +422,8 @@ type VenueMarket = {
|
|
|
365
422
|
venueMarketId: string;
|
|
366
423
|
label: string;
|
|
367
424
|
winner?: boolean | null | undefined;
|
|
425
|
+
/** Per-share USDC payout of this outcome in [0, 1] once settled; source of truth over `winner` when set. */
|
|
426
|
+
payoutPerShare?: number | null | undefined;
|
|
368
427
|
}[] | undefined;
|
|
369
428
|
volume?: number | null | undefined;
|
|
370
429
|
venueEvent?: {
|
|
@@ -475,6 +534,8 @@ type VenueMarketOutcome = {
|
|
|
475
534
|
title?: string | null | undefined;
|
|
476
535
|
externalIdentifier?: string | null | undefined;
|
|
477
536
|
winner?: boolean | null | undefined;
|
|
537
|
+
/** Per-share USDC payout of this outcome in [0, 1] once settled; source of truth over `winner` when set. */
|
|
538
|
+
payoutPerShare?: number | null | undefined;
|
|
478
539
|
/** Counterpart outcomes on matched sibling markets — only populated on
|
|
479
540
|
* the parent (queried) market's outcomes. */
|
|
480
541
|
matchedVenueMarketOutcomes?: MatchedVenueMarketOutcomeRef[];
|
package/dist/index.d.ts
CHANGED
|
@@ -250,6 +250,51 @@ type OrderListItem = {
|
|
|
250
250
|
* or a venue-specific tag.
|
|
251
251
|
*/
|
|
252
252
|
partialFillReason: string | null;
|
|
253
|
+
/**
|
|
254
|
+
* Fee breakdown. Optional so paper-trading orders, which have no venue
|
|
255
|
+
* fees, no bridges and no app-fee charge, stay valid without fabricating
|
|
256
|
+
* a zeroed breakdown that would read as "this trade was free".
|
|
257
|
+
*
|
|
258
|
+
* `quoted` is what the route promised at accept time; `actual` is money
|
|
259
|
+
* that moved. `actual.appFee` and `actual.bridge` are TRADE-level and
|
|
260
|
+
* shared by every order under one `actual.dagRunId` — group by it before
|
|
261
|
+
* summing. `quoted.venueFeeRaw` and `actual.venueFeeRaw` are per-leg.
|
|
262
|
+
*/
|
|
263
|
+
fees?: {
|
|
264
|
+
/**
|
|
265
|
+
* How the venue charges: `"fill"`, `"fill_in_game_only"`,
|
|
266
|
+
* `"winnings"`, `"exit"`, or null when the schedule cannot be
|
|
267
|
+
* expressed as a rate. Decides what the venue-fee figures mean.
|
|
268
|
+
*/
|
|
269
|
+
venueFeeBasis: string | null;
|
|
270
|
+
quoted: {
|
|
271
|
+
/** 6-dec USD atoms. Null when the router emitted no fee for this leg. */
|
|
272
|
+
venueFeeRaw: string | null;
|
|
273
|
+
/** Worst-case partner fee if the route fills 100%. */
|
|
274
|
+
appFeeRaw: string | null;
|
|
275
|
+
appFeeBips: number | null;
|
|
276
|
+
};
|
|
277
|
+
actual: {
|
|
278
|
+
/** Null until the order reaches a DAG run. */
|
|
279
|
+
dagRunId: string | null;
|
|
280
|
+
/** Venue-reported fee, 6-dec USD atoms. Null = unknown, never free. */
|
|
281
|
+
venueFeeRaw: string | null;
|
|
282
|
+
appFee: {
|
|
283
|
+
bips: number;
|
|
284
|
+
/** floor(filled × bips / 10_000). */
|
|
285
|
+
dueRaw: string;
|
|
286
|
+
/** Below `dueRaw` on `under_collected`, "0" on skips. */
|
|
287
|
+
collectedRaw: string;
|
|
288
|
+
status: string;
|
|
289
|
+
} | null;
|
|
290
|
+
bridge: {
|
|
291
|
+
relayFeeUsd: string | null;
|
|
292
|
+
originGasCostUsd: string | null;
|
|
293
|
+
operationCount: number;
|
|
294
|
+
pricedOperationCount: number;
|
|
295
|
+
} | null;
|
|
296
|
+
};
|
|
297
|
+
} | undefined;
|
|
253
298
|
txHash: string | null;
|
|
254
299
|
errorMessage: string | null;
|
|
255
300
|
dagRunId: string | null;
|
|
@@ -309,6 +354,8 @@ type VenueMarket = {
|
|
|
309
354
|
title?: string | null | undefined;
|
|
310
355
|
externalIdentifier?: string | null | undefined;
|
|
311
356
|
winner?: boolean | null | undefined;
|
|
357
|
+
/** Per-share USDC payout of this outcome in [0, 1] once settled; source of truth over `winner` when set. */
|
|
358
|
+
payoutPerShare?: number | null | undefined;
|
|
312
359
|
/** Counterpart outcomes on matched sibling markets — only populated
|
|
313
360
|
* on the parent (queried) market's outcomes. Each entry is a
|
|
314
361
|
* `{ venueMarketId, venueMarketOutcomeId }` ref into the same
|
|
@@ -348,6 +395,16 @@ type VenueMarket = {
|
|
|
348
395
|
marketSubtype?: string | null | undefined;
|
|
349
396
|
/** Line value for spread/total markets (e.g., 2.5 for totals, 3 for spreads). */
|
|
350
397
|
lineValue?: number | null | undefined;
|
|
398
|
+
/** Per-market minimum order size in shares/contracts, where AGG ingests one:
|
|
399
|
+
* Polymarket (the market's own floor) and PRED (0.001); null elsewhere.
|
|
400
|
+
* POST /execution/limit-orders validates `sizeRaw` against it on Polymarket.
|
|
401
|
+
* `null` means no value was ingested — NOT that the market is unconstrained;
|
|
402
|
+
* other venues enforce floors this field does not carry. */
|
|
403
|
+
minOrderSize?: number | null | undefined;
|
|
404
|
+
/** Price increment from venue metadata — a seed, not a guarantee. Prefer the
|
|
405
|
+
* runtime-inferred `tick` from the orderbook endpoints when aligning a limit
|
|
406
|
+
* price: the live grid can be finer than this. */
|
|
407
|
+
tickSize?: number | null | undefined;
|
|
351
408
|
matchedVenueMarkets?: {
|
|
352
409
|
id: string;
|
|
353
410
|
venue: Venue;
|
|
@@ -365,6 +422,8 @@ type VenueMarket = {
|
|
|
365
422
|
venueMarketId: string;
|
|
366
423
|
label: string;
|
|
367
424
|
winner?: boolean | null | undefined;
|
|
425
|
+
/** Per-share USDC payout of this outcome in [0, 1] once settled; source of truth over `winner` when set. */
|
|
426
|
+
payoutPerShare?: number | null | undefined;
|
|
368
427
|
}[] | undefined;
|
|
369
428
|
volume?: number | null | undefined;
|
|
370
429
|
venueEvent?: {
|
|
@@ -475,6 +534,8 @@ type VenueMarketOutcome = {
|
|
|
475
534
|
title?: string | null | undefined;
|
|
476
535
|
externalIdentifier?: string | null | undefined;
|
|
477
536
|
winner?: boolean | null | undefined;
|
|
537
|
+
/** Per-share USDC payout of this outcome in [0, 1] once settled; source of truth over `winner` when set. */
|
|
538
|
+
payoutPerShare?: number | null | undefined;
|
|
478
539
|
/** Counterpart outcomes on matched sibling markets — only populated on
|
|
479
540
|
* the parent (queried) market's outcomes. */
|
|
480
541
|
matchedVenueMarketOutcomes?: MatchedVenueMarketOutcomeRef[];
|
package/dist/index.js
CHANGED
|
@@ -8788,22 +8788,28 @@ var RECURRING_MARKET_STATUSES = [
|
|
|
8788
8788
|
var RECURRING_DURATION_MS = {
|
|
8789
8789
|
PT5M: 5 * 6e4,
|
|
8790
8790
|
PT15M: 15 * 6e4,
|
|
8791
|
+
PT30M: 30 * 6e4,
|
|
8791
8792
|
PT1H: 60 * 6e4,
|
|
8793
|
+
PT4H: 4 * 60 * 6e4,
|
|
8792
8794
|
P1D: 24 * 60 * 6e4
|
|
8793
8795
|
};
|
|
8794
8796
|
var RECURRING_SLUG_DURATION = {
|
|
8795
8797
|
"5m": "PT5M",
|
|
8796
8798
|
"15m": "PT15M",
|
|
8799
|
+
"30m": "PT30M",
|
|
8797
8800
|
"1h": "PT1H",
|
|
8801
|
+
"4h": "PT4H",
|
|
8798
8802
|
"1d": "P1D"
|
|
8799
8803
|
};
|
|
8800
8804
|
var RECURRING_DURATION_AGG_KEY_SEGMENT = {
|
|
8801
8805
|
PT5M: "5m",
|
|
8802
8806
|
PT15M: "15m",
|
|
8803
|
-
|
|
8807
|
+
PT30M: "30m",
|
|
8808
|
+
PT1H: "1h",
|
|
8809
|
+
PT4H: "4h"
|
|
8804
8810
|
};
|
|
8805
|
-
var RECURRING_CRYPTO_SLUG_PATTERN = /^([a-z0-9]+)-updown-(5m|15m|1h|1d)-(\d+)$/i;
|
|
8806
|
-
var RECURRING_CRYPTO_AGG_KEY_PATTERN = /^agg_ud_([a-z0-9]+)_(5m|15m|1h)_(\d{2})(\d{2})(\d{2})T(\d{2})(\d{2})$/i;
|
|
8811
|
+
var RECURRING_CRYPTO_SLUG_PATTERN = /^([a-z0-9]+)-updown-(5m|15m|30m|1h|4h|1d)-(\d+)$/i;
|
|
8812
|
+
var RECURRING_CRYPTO_AGG_KEY_PATTERN = /^agg_ud_([a-z0-9]+)_(5m|15m|30m|1h|4h)_(\d{2})(\d{2})(\d{2})T(\d{2})(\d{2})$/i;
|
|
8807
8813
|
var RECURRING_CRYPTO_DAILY_AGG_KEY_PATTERN = /^agg_ud_([a-z0-9]+)_1d_(\d{2})(\d{2})(\d{2})$/i;
|
|
8808
8814
|
var isRecurringCryptoDuration = (value) => value != null && Object.prototype.hasOwnProperty.call(RECURRING_DURATION_MS, value);
|
|
8809
8815
|
var parseTimestamp = (value) => {
|
package/dist/index.mjs
CHANGED
|
@@ -2789,22 +2789,28 @@ var RECURRING_MARKET_STATUSES = [
|
|
|
2789
2789
|
var RECURRING_DURATION_MS = {
|
|
2790
2790
|
PT5M: 5 * 6e4,
|
|
2791
2791
|
PT15M: 15 * 6e4,
|
|
2792
|
+
PT30M: 30 * 6e4,
|
|
2792
2793
|
PT1H: 60 * 6e4,
|
|
2794
|
+
PT4H: 4 * 60 * 6e4,
|
|
2793
2795
|
P1D: 24 * 60 * 6e4
|
|
2794
2796
|
};
|
|
2795
2797
|
var RECURRING_SLUG_DURATION = {
|
|
2796
2798
|
"5m": "PT5M",
|
|
2797
2799
|
"15m": "PT15M",
|
|
2800
|
+
"30m": "PT30M",
|
|
2798
2801
|
"1h": "PT1H",
|
|
2802
|
+
"4h": "PT4H",
|
|
2799
2803
|
"1d": "P1D"
|
|
2800
2804
|
};
|
|
2801
2805
|
var RECURRING_DURATION_AGG_KEY_SEGMENT = {
|
|
2802
2806
|
PT5M: "5m",
|
|
2803
2807
|
PT15M: "15m",
|
|
2804
|
-
|
|
2808
|
+
PT30M: "30m",
|
|
2809
|
+
PT1H: "1h",
|
|
2810
|
+
PT4H: "4h"
|
|
2805
2811
|
};
|
|
2806
|
-
var RECURRING_CRYPTO_SLUG_PATTERN = /^([a-z0-9]+)-updown-(5m|15m|1h|1d)-(\d+)$/i;
|
|
2807
|
-
var RECURRING_CRYPTO_AGG_KEY_PATTERN = /^agg_ud_([a-z0-9]+)_(5m|15m|1h)_(\d{2})(\d{2})(\d{2})T(\d{2})(\d{2})$/i;
|
|
2812
|
+
var RECURRING_CRYPTO_SLUG_PATTERN = /^([a-z0-9]+)-updown-(5m|15m|30m|1h|4h|1d)-(\d+)$/i;
|
|
2813
|
+
var RECURRING_CRYPTO_AGG_KEY_PATTERN = /^agg_ud_([a-z0-9]+)_(5m|15m|30m|1h|4h)_(\d{2})(\d{2})(\d{2})T(\d{2})(\d{2})$/i;
|
|
2808
2814
|
var RECURRING_CRYPTO_DAILY_AGG_KEY_PATTERN = /^agg_ud_([a-z0-9]+)_1d_(\d{2})(\d{2})(\d{2})$/i;
|
|
2809
2815
|
var isRecurringCryptoDuration = (value) => value != null && Object.prototype.hasOwnProperty.call(RECURRING_DURATION_MS, value);
|
|
2810
2816
|
var parseTimestamp = (value) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agg-build/hooks",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.17.0",
|
|
4
4
|
"description": "React hooks and providers for the AGG prediction market aggregator. Wraps @agg-build/sdk with TanStack Query, shared session state, and live WebSocket data.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"react": "^18.0.0 || ^19.0.0",
|
|
84
84
|
"viem": "^2.0.0",
|
|
85
85
|
"wagmi": "^3.0.0 || ^2.0.0",
|
|
86
|
-
"@agg-build/sdk": "^4.
|
|
86
|
+
"@agg-build/sdk": "^4.17.0"
|
|
87
87
|
},
|
|
88
88
|
"peerDependenciesMeta": {
|
|
89
89
|
"@solana/wallet-adapter-react": {
|