@tuwaio/nova-transactions 0.2.5 → 0.2.7
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 +62 -52
- package/dist/{TransactionsInfoModal-6RO18o9e.d.cts → TransactionsInfoModal-DSBueMY4.d.cts} +318 -8
- package/dist/{TransactionsInfoModal-6RO18o9e.d.ts → TransactionsInfoModal-DSBueMY4.d.ts} +318 -8
- package/dist/chunk-DKXUN36U.js +1 -0
- package/dist/chunk-HWS752GS.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +22 -3
- package/dist/index.d.ts +22 -3
- package/dist/index.js +1 -1
- package/dist/providers/index.cjs +1 -1
- package/dist/providers/index.d.cts +2 -2
- package/dist/providers/index.d.ts +2 -2
- package/dist/providers/index.js +1 -1
- package/package.json +8 -8
- package/dist/chunk-2DECUTV3.cjs +0 -15
- package/dist/chunk-2UT35IW2.js +0 -15
package/README.md
CHANGED
|
@@ -16,10 +16,10 @@ This package provides the **View Layer** for TUWA's transaction tracking ecosyst
|
|
|
16
16
|
|
|
17
17
|
## ✨ Core Features
|
|
18
18
|
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
19
|
+
- **🧩 Pre-built UI Suite:** A set of accessible components including `TrackingTxModal`, `TransactionsInfoModal`, and `ToastTransaction`, all managed internally by the `NovaTransactionsProvider`.
|
|
20
|
+
- **🔌 Plug-and-Play Integration:** Once connected to your Pulsar store, the UI automatically reacts to all transaction state changes.
|
|
21
|
+
- **🌐 Internationalization (custom version of i18n):** Built-in support for multiple languages with easy overrides for all text content via the `labels` prop.
|
|
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
|
|
|
@@ -28,12 +28,15 @@ This package provides the **View Layer** for TUWA's transaction tracking ecosyst
|
|
|
28
28
|
### Basic Installation
|
|
29
29
|
|
|
30
30
|
Install the main package:
|
|
31
|
+
|
|
31
32
|
```bash
|
|
32
33
|
pnpm add @tuwaio/nova-transactions
|
|
33
34
|
```
|
|
35
|
+
|
|
34
36
|
### Peer Dependencies
|
|
35
37
|
|
|
36
38
|
This package requires several peer dependencies for UI rendering:
|
|
39
|
+
|
|
37
40
|
```bash
|
|
38
41
|
# Core dependencies
|
|
39
42
|
pnpm add @tuwaio/nova-core @tuwaio/pulsar-core @tuwaio/orbit-core
|
|
@@ -52,6 +55,7 @@ pnpm add dayjs clsx tailwind-merge
|
|
|
52
55
|
### Complete Installation (All Packages)
|
|
53
56
|
|
|
54
57
|
For a complete setup with all TUWA packages:
|
|
58
|
+
|
|
55
59
|
```bash
|
|
56
60
|
# Using pnpm (recommended)
|
|
57
61
|
pnpm add @tuwaio/nova-transactions @tuwaio/nova-core @tuwaio/pulsar-core @tuwaio/orbit-core react-toastify framer-motion @radix-ui/react-dialog @heroicons/react @web3icons/common @web3icons/react dayjs react immer zustand clsx tailwind-merge
|
|
@@ -62,6 +66,7 @@ npm install @tuwaio/nova-transactions @tuwaio/nova-core @tuwaio/pulsar-core @tuw
|
|
|
62
66
|
# Using yarn
|
|
63
67
|
yarn add @tuwaio/nova-transactions @tuwaio/nova-core @tuwaio/pulsar-core @tuwaio/orbit-core react-toastify framer-motion @radix-ui/react-dialog @heroicons/react @web3icons/common @web3icons/react dayjs react immer zustand clsx tailwind-merge
|
|
64
68
|
```
|
|
69
|
+
|
|
65
70
|
---
|
|
66
71
|
|
|
67
72
|
## 🚀 Getting Started
|
|
@@ -71,6 +76,7 @@ To use this library, you must render the `<NovaTransactionsProvider />` componen
|
|
|
71
76
|
Here is a complete example of a `src/providers/index.tsx` file that configures the entire system.
|
|
72
77
|
|
|
73
78
|
### 1. Create Transaction Store
|
|
79
|
+
|
|
74
80
|
```tsx
|
|
75
81
|
// src/hooks/txTrackingHooks.tsx
|
|
76
82
|
import { createBoundedUseStore, createPulsarStore } from '@tuwaio/pulsar-core';
|
|
@@ -85,23 +91,24 @@ export enum TxType {
|
|
|
85
91
|
}
|
|
86
92
|
|
|
87
93
|
type ExampleTx = Transaction & {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
type: TxType.example;
|
|
95
|
+
payload: {
|
|
96
|
+
value: number;
|
|
97
|
+
};
|
|
92
98
|
};
|
|
93
99
|
|
|
94
100
|
export type TransactionUnion = ExampleTx;
|
|
95
101
|
|
|
96
102
|
export const usePulsarStore = createBoundedUseStore(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
103
|
+
createPulsarStore<TransactionUnion>({
|
|
104
|
+
name: storageName,
|
|
105
|
+
adapter: evmAdapter(config, appChains),
|
|
106
|
+
}),
|
|
101
107
|
);
|
|
102
108
|
```
|
|
103
109
|
|
|
104
110
|
### 2. Setup Provider Component
|
|
111
|
+
|
|
105
112
|
```tsx
|
|
106
113
|
// src/providers/NovaTransactionsProvider.tsx
|
|
107
114
|
import { NovaTransactionsProvider as NP } from '@tuwaio/nova-transactions/providers';
|
|
@@ -112,32 +119,33 @@ import { useAccount } from 'wagmi';
|
|
|
112
119
|
import { usePulsarStore } from '@/hooks/txTrackingHooks';
|
|
113
120
|
|
|
114
121
|
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);
|
|
122
|
+
const transactionsPool = usePulsarStore((state) => state.transactionsPool);
|
|
123
|
+
const initialTx = usePulsarStore((state) => state.initialTx);
|
|
124
|
+
const closeTxTrackedModal = usePulsarStore((state) => state.closeTxTrackedModal);
|
|
125
|
+
const handleTransaction = usePulsarStore((state) => state.handleTransaction);
|
|
126
|
+
const initializeTransactionsPool = usePulsarStore((state) => state.initializeTransactionsPool);
|
|
127
|
+
const getAdapter = usePulsarStore((state) => state.getAdapter);
|
|
121
128
|
|
|
122
|
-
useInitializeTransactionsPool({ initializeTransactionsPool });
|
|
129
|
+
useInitializeTransactionsPool({ initializeTransactionsPool });
|
|
123
130
|
|
|
124
|
-
const { address } = useAccount();
|
|
131
|
+
const { address } = useAccount();
|
|
125
132
|
|
|
126
|
-
return (
|
|
133
|
+
return (
|
|
127
134
|
<NP
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
+
transactionsPool={transactionsPool}
|
|
136
|
+
initialTx={initialTx}
|
|
137
|
+
closeTxTrackedModal={closeTxTrackedModal}
|
|
138
|
+
handleTransaction={handleTransaction}
|
|
139
|
+
connectedWalletAddress={address}
|
|
140
|
+
connectedAdapterType={TransactionAdapter.EVM}
|
|
141
|
+
adapter={getAdapter()}
|
|
135
142
|
/>
|
|
136
143
|
);
|
|
137
144
|
}
|
|
138
|
-
|
|
139
145
|
```
|
|
146
|
+
|
|
140
147
|
### 3. Integrate into App
|
|
148
|
+
|
|
141
149
|
```tsx
|
|
142
150
|
// src/providers/index.tsx
|
|
143
151
|
import { RainbowKitProvider } from '@rainbow-me/rainbowkit';
|
|
@@ -152,41 +160,43 @@ import { NovaTransactionsProvider } from './NovaTransactionsProvider';
|
|
|
152
160
|
const queryClient = new QueryClient();
|
|
153
161
|
|
|
154
162
|
export function Providers({ children }: { children: ReactNode }) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
return (
|
|
164
|
+
<WagmiProvider config={config}>
|
|
165
|
+
<QueryClientProvider client={queryClient}>
|
|
166
|
+
<RainbowKitProvider>
|
|
167
|
+
<NovaTransactionsProvider />
|
|
168
|
+
{children}
|
|
169
|
+
</RainbowKitProvider>
|
|
170
|
+
</QueryClientProvider>
|
|
171
|
+
</WagmiProvider>
|
|
172
|
+
);
|
|
165
173
|
}
|
|
166
174
|
```
|
|
167
175
|
|
|
168
176
|
## 🎨 Customization
|
|
169
177
|
|
|
170
178
|
You can easily override the default English text by passing a `labels` prop, or replace entire components using the `customization` prop.
|
|
179
|
+
|
|
171
180
|
```tsx
|
|
172
181
|
<NovaTransactionsProvider
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
182
|
+
// 1. Override text labels
|
|
183
|
+
labels={{
|
|
184
|
+
statuses: {
|
|
185
|
+
pending: 'В обработке...',
|
|
186
|
+
success: 'Успешно!',
|
|
187
|
+
failed: 'Ошибка!',
|
|
188
|
+
},
|
|
180
189
|
// ... other keys
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
}
|
|
190
|
+
}}
|
|
191
|
+
customization={{
|
|
192
|
+
components: {
|
|
193
|
+
statusBadge: ({ tx }) => <MyCustomBadge status={tx.status} />,
|
|
194
|
+
},
|
|
195
|
+
}}
|
|
187
196
|
// ... other required props
|
|
188
197
|
/>
|
|
189
198
|
```
|
|
199
|
+
|
|
190
200
|
---
|
|
191
201
|
|
|
192
202
|
## 🤝 Contributing & Support
|