@unifold/ui-react 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 ADDED
@@ -0,0 +1,121 @@
1
+ # @unifold/connect
2
+
3
+ Unifold Connect SDK - Deposit and onramp components for React applications.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @unifold/connect
9
+ # or
10
+ npm install @unifold/connect
11
+ # or
12
+ yarn add @unifold/connect
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ Wrap your app with the `UnifoldProvider`:
18
+
19
+ ```tsx
20
+ import { UnifoldProvider } from "@unifold/connect";
21
+
22
+ function App() {
23
+ return (
24
+ <UnifoldProvider
25
+ config={{
26
+ publishableKey: "your_publishable_key",
27
+ apiUrl: "https://api.unifold.com", // optional
28
+ appName: "Your App Name",
29
+ }}
30
+ >
31
+ <YourApp />
32
+ </UnifoldProvider>
33
+ );
34
+ }
35
+ ```
36
+
37
+ ## Usage
38
+
39
+ Use the `useUnifold` hook to trigger the deposit modal:
40
+
41
+ ```tsx
42
+ import { useUnifold } from "@unifold/connect";
43
+
44
+ function DepositButton() {
45
+ const { beginDeposit } = useUnifold();
46
+
47
+ const handleDeposit = () => {
48
+ beginDeposit({
49
+ userId: "user_123",
50
+ modalTitle: "Deposit USDC",
51
+ destinationChainId: "137", // Polygon
52
+ destinationTokenAddress: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", // USDC on Polygon
53
+ onSuccess: ({ message }) => {
54
+ console.log("Deposit successful!", message);
55
+ },
56
+ onError: ({ message }) => {
57
+ console.error("Deposit failed:", message);
58
+ },
59
+ });
60
+ };
61
+
62
+ return <button onClick={handleDeposit}>Deposit</button>;
63
+ }
64
+ ```
65
+
66
+ ## Components
67
+
68
+ The SDK includes the following components that can also be used directly:
69
+
70
+ - `DepositModal` - The main deposit modal
71
+ - `TransferCrypto` - Crypto transfer component with QR code
72
+ - `BuyWithCard` - Card payment component with onramp providers
73
+ - `CurrencyModal` - Currency selection modal
74
+ - `StyledQRCode` - Styled QR code component
75
+
76
+ ## API
77
+
78
+ The SDK exports all API functions for direct use:
79
+
80
+ ```tsx
81
+ import {
82
+ createEOA,
83
+ queryExecutions,
84
+ getSupportedDepositTokens,
85
+ getMeldQuotes,
86
+ createMeldSession,
87
+ getFiatCurrencies,
88
+ } from "@unifold/connect";
89
+ ```
90
+
91
+ ## Styling
92
+
93
+ The SDK uses Tailwind CSS for styling. Make sure to include the SDK's components in your Tailwind config:
94
+
95
+ ```js
96
+ // tailwind.config.js
97
+ module.exports = {
98
+ content: [
99
+ // ... your paths
100
+ "./node_modules/@unifold/connect/dist/**/*.{js,mjs}",
101
+ ],
102
+ // ... rest of your config
103
+ };
104
+ ```
105
+
106
+ ## Development
107
+
108
+ ```bash
109
+ # Install dependencies
110
+ pnpm install
111
+
112
+ # Build the SDK
113
+ pnpm build
114
+
115
+ # Watch mode
116
+ pnpm dev
117
+ ```
118
+
119
+ ## License
120
+
121
+ MIT
Binary file
Binary file
Binary file
Binary file