player-map 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,14 @@
1
1
  import { default as React } from 'react';
2
2
 
3
3
  interface GraphComponentProps {
4
- walletConnected?: any;
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;
@@ -7,6 +7,7 @@ interface PlayerMapHomeProps {
7
7
  walletHooks?: any;
8
8
  onClose?: () => void;
9
9
  isOpen?: boolean;
10
+ onCreatePlayer?: () => void;
10
11
  }
11
12
  declare const PlayerMapHome: React.FC<PlayerMapHomeProps>;
12
13
  export default PlayerMapHome;
@@ -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;
@@ -0,0 +1,19 @@
1
+ import { Network } from './useAtomData';
2
+
3
+ export interface AccountAtomResponse {
4
+ account: {
5
+ atom: {
6
+ id: string;
7
+ } | null;
8
+ } | null;
9
+ }
10
+ export declare const fetchAccountAtom: (accountId: string, network?: Network) => Promise<AccountAtomResponse>;
11
+ export declare const useAccountAtom: (accountId: string, network?: Network) => {
12
+ loading: boolean;
13
+ error: Error | null;
14
+ hasAccountAtom: boolean;
15
+ accountAtomId: string | null;
16
+ network: Network;
17
+ rawData: AccountAtomResponse | null;
18
+ };
19
+ export default useAccountAtom;
@@ -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;
@@ -0,0 +1,22 @@
1
+ import { Network } from './useAtomData';
2
+
3
+ export interface Triple {
4
+ subject_id: string;
5
+ predicate_id: string;
6
+ object_id: string;
7
+ }
8
+ export interface AtomTriplesResponse {
9
+ atom: {
10
+ as_subject_triples: Triple[];
11
+ } | null;
12
+ }
13
+ export declare const fetchAtomTriples: (atomId: number, network?: Network) => Promise<AtomTriplesResponse>;
14
+ export declare const useAtomTriples: (atomId: string | null, network?: Network) => {
15
+ loading: boolean;
16
+ error: Error | null;
17
+ triples: Triple[];
18
+ hasTriple: (predicateId: string, objectId: string) => boolean;
19
+ network: Network;
20
+ rawData: AtomTriplesResponse | null;
21
+ };
22
+ export default useAtomTriples;
@@ -0,0 +1,14 @@
1
+ import { Network, AtomData } from './useAtomData';
2
+
3
+ export interface AtomsByCreatorResponse {
4
+ atoms: AtomData[];
5
+ }
6
+ export declare const fetchAtomsByCreator: (creatorId: string, network?: Network) => Promise<AtomsByCreatorResponse>;
7
+ export declare const useAtomsByCreator: (creatorId: string, network?: Network) => {
8
+ loading: boolean;
9
+ error: Error | null;
10
+ atoms: AtomData[];
11
+ network: Network;
12
+ rawData: AtomsByCreatorResponse | null;
13
+ };
14
+ export default useAtomsByCreator;
@@ -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,10 @@
1
+ interface UseCreateSingleTripleProps {
2
+ walletConnected?: any;
3
+ walletAddress?: string;
4
+ publicClient?: any;
5
+ }
6
+ export declare const useCreateSingleTriple: ({ walletConnected, walletAddress, publicClient }: UseCreateSingleTripleProps) => {
7
+ checkTripleExists: (subjectId: bigint, predicateId: bigint, objectId: bigint) => Promise<boolean>;
8
+ createSingleTriple: (subjectId: bigint, predicateId: bigint, objectId: bigint) => Promise<bigint>;
9
+ };
10
+ 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;
@@ -6,7 +6,7 @@ import { default as GraphComponent } from './GraphComponent';
6
6
  export interface PlayerMapConfigType {
7
7
  apiUrl: string;
8
8
  }
9
- export { PlayerMapHome, RegistrationForm, PlayerMapGraph, GraphComponent };
9
+ export { PlayerMapHome, RegistrationForm, PlayerMapGraph, GraphComponent, };
10
10
  export declare const PlayerMapConfig: {
11
11
  /**
12
12
  * 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.4",
3
+ "version": "1.0.6",
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": "file:../playermap-graph"
25
+ "playermap_graph": "^0.1.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/react": "^18.2.0",