@tuwaio/pulsar-core 0.1.8 → 0.1.10
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 +31 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,17 +30,17 @@ This package exports one primary factory function: `createPulsarStore`.
|
|
|
30
30
|
|
|
31
31
|
## 💾 Installation
|
|
32
32
|
|
|
33
|
-
This package requires `zustand` and `
|
|
33
|
+
This package requires `zustand`, `immer` and `dayjs` as peer dependencies. You must install them alongside `@tuwaio/pulsar-core`.
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
36
|
# Using pnpm
|
|
37
|
-
pnpm add @tuwaio/pulsar-core zustand immer
|
|
37
|
+
pnpm add @tuwaio/pulsar-core zustand immer dayjs
|
|
38
38
|
|
|
39
39
|
# Using npm
|
|
40
|
-
npm install @tuwaio/pulsar-core zustand immer
|
|
40
|
+
npm install @tuwaio/pulsar-core zustand immer dayjs
|
|
41
41
|
|
|
42
42
|
# Using yarn
|
|
43
|
-
yarn add @tuwaio/pulsar-core zustand immer
|
|
43
|
+
yarn add @tuwaio/pulsar-core zustand immer dayjs
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
---
|
|
@@ -54,23 +54,32 @@ This is the main factory function that creates your transaction store. It takes
|
|
|
54
54
|
#### **Configuration Example**
|
|
55
55
|
|
|
56
56
|
```ts
|
|
57
|
-
import { createPulsarStore } from '@tuwaio/pulsar-core';
|
|
58
|
-
// Example adapter for EVM chains
|
|
57
|
+
import { createBoundedUseStore, createPulsarStore, Transaction } from '@tuwaio/pulsar-core';
|
|
59
58
|
import { evmAdapter } from '@tuwaio/pulsar-evm';
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
|
|
60
|
+
import { appChains, config } from '@/configs/wagmiConfig';
|
|
61
|
+
|
|
62
|
+
const storageName = 'transactions-tracking-storage';
|
|
63
|
+
|
|
64
|
+
export enum TxType {
|
|
65
|
+
example = 'example',
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
type ExampleTx = Transaction & {
|
|
69
|
+
type: TxType.example;
|
|
70
|
+
payload: {
|
|
71
|
+
value: number;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export type TransactionUnion = ExampleTx;
|
|
76
|
+
|
|
77
|
+
export const usePulsarStore = createBoundedUseStore(
|
|
78
|
+
createPulsarStore<TransactionUnion>({
|
|
79
|
+
name: storageName,
|
|
80
|
+
adapter: evmAdapter(config, appChains),
|
|
81
|
+
}),
|
|
82
|
+
);
|
|
74
83
|
```
|
|
75
84
|
|
|
76
85
|
### The Returned Store API
|
|
@@ -98,8 +107,9 @@ The `createPulsarStore` function returns a vanilla Zustand store with the follow
|
|
|
98
107
|
|
|
99
108
|
Pulsar is a modular ecosystem. Here’s how the pieces fit together:
|
|
100
109
|
|
|
101
|
-
- **`@tuwaio/pulsar-core
|
|
110
|
+
- **`@tuwaio/pulsar-core`:** Provides the generic, headless state machine (`createPulsarStore`). It knows _how_ to manage state but doesn't know anything about specific blockchains.
|
|
102
111
|
- **`@tuwaio/pulsar-evm`**: An adapter that plugs into the `adapters` config. It teaches the core store how to interact with EVM chains (e.g., how to check transaction receipts, get wallet info from Wagmi, etc.).
|
|
112
|
+
- **`@tuwaio/pulsar-solana`**: An adapter that plugs into the `adapters` config. It extends the core store to work with the Solana ecosystem, teaching it how to track transactions, get wallet info from `@wallet-ui/react`, and use Solana RPCs.
|
|
103
113
|
- **`@tuwaio/pulsar-react`**: Provides React bindings and hooks (like `useInitializeTransactionsPool`) to easily connect the Pulsar store to your React application's lifecycle.
|
|
104
114
|
|
|
105
115
|
---
|