player-map 2.0.20 → 2.0.22
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/GraphComponent.d.ts +15 -0
- package/dist/PlayerCreationProgress.d.ts +35 -0
- package/dist/PlayerMap.d.ts +5 -0
- package/dist/PlayerMapGraph.d.ts +25 -0
- package/dist/PlayerMapHome.d.ts +15 -0
- package/dist/abi.d.ts +2630 -0
- package/dist/api/fetchActivityHistory.d.ts +3 -0
- package/dist/api/fetchAtomDetails.d.ts +28 -0
- package/dist/api/fetchClaimsByAccount.d.ts +3 -0
- package/dist/api/fetchClaimsBySubject.d.ts +3 -0
- package/dist/api/fetchFollowsAndFollowers.d.ts +6 -0
- package/dist/api/fetchPlayerAliases.d.ts +47 -0
- package/dist/api/fetchPositions.d.ts +3 -0
- package/dist/api/fetchTriplesByTermIds.d.ts +32 -0
- package/dist/api/fetchTriplesForAgent.d.ts +3 -0
- package/dist/api/sidebarQueries.d.ts +9 -0
- package/dist/components/RightPanel.d.ts +25 -0
- package/dist/components/SafeImage.d.ts +20 -0
- package/dist/components/TopNavBar.d.ts +31 -0
- package/dist/components/graph/ActivityCard.d.ts +7 -0
- package/dist/components/graph/ActivitySection.d.ts +7 -0
- package/dist/components/graph/AtomBubble.d.ts +9 -0
- package/dist/components/graph/AtomClaimsSection.d.ts +9 -0
- package/dist/components/graph/AtomDetailsSection.d.ts +14 -0
- package/dist/components/graph/ClaimDepositControls.d.ts +11 -0
- package/dist/components/graph/ClaimsModal.d.ts +12 -0
- package/dist/components/graph/ClaimsSection.d.ts +11 -0
- package/dist/components/graph/Modal.d.ts +10 -0
- package/dist/components/graph/Pagination.d.ts +11 -0
- package/dist/components/graph/PaginationInfo.d.ts +9 -0
- package/dist/components/graph/PositionBubble.d.ts +10 -0
- package/dist/components/graph/PositionCard.d.ts +12 -0
- package/dist/components/graph/PositionsSection.d.ts +10 -0
- package/dist/components/graph/RedeemAllButton.d.ts +9 -0
- package/dist/components/graph/RedeemConfig.d.ts +13 -0
- package/dist/components/graph/RedeemSelector.d.ts +9 -0
- package/dist/components/graph/SidebarDrawer.d.ts +9 -0
- package/dist/components/graph/TripleBubble.d.ts +12 -0
- package/dist/components/graph/TruncatedText.d.ts +10 -0
- package/dist/components/graph/index.d.ts +18 -0
- package/dist/components/modals/ConnectWalletModal.d.ts +8 -0
- package/dist/components/modals/CreatePlayerModal.d.ts +9 -0
- package/dist/components/modals/index.d.ts +2 -0
- package/dist/components/vote/ClaimItem.d.ts +13 -0
- package/dist/components/vote/ClaimList.d.ts +18 -0
- package/dist/components/vote/ClaimVoting.d.ts +16 -0
- package/dist/components/vote/SpeakUpHeader.d.ts +8 -0
- package/dist/components/vote/SubmitButton.d.ts +11 -0
- package/dist/components/vote/TransactionInfo.d.ts +12 -0
- package/dist/components/vote/TransactionStatus.d.ts +11 -0
- package/dist/components/vote/VotingHeader.d.ts +7 -0
- package/dist/components/vote/VotingModal.d.ts +15 -0
- package/dist/components/vote/voteUtils.d.ts +49 -0
- package/dist/config/atomFiltering.d.ts +17 -0
- package/dist/config/graphql.d.ts +1 -0
- package/dist/config/verifiedAtoms.d.ts +24 -0
- package/dist/contexts/GameContext.d.ts +35 -0
- package/dist/contexts/QueryClientContext.d.ts +9 -0
- package/dist/hooks/useAtomCreation.d.ts +25 -0
- package/dist/hooks/useAtomData.d.ts +11 -0
- package/dist/hooks/useAtomLabel.d.ts +7 -0
- package/dist/hooks/useBatchCreateTriple.d.ts +16 -0
- package/dist/hooks/useCheckSpecificTriplePosition.d.ts +16 -0
- package/dist/hooks/useClaimsBySubject.d.ts +7 -0
- package/dist/hooks/useCreateAlias.d.ts +17 -0
- package/dist/hooks/useDepositTriple.d.ts +18 -0
- package/dist/hooks/useDisplayTriplesWithPosition.d.ts +5 -0
- package/dist/hooks/useFetchTripleDetails.d.ts +36 -0
- package/dist/hooks/useGameStats.d.ts +14 -0
- package/dist/hooks/usePlayerAliases.d.ts +15 -0
- package/dist/hooks/usePositions.d.ts +7 -0
- package/dist/hooks/useRedeemAmounts.d.ts +7 -0
- package/dist/hooks/useRedeemBatch.d.ts +19 -0
- package/dist/hooks/useRedeemExecution.d.ts +15 -0
- package/dist/hooks/useRegisterPlayer.d.ts +40 -0
- package/dist/hooks/useSelectedAtomClaims.d.ts +9 -0
- package/dist/hooks/useSelectedAtomData.d.ts +10 -0
- package/dist/hooks/useSidebarData.d.ts +16 -0
- package/dist/hooks/useSubmitVotes.d.ts +22 -0
- package/dist/hooks/useTripleByCreator.d.ts +54 -0
- package/dist/hooks/useVoteItemsManagement.d.ts +22 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.es.js +14801 -14663
- package/dist/index.umd.js +376 -376
- package/dist/pages/DirectPositionCheck.d.ts +4 -0
- package/dist/providers/QueryProvider.d.ts +7 -0
- package/dist/shared/components/NetworkSwitchMessage.d.ts +8 -0
- package/dist/shared/hooks/useNetworkCheck.d.ts +13 -0
- package/dist/types/PlayerMapConfig.d.ts +18 -0
- package/dist/types/alias.d.ts +39 -0
- package/dist/types/vote.d.ts +28 -0
- package/dist/utils/apiCache.d.ts +40 -0
- package/dist/utils/config.d.ts +7 -0
- package/dist/utils/constants.d.ts +15 -0
- package/dist/utils/conversionUtils.d.ts +13 -0
- package/dist/utils/debugPosition.d.ts +11 -0
- package/dist/utils/globalConstants.d.ts +2 -0
- package/dist/utils/ipfsUtils.d.ts +30 -0
- package/dist/utils/pinata.d.ts +3 -0
- package/dist/utils/voteUtils.d.ts +32 -0
- package/dist/utils/walletUtils.d.ts +24 -0
- package/package.json +3 -3
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { VoteItem, VoteDirection } from '../../types/vote';
|
|
2
|
+
import { Network } from '../../hooks/useAtomData';
|
|
3
|
+
import { TripleDetails } from '../../hooks/useFetchTripleDetails';
|
|
4
|
+
|
|
5
|
+
interface LoadingProgress {
|
|
6
|
+
loaded: number;
|
|
7
|
+
total: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const useVoteFetchTripleDetails: (network?: Network) => {
|
|
10
|
+
fetchTripleDetails: (tripleId: string) => Promise<TripleDetails | null>;
|
|
11
|
+
isLoading: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare const useVoteDisplayTriplesWithPosition: (walletAddress: string) => {
|
|
14
|
+
data: any;
|
|
15
|
+
loading: boolean;
|
|
16
|
+
error: Error | null;
|
|
17
|
+
};
|
|
18
|
+
export declare const useVoteItemsManagementOptimized: ({ network, walletAddress, onError, }: {
|
|
19
|
+
network?: Network;
|
|
20
|
+
walletAddress?: string;
|
|
21
|
+
onError?: (message: string) => void;
|
|
22
|
+
}) => {
|
|
23
|
+
voteItems: VoteItem[];
|
|
24
|
+
setVoteItems: import('react').Dispatch<import('react').SetStateAction<VoteItem[]>>;
|
|
25
|
+
isLoading: boolean;
|
|
26
|
+
isFullyLoaded: boolean;
|
|
27
|
+
loadingProgress: LoadingProgress;
|
|
28
|
+
totalUnits: number;
|
|
29
|
+
numberOfTransactions: number;
|
|
30
|
+
handleChangeUnits: (id: bigint, direction: VoteDirection, units: number) => void;
|
|
31
|
+
resetAllVotes: () => void;
|
|
32
|
+
loadTripleDetails: () => Promise<void>;
|
|
33
|
+
isVoteDirectionAllowed: (tripleId: bigint, direction: VoteDirection) => boolean;
|
|
34
|
+
userPositions: Record<string, VoteDirection>;
|
|
35
|
+
};
|
|
36
|
+
export declare const clearVoteCaches: () => void;
|
|
37
|
+
export declare const getVoteCacheStats: () => {
|
|
38
|
+
tripleCache: {
|
|
39
|
+
size: number;
|
|
40
|
+
maxSize: number;
|
|
41
|
+
ttl: number;
|
|
42
|
+
};
|
|
43
|
+
userPositionsCache: {
|
|
44
|
+
size: number;
|
|
45
|
+
maxSize: number;
|
|
46
|
+
ttl: number;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filtre l'image d'un atome en fonction de son statut de vérification
|
|
3
|
+
* Si l'atome est non-vérifiés, remplace l'image par un carré vert
|
|
4
|
+
*/
|
|
5
|
+
export declare const filterAtomImage: (atom: any) => any;
|
|
6
|
+
/**
|
|
7
|
+
* Filtre les images dans un triple (subject et object)
|
|
8
|
+
*/
|
|
9
|
+
export declare const filterTripleImages: (triple: any) => any;
|
|
10
|
+
/**
|
|
11
|
+
* Filtre les images dans un tableau de triples
|
|
12
|
+
*/
|
|
13
|
+
export declare const filterTriplesImages: (triples: any[]) => any[];
|
|
14
|
+
/**
|
|
15
|
+
* Filtre les images dans un tableau d'atomes
|
|
16
|
+
*/
|
|
17
|
+
export declare const filterAtomsImages: (atoms: any[]) => any[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function initGraphql(): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration des atomes vérifiés par les studios
|
|
3
|
+
* Les atomes dans cette liste affichent l'image avec un badge de vérification
|
|
4
|
+
* Format: { atomId: studioName }
|
|
5
|
+
*/
|
|
6
|
+
export declare const VERIFIED_ATOMS: Record<string, string>;
|
|
7
|
+
/**
|
|
8
|
+
* Configuration des atomes non vérifiés (créés par la communauté)
|
|
9
|
+
* Les atomes dans cette liste n'affichent PAS l'image et affichent un avertissement
|
|
10
|
+
* Format: { atomId: reason }
|
|
11
|
+
*/
|
|
12
|
+
export declare const NOT_VERIFIED_ATOMS: Record<string, string>;
|
|
13
|
+
/**
|
|
14
|
+
* Image de remplacement : carré vert pour les atomes non-vérifiés
|
|
15
|
+
*/
|
|
16
|
+
export declare const GREEN_SQUARE_PLACEHOLDER = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Crect width='100' height='100' fill='%2322c55e'/%3E%3C/svg%3E";
|
|
17
|
+
/**
|
|
18
|
+
* Vérifier le statut de vérification d'un atome
|
|
19
|
+
* Retourne: "verified" | "not-verified" | "normal" (comportement par défaut)
|
|
20
|
+
*/
|
|
21
|
+
export declare const getAtomVerificationStatus: (atomId?: string) => {
|
|
22
|
+
status: "verified" | "not-verified" | "normal";
|
|
23
|
+
studio?: string;
|
|
24
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { GameConfig } from '../types/PlayerMapConfig';
|
|
3
|
+
|
|
4
|
+
export interface ResolvedClaim {
|
|
5
|
+
atomId: string;
|
|
6
|
+
label: string;
|
|
7
|
+
imageUrl?: string;
|
|
8
|
+
category?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ResolvedGuild {
|
|
11
|
+
atomId: string;
|
|
12
|
+
label: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ResolvedGame {
|
|
15
|
+
atomId: string;
|
|
16
|
+
label: string;
|
|
17
|
+
imageUrl?: string;
|
|
18
|
+
claims: ResolvedClaim[];
|
|
19
|
+
guilds: ResolvedGuild[];
|
|
20
|
+
}
|
|
21
|
+
export interface GameContextValue {
|
|
22
|
+
games: ResolvedGame[];
|
|
23
|
+
activeGame: ResolvedGame | null;
|
|
24
|
+
setActiveGameId: (atomId: string) => void;
|
|
25
|
+
isLoading: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface GameContextProviderProps {
|
|
28
|
+
games: GameConfig[];
|
|
29
|
+
activeGameId?: string;
|
|
30
|
+
onGameChange?: (atomId: string) => void;
|
|
31
|
+
children: React.ReactNode;
|
|
32
|
+
}
|
|
33
|
+
export declare const GameContextProvider: React.FC<GameContextProviderProps>;
|
|
34
|
+
export declare function useGameContext(): GameContextValue;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
3
|
+
|
|
4
|
+
interface QueryClientProviderProps {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const PlayerMapQueryClientProvider: React.FC<QueryClientProviderProps>;
|
|
8
|
+
export declare const useQueryClientContext: () => QueryClient;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type IpfsAtomInput = {
|
|
2
|
+
name: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
image?: string | undefined;
|
|
5
|
+
};
|
|
6
|
+
export interface UseAtomCreationProps {
|
|
7
|
+
walletConnected?: any;
|
|
8
|
+
walletAddress?: string;
|
|
9
|
+
publicClient?: any;
|
|
10
|
+
}
|
|
11
|
+
export declare const useAtomCreation: ({ walletConnected, walletAddress, publicClient }: UseAtomCreationProps) => {
|
|
12
|
+
createAtom: (input: IpfsAtomInput) => Promise<{
|
|
13
|
+
atomId: bigint;
|
|
14
|
+
ipfsHash: string;
|
|
15
|
+
}>;
|
|
16
|
+
createStringAtom: (str: string) => Promise<{
|
|
17
|
+
atomId: bigint;
|
|
18
|
+
}>;
|
|
19
|
+
createEthereumAccountAtom: (address: string) => Promise<{
|
|
20
|
+
atomId: bigint;
|
|
21
|
+
}>;
|
|
22
|
+
createConsentAtom: (consentJson: object) => Promise<{
|
|
23
|
+
atomId: bigint;
|
|
24
|
+
}>;
|
|
25
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createServerClient } from '@0xintuition/graphql';
|
|
2
|
+
|
|
3
|
+
export declare enum Network {
|
|
4
|
+
MAINNET = "mainnet",
|
|
5
|
+
TESTNET = "testnet"
|
|
6
|
+
}
|
|
7
|
+
export declare const API_URLS: {
|
|
8
|
+
mainnet: string;
|
|
9
|
+
testnet: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const createClient: (network?: Network) => ReturnType<typeof createServerClient>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Network } from './useAtomData';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Fetches the label of an atom by its ID from the indexer.
|
|
5
|
+
* Used to display dynamic names (e.g. game name) without hardcoding.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useAtomLabel: (atomId: string | undefined, network?: Network, fallback?: string) => string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface TripleToCreate {
|
|
2
|
+
subjectId: bigint;
|
|
3
|
+
predicateId: bigint;
|
|
4
|
+
objectId: bigint;
|
|
5
|
+
}
|
|
6
|
+
interface UseBatchCreateTripleProps {
|
|
7
|
+
walletConnected?: any;
|
|
8
|
+
walletAddress?: string;
|
|
9
|
+
publicClient?: any;
|
|
10
|
+
}
|
|
11
|
+
export declare const useBatchCreateTriple: ({ walletConnected, walletAddress, publicClient }: UseBatchCreateTripleProps) => {
|
|
12
|
+
checkTripleExists: (subjectId: bigint, predicateId: bigint, objectId: bigint) => Promise<boolean>;
|
|
13
|
+
batchCreateTriple: (triples: TripleToCreate[]) => Promise<any>;
|
|
14
|
+
computeTripleId: (subjectId: bigint, predicateId: bigint, objectId: bigint) => Promise<bigint>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Network } from './useAtomData';
|
|
2
|
+
|
|
3
|
+
interface UseCheckSpecificTriplePositionProps {
|
|
4
|
+
walletAddress: string;
|
|
5
|
+
tripleId: string | number;
|
|
6
|
+
network?: Network;
|
|
7
|
+
}
|
|
8
|
+
export declare const useCheckSpecificTriplePosition: ({ walletAddress, tripleId, network }: UseCheckSpecificTriplePositionProps) => {
|
|
9
|
+
hasPosition: boolean;
|
|
10
|
+
isFor: boolean | null;
|
|
11
|
+
loading: boolean;
|
|
12
|
+
error: Error | null;
|
|
13
|
+
termPositionCount: number;
|
|
14
|
+
counterTermPositionCount: number;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AliasCreationStep } from '../types/alias';
|
|
2
|
+
|
|
3
|
+
interface UseCreateAliasProps {
|
|
4
|
+
walletConnected?: any;
|
|
5
|
+
walletAddress?: string;
|
|
6
|
+
publicClient?: any;
|
|
7
|
+
playerAtomId: string | null;
|
|
8
|
+
}
|
|
9
|
+
export declare const useCreateAlias: ({ walletConnected, walletAddress, publicClient, playerAtomId, }: UseCreateAliasProps) => {
|
|
10
|
+
createAlias: (pseudo: string) => Promise<void>;
|
|
11
|
+
reset: () => void;
|
|
12
|
+
step: AliasCreationStep;
|
|
13
|
+
isCreating: boolean;
|
|
14
|
+
error: string | undefined;
|
|
15
|
+
pseudoAtomId: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { VoteDirection, DepositResponse } from '../types/vote';
|
|
2
|
+
import { Network } from './useAtomData';
|
|
3
|
+
|
|
4
|
+
interface UseDepositTripleProps {
|
|
5
|
+
walletConnected?: any;
|
|
6
|
+
walletAddress?: string;
|
|
7
|
+
publicClient?: any;
|
|
8
|
+
network?: Network;
|
|
9
|
+
}
|
|
10
|
+
export declare const useDepositTriple: ({ walletConnected, walletAddress, publicClient, network, }: UseDepositTripleProps) => {
|
|
11
|
+
depositTriple: (votes: Array<{
|
|
12
|
+
claimId: string;
|
|
13
|
+
units: number;
|
|
14
|
+
direction: VoteDirection;
|
|
15
|
+
}>) => Promise<DepositResponse>;
|
|
16
|
+
isLoading: boolean;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Network } from './useAtomData';
|
|
2
|
+
|
|
3
|
+
export interface TripleDetails {
|
|
4
|
+
id: string;
|
|
5
|
+
subject?: {
|
|
6
|
+
term_id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
image?: string;
|
|
9
|
+
};
|
|
10
|
+
predicate?: {
|
|
11
|
+
term_id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
};
|
|
14
|
+
object?: {
|
|
15
|
+
term_id: string;
|
|
16
|
+
label: string;
|
|
17
|
+
};
|
|
18
|
+
term_id?: string;
|
|
19
|
+
term_position_count?: number;
|
|
20
|
+
counter_term_id?: string;
|
|
21
|
+
counter_term_position_count?: number;
|
|
22
|
+
}
|
|
23
|
+
interface UseFetchTripleDetailsProps {
|
|
24
|
+
network?: Network;
|
|
25
|
+
onError?: (message: string) => void;
|
|
26
|
+
}
|
|
27
|
+
export declare const useFetchTripleDetails: ({ network, onError }?: UseFetchTripleDetailsProps) => {
|
|
28
|
+
fetchTripleDetails: (tripleId: string) => Promise<TripleDetails | null>;
|
|
29
|
+
isLoading: boolean;
|
|
30
|
+
};
|
|
31
|
+
export declare const useTripleDetails: (tripleId: string | undefined, network?: Network) => {
|
|
32
|
+
tripleDetails: TripleDetails | null;
|
|
33
|
+
loading: boolean;
|
|
34
|
+
error: Error | null;
|
|
35
|
+
};
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Network } from './useAtomData';
|
|
2
|
+
|
|
3
|
+
export interface GameStats {
|
|
4
|
+
gameName: string;
|
|
5
|
+
gameImage: string | null;
|
|
6
|
+
gameTermId: string | null;
|
|
7
|
+
totalGuilds: number;
|
|
8
|
+
totalPlayers: number;
|
|
9
|
+
totalVotes: number;
|
|
10
|
+
totalAttestations: number;
|
|
11
|
+
loading: boolean;
|
|
12
|
+
error: string | null;
|
|
13
|
+
}
|
|
14
|
+
export declare const useGameStats: (network?: Network) => GameStats;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Network } from './useAtomData';
|
|
2
|
+
import { PlayerAlias } from '../types/alias';
|
|
3
|
+
|
|
4
|
+
interface UsePlayerAliasesProps {
|
|
5
|
+
walletAddress?: string;
|
|
6
|
+
network?: Network;
|
|
7
|
+
}
|
|
8
|
+
export declare const usePlayerAliases: ({ walletAddress, network, }: UsePlayerAliasesProps) => {
|
|
9
|
+
aliases: PlayerAlias[];
|
|
10
|
+
primaryAlias: PlayerAlias | null;
|
|
11
|
+
playerAtomId: string | null;
|
|
12
|
+
isLoading: boolean;
|
|
13
|
+
error: Error | null;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const useRedeemAmounts: () => {
|
|
2
|
+
selectedPositions: Set<string>;
|
|
3
|
+
redeemAmounts: Record<string, number>;
|
|
4
|
+
handlePositionSelect: (positionId: string, selected: boolean) => void;
|
|
5
|
+
handleAmountChange: (positionId: string, amount: number) => void;
|
|
6
|
+
clearSelection: () => void;
|
|
7
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface RedeemBatchParams {
|
|
2
|
+
receiver: `0x${string}`;
|
|
3
|
+
termIds: `0x${string}`[];
|
|
4
|
+
curveIds: bigint[];
|
|
5
|
+
shares: bigint[];
|
|
6
|
+
minAssets: bigint[];
|
|
7
|
+
}
|
|
8
|
+
interface UseRedeemBatchProps {
|
|
9
|
+
walletConnected?: any;
|
|
10
|
+
walletAddress?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const useRedeemBatch: ({ walletConnected, walletAddress, }: UseRedeemBatchProps) => {
|
|
13
|
+
redeemBatch: (params: RedeemBatchParams) => Promise<{
|
|
14
|
+
success: boolean;
|
|
15
|
+
hash: any;
|
|
16
|
+
}>;
|
|
17
|
+
isLoading: boolean;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface UseRedeemExecutionProps {
|
|
2
|
+
walletConnected?: any;
|
|
3
|
+
walletAddress?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const useRedeemExecution: ({ walletConnected, walletAddress }: UseRedeemExecutionProps) => {
|
|
6
|
+
handleRedeemAllSelected: (positions: any[], selectedPositions: Set<string>, redeemAmounts: Record<string, number>, accountId: string) => Promise<{
|
|
7
|
+
success: boolean;
|
|
8
|
+
error?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
success: boolean;
|
|
11
|
+
error: any;
|
|
12
|
+
} | undefined>;
|
|
13
|
+
isLoading: boolean;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Network } from './useAtomData';
|
|
2
|
+
import { IdentityCreationStep } from '../types/alias';
|
|
3
|
+
|
|
4
|
+
interface UseRegisterPlayerProps {
|
|
5
|
+
walletConnected?: any;
|
|
6
|
+
walletAddress?: string;
|
|
7
|
+
publicClient?: any;
|
|
8
|
+
network?: Network;
|
|
9
|
+
guildId?: string;
|
|
10
|
+
existingAccountAtomId?: string;
|
|
11
|
+
existingPseudoAtomId?: string;
|
|
12
|
+
existingAliasTripleId?: string;
|
|
13
|
+
consentAlreadyAccepted?: boolean;
|
|
14
|
+
chainId?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Phase 1 registration hook.
|
|
18
|
+
*
|
|
19
|
+
* Creates the player's identity via up to four sequential on-chain operations:
|
|
20
|
+
* 1. createStringAtom(pseudo) → pseudoAtomId
|
|
21
|
+
* 2. getOrCreate account atom(walletAddress) → accountAtomId
|
|
22
|
+
* 3. createTriple([accountAtom, HAS_ALIAS, pseudoAtom]) → aliasTripleId
|
|
23
|
+
* 4. (if guildId) createTriple([aliasTripleId, IS_MEMBER_OF, guildAtomId])
|
|
24
|
+
*
|
|
25
|
+
* Retry-safe: pseudoAtomId and accountAtomId are preserved in state on error
|
|
26
|
+
* so that a retry call to register(pseudo) skips already-completed steps.
|
|
27
|
+
*
|
|
28
|
+
* Call reset() only to explicitly cancel the flow (clears all preserved IDs).
|
|
29
|
+
*/
|
|
30
|
+
export declare const useRegisterPlayer: ({ walletConnected, walletAddress, publicClient, network, guildId, existingAccountAtomId, existingPseudoAtomId, existingAliasTripleId, consentAlreadyAccepted, chainId, }: UseRegisterPlayerProps) => {
|
|
31
|
+
register: (pseudo: string, imageFile?: File) => Promise<void>;
|
|
32
|
+
reset: () => void;
|
|
33
|
+
step: IdentityCreationStep;
|
|
34
|
+
isRegistering: boolean;
|
|
35
|
+
error: string | undefined;
|
|
36
|
+
pseudoAtomId: string | undefined;
|
|
37
|
+
accountAtomId: string | undefined;
|
|
38
|
+
aliasTripleId: string | undefined;
|
|
39
|
+
};
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Network } from './useAtomData';
|
|
2
|
+
import { AtomDetails } from '../api/fetchAtomDetails';
|
|
3
|
+
|
|
4
|
+
interface SelectedAtomData {
|
|
5
|
+
atomDetails: AtomDetails | null;
|
|
6
|
+
loading: boolean;
|
|
7
|
+
error: string | null;
|
|
8
|
+
}
|
|
9
|
+
export declare const useSelectedAtomData: (selectedNode: any, network?: Network) => SelectedAtomData;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Network } from './useAtomData';
|
|
2
|
+
|
|
3
|
+
interface SidebarData {
|
|
4
|
+
atomDetails: any | null;
|
|
5
|
+
triples: any[];
|
|
6
|
+
positions: any[];
|
|
7
|
+
activities: any[];
|
|
8
|
+
connections: {
|
|
9
|
+
follows: any[];
|
|
10
|
+
followers: any[];
|
|
11
|
+
};
|
|
12
|
+
loading: boolean;
|
|
13
|
+
error: string | null;
|
|
14
|
+
}
|
|
15
|
+
export declare const useSidebarData: (walletAddress: string | undefined, network?: Network) => SidebarData;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { VoteItem, DepositResponse } from '../types/vote';
|
|
2
|
+
import { Network } from './useAtomData';
|
|
3
|
+
|
|
4
|
+
type TransactionStatus = {
|
|
5
|
+
status: "idle" | "pending" | "success" | "error" | "approval_pending" | "whitelist_error";
|
|
6
|
+
message: string;
|
|
7
|
+
};
|
|
8
|
+
interface UseSubmitVotesProps {
|
|
9
|
+
walletConnected?: any;
|
|
10
|
+
walletAddress?: string;
|
|
11
|
+
publicClient?: any;
|
|
12
|
+
network?: Network;
|
|
13
|
+
onSuccess?: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const useSubmitVotes: ({ walletConnected, walletAddress, publicClient, network, onSuccess }: UseSubmitVotesProps) => {
|
|
16
|
+
submitVotes: (voteItems: VoteItem[]) => Promise<DepositResponse | null>;
|
|
17
|
+
isSubmitting: boolean;
|
|
18
|
+
isDepositLoading: boolean;
|
|
19
|
+
transactionStatus: TransactionStatus;
|
|
20
|
+
setTransactionStatus: import('react').Dispatch<import('react').SetStateAction<TransactionStatus>>;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Network } from './useAtomData';
|
|
2
|
+
|
|
3
|
+
export interface Triple {
|
|
4
|
+
term_id: string;
|
|
5
|
+
subject_id: string;
|
|
6
|
+
predicate_id: string;
|
|
7
|
+
object_id: string;
|
|
8
|
+
subject: {
|
|
9
|
+
term_id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
type: string;
|
|
12
|
+
creator_id: string;
|
|
13
|
+
image?: string;
|
|
14
|
+
value?: {
|
|
15
|
+
person?: {
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
organization?: {
|
|
19
|
+
description: string;
|
|
20
|
+
};
|
|
21
|
+
thing?: {
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
book?: {
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
predicate: {
|
|
30
|
+
term_id: string;
|
|
31
|
+
label: string;
|
|
32
|
+
type: string;
|
|
33
|
+
};
|
|
34
|
+
object: {
|
|
35
|
+
term_id: string;
|
|
36
|
+
label: string;
|
|
37
|
+
type: string;
|
|
38
|
+
};
|
|
39
|
+
block_number: number;
|
|
40
|
+
created_at: string;
|
|
41
|
+
transaction_hash: string;
|
|
42
|
+
}
|
|
43
|
+
export interface TriplesByCreatorResponse {
|
|
44
|
+
triples: Triple[];
|
|
45
|
+
}
|
|
46
|
+
export declare const fetchTriplesByCreator: (creatorId: string, predicateId: string, objectId: string, network?: Network) => Promise<TriplesByCreatorResponse>;
|
|
47
|
+
export declare const useTripleByCreator: (creatorId: string, predicateId?: string, objectId?: string, network?: Network) => {
|
|
48
|
+
loading: boolean;
|
|
49
|
+
error: Error | null;
|
|
50
|
+
triples: Triple[];
|
|
51
|
+
network: Network;
|
|
52
|
+
rawData: TriplesByCreatorResponse | undefined;
|
|
53
|
+
};
|
|
54
|
+
export default useTripleByCreator;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { VoteItem, VoteDirection } from '../types/vote';
|
|
2
|
+
import { Network } from './useAtomData';
|
|
3
|
+
|
|
4
|
+
interface UseVoteItemsManagementProps {
|
|
5
|
+
network?: Network;
|
|
6
|
+
walletAddress?: string;
|
|
7
|
+
onError?: (message: string) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const useVoteItemsManagement: ({ network, walletAddress, onError, }: UseVoteItemsManagementProps) => {
|
|
10
|
+
voteItems: VoteItem[];
|
|
11
|
+
setVoteItems: import('react').Dispatch<import('react').SetStateAction<VoteItem[]>>;
|
|
12
|
+
isLoading: boolean;
|
|
13
|
+
totalUnits: number;
|
|
14
|
+
numberOfTransactions: number;
|
|
15
|
+
handleChangeUnits: (id: bigint, direction: VoteDirection, units: number) => void;
|
|
16
|
+
resetAllVotes: () => void;
|
|
17
|
+
refreshPositions: () => void;
|
|
18
|
+
loadTripleDetails: (currentUserPositions?: Record<string, VoteDirection>) => Promise<void>;
|
|
19
|
+
isVoteDirectionAllowed: (tripleId: bigint, direction: VoteDirection) => boolean;
|
|
20
|
+
userPositions: Record<string, VoteDirection>;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { default as PlayerMapHome } from './PlayerMapHome';
|
|
2
|
+
import { default as PlayerMapGraph } from './PlayerMapGraph';
|
|
3
|
+
import { default as GraphComponent } from './GraphComponent';
|
|
4
|
+
import { ClaimVoting } from './components/vote/ClaimVoting';
|
|
5
|
+
import { default as VotingModal } from './components/vote/VotingModal';
|
|
6
|
+
import { useDepositTriple } from './hooks/useDepositTriple';
|
|
7
|
+
import { useCheckSpecificTriplePosition } from './hooks/useCheckSpecificTriplePosition';
|
|
8
|
+
import { useDisplayTriplesWithPosition } from './hooks/useDisplayTriplesWithPosition';
|
|
9
|
+
import { usePositions } from './hooks/usePositions';
|
|
10
|
+
import { useClaimsBySubject } from './hooks/useClaimsBySubject';
|
|
11
|
+
import { checkTriplePosition } from './utils/debugPosition';
|
|
12
|
+
import { setPinataConstants } from './utils/globalConstants';
|
|
13
|
+
|
|
14
|
+
export interface PlayerMapConfigType {
|
|
15
|
+
apiUrl: string;
|
|
16
|
+
}
|
|
17
|
+
export { PlayerMapHome, PlayerMapGraph, GraphComponent, ClaimVoting, VotingModal, useDepositTriple, useCheckSpecificTriplePosition, useDisplayTriplesWithPosition, usePositions, useClaimsBySubject, checkTriplePosition, };
|
|
18
|
+
export { VoteDirection, type Claim, type VoteItem, type DepositResponse } from './types/vote';
|
|
19
|
+
export { UNIT_VALUE, PREDICATES } from './utils/constants';
|
|
20
|
+
export declare const PlayerMapConfig: {
|
|
21
|
+
/**
|
|
22
|
+
* Initialise la configuration de la bibliothèque Player-map
|
|
23
|
+
* @param config Configuration contenant l'URL de l'API (obligatoire)
|
|
24
|
+
*/
|
|
25
|
+
init: (config: PlayerMapConfigType) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Récupère la configuration actuelle
|
|
28
|
+
* @throws Error si la configuration n'a pas été initialisée
|
|
29
|
+
*/
|
|
30
|
+
get: () => Readonly<import('./utils/config').IPlayerMapConfig>;
|
|
31
|
+
};
|
|
32
|
+
export { setPinataConstants };
|
|
33
|
+
export { usePlayerAliases } from './hooks/usePlayerAliases';
|
|
34
|
+
export { useCreateAlias } from './hooks/useCreateAlias';
|
|
35
|
+
export { useRegisterPlayer } from './hooks/useRegisterPlayer';
|
|
36
|
+
export type { PlayerAlias, AliasCreationStep, RegistrationPhase, IdentityCreationStep, InitItem } from './types/alias';
|
|
37
|
+
export { default as PlayerMap } from './PlayerMap';
|
|
38
|
+
export { GameContextProvider, useGameContext } from './contexts/GameContext';
|
|
39
|
+
export type { ResolvedGame, ResolvedClaim, ResolvedGuild, GameContextValue } from './contexts/GameContext';
|
|
40
|
+
export type { GameConfig, ClaimConfig, GuildConfig, PlayerMapProps } from './types/PlayerMapConfig';
|
|
41
|
+
export default PlayerMapHome;
|