@volr/react-ui 0.1.94 → 0.1.96
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 +27 -3
- package/dist/index.cjs +914 -242
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +106 -4
- package/dist/index.d.ts +106 -4
- package/dist/index.js +806 -139
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -46,6 +46,7 @@ Volr provides a simple, Stripe-like payment experience for Web3 applications.
|
|
|
46
46
|
|
|
47
47
|
```tsx
|
|
48
48
|
import { useVolrPay } from '@volr/react-ui';
|
|
49
|
+
// Or from @volr/react if not using UI components
|
|
49
50
|
|
|
50
51
|
function CheckoutButton() {
|
|
51
52
|
const { pay } = useVolrPay();
|
|
@@ -250,20 +251,43 @@ function DepositButton() {
|
|
|
250
251
|
|
|
251
252
|
### useVolrPay
|
|
252
253
|
|
|
253
|
-
Hook for payment operations.
|
|
254
|
+
Hook for payment operations with PaymentModal integration.
|
|
254
255
|
|
|
255
256
|
```tsx
|
|
256
257
|
import { useVolrPay } from '@volr/react-ui';
|
|
257
258
|
|
|
258
259
|
const {
|
|
259
|
-
pay,
|
|
260
|
+
pay, // (options: PayOptions) => Promise<PaymentHandle>
|
|
261
|
+
checkPayment, // (id: string) => Promise<PaymentResult>
|
|
262
|
+
getPaymentHistory, // (options?) => Promise<{ payments, total }>
|
|
263
|
+
isPaymentInProgress // boolean
|
|
264
|
+
} = useVolrPay();
|
|
265
|
+
|
|
266
|
+
// PaymentHandle returned from pay()
|
|
267
|
+
interface PaymentHandle {
|
|
268
|
+
id: string;
|
|
269
|
+
status: PaymentStatus;
|
|
270
|
+
wait: () => Promise<PaymentResult>; // Wait for completion
|
|
271
|
+
cancel: () => Promise<void>; // Cancel (PENDING only)
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### useVolrPaymentApi (Advanced)
|
|
276
|
+
|
|
277
|
+
Headless payment API for advanced use cases (no UI).
|
|
278
|
+
|
|
279
|
+
```tsx
|
|
280
|
+
import { useVolrPaymentApi } from '@volr/react-ui';
|
|
281
|
+
|
|
282
|
+
const {
|
|
283
|
+
createPayment, // (options: PayOptions) => Promise<PaymentResult>
|
|
260
284
|
checkPayment, // (id: string) => Promise<PaymentResult>
|
|
261
285
|
getPaymentHistory, // (options?) => Promise<{ payments, total }>
|
|
262
286
|
updatePaymentToProcessing,// (id, txId) => Promise<PaymentResult>
|
|
263
287
|
cancelPayment, // (id) => Promise<PaymentResult>
|
|
264
288
|
pollPaymentStatus, // (id) => Promise<PaymentResult>
|
|
265
289
|
isLoading, // boolean
|
|
266
|
-
} =
|
|
290
|
+
} = useVolrPaymentApi();
|
|
267
291
|
```
|
|
268
292
|
|
|
269
293
|
### useVolrModal
|