sportfi-kit 1.0.0

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.
Files changed (122) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -0
  3. package/dist/cli/commands/add-example.d.ts +2 -0
  4. package/dist/cli/commands/add-example.d.ts.map +1 -0
  5. package/dist/cli/commands/add-example.js +30 -0
  6. package/dist/cli/commands/create.d.ts +4 -0
  7. package/dist/cli/commands/create.d.ts.map +1 -0
  8. package/dist/cli/commands/create.js +39 -0
  9. package/dist/cli/commands/init.d.ts +2 -0
  10. package/dist/cli/commands/init.d.ts.map +1 -0
  11. package/dist/cli/commands/init.js +26 -0
  12. package/dist/cli/index.d.ts +3 -0
  13. package/dist/cli/index.d.ts.map +1 -0
  14. package/dist/cli/index.js +29 -0
  15. package/dist/cli/templates/basic/src/App.d.ts +3 -0
  16. package/dist/cli/templates/basic/src/App.d.ts.map +1 -0
  17. package/dist/cli/templates/basic/src/App.js +9 -0
  18. package/dist/cli/templates/fan-token-gate/src/App.d.ts +3 -0
  19. package/dist/cli/templates/fan-token-gate/src/App.d.ts.map +1 -0
  20. package/dist/cli/templates/fan-token-gate/src/App.js +7 -0
  21. package/dist/cli/templates/live-poll/src/App.d.ts +3 -0
  22. package/dist/cli/templates/live-poll/src/App.d.ts.map +1 -0
  23. package/dist/cli/templates/live-poll/src/App.js +9 -0
  24. package/dist/cli/templates/prediction-market/src/App.d.ts +3 -0
  25. package/dist/cli/templates/prediction-market/src/App.d.ts.map +1 -0
  26. package/dist/cli/templates/prediction-market/src/App.js +20 -0
  27. package/dist/components/CloseMiniAppButton.d.ts +6 -0
  28. package/dist/components/CloseMiniAppButton.d.ts.map +1 -0
  29. package/dist/components/CloseMiniAppButton.js +9 -0
  30. package/dist/components/ConnectButton.d.ts +9 -0
  31. package/dist/components/ConnectButton.d.ts.map +1 -0
  32. package/dist/components/ConnectButton.js +14 -0
  33. package/dist/components/FanTokenGate.d.ts +14 -0
  34. package/dist/components/FanTokenGate.d.ts.map +1 -0
  35. package/dist/components/FanTokenGate.js +14 -0
  36. package/dist/components/PredictionCard.d.ts +13 -0
  37. package/dist/components/PredictionCard.d.ts.map +1 -0
  38. package/dist/components/PredictionCard.js +7 -0
  39. package/dist/components/SafeAreaWrapper.d.ts +9 -0
  40. package/dist/components/SafeAreaWrapper.d.ts.map +1 -0
  41. package/dist/components/SafeAreaWrapper.js +15 -0
  42. package/dist/components/ShareToSociosButton.d.ts +9 -0
  43. package/dist/components/ShareToSociosButton.d.ts.map +1 -0
  44. package/dist/components/ShareToSociosButton.js +23 -0
  45. package/dist/hooks/useFanTokenBalance.d.ts +13 -0
  46. package/dist/hooks/useFanTokenBalance.d.ts.map +1 -0
  47. package/dist/hooks/useFanTokenBalance.js +20 -0
  48. package/dist/hooks/usePythSportsFeed.d.ts +12 -0
  49. package/dist/hooks/usePythSportsFeed.d.ts.map +1 -0
  50. package/dist/hooks/usePythSportsFeed.js +21 -0
  51. package/dist/hooks/useSimpleVote.d.ts +6 -0
  52. package/dist/hooks/useSimpleVote.d.ts.map +1 -0
  53. package/dist/hooks/useSimpleVote.js +38 -0
  54. package/dist/hooks/useSportFiConnect.d.ts +16 -0
  55. package/dist/hooks/useSportFiConnect.d.ts.map +1 -0
  56. package/dist/hooks/useSportFiConnect.js +22 -0
  57. package/dist/index.d.ts +15 -0
  58. package/dist/index.d.ts.map +1 -0
  59. package/dist/index.js +14 -0
  60. package/dist/provider/SportFiKitProvider.d.ts +12 -0
  61. package/dist/provider/SportFiKitProvider.d.ts.map +1 -0
  62. package/dist/provider/SportFiKitProvider.js +88 -0
  63. package/dist/src/components/CloseMiniAppButton.d.ts +6 -0
  64. package/dist/src/components/CloseMiniAppButton.d.ts.map +1 -0
  65. package/dist/src/components/CloseMiniAppButton.js +9 -0
  66. package/dist/src/components/ConnectButton.d.ts +9 -0
  67. package/dist/src/components/ConnectButton.d.ts.map +1 -0
  68. package/dist/src/components/ConnectButton.js +12 -0
  69. package/dist/src/components/FanTokenGate.d.ts +14 -0
  70. package/dist/src/components/FanTokenGate.d.ts.map +1 -0
  71. package/dist/src/components/FanTokenGate.js +14 -0
  72. package/dist/src/components/PredictionCard.d.ts +15 -0
  73. package/dist/src/components/PredictionCard.d.ts.map +1 -0
  74. package/dist/src/components/PredictionCard.js +9 -0
  75. package/dist/src/components/SafeAreaWrapper.d.ts +9 -0
  76. package/dist/src/components/SafeAreaWrapper.d.ts.map +1 -0
  77. package/dist/src/components/SafeAreaWrapper.js +15 -0
  78. package/dist/src/components/ShareToSociosButton.d.ts +9 -0
  79. package/dist/src/components/ShareToSociosButton.d.ts.map +1 -0
  80. package/dist/src/components/ShareToSociosButton.js +23 -0
  81. package/dist/src/hooks/useFanTokenBalance.d.ts +13 -0
  82. package/dist/src/hooks/useFanTokenBalance.d.ts.map +1 -0
  83. package/dist/src/hooks/useFanTokenBalance.js +20 -0
  84. package/dist/src/hooks/usePythSportsFeed.d.ts +19 -0
  85. package/dist/src/hooks/usePythSportsFeed.d.ts.map +1 -0
  86. package/dist/src/hooks/usePythSportsFeed.js +42 -0
  87. package/dist/src/hooks/useSimpleVote.d.ts +17 -0
  88. package/dist/src/hooks/useSimpleVote.d.ts.map +1 -0
  89. package/dist/src/hooks/useSimpleVote.js +41 -0
  90. package/dist/src/hooks/useSportFiConnect.d.ts +16 -0
  91. package/dist/src/hooks/useSportFiConnect.d.ts.map +1 -0
  92. package/dist/src/hooks/useSportFiConnect.js +22 -0
  93. package/dist/src/index.d.ts +15 -0
  94. package/dist/src/index.d.ts.map +1 -0
  95. package/dist/src/index.js +14 -0
  96. package/dist/src/provider/SportFiKitProvider.d.ts +12 -0
  97. package/dist/src/provider/SportFiKitProvider.d.ts.map +1 -0
  98. package/dist/src/provider/SportFiKitProvider.js +88 -0
  99. package/dist/src/types/index.d.ts +44 -0
  100. package/dist/src/types/index.d.ts.map +1 -0
  101. package/dist/src/types/index.js +5 -0
  102. package/dist/src/utils/detectSociosBrowser.d.ts +9 -0
  103. package/dist/src/utils/detectSociosBrowser.d.ts.map +1 -0
  104. package/dist/src/utils/detectSociosBrowser.js +25 -0
  105. package/dist/src/utils/telegramMiniAppSupport.d.ts +13 -0
  106. package/dist/src/utils/telegramMiniAppSupport.d.ts.map +1 -0
  107. package/dist/src/utils/telegramMiniAppSupport.js +28 -0
  108. package/dist/types/index.d.ts +44 -0
  109. package/dist/types/index.d.ts.map +1 -0
  110. package/dist/types/index.js +5 -0
  111. package/dist/utils/detectSociosBrowser.d.ts +9 -0
  112. package/dist/utils/detectSociosBrowser.d.ts.map +1 -0
  113. package/dist/utils/detectSociosBrowser.js +25 -0
  114. package/dist/utils/telegramMiniAppSupport.d.ts +13 -0
  115. package/dist/utils/telegramMiniAppSupport.d.ts.map +1 -0
  116. package/dist/utils/telegramMiniAppSupport.js +28 -0
  117. package/package.json +55 -0
  118. package/templates/basic/package.json +24 -0
  119. package/templates/basic/src/App.tsx +28 -0
  120. package/templates/fan-token-gate/src/App.tsx +28 -0
  121. package/templates/live-poll/src/App.tsx +46 -0
  122. package/templates/prediction-market/src/App.tsx +40 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Chiliz / SportFi Kit Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # sportfi-kit
2
+
3
+ <div align="center">
4
+ <img src="https://raw.githubusercontent.com/chiliz/sportfi-kit/main/logo.svg" width="128" height="128" alt="SportFi Kit Logo" />
5
+ <h1>SportFi Kit</h1>
6
+ <p>The ultimate SDK for building high-performance SportFi mini-apps on Chiliz Chain.</p>
7
+ </div>
8
+
9
+ ---
10
+
11
+ **SportFi Kit** is a modern React component library, collection of hooks, and CLI tool designed specifically for developers building dApps for the **Socios.com Wallet Browser** and **Telegram Mini-App** ecosystems.
12
+
13
+ ## 🚀 Key Features
14
+
15
+ - **Built for Chiliz Chain**: Hard-coded support for Mainnet (88888) and Spicy Testnet (88882).
16
+ - **Embedded Browser Optimized**: Automatic detection and support for Socios.com and Telegram browser environments.
17
+ - **Fan Token Infrastructure**: Ready-to-use components for Fan Token gating and balance tracking.
18
+ - **SportFi Components**: Prediction cards, voting hooks, and Pyth oracle integration out of the box.
19
+ - **Modern Tech Stack**: React 19, Reown AppKit, Wagmi v2, Viem v2, and TanStack Query v5.
20
+ - **Premium Aesthetic**: Minimalist, high-contrast design system featuring Emerald-600 accents.
21
+
22
+ ## 📦 Installation
23
+
24
+ ```bash
25
+ npm install sportfi-kit
26
+ ```
27
+
28
+ ## 🛠️ Quick Start
29
+
30
+ ### 1. Configure Provider
31
+
32
+ Wrap your application with the `SportFiKitProvider` at the root.
33
+
34
+ ```tsx
35
+ import { SportFiKitProvider } from 'sportfi-kit';
36
+
37
+ function App() {
38
+ return (
39
+ <SportFiKitProvider config={{ reownProjectId: 'YOUR_PROJECT_ID' }}>
40
+ <YourAppContent />
41
+ </SportFiKitProvider>
42
+ );
43
+ }
44
+ ```
45
+
46
+ ### 2. Connect Wallet
47
+
48
+ Use the pre-styled `ConnectButton` or the `useSportFiConnect` hook.
49
+
50
+ ```tsx
51
+ import { ConnectButton, useSportFiConnect } from 'sportfi-kit';
52
+
53
+ function Header() {
54
+ const { isConnected, address } = useSportFiConnect();
55
+
56
+ return (
57
+ <nav>
58
+ <ConnectButton />
59
+ {isConnected && <span>Connected: {address}</span>}
60
+ </nav>
61
+ );
62
+ }
63
+ ```
64
+
65
+ ## 💻 CLI Tools
66
+
67
+ SportFi Kit comes with a powerful CLI to scaffold new projects in seconds.
68
+
69
+ ```bash
70
+ # Scaffold a new mini-app
71
+ npx sportfi-kit create my-app --template prediction-market
72
+
73
+ # Add examples to existing project
74
+ npx sportfi-kit add-example live-poll
75
+ ```
76
+
77
+ Available templates:
78
+ - `basic`: Minimalism at its finest.
79
+ - `prediction-market`: Full Chiliz-integrated prediction UI.
80
+ - `fan-token-gate`: Content locking based on Fan Token ownership.
81
+ - `live-poll`: Real-time on-chain voting.
82
+
83
+ ## 📖 Documentation
84
+
85
+ For full API reference, component guides, and Socios integration tips, visit our documentation site:
86
+ **[docs.sportfi.kit](https://localhost:5173)** (Local Preview)
87
+
88
+ ## 📄 License
89
+
90
+ MIT © [Chiliz Team](LICENSE)
@@ -0,0 +1,2 @@
1
+ export declare const addExampleCommand: (exampleName: string) => Promise<void>;
2
+ //# sourceMappingURL=add-example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-example.d.ts","sourceRoot":"","sources":["../../../cli/commands/add-example.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,GAAU,aAAa,MAAM,kBA8B1D,CAAC"}
@@ -0,0 +1,30 @@
1
+ import fs from 'fs-extra';
2
+ import path from 'path';
3
+ import chalk from 'chalk';
4
+ export const addExampleCommand = async (exampleName) => {
5
+ const currentDir = process.cwd();
6
+ const srcDir = path.join(currentDir, 'src');
7
+ // Resolve templates from the package root
8
+ // - In source: packages/core/cli/commands/add-example.ts -> ../../templates
9
+ // - In build: packages/core/dist/cli/commands/add-example.js -> ../../../templates
10
+ const sourcePath = path.resolve(__dirname, '../../templates', exampleName);
11
+ const buildPath = path.resolve(__dirname, '../../../templates', exampleName);
12
+ const templateDir = fs.existsSync(sourcePath) ? sourcePath : buildPath;
13
+ if (!fs.existsSync(srcDir)) {
14
+ console.error(chalk.red('Error: src/ directory not found. Please run this in the root of a React project.'));
15
+ process.exit(1);
16
+ }
17
+ if (!fs.existsSync(templateDir)) {
18
+ console.error(chalk.red(`Error: Example "${exampleName}" not found.`));
19
+ process.exit(1);
20
+ }
21
+ try {
22
+ const targetPath = path.join(srcDir, 'examples', exampleName);
23
+ console.log(chalk.blue(`Copying example code to ${targetPath}...`));
24
+ await fs.copy(templateDir, targetPath);
25
+ console.log(chalk.green(`\n✅ Example "${exampleName}" added successfully to your src/examples directory!`));
26
+ }
27
+ catch (err) {
28
+ console.error(chalk.red('Failed to add example:'), err);
29
+ }
30
+ };
@@ -0,0 +1,4 @@
1
+ export declare const createCommand: (appName: string, options: {
2
+ template: string;
3
+ }) => Promise<void>;
4
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../cli/commands/create.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,GAAU,SAAS,MAAM,EAAE,SAAS;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,kBAwCjF,CAAC"}
@@ -0,0 +1,39 @@
1
+ import fs from 'fs-extra';
2
+ import path from 'path';
3
+ import chalk from 'chalk';
4
+ export const createCommand = async (appName, options) => {
5
+ const targetDir = path.resolve(process.cwd(), appName);
6
+ // Resolve templates from the package root
7
+ // - In source: packages/core/cli/commands/create.ts -> ../../templates
8
+ // - In build: packages/core/dist/cli/commands/create.js -> ../../../templates
9
+ const sourcePath = path.resolve(__dirname, '../../templates', options.template);
10
+ const buildPath = path.resolve(__dirname, '../../../templates', options.template);
11
+ const templateDir = fs.existsSync(sourcePath) ? sourcePath : buildPath;
12
+ if (fs.existsSync(targetDir)) {
13
+ console.error(chalk.red(`Error: Directory ${appName} already exists.`));
14
+ process.exit(1);
15
+ }
16
+ if (!fs.existsSync(templateDir)) {
17
+ console.error(chalk.red(`Error: Template "${options.template}" not found.`));
18
+ process.exit(1);
19
+ }
20
+ try {
21
+ console.log(chalk.blue(`Scaffolding project from ${options.template} template...`));
22
+ await fs.copy(templateDir, targetDir);
23
+ // Update package.json name
24
+ const pkgPath = path.join(targetDir, 'package.json');
25
+ if (fs.existsSync(pkgPath)) {
26
+ const pkg = await fs.readJson(pkgPath);
27
+ pkg.name = appName;
28
+ await fs.writeJson(pkgPath, pkg, { spaces: 2 });
29
+ }
30
+ console.log(chalk.green(`\n✅ Project "${appName}" created successfully!`));
31
+ console.log(`\nNext steps:`);
32
+ console.log(` cd ${appName}`);
33
+ console.log(` npm install`);
34
+ console.log(` npm run dev\n`);
35
+ }
36
+ catch (err) {
37
+ console.error(chalk.red('Failed to create project:'), err);
38
+ }
39
+ };
@@ -0,0 +1,2 @@
1
+ export declare const initCommand: () => Promise<void>;
2
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../cli/commands/init.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,qBAyBvB,CAAC"}
@@ -0,0 +1,26 @@
1
+ import fs from 'fs-extra';
2
+ import path from 'path';
3
+ import chalk from 'chalk';
4
+ export const initCommand = async () => {
5
+ const currentDir = process.cwd();
6
+ const pkgPath = path.join(currentDir, 'package.json');
7
+ if (!fs.existsSync(pkgPath)) {
8
+ console.error(chalk.red('Error: package.json not found. Run "npm init" first or navigate to a project root.'));
9
+ process.exit(1);
10
+ }
11
+ try {
12
+ // Add dependencies
13
+ const pkg = await fs.readJson(pkgPath);
14
+ pkg.dependencies = pkg.dependencies || {};
15
+ pkg.dependencies['sportfi-kit'] = '^1.0.0';
16
+ pkg.dependencies['wagmi'] = 'latest';
17
+ pkg.dependencies['viem'] = 'latest';
18
+ pkg.dependencies['@reown/appkit-wagmi'] = 'latest';
19
+ await fs.writeJson(pkgPath, pkg, { spaces: 2 });
20
+ console.log(chalk.green('✅ Added sportfi-kit to dependencies.'));
21
+ console.log(chalk.yellow('Remember to run "npm install" to update your node_modules.'));
22
+ }
23
+ catch (err) {
24
+ console.error(chalk.red('Failed to initialize:'), err);
25
+ }
26
+ };
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../cli/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+ import { cac } from 'cac';
3
+ import chalk from 'chalk';
4
+ import { createCommand } from './commands/create';
5
+ import { initCommand } from './commands/init';
6
+ import { addExampleCommand } from './commands/add-example';
7
+ const cli = cac('sportfi-kit');
8
+ cli
9
+ .command('create <app-name>', 'Scaffold a new SportFi mini-app')
10
+ .option('--template <template>', 'Template to use (basic, prediction-market, fan-token-gate, live-poll)', { default: 'basic' })
11
+ .action(async (appName, options) => {
12
+ console.log(chalk.hex('#059669')(`\n⚽ SportFi Kit: Creating "${appName}"...`));
13
+ await createCommand(appName, options);
14
+ });
15
+ cli
16
+ .command('init', 'Add SportFi Kit to an existing project')
17
+ .action(async () => {
18
+ console.log(chalk.hex('#059669')(`\n🛠️ SportFi Kit: Initializing in current directory...`));
19
+ await initCommand();
20
+ });
21
+ cli
22
+ .command('add-example <name>', 'Add a SportFi example to your project')
23
+ .action(async (name) => {
24
+ console.log(chalk.hex('#059669')(`\n💡 SportFi Kit: Adding example "${name}"...`));
25
+ await addExampleCommand(name);
26
+ });
27
+ cli.help();
28
+ cli.version('1.0.0');
29
+ cli.parse();
@@ -0,0 +1,3 @@
1
+ declare function App(): import("react/jsx-runtime").JSX.Element;
2
+ export default App;
3
+ //# sourceMappingURL=App.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../../cli/templates/basic/src/App.tsx"],"names":[],"mappings":"AAEA,iBAAS,GAAG,4CAuBX;AAED,eAAe,GAAG,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { SportFiKitProvider, ConnectButton, SafeAreaWrapper } from '@chiliz/sportfi-kit';
3
+ function App() {
4
+ const config = {
5
+ reownProjectId: 'YOUR_PROJECT_ID',
6
+ };
7
+ return (_jsx(SportFiKitProvider, { config: config, children: _jsxs(SafeAreaWrapper, { children: [_jsxs("header", { className: "flex justify-between items-center mb-8", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("svg", { width: "32", height: "32", viewBox: "0 0 32 32", children: _jsx("path", { d: "M16 2C8.268 2 2 8.268 2 16s6.268 14 14 14 14-6.268 14-14S23.732 2 16 2zm0 24c-5.523 0-10-4.477-10-10S10.477 6 16 6s10 4.477 10 10-4.477 10-10 10z", fill: "#059669" }) }), _jsx("span", { className: "text-xl font-bold", children: "SportFi Mini App" })] }), _jsx(ConnectButton, {})] }), _jsxs("main", { className: "text-center", children: [_jsx("h1", { className: "text-3xl font-bold text-slate-900 mb-4", children: "Welcome to Chiliz Chain" }), _jsx("p", { className: "text-slate-600 mb-8", children: "Start building your fan experience with SportFi Kit." })] })] }) }));
8
+ }
9
+ export default App;
@@ -0,0 +1,3 @@
1
+ declare function App(): import("react/jsx-runtime").JSX.Element;
2
+ export default App;
3
+ //# sourceMappingURL=App.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../../cli/templates/fan-token-gate/src/App.tsx"],"names":[],"mappings":"AAEA,iBAAS,GAAG,4CAuBX;AAED,eAAe,GAAG,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { SportFiKitProvider, ConnectButton, SafeAreaWrapper, FanTokenGate } from '@chiliz/sportfi-kit';
3
+ function App() {
4
+ const JUV_TOKEN = "0x...123"; // Juventus Fan Token
5
+ return (_jsx(SportFiKitProvider, { config: { reownProjectId: 'demo' }, children: _jsxs(SafeAreaWrapper, { className: "p-4", children: [_jsxs("header", { className: "flex justify-between items-center mb-8", children: [_jsx("span", { className: "font-bold text-xl text-emerald-600", children: "Fan Gate Demo" }), _jsx(ConnectButton, {})] }), _jsx(FanTokenGate, { tokenAddress: JUV_TOKEN, minBalance: 5, children: _jsxs("div", { className: "bg-white border border-slate-200 rounded-xl p-6 shadow-sm", children: [_jsx("h2", { className: "text-2xl font-bold mb-4", children: "Welcome, True Fan! \uD83C\uDFDF\uFE0F" }), _jsx("p", { className: "text-slate-600", children: "You have exclusive access to this locker room content." }), _jsx("div", { className: "mt-6 aspect-video bg-slate-100 rounded-lg flex items-center justify-center", children: _jsx("span", { className: "text-slate-400", children: "Exclusive Video Content" }) })] }) })] }) }));
6
+ }
7
+ export default App;
@@ -0,0 +1,3 @@
1
+ declare function App(): import("react/jsx-runtime").JSX.Element;
2
+ export default App;
3
+ //# sourceMappingURL=App.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../../cli/templates/live-poll/src/App.tsx"],"names":[],"mappings":"AAEA,iBAAS,GAAG,4CAyCX;AAED,eAAe,GAAG,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { SportFiKitProvider, ConnectButton, SafeAreaWrapper, useSimpleVote } from '@chiliz/sportfi-kit';
3
+ function App() {
4
+ const POLL_CONTRACT = "0x...abc";
5
+ const { vote, isPending, isSuccess } = useSimpleVote(POLL_CONTRACT);
6
+ const options = ["Messi", "Ronaldo", "Neymar"];
7
+ return (_jsx(SportFiKitProvider, { config: { reownProjectId: 'demo' }, children: _jsxs(SafeAreaWrapper, { className: "p-4", children: [_jsxs("header", { className: "flex justify-between items-center mb-10", children: [_jsx("span", { className: "font-bold text-xl text-emerald-600", children: "Fan Vote" }), _jsx(ConnectButton, {})] }), _jsxs("div", { className: "max-w-md mx-auto bg-white border border-slate-200 rounded-xl p-8 shadow-sm", children: [_jsx("h2", { className: "text-xl font-bold mb-6", children: "Vote for Player of the Month" }), _jsx("div", { className: "space-y-4", children: options.map((opt, i) => (_jsx("button", { onClick: () => vote(i), disabled: isPending || isSuccess, className: `w-full p-4 text-left border rounded-lg transition-all ${isSuccess ? 'border-emerald-200 bg-emerald-50 text-emerald-700' : 'border-slate-200 hover:border-emerald-600'}`, children: opt }, i))) }), isSuccess && (_jsx("p", { className: "mt-4 text-center text-emerald-600 font-medium", children: "Your vote has been cast! \u2705" })) || isPending && (_jsx("p", { className: "mt-4 text-center text-slate-500", children: "Submitting vote..." }))] })] }) }));
8
+ }
9
+ export default App;
@@ -0,0 +1,3 @@
1
+ declare function App(): import("react/jsx-runtime").JSX.Element;
2
+ export default App;
3
+ //# sourceMappingURL=App.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../../cli/templates/prediction-market/src/App.tsx"],"names":[],"mappings":"AAGA,iBAAS,GAAG,4CAkCX;AAED,eAAe,GAAG,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { SportFiKitProvider, ConnectButton, SafeAreaWrapper, PredictionCard } from '@chiliz/sportfi-kit';
3
+ import { useState } from 'react';
4
+ function App() {
5
+ const [isVoting, setIsVoting] = useState(false);
6
+ const prediction = {
7
+ id: "1",
8
+ question: "Who will win the Chiliz Cup final?",
9
+ options: ["Team Spicy", "Team Chiliz", "Draw"],
10
+ endTime: Date.now() + 86400000,
11
+ totalPool: "25000",
12
+ };
13
+ const handleVote = (index) => {
14
+ setIsVoting(true);
15
+ console.log(`Voting for ${prediction.options[index]}`);
16
+ setTimeout(() => setIsVoting(false), 2000);
17
+ };
18
+ return (_jsx(SportFiKitProvider, { config: { reownProjectId: 'demo' }, children: _jsxs(SafeAreaWrapper, { className: "p-4", children: [_jsxs("header", { className: "flex justify-between items-center mb-8", children: [_jsx("span", { className: "font-bold text-xl text-emerald-600", children: "Prediction Market" }), _jsx(ConnectButton, {})] }), _jsx("div", { className: "flex justify-center", children: _jsx(PredictionCard, { prediction: prediction, onVote: handleVote, isVoting: isVoting }) })] }) }));
19
+ }
20
+ export default App;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * CloseMiniAppButton - Standard 'X' button to exit the mini-app environment.
4
+ */
5
+ export declare const CloseMiniAppButton: React.FC;
6
+ //# sourceMappingURL=CloseMiniAppButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloseMiniAppButton.d.ts","sourceRoot":"","sources":["../../src/components/CloseMiniAppButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAUtC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { X } from 'lucide-react';
3
+ import { closeSociosMiniApp } from '../utils/detectSociosBrowser';
4
+ /**
5
+ * CloseMiniAppButton - Standard 'X' button to exit the mini-app environment.
6
+ */
7
+ export const CloseMiniAppButton = () => {
8
+ return (_jsx("button", { onClick: closeSociosMiniApp, className: "p-2 rounded-full bg-slate-100 hover:bg-slate-200 text-slate-600 transition-all shadow-sm", "aria-label": "Close", children: _jsx(X, { size: 20 }) }));
9
+ };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ /**
3
+ * ConnectButton - The primary entry point for wallet connection.
4
+ * Styled with Emerald-600 and follows the minimalist design rules.
5
+ */
6
+ export declare const ConnectButton: React.FC<{
7
+ className?: string;
8
+ }>;
9
+ //# sourceMappingURL=ConnectButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConnectButton.d.ts","sourceRoot":"","sources":["../../src/components/ConnectButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAyB1D,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { useSportFiConnect } from '../hooks/useSportFiConnect';
3
+ /**
4
+ * ConnectButton - The primary entry point for wallet connection.
5
+ * Styled with Emerald-600 and follows the minimalist design rules.
6
+ */
7
+ export const ConnectButton = ({ className = '' }) => {
8
+ const { address, isConnected, isConnecting, connect, disconnect } = useSportFiConnect();
9
+ const baseStyles = "bg-emerald-600 text-white rounded-md px-4 py-2 hover:opacity-90 transition-all font-medium shadow-sm flex items-center justify-center gap-2";
10
+ if (isConnected && address) {
11
+ return (_jsxs("button", { onClick: () => disconnect(), className: `${baseStyles} ${className}`, children: [address.slice(0, 6), "...", address.slice(-4)] }));
12
+ }
13
+ return (_jsx("button", { onClick: () => connect(), className: `${baseStyles} ${className}`, disabled: isConnecting, children: isConnecting ? 'Connecting...' : 'Connect Wallet' }));
14
+ };
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ interface FanTokenGateProps {
3
+ tokenAddress: string;
4
+ minBalance?: number;
5
+ loadingFallback?: React.ReactNode;
6
+ unauthorizedFallback?: React.ReactNode;
7
+ children: React.ReactNode;
8
+ }
9
+ /**
10
+ * FanTokenGate - Content gating based on Fan Token ownership.
11
+ */
12
+ export declare const FanTokenGate: React.FC<FanTokenGateProps>;
13
+ export {};
14
+ //# sourceMappingURL=FanTokenGate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FanTokenGate.d.ts","sourceRoot":"","sources":["../../src/components/FanTokenGate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,iBAAiB;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC,oBAAoB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAsBpD,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useFanTokenBalance } from '../hooks/useFanTokenBalance';
3
+ /**
4
+ * FanTokenGate - Content gating based on Fan Token ownership.
5
+ */
6
+ export const FanTokenGate = ({ tokenAddress, minBalance = 1, loadingFallback = _jsx("div", { className: "p-4 text-center text-slate-600", children: "Checking fan status..." }), unauthorizedFallback = (_jsxs("div", { className: "p-6 border border-slate-200 rounded-xl bg-white text-center shadow-sm", children: [_jsx("h3", { className: "text-lg font-bold text-slate-900 mb-2", children: "Fan-Only Content" }), _jsxs("p", { className: "text-slate-600 mb-4", children: ["You need at least ", minBalance, " token(s) to access this content."] }), _jsx("button", { className: "bg-emerald-600 text-white rounded-md px-4 py-2 font-medium", children: "Buy Tokens" })] })), children }) => {
7
+ const { balance, isLoading } = useFanTokenBalance(tokenAddress);
8
+ if (isLoading)
9
+ return _jsx(_Fragment, { children: loadingFallback });
10
+ if (parseFloat(balance) < minBalance) {
11
+ return _jsx(_Fragment, { children: unauthorizedFallback });
12
+ }
13
+ return _jsx(_Fragment, { children: children });
14
+ };
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { Prediction } from '../types';
3
+ interface PredictionCardProps {
4
+ prediction: Prediction;
5
+ onVote: (optionIndex: number) => void;
6
+ isVoting?: boolean;
7
+ }
8
+ /**
9
+ * PredictionCard - Interactive UI for sport prediction markets.
10
+ */
11
+ export declare const PredictionCard: React.FC<PredictionCardProps>;
12
+ export {};
13
+ //# sourceMappingURL=PredictionCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PredictionCard.d.ts","sourceRoot":"","sources":["../../src/components/PredictionCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,UAAU,mBAAmB;IAC3B,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA+BxD,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * PredictionCard - Interactive UI for sport prediction markets.
4
+ */
5
+ export const PredictionCard = ({ prediction, onVote, isVoting = false }) => {
6
+ return (_jsxs("div", { className: "bg-white border border-slate-200 rounded-xl shadow-sm p-6 max-w-sm", children: [_jsx("h3", { className: "text-lg font-bold text-slate-900 mb-4", children: prediction.question }), _jsx("div", { className: "space-y-3", children: prediction.options.map((option, index) => (_jsx("button", { onClick: () => onVote(index), disabled: isVoting, className: "w-full text-left p-4 rounded-md border border-slate-200 hover:border-emerald-600 hover:bg-emerald-50 transition-all group", children: _jsxs("div", { className: "flex justify-between items-center", children: [_jsx("span", { className: "font-medium text-slate-700 group-hover:text-emerald-700", children: option }), _jsx("span", { className: "text-xs text-slate-400", children: "Vote" })] }) }, index))) }), _jsxs("div", { className: "mt-4 pt-4 border-t border-slate-100 flex justify-between items-center", children: [_jsxs("span", { className: "text-xs text-slate-500 font-medium uppercase tracking-wider", children: ["Pool: ", prediction.totalPool, " CHZ"] }), _jsx("span", { className: "text-xs text-slate-400", children: "Ends soon" })] })] }));
7
+ };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ /**
3
+ * SafeAreaWrapper - Handles layout padding for notched mobile devices in Socios/Telegram browsers.
4
+ */
5
+ export declare const SafeAreaWrapper: React.FC<{
6
+ children: React.ReactNode;
7
+ className?: string;
8
+ }>;
9
+ //# sourceMappingURL=SafeAreaWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SafeAreaWrapper.d.ts","sourceRoot":"","sources":["../../src/components/SafeAreaWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,CAqBvF,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useMiniAppContext } from '../provider/SportFiKitProvider';
3
+ /**
4
+ * SafeAreaWrapper - Handles layout padding for notched mobile devices in Socios/Telegram browsers.
5
+ */
6
+ export const SafeAreaWrapper = ({ children, className = "" }) => {
7
+ const { safeAreaInsets } = useMiniAppContext();
8
+ const style = {
9
+ paddingTop: `max(1rem, ${safeAreaInsets.top}px)`,
10
+ paddingBottom: `max(1rem, ${safeAreaInsets.bottom}px)`,
11
+ paddingLeft: `max(1rem, ${safeAreaInsets.left}px)`,
12
+ paddingRight: `max(1rem, ${safeAreaInsets.right}px)`,
13
+ };
14
+ return (_jsx("div", { className: `min-h-screen bg-[#fafafa] transition-all ${className}`, style: style, children: children }));
15
+ };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ /**
3
+ * ShareToSociosButton - Specialized button to share dApp content within Socios.
4
+ */
5
+ export declare const ShareToSociosButton: React.FC<{
6
+ url: string;
7
+ text?: string;
8
+ }>;
9
+ //# sourceMappingURL=ShareToSociosButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShareToSociosButton.d.ts","sourceRoot":"","sources":["../../src/components/ShareToSociosButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CA0BxE,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Share2 } from 'lucide-react';
3
+ import { detectSociosBrowser } from '../utils/detectSociosBrowser';
4
+ /**
5
+ * ShareToSociosButton - Specialized button to share dApp content within Socios.
6
+ */
7
+ export const ShareToSociosButton = ({ url, text = "Check this out on SportFi!" }) => {
8
+ const handleShare = () => {
9
+ if (detectSociosBrowser() && window.SociosBridge) {
10
+ window.SociosBridge.share({ url, text });
11
+ }
12
+ else {
13
+ // Fallback to web share API
14
+ if (navigator.share) {
15
+ navigator.share({ title: 'SportFi Kit', text, url });
16
+ }
17
+ else {
18
+ alert("Sharing not supported in this browser");
19
+ }
20
+ }
21
+ };
22
+ return (_jsxs("button", { onClick: handleShare, className: "flex items-center gap-2 text-emerald-600 font-medium hover:underline", children: [_jsx(Share2, { size: 18 }), _jsx("span", { children: "Share to Fans" })] }));
23
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Hook to fetch the balance of a specific Fan Token for the connected user on Chiliz Chain.
3
+ * @param tokenAddress The contract address of the Fan Token.
4
+ */
5
+ export declare const useFanTokenBalance: (tokenAddress: string) => {
6
+ balance: string;
7
+ symbol: string;
8
+ decimals: number;
9
+ isLoading: boolean;
10
+ isError: boolean;
11
+ error: import("viem").GetBalanceErrorType | null;
12
+ };
13
+ //# sourceMappingURL=useFanTokenBalance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFanTokenBalance.d.ts","sourceRoot":"","sources":["../../src/hooks/useFanTokenBalance.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,cAAc,MAAM;;;;;;;CAgBtD,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { useBalance, useAccount } from 'wagmi';
2
+ /**
3
+ * Hook to fetch the balance of a specific Fan Token for the connected user on Chiliz Chain.
4
+ * @param tokenAddress The contract address of the Fan Token.
5
+ */
6
+ export const useFanTokenBalance = (tokenAddress) => {
7
+ const { address } = useAccount();
8
+ const { data, isLoading, isError, error } = useBalance({
9
+ address,
10
+ token: tokenAddress,
11
+ });
12
+ return {
13
+ balance: data?.formatted || '0',
14
+ symbol: data?.symbol || '',
15
+ decimals: data?.decimals || 18,
16
+ isLoading,
17
+ isError,
18
+ error,
19
+ };
20
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Hook to fetch real-time sports feed data using Pyth Network oracles.
3
+ * (Simplified for demo, implementation would use @pythnetwork/pyth-evm-js)
4
+ */
5
+ export declare const usePythSportsFeed: (priceFeedId: string) => {
6
+ data: {
7
+ price: string;
8
+ confidence: string;
9
+ } | null;
10
+ isLoading: boolean;
11
+ };
12
+ //# sourceMappingURL=usePythSportsFeed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePythSportsFeed.d.ts","sourceRoot":"","sources":["../../src/hooks/usePythSportsFeed.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,aAAa,MAAM;;eACT,MAAM;oBAAc,MAAM;;;CAiBrE,CAAC"}