player-map 1.0.6 → 1.0.8
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/index.es.js +35705 -32773
- package/dist/index.umd.js +1118 -538
- package/dist/types/components/modals/ConnectWalletModal.d.ts +8 -0
- package/dist/types/components/modals/CreatePlayerModal.d.ts +9 -0
- package/dist/types/components/modals/index.d.ts +2 -0
- package/dist/types/components/vote/ClaimItem.d.ts +13 -0
- package/dist/types/components/vote/ClaimList.d.ts +14 -0
- package/dist/types/components/vote/ClaimVoting.d.ts +16 -0
- package/dist/types/components/vote/SubmitButton.d.ts +11 -0
- package/dist/types/components/vote/TransactionInfo.d.ts +9 -0
- package/dist/types/components/vote/TransactionStatus.d.ts +11 -0
- package/dist/types/components/vote/VotingHeader.d.ts +7 -0
- package/dist/types/hooks/useAtomData.d.ts +0 -50
- package/dist/types/hooks/useCheckSpecificTriplePosition.d.ts +14 -0
- package/dist/types/hooks/useDepositTriple.d.ts +14 -0
- package/dist/types/hooks/useDisplayTriplesWithPosition.d.ts +5 -0
- package/dist/types/hooks/useFetchTripleDetails.d.ts +27 -0
- package/dist/types/hooks/useSubmitVotes.d.ts +22 -0
- package/dist/types/hooks/useVoteItemsManagement.d.ts +21 -0
- package/dist/types/hooks.old.local/useAtomCreation.d.ts +23 -0
- package/dist/types/hooks.old.local/useAtomData.d.ts +61 -0
- package/dist/types/hooks.old.local/useBatchCreateTriple.d.ts +16 -0
- package/dist/types/hooks.old.local/useDepositTriple.d.ts +14 -0
- package/dist/types/hooks.old.local/useDisplayTriplesWithPosition.d.ts +5 -0
- package/dist/types/hooks.old.local/useFetchTripleDetails.d.ts +27 -0
- package/dist/types/hooks.old.local/useSubmitVotes.d.ts +22 -0
- package/dist/types/hooks.old.local/useTripleByCreator.d.ts +39 -0
- package/dist/types/hooks.old.local/useVoteItemsManagement.d.ts +18 -0
- package/dist/types/index.d.ts +9 -1
- package/dist/types/pages/DirectPositionCheck.d.ts +4 -0
- package/dist/types/types/vote.d.ts +26 -0
- package/dist/types/utils/debugPosition.d.ts +11 -0
- package/dist/types/utils/voteConstants.d.ts +2 -0
- package/dist/types/utils/voteUtils.d.ts +32 -0
- package/package.json +2 -2
- /package/dist/types/{hooks → hooks.old.local}/useAccountAtom.d.ts +0 -0
- /package/dist/types/{hooks → hooks.old.local}/useAtomTriples.d.ts +0 -0
- /package/dist/types/{hooks → hooks.old.local}/useAtomsByCreator.d.ts +0 -0
- /package/dist/types/{hooks → hooks.old.local}/useCreateSingleTriple.d.ts +0 -0
- /package/dist/types/{hooks → hooks.old.local}/useMainnetAtomData.d.ts +0 -0
- /package/dist/types/{hooks → hooks.old.local}/useTestnetAtomData.d.ts +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { VoteItem, VoteDirection } from '../../types/vote';
|
|
3
|
+
import { Network } from '../../hooks/useAtomData';
|
|
4
|
+
|
|
5
|
+
interface ClaimItemProps {
|
|
6
|
+
voteItem: VoteItem;
|
|
7
|
+
onChangeUnits: (id: bigint, direction: VoteDirection, units: number) => void;
|
|
8
|
+
isVoteDirectionAllowed?: (tripleId: bigint, direction: VoteDirection) => boolean;
|
|
9
|
+
walletAddress?: string;
|
|
10
|
+
network?: Network;
|
|
11
|
+
}
|
|
12
|
+
export declare const ClaimItem: React.FC<ClaimItemProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { VoteItem, VoteDirection } from '../../types/vote';
|
|
3
|
+
import { Network } from '../../hooks/useAtomData';
|
|
4
|
+
|
|
5
|
+
interface ClaimListProps {
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
voteItems: VoteItem[];
|
|
8
|
+
onChangeUnits: (id: bigint, direction: VoteDirection, units: number) => void;
|
|
9
|
+
isVoteDirectionAllowed?: (tripleId: bigint, direction: VoteDirection) => boolean;
|
|
10
|
+
walletAddress?: string;
|
|
11
|
+
network?: Network;
|
|
12
|
+
}
|
|
13
|
+
export declare const ClaimList: React.FC<ClaimListProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Network } from '../../hooks/useAtomData';
|
|
3
|
+
|
|
4
|
+
interface ClaimVotingProps {
|
|
5
|
+
walletConnected?: any;
|
|
6
|
+
walletAddress?: string;
|
|
7
|
+
publicClient?: any;
|
|
8
|
+
onClose?: () => void;
|
|
9
|
+
network?: Network;
|
|
10
|
+
onConnectWallet?: () => void;
|
|
11
|
+
onCreatePlayer?: () => void;
|
|
12
|
+
wagmiConfig?: any;
|
|
13
|
+
walletHooks?: any;
|
|
14
|
+
}
|
|
15
|
+
export declare const ClaimVoting: React.FC<ClaimVotingProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
interface SubmitButtonProps {
|
|
4
|
+
onSubmit: () => void;
|
|
5
|
+
isSubmitting: boolean;
|
|
6
|
+
isDepositLoading: boolean;
|
|
7
|
+
totalUnits: number;
|
|
8
|
+
numberOfTransactions: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const SubmitButton: React.FC<SubmitButtonProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
type TransactionStatusType = {
|
|
4
|
+
status: "idle" | "pending" | "success" | "error" | "approval_pending" | "whitelist_error";
|
|
5
|
+
message: string;
|
|
6
|
+
};
|
|
7
|
+
interface TransactionStatusDisplayProps {
|
|
8
|
+
transactionStatus: TransactionStatusType;
|
|
9
|
+
}
|
|
10
|
+
export declare const TransactionStatusDisplay: React.FC<TransactionStatusDisplayProps>;
|
|
11
|
+
export {};
|
|
@@ -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,14 @@
|
|
|
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
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
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: (claimId: bigint, units: number, direction: VoteDirection) => Promise<DepositResponse>;
|
|
12
|
+
isLoading: boolean;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Network } from './useAtomData';
|
|
2
|
+
|
|
3
|
+
export interface TripleDetails {
|
|
4
|
+
id: string;
|
|
5
|
+
subject?: {
|
|
6
|
+
label: string;
|
|
7
|
+
};
|
|
8
|
+
predicate?: {
|
|
9
|
+
label: string;
|
|
10
|
+
};
|
|
11
|
+
object?: {
|
|
12
|
+
label: string;
|
|
13
|
+
};
|
|
14
|
+
vault_id?: string;
|
|
15
|
+
vault_position_count?: number;
|
|
16
|
+
counter_vault_id?: string;
|
|
17
|
+
counter_vault_position_count?: number;
|
|
18
|
+
}
|
|
19
|
+
interface UseFetchTripleDetailsProps {
|
|
20
|
+
network?: Network;
|
|
21
|
+
onError?: (message: string) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare const useFetchTripleDetails: ({ network, onError }?: UseFetchTripleDetailsProps) => {
|
|
24
|
+
fetchTripleDetails: (tripleId: bigint) => Promise<TripleDetails | null>;
|
|
25
|
+
isLoading: boolean;
|
|
26
|
+
};
|
|
27
|
+
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,21 @@
|
|
|
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
|
+
loadTripleDetails: () => Promise<void>;
|
|
18
|
+
isVoteDirectionAllowed: (tripleId: bigint, direction: VoteDirection) => boolean;
|
|
19
|
+
userPositions: Record<string, VoteDirection>;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
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 | undefined;
|
|
12
|
+
};
|
|
13
|
+
export interface UseAtomCreationProps {
|
|
14
|
+
walletConnected?: any;
|
|
15
|
+
walletAddress?: string;
|
|
16
|
+
publicClient?: any;
|
|
17
|
+
}
|
|
18
|
+
export declare const useAtomCreation: ({ walletConnected, walletAddress, publicClient }: UseAtomCreationProps) => {
|
|
19
|
+
createAtom: (input: IpfsAtomInput) => Promise<{
|
|
20
|
+
atomId: bigint;
|
|
21
|
+
ipfsHash: string;
|
|
22
|
+
}>;
|
|
23
|
+
};
|
|
@@ -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,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,14 @@
|
|
|
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: (claimId: bigint, units: number, direction: VoteDirection) => Promise<DepositResponse>;
|
|
12
|
+
isLoading: boolean;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Network } from './useAtomData';
|
|
2
|
+
|
|
3
|
+
export interface TripleDetails {
|
|
4
|
+
id: string;
|
|
5
|
+
subject?: {
|
|
6
|
+
label: string;
|
|
7
|
+
};
|
|
8
|
+
predicate?: {
|
|
9
|
+
label: string;
|
|
10
|
+
};
|
|
11
|
+
object?: {
|
|
12
|
+
label: string;
|
|
13
|
+
};
|
|
14
|
+
vault_id?: string;
|
|
15
|
+
vault_position_count?: number;
|
|
16
|
+
counter_vault_id?: string;
|
|
17
|
+
counter_vault_position_count?: number;
|
|
18
|
+
}
|
|
19
|
+
interface UseFetchTripleDetailsProps {
|
|
20
|
+
network?: Network;
|
|
21
|
+
onError?: (message: string) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare const useFetchTripleDetails: ({ network, onError }?: UseFetchTripleDetailsProps) => {
|
|
24
|
+
fetchTripleDetails: (tripleId: bigint) => Promise<TripleDetails | null>;
|
|
25
|
+
isLoading: boolean;
|
|
26
|
+
};
|
|
27
|
+
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,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;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { VoteItem, VoteDirection } from '../types/vote';
|
|
2
|
+
import { Network } from './useAtomData';
|
|
3
|
+
|
|
4
|
+
interface UseVoteItemsManagementProps {
|
|
5
|
+
network?: Network;
|
|
6
|
+
onError?: (message: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const useVoteItemsManagement: ({ network, onError }: UseVoteItemsManagementProps) => {
|
|
9
|
+
voteItems: VoteItem[];
|
|
10
|
+
setVoteItems: import('react').Dispatch<import('react').SetStateAction<VoteItem[]>>;
|
|
11
|
+
isLoading: boolean;
|
|
12
|
+
totalUnits: number;
|
|
13
|
+
numberOfTransactions: number;
|
|
14
|
+
handleChangeUnits: (id: bigint, direction: VoteDirection, units: number) => void;
|
|
15
|
+
resetAllVotes: () => void;
|
|
16
|
+
loadTripleDetails: () => Promise<void>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
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,26 @@
|
|
|
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
|
+
vault_id?: string;
|
|
16
|
+
vault_position_count?: number;
|
|
17
|
+
counter_vault_id?: string;
|
|
18
|
+
counter_vault_position_count?: number;
|
|
19
|
+
userHasPosition?: boolean;
|
|
20
|
+
userPositionDirection?: VoteDirection;
|
|
21
|
+
}
|
|
22
|
+
export interface DepositResponse {
|
|
23
|
+
success: boolean;
|
|
24
|
+
hash?: string;
|
|
25
|
+
error?: string;
|
|
26
|
+
}
|
|
@@ -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,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[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "player-map",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
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.3"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/react": "^18.2.0",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|