@sudobility/heavymath_ui 0.0.3
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/components/dealer/DealerNFTList.d.ts +6 -0
- package/dist/components/dealer/DealerNFTList.d.ts.map +1 -0
- package/dist/components/dealer/DealerNFTList.js +46 -0
- package/dist/components/dealer/DealerNFTList.js.map +1 -0
- package/dist/components/dealer/DealerNFTSelector.d.ts +8 -0
- package/dist/components/dealer/DealerNFTSelector.d.ts.map +1 -0
- package/dist/components/dealer/DealerNFTSelector.js +10 -0
- package/dist/components/dealer/DealerNFTSelector.js.map +1 -0
- package/dist/components/dealer/UpcomingGamesWidget.d.ts +8 -0
- package/dist/components/dealer/UpcomingGamesWidget.d.ts.map +1 -0
- package/dist/components/dealer/UpcomingGamesWidget.js +68 -0
- package/dist/components/dealer/UpcomingGamesWidget.js.map +1 -0
- package/dist/components/icons/index.d.ts +2 -0
- package/dist/components/icons/index.d.ts.map +1 -0
- package/dist/components/icons/index.js +2 -0
- package/dist/components/icons/index.js.map +1 -0
- package/dist/components/market/GameMarketsSection.d.ts +16 -0
- package/dist/components/market/GameMarketsSection.d.ts.map +1 -0
- package/dist/components/market/GameMarketsSection.js +18 -0
- package/dist/components/market/GameMarketsSection.js.map +1 -0
- package/dist/components/market/InlineCreateMarketForm.d.ts +17 -0
- package/dist/components/market/InlineCreateMarketForm.d.ts.map +1 -0
- package/dist/components/market/InlineCreateMarketForm.js +274 -0
- package/dist/components/market/InlineCreateMarketForm.js.map +1 -0
- package/dist/components/market/LeagueMarketsSection.d.ts +16 -0
- package/dist/components/market/LeagueMarketsSection.d.ts.map +1 -0
- package/dist/components/market/LeagueMarketsSection.js +15 -0
- package/dist/components/market/LeagueMarketsSection.js.map +1 -0
- package/dist/components/market/MarketCard.d.ts +8 -0
- package/dist/components/market/MarketCard.d.ts.map +1 -0
- package/dist/components/market/MarketCard.js +30 -0
- package/dist/components/market/MarketCard.js.map +1 -0
- package/dist/components/market/MarketList.d.ts +9 -0
- package/dist/components/market/MarketList.d.ts.map +1 -0
- package/dist/components/market/MarketList.js +17 -0
- package/dist/components/market/MarketList.js.map +1 -0
- package/dist/components/market/MarketStatusBadge.d.ts +8 -0
- package/dist/components/market/MarketStatusBadge.d.ts.map +1 -0
- package/dist/components/market/MarketStatusBadge.js +31 -0
- package/dist/components/market/MarketStatusBadge.js.map +1 -0
- package/dist/components/market/PredictionSlider.d.ts +11 -0
- package/dist/components/market/PredictionSlider.d.ts.map +1 -0
- package/dist/components/market/PredictionSlider.js +55 -0
- package/dist/components/market/PredictionSlider.js.map +1 -0
- package/dist/components/market/SportPredictionCard.d.ts +15 -0
- package/dist/components/market/SportPredictionCard.d.ts.map +1 -0
- package/dist/components/market/SportPredictionCard.js +92 -0
- package/dist/components/market/SportPredictionCard.js.map +1 -0
- package/dist/components/market/TeamMarketsSection.d.ts +17 -0
- package/dist/components/market/TeamMarketsSection.d.ts.map +1 -0
- package/dist/components/market/TeamMarketsSection.js +8 -0
- package/dist/components/market/TeamMarketsSection.js.map +1 -0
- package/dist/components/market/TeamTournamentMarketForm.d.ts +19 -0
- package/dist/components/market/TeamTournamentMarketForm.d.ts.map +1 -0
- package/dist/components/market/TeamTournamentMarketForm.js +92 -0
- package/dist/components/market/TeamTournamentMarketForm.js.map +1 -0
- package/dist/components/market/TournamentMarketForm.d.ts +19 -0
- package/dist/components/market/TournamentMarketForm.d.ts.map +1 -0
- package/dist/components/market/TournamentMarketForm.js +86 -0
- package/dist/components/market/TournamentMarketForm.js.map +1 -0
- package/dist/components/market/index.d.ts +12 -0
- package/dist/components/market/index.d.ts.map +1 -0
- package/dist/components/market/index.js +12 -0
- package/dist/components/market/index.js.map +1 -0
- package/dist/components/sports/SeasonSelector.d.ts +10 -0
- package/dist/components/sports/SeasonSelector.d.ts.map +1 -0
- package/dist/components/sports/SeasonSelector.js +13 -0
- package/dist/components/sports/SeasonSelector.js.map +1 -0
- package/dist/components/ui/AnimatedCollapse.d.ts +9 -0
- package/dist/components/ui/AnimatedCollapse.d.ts.map +1 -0
- package/dist/components/ui/AnimatedCollapse.js +8 -0
- package/dist/components/ui/AnimatedCollapse.js.map +1 -0
- package/dist/components/ui/FavoriteStar.d.ts +13 -0
- package/dist/components/ui/FavoriteStar.d.ts.map +1 -0
- package/dist/components/ui/FavoriteStar.js +47 -0
- package/dist/components/ui/FavoriteStar.js.map +1 -0
- package/dist/components/wallet/ConnectedWalletMenu.d.ts +16 -0
- package/dist/components/wallet/ConnectedWalletMenu.d.ts.map +1 -0
- package/dist/components/wallet/ConnectedWalletMenu.js +131 -0
- package/dist/components/wallet/ConnectedWalletMenu.js.map +1 -0
- package/dist/components/wallet/DealerRoute.d.ts +6 -0
- package/dist/components/wallet/DealerRoute.d.ts.map +1 -0
- package/dist/components/wallet/DealerRoute.js +20 -0
- package/dist/components/wallet/DealerRoute.js.map +1 -0
- package/dist/components/wallet/ProtectedRoute.d.ts +8 -0
- package/dist/components/wallet/ProtectedRoute.d.ts.map +1 -0
- package/dist/components/wallet/ProtectedRoute.js +17 -0
- package/dist/components/wallet/ProtectedRoute.js.map +1 -0
- package/dist/components/wallet/WalletConnectionModal.d.ts +7 -0
- package/dist/components/wallet/WalletConnectionModal.d.ts.map +1 -0
- package/dist/components/wallet/WalletConnectionModal.js +334 -0
- package/dist/components/wallet/WalletConnectionModal.js.map +1 -0
- package/dist/config/app.d.ts +24 -0
- package/dist/config/app.d.ts.map +1 -0
- package/dist/config/app.js +18 -0
- package/dist/config/app.js.map +1 -0
- package/dist/config/chains.d.ts +1070 -0
- package/dist/config/chains.d.ts.map +1 -0
- package/dist/config/chains.js +28 -0
- package/dist/config/chains.js.map +1 -0
- package/dist/config/contracts.d.ts +15 -0
- package/dist/config/contracts.d.ts.map +1 -0
- package/dist/config/contracts.js +62 -0
- package/dist/config/contracts.js.map +1 -0
- package/dist/config/sportCodes.d.ts +58 -0
- package/dist/config/sportCodes.d.ts.map +1 -0
- package/dist/config/sportCodes.js +78 -0
- package/dist/config/sportCodes.js.map +1 -0
- package/dist/context/IndexerContext.d.ts +34 -0
- package/dist/context/IndexerContext.d.ts.map +1 -0
- package/dist/context/IndexerContext.js +40 -0
- package/dist/context/IndexerContext.js.map +1 -0
- package/dist/context/WalletAuthContext.d.ts +26 -0
- package/dist/context/WalletAuthContext.d.ts.map +1 -0
- package/dist/context/WalletAuthContext.js +148 -0
- package/dist/context/WalletAuthContext.js.map +1 -0
- package/dist/hooks/index.d.ts +13 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +13 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/useContractWithToast.d.ts +1348 -0
- package/dist/hooks/useContractWithToast.d.ts.map +1 -0
- package/dist/hooks/useContractWithToast.js +395 -0
- package/dist/hooks/useContractWithToast.js.map +1 -0
- package/dist/hooks/useDealerNFT.d.ts +71 -0
- package/dist/hooks/useDealerNFT.d.ts.map +1 -0
- package/dist/hooks/useDealerNFT.js +127 -0
- package/dist/hooks/useDealerNFT.js.map +1 -0
- package/dist/hooks/useDealerPermission.d.ts +11 -0
- package/dist/hooks/useDealerPermission.d.ts.map +1 -0
- package/dist/hooks/useDealerPermission.js +48 -0
- package/dist/hooks/useDealerPermission.js.map +1 -0
- package/dist/hooks/useFilteredSportsData.d.ts +20 -0
- package/dist/hooks/useFilteredSportsData.d.ts.map +1 -0
- package/dist/hooks/useFilteredSportsData.js +52 -0
- package/dist/hooks/useFilteredSportsData.js.map +1 -0
- package/dist/hooks/useGameMarkets.d.ts +23 -0
- package/dist/hooks/useGameMarkets.d.ts.map +1 -0
- package/dist/hooks/useGameMarkets.js +50 -0
- package/dist/hooks/useGameMarkets.js.map +1 -0
- package/dist/hooks/useLeagueMarkets.d.ts +11 -0
- package/dist/hooks/useLeagueMarkets.d.ts.map +1 -0
- package/dist/hooks/useLeagueMarkets.js +38 -0
- package/dist/hooks/useLeagueMarkets.js.map +1 -0
- package/dist/hooks/useMarketContract.d.ts +219 -0
- package/dist/hooks/useMarketContract.d.ts.map +1 -0
- package/dist/hooks/useMarketContract.js +790 -0
- package/dist/hooks/useMarketContract.js.map +1 -0
- package/dist/hooks/useToastActions.d.ts +13 -0
- package/dist/hooks/useToastActions.d.ts.map +1 -0
- package/dist/hooks/useToastActions.js +40 -0
- package/dist/hooks/useToastActions.js.map +1 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/evmClient.d.ts +299 -0
- package/dist/lib/evmClient.d.ts.map +1 -0
- package/dist/lib/evmClient.js +691 -0
- package/dist/lib/evmClient.js.map +1 -0
- package/dist/types/auth.d.ts +44 -0
- package/dist/types/auth.d.ts.map +1 -0
- package/dist/types/auth.js +17 -0
- package/dist/types/auth.js.map +1 -0
- package/dist/types/dealer.d.ts +59 -0
- package/dist/types/dealer.d.ts.map +1 -0
- package/dist/types/dealer.js +31 -0
- package/dist/types/dealer.js.map +1 -0
- package/dist/types/market.d.ts +79 -0
- package/dist/types/market.d.ts.map +1 -0
- package/dist/types/market.js +47 -0
- package/dist/types/market.js.map +1 -0
- package/dist/utils/conditionData.d.ts +8 -0
- package/dist/utils/conditionData.d.ts.map +1 -0
- package/dist/utils/conditionData.js +7 -0
- package/dist/utils/conditionData.js.map +1 -0
- package/dist/utils/datetime.d.ts +3 -0
- package/dist/utils/datetime.d.ts.map +1 -0
- package/dist/utils/datetime.js +13 -0
- package/dist/utils/datetime.js.map +1 -0
- package/dist/utils/format.d.ts +79 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +144 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/marketDisplay.d.ts +28 -0
- package/dist/utils/marketDisplay.d.ts.map +1 -0
- package/dist/utils/marketDisplay.js +45 -0
- package/dist/utils/marketDisplay.js.map +1 -0
- package/dist/utils/marketId.d.ts +8 -0
- package/dist/utils/marketId.d.ts.map +1 -0
- package/dist/utils/marketId.js +12 -0
- package/dist/utils/marketId.js.map +1 -0
- package/dist/utils/oracleId.d.ts +33 -0
- package/dist/utils/oracleId.d.ts.map +1 -0
- package/dist/utils/oracleId.js +62 -0
- package/dist/utils/oracleId.js.map +1 -0
- package/dist/utils/sportsSeason.d.ts +10 -0
- package/dist/utils/sportsSeason.d.ts.map +1 -0
- package/dist/utils/sportsSeason.js +39 -0
- package/dist/utils/sportsSeason.js.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useReadContract, useChainId } from 'wagmi';
|
|
2
|
+
import { useAuth } from '../context/WalletAuthContext';
|
|
3
|
+
import { getContractAddress } from '../config/contracts';
|
|
4
|
+
import { CATEGORIES } from '../types/market';
|
|
5
|
+
const VALIDATE_PERMISSION_ABI = [
|
|
6
|
+
{
|
|
7
|
+
name: 'validatePermission',
|
|
8
|
+
type: 'function',
|
|
9
|
+
stateMutability: 'view',
|
|
10
|
+
inputs: [
|
|
11
|
+
{ name: 'tokenId', type: 'uint256' },
|
|
12
|
+
{ name: 'category', type: 'uint256' },
|
|
13
|
+
{ name: 'subCategory', type: 'uint256' },
|
|
14
|
+
],
|
|
15
|
+
outputs: [{ name: '', type: 'bool' }],
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* Check if the dealer's token has permission for a given sport.
|
|
20
|
+
* Accepts an optional tokenId; defaults to the first token.
|
|
21
|
+
* Returns { hasPermission, isLoading } so forms can gate submission.
|
|
22
|
+
*/
|
|
23
|
+
export function useDealerPermission(sportCode, tokenId) {
|
|
24
|
+
const { dealerTokenIds, isDealer } = useAuth();
|
|
25
|
+
const chainId = useChainId();
|
|
26
|
+
const dealerNFTAddress = getContractAddress(chainId, 'dealerNFT');
|
|
27
|
+
const effectiveTokenId = tokenId ?? dealerTokenIds?.[0];
|
|
28
|
+
const { data: permitted, isLoading } = useReadContract({
|
|
29
|
+
address: dealerNFTAddress,
|
|
30
|
+
abi: VALIDATE_PERMISSION_ABI,
|
|
31
|
+
functionName: 'validatePermission',
|
|
32
|
+
args: effectiveTokenId !== undefined
|
|
33
|
+
? [
|
|
34
|
+
BigInt(effectiveTokenId),
|
|
35
|
+
BigInt(CATEGORIES.SPORTS),
|
|
36
|
+
BigInt(sportCode),
|
|
37
|
+
]
|
|
38
|
+
: undefined,
|
|
39
|
+
query: {
|
|
40
|
+
enabled: isDealer && effectiveTokenId !== undefined && !!dealerNFTAddress,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
hasPermission: permitted === true,
|
|
45
|
+
isLoading,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=useDealerPermission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDealerPermission.js","sourceRoot":"","sources":["../../src/hooks/useDealerPermission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,uBAAuB,GAAG;IAC9B;QACE,IAAI,EAAE,oBAAoB;QAC1B,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,MAAM;QACvB,MAAM,EAAE;YACN,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;YACpC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;YACrC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE;SACzC;QACD,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;KACtC;CACO,CAAC;AAEX;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAAoB,EAAE,OAAgB;IACxE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAC;IAC/C,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAC7B,MAAM,gBAAgB,GAAG,kBAAkB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAClE,MAAM,gBAAgB,GAAG,OAAO,IAAI,cAAc,EAAE,CAAC,CAAC,CAAC,CAAC;IAExD,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,eAAe,CAAC;QACrD,OAAO,EAAE,gBAAgB;QACzB,GAAG,EAAE,uBAAuB;QAC5B,YAAY,EAAE,oBAAoB;QAClC,IAAI,EACF,gBAAgB,KAAK,SAAS;YAC5B,CAAC,CAAC;gBACE,MAAM,CAAC,gBAAgB,CAAC;gBACxB,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC;gBACzB,MAAM,CAAC,SAAS,CAAC;aAClB;YACH,CAAC,CAAC,SAAS;QACf,KAAK,EAAE;YACL,OAAO,EAAE,QAAQ,IAAI,gBAAgB,KAAK,SAAS,IAAI,CAAC,CAAC,gBAAgB;SAC1E;KACF,CAAC,CAAC;IAEH,OAAO;QACL,aAAa,EAAE,SAAS,KAAK,IAAI;QACjC,SAAS;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Hook to get game IDs that have associated prediction markets
|
|
3
|
+
* @description Fetches all SPORTS category markets from the indexer, decodes
|
|
4
|
+
* their oracleIds, and returns a set of game IDs for a given sport.
|
|
5
|
+
* Used by the bettor mode to filter sports hierarchy pages.
|
|
6
|
+
*/
|
|
7
|
+
import type { IndexerClient } from '@heavymath/indexer_client';
|
|
8
|
+
import type { SportCode } from '../config/sportCodes';
|
|
9
|
+
/**
|
|
10
|
+
* Fetch game IDs that have associated prediction markets for a given sport.
|
|
11
|
+
*
|
|
12
|
+
* @param indexerClient - IndexerClient instance
|
|
13
|
+
* @param sportCode - Numeric sport code to filter by
|
|
14
|
+
* @returns Set of game IDs with markets, plus loading state
|
|
15
|
+
*/
|
|
16
|
+
export declare function useGameIdsWithMarkets(indexerClient: IndexerClient, sportCode: SportCode): {
|
|
17
|
+
gameIds: Set<number>;
|
|
18
|
+
isLoading: boolean;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=useFilteredSportsData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFilteredSportsData.d.ts","sourceRoot":"","sources":["../../src/hooks/useFilteredSportsData.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;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS;;;EAoCrB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Hook to get game IDs that have associated prediction markets
|
|
3
|
+
* @description Fetches all SPORTS category markets from the indexer, decodes
|
|
4
|
+
* their oracleIds, and returns a set of game IDs for a given sport.
|
|
5
|
+
* Used by the bettor mode to filter sports hierarchy pages.
|
|
6
|
+
*/
|
|
7
|
+
import { useQuery } from '@tanstack/react-query';
|
|
8
|
+
import { decodeOracleId, isValidSportsOracleId } from '../utils/oracleId';
|
|
9
|
+
import { CATEGORIES } from '../types/market';
|
|
10
|
+
/**
|
|
11
|
+
* Fetch game IDs that have associated prediction markets for a given sport.
|
|
12
|
+
*
|
|
13
|
+
* @param indexerClient - IndexerClient instance
|
|
14
|
+
* @param sportCode - Numeric sport code to filter by
|
|
15
|
+
* @returns Set of game IDs with markets, plus loading state
|
|
16
|
+
*/
|
|
17
|
+
export function useGameIdsWithMarkets(indexerClient, sportCode) {
|
|
18
|
+
const { data, isLoading } = useQuery({
|
|
19
|
+
queryKey: ['gameIdsWithMarkets', sportCode],
|
|
20
|
+
queryFn: async () => {
|
|
21
|
+
const response = await indexerClient.getMarkets({
|
|
22
|
+
category: CATEGORIES.SPORTS,
|
|
23
|
+
limit: 500,
|
|
24
|
+
});
|
|
25
|
+
const markets = response.data ?? [];
|
|
26
|
+
const gameIds = new Set();
|
|
27
|
+
for (const market of markets) {
|
|
28
|
+
if (!market.oracleId)
|
|
29
|
+
continue;
|
|
30
|
+
try {
|
|
31
|
+
const hex = market.oracleId;
|
|
32
|
+
if (!isValidSportsOracleId(hex))
|
|
33
|
+
continue;
|
|
34
|
+
const { sportCode: sc, gameId } = decodeOracleId(hex);
|
|
35
|
+
if (sc === sportCode) {
|
|
36
|
+
gameIds.add(gameId);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
// Skip invalid oracleIds
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return gameIds;
|
|
44
|
+
},
|
|
45
|
+
staleTime: 5 * 60 * 1000, // 5 minutes
|
|
46
|
+
});
|
|
47
|
+
return {
|
|
48
|
+
gameIds: data ?? new Set(),
|
|
49
|
+
isLoading,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=useFilteredSportsData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFilteredSportsData.js","sourceRoot":"","sources":["../../src/hooks/useFilteredSportsData.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;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,aAA4B,EAC5B,SAAoB;IAEpB,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,QAAQ,CAAC;QACnC,QAAQ,EAAE,CAAC,oBAAoB,EAAE,SAAS,CAAC;QAC3C,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;YACpC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;YAElC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;gBAC7B,IAAI,CAAC,MAAM,CAAC,QAAQ;oBAAE,SAAS;gBAC/B,IAAI,CAAC;oBACH,MAAM,GAAG,GAAG,MAAM,CAAC,QAAyB,CAAC;oBAC7C,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC;wBAAE,SAAS;oBAC1C,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;oBACtD,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;wBACrB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;oBACtB,CAAC;gBACH,CAAC;gBAAC,MAAM,CAAC;oBACP,yBAAyB;gBAC3B,CAAC;YACH,CAAC;YAED,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,YAAY;KACvC,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE,IAAI,IAAI,IAAI,GAAG,EAAU;QAClC,SAAS;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
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.
|
|
6
|
+
*/
|
|
7
|
+
import type { IndexerClient } from '@heavymath/indexer_client';
|
|
8
|
+
import type { SportCode } from '../config/sportCodes';
|
|
9
|
+
/**
|
|
10
|
+
* 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.
|
|
14
|
+
*
|
|
15
|
+
* @param indexerClient - IndexerClient instance from useIndexer()
|
|
16
|
+
* @param sportCode - Numeric sport code
|
|
17
|
+
* @param gameId - Game/fixture ID from the sports API
|
|
18
|
+
* @param options - Optional TanStack Query options
|
|
19
|
+
*/
|
|
20
|
+
export declare function useGameMarkets(indexerClient: IndexerClient, sportCode: SportCode, gameId: number | undefined, options?: {
|
|
21
|
+
enabled?: boolean;
|
|
22
|
+
}): import("@tanstack/react-query").UseQueryResult<import("@sudobility/heavymath_types").MarketData[], Error>;
|
|
23
|
+
//# sourceMappingURL=useGameMarkets.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
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.
|
|
6
|
+
*/
|
|
7
|
+
import { useQuery } from '@tanstack/react-query';
|
|
8
|
+
import { encodeOracleId, isValidSportsOracleId } from '../utils/oracleId';
|
|
9
|
+
import { CATEGORIES } from '../types/market';
|
|
10
|
+
/**
|
|
11
|
+
* 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.
|
|
15
|
+
*
|
|
16
|
+
* @param indexerClient - IndexerClient instance from useIndexer()
|
|
17
|
+
* @param sportCode - Numeric sport code
|
|
18
|
+
* @param gameId - Game/fixture ID from the sports API
|
|
19
|
+
* @param options - Optional TanStack Query options
|
|
20
|
+
*/
|
|
21
|
+
export function useGameMarkets(indexerClient, sportCode, gameId, options) {
|
|
22
|
+
const targetOracleId = gameId !== undefined ? encodeOracleId(sportCode, gameId) : undefined;
|
|
23
|
+
return useQuery({
|
|
24
|
+
queryKey: ['gameMarkets', sportCode, gameId],
|
|
25
|
+
queryFn: async () => {
|
|
26
|
+
const response = await indexerClient.getMarkets({
|
|
27
|
+
category: CATEGORIES.SPORTS,
|
|
28
|
+
limit: 100,
|
|
29
|
+
});
|
|
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
|
+
});
|
|
45
|
+
},
|
|
46
|
+
enabled: (options?.enabled ?? true) && gameId !== undefined,
|
|
47
|
+
staleTime: 5 * 60 * 1000, // 5 minutes
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=useGameMarkets.js.map
|
|
@@ -0,0 +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,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;oBACjD,OAAO,CACL,UAAU,KAAK,cAAc,CAAC,WAAW,EAAE;wBAC3C,qBAAqB,CAAC,MAAM,CAAC,QAAyB,CAAC,CACxD,CAAC;gBACJ,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO,KAAK,CAAC;gBACf,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC,IAAI,MAAM,KAAK,SAAS;QAC3D,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,YAAY;KACvC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Hook to fetch markets associated with a specific league/tournament
|
|
3
|
+
* @description Fetches SPORTS category markets from the indexer and filters
|
|
4
|
+
* client-side by oracleId encoding. Same approach as useGameMarkets.
|
|
5
|
+
*/
|
|
6
|
+
import type { IndexerClient } from '@heavymath/indexer_client';
|
|
7
|
+
import type { SportCode } from '../config/sportCodes';
|
|
8
|
+
export declare function useLeagueMarkets(indexerClient: IndexerClient, sportCode: SportCode, leagueId: number | undefined, options?: {
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
}): import("@tanstack/react-query").UseQueryResult<import("@sudobility/heavymath_types").MarketData[], Error>;
|
|
11
|
+
//# sourceMappingURL=useLeagueMarkets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLeagueMarkets.d.ts","sourceRoot":"","sources":["../../src/hooks/useLeagueMarkets.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,6GAiChC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Hook to fetch markets associated with a specific league/tournament
|
|
3
|
+
* @description Fetches SPORTS category markets from the indexer and filters
|
|
4
|
+
* client-side by oracleId encoding. Same approach as useGameMarkets.
|
|
5
|
+
*/
|
|
6
|
+
import { useQuery } from '@tanstack/react-query';
|
|
7
|
+
import { encodeOracleId, isValidSportsOracleId } from '../utils/oracleId';
|
|
8
|
+
import { CATEGORIES } from '../types/market';
|
|
9
|
+
export function useLeagueMarkets(indexerClient, sportCode, leagueId, options) {
|
|
10
|
+
const targetOracleId = leagueId !== undefined ? encodeOracleId(sportCode, leagueId) : undefined;
|
|
11
|
+
return useQuery({
|
|
12
|
+
queryKey: ['leagueMarkets', sportCode, leagueId],
|
|
13
|
+
queryFn: async () => {
|
|
14
|
+
const response = await indexerClient.getMarkets({
|
|
15
|
+
category: CATEGORIES.SPORTS,
|
|
16
|
+
limit: 100,
|
|
17
|
+
});
|
|
18
|
+
const markets = response.data ?? [];
|
|
19
|
+
if (!targetOracleId)
|
|
20
|
+
return [];
|
|
21
|
+
return markets.filter(market => {
|
|
22
|
+
if (!market.oracleId)
|
|
23
|
+
return false;
|
|
24
|
+
try {
|
|
25
|
+
const normalized = market.oracleId.toLowerCase();
|
|
26
|
+
return (normalized === targetOracleId.toLowerCase() &&
|
|
27
|
+
isValidSportsOracleId(market.oracleId));
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
enabled: (options?.enabled ?? true) && leagueId !== undefined,
|
|
35
|
+
staleTime: 5 * 60 * 1000,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=useLeagueMarkets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLeagueMarkets.js","sourceRoot":"","sources":["../../src/hooks/useLeagueMarkets.ts"],"names":[],"mappings":"AAAA;;;;GAIG;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,MAAM,UAAU,gBAAgB,CAC9B,aAA4B,EAC5B,SAAoB,EACpB,QAA4B,EAC5B,OAA+B;IAE/B,MAAM,cAAc,GAClB,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAE3E,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,CAAC,eAAe,EAAE,SAAS,EAAE,QAAQ,CAAC;QAChD,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,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;oBACjD,OAAO,CACL,UAAU,KAAK,cAAc,CAAC,WAAW,EAAE;wBAC3C,qBAAqB,CAAC,MAAM,CAAC,QAAyB,CAAC,CACxD,CAAC;gBACJ,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO,KAAK,CAAC;gBACf,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC,IAAI,QAAQ,KAAK,SAAS;QAC7D,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;KACzB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { EVMPredictionClient } from '../lib/evmClient';
|
|
2
|
+
import type { Address } from 'viem';
|
|
3
|
+
/**
|
|
4
|
+
* Hook to get the EVM prediction client for the current chain.
|
|
5
|
+
*
|
|
6
|
+
* @returns The EVMPredictionClient for the current chain, or null if contracts are unavailable
|
|
7
|
+
*/
|
|
8
|
+
export declare function useEVMClient(): EVMPredictionClient | null;
|
|
9
|
+
/**
|
|
10
|
+
* Hook to place a prediction on a market.
|
|
11
|
+
* Auto-handles USDC allowance approval before the prediction transaction.
|
|
12
|
+
*
|
|
13
|
+
* @returns TanStack mutation for placing predictions
|
|
14
|
+
*/
|
|
15
|
+
export declare function usePlacePrediction(): import("@tanstack/react-query").UseMutationResult<import("../lib/evmClient").TransactionResult, Error, {
|
|
16
|
+
marketId: bigint;
|
|
17
|
+
percentage: number;
|
|
18
|
+
amount: bigint;
|
|
19
|
+
}, unknown>;
|
|
20
|
+
/**
|
|
21
|
+
* Hook to update an existing prediction on a market.
|
|
22
|
+
* Auto-handles USDC allowance approval for additional stake amounts.
|
|
23
|
+
*
|
|
24
|
+
* @returns TanStack mutation for updating predictions
|
|
25
|
+
*/
|
|
26
|
+
export declare function useUpdatePrediction(): import("@tanstack/react-query").UseMutationResult<import("../lib/evmClient").TransactionResult, Error, {
|
|
27
|
+
marketId: bigint;
|
|
28
|
+
newPercentage: number;
|
|
29
|
+
additionalAmount: bigint;
|
|
30
|
+
}, unknown>;
|
|
31
|
+
/**
|
|
32
|
+
* Hook to withdraw a prediction from a market (before deadline).
|
|
33
|
+
*
|
|
34
|
+
* @returns TanStack mutation for withdrawing predictions
|
|
35
|
+
*/
|
|
36
|
+
export declare function useWithdrawPrediction(): import("@tanstack/react-query").UseMutationResult<import("../lib/evmClient").TransactionResult, Error, {
|
|
37
|
+
marketId: bigint;
|
|
38
|
+
}, unknown>;
|
|
39
|
+
/**
|
|
40
|
+
* Hook to claim winnings from a resolved market.
|
|
41
|
+
*
|
|
42
|
+
* @returns TanStack mutation for claiming winnings
|
|
43
|
+
*/
|
|
44
|
+
export declare function useClaimWinnings(): import("@tanstack/react-query").UseMutationResult<import("../lib/evmClient").TransactionResult, Error, {
|
|
45
|
+
marketId: bigint;
|
|
46
|
+
}, unknown>;
|
|
47
|
+
/**
|
|
48
|
+
* Hook to claim a refund from a cancelled or abandoned market.
|
|
49
|
+
*
|
|
50
|
+
* @returns TanStack mutation for claiming refunds
|
|
51
|
+
*/
|
|
52
|
+
export declare function useClaimRefund(): import("@tanstack/react-query").UseMutationResult<import("../lib/evmClient").TransactionResult, Error, {
|
|
53
|
+
marketId: bigint;
|
|
54
|
+
}, unknown>;
|
|
55
|
+
/**
|
|
56
|
+
* Hook to read on-chain market data from the smart contract.
|
|
57
|
+
*
|
|
58
|
+
* @param marketId - The market ID to query, or undefined to skip
|
|
59
|
+
* @returns TanStack query result with market state data
|
|
60
|
+
*/
|
|
61
|
+
export declare function useOnChainMarket(marketId: bigint | undefined): import("@tanstack/react-query").UseQueryResult<{
|
|
62
|
+
dealer: `0x${string}`;
|
|
63
|
+
tokenId: bigint;
|
|
64
|
+
category: bigint;
|
|
65
|
+
subCategory: bigint;
|
|
66
|
+
deadline: bigint;
|
|
67
|
+
description: string;
|
|
68
|
+
createdAt: bigint;
|
|
69
|
+
dealerFeeBps: bigint;
|
|
70
|
+
status: number;
|
|
71
|
+
positiveOutcome: boolean;
|
|
72
|
+
oracleId: `0x${string}`;
|
|
73
|
+
conditionData: `0x${string}`;
|
|
74
|
+
} | null, Error>;
|
|
75
|
+
/**
|
|
76
|
+
* Hook to read on-chain prediction data for a specific user and market.
|
|
77
|
+
*
|
|
78
|
+
* @param marketId - The market ID to query, or undefined to skip
|
|
79
|
+
* @param account - The user's wallet address, or undefined to skip
|
|
80
|
+
* @returns TanStack query result with prediction data (amount, percentage, placedAt, claimed)
|
|
81
|
+
*/
|
|
82
|
+
export declare function useOnChainPrediction(marketId: bigint | undefined, account: Address | undefined): import("@tanstack/react-query").UseQueryResult<{
|
|
83
|
+
amount: bigint;
|
|
84
|
+
percentage: bigint;
|
|
85
|
+
placedAt: bigint;
|
|
86
|
+
claimed: boolean;
|
|
87
|
+
} | null, Error>;
|
|
88
|
+
/**
|
|
89
|
+
* Hook to lock a market after its deadline.
|
|
90
|
+
* Calculates market split and enables partial refunds for the overweight side.
|
|
91
|
+
* Anyone can call this after the market deadline.
|
|
92
|
+
*
|
|
93
|
+
* @returns TanStack mutation for locking markets
|
|
94
|
+
*/
|
|
95
|
+
export declare function useLockMarket(): import("@tanstack/react-query").UseMutationResult<import("../lib/evmClient").TransactionResult, Error, {
|
|
96
|
+
marketId: bigint;
|
|
97
|
+
}, unknown>;
|
|
98
|
+
/**
|
|
99
|
+
* Hook to claim a partial refund from a locked market.
|
|
100
|
+
* Available to bettors on the overweight side after market is locked.
|
|
101
|
+
*
|
|
102
|
+
* @returns TanStack mutation for claiming lock refunds
|
|
103
|
+
*/
|
|
104
|
+
export declare function useClaimLockRefund(): import("@tanstack/react-query").UseMutationResult<import("../lib/evmClient").TransactionResult, Error, {
|
|
105
|
+
marketId: bigint;
|
|
106
|
+
}, unknown>;
|
|
107
|
+
/**
|
|
108
|
+
* Hook to read the lock refund amount for the current user on a market.
|
|
109
|
+
*
|
|
110
|
+
* @param marketId - The market ID to query, or undefined to skip
|
|
111
|
+
* @param account - The user's wallet address, or undefined to skip
|
|
112
|
+
* @returns TanStack query result with refund amount
|
|
113
|
+
*/
|
|
114
|
+
export declare function useLockRefundAmount(marketId: bigint | undefined, account: Address | undefined): import("@tanstack/react-query").UseQueryResult<bigint, Error>;
|
|
115
|
+
/**
|
|
116
|
+
* Hook to read the lock split boundaries for a locked market.
|
|
117
|
+
* Returns negativePercentage and positivePercentage which define the under/over boundary.
|
|
118
|
+
*
|
|
119
|
+
* @param marketId - The market ID to query, or undefined to skip
|
|
120
|
+
* @returns TanStack query result with split boundary data
|
|
121
|
+
*/
|
|
122
|
+
export declare function useMarketSplit(marketId: bigint | undefined): import("@tanstack/react-query").UseQueryResult<{
|
|
123
|
+
negativePercentage: bigint;
|
|
124
|
+
positivePercentage: bigint;
|
|
125
|
+
negativeAllowedAmount: bigint;
|
|
126
|
+
positiveAllowedAmount: bigint;
|
|
127
|
+
} | null, Error>;
|
|
128
|
+
/**
|
|
129
|
+
* Hook to read the contract's testMode flag.
|
|
130
|
+
* When true, markets can be locked/resolved without waiting for the deadline.
|
|
131
|
+
*
|
|
132
|
+
* @returns TanStack query result with boolean testMode value
|
|
133
|
+
*/
|
|
134
|
+
export declare function useTestMode(): import("@tanstack/react-query").UseQueryResult<boolean, Error>;
|
|
135
|
+
/**
|
|
136
|
+
* Hook to read the PredictionMarket contract owner address.
|
|
137
|
+
* Used to gate admin-only UI (e.g., Chainlink configuration).
|
|
138
|
+
*
|
|
139
|
+
* @returns TanStack query result with the owner address
|
|
140
|
+
*/
|
|
141
|
+
export declare function useContractOwner(): import("@tanstack/react-query").UseQueryResult<`0x${string}` | null, Error>;
|
|
142
|
+
/**
|
|
143
|
+
* Hook to check whether a Chainlink oracle resolution request is pending
|
|
144
|
+
* for a given market. Reads `pendingResolution(marketId)` from the
|
|
145
|
+
* OracleResolver contract.
|
|
146
|
+
*
|
|
147
|
+
* Polls every 10 seconds while the result is `true` (waiting for callback),
|
|
148
|
+
* and stops polling once it flips to `false`.
|
|
149
|
+
*
|
|
150
|
+
* @param marketId - The on-chain market ID (bigint), or undefined to skip
|
|
151
|
+
* @returns TanStack query result with boolean (true = request in flight)
|
|
152
|
+
*/
|
|
153
|
+
export declare function usePendingResolution(marketId: bigint | undefined): import("@tanstack/react-query").UseQueryResult<boolean, Error>;
|
|
154
|
+
/**
|
|
155
|
+
* Hook to create a new prediction market (dealer only).
|
|
156
|
+
*
|
|
157
|
+
* @returns TanStack mutation for creating markets
|
|
158
|
+
*/
|
|
159
|
+
export declare function useCreateMarket(): import("@tanstack/react-query").UseMutationResult<import("../lib/evmClient").TransactionResult, Error, {
|
|
160
|
+
tokenId: bigint;
|
|
161
|
+
category: bigint;
|
|
162
|
+
subCategory: bigint;
|
|
163
|
+
deadline: bigint;
|
|
164
|
+
description: string;
|
|
165
|
+
oracleId?: Address;
|
|
166
|
+
conditionData?: `0x${string}`;
|
|
167
|
+
}, unknown>;
|
|
168
|
+
/**
|
|
169
|
+
* Hook to resolve a market with a manual resolution value (dealer only).
|
|
170
|
+
*
|
|
171
|
+
* @returns TanStack mutation for resolving markets
|
|
172
|
+
*/
|
|
173
|
+
export declare function useResolveMarket(): import("@tanstack/react-query").UseMutationResult<import("../lib/evmClient").TransactionResult, Error, {
|
|
174
|
+
marketId: bigint;
|
|
175
|
+
positiveOutcome: boolean;
|
|
176
|
+
}, unknown>;
|
|
177
|
+
/**
|
|
178
|
+
* Hook to resolve a market using oracle data (anyone can call after deadline).
|
|
179
|
+
*
|
|
180
|
+
* @returns TanStack mutation for oracle-based resolution
|
|
181
|
+
*/
|
|
182
|
+
export declare function useResolveMarketWithOracle(): import("@tanstack/react-query").UseMutationResult<import("../lib/evmClient").TransactionResult, Error, {
|
|
183
|
+
marketId: bigint;
|
|
184
|
+
}, unknown>;
|
|
185
|
+
/**
|
|
186
|
+
* Hook to request oracle resolution via Chainlink (step 1 of 2).
|
|
187
|
+
* Anyone can call. Sends a Chainlink request to fetch the game result.
|
|
188
|
+
*
|
|
189
|
+
* @returns TanStack mutation for requesting oracle resolution
|
|
190
|
+
*/
|
|
191
|
+
export declare function useRequestOracleResolution(): import("@tanstack/react-query").UseMutationResult<import("../lib/evmClient").TransactionResult, Error, {
|
|
192
|
+
marketId: bigint;
|
|
193
|
+
}, unknown>;
|
|
194
|
+
/**
|
|
195
|
+
* Hook to complete oracle resolution after Chainlink callback (step 2 of 2).
|
|
196
|
+
* Anyone can call after the Chainlink callback has delivered the result.
|
|
197
|
+
*
|
|
198
|
+
* @returns TanStack mutation for completing oracle resolution
|
|
199
|
+
*/
|
|
200
|
+
export declare function useCompleteOracleResolution(): import("@tanstack/react-query").UseMutationResult<import("../lib/evmClient").TransactionResult, Error, {
|
|
201
|
+
marketId: bigint;
|
|
202
|
+
}, unknown>;
|
|
203
|
+
/**
|
|
204
|
+
* Hook to cancel a market (dealer only).
|
|
205
|
+
*
|
|
206
|
+
* @returns TanStack mutation for cancelling markets
|
|
207
|
+
*/
|
|
208
|
+
export declare function useCancelMarket(): import("@tanstack/react-query").UseMutationResult<import("../lib/evmClient").TransactionResult, Error, {
|
|
209
|
+
marketId: bigint;
|
|
210
|
+
}, unknown>;
|
|
211
|
+
/**
|
|
212
|
+
* Hook to withdraw accumulated dealer fees from a resolved market (dealer only).
|
|
213
|
+
*
|
|
214
|
+
* @returns TanStack mutation for withdrawing dealer fees
|
|
215
|
+
*/
|
|
216
|
+
export declare function useWithdrawDealerFees(): import("@tanstack/react-query").UseMutationResult<import("../lib/evmClient").TransactionResult, Error, {
|
|
217
|
+
marketId: bigint;
|
|
218
|
+
}, unknown>;
|
|
219
|
+
//# sourceMappingURL=useMarketContract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMarketContract.d.ts","sourceRoot":"","sources":["../../src/hooks/useMarketContract.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AA8EpC;;;;GAIG;AACH,wBAAgB,YAAY,+BAO3B;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB;cAYlB,MAAM;gBACJ,MAAM;YACV,MAAM;YAiCnB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB;cAYnB,MAAM;mBACD,MAAM;sBACH,MAAM;YAiC7B;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB;cAOY,MAAM;YA8BtD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB;cAOiB,MAAM;YA6BtD;AAED;;;;GAIG;AACH,wBAAgB,cAAc;cAOmB,MAAM;YA4BtD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS;;;;;;;;;;;;;iBAe5D;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,OAAO,EAAE,OAAO,GAAG,SAAS;;;;;iBAgB7B;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa;cAOoB,MAAM;YA6BtD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB;cAOe,MAAM;YA6BtD;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,OAAO,EAAE,OAAO,GAAG,SAAS,iEAgB7B;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS;;;;;iBAe1D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,mEAgB1B;AAaD;;;;;GAKG;AACH,wBAAgB,gBAAgB,gFA0C/B;AAaD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,kEA8BhE;AAED;;;;GAIG;AACH,wBAAgB,eAAe;aAgBhB,MAAM;cACL,MAAM;iBACH,MAAM;cACT,MAAM;iBACH,MAAM;eACR,OAAO;oBACF,KAAK,MAAM,EAAE;YAqClC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB;cAWhB,MAAM;qBACC,OAAO;YA+B7B;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B;cAOO,MAAM;YA6BtD;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B;cAOO,MAAM;YAyBtD;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B;cAOM,MAAM;YA6BtD;AAED;;;;GAIG;AACH,wBAAgB,eAAe;cAOkB,MAAM;YA6BtD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB;cAOY,MAAM;YA4BtD"}
|