@sudobility/heavymath_ui 0.0.14 → 0.0.16

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.
@@ -1,16 +1,12 @@
1
1
  /**
2
2
  * @fileoverview Hook to fetch markets associated with a specific game
3
- * @description Fetches SPORTS category markets from the indexer and filters
4
- * client-side by oracleId encoding. This is a temporary approach until
5
- * the indexer supports oracleId filtering in MarketFilters.
3
+ * @description Fetches markets by oracleId using server-side filtering.
6
4
  */
7
5
  import type { IndexerClient } from '@heavymath/indexer_client';
8
6
  import type { SportCode } from '../config/sportCodes';
9
7
  /**
10
8
  * Fetch markets for a specific game, identified by sport code and game ID.
11
- *
12
- * Currently fetches all SPORTS markets and filters client-side by oracleId.
13
- * Will be optimized with server-side filtering when the indexer adds oracleId support.
9
+ * Uses server-side oracle_id filtering for efficient querying.
14
10
  *
15
11
  * @param indexerClient - IndexerClient instance from useIndexer()
16
12
  * @param sportCode - Numeric sport code
@@ -1 +1 @@
1
- {"version":3,"file":"useGameMarkets.d.ts","sourceRoot":"","sources":["../../src/hooks/useGameMarkets.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC5B,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,6GAiChC"}
1
+ {"version":3,"file":"useGameMarkets.d.ts","sourceRoot":"","sources":["../../src/hooks/useGameMarkets.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,6GAqBhC"}
@@ -1,17 +1,13 @@
1
1
  /**
2
2
  * @fileoverview Hook to fetch markets associated with a specific game
3
- * @description Fetches SPORTS category markets from the indexer and filters
4
- * client-side by oracleId encoding. This is a temporary approach until
5
- * the indexer supports oracleId filtering in MarketFilters.
3
+ * @description Fetches markets by oracleId using server-side filtering.
6
4
  */
7
5
  import { useQuery } from '@tanstack/react-query';
8
- import { encodeOracleId, isValidSportsOracleId } from '../utils/oracleId';
6
+ import { encodeOracleId } from '../utils/oracleId';
9
7
  import { CATEGORIES } from '../types/market';
10
8
  /**
11
9
  * Fetch markets for a specific game, identified by sport code and game ID.
12
- *
13
- * Currently fetches all SPORTS markets and filters client-side by oracleId.
14
- * Will be optimized with server-side filtering when the indexer adds oracleId support.
10
+ * Uses server-side oracle_id filtering for efficient querying.
15
11
  *
16
12
  * @param indexerClient - IndexerClient instance from useIndexer()
17
13
  * @param sportCode - Numeric sport code
@@ -23,28 +19,17 @@ export function useGameMarkets(indexerClient, sportCode, gameId, options) {
23
19
  return useQuery({
24
20
  queryKey: ['gameMarkets', sportCode, gameId],
25
21
  queryFn: async () => {
22
+ if (!targetOracleId)
23
+ return [];
26
24
  const response = await indexerClient.getMarkets({
27
25
  category: CATEGORIES.SPORTS,
26
+ oracleId: targetOracleId,
28
27
  limit: 100,
29
28
  });
30
- const markets = response.data ?? [];
31
- if (!targetOracleId)
32
- return [];
33
- return markets.filter(market => {
34
- if (!market.oracleId)
35
- return false;
36
- try {
37
- const normalized = market.oracleId.toLowerCase();
38
- return (normalized === targetOracleId.toLowerCase() &&
39
- isValidSportsOracleId(market.oracleId));
40
- }
41
- catch {
42
- return false;
43
- }
44
- });
29
+ return response.data ?? [];
45
30
  },
46
31
  enabled: (options?.enabled ?? true) && gameId !== undefined,
47
- staleTime: 5 * 60 * 1000, // 5 minutes
32
+ staleTime: 5 * 60 * 1000,
48
33
  });
49
34
  }
50
35
  //# sourceMappingURL=useGameMarkets.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useGameMarkets.js","sourceRoot":"","sources":["../../src/hooks/useGameMarkets.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc,CAC5B,aAA4B,EAC5B,SAAoB,EACpB,MAA0B,EAC1B,OAA+B;IAE/B,MAAM,cAAc,GAClB,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAEvE,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,CAAC,aAAa,EAAE,SAAS,EAAE,MAAM,CAAC;QAC5C,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,UAAU,CAAC;gBAC9C,QAAQ,EAAE,UAAU,CAAC,MAAM;gBAC3B,KAAK,EAAE,GAAG;aACX,CAAC,CAAC;YAEH,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC;YAEpC,IAAI,CAAC,cAAc;gBAAE,OAAO,EAAE,CAAC;YAE/B,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;gBAC7B,IAAI,CAAC,MAAM,CAAC,QAAQ;oBAAE,OAAO,KAAK,CAAC;gBACnC,IAAI,CAAC;oBACH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BACxB,KAAK,EAAE,GAAG;aACX,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC;QAC7B,CAAC;QACD,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC,IAAI,MAAM,KAAK,SAAS;QAC3D,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;KACzB,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudobility/heavymath_ui",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "Shared UI components, hooks, and utilities for Heavymath prediction market apps",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -30,8 +30,8 @@
30
30
  "@sudobility/design": "^1.1.30",
31
31
  "@sudobility/di": "^1.5.56",
32
32
  "@sudobility/heavymath_contracts": "^0.1.67",
33
- "@sudobility/heavymath_indexer_client": "^0.0.53",
34
- "@sudobility/heavymath_lib": "^0.0.78",
33
+ "@sudobility/heavymath_indexer_client": "^0.0.55",
34
+ "@sudobility/heavymath_lib": "^0.0.80",
35
35
  "@sudobility/heavymath_types": "^0.0.31",
36
36
  "@sudobility/types": "^1.9.62",
37
37
  "@sudobility/web3-components": "^2.0.15",
@@ -53,8 +53,8 @@
53
53
  "@sudobility/design": "^1.1.30",
54
54
  "@sudobility/di": "^1.5.56",
55
55
  "@sudobility/heavymath_contracts": "^0.1.67",
56
- "@sudobility/heavymath_indexer_client": "^0.0.53",
57
- "@sudobility/heavymath_lib": "^0.0.78",
56
+ "@sudobility/heavymath_indexer_client": "^0.0.55",
57
+ "@sudobility/heavymath_lib": "^0.0.80",
58
58
  "@sudobility/heavymath_types": "^0.0.31",
59
59
  "@sudobility/types": "^1.9.62",
60
60
  "@sudobility/web3-components": "^2.0.15",