player-map 1.0.2 → 1.0.4
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 +45 -2
- package/dist/index.es.js +120199 -0
- package/dist/index.umd.js +10537 -0
- package/dist/types/GraphComponent.d.ts +12 -0
- package/dist/types/PlayerMapGraph.d.ts +4 -0
- package/dist/types/PlayerMapHome.d.ts +12 -0
- package/dist/types/RegistrationForm.d.ts +17 -0
- package/dist/types/abi.d.ts +24 -0
- package/dist/types/hooks/useAtomCreation.d.ts +22 -0
- package/dist/types/hooks/useAtomData.d.ts +61 -0
- package/dist/types/hooks/useMainnetAtomData.d.ts +20 -0
- package/dist/types/hooks/useTestnetAtomData.d.ts +20 -0
- package/dist/types/index.d.ts +29 -0
- package/dist/types/utils/auth.d.ts +24 -0
- package/dist/types/utils/config.d.ts +7 -0
- package/dist/types/utils/ipfs-utils.d.ts +4 -0
- package/dist/types/utils/pinata.d.ts +3 -0
- package/package.json +10 -7
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
interface GraphComponentProps {
|
|
4
|
+
walletConnected?: any;
|
|
5
|
+
walletAddress?: string;
|
|
6
|
+
wagmiConfig?: any;
|
|
7
|
+
walletHooks?: any;
|
|
8
|
+
isOpen?: boolean;
|
|
9
|
+
onClose?: () => void;
|
|
10
|
+
}
|
|
11
|
+
declare const GraphComponent: React.FC<GraphComponentProps>;
|
|
12
|
+
export default GraphComponent;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
interface PlayerMapHomeProps {
|
|
4
|
+
walletConnected?: any;
|
|
5
|
+
walletAddress?: string;
|
|
6
|
+
wagmiConfig?: any;
|
|
7
|
+
walletHooks?: any;
|
|
8
|
+
onClose?: () => void;
|
|
9
|
+
isOpen?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const PlayerMapHome: React.FC<PlayerMapHomeProps>;
|
|
12
|
+
export default PlayerMapHome;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
interface RegistrationFormProps {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
walletConnected?: any;
|
|
7
|
+
walletAddress?: string;
|
|
8
|
+
wagmiConfig?: any;
|
|
9
|
+
walletHooks?: {
|
|
10
|
+
useAccount?: any;
|
|
11
|
+
useConnect?: any;
|
|
12
|
+
useWalletClient?: any;
|
|
13
|
+
usePublicClient?: any;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
declare const RegistrationForm: React.FC<RegistrationFormProps>;
|
|
17
|
+
export default RegistrationForm;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const ATOM_CONTRACT_ADDRESS: string;
|
|
2
|
+
export declare const VALUE_PER_ATOM: bigint;
|
|
3
|
+
export declare const ATOM_CONTRACT_CHAIN_ID: number;
|
|
4
|
+
export declare const atomABI: ({
|
|
5
|
+
type: string;
|
|
6
|
+
name: string;
|
|
7
|
+
inputs: {
|
|
8
|
+
name: string;
|
|
9
|
+
type: string;
|
|
10
|
+
internalType: string;
|
|
11
|
+
}[];
|
|
12
|
+
outputs: {
|
|
13
|
+
name: string;
|
|
14
|
+
type: string;
|
|
15
|
+
internalType: string;
|
|
16
|
+
}[];
|
|
17
|
+
stateMutability: string;
|
|
18
|
+
} | {
|
|
19
|
+
type: string;
|
|
20
|
+
stateMutability: string;
|
|
21
|
+
name?: undefined;
|
|
22
|
+
inputs?: undefined;
|
|
23
|
+
outputs?: undefined;
|
|
24
|
+
})[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type IpfsAtom = {
|
|
2
|
+
'@context': string;
|
|
3
|
+
'@type': string;
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
image?: string;
|
|
7
|
+
};
|
|
8
|
+
export type IpfsAtomInput = {
|
|
9
|
+
name: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
image?: string;
|
|
12
|
+
};
|
|
13
|
+
export interface UseAtomCreationProps {
|
|
14
|
+
walletConnected?: any;
|
|
15
|
+
walletAddress?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const useAtomCreation: ({ walletConnected, walletAddress }: UseAtomCreationProps) => {
|
|
18
|
+
createAtom: (input: IpfsAtomInput) => Promise<{
|
|
19
|
+
atomId: bigint;
|
|
20
|
+
ipfsHash: string;
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createServerClient } from '@0xintuition/graphql';
|
|
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
|
+
export declare enum Network {
|
|
26
|
+
MAINNET = "mainnet",
|
|
27
|
+
TESTNET = "testnet"
|
|
28
|
+
}
|
|
29
|
+
export declare const API_URLS: {
|
|
30
|
+
mainnet: string;
|
|
31
|
+
testnet: string;
|
|
32
|
+
};
|
|
33
|
+
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,20 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { default as PlayerMapHome } from './PlayerMapHome';
|
|
2
|
+
import { default as RegistrationForm } from './RegistrationForm';
|
|
3
|
+
import { default as PlayerMapGraph } from './PlayerMapGraph';
|
|
4
|
+
import { default as GraphComponent } from './GraphComponent';
|
|
5
|
+
|
|
6
|
+
export interface PlayerMapConfigType {
|
|
7
|
+
apiUrl: string;
|
|
8
|
+
}
|
|
9
|
+
export { PlayerMapHome, RegistrationForm, PlayerMapGraph, GraphComponent };
|
|
10
|
+
export declare const PlayerMapConfig: {
|
|
11
|
+
/**
|
|
12
|
+
* Initialise la configuration de la bibliothèque Player-map
|
|
13
|
+
* @param config Configuration contenant l'URL de l'API (obligatoire)
|
|
14
|
+
*/
|
|
15
|
+
init: (config: PlayerMapConfigType) => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Récupère la configuration actuelle
|
|
18
|
+
* @throws Error si la configuration n'a pas été initialisée
|
|
19
|
+
*/
|
|
20
|
+
get: () => Readonly<import('./utils/config').IPlayerMapConfig>;
|
|
21
|
+
};
|
|
22
|
+
export declare const auth: {
|
|
23
|
+
setAuthToken: (token: string) => void;
|
|
24
|
+
getAuthToken: () => string | null;
|
|
25
|
+
isAuthenticated: () => boolean;
|
|
26
|
+
clearAuthToken: () => void;
|
|
27
|
+
initialize: (token: string) => boolean;
|
|
28
|
+
};
|
|
29
|
+
export default PlayerMapHome;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stocke le token d'authentification JWT
|
|
3
|
+
* @param token - Le token JWT à stocker
|
|
4
|
+
*/
|
|
5
|
+
export declare const setAuthToken: (token: string) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Récupère le token d'authentification JWT
|
|
8
|
+
* @returns Le token JWT ou null s'il n'existe pas
|
|
9
|
+
*/
|
|
10
|
+
export declare const getAuthToken: () => string | null;
|
|
11
|
+
/**
|
|
12
|
+
* Vérifie si l'utilisateur est connecté (a un token)
|
|
13
|
+
* @returns true si l'utilisateur est connecté, false sinon
|
|
14
|
+
*/
|
|
15
|
+
export declare const isAuthenticated: () => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Supprime le token d'authentification JWT (déconnexion)
|
|
18
|
+
*/
|
|
19
|
+
export declare const clearAuthToken: () => void;
|
|
20
|
+
/**
|
|
21
|
+
* Formate le token pour l'utiliser dans les headers HTTP
|
|
22
|
+
* @returns Le token formaté ou une chaîne vide
|
|
23
|
+
*/
|
|
24
|
+
export declare const getAuthHeader: () => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "player-map",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -20,20 +20,23 @@
|
|
|
20
20
|
"test": ""
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
23
|
+
"@0xintuition/graphql": "^0.8.0",
|
|
24
|
+
"axios": "^1.9.0",
|
|
25
|
+
"playermap_graph": "file:../playermap-graph"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
28
|
"@types/react": "^18.2.0",
|
|
28
29
|
"@types/react-dom": "^18.2.0",
|
|
29
30
|
"@vitejs/plugin-react": "^4.4.1",
|
|
31
|
+
"typescript": "^5.0.0",
|
|
30
32
|
"vite": "^5.0.0",
|
|
31
|
-
"vite-plugin-dts": "^3.0.0"
|
|
32
|
-
"typescript": "^5.0.0"
|
|
33
|
+
"vite-plugin-dts": "^3.0.0"
|
|
33
34
|
},
|
|
34
35
|
"peerDependencies": {
|
|
35
|
-
"react": "^18.
|
|
36
|
-
"react-dom": "^18.
|
|
36
|
+
"react": "^18.3.1",
|
|
37
|
+
"react-dom": "^18.3.1",
|
|
38
|
+
"viem": "^2.29.0",
|
|
39
|
+
"wagmi": "^2.15.2"
|
|
37
40
|
},
|
|
38
41
|
"packageManager": "pnpm@9.12.3+sha512.cce0f9de9c5a7c95bef944169cc5dfe8741abfb145078c0d508b868056848a87c81e626246cb60967cbd7fd29a6c062ef73ff840d96b3c86c40ac92cf4a813ee"
|
|
39
42
|
}
|