@tuwaio/nova-transactions 0.0.27 → 0.1.1

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 CHANGED
@@ -10,48 +10,69 @@ The official React UI component library for the Pulsar transaction engine. It pr
10
10
 
11
11
  ## 🏛️ Architecture
12
12
 
13
- This package provides the **View Layer** for TUWA's transaction tracking ecosystem. It works by consuming the state from your headless Pulsar store and rendering the appropriate UI. You must connect your Pulsar store's state and actions to the `<NovaProvider />` component, which acts as a self-contained UI manager that renders modals and toasts.
13
+ This package provides the **View Layer** for TUWA's transaction tracking ecosystem. It works by consuming the state from your headless Pulsar store and rendering the appropriate UI. You must connect your Pulsar store's state and actions to the `<NovaTransactionsProvider />` component, which acts as a self-contained UI manager that renders modals and toasts.
14
14
 
15
15
  ---
16
16
 
17
17
  ## ✨ Core Features
18
18
 
19
- - **🧩 Pre-built UI Suite:** A set of accessible components including `TrackingTxModal`, `WalletInfoModal`, and `ToastTransaction`, all managed internally by the `NovaProvider`.
19
+ - **🧩 Pre-built UI Suite:** A set of accessible components including `TrackingTxModal`, `TransactionsInfoModal`, and `ToastTransaction`, all managed internally by the `NovaTransactionsProvider`.
20
20
  - **🔌 Plug-and-Play Integration:** Once connected to your Pulsar store, the UI automatically reacts to all transaction state changes.
21
- - **🌐 Internationalization (i18n):** Built-in support for multiple languages with easy overrides for all text content via the `labels` prop.
21
+ - **🌐 Internationalization (custom version of i18n):** Built-in support for multiple languages with easy overrides for all text content via the `labels` prop.
22
22
  - **🎨 Highly Customizable:** Styled with `@tuwaio/nova-core` to be easily themed using CSS variables. Almost every sub-component can be replaced with your own implementation via the `customization` prop.
23
23
 
24
24
  ---
25
25
 
26
26
  ## 💾 Installation
27
27
 
28
- First, install all required packages for the Pulsar & Nova stack.
28
+ ### Basic Installation
29
29
 
30
- Next, you need to install a peer dependencies that `nova-transactions` relies on for UI rendering.
30
+ Install the main package:
31
+ ```bash
32
+ pnpm add @tuwaio/nova-transactions
33
+ ```
34
+ ### Peer Dependencies
31
35
 
36
+ This package requires several peer dependencies for UI rendering:
32
37
  ```bash
33
- # Using pnpm
34
- pnpm add react-toastify framer-motion @radix-ui/react-dialog @heroicons/react @bgd-labs/react-web3-icons @tuwaio/pulsar-core @tuwaio/nova-core dayjs ethereum-blockies-base64 react immer zustand clsx tailwind-merge
38
+ # Core dependencies
39
+ pnpm add @tuwaio/nova-core @tuwaio/pulsar-core @tuwaio/orbit-core
40
+
41
+ # React ecosystem
42
+ pnpm add react react-dom zustand immer
43
+
44
+ # UI libraries
45
+ pnpm add framer-motion @radix-ui/react-dialog @heroicons/react
46
+ pnpm add react-toastify @bgd-labs/react-web3-icons
47
+
48
+ # Utilities
49
+ pnpm add dayjs clsx tailwind-merge
50
+ ```
51
+
52
+ ### Complete Installation (All Packages)
53
+
54
+ For a complete setup with all TUWA packages:
55
+ ```bash
56
+ # Using pnpm (recommended)
57
+ pnpm add @tuwaio/nova-transactions @tuwaio/nova-core @tuwaio/pulsar-core @tuwaio/orbit-core react-toastify framer-motion @radix-ui/react-dialog @heroicons/react @bgd-labs/react-web3-icons dayjs react immer zustand clsx tailwind-merge
35
58
 
36
59
  # Using npm
37
- npm install react-toastify framer-motion @radix-ui/react-dialog @heroicons/react @bgd-labs/react-web3-icons @tuwaio/pulsar-core @tuwaio/nova-core dayjs ethereum-blockies-base64 react immer zustand clsx tailwind-merge
60
+ npm install @tuwaio/nova-transactions @tuwaio/nova-core @tuwaio/pulsar-core @tuwaio/orbit-core react-toastify framer-motion @radix-ui/react-dialog @heroicons/react @bgd-labs/react-web3-icons dayjs react immer zustand clsx tailwind-merge
38
61
 
39
62
  # Using yarn
40
- yarn add react-toastify framer-motion @radix-ui/react-dialog @heroicons/react @bgd-labs/react-web3-icons @tuwaio/pulsar-core @tuwaio/nova-core dayjs ethereum-blockies-base64 react immer zustand clsx tailwind-merge
41
- ````
42
-
43
- -----
63
+ yarn add @tuwaio/nova-transactions @tuwaio/nova-core @tuwaio/pulsar-core @tuwaio/orbit-core react-toastify framer-motion @radix-ui/react-dialog @heroicons/react @bgd-labs/react-web3-icons dayjs react immer zustand clsx tailwind-merge
64
+ ```
65
+ ---
44
66
 
45
67
  ## 🚀 Getting Started
46
68
 
47
- To use this library, you must render the `<NovaProvider />` component at a high level in your application and pass the state and actions from your Pulsar store to it as props.
69
+ To use this library, you must render the `<NovaTransactionsProvider />` component at a high level in your application and pass the state and actions from your Pulsar store to it as props.
48
70
 
49
71
  Here is a complete example of a `src/providers/index.tsx` file that configures the entire system.
50
72
 
73
+ ### 1. Create Transaction Store
51
74
  ```tsx
52
75
  // src/hooks/txTrackingHooks.tsx
53
- 'use client';
54
-
55
76
  import { createBoundedUseStore, createPulsarStore } from '@tuwaio/pulsar-core';
56
77
  import { evmAdapter } from '@tuwaio/pulsar-evm';
57
78
 
@@ -64,62 +85,61 @@ export enum TxType {
64
85
  }
65
86
 
66
87
  type ExampleTx = Transaction & {
67
- type: TxType.example;
68
- payload: {
69
- value: number;
70
- };
88
+ type: TxType.example;
89
+ payload: {
90
+ value: number;
91
+ };
71
92
  };
72
93
 
73
94
  export type TransactionUnion = ExampleTx;
74
95
 
75
96
  export const usePulsarStore = createBoundedUseStore(
76
- createPulsarStore<TransactionUnion>({
77
- name: storageName,
78
- adapter: evmAdapter(config, appChains),
79
- }),
97
+ createPulsarStore<TransactionUnion>({
98
+ name: storageName,
99
+ adapter: evmAdapter(config, appChains),
100
+ }),
80
101
  );
81
102
  ```
82
103
 
104
+ ### 2. Setup Provider Component
83
105
  ```tsx
84
- // src/providers/NovaProvider.tsx
85
- import { NovaProvider as NP } from '@tuwaio/nova-transactions/providers';
106
+ // src/providers/NovaTransactionsProvider.tsx
107
+ import { NovaTransactionsProvider as NP } from '@tuwaio/nova-transactions/providers';
86
108
  import { TransactionAdapter } from '@tuwaio/pulsar-core';
87
109
  import { useInitializeTransactionsPool } from '@tuwaio/pulsar-react';
88
110
  import { useAccount } from 'wagmi';
89
111
 
90
112
  import { usePulsarStore } from '@/hooks/txTrackingHooks';
91
113
 
92
- export function NovaProvider() {
93
- const transactionsPool = usePulsarStore((state) => state.transactionsPool);
94
- const initialTx = usePulsarStore((state) => state.initialTx);
95
- const closeTxTrackedModal = usePulsarStore((state) => state.closeTxTrackedModal);
96
- const handleTransaction = usePulsarStore((state) => state.handleTransaction);
97
- const initializeTransactionsPool = usePulsarStore((state) => state.initializeTransactionsPool);
98
- const getAdapter = usePulsarStore((state) => state.getAdapter);
114
+ export function NovaTransactionsProvider() {
115
+ const transactionsPool = usePulsarStore((state) => state.transactionsPool);
116
+ const initialTx = usePulsarStore((state) => state.initialTx);
117
+ const closeTxTrackedModal = usePulsarStore((state) => state.closeTxTrackedModal);
118
+ const handleTransaction = usePulsarStore((state) => state.handleTransaction);
119
+ const initializeTransactionsPool = usePulsarStore((state) => state.initializeTransactionsPool);
120
+ const getAdapter = usePulsarStore((state) => state.getAdapter);
99
121
 
100
- useInitializeTransactionsPool({ initializeTransactionsPool });
122
+ useInitializeTransactionsPool({ initializeTransactionsPool });
101
123
 
102
- const { address } = useAccount();
124
+ const { address } = useAccount();
103
125
 
104
- return (
126
+ return (
105
127
  <NP
106
- transactionsPool={transactionsPool}
107
- initialTx={initialTx}
108
- closeTxTrackedModal={closeTxTrackedModal}
109
- handleTransaction={handleTransaction}
110
- connectedWalletAddress={address}
111
- connectedAdapterType={TransactionAdapter.EVM}
112
- adapter={getAdapter()}
128
+ transactionsPool={transactionsPool}
129
+ initialTx={initialTx}
130
+ closeTxTrackedModal={closeTxTrackedModal}
131
+ handleTransaction={handleTransaction}
132
+ connectedWalletAddress={address}
133
+ connectedAdapterType={TransactionAdapter.EVM}
134
+ adapter={getAdapter()}
113
135
  />
114
136
  );
115
137
  }
116
138
 
117
139
  ```
118
-
140
+ ### 3. Integrate into App
119
141
  ```tsx
120
142
  // src/providers/index.tsx
121
- 'use client';
122
-
123
143
  import { RainbowKitProvider } from '@rainbow-me/rainbowkit';
124
144
  import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
125
145
  import { ReactNode } from 'react';
@@ -127,52 +147,47 @@ import { WagmiProvider } from 'wagmi';
127
147
 
128
148
  import { config } from '@/configs/wagmiConfig';
129
149
 
130
- import { NovaProvider } from './NovaProvider';
150
+ import { NovaTransactionsProvider } from './NovaTransactionsProvider';
131
151
 
132
152
  const queryClient = new QueryClient();
133
153
 
134
154
  export function Providers({ children }: { children: ReactNode }) {
135
- return (
136
- <WagmiProvider config={config}>
137
- <QueryClientProvider client={queryClient}>
138
- <RainbowKitProvider>
139
- <NovaProvider />
140
- {children}
141
- </RainbowKitProvider>
142
- </QueryClientProvider>
143
- </WagmiProvider>
144
- );
155
+ return (
156
+ <WagmiProvider config={config}>
157
+ <QueryClientProvider client={queryClient}>
158
+ <RainbowKitProvider>
159
+ <NovaTransactionsProvider />
160
+ {children}
161
+ </RainbowKitProvider>
162
+ </QueryClientProvider>
163
+ </WagmiProvider>
164
+ );
145
165
  }
146
166
  ```
147
167
 
148
- ## Customization
168
+ ## 🎨 Customization
149
169
 
150
170
  You can easily override the default English text by passing a `labels` prop, or replace entire components using the `customization` prop.
151
-
152
171
  ```tsx
153
- <NovaProvider
154
- // 1. Override text labels
155
- labels={{
156
- statuses: {
157
- pending: 'In Bearbeitung...',
158
- success: 'Erfolgreich!',
159
- failed: 'Fehlgeschlagen!',
160
- },
172
+ <NovaTransactionsProvider
173
+ // 1. Override text labels
174
+ labels={{
175
+ statuses: {
176
+ pending: 'В обработке...',
177
+ success: 'Успешно!',
178
+ failed: 'Ошибка!',
179
+ },
161
180
  // ... other keys
162
- }}
163
-
164
- // 2. Override a component (e.g., the status badge)
165
- customization={{
166
- components: {
167
- statusBadge: ({ tx }) => <MyCustomBadge status={tx.status} />,
168
- }
169
- }}
170
-
181
+ }}
182
+ customization={{
183
+ components: {
184
+ statusBadge: ({ tx }) => <MyCustomBadge status={tx.status} />,
185
+ }}
186
+ }
171
187
  // ... other required props
172
188
  />
173
189
  ```
174
-
175
- -----
190
+ ---
176
191
 
177
192
  ## 🤝 Contributing & Support
178
193