@agg-build/hooks 2.2.0 → 2.3.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-56RISN73.mjs → chunk-R7C4J345.mjs} +2 -0
- package/dist/{chunk-NZEXGOFC.mjs → chunk-TILXL4NI.mjs} +1 -1
- package/dist/{chunk-SN4AO5D7.mjs → chunk-UYM2TJOM.mjs} +1 -1
- package/dist/deposit.js +2 -0
- package/dist/deposit.mjs +2 -2
- package/dist/index.d.mts +63 -1
- package/dist/index.d.ts +63 -1
- package/dist/index.js +99 -20
- package/dist/index.mjs +100 -23
- package/dist/withdraw.js +2 -0
- package/dist/withdraw.mjs +2 -2
- package/package.json +2 -2
|
@@ -474,6 +474,8 @@ var enUsLabels = {
|
|
|
474
474
|
depositType: "Deposit",
|
|
475
475
|
redeemType: "Claim",
|
|
476
476
|
withdrawalType: "Withdrawal",
|
|
477
|
+
claimBreakdownModalAriaLabel: "Claim activity breakdown",
|
|
478
|
+
claimBreakdownTransactionLinkAria: (venue) => `Open ${venue} claim transaction`,
|
|
477
479
|
redeemStatusTitles: {
|
|
478
480
|
pending: "Processing claim",
|
|
479
481
|
completed: "Successful claim",
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useOnWithdrawalLifecycle,
|
|
12
12
|
useSyncBalances,
|
|
13
13
|
useWithdrawManaged
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-R7C4J345.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
|
@@ -411,6 +411,8 @@ var enUsLabels = {
|
|
|
411
411
|
depositType: "Deposit",
|
|
412
412
|
redeemType: "Claim",
|
|
413
413
|
withdrawalType: "Withdrawal",
|
|
414
|
+
claimBreakdownModalAriaLabel: "Claim activity breakdown",
|
|
415
|
+
claimBreakdownTransactionLinkAria: (venue) => `Open ${venue} claim transaction`,
|
|
414
416
|
redeemStatusTitles: {
|
|
415
417
|
pending: "Processing claim",
|
|
416
418
|
completed: "Successful claim",
|
package/dist/deposit.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useRampQuotes,
|
|
3
3
|
useRampSession
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UYM2TJOM.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-R7C4J345.mjs";
|
|
15
15
|
|
|
16
16
|
// src/deposit/normalize-wallet-error.ts
|
|
17
17
|
function normalizeWalletError(error, supportedChains) {
|
package/dist/index.d.mts
CHANGED
|
@@ -717,6 +717,8 @@ interface AggUiLabels {
|
|
|
717
717
|
depositType: string;
|
|
718
718
|
redeemType: string;
|
|
719
719
|
withdrawalType: string;
|
|
720
|
+
claimBreakdownModalAriaLabel: string;
|
|
721
|
+
claimBreakdownTransactionLinkAria: (venue: string) => string;
|
|
720
722
|
redeemStatusTitles: {
|
|
721
723
|
pending: string;
|
|
722
724
|
completed: string;
|
|
@@ -3731,7 +3733,15 @@ interface UseMarketOrderbookVenueOutcome {
|
|
|
3731
3733
|
venueMarketOutcomeId: string;
|
|
3732
3734
|
}
|
|
3733
3735
|
interface UseMarketOrderbookOptions {
|
|
3734
|
-
|
|
3736
|
+
/**
|
|
3737
|
+
* The venueMarketOutcomeId to subscribe to (the `outcomes[].id` on REST
|
|
3738
|
+
* market responses). Orderbooks are keyed per-outcome on the WS gateway —
|
|
3739
|
+
* a venueMarketId here will never resolve to a book.
|
|
3740
|
+
*/
|
|
3741
|
+
venueMarketOutcomeId?: string | null;
|
|
3742
|
+
/** @deprecated Misleading name — this has always been a venueMarketOutcomeId.
|
|
3743
|
+
* Use `venueMarketOutcomeId` instead. */
|
|
3744
|
+
marketId?: string | null;
|
|
3735
3745
|
depth?: number;
|
|
3736
3746
|
enabled?: boolean;
|
|
3737
3747
|
venueOutcomes?: UseMarketOrderbookVenueOutcome[];
|
|
@@ -4026,6 +4036,8 @@ interface UseSearchOptions {
|
|
|
4026
4036
|
type: "events" | "markets";
|
|
4027
4037
|
/** Optional category ID filter. */
|
|
4028
4038
|
categoryIds?: string[];
|
|
4039
|
+
/** Filter by status — pass ["open"] for tradeable-only results. */
|
|
4040
|
+
status?: MarketStatus[];
|
|
4029
4041
|
/** Page size. Default 20. */
|
|
4030
4042
|
limit?: number;
|
|
4031
4043
|
/** If provided, enable/disable the query. Defaults to true. */
|
|
@@ -4073,6 +4085,8 @@ interface UseMarketSearchOptions {
|
|
|
4073
4085
|
type: "events" | "markets";
|
|
4074
4086
|
/** Optional category ID filter. */
|
|
4075
4087
|
categoryIds?: string[];
|
|
4088
|
+
/** Filter by status — pass ["open"] for tradeable-only results. */
|
|
4089
|
+
status?: MarketStatus[];
|
|
4076
4090
|
/** Page size for both modes. Default 20. */
|
|
4077
4091
|
limit?: number;
|
|
4078
4092
|
/**
|
|
@@ -5366,8 +5380,16 @@ declare function useVenueMarketMidpoints(options: UseVenueMarketMidpointsOptions
|
|
|
5366
5380
|
midpointRows: (MidpointRow & {
|
|
5367
5381
|
outcomes: _agg_build_sdk.OutcomeMidpointRow[];
|
|
5368
5382
|
matched: MidpointRow[];
|
|
5383
|
+
arbReturn?: number | null;
|
|
5384
|
+
marketStatus?: _agg_build_sdk.MarketStatus;
|
|
5385
|
+
error?: {
|
|
5386
|
+
code: "market_resolved" | "market_not_found";
|
|
5387
|
+
message: string;
|
|
5388
|
+
retryable: boolean;
|
|
5389
|
+
};
|
|
5369
5390
|
})[];
|
|
5370
5391
|
midpointsByVenueMarketId: Map<string, number | null>;
|
|
5392
|
+
arbReturnByVenueMarketId: Map<string, number | null>;
|
|
5371
5393
|
requestedVenueMarketIds: string[];
|
|
5372
5394
|
data: BatchMidpointsResponse;
|
|
5373
5395
|
error: Error;
|
|
@@ -5399,8 +5421,16 @@ declare function useVenueMarketMidpoints(options: UseVenueMarketMidpointsOptions
|
|
|
5399
5421
|
midpointRows: (MidpointRow & {
|
|
5400
5422
|
outcomes: _agg_build_sdk.OutcomeMidpointRow[];
|
|
5401
5423
|
matched: MidpointRow[];
|
|
5424
|
+
arbReturn?: number | null;
|
|
5425
|
+
marketStatus?: _agg_build_sdk.MarketStatus;
|
|
5426
|
+
error?: {
|
|
5427
|
+
code: "market_resolved" | "market_not_found";
|
|
5428
|
+
message: string;
|
|
5429
|
+
retryable: boolean;
|
|
5430
|
+
};
|
|
5402
5431
|
})[];
|
|
5403
5432
|
midpointsByVenueMarketId: Map<string, number | null>;
|
|
5433
|
+
arbReturnByVenueMarketId: Map<string, number | null>;
|
|
5404
5434
|
requestedVenueMarketIds: string[];
|
|
5405
5435
|
data: BatchMidpointsResponse;
|
|
5406
5436
|
error: null;
|
|
@@ -5432,8 +5462,16 @@ declare function useVenueMarketMidpoints(options: UseVenueMarketMidpointsOptions
|
|
|
5432
5462
|
midpointRows: (MidpointRow & {
|
|
5433
5463
|
outcomes: _agg_build_sdk.OutcomeMidpointRow[];
|
|
5434
5464
|
matched: MidpointRow[];
|
|
5465
|
+
arbReturn?: number | null;
|
|
5466
|
+
marketStatus?: _agg_build_sdk.MarketStatus;
|
|
5467
|
+
error?: {
|
|
5468
|
+
code: "market_resolved" | "market_not_found";
|
|
5469
|
+
message: string;
|
|
5470
|
+
retryable: boolean;
|
|
5471
|
+
};
|
|
5435
5472
|
})[];
|
|
5436
5473
|
midpointsByVenueMarketId: Map<string, number | null>;
|
|
5474
|
+
arbReturnByVenueMarketId: Map<string, number | null>;
|
|
5437
5475
|
requestedVenueMarketIds: string[];
|
|
5438
5476
|
data: undefined;
|
|
5439
5477
|
error: Error;
|
|
@@ -5465,8 +5503,16 @@ declare function useVenueMarketMidpoints(options: UseVenueMarketMidpointsOptions
|
|
|
5465
5503
|
midpointRows: (MidpointRow & {
|
|
5466
5504
|
outcomes: _agg_build_sdk.OutcomeMidpointRow[];
|
|
5467
5505
|
matched: MidpointRow[];
|
|
5506
|
+
arbReturn?: number | null;
|
|
5507
|
+
marketStatus?: _agg_build_sdk.MarketStatus;
|
|
5508
|
+
error?: {
|
|
5509
|
+
code: "market_resolved" | "market_not_found";
|
|
5510
|
+
message: string;
|
|
5511
|
+
retryable: boolean;
|
|
5512
|
+
};
|
|
5468
5513
|
})[];
|
|
5469
5514
|
midpointsByVenueMarketId: Map<string, number | null>;
|
|
5515
|
+
arbReturnByVenueMarketId: Map<string, number | null>;
|
|
5470
5516
|
requestedVenueMarketIds: string[];
|
|
5471
5517
|
data: undefined;
|
|
5472
5518
|
error: null;
|
|
@@ -5498,8 +5544,16 @@ declare function useVenueMarketMidpoints(options: UseVenueMarketMidpointsOptions
|
|
|
5498
5544
|
midpointRows: (MidpointRow & {
|
|
5499
5545
|
outcomes: _agg_build_sdk.OutcomeMidpointRow[];
|
|
5500
5546
|
matched: MidpointRow[];
|
|
5547
|
+
arbReturn?: number | null;
|
|
5548
|
+
marketStatus?: _agg_build_sdk.MarketStatus;
|
|
5549
|
+
error?: {
|
|
5550
|
+
code: "market_resolved" | "market_not_found";
|
|
5551
|
+
message: string;
|
|
5552
|
+
retryable: boolean;
|
|
5553
|
+
};
|
|
5501
5554
|
})[];
|
|
5502
5555
|
midpointsByVenueMarketId: Map<string, number | null>;
|
|
5556
|
+
arbReturnByVenueMarketId: Map<string, number | null>;
|
|
5503
5557
|
requestedVenueMarketIds: string[];
|
|
5504
5558
|
data: undefined;
|
|
5505
5559
|
error: null;
|
|
@@ -5531,8 +5585,16 @@ declare function useVenueMarketMidpoints(options: UseVenueMarketMidpointsOptions
|
|
|
5531
5585
|
midpointRows: (MidpointRow & {
|
|
5532
5586
|
outcomes: _agg_build_sdk.OutcomeMidpointRow[];
|
|
5533
5587
|
matched: MidpointRow[];
|
|
5588
|
+
arbReturn?: number | null;
|
|
5589
|
+
marketStatus?: _agg_build_sdk.MarketStatus;
|
|
5590
|
+
error?: {
|
|
5591
|
+
code: "market_resolved" | "market_not_found";
|
|
5592
|
+
message: string;
|
|
5593
|
+
retryable: boolean;
|
|
5594
|
+
};
|
|
5534
5595
|
})[];
|
|
5535
5596
|
midpointsByVenueMarketId: Map<string, number | null>;
|
|
5597
|
+
arbReturnByVenueMarketId: Map<string, number | null>;
|
|
5536
5598
|
requestedVenueMarketIds: string[];
|
|
5537
5599
|
data: BatchMidpointsResponse;
|
|
5538
5600
|
isError: false;
|
package/dist/index.d.ts
CHANGED
|
@@ -717,6 +717,8 @@ interface AggUiLabels {
|
|
|
717
717
|
depositType: string;
|
|
718
718
|
redeemType: string;
|
|
719
719
|
withdrawalType: string;
|
|
720
|
+
claimBreakdownModalAriaLabel: string;
|
|
721
|
+
claimBreakdownTransactionLinkAria: (venue: string) => string;
|
|
720
722
|
redeemStatusTitles: {
|
|
721
723
|
pending: string;
|
|
722
724
|
completed: string;
|
|
@@ -3731,7 +3733,15 @@ interface UseMarketOrderbookVenueOutcome {
|
|
|
3731
3733
|
venueMarketOutcomeId: string;
|
|
3732
3734
|
}
|
|
3733
3735
|
interface UseMarketOrderbookOptions {
|
|
3734
|
-
|
|
3736
|
+
/**
|
|
3737
|
+
* The venueMarketOutcomeId to subscribe to (the `outcomes[].id` on REST
|
|
3738
|
+
* market responses). Orderbooks are keyed per-outcome on the WS gateway —
|
|
3739
|
+
* a venueMarketId here will never resolve to a book.
|
|
3740
|
+
*/
|
|
3741
|
+
venueMarketOutcomeId?: string | null;
|
|
3742
|
+
/** @deprecated Misleading name — this has always been a venueMarketOutcomeId.
|
|
3743
|
+
* Use `venueMarketOutcomeId` instead. */
|
|
3744
|
+
marketId?: string | null;
|
|
3735
3745
|
depth?: number;
|
|
3736
3746
|
enabled?: boolean;
|
|
3737
3747
|
venueOutcomes?: UseMarketOrderbookVenueOutcome[];
|
|
@@ -4026,6 +4036,8 @@ interface UseSearchOptions {
|
|
|
4026
4036
|
type: "events" | "markets";
|
|
4027
4037
|
/** Optional category ID filter. */
|
|
4028
4038
|
categoryIds?: string[];
|
|
4039
|
+
/** Filter by status — pass ["open"] for tradeable-only results. */
|
|
4040
|
+
status?: MarketStatus[];
|
|
4029
4041
|
/** Page size. Default 20. */
|
|
4030
4042
|
limit?: number;
|
|
4031
4043
|
/** If provided, enable/disable the query. Defaults to true. */
|
|
@@ -4073,6 +4085,8 @@ interface UseMarketSearchOptions {
|
|
|
4073
4085
|
type: "events" | "markets";
|
|
4074
4086
|
/** Optional category ID filter. */
|
|
4075
4087
|
categoryIds?: string[];
|
|
4088
|
+
/** Filter by status — pass ["open"] for tradeable-only results. */
|
|
4089
|
+
status?: MarketStatus[];
|
|
4076
4090
|
/** Page size for both modes. Default 20. */
|
|
4077
4091
|
limit?: number;
|
|
4078
4092
|
/**
|
|
@@ -5366,8 +5380,16 @@ declare function useVenueMarketMidpoints(options: UseVenueMarketMidpointsOptions
|
|
|
5366
5380
|
midpointRows: (MidpointRow & {
|
|
5367
5381
|
outcomes: _agg_build_sdk.OutcomeMidpointRow[];
|
|
5368
5382
|
matched: MidpointRow[];
|
|
5383
|
+
arbReturn?: number | null;
|
|
5384
|
+
marketStatus?: _agg_build_sdk.MarketStatus;
|
|
5385
|
+
error?: {
|
|
5386
|
+
code: "market_resolved" | "market_not_found";
|
|
5387
|
+
message: string;
|
|
5388
|
+
retryable: boolean;
|
|
5389
|
+
};
|
|
5369
5390
|
})[];
|
|
5370
5391
|
midpointsByVenueMarketId: Map<string, number | null>;
|
|
5392
|
+
arbReturnByVenueMarketId: Map<string, number | null>;
|
|
5371
5393
|
requestedVenueMarketIds: string[];
|
|
5372
5394
|
data: BatchMidpointsResponse;
|
|
5373
5395
|
error: Error;
|
|
@@ -5399,8 +5421,16 @@ declare function useVenueMarketMidpoints(options: UseVenueMarketMidpointsOptions
|
|
|
5399
5421
|
midpointRows: (MidpointRow & {
|
|
5400
5422
|
outcomes: _agg_build_sdk.OutcomeMidpointRow[];
|
|
5401
5423
|
matched: MidpointRow[];
|
|
5424
|
+
arbReturn?: number | null;
|
|
5425
|
+
marketStatus?: _agg_build_sdk.MarketStatus;
|
|
5426
|
+
error?: {
|
|
5427
|
+
code: "market_resolved" | "market_not_found";
|
|
5428
|
+
message: string;
|
|
5429
|
+
retryable: boolean;
|
|
5430
|
+
};
|
|
5402
5431
|
})[];
|
|
5403
5432
|
midpointsByVenueMarketId: Map<string, number | null>;
|
|
5433
|
+
arbReturnByVenueMarketId: Map<string, number | null>;
|
|
5404
5434
|
requestedVenueMarketIds: string[];
|
|
5405
5435
|
data: BatchMidpointsResponse;
|
|
5406
5436
|
error: null;
|
|
@@ -5432,8 +5462,16 @@ declare function useVenueMarketMidpoints(options: UseVenueMarketMidpointsOptions
|
|
|
5432
5462
|
midpointRows: (MidpointRow & {
|
|
5433
5463
|
outcomes: _agg_build_sdk.OutcomeMidpointRow[];
|
|
5434
5464
|
matched: MidpointRow[];
|
|
5465
|
+
arbReturn?: number | null;
|
|
5466
|
+
marketStatus?: _agg_build_sdk.MarketStatus;
|
|
5467
|
+
error?: {
|
|
5468
|
+
code: "market_resolved" | "market_not_found";
|
|
5469
|
+
message: string;
|
|
5470
|
+
retryable: boolean;
|
|
5471
|
+
};
|
|
5435
5472
|
})[];
|
|
5436
5473
|
midpointsByVenueMarketId: Map<string, number | null>;
|
|
5474
|
+
arbReturnByVenueMarketId: Map<string, number | null>;
|
|
5437
5475
|
requestedVenueMarketIds: string[];
|
|
5438
5476
|
data: undefined;
|
|
5439
5477
|
error: Error;
|
|
@@ -5465,8 +5503,16 @@ declare function useVenueMarketMidpoints(options: UseVenueMarketMidpointsOptions
|
|
|
5465
5503
|
midpointRows: (MidpointRow & {
|
|
5466
5504
|
outcomes: _agg_build_sdk.OutcomeMidpointRow[];
|
|
5467
5505
|
matched: MidpointRow[];
|
|
5506
|
+
arbReturn?: number | null;
|
|
5507
|
+
marketStatus?: _agg_build_sdk.MarketStatus;
|
|
5508
|
+
error?: {
|
|
5509
|
+
code: "market_resolved" | "market_not_found";
|
|
5510
|
+
message: string;
|
|
5511
|
+
retryable: boolean;
|
|
5512
|
+
};
|
|
5468
5513
|
})[];
|
|
5469
5514
|
midpointsByVenueMarketId: Map<string, number | null>;
|
|
5515
|
+
arbReturnByVenueMarketId: Map<string, number | null>;
|
|
5470
5516
|
requestedVenueMarketIds: string[];
|
|
5471
5517
|
data: undefined;
|
|
5472
5518
|
error: null;
|
|
@@ -5498,8 +5544,16 @@ declare function useVenueMarketMidpoints(options: UseVenueMarketMidpointsOptions
|
|
|
5498
5544
|
midpointRows: (MidpointRow & {
|
|
5499
5545
|
outcomes: _agg_build_sdk.OutcomeMidpointRow[];
|
|
5500
5546
|
matched: MidpointRow[];
|
|
5547
|
+
arbReturn?: number | null;
|
|
5548
|
+
marketStatus?: _agg_build_sdk.MarketStatus;
|
|
5549
|
+
error?: {
|
|
5550
|
+
code: "market_resolved" | "market_not_found";
|
|
5551
|
+
message: string;
|
|
5552
|
+
retryable: boolean;
|
|
5553
|
+
};
|
|
5501
5554
|
})[];
|
|
5502
5555
|
midpointsByVenueMarketId: Map<string, number | null>;
|
|
5556
|
+
arbReturnByVenueMarketId: Map<string, number | null>;
|
|
5503
5557
|
requestedVenueMarketIds: string[];
|
|
5504
5558
|
data: undefined;
|
|
5505
5559
|
error: null;
|
|
@@ -5531,8 +5585,16 @@ declare function useVenueMarketMidpoints(options: UseVenueMarketMidpointsOptions
|
|
|
5531
5585
|
midpointRows: (MidpointRow & {
|
|
5532
5586
|
outcomes: _agg_build_sdk.OutcomeMidpointRow[];
|
|
5533
5587
|
matched: MidpointRow[];
|
|
5588
|
+
arbReturn?: number | null;
|
|
5589
|
+
marketStatus?: _agg_build_sdk.MarketStatus;
|
|
5590
|
+
error?: {
|
|
5591
|
+
code: "market_resolved" | "market_not_found";
|
|
5592
|
+
message: string;
|
|
5593
|
+
retryable: boolean;
|
|
5594
|
+
};
|
|
5534
5595
|
})[];
|
|
5535
5596
|
midpointsByVenueMarketId: Map<string, number | null>;
|
|
5597
|
+
arbReturnByVenueMarketId: Map<string, number | null>;
|
|
5536
5598
|
requestedVenueMarketIds: string[];
|
|
5537
5599
|
data: BatchMidpointsResponse;
|
|
5538
5600
|
isError: false;
|
package/dist/index.js
CHANGED
|
@@ -796,6 +796,8 @@ var enUsLabels = {
|
|
|
796
796
|
depositType: "Deposit",
|
|
797
797
|
redeemType: "Claim",
|
|
798
798
|
withdrawalType: "Withdrawal",
|
|
799
|
+
claimBreakdownModalAriaLabel: "Claim activity breakdown",
|
|
800
|
+
claimBreakdownTransactionLinkAria: (venue) => `Open ${venue} claim transaction`,
|
|
799
801
|
redeemStatusTitles: {
|
|
800
802
|
pending: "Processing claim",
|
|
801
803
|
completed: "Successful claim",
|
|
@@ -6519,6 +6521,18 @@ var normalizeVenueMarketIds = (venueMarkets) => {
|
|
|
6519
6521
|
var normalizeOutcomeLabel = (label) => {
|
|
6520
6522
|
return typeof label === "string" ? label.trim().toLowerCase() : "";
|
|
6521
6523
|
};
|
|
6524
|
+
var normalizeSemanticOutcomeLabel = (label) => {
|
|
6525
|
+
const normalizedLabel = normalizeOutcomeLabel(label);
|
|
6526
|
+
if (!normalizedLabel) return "";
|
|
6527
|
+
if (normalizedLabel === "y") return "yes";
|
|
6528
|
+
if (normalizedLabel === "n") return "no";
|
|
6529
|
+
return normalizedLabel;
|
|
6530
|
+
};
|
|
6531
|
+
var outcomeMatchesSemanticSide = (left, right) => {
|
|
6532
|
+
const leftCandidates = [left.label, left.title].map((value) => normalizeSemanticOutcomeLabel(value)).filter(Boolean);
|
|
6533
|
+
const rightCandidates = [right.label, right.title].map((value) => normalizeSemanticOutcomeLabel(value)).filter(Boolean);
|
|
6534
|
+
return leftCandidates.some((candidate) => rightCandidates.includes(candidate));
|
|
6535
|
+
};
|
|
6522
6536
|
var resolveBestMidpointCandidateOutcomeIds = (venueMarkets) => {
|
|
6523
6537
|
var _a, _b;
|
|
6524
6538
|
if (!(venueMarkets == null ? void 0 : venueMarkets.length)) return [];
|
|
@@ -6548,6 +6562,31 @@ var resolveSiblingOutcomeMidpoint = (matched, ref) => {
|
|
|
6548
6562
|
if ((sibOutcome == null ? void 0 : sibOutcome.midpoint) == null) return null;
|
|
6549
6563
|
return { midpoint: sibOutcome.midpoint, venue: (_b = sibling.venue) != null ? _b : null };
|
|
6550
6564
|
};
|
|
6565
|
+
var resolveSemanticFallbackMidpoint = ({
|
|
6566
|
+
marketById,
|
|
6567
|
+
outcome,
|
|
6568
|
+
matched
|
|
6569
|
+
}) => {
|
|
6570
|
+
var _a;
|
|
6571
|
+
if (!(matched == null ? void 0 : matched.length)) return null;
|
|
6572
|
+
let best = null;
|
|
6573
|
+
for (const sibling of matched) {
|
|
6574
|
+
const siblingMarket = marketById.get(sibling.venueMarketId);
|
|
6575
|
+
if (!((_a = siblingMarket == null ? void 0 : siblingMarket.venueMarketOutcomes) == null ? void 0 : _a.length)) continue;
|
|
6576
|
+
for (const siblingOutcome of siblingMarket.venueMarketOutcomes) {
|
|
6577
|
+
if (!outcomeMatchesSemanticSide(outcome, siblingOutcome)) continue;
|
|
6578
|
+
const candidate = resolveSiblingOutcomeMidpoint(matched, {
|
|
6579
|
+
venueMarketId: sibling.venueMarketId,
|
|
6580
|
+
venueMarketOutcomeId: siblingOutcome.id
|
|
6581
|
+
});
|
|
6582
|
+
if (candidate == null) continue;
|
|
6583
|
+
if (best == null || candidate.midpoint < best.midpoint) {
|
|
6584
|
+
best = candidate;
|
|
6585
|
+
}
|
|
6586
|
+
}
|
|
6587
|
+
}
|
|
6588
|
+
return best;
|
|
6589
|
+
};
|
|
6551
6590
|
var extractBestPrices = (data, venueMarkets) => {
|
|
6552
6591
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
6553
6592
|
const bestPrices = /* @__PURE__ */ new Map();
|
|
@@ -6656,11 +6695,12 @@ function useMidpoints(venueMarkets, options) {
|
|
|
6656
6695
|
refetchOnReconnect: false
|
|
6657
6696
|
});
|
|
6658
6697
|
const result = (0, import_react28.useMemo)(() => {
|
|
6659
|
-
var _a2, _b, _c, _d, _e;
|
|
6698
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
6660
6699
|
const map = /* @__PURE__ */ new Map();
|
|
6661
6700
|
const venueMap = /* @__PURE__ */ new Map();
|
|
6662
6701
|
if (!(data == null ? void 0 : data.data) || !venueMarkets) return { map, venueMap };
|
|
6663
6702
|
const itemByMarketId = new Map(data.data.map((item) => [item.venueMarketId, item]));
|
|
6703
|
+
const marketById = new Map(venueMarkets.map((market) => [market.id, market]));
|
|
6664
6704
|
for (const item of data.data) {
|
|
6665
6705
|
if (!((_a2 = item.outcomes) == null ? void 0 : _a2.length)) continue;
|
|
6666
6706
|
for (const o of item.outcomes) {
|
|
@@ -6674,15 +6714,26 @@ function useMidpoints(venueMarkets, options) {
|
|
|
6674
6714
|
if (!item) continue;
|
|
6675
6715
|
for (const outcome of market.venueMarketOutcomes) {
|
|
6676
6716
|
const refs = (_b = outcome.matchedVenueMarketOutcomes) != null ? _b : [];
|
|
6677
|
-
if (!refs.length) continue;
|
|
6678
6717
|
let best = (_c = map.get(outcome.id)) != null ? _c : null;
|
|
6679
6718
|
let bestVenue = (_d = item.venue) != null ? _d : null;
|
|
6680
|
-
|
|
6681
|
-
const
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
best
|
|
6685
|
-
|
|
6719
|
+
if (refs.length > 0) {
|
|
6720
|
+
for (const ref of refs) {
|
|
6721
|
+
const sib = resolveSiblingOutcomeMidpoint(item.matched, ref);
|
|
6722
|
+
if (sib == null) continue;
|
|
6723
|
+
if (best == null || sib.midpoint < best) {
|
|
6724
|
+
best = sib.midpoint;
|
|
6725
|
+
bestVenue = (_e = sib.venue) != null ? _e : bestVenue;
|
|
6726
|
+
}
|
|
6727
|
+
}
|
|
6728
|
+
} else if (best == null) {
|
|
6729
|
+
const fallback = resolveSemanticFallbackMidpoint({
|
|
6730
|
+
marketById,
|
|
6731
|
+
outcome,
|
|
6732
|
+
matched: item.matched
|
|
6733
|
+
});
|
|
6734
|
+
if (fallback != null) {
|
|
6735
|
+
best = fallback.midpoint;
|
|
6736
|
+
bestVenue = (_f = fallback.venue) != null ? _f : bestVenue;
|
|
6686
6737
|
}
|
|
6687
6738
|
}
|
|
6688
6739
|
if (best != null) {
|
|
@@ -6780,18 +6831,19 @@ var useRollingChartWindow = (options) => {
|
|
|
6780
6831
|
// src/use-market-orderbook.ts
|
|
6781
6832
|
var import_react_query27 = require("@tanstack/react-query");
|
|
6782
6833
|
function useMarketOrderbook(options) {
|
|
6783
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
6834
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6784
6835
|
const queryClient = (0, import_react_query27.useQueryClient)();
|
|
6785
6836
|
const ws = useAggWebSocket();
|
|
6786
6837
|
const isConnected = useAggWebSocketConnectionState();
|
|
6787
6838
|
const {
|
|
6788
6839
|
features: { enableLiveUpdates }
|
|
6789
6840
|
} = useAggUiConfig();
|
|
6790
|
-
const { marketId, depth, enabled = true, venueOutcomes, live } = options;
|
|
6841
|
+
const { venueMarketOutcomeId, marketId, depth, enabled = true, venueOutcomes, live } = options;
|
|
6842
|
+
const selectedId = (_a = venueMarketOutcomeId != null ? venueMarketOutcomeId : marketId) != null ? _a : null;
|
|
6791
6843
|
const liveEnabled = live != null ? live : enableLiveUpdates;
|
|
6792
6844
|
const outcomeIds = venueOutcomes == null ? void 0 : venueOutcomes.map((v) => v.venueMarketOutcomeId).filter(Boolean);
|
|
6793
|
-
const subscriptionIds = (outcomeIds == null ? void 0 : outcomeIds.length) ? [...new Set(outcomeIds)] :
|
|
6794
|
-
const selectedOutcomeId = (
|
|
6845
|
+
const subscriptionIds = (outcomeIds == null ? void 0 : outcomeIds.length) ? [...new Set(outcomeIds)] : selectedId ? [selectedId] : [];
|
|
6846
|
+
const selectedOutcomeId = (_b = subscriptionIds[0]) != null ? _b : null;
|
|
6795
6847
|
useMarketDataSubscription({
|
|
6796
6848
|
marketId: selectedOutcomeId,
|
|
6797
6849
|
additionalMarketIds: subscriptionIds.slice(1),
|
|
@@ -6813,8 +6865,8 @@ function useMarketOrderbook(options) {
|
|
|
6813
6865
|
var _a2, _b2;
|
|
6814
6866
|
return (_b2 = (_a2 = liveQueries[index]) == null ? void 0 : _a2.data) != null ? _b2 : createMarketLiveState(subscriptionId);
|
|
6815
6867
|
});
|
|
6816
|
-
const primaryOrderbook = (
|
|
6817
|
-
const primarySnapshotVersion = (
|
|
6868
|
+
const primaryOrderbook = (_d = (_c = liveStates[0]) == null ? void 0 : _c.orderbook) != null ? _d : null;
|
|
6869
|
+
const primarySnapshotVersion = (_f = (_e = liveStates[0]) == null ? void 0 : _e.orderbookSnapshotVersion) != null ? _f : 0;
|
|
6818
6870
|
const data = primaryOrderbook ? applyOrderbookDepth(
|
|
6819
6871
|
createMarketOrderbookDataFromState(primaryOrderbook, {
|
|
6820
6872
|
snapshotVersion: primarySnapshotVersion
|
|
@@ -6838,9 +6890,9 @@ function useMarketOrderbook(options) {
|
|
|
6838
6890
|
})
|
|
6839
6891
|
);
|
|
6840
6892
|
const hasAnyOrderbook = liveStates.some((liveState) => liveState.orderbook != null);
|
|
6841
|
-
const liveOrderbookErrorMessage = enabled && liveEnabled && !hasAnyOrderbook ? (
|
|
6893
|
+
const liveOrderbookErrorMessage = enabled && liveEnabled && !hasAnyOrderbook ? (_h = (_g = liveStates.find(
|
|
6842
6894
|
(liveState) => typeof liveState.orderbookError === "string" && liveState.orderbookError.length > 0
|
|
6843
|
-
)) == null ? void 0 :
|
|
6895
|
+
)) == null ? void 0 : _g.orderbookError) != null ? _h : null : null;
|
|
6844
6896
|
return {
|
|
6845
6897
|
data,
|
|
6846
6898
|
dataById,
|
|
@@ -7132,11 +7184,11 @@ function useOrders(options = {}) {
|
|
|
7132
7184
|
var import_react_query31 = require("@tanstack/react-query");
|
|
7133
7185
|
var import_react31 = require("react");
|
|
7134
7186
|
function useSearch(options) {
|
|
7135
|
-
var _a, _b, _c;
|
|
7187
|
+
var _a, _b, _c, _d;
|
|
7136
7188
|
const client = (0, import_react31.useContext)(AggClientContext);
|
|
7137
7189
|
const queryClient = (0, import_react31.useContext)(import_react_query31.QueryClientContext);
|
|
7138
7190
|
const [fallbackQueryClient] = (0, import_react31.useState)(() => new import_react_query31.QueryClient());
|
|
7139
|
-
const { q, type, categoryIds, limit = 20, enabled = true, deep = false } = options;
|
|
7191
|
+
const { q, type, categoryIds, status, limit = 20, enabled = true, deep = false } = options;
|
|
7140
7192
|
const isEnabled = enabled && q.length > 0;
|
|
7141
7193
|
(0, import_react31.useEffect)(() => {
|
|
7142
7194
|
if (queryClient) return void 0;
|
|
@@ -7152,7 +7204,15 @@ function useSearch(options) {
|
|
|
7152
7204
|
{
|
|
7153
7205
|
// deep is part of the key — TanStack treats deep vs light as
|
|
7154
7206
|
// independent queries so users can have both modes cached side-by-side.
|
|
7155
|
-
queryKey: [
|
|
7207
|
+
queryKey: [
|
|
7208
|
+
"search",
|
|
7209
|
+
q,
|
|
7210
|
+
type,
|
|
7211
|
+
(_a = categoryIds == null ? void 0 : categoryIds.join(",")) != null ? _a : "",
|
|
7212
|
+
(_b = status == null ? void 0 : status.join(",")) != null ? _b : "",
|
|
7213
|
+
limit,
|
|
7214
|
+
deep
|
|
7215
|
+
],
|
|
7156
7216
|
queryFn: (_0) => __async(null, [_0], function* ({ pageParam }) {
|
|
7157
7217
|
if (!client) {
|
|
7158
7218
|
throw new Error("useSearch must be used within an <AggProvider>");
|
|
@@ -7161,6 +7221,7 @@ function useSearch(options) {
|
|
|
7161
7221
|
q,
|
|
7162
7222
|
type,
|
|
7163
7223
|
categoryIds,
|
|
7224
|
+
status,
|
|
7164
7225
|
limit,
|
|
7165
7226
|
cursor: pageParam,
|
|
7166
7227
|
deep
|
|
@@ -7178,7 +7239,7 @@ function useSearch(options) {
|
|
|
7178
7239
|
},
|
|
7179
7240
|
queryClient != null ? queryClient : fallbackQueryClient
|
|
7180
7241
|
);
|
|
7181
|
-
const data = (
|
|
7242
|
+
const data = (_d = (_c = query.data) == null ? void 0 : _c.pages.flatMap((page) => page.data)) != null ? _d : [];
|
|
7182
7243
|
return {
|
|
7183
7244
|
data,
|
|
7184
7245
|
isLoading: query.isLoading,
|
|
@@ -7198,6 +7259,7 @@ function useMarketSearch(options) {
|
|
|
7198
7259
|
const {
|
|
7199
7260
|
type,
|
|
7200
7261
|
categoryIds,
|
|
7262
|
+
status,
|
|
7201
7263
|
limit = 20,
|
|
7202
7264
|
debounceMs = 200,
|
|
7203
7265
|
enableSuggestions = true,
|
|
@@ -7212,6 +7274,7 @@ function useMarketSearch(options) {
|
|
|
7212
7274
|
q: trimmedDebounced,
|
|
7213
7275
|
type,
|
|
7214
7276
|
categoryIds,
|
|
7277
|
+
status,
|
|
7215
7278
|
limit,
|
|
7216
7279
|
enabled: suggestionsEnabled,
|
|
7217
7280
|
deep: false
|
|
@@ -7221,6 +7284,7 @@ function useMarketSearch(options) {
|
|
|
7221
7284
|
q: submittedQ,
|
|
7222
7285
|
type,
|
|
7223
7286
|
categoryIds,
|
|
7287
|
+
status,
|
|
7224
7288
|
limit,
|
|
7225
7289
|
enabled: submittedQ.length > 0,
|
|
7226
7290
|
deep: true
|
|
@@ -7840,6 +7904,19 @@ var mapMidpointsByVenueMarketId = (rows) => {
|
|
|
7840
7904
|
});
|
|
7841
7905
|
return mappedMidpoints;
|
|
7842
7906
|
};
|
|
7907
|
+
var mapArbReturnByVenueMarketId = (rows) => {
|
|
7908
|
+
const mappedArbReturns = /* @__PURE__ */ new Map();
|
|
7909
|
+
rows.forEach((row) => {
|
|
7910
|
+
var _a;
|
|
7911
|
+
mappedArbReturns.set(row.venueMarketId, (_a = row.arbReturn) != null ? _a : null);
|
|
7912
|
+
row.matched.forEach((matchedRow) => {
|
|
7913
|
+
var _a2;
|
|
7914
|
+
if (mappedArbReturns.has(matchedRow.venueMarketId)) return;
|
|
7915
|
+
mappedArbReturns.set(matchedRow.venueMarketId, (_a2 = matchedRow.arbReturn) != null ? _a2 : null);
|
|
7916
|
+
});
|
|
7917
|
+
});
|
|
7918
|
+
return mappedArbReturns;
|
|
7919
|
+
};
|
|
7843
7920
|
function useVenueMarketMidpoints(options) {
|
|
7844
7921
|
var _a, _b, _c, _d;
|
|
7845
7922
|
const client = useAggClient();
|
|
@@ -7869,9 +7946,11 @@ function useVenueMarketMidpoints(options) {
|
|
|
7869
7946
|
});
|
|
7870
7947
|
const midpointRows = (_d = (_c = query.data) == null ? void 0 : _c.data) != null ? _d : [];
|
|
7871
7948
|
const midpointsByVenueMarketId = mapMidpointsByVenueMarketId(midpointRows);
|
|
7949
|
+
const arbReturnByVenueMarketId = mapArbReturnByVenueMarketId(midpointRows);
|
|
7872
7950
|
return __spreadProps(__spreadValues({}, query), {
|
|
7873
7951
|
midpointRows,
|
|
7874
7952
|
midpointsByVenueMarketId,
|
|
7953
|
+
arbReturnByVenueMarketId,
|
|
7875
7954
|
requestedVenueMarketIds
|
|
7876
7955
|
});
|
|
7877
7956
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useRampQuotes,
|
|
3
3
|
useRampSession
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UYM2TJOM.mjs";
|
|
5
5
|
import {
|
|
6
6
|
useWithdrawEstimate,
|
|
7
7
|
useWithdrawFlow,
|
|
8
8
|
useWithdrawPreview,
|
|
9
9
|
useWithdrawalLifecycle
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-TILXL4NI.mjs";
|
|
11
11
|
import {
|
|
12
12
|
AggAuthContext,
|
|
13
13
|
AggBalanceProvider,
|
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
useSyncBalances,
|
|
96
96
|
useWithdrawManaged,
|
|
97
97
|
userActivityQueryKeys
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-R7C4J345.mjs";
|
|
99
99
|
|
|
100
100
|
// src/index.ts
|
|
101
101
|
import { QueryClient as QueryClient4, QueryClientProvider, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
@@ -1322,6 +1322,18 @@ var normalizeVenueMarketIds = (venueMarkets) => {
|
|
|
1322
1322
|
var normalizeOutcomeLabel = (label) => {
|
|
1323
1323
|
return typeof label === "string" ? label.trim().toLowerCase() : "";
|
|
1324
1324
|
};
|
|
1325
|
+
var normalizeSemanticOutcomeLabel = (label) => {
|
|
1326
|
+
const normalizedLabel = normalizeOutcomeLabel(label);
|
|
1327
|
+
if (!normalizedLabel) return "";
|
|
1328
|
+
if (normalizedLabel === "y") return "yes";
|
|
1329
|
+
if (normalizedLabel === "n") return "no";
|
|
1330
|
+
return normalizedLabel;
|
|
1331
|
+
};
|
|
1332
|
+
var outcomeMatchesSemanticSide = (left, right) => {
|
|
1333
|
+
const leftCandidates = [left.label, left.title].map((value) => normalizeSemanticOutcomeLabel(value)).filter(Boolean);
|
|
1334
|
+
const rightCandidates = [right.label, right.title].map((value) => normalizeSemanticOutcomeLabel(value)).filter(Boolean);
|
|
1335
|
+
return leftCandidates.some((candidate) => rightCandidates.includes(candidate));
|
|
1336
|
+
};
|
|
1325
1337
|
var resolveBestMidpointCandidateOutcomeIds = (venueMarkets) => {
|
|
1326
1338
|
var _a, _b;
|
|
1327
1339
|
if (!(venueMarkets == null ? void 0 : venueMarkets.length)) return [];
|
|
@@ -1351,6 +1363,31 @@ var resolveSiblingOutcomeMidpoint = (matched, ref) => {
|
|
|
1351
1363
|
if ((sibOutcome == null ? void 0 : sibOutcome.midpoint) == null) return null;
|
|
1352
1364
|
return { midpoint: sibOutcome.midpoint, venue: (_b = sibling.venue) != null ? _b : null };
|
|
1353
1365
|
};
|
|
1366
|
+
var resolveSemanticFallbackMidpoint = ({
|
|
1367
|
+
marketById,
|
|
1368
|
+
outcome,
|
|
1369
|
+
matched
|
|
1370
|
+
}) => {
|
|
1371
|
+
var _a;
|
|
1372
|
+
if (!(matched == null ? void 0 : matched.length)) return null;
|
|
1373
|
+
let best = null;
|
|
1374
|
+
for (const sibling of matched) {
|
|
1375
|
+
const siblingMarket = marketById.get(sibling.venueMarketId);
|
|
1376
|
+
if (!((_a = siblingMarket == null ? void 0 : siblingMarket.venueMarketOutcomes) == null ? void 0 : _a.length)) continue;
|
|
1377
|
+
for (const siblingOutcome of siblingMarket.venueMarketOutcomes) {
|
|
1378
|
+
if (!outcomeMatchesSemanticSide(outcome, siblingOutcome)) continue;
|
|
1379
|
+
const candidate = resolveSiblingOutcomeMidpoint(matched, {
|
|
1380
|
+
venueMarketId: sibling.venueMarketId,
|
|
1381
|
+
venueMarketOutcomeId: siblingOutcome.id
|
|
1382
|
+
});
|
|
1383
|
+
if (candidate == null) continue;
|
|
1384
|
+
if (best == null || candidate.midpoint < best.midpoint) {
|
|
1385
|
+
best = candidate;
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
return best;
|
|
1390
|
+
};
|
|
1354
1391
|
var extractBestPrices = (data, venueMarkets) => {
|
|
1355
1392
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1356
1393
|
const bestPrices = /* @__PURE__ */ new Map();
|
|
@@ -1459,11 +1496,12 @@ function useMidpoints(venueMarkets, options) {
|
|
|
1459
1496
|
refetchOnReconnect: false
|
|
1460
1497
|
});
|
|
1461
1498
|
const result = useMemo8(() => {
|
|
1462
|
-
var _a2, _b, _c, _d, _e;
|
|
1499
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
1463
1500
|
const map = /* @__PURE__ */ new Map();
|
|
1464
1501
|
const venueMap = /* @__PURE__ */ new Map();
|
|
1465
1502
|
if (!(data == null ? void 0 : data.data) || !venueMarkets) return { map, venueMap };
|
|
1466
1503
|
const itemByMarketId = new Map(data.data.map((item) => [item.venueMarketId, item]));
|
|
1504
|
+
const marketById = new Map(venueMarkets.map((market) => [market.id, market]));
|
|
1467
1505
|
for (const item of data.data) {
|
|
1468
1506
|
if (!((_a2 = item.outcomes) == null ? void 0 : _a2.length)) continue;
|
|
1469
1507
|
for (const o of item.outcomes) {
|
|
@@ -1477,15 +1515,26 @@ function useMidpoints(venueMarkets, options) {
|
|
|
1477
1515
|
if (!item) continue;
|
|
1478
1516
|
for (const outcome of market.venueMarketOutcomes) {
|
|
1479
1517
|
const refs = (_b = outcome.matchedVenueMarketOutcomes) != null ? _b : [];
|
|
1480
|
-
if (!refs.length) continue;
|
|
1481
1518
|
let best = (_c = map.get(outcome.id)) != null ? _c : null;
|
|
1482
1519
|
let bestVenue = (_d = item.venue) != null ? _d : null;
|
|
1483
|
-
|
|
1484
|
-
const
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
best
|
|
1488
|
-
|
|
1520
|
+
if (refs.length > 0) {
|
|
1521
|
+
for (const ref of refs) {
|
|
1522
|
+
const sib = resolveSiblingOutcomeMidpoint(item.matched, ref);
|
|
1523
|
+
if (sib == null) continue;
|
|
1524
|
+
if (best == null || sib.midpoint < best) {
|
|
1525
|
+
best = sib.midpoint;
|
|
1526
|
+
bestVenue = (_e = sib.venue) != null ? _e : bestVenue;
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
} else if (best == null) {
|
|
1530
|
+
const fallback = resolveSemanticFallbackMidpoint({
|
|
1531
|
+
marketById,
|
|
1532
|
+
outcome,
|
|
1533
|
+
matched: item.matched
|
|
1534
|
+
});
|
|
1535
|
+
if (fallback != null) {
|
|
1536
|
+
best = fallback.midpoint;
|
|
1537
|
+
bestVenue = (_f = fallback.venue) != null ? _f : bestVenue;
|
|
1489
1538
|
}
|
|
1490
1539
|
}
|
|
1491
1540
|
if (best != null) {
|
|
@@ -1583,18 +1632,19 @@ var useRollingChartWindow = (options) => {
|
|
|
1583
1632
|
// src/use-market-orderbook.ts
|
|
1584
1633
|
import { useQueries as useQueries5, useQueryClient } from "@tanstack/react-query";
|
|
1585
1634
|
function useMarketOrderbook(options) {
|
|
1586
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1635
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1587
1636
|
const queryClient = useQueryClient();
|
|
1588
1637
|
const ws = useAggWebSocket();
|
|
1589
1638
|
const isConnected = useAggWebSocketConnectionState();
|
|
1590
1639
|
const {
|
|
1591
1640
|
features: { enableLiveUpdates }
|
|
1592
1641
|
} = useAggUiConfig();
|
|
1593
|
-
const { marketId, depth, enabled = true, venueOutcomes, live } = options;
|
|
1642
|
+
const { venueMarketOutcomeId, marketId, depth, enabled = true, venueOutcomes, live } = options;
|
|
1643
|
+
const selectedId = (_a = venueMarketOutcomeId != null ? venueMarketOutcomeId : marketId) != null ? _a : null;
|
|
1594
1644
|
const liveEnabled = live != null ? live : enableLiveUpdates;
|
|
1595
1645
|
const outcomeIds = venueOutcomes == null ? void 0 : venueOutcomes.map((v) => v.venueMarketOutcomeId).filter(Boolean);
|
|
1596
|
-
const subscriptionIds = (outcomeIds == null ? void 0 : outcomeIds.length) ? [...new Set(outcomeIds)] :
|
|
1597
|
-
const selectedOutcomeId = (
|
|
1646
|
+
const subscriptionIds = (outcomeIds == null ? void 0 : outcomeIds.length) ? [...new Set(outcomeIds)] : selectedId ? [selectedId] : [];
|
|
1647
|
+
const selectedOutcomeId = (_b = subscriptionIds[0]) != null ? _b : null;
|
|
1598
1648
|
useMarketDataSubscription({
|
|
1599
1649
|
marketId: selectedOutcomeId,
|
|
1600
1650
|
additionalMarketIds: subscriptionIds.slice(1),
|
|
@@ -1616,8 +1666,8 @@ function useMarketOrderbook(options) {
|
|
|
1616
1666
|
var _a2, _b2;
|
|
1617
1667
|
return (_b2 = (_a2 = liveQueries[index]) == null ? void 0 : _a2.data) != null ? _b2 : createMarketLiveState(subscriptionId);
|
|
1618
1668
|
});
|
|
1619
|
-
const primaryOrderbook = (
|
|
1620
|
-
const primarySnapshotVersion = (
|
|
1669
|
+
const primaryOrderbook = (_d = (_c = liveStates[0]) == null ? void 0 : _c.orderbook) != null ? _d : null;
|
|
1670
|
+
const primarySnapshotVersion = (_f = (_e = liveStates[0]) == null ? void 0 : _e.orderbookSnapshotVersion) != null ? _f : 0;
|
|
1621
1671
|
const data = primaryOrderbook ? applyOrderbookDepth(
|
|
1622
1672
|
createMarketOrderbookDataFromState(primaryOrderbook, {
|
|
1623
1673
|
snapshotVersion: primarySnapshotVersion
|
|
@@ -1641,9 +1691,9 @@ function useMarketOrderbook(options) {
|
|
|
1641
1691
|
})
|
|
1642
1692
|
);
|
|
1643
1693
|
const hasAnyOrderbook = liveStates.some((liveState) => liveState.orderbook != null);
|
|
1644
|
-
const liveOrderbookErrorMessage = enabled && liveEnabled && !hasAnyOrderbook ? (
|
|
1694
|
+
const liveOrderbookErrorMessage = enabled && liveEnabled && !hasAnyOrderbook ? (_h = (_g = liveStates.find(
|
|
1645
1695
|
(liveState) => typeof liveState.orderbookError === "string" && liveState.orderbookError.length > 0
|
|
1646
|
-
)) == null ? void 0 :
|
|
1696
|
+
)) == null ? void 0 : _g.orderbookError) != null ? _h : null : null;
|
|
1647
1697
|
return {
|
|
1648
1698
|
data,
|
|
1649
1699
|
dataById,
|
|
@@ -1940,11 +1990,11 @@ import {
|
|
|
1940
1990
|
} from "@tanstack/react-query";
|
|
1941
1991
|
import { useContext as useContext2, useEffect as useEffect7, useState as useState6 } from "react";
|
|
1942
1992
|
function useSearch(options) {
|
|
1943
|
-
var _a, _b, _c;
|
|
1993
|
+
var _a, _b, _c, _d;
|
|
1944
1994
|
const client = useContext2(AggClientContext);
|
|
1945
1995
|
const queryClient = useContext2(QueryClientContext);
|
|
1946
1996
|
const [fallbackQueryClient] = useState6(() => new QueryClient());
|
|
1947
|
-
const { q, type, categoryIds, limit = 20, enabled = true, deep = false } = options;
|
|
1997
|
+
const { q, type, categoryIds, status, limit = 20, enabled = true, deep = false } = options;
|
|
1948
1998
|
const isEnabled = enabled && q.length > 0;
|
|
1949
1999
|
useEffect7(() => {
|
|
1950
2000
|
if (queryClient) return void 0;
|
|
@@ -1960,7 +2010,15 @@ function useSearch(options) {
|
|
|
1960
2010
|
{
|
|
1961
2011
|
// deep is part of the key — TanStack treats deep vs light as
|
|
1962
2012
|
// independent queries so users can have both modes cached side-by-side.
|
|
1963
|
-
queryKey: [
|
|
2013
|
+
queryKey: [
|
|
2014
|
+
"search",
|
|
2015
|
+
q,
|
|
2016
|
+
type,
|
|
2017
|
+
(_a = categoryIds == null ? void 0 : categoryIds.join(",")) != null ? _a : "",
|
|
2018
|
+
(_b = status == null ? void 0 : status.join(",")) != null ? _b : "",
|
|
2019
|
+
limit,
|
|
2020
|
+
deep
|
|
2021
|
+
],
|
|
1964
2022
|
queryFn: (_0) => __async(null, [_0], function* ({ pageParam }) {
|
|
1965
2023
|
if (!client) {
|
|
1966
2024
|
throw new Error("useSearch must be used within an <AggProvider>");
|
|
@@ -1969,6 +2027,7 @@ function useSearch(options) {
|
|
|
1969
2027
|
q,
|
|
1970
2028
|
type,
|
|
1971
2029
|
categoryIds,
|
|
2030
|
+
status,
|
|
1972
2031
|
limit,
|
|
1973
2032
|
cursor: pageParam,
|
|
1974
2033
|
deep
|
|
@@ -1986,7 +2045,7 @@ function useSearch(options) {
|
|
|
1986
2045
|
},
|
|
1987
2046
|
queryClient != null ? queryClient : fallbackQueryClient
|
|
1988
2047
|
);
|
|
1989
|
-
const data = (
|
|
2048
|
+
const data = (_d = (_c = query.data) == null ? void 0 : _c.pages.flatMap((page) => page.data)) != null ? _d : [];
|
|
1990
2049
|
return {
|
|
1991
2050
|
data,
|
|
1992
2051
|
isLoading: query.isLoading,
|
|
@@ -2006,6 +2065,7 @@ function useMarketSearch(options) {
|
|
|
2006
2065
|
const {
|
|
2007
2066
|
type,
|
|
2008
2067
|
categoryIds,
|
|
2068
|
+
status,
|
|
2009
2069
|
limit = 20,
|
|
2010
2070
|
debounceMs = 200,
|
|
2011
2071
|
enableSuggestions = true,
|
|
@@ -2020,6 +2080,7 @@ function useMarketSearch(options) {
|
|
|
2020
2080
|
q: trimmedDebounced,
|
|
2021
2081
|
type,
|
|
2022
2082
|
categoryIds,
|
|
2083
|
+
status,
|
|
2023
2084
|
limit,
|
|
2024
2085
|
enabled: suggestionsEnabled,
|
|
2025
2086
|
deep: false
|
|
@@ -2029,6 +2090,7 @@ function useMarketSearch(options) {
|
|
|
2029
2090
|
q: submittedQ,
|
|
2030
2091
|
type,
|
|
2031
2092
|
categoryIds,
|
|
2093
|
+
status,
|
|
2032
2094
|
limit,
|
|
2033
2095
|
enabled: submittedQ.length > 0,
|
|
2034
2096
|
deep: true
|
|
@@ -2653,6 +2715,19 @@ var mapMidpointsByVenueMarketId = (rows) => {
|
|
|
2653
2715
|
});
|
|
2654
2716
|
return mappedMidpoints;
|
|
2655
2717
|
};
|
|
2718
|
+
var mapArbReturnByVenueMarketId = (rows) => {
|
|
2719
|
+
const mappedArbReturns = /* @__PURE__ */ new Map();
|
|
2720
|
+
rows.forEach((row) => {
|
|
2721
|
+
var _a;
|
|
2722
|
+
mappedArbReturns.set(row.venueMarketId, (_a = row.arbReturn) != null ? _a : null);
|
|
2723
|
+
row.matched.forEach((matchedRow) => {
|
|
2724
|
+
var _a2;
|
|
2725
|
+
if (mappedArbReturns.has(matchedRow.venueMarketId)) return;
|
|
2726
|
+
mappedArbReturns.set(matchedRow.venueMarketId, (_a2 = matchedRow.arbReturn) != null ? _a2 : null);
|
|
2727
|
+
});
|
|
2728
|
+
});
|
|
2729
|
+
return mappedArbReturns;
|
|
2730
|
+
};
|
|
2656
2731
|
function useVenueMarketMidpoints(options) {
|
|
2657
2732
|
var _a, _b, _c, _d;
|
|
2658
2733
|
const client = useAggClient();
|
|
@@ -2682,9 +2757,11 @@ function useVenueMarketMidpoints(options) {
|
|
|
2682
2757
|
});
|
|
2683
2758
|
const midpointRows = (_d = (_c = query.data) == null ? void 0 : _c.data) != null ? _d : [];
|
|
2684
2759
|
const midpointsByVenueMarketId = mapMidpointsByVenueMarketId(midpointRows);
|
|
2760
|
+
const arbReturnByVenueMarketId = mapArbReturnByVenueMarketId(midpointRows);
|
|
2685
2761
|
return __spreadProps(__spreadValues({}, query), {
|
|
2686
2762
|
midpointRows,
|
|
2687
2763
|
midpointsByVenueMarketId,
|
|
2764
|
+
arbReturnByVenueMarketId,
|
|
2688
2765
|
requestedVenueMarketIds
|
|
2689
2766
|
});
|
|
2690
2767
|
}
|
package/dist/withdraw.js
CHANGED
|
@@ -341,6 +341,8 @@ var enUsLabels = {
|
|
|
341
341
|
depositType: "Deposit",
|
|
342
342
|
redeemType: "Claim",
|
|
343
343
|
withdrawalType: "Withdrawal",
|
|
344
|
+
claimBreakdownModalAriaLabel: "Claim activity breakdown",
|
|
345
|
+
claimBreakdownTransactionLinkAria: (venue) => `Open ${venue} claim transaction`,
|
|
344
346
|
redeemStatusTitles: {
|
|
345
347
|
pending: "Processing claim",
|
|
346
348
|
completed: "Successful claim",
|
package/dist/withdraw.mjs
CHANGED
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
useWithdrawFlow,
|
|
4
4
|
useWithdrawPreview,
|
|
5
5
|
useWithdrawalLifecycle
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TILXL4NI.mjs";
|
|
7
7
|
import {
|
|
8
8
|
useDepositAddresses,
|
|
9
9
|
useManagedBalances,
|
|
10
10
|
useWithdrawManaged
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-R7C4J345.mjs";
|
|
12
12
|
export {
|
|
13
13
|
useDepositAddresses,
|
|
14
14
|
useManagedBalances,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agg-build/hooks",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.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": "^2.
|
|
86
|
+
"@agg-build/sdk": "^2.3.0"
|
|
87
87
|
},
|
|
88
88
|
"peerDependenciesMeta": {
|
|
89
89
|
"@solana/wallet-adapter-react": {
|