@chainrails/react 0.0.1 → 0.0.3

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.
Files changed (2) hide show
  1. package/README.md +22 -17
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -20,23 +20,28 @@ pnpm add @chainrails/react
20
20
  ## Usage
21
21
 
22
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
- />
23
+ import { chains, tokens, PaymentModal, usePaymentModal, ChainRails } from "@chainrails/react"
24
+
25
+ ChainRails.config({ api_key: <ENTER_API_KEY> })
26
+
27
+ function App() {
28
+ const cr = usePaymentModal({
29
+ to: "0x4F41BCf288E718A36c1e6919c2Dfc2E07d51c675",
30
+ amount: 2,
31
+ chain: chains.BASE,
32
+ token: tokens.USDC,
33
+ onSuccess: () => {
34
+ console.log("Payment Successful")
35
+ },
36
+ })
37
+
38
+ return (
39
+ <div>
40
+ <button onClick={cr.open}> Pay </button>
41
+ <PaymentModal {...cr} />
42
+ </div>
43
+ )
44
+ }
40
45
  ```
41
46
 
42
47
  ## Style Customization
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chainrails/react",
3
3
  "sideEffects": false,
4
- "version": "0.0.01",
4
+ "version": "0.0.3",
5
5
  "description": "",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -23,7 +23,7 @@
23
23
  "main": "./dist/chainrails-sdk.umd.js",
24
24
  "module": "./dist/chainrails-sdk.es.mjs",
25
25
  "source": "./src/index.ts",
26
- "types": "./dist/react/src/index.d.ts",
26
+ "types": "./dist/index.d.ts",
27
27
  "peerDependencies": {
28
28
  "react": "^18.2.0 || ^19.0.0",
29
29
  "react-dom": "^18.2.0 || ^19.0.0"
@@ -33,7 +33,7 @@
33
33
  ],
34
34
  "exports": {
35
35
  ".": {
36
- "types": "./dist/react/src/index.d.ts",
36
+ "types": "./dist/index.d.ts",
37
37
  "import": "./dist/chainrails-sdk.es.mjs",
38
38
  "require": "./dist/chainrails-sdk.umd.js"
39
39
  },
@@ -51,8 +51,8 @@
51
51
  "typescript": "^5.9.0-beta"
52
52
  },
53
53
  "dependencies": {
54
- "@chainrails/sdk": "workspace:*",
55
- "@chainrails/common": "workspace:*",
54
+ "@chainrails/common": "^0.0.2",
55
+ "@chainrails/sdk": "^0.0.1",
56
56
  "@tailwindcss/vite": "^4.1.14",
57
57
  "clsx": "^2.1.1",
58
58
  "dotenv": "^17.2.3",