create-partylayer-app 0.5.3 → 0.6.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/README.md +60 -21
- package/package.json +1 -1
- package/templates/next-ssr/README.md +38 -10
- package/templates/next-ssr/_package.json +3 -3
- package/templates/react-dvp/README.md +8 -2
- package/templates/react-dvp/_package.json +2 -3
- package/templates/react-dvp/src/App.tsx +2 -6
- package/templates/react-tokenization/README.md +10 -4
- package/templates/react-tokenization/_package.json +2 -3
- package/templates/react-tokenization/src/App.tsx +2 -6
- package/templates/react-vite/README.md +11 -3
- package/templates/react-vite/_package.json +2 -2
- package/templates/vanilla/README.md +44 -13
- package/templates/vanilla/_package.json +1 -1
- package/templates/vanilla/src/main.ts +2 -1
- package/templates/vue-nuxt-pinia/README.md +11 -2
- package/templates/vue-nuxt-pinia/_package.json +3 -3
- package/templates/vue-nuxt-pinia/app.vue +1 -0
package/README.md
CHANGED
|
@@ -1,41 +1,80 @@
|
|
|
1
1
|
# create-partylayer-app
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Create a Canton dApp with PartyLayer wallet connectivity, configuration and a working development setup. React starters use the ready-made `ConnectButton` and show **Powered by PartyLayer** by default.
|
|
4
|
+
|
|
5
|
+
## Create an app
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm create partylayer-app@latest my-dapp -- --template react-vite --pm npm
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The CLI creates the directory and installs dependencies. Then:
|
|
4
12
|
|
|
5
13
|
```bash
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
pnpm create partylayer-app
|
|
9
|
-
# or
|
|
10
|
-
yarn create partylayer-app
|
|
14
|
+
cd my-dapp
|
|
15
|
+
npm run dev
|
|
11
16
|
```
|
|
12
17
|
|
|
13
|
-
|
|
18
|
+
For an interactive setup, run `npm create partylayer-app@latest` and choose a directory, template and package manager. pnpm and Yarn are also supported.
|
|
19
|
+
|
|
20
|
+
> This guide covers CLI **0.6.0+** and its coordinated wallet-kit templates. See [release validation](https://github.com/PartyLayer/PartyLayer/blob/main/docs/releasing.md#default-wallet-release-validation) for release status.
|
|
21
|
+
|
|
22
|
+
## Templates
|
|
23
|
+
|
|
24
|
+
| Template | Use it for |
|
|
25
|
+
| --- | --- |
|
|
26
|
+
| `react-vite` | React + Vite with `PartyLayerKit` and the default `ConnectButton` |
|
|
27
|
+
| `next-ssr` | Next.js App Router with a client provider boundary and a cookie-based UI session projection |
|
|
28
|
+
| `vue-nuxt-pinia` | Nuxt + Vue + Pinia with a custom connection UI and PartyLayer attribution |
|
|
29
|
+
| `vanilla` | TypeScript + Vite with the SDK and a custom connection UI |
|
|
30
|
+
| `react-tokenization` | Tokenization UI over an application-owned demo backend |
|
|
31
|
+
| `react-dvp` | Delivery-versus-payment UI over an application-owned demo backend |
|
|
32
|
+
|
|
33
|
+
The vertical templates start with in-memory demo backends. Real ledger mode needs application-owned fetchers and authorization; scaffolding does not deploy a ledger backend. SSR cookies are UI hints, not an authenticated server session. Use backend verification for protected routes.
|
|
14
34
|
|
|
15
|
-
##
|
|
35
|
+
## Existing React application
|
|
16
36
|
|
|
17
|
-
|
|
37
|
+
You can add the kit without creating a new app:
|
|
18
38
|
|
|
19
39
|
```bash
|
|
20
|
-
npm
|
|
40
|
+
npm install @partylayer/react @tanstack/react-query
|
|
21
41
|
```
|
|
22
42
|
|
|
43
|
+
```tsx
|
|
44
|
+
import { PartyLayerKit, ConnectButton } from '@partylayer/react';
|
|
45
|
+
|
|
46
|
+
<PartyLayerKit network="devnet" appName="My dApp">
|
|
47
|
+
<ConnectButton />
|
|
48
|
+
</PartyLayerKit>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Reviewed wallet runtimes come with the kit. Network/channel selection and wallet capabilities control availability. Vala requires Devnet with `channel="beta"`; Send is Mainnet-only in the catalog. WalletConnect requires your project ID and Bron requires OAuth/API configuration. No additional per-wallet package installation is required.
|
|
52
|
+
|
|
53
|
+
## CLI options
|
|
54
|
+
|
|
23
55
|
| Flag | Description |
|
|
24
56
|
| --- | --- |
|
|
25
|
-
| `<dir>` | Target directory
|
|
26
|
-
| `-t, --template <id>` |
|
|
27
|
-
| `--pm <manager>` | `npm
|
|
28
|
-
| `--no-install` |
|
|
29
|
-
| `--no-git` | Skip
|
|
30
|
-
| `-h, --help` |
|
|
57
|
+
| `<dir>` | Target directory; an existing directory must be empty |
|
|
58
|
+
| `-t, --template <id>` | One of the template IDs above |
|
|
59
|
+
| `--pm <manager>` | `npm`, `pnpm` or `yarn` |
|
|
60
|
+
| `--no-install` | Generate files without installing dependencies |
|
|
61
|
+
| `--no-git` | Skip Git initialization |
|
|
62
|
+
| `-h, --help` | Print help |
|
|
31
63
|
|
|
32
|
-
|
|
64
|
+
Provide directory, template and package manager to skip prompts. For example:
|
|
33
65
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
66
|
+
```bash
|
|
67
|
+
npm create partylayer-app@latest my-dapp -- --template next-ssr --pm npm --no-git
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Node.js 18 is the CLI minimum. Follow the generated framework's Node requirements as well; use a supported Node LTS release for new projects.
|
|
71
|
+
|
|
72
|
+
## Next steps
|
|
37
73
|
|
|
38
|
-
|
|
74
|
+
- [Quick start](https://partylayer.xyz/docs/quick-start)
|
|
75
|
+
- [Wallet configuration](https://partylayer.xyz/docs/partylayer-kit)
|
|
76
|
+
- [Authentication](https://partylayer.xyz/docs/authentication)
|
|
77
|
+
- [Transaction lifecycle](https://partylayer.xyz/docs/transaction-lifecycle)
|
|
39
78
|
|
|
40
79
|
## License
|
|
41
80
|
|
package/package.json
CHANGED
|
@@ -1,28 +1,56 @@
|
|
|
1
1
|
# {{PROJECT_NAME}}
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A Canton dApp using Next.js App Router, PartyLayer's default `ConnectButton` and
|
|
4
|
+
explicit cookie-based UI session hints. The connection modal shows **Powered by
|
|
5
|
+
PartyLayer** by default.
|
|
4
6
|
|
|
5
7
|
## Develop
|
|
6
8
|
|
|
9
|
+
The CLI installs dependencies unless `--no-install` was selected. If installation
|
|
10
|
+
was skipped, run `npm install` first.
|
|
11
|
+
|
|
7
12
|
```bash
|
|
8
13
|
npm run dev
|
|
9
14
|
```
|
|
10
15
|
|
|
11
|
-
##
|
|
16
|
+
## Application structure
|
|
17
|
+
|
|
18
|
+
- `app/providers.tsx` is the client boundary. It mounts `QueryClientProvider` and
|
|
19
|
+
`PartyLayerKit` and supplies stable cookie storage through `sessionOptions`.
|
|
20
|
+
- `lib/session.ts` reads the same UI cookie on the server through a Next.js cookie
|
|
21
|
+
adapter. This can render an initial account hint without waiting for browser storage.
|
|
22
|
+
- The default button reads the live session after hydration; wallet restoration still
|
|
23
|
+
requires the SDK's live identity/network checks.
|
|
24
|
+
|
|
25
|
+
**The UI cookie is not authentication or authorization.** Do not protect backend data
|
|
26
|
+
or actions with its party ID. For protected server routes, use a backend challenge,
|
|
27
|
+
independent signature/key verification and a server-managed authenticated session.
|
|
28
|
+
|
|
29
|
+
## Wallet configuration
|
|
30
|
+
|
|
31
|
+
Change `network` in `app/providers.tsx`; keep the application name and any server-side
|
|
32
|
+
network assumptions aligned. The default is Devnet. Runtime dependencies are included;
|
|
33
|
+
no per-wallet installation or registration is needed.
|
|
12
34
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
35
|
+
- Vala: Devnet with `channel="beta"` on `PartyLayerKit`.
|
|
36
|
+
- Send: Mainnet-only in the catalog.
|
|
37
|
+
- WalletConnect: your project ID through a stable `walletConnect` configuration.
|
|
38
|
+
- Bron: your OAuth/API configuration through `bron`.
|
|
39
|
+
- `additionalAdapters` extends the defaults; `adapters` replaces them.
|
|
16
40
|
|
|
17
|
-
|
|
41
|
+
User login/approval and test funding are separate prerequisites. A connection or
|
|
42
|
+
signature does not verify a send/swap outcome.
|
|
18
43
|
|
|
19
44
|
## Build
|
|
20
45
|
|
|
21
46
|
```bash
|
|
22
|
-
npm run build
|
|
47
|
+
npm run build
|
|
48
|
+
npm start
|
|
23
49
|
```
|
|
24
50
|
|
|
25
|
-
##
|
|
51
|
+
## Documentation
|
|
26
52
|
|
|
27
|
-
- [
|
|
28
|
-
- [
|
|
53
|
+
- [Quick start](https://partylayer.xyz/docs/quick-start)
|
|
54
|
+
- [Kit configuration](https://partylayer.xyz/docs/partylayer-kit)
|
|
55
|
+
- [Authentication](https://partylayer.xyz/docs/authentication)
|
|
56
|
+
- [Transaction lifecycle](https://partylayer.xyz/docs/transaction-lifecycle)
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"lint": "next lint"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@partylayer/react": "^
|
|
14
|
-
"@partylayer/sdk": "^0.
|
|
15
|
-
"@partylayer/session": "^1.1.
|
|
13
|
+
"@partylayer/react": "^3.1.0",
|
|
14
|
+
"@partylayer/sdk": "^0.20.0",
|
|
15
|
+
"@partylayer/session": "^1.1.9",
|
|
16
16
|
"@tanstack/react-query": "^5.0.0",
|
|
17
17
|
"next": "^14.2.5",
|
|
18
18
|
"react": "^18.3.1",
|
|
@@ -18,9 +18,8 @@ the request and wrap the query or mutation.
|
|
|
18
18
|
## Run it
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
npm create partylayer-app@latest my-app -- --template react-dvp
|
|
21
|
+
npm create partylayer-app@latest my-app -- --template react-dvp --pm npm
|
|
22
22
|
cd my-app
|
|
23
|
-
npm install
|
|
24
23
|
npm run dev
|
|
25
24
|
```
|
|
26
25
|
|
|
@@ -132,3 +131,10 @@ disclosed contract and choice context types (`TokenDisclosedContract`,
|
|
|
132
131
|
`TokenChoiceContext`, `TokenTransferFactory`, `TokenAllocationFactory`) plus
|
|
133
132
|
`mergeDisclosedContracts` for combining the disclosures of several registry contexts
|
|
134
133
|
into one submission.
|
|
134
|
+
|
|
135
|
+
Wallet SDKs are included. Vala requires Devnet with `channel="beta"`. WalletConnect requires your project id through `walletConnect`; Bron requires OAuth/API configuration through `bron`. No separate wallet SDK installation or registration is needed.
|
|
136
|
+
|
|
137
|
+
The CLI installs dependencies unless `--no-install` was selected. These demo
|
|
138
|
+
backend outcomes do not prove connected-wallet signing or ledger settlement.
|
|
139
|
+
The default connection UI shows **Powered by PartyLayer**; backend authentication
|
|
140
|
+
and live command/settlement verification remain application responsibilities.
|
|
@@ -9,9 +9,8 @@
|
|
|
9
9
|
"preview": "vite preview"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@partylayer/react": "^
|
|
13
|
-
"@partylayer/sdk": "^0.
|
|
14
|
-
"@partylayer/adapter-console": "^0.3.15",
|
|
12
|
+
"@partylayer/react": "^3.1.0",
|
|
13
|
+
"@partylayer/sdk": "^0.20.0",
|
|
15
14
|
"@tanstack/react-query": "^5.0.0",
|
|
16
15
|
"react": "^18.3.1",
|
|
17
16
|
"react-dom": "^18.3.1"
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
themes,
|
|
16
16
|
type SynchronizerOption,
|
|
17
17
|
} from '@partylayer/react';
|
|
18
|
-
import { ConsoleAdapter } from '@partylayer/adapter-console';
|
|
19
18
|
import { DemoProvider } from './context/DemoContext';
|
|
20
19
|
import { demoBackend } from './lib/backend';
|
|
21
20
|
import { PARTIES, PARTY_ORDER } from './lib/fixtures';
|
|
@@ -25,10 +24,7 @@ import { MyAllocations } from './sections/MyAllocations';
|
|
|
25
24
|
import { Holdings } from './sections/Holdings';
|
|
26
25
|
import './App.css';
|
|
27
26
|
|
|
28
|
-
//
|
|
29
|
-
// context. The demo-party switcher, not this connection, drives the section data.
|
|
30
|
-
const ADAPTERS = [new ConsoleAdapter()];
|
|
31
|
-
|
|
27
|
+
// PartyLayerKit uses the public SDK default wallet catalog.
|
|
32
28
|
const SYNCHRONIZERS: SynchronizerOption[] = [
|
|
33
29
|
{ networkId: 'canton:da-devnet', label: 'DevNet' },
|
|
34
30
|
{ networkId: 'canton:da-testnet', label: 'TestNet' },
|
|
@@ -42,7 +38,7 @@ export default function App() {
|
|
|
42
38
|
const theme = mode === 'dark' ? themes.gold.dark : themes.gold.light;
|
|
43
39
|
|
|
44
40
|
return (
|
|
45
|
-
<PartyLayerKit network="devnet" appName="PartyLayer DvP" theme={theme}
|
|
41
|
+
<PartyLayerKit network="devnet" appName="PartyLayer DvP" theme={theme}>
|
|
46
42
|
<DemoProvider value={{ party, setParty, backend: demoBackend, mode }}>
|
|
47
43
|
<div className={'app app-' + mode}>
|
|
48
44
|
<header className="topbar">
|
|
@@ -17,9 +17,8 @@ hooks type the request and wrap the query or mutation.
|
|
|
17
17
|
## Run it
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
npm create partylayer-app@latest my-app -- --template react-tokenization
|
|
20
|
+
npm create partylayer-app@latest my-app -- --template react-tokenization --pm npm
|
|
21
21
|
cd my-app
|
|
22
|
-
npm install
|
|
23
22
|
npm run dev
|
|
24
23
|
```
|
|
25
24
|
|
|
@@ -42,8 +41,8 @@ writes the typed hooks do not cover.
|
|
|
42
41
|
|
|
43
42
|
## Demo flows
|
|
44
43
|
|
|
45
|
-
1. Connect. Click Connect Wallet in the header. The
|
|
46
|
-
the wallet modal
|
|
44
|
+
1. Connect. Click Connect Wallet in the header. The default wallet catalog is included, and
|
|
45
|
+
the wallet modal uses the teal theme. The sections below are driven
|
|
47
46
|
by the demo-party switcher, not the connection.
|
|
48
47
|
2. View holdings with a frozen lock. As Alice, the Holdings card shows two holdings;
|
|
49
48
|
one carries a lock and renders a "Locked: frozen by issuer" badge.
|
|
@@ -137,3 +136,10 @@ registry-defined.
|
|
|
137
136
|
|
|
138
137
|
The official Splice token-standard CLI is the canonical reference for these registry
|
|
139
138
|
flows.
|
|
139
|
+
|
|
140
|
+
Wallet SDKs are included. Vala requires Devnet with `channel="beta"`. WalletConnect requires your project id through `walletConnect`; Bron requires OAuth/API configuration through `bron`. No separate wallet SDK installation or registration is needed.
|
|
141
|
+
|
|
142
|
+
The CLI installs dependencies unless `--no-install` was selected. These demo
|
|
143
|
+
backend outcomes do not prove connected-wallet signing or ledger settlement.
|
|
144
|
+
The default connection UI shows **Powered by PartyLayer**; backend authentication
|
|
145
|
+
and live command/settlement verification remain application responsibilities.
|
|
@@ -9,9 +9,8 @@
|
|
|
9
9
|
"preview": "vite preview"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@partylayer/react": "^
|
|
13
|
-
"@partylayer/sdk": "^0.
|
|
14
|
-
"@partylayer/adapter-console": "^0.3.15",
|
|
12
|
+
"@partylayer/react": "^3.1.0",
|
|
13
|
+
"@partylayer/sdk": "^0.20.0",
|
|
15
14
|
"@tanstack/react-query": "^5.0.0",
|
|
16
15
|
"react": "^18.3.1",
|
|
17
16
|
"react-dom": "^18.3.1"
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
themes,
|
|
16
16
|
type SynchronizerOption,
|
|
17
17
|
} from '@partylayer/react';
|
|
18
|
-
import { ConsoleAdapter } from '@partylayer/adapter-console';
|
|
19
18
|
import { DemoProvider } from './context/DemoContext';
|
|
20
19
|
import { demoBackend } from './lib/backend';
|
|
21
20
|
import { PARTIES, PARTY_ORDER } from './lib/fixtures';
|
|
@@ -27,10 +26,7 @@ import { Issuer } from './sections/Issuer';
|
|
|
27
26
|
import { Allocations } from './sections/Allocations';
|
|
28
27
|
import './App.css';
|
|
29
28
|
|
|
30
|
-
//
|
|
31
|
-
// context. The demo-party switcher, not this connection, drives the section data.
|
|
32
|
-
const ADAPTERS = [new ConsoleAdapter()];
|
|
33
|
-
|
|
29
|
+
// PartyLayerKit uses the public SDK default wallet catalog.
|
|
34
30
|
const SYNCHRONIZERS: SynchronizerOption[] = [
|
|
35
31
|
{ networkId: 'canton:da-devnet', label: 'DevNet' },
|
|
36
32
|
{ networkId: 'canton:da-testnet', label: 'TestNet' },
|
|
@@ -44,7 +40,7 @@ export default function App() {
|
|
|
44
40
|
const theme = mode === 'dark' ? themes.teal.dark : themes.teal.light;
|
|
45
41
|
|
|
46
42
|
return (
|
|
47
|
-
<PartyLayerKit network="devnet" appName="PartyLayer Tokenization" theme={theme}
|
|
43
|
+
<PartyLayerKit network="devnet" appName="PartyLayer Tokenization" theme={theme}>
|
|
48
44
|
<DemoProvider value={{ party, setParty, backend: demoBackend, mode }}>
|
|
49
45
|
<div className={'app app-' + mode}>
|
|
50
46
|
<header className="topbar">
|
|
@@ -4,11 +4,15 @@ A [PartyLayer](https://partylayer.xyz) dApp: React + Vite, with Canton wallet in
|
|
|
4
4
|
|
|
5
5
|
## Develop
|
|
6
6
|
|
|
7
|
+
The CLI installs dependencies unless `--no-install` was selected. If installation
|
|
8
|
+
was skipped, run `npm install` first. The connection modal shows **Powered by PartyLayer**
|
|
9
|
+
by default.
|
|
10
|
+
|
|
7
11
|
```bash
|
|
8
12
|
npm run dev
|
|
9
13
|
```
|
|
10
14
|
|
|
11
|
-
Open the app and click **Connect Wallet**. The modal lists
|
|
15
|
+
Open the app and click **Connect Wallet**. The modal lists supported wallets for the configured network and channel.
|
|
12
16
|
|
|
13
17
|
## How it's wired
|
|
14
18
|
|
|
@@ -20,10 +24,12 @@ import { PartyLayerKit, ConnectButton } from '@partylayer/react';
|
|
|
20
24
|
</PartyLayerKit>
|
|
21
25
|
```
|
|
22
26
|
|
|
23
|
-
`<PartyLayerKit>` creates the client,
|
|
27
|
+
`<PartyLayerKit>` creates the client, loads the supported default wallet catalog, and provides session context. `<ConnectButton>` handles the full connect flow. Read the connected session with `useAccount()`.
|
|
24
28
|
|
|
25
29
|
Switch networks by changing `network` to `"testnet"` or `"mainnet"` in `src/App.tsx`.
|
|
26
30
|
|
|
31
|
+
A wallet session is not backend authentication. Use the [authentication guide](https://partylayer.xyz/docs/authentication) for sign-in and independently verify ledger outcomes for transfers/swaps. Send is Mainnet-only in the catalog.
|
|
32
|
+
|
|
27
33
|
## Build
|
|
28
34
|
|
|
29
35
|
```bash
|
|
@@ -32,5 +38,7 @@ npm run build && npm run preview
|
|
|
32
38
|
|
|
33
39
|
## Docs
|
|
34
40
|
|
|
35
|
-
- [PartyLayer docs](https://partylayer.xyz/docs
|
|
41
|
+
- [PartyLayer docs](https://partylayer.xyz/docs)
|
|
36
42
|
- [@partylayer/react](https://www.npmjs.com/package/@partylayer/react)
|
|
43
|
+
|
|
44
|
+
Wallet SDKs are included. Vala requires Devnet with `channel="beta"`. WalletConnect requires your project id through `walletConnect`; Bron requires OAuth/API configuration through `bron`. No separate wallet SDK installation or registration is needed.
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"preview": "vite preview"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@partylayer/react": "^
|
|
13
|
-
"@partylayer/sdk": "^0.
|
|
12
|
+
"@partylayer/react": "^3.1.0",
|
|
13
|
+
"@partylayer/sdk": "^0.20.0",
|
|
14
14
|
"@tanstack/react-query": "^5.0.0",
|
|
15
15
|
"react": "^18.3.1",
|
|
16
16
|
"react-dom": "^18.3.1"
|
|
@@ -1,36 +1,67 @@
|
|
|
1
1
|
# {{PROJECT_NAME}}
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A Canton dApp using TypeScript, Vite and `@partylayer/sdk`. This template provides
|
|
4
|
+
its own connection UI with **Powered by PartyLayer** attribution. React apps can
|
|
5
|
+
use the ready-made kit and `ConnectButton` instead.
|
|
4
6
|
|
|
5
7
|
## Develop
|
|
6
8
|
|
|
9
|
+
The CLI installs dependencies unless `--no-install` was selected. If needed, run
|
|
10
|
+
`npm install`, then:
|
|
11
|
+
|
|
7
12
|
```bash
|
|
8
13
|
npm run dev
|
|
9
14
|
```
|
|
10
15
|
|
|
11
|
-
## How it
|
|
16
|
+
## How it works
|
|
17
|
+
|
|
18
|
+
`src/main.ts` creates the client, renders its wallet list and handles connection
|
|
19
|
+
from a user click. The SDK includes supported runtimes; no separate wallet package
|
|
20
|
+
installation is required.
|
|
12
21
|
|
|
13
22
|
```ts
|
|
14
23
|
import { createPartyLayer } from '@partylayer/sdk';
|
|
15
24
|
|
|
16
|
-
const client = createPartyLayer({
|
|
25
|
+
const client = createPartyLayer({
|
|
26
|
+
network: 'devnet',
|
|
27
|
+
app: { name: '{{PROJECT_NAME}}' },
|
|
28
|
+
});
|
|
17
29
|
|
|
18
|
-
const wallets = await client.listWallets();
|
|
19
|
-
|
|
20
|
-
client.
|
|
21
|
-
|
|
22
|
-
const active = await client.getActiveSession();
|
|
30
|
+
const wallets = await client.listWallets();
|
|
31
|
+
// Connect the selected entry from a user click handler:
|
|
32
|
+
// await client.connect({ walletId: selectedWallet.walletId });
|
|
33
|
+
|
|
34
|
+
const active = await client.getActiveSession();
|
|
35
|
+
// A saved cache alone never establishes a live connection.
|
|
23
36
|
```
|
|
24
37
|
|
|
25
|
-
|
|
38
|
+
Dispose the application-owned client with `client.destroy()` when its owner is
|
|
39
|
+
removed. Use `client.disconnect()` for an explicit wallet disconnect.
|
|
40
|
+
|
|
41
|
+
## Wallet configuration
|
|
42
|
+
|
|
43
|
+
Change the `createPartyLayer` options in `src/main.ts`:
|
|
44
|
+
|
|
45
|
+
- `network: 'devnet'`, `'testnet'` or `'mainnet'` filters the catalog.
|
|
46
|
+
- Vala requires `network: 'devnet', channel: 'beta'`.
|
|
47
|
+
- Send is Mainnet-only in the catalog.
|
|
48
|
+
- WalletConnect needs `walletConnect: { projectId: 'YOUR_PROJECT_ID' }`.
|
|
49
|
+
- Bron needs application-owned OAuth/API configuration through `bron`.
|
|
50
|
+
- `additionalAdapters` extends defaults; `adapters` replaces them.
|
|
51
|
+
|
|
52
|
+
Wallet accounts, login/approval and test funding remain prerequisites. A returned
|
|
53
|
+
message signature is not proof of a transfer, swap or authenticated backend login.
|
|
26
54
|
|
|
27
55
|
## Build
|
|
28
56
|
|
|
29
57
|
```bash
|
|
30
|
-
npm run build
|
|
58
|
+
npm run build
|
|
59
|
+
npm run preview
|
|
31
60
|
```
|
|
32
61
|
|
|
33
|
-
##
|
|
62
|
+
## Documentation
|
|
34
63
|
|
|
35
|
-
- [
|
|
36
|
-
- [
|
|
64
|
+
- [Framework-independent SDK](https://partylayer.xyz/docs/vanilla-js)
|
|
65
|
+
- [Wallet configuration](https://partylayer.xyz/docs/wallets)
|
|
66
|
+
- [Authentication](https://partylayer.xyz/docs/authentication)
|
|
67
|
+
- [Transaction lifecycle](https://partylayer.xyz/docs/transaction-lifecycle)
|
|
@@ -2,7 +2,7 @@ import { createPartyLayer, type Session } from '@partylayer/sdk';
|
|
|
2
2
|
import './style.css';
|
|
3
3
|
|
|
4
4
|
// The PartyLayer client — the dApp connect API (listWallets / connect / session).
|
|
5
|
-
//
|
|
5
|
+
// The public SDK supplies the supported default wallet catalog.
|
|
6
6
|
const client = createPartyLayer({ network: 'devnet', app: { name: '{{PROJECT_NAME}}' } });
|
|
7
7
|
|
|
8
8
|
const app = document.querySelector<HTMLDivElement>('#app')!;
|
|
@@ -13,6 +13,7 @@ app.innerHTML = `
|
|
|
13
13
|
<div id="status" class="status"></div>
|
|
14
14
|
<button id="connect" class="btn">Connect Wallet</button>
|
|
15
15
|
<ul id="wallets" class="wallets" hidden></ul>
|
|
16
|
+
<p><a href="https://partylayer.xyz" target="_blank" rel="noopener noreferrer">Powered by PartyLayer</a></p>
|
|
16
17
|
</main>
|
|
17
18
|
`;
|
|
18
19
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# {{PROJECT_NAME}}
|
|
2
2
|
|
|
3
|
-
A [PartyLayer](https://partylayer.xyz) dApp: Nuxt 3 + Vue 3 + Pinia, with
|
|
3
|
+
A [PartyLayer](https://partylayer.xyz) dApp: Nuxt 3 + Vue 3 + Pinia, with a custom connection UI, default PartyLayer attribution and explicit SSR UI session hints.
|
|
4
4
|
|
|
5
5
|
## Develop
|
|
6
6
|
|
|
@@ -23,5 +23,14 @@ npm run build && npm run preview
|
|
|
23
23
|
|
|
24
24
|
## Docs
|
|
25
25
|
|
|
26
|
-
- [PartyLayer docs](https://partylayer.xyz/docs
|
|
26
|
+
- [PartyLayer docs](https://partylayer.xyz/docs)
|
|
27
27
|
- [@partylayer/vue composables](https://www.npmjs.com/package/@partylayer/vue)
|
|
28
|
+
|
|
29
|
+
Wallet SDKs are included. Configure the client in `plugins/partylayer.client.ts`:
|
|
30
|
+
Vala needs `network: 'devnet', channel: 'beta'`; Send is Mainnet-only in the catalog.
|
|
31
|
+
WalletConnect needs your project ID through `walletConnect`; Bron needs OAuth/API
|
|
32
|
+
configuration through `bron`. No per-wallet installation is required.
|
|
33
|
+
|
|
34
|
+
The cookie/server session is a UI hint, not application authentication. Never use
|
|
35
|
+
its party ID alone to authorize backend access. See [authentication](https://partylayer.xyz/docs/authentication)
|
|
36
|
+
for backend verification. Wallet login/approval and ledger settlement require their own checks.
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"postinstall": "nuxt prepare"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@partylayer/sdk": "^0.
|
|
14
|
-
"@partylayer/session": "^1.1.
|
|
15
|
-
"@partylayer/vue": "^
|
|
13
|
+
"@partylayer/sdk": "^0.20.0",
|
|
14
|
+
"@partylayer/session": "^1.1.9",
|
|
15
|
+
"@partylayer/vue": "^2.0.1",
|
|
16
16
|
"@pinia/nuxt": "^0.5.5",
|
|
17
17
|
"@tanstack/vue-query": "^5.0.0",
|
|
18
18
|
"pinia": "^2.2.0",
|
|
@@ -33,6 +33,7 @@ const sessionStore = useSessionStore();
|
|
|
33
33
|
<code>{{ truncateParty(sessionStore.party ?? '') }}</code>
|
|
34
34
|
<button class="btn" @click="sessionStore.disconnect()">Disconnect</button>
|
|
35
35
|
</div>
|
|
36
|
+
<p><a href="https://partylayer.xyz" target="_blank" rel="noopener noreferrer">Powered by PartyLayer</a></p>
|
|
36
37
|
</main>
|
|
37
38
|
</template>
|
|
38
39
|
|