player-map 1.0.5 → 1.0.7
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/README.md +2 -45
- package/dist/index.es.js +55883 -52994
- package/dist/index.umd.js +1353 -806
- package/dist/types/GraphComponent.d.ts +3 -1
- package/dist/types/PlayerCreationProgress.d.ts +27 -0
- package/dist/types/PlayerMapHome.d.ts +1 -0
- package/dist/types/abi.d.ts +2 -1
- package/dist/types/hooks/useAtomCreation.d.ts +3 -2
- package/dist/types/hooks/useAtomData.d.ts +0 -50
- package/dist/types/hooks/useBatchCreateTriple.d.ts +16 -0
- package/dist/types/hooks/useTripleByCreator.d.ts +39 -0
- package/dist/types/index.d.ts +9 -1
- package/dist/types/services/playerCreationService.d.ts +14 -0
- package/dist/types/utils/constants.d.ts +33 -0
- package/package.json +2 -2
- package/dist/types/hooks/useMainnetAtomData.d.ts +0 -20
- package/dist/types/hooks/useTestnetAtomData.d.ts +0 -20
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
|
|
3
3
|
interface GraphComponentProps {
|
|
4
|
-
walletConnected?:
|
|
4
|
+
walletConnected?: boolean;
|
|
5
5
|
walletAddress?: string;
|
|
6
6
|
wagmiConfig?: any;
|
|
7
7
|
walletHooks?: any;
|
|
8
8
|
isOpen?: boolean;
|
|
9
9
|
onClose?: () => void;
|
|
10
|
+
onCreatePlayer?: () => void;
|
|
11
|
+
onConnectWallet?: () => void;
|
|
10
12
|
}
|
|
11
13
|
declare const GraphComponent: React.FC<GraphComponentProps>;
|
|
12
14
|
export default GraphComponent;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
interface PlayerCreationProgressProps {
|
|
4
|
+
step: number;
|
|
5
|
+
isCreatingAtom: boolean;
|
|
6
|
+
isCreatingTriples: boolean;
|
|
7
|
+
creationSuccess: boolean;
|
|
8
|
+
atomId: string | null;
|
|
9
|
+
tripleCreated: boolean;
|
|
10
|
+
walletAddress?: string;
|
|
11
|
+
hasExistingAtom: boolean;
|
|
12
|
+
formData: {
|
|
13
|
+
pseudo: string;
|
|
14
|
+
userId: string;
|
|
15
|
+
image: string;
|
|
16
|
+
guildId?: string;
|
|
17
|
+
};
|
|
18
|
+
handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
19
|
+
handleSelectChange: (e: React.ChangeEvent<HTMLSelectElement>) => void;
|
|
20
|
+
handleFileUpload: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
21
|
+
handleSubmit: () => void;
|
|
22
|
+
isLoading: boolean;
|
|
23
|
+
isUploading: boolean;
|
|
24
|
+
fileInputRef: React.RefObject<HTMLInputElement>;
|
|
25
|
+
}
|
|
26
|
+
declare const PlayerCreationProgress: React.FC<PlayerCreationProgressProps>;
|
|
27
|
+
export default PlayerCreationProgress;
|
package/dist/types/abi.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const ATOM_CONTRACT_ADDRESS: string;
|
|
2
|
-
export declare const VALUE_PER_ATOM: bigint;
|
|
3
2
|
export declare const ATOM_CONTRACT_CHAIN_ID: number;
|
|
3
|
+
export declare const VALUE_PER_ATOM: bigint;
|
|
4
|
+
export declare const VALUE_PER_TRIPLE: bigint;
|
|
4
5
|
export declare const atomABI: ({
|
|
5
6
|
type: string;
|
|
6
7
|
name: string;
|
|
@@ -8,13 +8,14 @@ export type IpfsAtom = {
|
|
|
8
8
|
export type IpfsAtomInput = {
|
|
9
9
|
name: string;
|
|
10
10
|
description?: string;
|
|
11
|
-
image?: string;
|
|
11
|
+
image?: string | undefined;
|
|
12
12
|
};
|
|
13
13
|
export interface UseAtomCreationProps {
|
|
14
14
|
walletConnected?: any;
|
|
15
15
|
walletAddress?: string;
|
|
16
|
+
publicClient?: any;
|
|
16
17
|
}
|
|
17
|
-
export declare const useAtomCreation: ({ walletConnected, walletAddress }: UseAtomCreationProps) => {
|
|
18
|
+
export declare const useAtomCreation: ({ walletConnected, walletAddress, publicClient }: UseAtomCreationProps) => {
|
|
18
19
|
createAtom: (input: IpfsAtomInput) => Promise<{
|
|
19
20
|
atomId: bigint;
|
|
20
21
|
ipfsHash: string;
|
|
@@ -1,27 +1,5 @@
|
|
|
1
1
|
import { createServerClient } from '@0xintuition/graphql';
|
|
2
2
|
|
|
3
|
-
export interface AtomData {
|
|
4
|
-
id: number;
|
|
5
|
-
label: string;
|
|
6
|
-
type: string;
|
|
7
|
-
data: string | null;
|
|
8
|
-
emoji: string | null;
|
|
9
|
-
image: string | null;
|
|
10
|
-
creator_id: string;
|
|
11
|
-
creator: {
|
|
12
|
-
id: string;
|
|
13
|
-
label: string;
|
|
14
|
-
};
|
|
15
|
-
value: {
|
|
16
|
-
id: number;
|
|
17
|
-
} | null;
|
|
18
|
-
block_number: number;
|
|
19
|
-
block_timestamp: string;
|
|
20
|
-
transaction_hash: string;
|
|
21
|
-
}
|
|
22
|
-
export interface AtomResponse {
|
|
23
|
-
atom: AtomData;
|
|
24
|
-
}
|
|
25
3
|
export declare enum Network {
|
|
26
4
|
MAINNET = "mainnet",
|
|
27
5
|
TESTNET = "testnet"
|
|
@@ -31,31 +9,3 @@ export declare const API_URLS: {
|
|
|
31
9
|
testnet: string;
|
|
32
10
|
};
|
|
33
11
|
export declare const createClient: (network?: Network) => ReturnType<typeof createServerClient>;
|
|
34
|
-
export declare const fetchAtomById: (id: number, network?: Network) => Promise<AtomResponse>;
|
|
35
|
-
export declare const fetchAtomByLabel: (label: string, network?: Network) => Promise<{
|
|
36
|
-
atoms: AtomData[];
|
|
37
|
-
}>;
|
|
38
|
-
export interface AtomByIdHook {
|
|
39
|
-
data: AtomResponse | null;
|
|
40
|
-
loading: boolean;
|
|
41
|
-
error: string | null;
|
|
42
|
-
network: Network;
|
|
43
|
-
}
|
|
44
|
-
export interface AtomByLabelHook {
|
|
45
|
-
data: AtomData | null;
|
|
46
|
-
loading: boolean;
|
|
47
|
-
error: string | null;
|
|
48
|
-
network: Network;
|
|
49
|
-
}
|
|
50
|
-
export { useMainnetAtomById, useMainnetAtomByLabel } from './useMainnetAtomData';
|
|
51
|
-
export { useTestnetAtomById, useTestnetAtomByLabel } from './useTestnetAtomData';
|
|
52
|
-
export declare const useAtomById: (id: number, network?: Network) => {
|
|
53
|
-
data: AtomResponse | null;
|
|
54
|
-
loading: boolean;
|
|
55
|
-
error: string | null;
|
|
56
|
-
};
|
|
57
|
-
export declare const useAtomByLabel: (label: string, network?: Network) => {
|
|
58
|
-
data: AtomData | null;
|
|
59
|
-
loading: boolean;
|
|
60
|
-
error: string | null;
|
|
61
|
-
};
|
|
@@ -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
|
+
createPlayerTriples: (playerAtomId: bigint) => Promise<any>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Network } from './useAtomData';
|
|
2
|
+
|
|
3
|
+
export interface Triple {
|
|
4
|
+
id: string;
|
|
5
|
+
subject_id: string;
|
|
6
|
+
predicate_id: string;
|
|
7
|
+
object_id: string;
|
|
8
|
+
subject: {
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
type: string;
|
|
12
|
+
creator_id: string;
|
|
13
|
+
};
|
|
14
|
+
predicate: {
|
|
15
|
+
id: string;
|
|
16
|
+
label: string;
|
|
17
|
+
type: string;
|
|
18
|
+
};
|
|
19
|
+
object: {
|
|
20
|
+
id: string;
|
|
21
|
+
label: string;
|
|
22
|
+
type: string;
|
|
23
|
+
};
|
|
24
|
+
block_number: number;
|
|
25
|
+
block_timestamp: string;
|
|
26
|
+
transaction_hash: string;
|
|
27
|
+
}
|
|
28
|
+
export interface TriplesByCreatorResponse {
|
|
29
|
+
triples: Triple[];
|
|
30
|
+
}
|
|
31
|
+
export declare const fetchTriplesByCreator: (creatorId: string, predicateId?: number, objectId?: number, network?: Network) => Promise<TriplesByCreatorResponse>;
|
|
32
|
+
export declare const useTripleByCreator: (creatorId: string, predicateId?: number, objectId?: number, network?: Network) => {
|
|
33
|
+
loading: boolean;
|
|
34
|
+
error: Error | null;
|
|
35
|
+
triples: Triple[];
|
|
36
|
+
network: Network;
|
|
37
|
+
rawData: TriplesByCreatorResponse | null;
|
|
38
|
+
};
|
|
39
|
+
export default useTripleByCreator;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,11 +2,19 @@ import { default as PlayerMapHome } from './PlayerMapHome';
|
|
|
2
2
|
import { default as RegistrationForm } from './RegistrationForm';
|
|
3
3
|
import { default as PlayerMapGraph } from './PlayerMapGraph';
|
|
4
4
|
import { default as GraphComponent } from './GraphComponent';
|
|
5
|
+
import { ClaimVoting } from './components/vote/ClaimVoting';
|
|
6
|
+
import { useDepositTriple } from './hooks/useDepositTriple';
|
|
7
|
+
import { useCheckSpecificTriplePosition } from './hooks/useCheckSpecificTriplePosition';
|
|
8
|
+
import { useDisplayTriplesWithPosition } from './hooks/useDisplayTriplesWithPosition';
|
|
9
|
+
import { checkTriplePosition } from './utils/debugPosition';
|
|
10
|
+
import { setAuthToken, getAuthToken, isAuthenticated, clearAuthToken } from './utils/auth';
|
|
5
11
|
|
|
6
12
|
export interface PlayerMapConfigType {
|
|
7
13
|
apiUrl: string;
|
|
8
14
|
}
|
|
9
|
-
export { PlayerMapHome, RegistrationForm, PlayerMapGraph, GraphComponent };
|
|
15
|
+
export { PlayerMapHome, RegistrationForm, PlayerMapGraph, GraphComponent, ClaimVoting, useDepositTriple, useCheckSpecificTriplePosition, useDisplayTriplesWithPosition, checkTriplePosition, setAuthToken, getAuthToken, isAuthenticated, clearAuthToken, };
|
|
16
|
+
export { VoteDirection, type Claim, type VoteItem, type DepositResponse } from './types/vote';
|
|
17
|
+
export { PREDEFINED_CLAIM_IDS, UNIT_VALUE } from './utils/voteConstants';
|
|
10
18
|
export declare const PlayerMapConfig: {
|
|
11
19
|
/**
|
|
12
20
|
* Initialise la configuration de la bibliothèque Player-map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface PlayerData {
|
|
2
|
+
pseudo: string;
|
|
3
|
+
userId: string;
|
|
4
|
+
image?: string | undefined;
|
|
5
|
+
guildId?: bigint;
|
|
6
|
+
}
|
|
7
|
+
export declare const usePlayerCreationService: (walletConnected: any, walletAddress: string, publicClient?: any) => {
|
|
8
|
+
createPlayer: (playerData: PlayerData) => Promise<{
|
|
9
|
+
atomId: bigint;
|
|
10
|
+
ipfsHash: string;
|
|
11
|
+
tripleCreated: boolean;
|
|
12
|
+
transactionHash?: string;
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const PLAYER_TRIPLE_TYPES: {
|
|
2
|
+
IS_PLAYER_GAMES: {
|
|
3
|
+
predicateId: bigint;
|
|
4
|
+
objectId: bigint;
|
|
5
|
+
};
|
|
6
|
+
IS_FAIRPLAY: {
|
|
7
|
+
predicateId: bigint;
|
|
8
|
+
objectId: bigint;
|
|
9
|
+
};
|
|
10
|
+
IS_STRONG_BOSS: {
|
|
11
|
+
predicateId: bigint;
|
|
12
|
+
objectId: bigint;
|
|
13
|
+
};
|
|
14
|
+
IS_STRONG_FIGHTER: {
|
|
15
|
+
predicateId: bigint;
|
|
16
|
+
objectId: bigint;
|
|
17
|
+
};
|
|
18
|
+
IS_PLAYER_GUILD: {
|
|
19
|
+
predicateId: bigint;
|
|
20
|
+
objectId: null;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export declare const OFFICIAL_GUILDS: {
|
|
24
|
+
id: bigint;
|
|
25
|
+
name: string;
|
|
26
|
+
}[];
|
|
27
|
+
export declare const API_STATUS: {
|
|
28
|
+
SUCCESS: string;
|
|
29
|
+
ERROR: string;
|
|
30
|
+
};
|
|
31
|
+
export declare const TIMEOUT: {
|
|
32
|
+
MODAL_CLOSE: number;
|
|
33
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "player-map",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@0xintuition/graphql": "^0.8.0",
|
|
24
24
|
"axios": "^1.9.0",
|
|
25
|
-
"playermap_graph": "^0.1.
|
|
25
|
+
"playermap_graph": "^0.1.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/react": "^18.2.0",
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Network, AtomResponse, AtomData } from './useAtomData';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Hook pour récupérer un atome par ID sur le mainnet
|
|
5
|
-
*/
|
|
6
|
-
export declare const useMainnetAtomById: (id: number) => {
|
|
7
|
-
data: AtomResponse | null;
|
|
8
|
-
loading: boolean;
|
|
9
|
-
error: string | null;
|
|
10
|
-
network: Network;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Hook pour récupérer un atome par label sur le mainnet
|
|
14
|
-
*/
|
|
15
|
-
export declare const useMainnetAtomByLabel: (label: string) => {
|
|
16
|
-
data: AtomData | null;
|
|
17
|
-
loading: boolean;
|
|
18
|
-
error: string | null;
|
|
19
|
-
network: Network;
|
|
20
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Network, AtomResponse, AtomData } from './useAtomData';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Hook pour récupérer un atome par ID sur le testnet
|
|
5
|
-
*/
|
|
6
|
-
export declare const useTestnetAtomById: (id: number) => {
|
|
7
|
-
data: AtomResponse | null;
|
|
8
|
-
loading: boolean;
|
|
9
|
-
error: string | null;
|
|
10
|
-
network: Network;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Hook pour récupérer un atome par label sur le testnet
|
|
14
|
-
*/
|
|
15
|
-
export declare const useTestnetAtomByLabel: (label: string) => {
|
|
16
|
-
data: AtomData | null;
|
|
17
|
-
loading: boolean;
|
|
18
|
-
error: string | null;
|
|
19
|
-
network: Network;
|
|
20
|
-
};
|