@tuwaio/pulsar-react 0.0.6 → 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.
Files changed (2) hide show
  1. package/README.md +25 -15
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -43,24 +43,34 @@ Here is a complete step-by-step example:
43
43
 
44
44
  First, create your vanilla Pulsar store and a reusable, bounded hook to access it. This pattern is recommended by Zustand for type safety and ease of use.
45
45
 
46
- ```tsx
47
- // src/store/pulsar.ts
48
- import { createBoundedUseStore, createPulsarStore } from '@tuwaio/pulsar-core';
46
+ ```ts
47
+ // src/hooks/txTrackingHooks.ts
48
+ import { createBoundedUseStore, createPulsarStore, Transaction } from '@tuwaio/pulsar-core';
49
49
  import { evmAdapter } from '@tuwaio/pulsar-evm';
50
- import { wagmiConfig, chains } from '../configs/wagmi'; // Your wagmi config
51
50
 
52
- // 1. Create the vanilla store instance
53
- const pulsarStore = createPulsarStore({
54
- name: 'my-app-pulsar-storage',
55
- adapter: [evmAdapter(wagmiConfig, chains)],
56
- // ... other configurations
57
- });
51
+ import { appChains, config } from '@/configs/wagmiConfig';
52
+
53
+ const storageName = 'transactions-tracking-storage';
54
+
55
+ export enum TxType {
56
+ example = 'example',
57
+ }
58
+
59
+ type ExampleTx = Transaction & {
60
+ type: TxType.example;
61
+ payload: {
62
+ value: number;
63
+ };
64
+ };
58
65
 
59
- // 2. Create and export the bounded hook for React components
60
- export const usePulsar = createBoundedUseStore(pulsarStore);
66
+ export type TransactionUnion = ExampleTx;
61
67
 
62
- // 3. Export the vanilla store for non-React usage if needed
63
- export default pulsarStore;
68
+ export const usePulsarStore = createBoundedUseStore(
69
+ createPulsarStore<TransactionUnion>({
70
+ name: storageName,
71
+ adapter: evmAdapter(config, appChains),
72
+ }),
73
+ );
64
74
  ```
65
75
 
66
76
  ### Step 2: Initialize the Store in Your App
@@ -72,7 +82,7 @@ Create a small, client-side component that uses the `useInitializeTransactionsPo
72
82
  'use client';
73
83
 
74
84
  import { useInitializeTransactionsPool } from '@tuwaio/pulsar-react';
75
- import { usePulsar } from '../store/pulsar';
85
+ import { usePulsarStore } from '../hooks/txTrackingHooks';
76
86
 
77
87
  export const PulsarInitializer = () => {
78
88
  // Get the initialization function from the store via our custom hook
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuwaio/pulsar-react",
3
- "version": "0.0.6",
3
+ "version": "0.1.0",
4
4
  "private": false,
5
5
  "author": "Oleksandr Tkach",
6
6
  "license": "Apache-2.0",
@@ -38,13 +38,13 @@
38
38
  }
39
39
  ],
40
40
  "peerDependencies": {
41
- "react": ">=19"
41
+ "react": "19.x.x"
42
42
  },
43
43
  "devDependencies": {
44
- "@types/react": "^19.1.12",
45
- "react": "^19.1.1",
44
+ "@types/react": "^19.2.2",
45
+ "react": "^19.2.0",
46
46
  "tsup": "^8.5.0",
47
- "typescript": "^5.9.2"
47
+ "typescript": "^5.9.3"
48
48
  },
49
49
  "scripts": {
50
50
  "start": "tsup src/index.ts --watch",