@c7-digital/react 0.0.4 → 0.0.5
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 +10 -10
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @c7/react
|
|
1
|
+
# @c7-digital/react
|
|
2
2
|
|
|
3
3
|
React hooks for Daml ledger integration using Canton JSON API v2
|
|
4
4
|
|
|
@@ -12,11 +12,11 @@ React hooks for Daml ledger integration using Canton JSON API v2
|
|
|
12
12
|
|
|
13
13
|
## Versioning
|
|
14
14
|
|
|
15
|
-
This package follows the Canton SDK versioning scheme, matching the `@c7/ledger` package it depends on.
|
|
15
|
+
This package follows the Canton SDK versioning scheme, matching the `@c7-digital/ledger` package it depends on.
|
|
16
16
|
|
|
17
17
|
**Current version**: `3.3.0-snapshot.20250507.0`
|
|
18
18
|
|
|
19
|
-
- Versioned to match the Canton SDK and `@c7/ledger` package
|
|
19
|
+
- Versioned to match the Canton SDK and `@c7-digital/ledger` package
|
|
20
20
|
- Ensures compatibility with the specific Canton OpenAPI types
|
|
21
21
|
- When Canton releases a new version, both packages will be updated together
|
|
22
22
|
|
|
@@ -25,7 +25,7 @@ This package follows the Canton SDK versioning scheme, matching the `@c7/ledger`
|
|
|
25
25
|
## Installation
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
pnpm install @c7/react @c7/ledger
|
|
28
|
+
pnpm install @c7-digital/react @c7-digital/ledger
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
## Build Output
|
|
@@ -43,8 +43,8 @@ The library builds to the `dist/` folder with:
|
|
|
43
43
|
Wrap your app with `DamlLedger` provider:
|
|
44
44
|
|
|
45
45
|
```tsx
|
|
46
|
-
import { DamlLedger } from "@c7/react";
|
|
47
|
-
import { Ledger } from "@c7/ledger";
|
|
46
|
+
import { DamlLedger } from "@c7-digital/react";
|
|
47
|
+
import { Ledger } from "@c7-digital/ledger";
|
|
48
48
|
|
|
49
49
|
const ledger = new Ledger({
|
|
50
50
|
baseUrl: "http://localhost:7575",
|
|
@@ -66,7 +66,7 @@ function App() {
|
|
|
66
66
|
Use `useQuery` to fetch active contracts:
|
|
67
67
|
|
|
68
68
|
```tsx
|
|
69
|
-
import { useQuery } from "@c7/react";
|
|
69
|
+
import { useQuery } from "@c7-digital/react";
|
|
70
70
|
|
|
71
71
|
function MyComponent() {
|
|
72
72
|
const { contracts, loading, error, reload } = useQuery(
|
|
@@ -96,7 +96,7 @@ function MyComponent() {
|
|
|
96
96
|
Use `useLedger` to get the ledger instance and `useUser` for the current user information:
|
|
97
97
|
|
|
98
98
|
```tsx
|
|
99
|
-
import { useLedger, useUser } from "@c7/react";
|
|
99
|
+
import { useLedger, useUser } from "@c7-digital/react";
|
|
100
100
|
|
|
101
101
|
function ApprovalComponent({ contractId }: { contractId: string }) {
|
|
102
102
|
const ledger = useLedger();
|
|
@@ -129,7 +129,7 @@ function ApprovalComponent({ contractId }: { contractId: string }) {
|
|
|
129
129
|
Use `useStreamQuery` for live updates:
|
|
130
130
|
|
|
131
131
|
```tsx
|
|
132
|
-
import { useStreamQuery } from "@c7/react";
|
|
132
|
+
import { useStreamQuery } from "@c7-digital/react";
|
|
133
133
|
|
|
134
134
|
function LiveContracts() {
|
|
135
135
|
const { contracts, loading, connected, error } = useStreamQuery(
|
|
@@ -239,7 +239,7 @@ function useReload(): () => void;
|
|
|
239
239
|
|
|
240
240
|
This package provides a compatible API with `@daml/react` but uses the newer Canton JSON API v2:
|
|
241
241
|
|
|
242
|
-
| @daml/react | @c7/react | Notes |
|
|
242
|
+
| @daml/react | @c7-digital/react | Notes |
|
|
243
243
|
| ------------------ | -------------------- | ------------------------------ |
|
|
244
244
|
| `DamlLedger` | `DamlLedger` | Same API, different backend |
|
|
245
245
|
| `useParty()` | `useParty()` | Identical |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c7-digital/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "React hooks for Daml ledger integration using Canton JSON API v2",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"author": "",
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@c7/ledger": "^0.0.
|
|
28
|
+
"@c7-digital/ledger": "^0.0.5",
|
|
29
29
|
"react": "^18.0.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|