create-partylayer-app 0.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/LICENSE +21 -0
- package/README.md +42 -0
- package/package.json +50 -0
- package/templates/react-vite/README.md +36 -0
- package/templates/react-vite/_gitignore +8 -0
- package/templates/react-vite/_package.json +24 -0
- package/templates/react-vite/index.html +12 -0
- package/templates/react-vite/src/App.css +27 -0
- package/templates/react-vite/src/App.tsx +32 -0
- package/templates/react-vite/src/index.css +14 -0
- package/templates/react-vite/src/main.tsx +10 -0
- package/templates/react-vite/tsconfig.json +20 -0
- package/templates/react-vite/vite.config.ts +7 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PartyLayer
|
|
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,42 @@
|
|
|
1
|
+
# create-partylayer-app
|
|
2
|
+
|
|
3
|
+
Scaffold a [PartyLayer](https://partylayer.xyz) dApp — Canton wallet integration — in seconds.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm create partylayer-app@latest
|
|
7
|
+
# or
|
|
8
|
+
pnpm create partylayer-app
|
|
9
|
+
# or
|
|
10
|
+
yarn create partylayer-app
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Then follow the prompts (project directory → template → package manager).
|
|
14
|
+
|
|
15
|
+
## Non-interactive
|
|
16
|
+
|
|
17
|
+
Pass flags to skip the prompts (useful in CI):
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm create partylayer-app@latest my-app -- --template react-vite --pm npm
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
| Flag | Description |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| `<dir>` | Target directory (positional) |
|
|
26
|
+
| `-t, --template <id>` | Template to use (`react-vite`) |
|
|
27
|
+
| `--pm <manager>` | `npm` \| `pnpm` \| `yarn` |
|
|
28
|
+
| `--no-install` | Skip dependency install |
|
|
29
|
+
| `--no-git` | Skip git init |
|
|
30
|
+
| `-h, --help` | Show help |
|
|
31
|
+
|
|
32
|
+
## Templates
|
|
33
|
+
|
|
34
|
+
| Template | Stack |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| `react-vite` | React 18 + Vite + zero-config `PartyLayerKit` |
|
|
37
|
+
|
|
38
|
+
More templates (Next SSR, Vue/Nuxt/Pinia, Vanilla) are on the way.
|
|
39
|
+
|
|
40
|
+
## License
|
|
41
|
+
|
|
42
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-partylayer-app",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Scaffold a PartyLayer dApp (Canton wallet integration) in seconds.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"create-partylayer-app": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"templates"
|
|
13
|
+
],
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@clack/prompts": "1.5.1",
|
|
16
|
+
"mri": "1.2.0",
|
|
17
|
+
"picocolors": "1.1.1"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/node": "^20.11.0",
|
|
21
|
+
"typescript": "^5.3.3"
|
|
22
|
+
},
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=18"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/PartyLayer/PartyLayer.git",
|
|
29
|
+
"directory": "packages/create-partylayer-app"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://github.com/PartyLayer/PartyLayer/tree/main/packages/create-partylayer-app",
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/PartyLayer/PartyLayer/issues"
|
|
34
|
+
},
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"keywords": [
|
|
37
|
+
"partylayer",
|
|
38
|
+
"canton",
|
|
39
|
+
"wallet",
|
|
40
|
+
"create",
|
|
41
|
+
"scaffold",
|
|
42
|
+
"cli",
|
|
43
|
+
"dapp",
|
|
44
|
+
"starter"
|
|
45
|
+
],
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsc",
|
|
48
|
+
"clean": "rm -rf dist"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
A [PartyLayer](https://partylayer.xyz) dApp — React + Vite, with Canton wallet integration.
|
|
4
|
+
|
|
5
|
+
## Develop
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm run dev
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Open the app and click **Connect Wallet** — the modal lists every verified Canton wallet from the registry.
|
|
12
|
+
|
|
13
|
+
## How it's wired
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { PartyLayerKit, ConnectButton } from '@partylayer/react';
|
|
17
|
+
|
|
18
|
+
<PartyLayerKit network="devnet" appName="{{PROJECT_NAME}}">
|
|
19
|
+
<ConnectButton />
|
|
20
|
+
</PartyLayerKit>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`<PartyLayerKit>` creates the client, registers all built-in wallet adapters, and provides session context. `<ConnectButton>` handles the full connect flow. Read the connected session with `useAccount()`.
|
|
24
|
+
|
|
25
|
+
Switch networks by changing `network` to `"testnet"` or `"mainnet"` in `src/App.tsx`.
|
|
26
|
+
|
|
27
|
+
## Build
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm run build && npm run preview
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Docs
|
|
34
|
+
|
|
35
|
+
- [PartyLayer docs](https://partylayer.xyz/docs/introduction)
|
|
36
|
+
- [@partylayer/react](https://www.npmjs.com/package/@partylayer/react)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{PROJECT_NAME}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "tsc && vite build",
|
|
9
|
+
"preview": "vite preview"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@partylayer/react": "^0.9.1",
|
|
13
|
+
"@partylayer/sdk": "^0.10.0",
|
|
14
|
+
"react": "^18.3.1",
|
|
15
|
+
"react-dom": "^18.3.1"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/react": "^18.3.3",
|
|
19
|
+
"@types/react-dom": "^18.3.0",
|
|
20
|
+
"@vitejs/plugin-react": "^4.3.1",
|
|
21
|
+
"typescript": "^5.6.2",
|
|
22
|
+
"vite": "^5.4.2"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>{{PROJECT_NAME}}</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="root"></div>
|
|
10
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.app {
|
|
2
|
+
min-height: 100vh;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
gap: 16px;
|
|
8
|
+
padding: 24px;
|
|
9
|
+
text-align: center;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.app h1 {
|
|
13
|
+
font-size: 2.5rem;
|
|
14
|
+
margin: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.subtitle {
|
|
18
|
+
margin: 0 0 8px;
|
|
19
|
+
color: rgba(255, 255, 255, 0.6);
|
|
20
|
+
max-width: 32rem;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.session code {
|
|
24
|
+
background: rgba(255, 255, 255, 0.08);
|
|
25
|
+
padding: 2px 8px;
|
|
26
|
+
border-radius: 6px;
|
|
27
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { PartyLayerKit, ConnectButton, useAccount, truncatePartyId } from '@partylayer/react';
|
|
2
|
+
import './App.css';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* <PartyLayerKit> is the zero-config wrapper: pass `network` + `appName` and it
|
|
6
|
+
* creates the PartyLayer client, registers all built-in wallet adapters, and
|
|
7
|
+
* provides the session context. <ConnectButton> renders the full connect flow
|
|
8
|
+
* (wallet modal → connected state) on its own.
|
|
9
|
+
*/
|
|
10
|
+
export default function App() {
|
|
11
|
+
return (
|
|
12
|
+
<PartyLayerKit network="devnet" appName="{{PROJECT_NAME}}">
|
|
13
|
+
<main className="app">
|
|
14
|
+
<h1>{{PROJECT_NAME}}</h1>
|
|
15
|
+
<p className="subtitle">A PartyLayer dApp on Canton — connect any verified wallet.</p>
|
|
16
|
+
<ConnectButton />
|
|
17
|
+
<SessionPanel />
|
|
18
|
+
</main>
|
|
19
|
+
</PartyLayerKit>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Reads the active session and shows the connected party id. */
|
|
24
|
+
function SessionPanel() {
|
|
25
|
+
const { address, isConnected } = useAccount();
|
|
26
|
+
if (!isConnected || !address) return null;
|
|
27
|
+
return (
|
|
28
|
+
<p className="session">
|
|
29
|
+
Connected as <code>{truncatePartyId(address)}</code>
|
|
30
|
+
</p>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"allowImportingTsExtensions": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"jsx": "react-jsx",
|
|
14
|
+
"strict": true,
|
|
15
|
+
"noUnusedLocals": true,
|
|
16
|
+
"noUnusedParameters": true,
|
|
17
|
+
"noFallthroughCasesInSwitch": true
|
|
18
|
+
},
|
|
19
|
+
"include": ["src"]
|
|
20
|
+
}
|