open-index/open-npm huggingface dataset:
npm package: @predictonton/sdk
Description: Predicton SDK JavaScript
Latest version: 0.2.1

# Install
```
yarn add @predictonton/sdk
```

# Example - ReactJS
```typescript
import PredictonCore from '@predictonton/sdk';
import TonConnect from '@tonconnect/sdk';
import { TonConnectButton, useTonConnectUI } from '@tonconnect/ui-react';
import { useEffect, useState } from 'react';
import { Button } from 'react-bootstrap';

interface RootProps {
	children: React.ReactNode;
}

const eventCode = '6ys5d';

const Root: React.FC<RootProps> = ({ children }) => {
	const [event, setEvent] = useState<Event | null>(null);
	const [userShares, setUserShares] = useState<any | null>(null);
	const [prediction, setPrediction] = useState<any | null>(null);

	const getPrediction = async () => {
        const predictionCore = new PredictonCore({
            env: 'development',
            ownerAddress: '0QCd8ttR1ZOngd4fuZj3Hqv2WjbT4T6LeO7dwgerJC1_1GJ8',
        });
		const prediction = await predictionCore.connect(tonConnectUI.connector as unknown as TonConnect);
		setPrediction(prediction);
		const event = await predictionCore.getEvent(eventCode);
        const userShares = await predictionCore.getUserShares(eventCode);
		setEvent(event);
        setUserShares(userShares);
	};

	const deployUserPredict = async () => {
		const deployUserPredictResponse = await prediction.deployUserPredict(eventCode);
		console.log(deployUserPredictResponse.toRawString());
	};

	const [tonConnectUI] = useTonConnectUI();

	const buyShares = async () => {
        try {
            const amount = 1;
            const option = 1;
            const buySharesResponse = await prediction.buyShares(eventCode, option, amount);
            console.log(buySharesResponse);
        } catch (error) {
            console.error("Error buying shares:", error);
        }
	};

	const sellShares = async () => {
        const shares = 4278917517;
        const option = 1;
		const sellSharesResponse = await prediction.sellShares(eventCode, option, shares);
		console.log(sellSharesResponse);
	};

	useEffect(() => {
		console.log(tonConnectUI);
	}, [tonConnectUI]);

	return (
		<div className="pageWrapper">
			<div className="small w-100">
				<div className="fw-bold">Connect TON Wallet</div>
			</div>
			<TonConnectButton />
			<Button onClick={getPrediction}>Get Prediction</Button>
            {event && <div>{JSON.stringify(event, null, 2)}</div>}
            <br />
            {userShares && <div>{JSON.stringify(userShares, null, 2)}</div>}
			<Button onClick={deployUserPredict}>Deploy User Predict</Button>
			<Button onClick={buyShares}>Buy Shares</Button>
			<Button onClick={sellShares}>Sell Shares</Button>
		</div>
	);
};

export default Root;
```