@powerhousedao/academy 5.1.0-staging.0 → 5.1.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.
- package/CHANGELOG.md +46 -1148
- package/blog/BeyondCommunication-ABlueprintForDevelopment.md +1 -2
- package/blog/TheChallengeOfChange.md +0 -1
- package/docs/academy/00-EthereumArgentinaHackathon.md +207 -0
- package/docs/academy/01-GetStarted/00-ExploreDemoPackage.mdx +27 -24
- package/docs/academy/01-GetStarted/01-CreateNewPowerhouseProject.md +10 -155
- package/docs/academy/01-GetStarted/02-DefineToDoListDocumentModel.md +35 -122
- package/docs/academy/01-GetStarted/03-ImplementOperationReducers.md +155 -178
- package/docs/academy/01-GetStarted/04-BuildToDoListEditor.md +218 -0
- package/docs/academy/{02-MasteryTrack/01-BuilderEnvironment → 01-GetStarted}/05-VetraStudio.md +22 -62
- package/docs/academy/01-GetStarted/06-ReactorMCP.md +58 -0
- package/docs/academy/01-GetStarted/_04-BuildToDoListEditor +1 -1
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/03-BuilderTools.md +2 -2
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/02-SpecifyTheStateSchema.md +44 -75
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/03-SpecifyDocumentOperations.md +22 -28
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/04-UseTheDocumentModelGenerator.md +31 -28
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/05-ImplementDocumentReducers.md +206 -211
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/06-ImplementDocumentModelTests.md +62 -176
- package/docs/academy/02-MasteryTrack/02-DocumentModelCreation/07-ExampleToDoListRepository.md +0 -21
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/01-BuildingDocumentEditors.md +319 -309
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/00-DocumentToolbar.mdx +0 -4
- package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/01-OperationHistory.md +0 -4
- package/docs/academy/02-MasteryTrack/05-Launch/04-ConfigureEnvironment.md +1 -1
- package/docs/academy/03-ExampleUsecases/Chatroom/02-CreateNewPowerhouseProject.md +35 -111
- package/docs/academy/03-ExampleUsecases/Chatroom/03-DefineChatroomDocumentModel.md +79 -195
- package/docs/academy/03-ExampleUsecases/Chatroom/04-ImplementOperationReducers.md +241 -435
- package/docs/academy/03-ExampleUsecases/Chatroom/05-ImplementChatroomEditor.md +27 -388
- package/docs/academy/03-ExampleUsecases/Chatroom/06-LaunchALocalReactor.md +7 -95
- package/docs/academy/03-ExampleUsecases/Chatroom/_category_.json +1 -1
- package/docs/academy/04-APIReferences/00-PowerhouseCLI.md +2 -6
- package/docs/academy/04-APIReferences/01-ReactHooks.md +501 -291
- package/docs/academy/05-Architecture/00-PowerhouseArchitecture.md +39 -7
- package/docs/academy/05-Architecture/02-ReferencingMonorepoPackages +65 -0
- package/docs/academy/05-Architecture/04-MovingBeyondCRUD +61 -0
- package/docs/academy/06-ComponentLibrary/00-DocumentEngineering.md +24 -72
- package/docs/academy/08-Glossary.md +0 -7
- package/docusaurus.config.ts +3 -28
- package/package.json +1 -1
- package/sidebars.ts +13 -49
- package/src/css/custom.css +18 -26
- package/docs/academy/01-GetStarted/04-WriteDocumentModelTests.md +0 -425
- package/docs/academy/01-GetStarted/05-BuildToDoListEditor.md +0 -557
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/images/Modules.png +0 -0
- package/docs/academy/02-MasteryTrack/01-BuilderEnvironment/images/VetraStudioDrive.png +0 -0
- package/docs/academy/02-MasteryTrack/05-Launch/05-DockerDeployment.md +0 -384
- package/docs/academy/03-ExampleUsecases/TodoList/00-GetTheStarterCode.md +0 -24
- package/docs/academy/03-ExampleUsecases/TodoList/01-GenerateTodoListDocumentModel.md +0 -211
- package/docs/academy/03-ExampleUsecases/TodoList/02-ImplementTodoListDocumentModelReducerOperationHandlers.md +0 -171
- package/docs/academy/03-ExampleUsecases/TodoList/03-AddTestsForTodoListActions.md +0 -462
- package/docs/academy/03-ExampleUsecases/TodoList/04-GenerateTodoListDocumentEditor.md +0 -45
- package/docs/academy/03-ExampleUsecases/TodoList/05-ImplementTodoListDocumentEditorUIComponents.md +0 -422
- package/docs/academy/03-ExampleUsecases/TodoList/06-GenerateTodoDriveExplorer.md +0 -61
- package/docs/academy/03-ExampleUsecases/TodoList/07-AddSharedComponentForShowingTodoListStats.md +0 -384
- package/docs/academy/03-ExampleUsecases/TodoList/_category_.json +0 -8
- package/docs/academy/03-ExampleUsecases/VetraPackageLibrary/VetraPackageLibrary.md +0 -7
- package/docs/academy/03-ExampleUsecases/VetraPackageLibrary/_category_.json +0 -9
- package/docs/academy/04-APIReferences/06-VetraRemoteDrive.md +0 -160
- package/docs/academy/04-APIReferences/renown-sdk/00-Overview.md +0 -316
- package/docs/academy/04-APIReferences/renown-sdk/01-Authentication.md +0 -672
- package/docs/academy/04-APIReferences/renown-sdk/02-APIReference.md +0 -957
- package/docs/academy/04-APIReferences/renown-sdk/_category_.json +0 -8
- package/docs/academy/10-TodoListTutorial/02-ImplementTodoListDocumentModelReducerOperationHandlers.md +0 -171
- package/docs/academy/10-TodoListTutorial/03-AddTestsForTodoListActions.md +0 -462
- package/docs/academy/10-TodoListTutorial/05-ImplementTodoListDocumentEditorUIComponents.md +0 -422
- package/docs/academy/10-TodoListTutorial/07-AddSharedComponentForShowingTodoListStats.md +0 -370
- package/static/img/Vetra-logo-dark.svg +0 -11
- package/static/img/vetra-logo-light.svg +0 -11
- /package/docs/academy/02-MasteryTrack/03-BuildingUserExperiences/06-DocumentTools/{02-RevisionHistoryTimeline/360/237/232/247" → 02-RevisionHistoryTimeline} +0 -0
- /package/docs/academy/05-Architecture/05-DocumentModelTheory/{360/237/232/247 /01-WhatIsADocumentModel" → 01-WhatIsADocumentModel} +0 -0
- /package/docs/academy/05-Architecture/05-DocumentModelTheory/{360/237/232/247 /02-DAOandDocumentsModelsQ+A" → 02-DAOandDocumentsModelsQ+A} +0 -0
- /package/docs/academy/05-Architecture/05-DocumentModelTheory/{360/237/232/247 /02-domain-modeling" → 02-domain-modeling} +0 -0
- /package/docs/academy/05-Architecture/05-DocumentModelTheory/{360/237/232/247 /03-BenefitsOfDocumentModels" → 03-BenefitsOfDocumentModels} +0 -0
- /package/docs/academy/05-Architecture/05-DocumentModelTheory/{360/237/232/247 /04-UtilitiesAndTips" → 04-UtilitiesAndTips} +0 -0
- /package/docs/academy/05-Architecture/05-DocumentModelTheory/{360/237/232/247 /05-best-practices" → 05-best-practices} +0 -0
- /package/docs/academy/05-Architecture/05-DocumentModelTheory/{360/237/232/247 /_category_.json" → _category_.json} +0 -0
- /package/docs/academy/05-Architecture/05-DocumentModelTheory/{360/237/232/247 /three-data-layers.png" → three-data-layers.png} +0 -0
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
# Renown SDK
|
|
2
|
-
|
|
3
|
-
A comprehensive SDK for integrating Renown authentication and user profile management into your React applications.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- 🔐 **Authentication** - Complete authentication flow with session management
|
|
8
|
-
- 👤 **User Profiles** - Fetch and manage user profile data
|
|
9
|
-
- ⚛️ **React Integration** - Provider and hooks for seamless React integration
|
|
10
|
-
- 🎨 **UI Component** - Ready-to-use RenownAuthButton component
|
|
11
|
-
- 🔄 **Session Persistence** - Automatic session restoration across page reloads
|
|
12
|
-
- 🌐 **Renown Portal** - Easy integration with Renown authentication portal
|
|
13
|
-
- 📦 **Type-Safe** - Full TypeScript support
|
|
14
|
-
- 🎯 **Headless** - Customizable UI with optional render props
|
|
15
|
-
|
|
16
|
-
## Installation
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
npm install @renown/sdk
|
|
20
|
-
# or
|
|
21
|
-
yarn add @renown/sdk
|
|
22
|
-
# or
|
|
23
|
-
pnpm add @renown/sdk
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Quick Start
|
|
27
|
-
|
|
28
|
-
### 1. Wrap Your App with RenownUserProvider
|
|
29
|
-
|
|
30
|
-
The RenownUserProvider automatically initializes the SDK - no manual setup needed!
|
|
31
|
-
|
|
32
|
-
```typescript
|
|
33
|
-
// app/layout.tsx or app.tsx
|
|
34
|
-
import { RenownUserProvider } from '@renown/sdk'
|
|
35
|
-
|
|
36
|
-
export default function RootLayout({ children }) {
|
|
37
|
-
return (
|
|
38
|
-
<html>
|
|
39
|
-
<body>
|
|
40
|
-
<RenownUserProvider>
|
|
41
|
-
{children}
|
|
42
|
-
</RenownUserProvider>
|
|
43
|
-
</body>
|
|
44
|
-
</html>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Optional: Customize with loading/error components:
|
|
50
|
-
|
|
51
|
-
```typescript
|
|
52
|
-
<RenownUserProvider
|
|
53
|
-
loadingComponent={
|
|
54
|
-
<div className="loading-screen">
|
|
55
|
-
<Spinner />
|
|
56
|
-
<p>Initializing...</p>
|
|
57
|
-
</div>
|
|
58
|
-
}
|
|
59
|
-
errorComponent={(error, retry) => (
|
|
60
|
-
<div className="error-screen">
|
|
61
|
-
<h2>Failed to initialize</h2>
|
|
62
|
-
<p>{error.message}</p>
|
|
63
|
-
<button onClick={retry}>Try Again</button>
|
|
64
|
-
</div>
|
|
65
|
-
)}
|
|
66
|
-
>
|
|
67
|
-
{children}
|
|
68
|
-
</RenownUserProvider>
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### 2. Use Authentication in Components
|
|
72
|
-
|
|
73
|
-
```typescript
|
|
74
|
-
// components/Header.tsx
|
|
75
|
-
import { RenownAuthButton } from '@renown/sdk'
|
|
76
|
-
|
|
77
|
-
export function Header() {
|
|
78
|
-
return (
|
|
79
|
-
<header>
|
|
80
|
-
<h1>My App</h1>
|
|
81
|
-
<RenownAuthButton showLogoutButton />
|
|
82
|
-
</header>
|
|
83
|
-
)
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
Or use the `useUser` hook for custom implementations:
|
|
88
|
-
|
|
89
|
-
```typescript
|
|
90
|
-
// components/CustomAuth.tsx
|
|
91
|
-
import { useUser } from '@renown/sdk'
|
|
92
|
-
|
|
93
|
-
export function CustomAuth() {
|
|
94
|
-
const { user, loginStatus, openRenown, logout } = useUser()
|
|
95
|
-
|
|
96
|
-
if (user) {
|
|
97
|
-
return (
|
|
98
|
-
<div>
|
|
99
|
-
<p>Welcome, {user.name || user.did}</p>
|
|
100
|
-
<button onClick={logout}>Logout</button>
|
|
101
|
-
</div>
|
|
102
|
-
)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return <button onClick={openRenown}>Login with Renown</button>
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## Documentation Structure
|
|
110
|
-
|
|
111
|
-
- **[Authentication Guide](./01-Authentication.md)** - Comprehensive guide to implementing authentication
|
|
112
|
-
- **[API Reference](./02-APIReference.md)** - Complete API documentation
|
|
113
|
-
|
|
114
|
-
## Key Concepts
|
|
115
|
-
|
|
116
|
-
### RenownUserProvider
|
|
117
|
-
|
|
118
|
-
The `<RenownUserProvider>` component is the central authentication provider that manages auth state across your application. It must wrap your application to provide authentication context.
|
|
119
|
-
|
|
120
|
-
### useUser Hook
|
|
121
|
-
|
|
122
|
-
The `useUser()` hook provides access to authentication state and methods throughout your application. It can only be used within a `<RenownUserProvider>`. The hook returns `connectCrypto` and `renown` instances for advanced use cases.
|
|
123
|
-
|
|
124
|
-
### Session Management
|
|
125
|
-
|
|
126
|
-
The SDK automatically manages user sessions using sessionStorage, allowing users to stay logged in across page reloads within the same browser session.
|
|
127
|
-
|
|
128
|
-
### Profile Data
|
|
129
|
-
|
|
130
|
-
User profile data is automatically fetched from the Renown API after successful authentication, enriching the user object with display name, avatar, and other profile information.
|
|
131
|
-
|
|
132
|
-
### UI Component
|
|
133
|
-
|
|
134
|
-
The SDK provides a ready-to-use component:
|
|
135
|
-
- **RenownAuthButton** - Smart component that adapts to auth state (shows login button or user info)
|
|
136
|
-
|
|
137
|
-
This component is optional - you can build your own UI using the `useUser` hook.
|
|
138
|
-
|
|
139
|
-
## Examples
|
|
140
|
-
|
|
141
|
-
### Next.js App Router
|
|
142
|
-
|
|
143
|
-
```typescript
|
|
144
|
-
// app/layout.tsx - Minimal setup
|
|
145
|
-
import { RenownUserProvider } from '@renown/sdk'
|
|
146
|
-
|
|
147
|
-
export default function RootLayout({ children }) {
|
|
148
|
-
return (
|
|
149
|
-
<html lang="en">
|
|
150
|
-
<body>
|
|
151
|
-
<RenownUserProvider>
|
|
152
|
-
{children}
|
|
153
|
-
</RenownUserProvider>
|
|
154
|
-
</body>
|
|
155
|
-
</html>
|
|
156
|
-
)
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// components/Navbar.tsx - Using RenownAuthButton component
|
|
160
|
-
'use client'
|
|
161
|
-
|
|
162
|
-
import { RenownAuthButton } from '@renown/sdk'
|
|
163
|
-
|
|
164
|
-
export function Navbar() {
|
|
165
|
-
return (
|
|
166
|
-
<nav>
|
|
167
|
-
<h1>My App</h1>
|
|
168
|
-
<RenownAuthButton showLogoutButton showUsername />
|
|
169
|
-
</nav>
|
|
170
|
-
)
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// app/profile/page.tsx - Using useUser hook
|
|
174
|
-
'use client'
|
|
175
|
-
|
|
176
|
-
import { useUser } from '@renown/sdk'
|
|
177
|
-
|
|
178
|
-
export default function ProfilePage() {
|
|
179
|
-
const { user, openRenown, logout } = useUser()
|
|
180
|
-
|
|
181
|
-
if (!user) {
|
|
182
|
-
return (
|
|
183
|
-
<div>
|
|
184
|
-
<h1>Login Required</h1>
|
|
185
|
-
<button onClick={openRenown}>Login with Renown</button>
|
|
186
|
-
</div>
|
|
187
|
-
)
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
return (
|
|
191
|
-
<div>
|
|
192
|
-
<h1>Profile</h1>
|
|
193
|
-
<p>DID: {user.did}</p>
|
|
194
|
-
<p>Name: {user.name}</p>
|
|
195
|
-
{user.avatar && <img src={user.avatar} alt="Avatar" />}
|
|
196
|
-
<button onClick={logout}>Logout</button>
|
|
197
|
-
</div>
|
|
198
|
-
)
|
|
199
|
-
}
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
### React SPA
|
|
203
|
-
|
|
204
|
-
```typescript
|
|
205
|
-
// main.tsx
|
|
206
|
-
import { RenownUserProvider } from '@renown/sdk'
|
|
207
|
-
import App from './App'
|
|
208
|
-
|
|
209
|
-
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
210
|
-
<React.StrictMode>
|
|
211
|
-
<RenownUserProvider>
|
|
212
|
-
<App />
|
|
213
|
-
</RenownUserProvider>
|
|
214
|
-
</React.StrictMode>
|
|
215
|
-
)
|
|
216
|
-
|
|
217
|
-
// App.tsx - Using RenownAuthButton
|
|
218
|
-
import { RenownAuthButton } from '@renown/sdk'
|
|
219
|
-
|
|
220
|
-
function App() {
|
|
221
|
-
return (
|
|
222
|
-
<div>
|
|
223
|
-
<h1>My App</h1>
|
|
224
|
-
<RenownAuthButton showLogoutButton />
|
|
225
|
-
</div>
|
|
226
|
-
)
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// Or custom with useUser hook
|
|
230
|
-
import { useUser } from '@renown/sdk'
|
|
231
|
-
|
|
232
|
-
function CustomApp() {
|
|
233
|
-
const { user, openRenown } = useUser()
|
|
234
|
-
|
|
235
|
-
return (
|
|
236
|
-
<div>
|
|
237
|
-
{user ? (
|
|
238
|
-
<p>Welcome {user.name}</p>
|
|
239
|
-
) : (
|
|
240
|
-
<button onClick={openRenown}>Login</button>
|
|
241
|
-
)}
|
|
242
|
-
</div>
|
|
243
|
-
)
|
|
244
|
-
}
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
## Configuration
|
|
248
|
-
|
|
249
|
-
### RenownUserProvider Props
|
|
250
|
-
|
|
251
|
-
Customize the Renown SDK initialization:
|
|
252
|
-
|
|
253
|
-
```typescript
|
|
254
|
-
<RenownUserProvider
|
|
255
|
-
renownUrl="https://www.renown.id" // Custom Renown service URL
|
|
256
|
-
networkId="eip155" // Network ID (default: 'eip155')
|
|
257
|
-
chainId="1" // Chain ID (default: '1')
|
|
258
|
-
loadingComponent={<YourLoader />} // Custom loading screen
|
|
259
|
-
errorComponent={(error, retry) => <YourError />} // Custom error screen
|
|
260
|
-
>
|
|
261
|
-
<App />
|
|
262
|
-
</RenownUserProvider>
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
All props are optional - RenownUserProvider uses sensible defaults.
|
|
266
|
-
|
|
267
|
-
### Environment Variables
|
|
268
|
-
|
|
269
|
-
You can use environment variables for configuration:
|
|
270
|
-
|
|
271
|
-
```typescript
|
|
272
|
-
<RenownUserProvider
|
|
273
|
-
renownUrl={process.env.NEXT_PUBLIC_RENOWN_URL}
|
|
274
|
-
>
|
|
275
|
-
<App />
|
|
276
|
-
</RenownUserProvider>
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
```bash
|
|
280
|
-
# .env
|
|
281
|
-
NEXT_PUBLIC_RENOWN_URL=https://www.renown.id
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
## Troubleshooting
|
|
285
|
-
|
|
286
|
-
### Context Error
|
|
287
|
-
|
|
288
|
-
**Error:** `useUser must be used within a RenownUserProvider`
|
|
289
|
-
|
|
290
|
-
**Solution:** Ensure your component is wrapped by `<RenownUserProvider>`:
|
|
291
|
-
|
|
292
|
-
```typescript
|
|
293
|
-
<RenownUserProvider>
|
|
294
|
-
<YourComponent /> {/* ✅ Can use useUser */}
|
|
295
|
-
</RenownUserProvider>
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
### Custom Renown URL
|
|
299
|
-
|
|
300
|
-
If you need to use a different Renown instance:
|
|
301
|
-
|
|
302
|
-
```typescript
|
|
303
|
-
<RenownUserProvider renownUrl="https://your-renown-instance.com">
|
|
304
|
-
<App />
|
|
305
|
-
</RenownUserProvider>
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
## Resources
|
|
309
|
-
|
|
310
|
-
- [GitHub Repository](https://github.com/powerhouse-inc/powerhouse)
|
|
311
|
-
- [NPM Package](https://www.npmjs.com/package/@renown/sdk)
|
|
312
|
-
- [Renown Portal](https://www.renown.id)
|
|
313
|
-
|
|
314
|
-
## License
|
|
315
|
-
|
|
316
|
-
AGPL-3.0-only
|