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,8 @@
|
|
|
1
|
+
interface NetworkSwitchMessageProps {
|
|
2
|
+
currentChainId: number | null;
|
|
3
|
+
targetChainId: number;
|
|
4
|
+
allowedChainIds?: number[];
|
|
5
|
+
onSwitchNetwork?: () => Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare const NetworkSwitchMessage: ({ currentChainId, targetChainId, allowedChainIds, onSwitchNetwork }: NetworkSwitchMessageProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface UseNetworkCheckProps {
|
|
2
|
+
walletConnected?: any;
|
|
3
|
+
publicClient?: any;
|
|
4
|
+
}
|
|
5
|
+
interface NetworkCheckResult {
|
|
6
|
+
isCorrectNetwork: boolean;
|
|
7
|
+
currentChainId: number | null;
|
|
8
|
+
targetChainId: number;
|
|
9
|
+
allowedChainIds: number[];
|
|
10
|
+
switchNetwork: () => Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export declare const useNetworkCheck: ({ walletConnected, publicClient }: UseNetworkCheckProps) => NetworkCheckResult;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface ClaimConfig {
|
|
2
|
+
atomId: string;
|
|
3
|
+
category?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface GuildConfig {
|
|
6
|
+
atomId: string;
|
|
7
|
+
}
|
|
8
|
+
export interface GameConfig {
|
|
9
|
+
atomId: string;
|
|
10
|
+
claims: ClaimConfig[];
|
|
11
|
+
guilds?: GuildConfig[];
|
|
12
|
+
}
|
|
13
|
+
export interface PlayerMapProps {
|
|
14
|
+
games: GameConfig[];
|
|
15
|
+
activeGameId?: string;
|
|
16
|
+
onGameChange?: (atomId: string) => void;
|
|
17
|
+
initialProfile?: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface PlayerAlias {
|
|
2
|
+
tripleId: string;
|
|
3
|
+
pseudo: string;
|
|
4
|
+
atomId: string;
|
|
5
|
+
image?: string;
|
|
6
|
+
userPosition: bigint;
|
|
7
|
+
isPrimary: boolean;
|
|
8
|
+
}
|
|
9
|
+
export type AliasCreationStep = 'idle' | 'creating-pseudo-atom' | 'creating-triple' | 'success' | 'error';
|
|
10
|
+
export interface AliasCreationState {
|
|
11
|
+
step: AliasCreationStep;
|
|
12
|
+
error?: string;
|
|
13
|
+
pseudoAtomId?: string;
|
|
14
|
+
tripleId?: string;
|
|
15
|
+
}
|
|
16
|
+
export type RegistrationPhase = 'input' | 'creating-identity' | 'loading-existing' | 'ready-to-initialize' | 'creating-claims' | 'complete' | 'error';
|
|
17
|
+
export type IdentityCreationStep = 'idle' | 'signing-consent' | 'creating-consent-atom' | 'creating-pseudo-atom' | 'fetching-account-atom' | 'creating-account-atom' | 'creating-alias-triple' | 'creating-accepted-triple' | 'creating-guild-membership' | 'success' | 'error';
|
|
18
|
+
export interface IdentityCreationState {
|
|
19
|
+
step: IdentityCreationStep;
|
|
20
|
+
error?: string;
|
|
21
|
+
pseudoAtomId?: string;
|
|
22
|
+
accountAtomId?: string;
|
|
23
|
+
aliasTripleId?: string;
|
|
24
|
+
signature?: string;
|
|
25
|
+
consentAtomId?: string;
|
|
26
|
+
_consentMessage?: Record<string, string>;
|
|
27
|
+
}
|
|
28
|
+
export interface InitItem {
|
|
29
|
+
id: string;
|
|
30
|
+
type: 'atom' | 'triple' | 'nested-triple';
|
|
31
|
+
label: string;
|
|
32
|
+
description: string;
|
|
33
|
+
status: 'existing' | 'to-create' | 'creating' | 'created' | 'error';
|
|
34
|
+
subjectId?: string;
|
|
35
|
+
predicateId?: string;
|
|
36
|
+
objectId?: string;
|
|
37
|
+
resultTripleId?: string;
|
|
38
|
+
image?: string;
|
|
39
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare enum VoteDirection {
|
|
2
|
+
For = "FOR",
|
|
3
|
+
Against = "AGAINST",
|
|
4
|
+
None = "NONE"
|
|
5
|
+
}
|
|
6
|
+
export interface Claim {
|
|
7
|
+
id: bigint;
|
|
8
|
+
subject: string;
|
|
9
|
+
predicate: string;
|
|
10
|
+
object: string;
|
|
11
|
+
}
|
|
12
|
+
export interface VoteItem extends Claim {
|
|
13
|
+
units: number;
|
|
14
|
+
direction: VoteDirection;
|
|
15
|
+
term_id?: string;
|
|
16
|
+
term_position_count?: number;
|
|
17
|
+
counter_term_id?: string;
|
|
18
|
+
counter_term_position_count?: number;
|
|
19
|
+
userHasPosition?: boolean;
|
|
20
|
+
userPositionDirection?: VoteDirection;
|
|
21
|
+
subject_image?: string | null;
|
|
22
|
+
object_image?: string | null;
|
|
23
|
+
}
|
|
24
|
+
export interface DepositResponse {
|
|
25
|
+
success: boolean;
|
|
26
|
+
hash?: string;
|
|
27
|
+
error?: string;
|
|
28
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple cache système pour éviter les requêtes API répétées
|
|
3
|
+
* et prévenir les erreurs 429 (Too Many Requests)
|
|
4
|
+
*/
|
|
5
|
+
declare class APICache {
|
|
6
|
+
private cache;
|
|
7
|
+
private pendingRequests;
|
|
8
|
+
private readonly defaultTTL;
|
|
9
|
+
/**
|
|
10
|
+
* Génère une clé de cache à partir d'une URL et de variables
|
|
11
|
+
*/
|
|
12
|
+
private generateKey;
|
|
13
|
+
/**
|
|
14
|
+
* Vérifie si une entrée du cache est encore valide
|
|
15
|
+
*/
|
|
16
|
+
private isValid;
|
|
17
|
+
/**
|
|
18
|
+
* Récupère des données du cache si elles existent et sont valides
|
|
19
|
+
*/
|
|
20
|
+
get<T>(url: string, variables?: any, ttl?: number): T | null;
|
|
21
|
+
/**
|
|
22
|
+
* Stocke des données dans le cache
|
|
23
|
+
*/
|
|
24
|
+
set<T>(url: string, variables: any, data: T): void;
|
|
25
|
+
/**
|
|
26
|
+
* Décore une fonction de requête avec du cache et une déduplication
|
|
27
|
+
* Si plusieurs appels identiques sont faits simultanément, ils partagent la même promesse
|
|
28
|
+
*/
|
|
29
|
+
withCache<T>(url: string, variables: any, fetcher: () => Promise<T>, ttl?: number): Promise<T>;
|
|
30
|
+
/**
|
|
31
|
+
* Vide le cache
|
|
32
|
+
*/
|
|
33
|
+
clear(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Vide les entrées expirées du cache
|
|
36
|
+
*/
|
|
37
|
+
cleanup(ttl?: number): void;
|
|
38
|
+
}
|
|
39
|
+
export declare const apiCache: APICache;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Protocol-level Intuition predicate IDs — universal, never game-specific.
|
|
3
|
+
* These are the only IDs that belong in the package.
|
|
4
|
+
*/
|
|
5
|
+
export declare const PREDICATES: {
|
|
6
|
+
readonly HAS_ALIAS: "0x90b0a11a334ba1a7c3613ed8ea007f1f41b274892f0f05cc0b24d3ab34042d3c";
|
|
7
|
+
readonly IS_PLAYER_OF: "0x6bd2557fa101349b1adab869c7f14bdcb5dce3ae0bc722bee3ae183a544faa81";
|
|
8
|
+
readonly IS: "0xdd4320a03fcd85ed6ac29f3171208f05418324d6943f1fac5d3c23cc1ce10eb3";
|
|
9
|
+
readonly IS_MEMBER_OF: "0xe489948c4bd4fa6f50f402434996b90942ab67585a71c71d81dff8e624f661d4";
|
|
10
|
+
readonly IN: "0xb0d3de9abeebc79e74504814f69d38eae809410c9759678855f79d1b4c7405cb";
|
|
11
|
+
readonly ACCEPTED: "0x69b32b0ec575de94fea50d8ed84f198d46ab1590b6ec10d6527a1cc93c2c2dc1";
|
|
12
|
+
readonly FOLLOWS: "0x8f9b5dc2e7b8bd12f6762c839830672f1d13c08e72b5f09f194cafc153f2df8a";
|
|
13
|
+
readonly CREATED_BY: "0xf08c4615f44c4700519ec874b6d72e4bd990beea9fc301325c91b650784ee971";
|
|
14
|
+
};
|
|
15
|
+
export declare const UNIT_VALUE = 10000000000000000n;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert shares to TTRUST percentage based on total market cap
|
|
3
|
+
* @param shares - Number of shares
|
|
4
|
+
* @param totalMarketCap - Total market cap
|
|
5
|
+
* @returns Formatted percentage string
|
|
6
|
+
*/
|
|
7
|
+
export declare const convertSharesToTTRUST: (shares: number, totalMarketCap: number) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Format large numbers with appropriate units
|
|
10
|
+
* @param value - Numeric value to format
|
|
11
|
+
* @returns Formatted string
|
|
12
|
+
*/
|
|
13
|
+
export declare const formatLargeNumber: (value: number) => string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Network } from '../hooks/useAtomData';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Function to directly check a user's position on a specific triple
|
|
5
|
+
* This can be helpful for debugging position-related issues
|
|
6
|
+
*/
|
|
7
|
+
export declare const checkTriplePosition: (walletAddress: string, tripleId: string | number, network?: Network) => Promise<{
|
|
8
|
+
hasPosition: boolean;
|
|
9
|
+
isFor: boolean | null;
|
|
10
|
+
result: any;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilitaires pour gérer les URLs IPFS dans l'application
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Upload et hash des données JSON vers IPFS
|
|
6
|
+
*/
|
|
7
|
+
export declare const hashDataToIPFS: (data: any) => Promise<{
|
|
8
|
+
ipfsHash: string;
|
|
9
|
+
httpUrl: string;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* Convertit récursivement toutes les URLs IPFS dans un objet en URLs HTTP
|
|
13
|
+
* Utilisé principalement pour les données du graphique
|
|
14
|
+
*/
|
|
15
|
+
export declare const convertIpfsUrlsInObject: (obj: any) => any;
|
|
16
|
+
/**
|
|
17
|
+
* Convertit toutes les URLs IPFS dans les données du graphique
|
|
18
|
+
* Applique la conversion aux nodes et links
|
|
19
|
+
*/
|
|
20
|
+
export declare const convertGraphDataIpfsUrls: (graphData: any) => any;
|
|
21
|
+
/**
|
|
22
|
+
* Convertit une URL IPFS unique en URL HTTP
|
|
23
|
+
* Retourne l'URL inchangée si ce n'est pas une URL IPFS
|
|
24
|
+
*/
|
|
25
|
+
export declare const ensureHttpUrl: (url: string | undefined) => string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Précharge une image via une gateway IPFS pour l'optimisation
|
|
28
|
+
*/
|
|
29
|
+
export declare const preloadIpfsImage: (ipfsUrl: string) => Promise<string>;
|
|
30
|
+
export { isIpfsUrl, ipfsToHttpUrl, uploadToPinata } from './pinata';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { VoteItem } from '../types/vote';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Calculates the total number of transactions needed for the current vote selection
|
|
5
|
+
* @param voteItems Array of vote items
|
|
6
|
+
* @returns Number of transactions
|
|
7
|
+
*/
|
|
8
|
+
export declare const calculateNumberOfTransactions: (voteItems: VoteItem[]) => number;
|
|
9
|
+
/**
|
|
10
|
+
* Calculates the total units selected across all vote items
|
|
11
|
+
* @param voteItems Array of vote items
|
|
12
|
+
* @returns Total units
|
|
13
|
+
*/
|
|
14
|
+
export declare const calculateTotalUnits: (voteItems: VoteItem[]) => number;
|
|
15
|
+
/**
|
|
16
|
+
* Calculates the total ETH cost based on number of units
|
|
17
|
+
* @param units Number of units
|
|
18
|
+
* @returns Total ETH cost as a string with 3 decimal places
|
|
19
|
+
*/
|
|
20
|
+
export declare const calculateEthCost: (units: number) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Calculates the estimated gas cost for a set of transactions
|
|
23
|
+
* @param transactionCount Number of transactions
|
|
24
|
+
* @returns Estimated gas cost as a string with 4 decimal places
|
|
25
|
+
*/
|
|
26
|
+
export declare const calculateGasCost: (transactionCount: number) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Reset all vote items to zero units and no direction
|
|
29
|
+
* @param voteItems Array of vote items
|
|
30
|
+
* @returns New array with reset vote items
|
|
31
|
+
*/
|
|
32
|
+
export declare const resetVoteItems: (voteItems: VoteItem[]) => VoteItem[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified contract write helper.
|
|
3
|
+
*
|
|
4
|
+
* Supports three calling conventions:
|
|
5
|
+
* 1. viem WalletClient — walletConnected.writeContract(params)
|
|
6
|
+
* 2. viem WalletClient fallback — walletConnected.sendTransaction({ to, data, value, gas })
|
|
7
|
+
* 3. wagmi v2 Config — writeContract(config, params) from @wagmi/core
|
|
8
|
+
*
|
|
9
|
+
* Returns the transaction hash as a string.
|
|
10
|
+
*/
|
|
11
|
+
export declare function contractWrite(walletConnected: any, params: {
|
|
12
|
+
address: `0x${string}`;
|
|
13
|
+
abi: any;
|
|
14
|
+
functionName: string;
|
|
15
|
+
args: any[];
|
|
16
|
+
value?: bigint;
|
|
17
|
+
gas?: bigint;
|
|
18
|
+
}): Promise<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Wait for a transaction receipt.
|
|
21
|
+
*
|
|
22
|
+
* Tries: publicClient → walletConnected → @wagmi/core → legacy ethers.js txHash.wait()
|
|
23
|
+
*/
|
|
24
|
+
export declare function waitForReceipt(txHash: any, walletConnected: any, publicClient: any): Promise<any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "player-map",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.umd.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@0xintuition/graphql": "^2.0.2",
|
|
26
26
|
"@0xintuition/sdk": "^2.0.2",
|
|
27
27
|
"@tanstack/react-query": "^5.87.1",
|
|
28
|
-
"axios": "
|
|
29
|
-
"playermap_graph": "0.2.
|
|
28
|
+
"axios": "1.15.0",
|
|
29
|
+
"playermap_graph": "0.2.9",
|
|
30
30
|
"react-icons": "^5.5.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|