@c7-digital/react 0.0.3 → 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.
Files changed (2) hide show
  1. package/README.md +13 -27
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -77,9 +77,7 @@ function MyComponent() {
77
77
  if (error) return <div>Error: {error.message}</div>;
78
78
 
79
79
  // Filter contracts at the application level
80
- const exampleContracts = contracts.filter(
81
- (contract) => contract.domain === "example.com"
82
- );
80
+ const exampleContracts = contracts.filter(contract => contract.domain === "example.com");
83
81
 
84
82
  return (
85
83
  <div>
@@ -107,8 +105,7 @@ function ApprovalComponent({ contractId }: { contractId: string }) {
107
105
  const handleApprove = async () => {
108
106
  try {
109
107
  await ledger.exercise({
110
- templateId:
111
- "#domain-verification-model:InternetDomainName:VerificationRequest",
108
+ templateId: "#domain-verification-model:InternetDomainName:VerificationRequest",
112
109
  contractId,
113
110
  choice: "AcceptRequest",
114
111
  choiceArgument: {
@@ -123,9 +120,7 @@ function ApprovalComponent({ contractId }: { contractId: string }) {
123
120
  if (loading) return <div>Loading user...</div>;
124
121
  if (error) return <div>Error: {error.message}</div>;
125
122
 
126
- return (
127
- <button onClick={handleApprove}>Approve Request (as {user?.userId})</button>
128
- );
123
+ return <button onClick={handleApprove}>Approve Request (as {user?.userId})</button>;
129
124
  }
130
125
  ```
131
126
 
@@ -176,10 +171,7 @@ interface DamlLedgerProps {
176
171
  Query active contracts for a template.
177
172
 
178
173
  ```tsx
179
- function useQuery<T>(
180
- templateId: string,
181
- options?: QueryOptions
182
- ): QueryResult<T>;
174
+ function useQuery<T>(templateId: string, options?: QueryOptions): QueryResult<T>;
183
175
 
184
176
  interface QueryOptions {
185
177
  autoReload?: boolean;
@@ -220,10 +212,7 @@ interface UserResult {
220
212
  Stream active contracts with real-time updates.
221
213
 
222
214
  ```tsx
223
- function useStreamQuery<T>(
224
- templateId: string,
225
- options?: QueryOptions
226
- ): StreamQueryResult<T>;
215
+ function useStreamQuery<T>(templateId: string, options?: QueryOptions): StreamQueryResult<T>;
227
216
 
228
217
  interface StreamQueryResult<T> extends QueryResult<T> {
229
218
  connected: boolean;
@@ -235,10 +224,7 @@ interface StreamQueryResult<T> extends QueryResult<T> {
235
224
  Stream multiple templates simultaneously.
236
225
 
237
226
  ```tsx
238
- function useStreamQueries<T>(
239
- templateIds: string[],
240
- options?: QueryOptions
241
- ): StreamQueryResult<T>;
227
+ function useStreamQueries<T>(templateIds: string[], options?: QueryOptions): StreamQueryResult<T>;
242
228
  ```
243
229
 
244
230
  #### `useReload()`
@@ -253,13 +239,13 @@ function useReload(): () => void;
253
239
 
254
240
  This package provides a compatible API with `@daml/react` but uses the newer Canton JSON API v2:
255
241
 
256
- | @daml/react | @c7-digital/react | Notes |
257
- | ------------------ | ------------------ | ------------------------------ |
258
- | `DamlLedger` | `DamlLedger` | Same API, different backend |
259
- | `useParty()` | `useParty()` | Identical |
260
- | `useLedger()` | `useLedger()` | Enhanced with typed operations |
261
- | `useQuery()` | `useQuery()` | Improved filtering and caching |
262
- | `useStreamQuery()` | `useStreamQuery()` | Real-time WebSocket updates |
242
+ | @daml/react | @c7-digital/react | Notes |
243
+ | ------------------ | -------------------- | ------------------------------ |
244
+ | `DamlLedger` | `DamlLedger` | Same API, different backend |
245
+ | `useParty()` | `useParty()` | Identical |
246
+ | `useLedger()` | `useLedger()` | Enhanced with typed operations |
247
+ | `useQuery()` | `useQuery()` | Improved filtering and caching |
248
+ | `useStreamQuery()` | `useStreamQuery()` | Real-time WebSocket updates |
263
249
 
264
250
  ## License
265
251
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c7-digital/react",
3
- "version": "0.0.3",
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-digital/ledger": "^0.0.3",
28
+ "@c7-digital/ledger": "^0.0.5",
29
29
  "react": "^18.0.0"
30
30
  },
31
31
  "dependencies": {