@lnfi-network/nodeflow-sdk 1.0.0-alpha.0

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 (106) hide show
  1. package/README.md +276 -0
  2. package/dist/SwapController-C-2g6oSP.js +447 -0
  3. package/dist/add-DDBnz1-Q.js +19 -0
  4. package/dist/all-wallets-XTwjZKGg.js +10 -0
  5. package/dist/app-store-sCzhkWOo.js +21 -0
  6. package/dist/apple-C4IG4u61.js +22 -0
  7. package/dist/arrow-bottom-D5KjiSxX.js +12 -0
  8. package/dist/arrow-bottom-circle-BwWTHJky.js +15 -0
  9. package/dist/arrow-left-hn1Ftfvb.js +12 -0
  10. package/dist/arrow-right-CkV03q5Q.js +12 -0
  11. package/dist/arrow-top-BFm9X5g1.js +12 -0
  12. package/dist/bank-BUCrVHdo.js +18 -0
  13. package/dist/bin-BKleaahE.js +8 -0
  14. package/dist/bitcoin-C7iWQVuy.js +17 -0
  15. package/dist/browser-CpOtTIku.js +18 -0
  16. package/dist/build-info.json +1 -0
  17. package/dist/card-CJ3tg2Ri.js +18 -0
  18. package/dist/ccip-DyUNuvL1.js +239 -0
  19. package/dist/checkmark-CvSC6zeV.js +15 -0
  20. package/dist/checkmark-bold-DyZJqlJ7.js +12 -0
  21. package/dist/chevron-bottom-T9v1OvPA.js +12 -0
  22. package/dist/chevron-left-B4I8A8BR.js +12 -0
  23. package/dist/chevron-right-DGcVStvL.js +12 -0
  24. package/dist/chevron-top-BtD7BPVB.js +12 -0
  25. package/dist/chrome-store-BTKxY14m.js +65 -0
  26. package/dist/circle-DLLZtCBf.js +8 -0
  27. package/dist/clock-BNIDUPYZ.js +12 -0
  28. package/dist/close-BscNWH3j.js +12 -0
  29. package/dist/coinPlaceholder-JCYCAADZ.js +12 -0
  30. package/dist/compass-D7B-kHmZ.js +12 -0
  31. package/dist/copy-DHBc9gJO.js +19 -0
  32. package/dist/cursor-DKduK293.js +7 -0
  33. package/dist/cursor-transparent-8DkjrHTm.js +16 -0
  34. package/dist/desktop-ChlWl7Ma.js +13 -0
  35. package/dist/disconnect-CML_GEin.js +12 -0
  36. package/dist/discord-CgAM6i7H.js +21 -0
  37. package/dist/email-8mepCwp-.js +10 -0
  38. package/dist/embedded-wallet-scU49N5X.js +464 -0
  39. package/dist/ethereum-CA-_7cWX.js +14 -0
  40. package/dist/etherscan-B4h2i8Uc.js +10 -0
  41. package/dist/exclamation-triangle-ftOWMqSf.js +8 -0
  42. package/dist/extension-7iqlSonF.js +12 -0
  43. package/dist/external-link-DAvuMfW6.js +12 -0
  44. package/dist/facebook-CsyBIxMB.js +30 -0
  45. package/dist/farcaster-DfetCk1r.js +16 -0
  46. package/dist/filters-CsU-LYSd.js +12 -0
  47. package/dist/font/ClashDisplay-Variable.ttf +0 -0
  48. package/dist/font/ClashDisplay-Variable.woff +0 -0
  49. package/dist/font/ClashDisplay-Variable.woff2 +0 -0
  50. package/dist/github-DjxwfOOF.js +22 -0
  51. package/dist/google--g4VSi6h.js +22 -0
  52. package/dist/help-circle-BPA985E7.js +16 -0
  53. package/dist/id-BCUBMri8.js +16 -0
  54. package/dist/image-gYCDO7su.js +8 -0
  55. package/dist/index-B9q3HG5u.js +709 -0
  56. package/dist/index-BEm1bPeX.js +63547 -0
  57. package/dist/index-CCgAY-U4.js +70 -0
  58. package/dist/index-CRbuhHbe.js +33 -0
  59. package/dist/index-DYL5OPkx.js +1060 -0
  60. package/dist/info-CIaFQJ_e.js +7 -0
  61. package/dist/info-circle-BPz5hFQa.js +16 -0
  62. package/dist/lightbulb-BDmHvdbq.js +7 -0
  63. package/dist/mail-DQiXQ-4_.js +12 -0
  64. package/dist/mobile-CG_8sNWZ.js +13 -0
  65. package/dist/more-B1H_I3-I.js +15 -0
  66. package/dist/network-placeholder-1RWeD7Yp.js +18 -0
  67. package/dist/nftPlaceholder-Cg-f-eaw.js +12 -0
  68. package/dist/nodeflow-sdk.es.js +15 -0
  69. package/dist/off-DB-2L-AT.js +8 -0
  70. package/dist/onramp-DI5eQmAC.js +917 -0
  71. package/dist/play-store-DKJRWbqp.js +36 -0
  72. package/dist/plus-By1Ef8nV.js +17 -0
  73. package/dist/qr-code-DGuZgP-9.js +10 -0
  74. package/dist/receive-BEsZr88v.js +179 -0
  75. package/dist/recycle-horizontal-DubwRDbc.js +13 -0
  76. package/dist/refresh-Dwfvwy6t.js +12 -0
  77. package/dist/reown-logo-oDEjOrqY.js +16 -0
  78. package/dist/search-DX_QdW9h.js +12 -0
  79. package/dist/send-Bd5bwLNJ.js +1039 -0
  80. package/dist/send-Dq4B7ftm.js +19 -0
  81. package/dist/socials-BnnwB5_t.js +589 -0
  82. package/dist/solana-B7Ds9KBT.js +17 -0
  83. package/dist/swapHorizontal-CF6_7qU-.js +12 -0
  84. package/dist/swapHorizontalBold-C-YFgVbc.js +12 -0
  85. package/dist/swapHorizontalMedium-BGOdc8_e.js +20 -0
  86. package/dist/swapHorizontalRoundedBold-D_vYgwwO.js +12 -0
  87. package/dist/swapVertical-j2pWqia1.js +12 -0
  88. package/dist/swaps-Bh2kuHjL.js +1713 -0
  89. package/dist/telegram-bh_htnzP.js +20 -0
  90. package/dist/three-dots-B31D_Ocu.js +9 -0
  91. package/dist/transactions-Ch56TR3p.js +35 -0
  92. package/dist/twitch-DUloatpE.js +22 -0
  93. package/dist/twitterIcon-CNo6b91J.js +10 -0
  94. package/dist/ui-C7PJmqHY.js +812 -0
  95. package/dist/user-DqFnAlKR.js +7 -0
  96. package/dist/verify-BmaaygAV.js +12 -0
  97. package/dist/verify-filled-BwLeEdJj.js +12 -0
  98. package/dist/vite.svg +1 -0
  99. package/dist/w3m-modal-BijXCMl6.js +1041 -0
  100. package/dist/wallet-DyP6_6JN.js +12 -0
  101. package/dist/wallet-placeholder-BZC82rR0.js +18 -0
  102. package/dist/walletconnect-DT69luRK.js +36 -0
  103. package/dist/warning-circle-CGbg6QZn.js +16 -0
  104. package/dist/x-BfEtqtAc.js +16 -0
  105. package/dist/x-mark-CSmIdhvb.js +7 -0
  106. package/package.json +53 -0
package/README.md ADDED
@@ -0,0 +1,276 @@
1
+ # NodeFlow SDK
2
+
3
+ NodeFlow SDK is a React library that enables seamless asset bridging between EVM chains and the Bitcoin Lightning Network.
4
+
5
+ ## Features
6
+
7
+ - **Cross-Chain Bridge**: Bridge assets between EVM chains and Lightning Network
8
+ - **Multi-Chain Support**: Base, BSC, and more
9
+ - **Wallet Integration**: Built-in WalletConnect support
10
+ - **Dynamic Configuration**: Auto-detects supported networks from API
11
+ - **Responsive UI**: Dark theme with customizable modal
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ yarn add @lnfi-network/nodeflow-sdk
17
+ # or
18
+ npm install @lnfi-network/nodeflow-sdk
19
+ ```
20
+
21
+ > Peer dependencies (wagmi, viem, @reown/appkit, etc.) will be installed automatically.
22
+
23
+ ## Configuration
24
+
25
+ | Item | Value | Description |
26
+ | :--- | :--- | :--- |
27
+ | **Project ID** | Get from [WalletConnect](https://cloud.walletconnect.com/) | Required for wallet connection |
28
+ | **Dev API URL** | `<API_BASE_URL>` | Development/Testnet |
29
+ | **Prod API URL** | *(Contact support)* | Production |
30
+
31
+ ---
32
+
33
+ ## Quick Start
34
+
35
+ ```jsx
36
+ import {
37
+ NodeFlowProvider,
38
+ NodeFlowModal,
39
+ nodeFlowSend,
40
+ nodeFlowReceive,
41
+ useNodeFlowPairs // Hook to get available asset pairs
42
+ } from '@lnfi-network/nodeflow-sdk';
43
+
44
+ function App() {
45
+ return (
46
+ <NodeFlowProvider
47
+ projectId="your-walletconnect-project-id"
48
+ apiUrl="<API_BASE_URL>"
49
+ >
50
+ <NodeFlowModal />
51
+ <MyBridgeUI />
52
+ </NodeFlowProvider>
53
+ );
54
+ }
55
+
56
+ function MyBridgeUI() {
57
+ // Get available trading pairs dynamically - no hardcoded asset IDs needed!
58
+ const { pairs, defaultAssetId, isReady } = useNodeFlowPairs();
59
+
60
+ if (!isReady) return <div>Loading...</div>;
61
+
62
+ return (
63
+ <div>
64
+ {/* Lightning → EVM: Get tokens by paying LN invoice */}
65
+ <button onClick={() => nodeFlowSend({
66
+ assetId: defaultAssetId, // Use dynamic asset ID
67
+ amount: 1000, // Amount in sats
68
+ onSuccess: (result) => console.log('Success!', result)
69
+ })}>
70
+ Get Tokens (Pay Lightning)
71
+ </button>
72
+
73
+ {/* EVM → Lightning: Pay LN invoice with tokens */}
74
+ <button onClick={() => nodeFlowReceive({
75
+ assetId: defaultAssetId,
76
+ invoice: "lnbc...", // Lightning invoice to pay
77
+ onSuccess: (result) => console.log('Paid!', result)
78
+ })}>
79
+ Pay Invoice (Use Tokens)
80
+ </button>
81
+ </div>
82
+ );
83
+ }
84
+ ```
85
+
86
+ ---
87
+
88
+ ## How It Works
89
+
90
+ ### Lightning → EVM (Get Tokens)
91
+
92
+ User pays a Lightning invoice to receive EVM tokens.
93
+
94
+ ```
95
+ ┌─────────────────────────────────────────────────────────────────────────────┐
96
+ │ Lightning → EVM (nodeFlowSend) │
97
+ └─────────────────────────────────────────────────────────────────────────────┘
98
+
99
+ User SDK LSP Node
100
+ │ │ │
101
+ │ nodeFlowSend({ │ │
102
+ │ assetId, amount │ │
103
+ │ }) │ │
104
+ ├─────────────────────────────►│ │
105
+ │ │ │
106
+ │ │ Request Quote & Invoice │
107
+ │ ├──────────────────────────────►│
108
+ │ │ ◄── { invoice } │
109
+ │ │ │
110
+ │ Show Invoice QR │ │
111
+ ◄──────────────────────────────│ │
112
+ │ │ │
113
+ │ User pays via LN wallet │ │
114
+ ├──────────────────────────────┼──────────────────────────────►│
115
+ │ │ │
116
+ │ │ LSP releases tokens on-chain │
117
+ │ │ ◄──────────────────────────────
118
+ │ │ │
119
+ │ ✅ Tokens received! │ │
120
+ ◄──────────────────────────────│ │
121
+ ```
122
+
123
+ ### EVM → Lightning (Pay Invoice)
124
+
125
+ User pays a Lightning invoice using their EVM tokens.
126
+
127
+ ```
128
+ ┌─────────────────────────────────────────────────────────────────────────────┐
129
+ │ EVM → Lightning (nodeFlowReceive) │
130
+ └─────────────────────────────────────────────────────────────────────────────┘
131
+
132
+ User SDK LSP Node
133
+ │ │ │
134
+ │ nodeFlowReceive({ │ │
135
+ │ assetId, invoice │ │
136
+ │ }) │ │
137
+ ├─────────────────────────────►│ │
138
+ │ │ │
139
+ │ Show quote & confirm │ │
140
+ ◄──────────────────────────────│ │
141
+ │ │ │
142
+ │ Approve & Deposit tokens │ │
143
+ ├─────────────────────────────►│ │
144
+ │ │ │
145
+ │ │ Lock tokens in contract │
146
+ │ ├──────────────────────────────►│
147
+ │ │ │
148
+ │ │ LSP pays LN invoice │
149
+ │ │ ◄──────────────────────────────
150
+ │ │ │
151
+ │ ✅ Invoice paid! │ │
152
+ ◄──────────────────────────────│ │
153
+ ```
154
+
155
+ ---
156
+
157
+ ## API Reference
158
+
159
+ ### Components
160
+
161
+ #### `<NodeFlowProvider>`
162
+
163
+ Main provider component. Wrap your app with this.
164
+
165
+ | Prop | Type | Required | Description |
166
+ | :--- | :--- | :--- | :--- |
167
+ | `projectId` | `string` | ✅ | WalletConnect Project ID |
168
+ | `apiUrl` | `string` | ✅ | NodeFlow API URL |
169
+ | `themeMode` | `'dark' \| 'light'` | - | Theme mode (default: `'dark'`) |
170
+ | `customNetworks` | `Network[]` | - | Custom network configuration |
171
+
172
+ #### `<NodeFlowModal>`
173
+
174
+ Modal component for transaction UI. Add once inside the provider.
175
+
176
+ ---
177
+
178
+ ### Functions
179
+
180
+ #### `nodeFlowSend(options)`
181
+
182
+ Lightning → EVM: Get tokens by paying a Lightning invoice.
183
+
184
+ | Option | Type | Description |
185
+ | :--- | :--- | :--- |
186
+ | `assetId` | `string` | Asset ID (get from `useNodeFlowPairs`) |
187
+ | `amount` | `number` | Amount in satoshis |
188
+ | `onProgress` | `(step, data) => void` | Progress callback |
189
+ | `onSuccess` | `(result) => void` | Success callback |
190
+ | `onError` | `(error) => void` | Error callback |
191
+
192
+ **Progress steps**: `'init'` → `'signature'` → `'deposit'` → `'pending'` → `'complete'`
193
+
194
+ ```javascript
195
+ const result = await nodeFlowSend({
196
+ assetId: defaultAssetId,
197
+ amount: 1000,
198
+ onProgress: (step) => console.log('Step:', step),
199
+ onSuccess: (result) => console.log('Success:', result),
200
+ });
201
+ ```
202
+
203
+ #### `nodeFlowReceive(options)`
204
+
205
+ EVM → Lightning: Pay a Lightning invoice using tokens.
206
+
207
+ | Option | Type | Description |
208
+ | :--- | :--- | :--- |
209
+ | `assetId` | `string` | Asset ID (get from `useNodeFlowPairs`) |
210
+ | `invoice` | `string` | Lightning invoice to pay |
211
+ | `onProgress` | `(step, data) => void` | Progress callback |
212
+ | `onSuccess` | `(result) => void` | Success callback |
213
+ | `onError` | `(error) => void` | Error callback |
214
+
215
+ **Progress steps**: `'init'` → `'approve'` → `'deposit'` → `'complete'`
216
+
217
+ ```javascript
218
+ const result = await nodeFlowReceive({
219
+ assetId: defaultAssetId,
220
+ invoice: 'lnbc...',
221
+ onSuccess: (result) => console.log('Paid:', result),
222
+ });
223
+ ```
224
+
225
+ ---
226
+
227
+ ### Hooks
228
+
229
+ #### `useNodeFlowPairs()`
230
+
231
+ Get available trading pairs for the current chain.
232
+
233
+ ```javascript
234
+ const {
235
+ pairs, // All available pairs
236
+ defaultAssetId, // First pair's asset ID
237
+ currentPair, // Currently selected pair
238
+ setCurrentPair, // Set current pair
239
+ isReady // Whether pairs are loaded
240
+ } = useNodeFlowPairs();
241
+ ```
242
+
243
+ #### `useNodeFlowState()`
244
+
245
+ Get SDK configuration state.
246
+
247
+ ```javascript
248
+ const {
249
+ supportedChainIds, // Supported chain IDs from backend
250
+ isConfigReady, // Config loaded
251
+ apiUrl, // Current API URL
252
+ targetNetwork // Current network
253
+ } = useNodeFlowState();
254
+ ```
255
+
256
+ ---
257
+
258
+ ## Using NodeFlowConfig (Existing Wagmi Setup)
259
+
260
+ If you already have Wagmi configured in your app, use `NodeFlowConfig` instead:
261
+
262
+ ```jsx
263
+ import { NodeFlowConfig, NodeFlowModal } from '@lnfi-network/nodeflow-sdk';
264
+
265
+ // Inside your existing WagmiProvider
266
+ <NodeFlowConfig apiUrl="<API_BASE_URL>">
267
+ <NodeFlowModal />
268
+ <YourApp />
269
+ </NodeFlowConfig>
270
+ ```
271
+
272
+ ---
273
+
274
+ ## License
275
+
276
+ MIT