@nosana/kit 0.1.1 → 0.1.2

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 (71) hide show
  1. package/.gitlab-ci.yml +6 -5
  2. package/dist/config/defaultConfigs.js +15 -18
  3. package/dist/config/index.js +3 -19
  4. package/dist/config/types.d.ts +1 -3
  5. package/dist/config/types.js +4 -7
  6. package/dist/config/utils.js +8 -13
  7. package/dist/errors/NosanaError.d.ts +1 -0
  8. package/dist/errors/NosanaError.js +3 -6
  9. package/dist/generated_clients/jobs/accounts/index.js +3 -19
  10. package/dist/generated_clients/jobs/accounts/jobAccount.js +46 -59
  11. package/dist/generated_clients/jobs/accounts/marketAccount.js +45 -57
  12. package/dist/generated_clients/jobs/accounts/runAccount.js +36 -49
  13. package/dist/generated_clients/jobs/errors/index.js +1 -17
  14. package/dist/generated_clients/jobs/errors/nosanaJobs.js +43 -48
  15. package/dist/generated_clients/jobs/index.js +5 -21
  16. package/dist/generated_clients/jobs/instructions/claim.js +17 -26
  17. package/dist/generated_clients/jobs/instructions/clean.js +17 -26
  18. package/dist/generated_clients/jobs/instructions/cleanAdmin.js +17 -26
  19. package/dist/generated_clients/jobs/instructions/close.js +17 -26
  20. package/dist/generated_clients/jobs/instructions/closeAdmin.js +17 -26
  21. package/dist/generated_clients/jobs/instructions/complete.js +21 -30
  22. package/dist/generated_clients/jobs/instructions/delist.js +17 -26
  23. package/dist/generated_clients/jobs/instructions/end.js +17 -26
  24. package/dist/generated_clients/jobs/instructions/extend.js +21 -30
  25. package/dist/generated_clients/jobs/instructions/finish.js +21 -30
  26. package/dist/generated_clients/jobs/instructions/index.js +18 -34
  27. package/dist/generated_clients/jobs/instructions/list.js +23 -32
  28. package/dist/generated_clients/jobs/instructions/open.js +29 -38
  29. package/dist/generated_clients/jobs/instructions/quit.js +17 -26
  30. package/dist/generated_clients/jobs/instructions/quitAdmin.js +17 -26
  31. package/dist/generated_clients/jobs/instructions/recover.js +17 -26
  32. package/dist/generated_clients/jobs/instructions/stop.js +17 -26
  33. package/dist/generated_clients/jobs/instructions/update.js +29 -38
  34. package/dist/generated_clients/jobs/instructions/work.js +17 -26
  35. package/dist/generated_clients/jobs/programs/index.js +1 -17
  36. package/dist/generated_clients/jobs/programs/nosanaJobs.js +29 -34
  37. package/dist/generated_clients/jobs/shared/index.js +13 -21
  38. package/dist/generated_clients/jobs/types/index.js +3 -19
  39. package/dist/generated_clients/jobs/types/jobState.js +9 -15
  40. package/dist/generated_clients/jobs/types/jobType.js +9 -15
  41. package/dist/generated_clients/jobs/types/queueType.js +9 -15
  42. package/dist/index.d.ts +5 -1
  43. package/dist/index.js +149 -35
  44. package/dist/ipfs/IPFS.js +5 -12
  45. package/dist/logger/Logger.js +1 -5
  46. package/dist/programs/BaseProgram.js +1 -5
  47. package/dist/programs/JobsProgram.d.ts +2 -3
  48. package/dist/programs/JobsProgram.js +35 -99
  49. package/dist/solana/SolanaUtils.d.ts +15 -1
  50. package/dist/solana/SolanaUtils.js +81 -14
  51. package/dist/utils/index.js +1 -4
  52. package/examples/browser/.gitlab-ci.yml +78 -0
  53. package/examples/browser/FEATURES.md +141 -0
  54. package/examples/browser/QUICK_START.md +76 -0
  55. package/examples/browser/README.md +182 -0
  56. package/examples/browser/app.vue +1840 -0
  57. package/examples/browser/assets/css/main.css +7 -0
  58. package/examples/browser/nuxt.config.ts +24 -0
  59. package/examples/browser/package-lock.json +11855 -0
  60. package/examples/browser/package.json +31 -0
  61. package/examples/browser/public/favicon.ico +0 -0
  62. package/examples/browser/public/robots.txt +2 -0
  63. package/examples/browser/start.sh +38 -0
  64. package/examples/browser/tailwind.config.js +26 -0
  65. package/examples/node/README.md +146 -0
  66. package/examples/node/example-keypair.json +1 -0
  67. package/examples/node/package-lock.json +500 -156
  68. package/examples/node/package.json +5 -3
  69. package/examples/node/post-job.ts +160 -0
  70. package/examples/node/set-wallet.ts +87 -0
  71. package/package.json +3 -1
@@ -0,0 +1,76 @@
1
+ # Quick Start Guide
2
+
3
+ Get the Nosana SDK Browser Playground running in under 2 minutes!
4
+
5
+ ## 🚀 One-Command Start
6
+
7
+ ```bash
8
+ cd examples/browser && ./start.sh
9
+ ```
10
+
11
+ That's it! The script will:
12
+ - ✅ Check your Node.js version
13
+ - 📦 Install dependencies if needed
14
+ - 🌐 Start the development server
15
+ - 🎯 Open at http://localhost:3000
16
+
17
+ ## 📋 What You'll See
18
+
19
+ When you open the playground, you'll find:
20
+
21
+ ### Left Panel - Controls
22
+ 1. **SDK Initialization** - Network selection and connection testing
23
+ 2. **Job Operations** - Get individual jobs or browse all jobs with filters
24
+ 3. **Market Operations** - Explore available markets
25
+ 4. **Real-time Monitoring** - Watch live blockchain updates
26
+ 5. **Clear Logs** - Reset the terminal output
27
+
28
+ ### Right Panel - Terminal Output
29
+ - 🖥️ Terminal-style logging with timestamps
30
+ - 🎨 Color-coded messages (info, success, error, warning)
31
+ - 📜 Auto-scroll toggle
32
+ - 📊 Line counter
33
+
34
+ ## 🎯 Try These First
35
+
36
+ 1. **Test Connection**: Click "Test Connection" to verify everything works
37
+ 2. **Get a Job**: Use the pre-filled job address and click "Get Job"
38
+ 3. **Browse Markets**: Click "Get All Markets" to see available markets
39
+ 4. **Start Monitoring**: Click "Start Monitoring" to see live updates
40
+
41
+ ## 🔧 Troubleshooting
42
+
43
+ ### Port Already in Use?
44
+ ```bash
45
+ # Kill any process using port 3000
46
+ npx kill-port 3000
47
+ # Then restart
48
+ npm run dev
49
+ ```
50
+
51
+ ### Dependencies Issues?
52
+ ```bash
53
+ # Clean install
54
+ rm -rf node_modules package-lock.json
55
+ npm install
56
+ ```
57
+
58
+ ### SDK Errors?
59
+ - Check your internet connection
60
+ - Try switching networks (Mainnet ↔ Devnet)
61
+ - Look at browser console for detailed errors
62
+
63
+ ## 📚 Next Steps
64
+
65
+ - Read the full [README.md](./README.md) for detailed usage
66
+ - Check [FEATURES.md](./FEATURES.md) for complete feature list
67
+ - Explore the [source code](./app.vue) to understand implementation
68
+
69
+ ## 🆘 Need Help?
70
+
71
+ - Check browser console for errors
72
+ - Verify Node.js version (20.18.0+)
73
+ - Ensure stable internet connection
74
+ - Try different networks if one fails
75
+
76
+ Happy testing! 🎉
@@ -0,0 +1,182 @@
1
+ # Nosana SDK Browser Playground
2
+
3
+ An interactive documentation and testing environment for the Nosana SDK built with Nuxt 3. This playground allows you to test SDK functionality directly in your browser with a beautiful, modern interface.
4
+
5
+ ## Features
6
+
7
+ - 🚀 **Interactive SDK Testing**: Test all major SDK functions with a user-friendly interface
8
+ - 🌐 **Network Switching**: Easily switch between Mainnet and Devnet
9
+ - 📊 **Real-time Monitoring**: Monitor job, run, and market account updates in real-time
10
+ - 🖥️ **Terminal-style Logging**: Beautiful terminal-like output for all operations
11
+ - 📱 **Responsive Design**: Works on desktop and mobile devices
12
+ - ⚡ **Fast Development**: Hot reload and modern development experience
13
+
14
+ ## Available Operations
15
+
16
+ ### SDK Initialization
17
+ - Initialize the Nosana SDK for different networks
18
+ - Test connection to Solana RPC endpoints
19
+ - View configuration details
20
+
21
+ ### Job Operations
22
+ - **Get Job by Address**: Retrieve detailed information about a specific job
23
+ - **Get All Jobs with Filters**: Fetch multiple jobs with optional state filtering
24
+ - **Real-time Job Monitoring**: Watch for job account updates
25
+
26
+ ### Market Operations
27
+ - **Get All Markets**: Retrieve all available markets
28
+ - **Market Monitoring**: Watch for market account updates
29
+
30
+ ### Real-time Monitoring
31
+ - **WebSocket Subscriptions**: Real-time updates for job, run, and market accounts
32
+ - **Error Handling**: Automatic reconnection and error reporting
33
+ - **Live Logging**: See updates as they happen
34
+
35
+ ## Getting Started
36
+
37
+ ### Prerequisites
38
+
39
+ - Node.js 20.18.0 or higher
40
+ - npm or yarn
41
+
42
+ ### Installation
43
+
44
+ 1. Navigate to the browser example directory:
45
+ ```bash
46
+ cd examples/browser
47
+ ```
48
+
49
+ 2. Install dependencies:
50
+ ```bash
51
+ npm install
52
+ ```
53
+
54
+ 3. Start the development server:
55
+ ```bash
56
+ npm run dev
57
+ ```
58
+
59
+ 4. Open your browser and navigate to `http://localhost:3000`
60
+
61
+ ## Usage Guide
62
+
63
+ ### 1. Network Selection
64
+ - Use the network dropdown in the header to switch between Mainnet and Devnet
65
+ - The SDK will automatically reinitialize when you change networks
66
+ - Connection status is displayed with a colored indicator
67
+
68
+ ### 2. Testing SDK Functions
69
+
70
+ #### Get Job by Address
71
+ 1. Enter a valid job address in the input field (default example provided)
72
+ 2. Click "Get Job" to retrieve job details
73
+ 3. View the results in the terminal output
74
+
75
+ #### Get All Jobs with Filters
76
+ 1. Optionally select a job state filter (Queued, Running, Stopped, Done)
77
+ 2. Set a limit for the number of jobs to retrieve (default: 10)
78
+ 3. Click "Get Jobs" to fetch filtered results
79
+
80
+ #### Get All Markets
81
+ 1. Click "Get All Markets" to retrieve all available markets
82
+ 2. View market details including pricing and configuration
83
+
84
+ ### 3. Real-time Monitoring
85
+ 1. Click "Start Monitoring" to begin real-time account monitoring
86
+ 2. The system will watch for updates to job, run, and market accounts
87
+ 3. Updates will appear in the terminal as they happen
88
+ 4. Click "Stop Monitoring" to end the monitoring session
89
+
90
+ ### 4. Terminal Output
91
+ - All operations log their results to the terminal-style output panel
92
+ - Different log types are color-coded:
93
+ - 🔵 **Info**: General information (blue)
94
+ - ✅ **Success**: Successful operations (green)
95
+ - ❌ **Error**: Errors and failures (red)
96
+ - ⚠️ **Warning**: Warnings and notices (yellow)
97
+ - Use "Auto-scroll: ON/OFF" to control automatic scrolling
98
+ - Click "Clear Logs" to reset the terminal
99
+
100
+ ## Example Job Addresses
101
+
102
+ For testing purposes, you can use these example job addresses:
103
+
104
+ **Mainnet:**
105
+ - `BwBURHTRMM3Ckzo2Dzmw99hv6gV8Ve12b6iw4sm9qeyR`
106
+
107
+ **Devnet:**
108
+ - Check the latest jobs using the "Get All Jobs" function
109
+
110
+ ## Development
111
+
112
+ ### Project Structure
113
+
114
+ ```
115
+ examples/browser/
116
+ ├── app.vue # Main application component
117
+ ├── nuxt.config.ts # Nuxt configuration
118
+ ├── assets/css/main.css # Custom styles and Tailwind
119
+ ├── package.json # Dependencies and scripts
120
+ └── README.md # This file
121
+ ```
122
+
123
+ ### Key Technologies
124
+
125
+ - **Nuxt 3**: Vue.js framework for the frontend
126
+ - **Tailwind CSS**: Utility-first CSS framework for styling
127
+ - **@nosana/kit**: The Nosana SDK for blockchain interactions
128
+ - **Vue 3 Composition API**: Modern Vue.js reactive programming
129
+
130
+ ### Configuration
131
+
132
+ The application is configured to:
133
+ - Disable SSR for better Solana SDK compatibility
134
+ - Enable WASM support for blockchain operations
135
+ - Optimize dependencies for faster loading
136
+ - Use Tailwind CSS for styling
137
+
138
+ ## Troubleshooting
139
+
140
+ ### Common Issues
141
+
142
+ 1. **SDK Initialization Fails**
143
+ - Check your internet connection
144
+ - Verify the selected network is accessible
145
+ - Check browser console for detailed error messages
146
+
147
+ 2. **Job Not Found**
148
+ - Ensure the job address is valid and exists on the selected network
149
+ - Try switching networks if the job exists on a different network
150
+
151
+ 3. **Monitoring Connection Issues**
152
+ - WebSocket connections may fail due to network issues
153
+ - The system will automatically attempt to reconnect
154
+ - Check the terminal output for connection status
155
+
156
+ ### Browser Compatibility
157
+
158
+ This playground works best with modern browsers that support:
159
+ - WebSockets
160
+ - ES2020+ JavaScript features
161
+ - WebAssembly (WASM)
162
+
163
+ ## Contributing
164
+
165
+ To contribute to this example:
166
+
167
+ 1. Fork the repository
168
+ 2. Create a feature branch
169
+ 3. Make your changes
170
+ 4. Test thoroughly
171
+ 5. Submit a pull request
172
+
173
+ ## License
174
+
175
+ This example is part of the Nosana SDK and follows the same MIT license.
176
+
177
+ ## Support
178
+
179
+ For support and questions:
180
+ - Check the main Nosana SDK documentation
181
+ - Open an issue in the repository
182
+ - Join the Nosana community channels