@chainrails/react 0.0.0 → 0.0.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 +50 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,16 +1,57 @@
|
|
|
1
|
-
# @chainrails/react
|
|
1
|
+
# @chainrails/react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React components and hooks for integrating ChainRails payments and blockchain utilities into your app.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
7
|
+
- **PaymentModal**: Drop-in modal for blockchain payments.
|
|
8
|
+
- **usePaymentModal**: React hook for controlling the modal.
|
|
9
|
+
- **Auto-included styles**: Importing the package automatically loads component CSS.
|
|
10
|
+
- **ChainRails SDK access**: Re-exports ChainRails API and common utilities.
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
## Installation
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
```bash
|
|
15
|
+
npm install @chainrails/react
|
|
16
|
+
# or
|
|
17
|
+
pnpm add @chainrails/react
|
|
18
|
+
```
|
|
13
19
|
|
|
14
|
-
|
|
20
|
+
## Usage
|
|
15
21
|
|
|
16
|
-
|
|
22
|
+
```tsx
|
|
23
|
+
import { PaymentModal, usePaymentModal } from "@chainrails/react"
|
|
24
|
+
|
|
25
|
+
const { isOpen, open, close } = usePaymentModal()
|
|
26
|
+
|
|
27
|
+
<PaymentModal
|
|
28
|
+
to="0xRecipient"
|
|
29
|
+
amount={1.23}
|
|
30
|
+
chain="eth"
|
|
31
|
+
token="usdc"
|
|
32
|
+
isOpen={isOpen}
|
|
33
|
+
open={open}
|
|
34
|
+
close={close}
|
|
35
|
+
complete={() => {/* handle completion */}}
|
|
36
|
+
cancel={() => {/* handle cancel */}}
|
|
37
|
+
chainSelected={() => {/* handle chain select */}}
|
|
38
|
+
intentCreated={() => {/* handle intent */}}
|
|
39
|
+
/>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Style Customization
|
|
43
|
+
|
|
44
|
+
- Default styles are loaded automatically.
|
|
45
|
+
- To override, add your own CSS with higher specificity or import your CSS after this package.
|
|
46
|
+
|
|
47
|
+
## Aliases & Monorepo
|
|
48
|
+
|
|
49
|
+
- The package is aliased as `@chainrails/react` in Vite config for local development.
|
|
50
|
+
- Styles and components are bundled for both dev and production.
|
|
51
|
+
|
|
52
|
+
## Exports
|
|
53
|
+
|
|
54
|
+
- `PaymentModal` — React component for payments
|
|
55
|
+
- `usePaymentModal` — Modal state management hook
|
|
56
|
+
- `chains`, `tokens`, `ChainRails` — Blockchain utilities from `@chainrails/common`
|
|
57
|
+
- `CRAPI` — ChainRails SDK API
|