@lnfi-network/nodeflow-sdk 1.0.0-alpha.0 → 1.0.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.
- package/README.md +153 -206
- package/dist/{SwapController-C-2g6oSP.js → SwapController-DA_d5NeB.js} +1 -1
- package/dist/{add-DDBnz1-Q.js → add-DifHz_4G.js} +1 -1
- package/dist/{all-wallets-XTwjZKGg.js → all-wallets-BxlzanqT.js} +1 -1
- package/dist/{app-store-sCzhkWOo.js → app-store-B1ckGj7Q.js} +1 -1
- package/dist/{apple-C4IG4u61.js → apple-BargtT2E.js} +1 -1
- package/dist/{arrow-bottom-D5KjiSxX.js → arrow-bottom-QB5GvCc_.js} +1 -1
- package/dist/{arrow-bottom-circle-BwWTHJky.js → arrow-bottom-circle-8kYSrM-8.js} +1 -1
- package/dist/{arrow-left-hn1Ftfvb.js → arrow-left-Dzs1Rbzy.js} +1 -1
- package/dist/{arrow-right-CkV03q5Q.js → arrow-right-BUNVWlDg.js} +1 -1
- package/dist/{arrow-top-BFm9X5g1.js → arrow-top-bRBdGbru.js} +1 -1
- package/dist/{bank-BUCrVHdo.js → bank-s_7TtBvp.js} +1 -1
- package/dist/{bin-BKleaahE.js → bin-B1WUs0c9.js} +1 -1
- package/dist/{bitcoin-C7iWQVuy.js → bitcoin-CUGbDpLq.js} +1 -1
- package/dist/{browser-CpOtTIku.js → browser-VIGVYY_p.js} +1 -1
- package/dist/build-info.json +1 -1
- package/dist/{card-CJ3tg2Ri.js → card-DmQHUJPV.js} +1 -1
- package/dist/{ccip-DyUNuvL1.js → ccip-CPTmdqXg.js} +1 -1
- package/dist/{checkmark-CvSC6zeV.js → checkmark-DvWglMSb.js} +1 -1
- package/dist/{checkmark-bold-DyZJqlJ7.js → checkmark-bold-FU2AlWM0.js} +1 -1
- package/dist/{chevron-bottom-T9v1OvPA.js → chevron-bottom-BPUaMqw6.js} +1 -1
- package/dist/{chevron-left-B4I8A8BR.js → chevron-left-Dyep8Ts2.js} +1 -1
- package/dist/{chevron-right-DGcVStvL.js → chevron-right-C89BBiEV.js} +1 -1
- package/dist/{chevron-top-BtD7BPVB.js → chevron-top-B9xFerk2.js} +1 -1
- package/dist/{chrome-store-BTKxY14m.js → chrome-store-D4VFLtlE.js} +1 -1
- package/dist/{circle-DLLZtCBf.js → circle-TvlobjJu.js} +1 -1
- package/dist/{clock-BNIDUPYZ.js → clock-B2y7ZxSe.js} +1 -1
- package/dist/{close-BscNWH3j.js → close-DoHX75lN.js} +1 -1
- package/dist/{coinPlaceholder-JCYCAADZ.js → coinPlaceholder-CegpqgJ_.js} +1 -1
- package/dist/{compass-D7B-kHmZ.js → compass-CvkXw9Ye.js} +1 -1
- package/dist/{copy-DHBc9gJO.js → copy-CmcyvKtf.js} +1 -1
- package/dist/{cursor-DKduK293.js → cursor-Dqn2saTN.js} +1 -1
- package/dist/{cursor-transparent-8DkjrHTm.js → cursor-transparent-BcKWGyIQ.js} +1 -1
- package/dist/{desktop-ChlWl7Ma.js → desktop-CV4gDCvm.js} +1 -1
- package/dist/{disconnect-CML_GEin.js → disconnect-DT7kVc8h.js} +1 -1
- package/dist/{discord-CgAM6i7H.js → discord-TnPWhd9L.js} +1 -1
- package/dist/{email-8mepCwp-.js → email-CVLSnoqA.js} +1 -1
- package/dist/{embedded-wallet-scU49N5X.js → embedded-wallet-B7bkxX6d.js} +1 -1
- package/dist/{ethereum-CA-_7cWX.js → ethereum-BlO8HW9Q.js} +1 -1
- package/dist/{etherscan-B4h2i8Uc.js → etherscan-Cb2onJ7f.js} +1 -1
- package/dist/{exclamation-triangle-ftOWMqSf.js → exclamation-triangle-F1tn2VQf.js} +1 -1
- package/dist/{extension-7iqlSonF.js → extension-DvV90UPL.js} +1 -1
- package/dist/{external-link-DAvuMfW6.js → external-link-BLVu1mX2.js} +1 -1
- package/dist/{facebook-CsyBIxMB.js → facebook-B8IEMQnV.js} +1 -1
- package/dist/{farcaster-DfetCk1r.js → farcaster-DCqoYCyW.js} +1 -1
- package/dist/{filters-CsU-LYSd.js → filters-DPNj5qFO.js} +1 -1
- package/dist/{github-DjxwfOOF.js → github-BEyjHHVl.js} +1 -1
- package/dist/{google--g4VSi6h.js → google-yD_NkIF5.js} +1 -1
- package/dist/{help-circle-BPA985E7.js → help-circle-Bh73yFrh.js} +1 -1
- package/dist/{id-BCUBMri8.js → id-CEf61kBT.js} +1 -1
- package/dist/{image-gYCDO7su.js → image-C5keTJFL.js} +1 -1
- package/dist/{index-DYL5OPkx.js → index--bI0kpnm.js} +1 -1
- package/dist/{index-BEm1bPeX.js → index-2T8jmZ4H.js} +8034 -8225
- package/dist/{index-B9q3HG5u.js → index-DDyu9CC0.js} +1 -1
- package/dist/{index-CRbuhHbe.js → index-DLz210zd.js} +1 -1
- package/dist/{index-CCgAY-U4.js → index-Dw4TPAdD.js} +1 -1
- package/dist/{info-CIaFQJ_e.js → info-B2Bxbc9X.js} +1 -1
- package/dist/{info-circle-BPz5hFQa.js → info-circle-WjqIHBI0.js} +1 -1
- package/dist/{lightbulb-BDmHvdbq.js → lightbulb-Np0q4TTK.js} +1 -1
- package/dist/{mail-DQiXQ-4_.js → mail-bS7BtmPM.js} +1 -1
- package/dist/{mobile-CG_8sNWZ.js → mobile-BuUmOrFL.js} +1 -1
- package/dist/{more-B1H_I3-I.js → more-CoW0Rw4G.js} +1 -1
- package/dist/{network-placeholder-1RWeD7Yp.js → network-placeholder-Di1vVnXI.js} +1 -1
- package/dist/{nftPlaceholder-Cg-f-eaw.js → nftPlaceholder-BjysENlN.js} +1 -1
- package/dist/nodeflow-sdk.es.js +5 -7
- package/dist/{off-DB-2L-AT.js → off-DvWbpwbW.js} +1 -1
- package/dist/{onramp-DI5eQmAC.js → onramp-DQZvzOk0.js} +1 -1
- package/dist/{play-store-DKJRWbqp.js → play-store-D3t2SGfv.js} +1 -1
- package/dist/{plus-By1Ef8nV.js → plus-Q_Cxxwb9.js} +1 -1
- package/dist/{qr-code-DGuZgP-9.js → qr-code-Czh9rE2t.js} +1 -1
- package/dist/{receive-BEsZr88v.js → receive-CTGODmyw.js} +1 -1
- package/dist/{recycle-horizontal-DubwRDbc.js → recycle-horizontal-CC7ZuDye.js} +1 -1
- package/dist/{refresh-Dwfvwy6t.js → refresh-D7UM77lR.js} +1 -1
- package/dist/{reown-logo-oDEjOrqY.js → reown-logo-X-rUROY8.js} +1 -1
- package/dist/{search-DX_QdW9h.js → search-qBfnHa5c.js} +1 -1
- package/dist/{send-Bd5bwLNJ.js → send-DjMkY1wE.js} +3 -3
- package/dist/{send-Dq4B7ftm.js → send-G17ALuGy.js} +1 -1
- package/dist/{socials-BnnwB5_t.js → socials-B2D5v0YI.js} +1 -1
- package/dist/{solana-B7Ds9KBT.js → solana-BJyVpLHP.js} +1 -1
- package/dist/{swapHorizontal-CF6_7qU-.js → swapHorizontal-NYgfySNJ.js} +1 -1
- package/dist/{swapHorizontalBold-C-YFgVbc.js → swapHorizontalBold-B9xaivxd.js} +1 -1
- package/dist/{swapHorizontalMedium-BGOdc8_e.js → swapHorizontalMedium-CkUW7p7U.js} +1 -1
- package/dist/{swapHorizontalRoundedBold-D_vYgwwO.js → swapHorizontalRoundedBold-C9RzJJN4.js} +1 -1
- package/dist/{swapVertical-j2pWqia1.js → swapVertical-DdsQgQvB.js} +1 -1
- package/dist/{swaps-Bh2kuHjL.js → swaps-CeC1ZRzl.js} +3 -3
- package/dist/{telegram-bh_htnzP.js → telegram-DGuecB-v.js} +1 -1
- package/dist/{three-dots-B31D_Ocu.js → three-dots-Hh6lliDO.js} +1 -1
- package/dist/{transactions-Ch56TR3p.js → transactions-C3OGRAxG.js} +1 -1
- package/dist/{twitch-DUloatpE.js → twitch-D_DfaoKJ.js} +1 -1
- package/dist/{twitterIcon-CNo6b91J.js → twitterIcon-1bcBjC4S.js} +1 -1
- package/dist/{ui-C7PJmqHY.js → ui-DDPmFstC.js} +2 -2
- package/dist/{user-DqFnAlKR.js → user-DUjDnNlY.js} +1 -1
- package/dist/{verify-BmaaygAV.js → verify-CpFp9aVw.js} +1 -1
- package/dist/{verify-filled-BwLeEdJj.js → verify-filled-BngATaX_.js} +1 -1
- package/dist/{w3m-modal-BijXCMl6.js → w3m-modal-e3_xcoN3.js} +2 -2
- package/dist/{wallet-DyP6_6JN.js → wallet-DYtG04Ig.js} +1 -1
- package/dist/{wallet-placeholder-BZC82rR0.js → wallet-placeholder-DjvF99d_.js} +1 -1
- package/dist/{walletconnect-DT69luRK.js → walletconnect-BPdXUcUh.js} +1 -1
- package/dist/{warning-circle-CGbg6QZn.js → warning-circle-B52WX_2y.js} +1 -1
- package/dist/{x-BfEtqtAc.js → x-Kr7osYk1.js} +1 -1
- package/dist/{x-mark-CSmIdhvb.js → x-mark-DvO4CYCP.js} +1 -1
- package/package.json +10 -3
package/README.md
CHANGED
|
@@ -1,276 +1,223 @@
|
|
|
1
1
|
# NodeFlow SDK
|
|
2
2
|
|
|
3
|
-
NodeFlow SDK is a React library that enables seamless asset bridging between EVM
|
|
3
|
+
NodeFlow SDK is a powerful React library that enables seamless asset bridging between EVM-compatible blockchains and the Bitcoin Lightning Network. Built with modern web technologies, it provides developers with an easy-to-integrate solution for cross-chain liquidity and payments.
|
|
4
|
+
|
|
5
|
+
### ✨ Features
|
|
6
|
+
|
|
7
|
+
- **Cross-Chain Bridge**: Bridge assets between EVM chains and Lightning Network.
|
|
8
|
+
- **Multi-Chain Support**: Support for Ethereum, Base, BSC, Botanix testnet, and more.
|
|
9
|
+
- **Wallet Integration**: Built-in support for WalletConnect and popular Web3 wallets.
|
|
10
|
+
- **TypeScript Ready**: Full TypeScript support with type definitions.
|
|
11
|
+
- **Responsive Design**: Mobile-first design with responsive UI components.
|
|
12
|
+
- **Real-time Updates**: Live transaction status and balance updates.
|
|
13
|
+
- **Customizable Theme**: Dark theme with customizable styling.
|
|
14
|
+
|
|
15
|
+
### 🔄 Workflows
|
|
16
|
+
|
|
17
|
+
#### 1. Lightning to EVM (Withdraw)
|
|
18
|
+
Used when a user sends BTC via Lightning to receive tokens on an EVM chain.
|
|
19
|
+
|
|
20
|
+
```mermaid
|
|
21
|
+
sequenceDiagram
|
|
22
|
+
participant U as User / App
|
|
23
|
+
participant S as NodeFlow SDK
|
|
24
|
+
participant L as LSP Node
|
|
25
|
+
participant E as EVM Chain
|
|
26
|
+
|
|
27
|
+
U->>S: nodeFlowSend(amount, assetId)
|
|
28
|
+
S->>L: Request Quote & NodeFlow Invoice
|
|
29
|
+
L-->>S: Return LN Invoice
|
|
30
|
+
S->>U: Display Invoice to User
|
|
31
|
+
U->>L: User pays via Lightning Wallet
|
|
32
|
+
L->>E: Trigger Smart Contract Release
|
|
33
|
+
E-->>U: Mint/Transfer Tokens to User
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
#### 2. EVM to Lightning (Deposit)
|
|
37
|
+
Used when a user pays with EVM tokens to receive BTC on a Lightning Invoice.
|
|
38
|
+
|
|
39
|
+
```mermaid
|
|
40
|
+
sequenceDiagram
|
|
41
|
+
participant U as User / App
|
|
42
|
+
participant S as NodeFlow SDK
|
|
43
|
+
participant E as EVM Chain
|
|
44
|
+
participant L as LSP Node
|
|
45
|
+
|
|
46
|
+
U->>S: nodeFlowReceive(invoice, assetId)
|
|
47
|
+
S-->>U: Show detailed quote
|
|
48
|
+
U->>E: Approve & Deposit Tokens
|
|
49
|
+
E-->>L: Lock assets in Contract
|
|
50
|
+
L->>U: Pay User's Lightning Invoice
|
|
51
|
+
```
|
|
4
52
|
|
|
5
|
-
|
|
53
|
+
### 🚀 Quick Start
|
|
6
54
|
|
|
7
|
-
|
|
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
|
|
55
|
+
#### Installation
|
|
12
56
|
|
|
13
|
-
|
|
57
|
+
NodeFlow SDK requires several peer dependencies to be installed in your project:
|
|
14
58
|
|
|
15
59
|
```bash
|
|
16
|
-
|
|
17
|
-
# or
|
|
18
|
-
npm install @lnfi-network/nodeflow-sdk
|
|
60
|
+
npm install nodeflow-sdk wagmi viem @reown/appkit @reown/appkit-adapter-wagmi @tanstack/react-query
|
|
19
61
|
```
|
|
20
62
|
|
|
21
|
-
|
|
63
|
+
### 🧪 Testnet Environment Setup
|
|
22
64
|
|
|
23
|
-
|
|
65
|
+
To help you get started quickly on the **Base Regtest** testnet, use the following configuration:
|
|
24
66
|
|
|
25
67
|
| Item | Value | Description |
|
|
26
68
|
| :--- | :--- | :--- |
|
|
27
|
-
| **Project ID** |
|
|
28
|
-
| **
|
|
29
|
-
| **
|
|
69
|
+
| **Project ID** | `92461524d3cfcb3d78b38b5dbd6a6ce3` | Public demo ID (please use your own for production) |
|
|
70
|
+
| **Env** | `"development"` | Switches to Regtest / Base Sepolia |
|
|
71
|
+
| **Asset ID** | `f7ac99f2c068f1157c787012f50cb043437505c309c6d8685e135cd8481b1e9d` | **USDT** (Taproot Asset) |
|
|
72
|
+
| **Token Address** | `0x616F1207D8BbC71549b8AC41f4797df72EA39297` | **USDT** (Base Regtest) |
|
|
73
|
+
| **Invoice Generator** | [lnexchange](https://devoflnexchange.unift.xyz/) | Generate Regtest invoices for testing |
|
|
30
74
|
|
|
31
|
-
|
|
75
|
+
#### Quick Start Example
|
|
32
76
|
|
|
33
|
-
|
|
77
|
+
Here is a copy-paste ready example for Regtest / Base Sepolia :
|
|
34
78
|
|
|
35
79
|
```jsx
|
|
36
|
-
import
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
useNodeFlowPairs // Hook to get available asset pairs
|
|
42
|
-
} from '@lnfi-network/nodeflow-sdk';
|
|
80
|
+
import React from 'react';
|
|
81
|
+
import { NodeFlowProvider, NodeFlowModal, nodeFlowSend, nodeFlowReceive } from '@lnfi-network/nodeflow-sdk';
|
|
82
|
+
|
|
83
|
+
// Testnet Asset ID for USDT
|
|
84
|
+
const USDT_ASSET_ID = "f7ac99f2c068f1157c787012f50cb043437505c309c6d8685e135cd8481b1e9d";
|
|
43
85
|
|
|
44
86
|
function App() {
|
|
45
87
|
return (
|
|
46
88
|
<NodeFlowProvider
|
|
47
|
-
projectId="
|
|
48
|
-
|
|
89
|
+
projectId="92461524d3cfcb3d78b38b5dbd6a6ce3"
|
|
90
|
+
env="development"
|
|
49
91
|
>
|
|
50
92
|
<NodeFlowModal />
|
|
51
|
-
|
|
52
|
-
|
|
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 */}
|
|
93
|
+
|
|
94
|
+
{/* 1. Lightning to EVM (Withdraw USDT) */}
|
|
65
95
|
<button onClick={() => nodeFlowSend({
|
|
66
|
-
assetId:
|
|
67
|
-
amount:
|
|
68
|
-
|
|
96
|
+
assetId: USDT_ASSET_ID,
|
|
97
|
+
amount: 10000,
|
|
98
|
+
waitConfirm: true,
|
|
99
|
+
onNodeFlowInvoice: (invoice, tx, txUrl) => {
|
|
100
|
+
console.log("Pay this Invoice:", invoice);
|
|
101
|
+
}
|
|
69
102
|
})}>
|
|
70
|
-
Get
|
|
103
|
+
Get USDT on Base Sepolia
|
|
71
104
|
</button>
|
|
72
105
|
|
|
73
|
-
{/* EVM
|
|
106
|
+
{/* 2. EVM to Lightning (Deposit USDT) */}
|
|
74
107
|
<button onClick={() => nodeFlowReceive({
|
|
75
|
-
assetId:
|
|
76
|
-
invoice: "
|
|
77
|
-
onSuccess: (result) => console.log('Paid!', result)
|
|
108
|
+
assetId: USDT_ASSET_ID,
|
|
109
|
+
invoice: "lnbcrt1..." // Get a test invoice from: https://devoflnexchange.unift.xyz/
|
|
78
110
|
})}>
|
|
79
|
-
Pay Invoice
|
|
111
|
+
Pay Lightning Invoice with USDT
|
|
80
112
|
</button>
|
|
81
|
-
</
|
|
113
|
+
</NodeFlowProvider>
|
|
82
114
|
);
|
|
83
115
|
}
|
|
84
116
|
```
|
|
85
117
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
## How It Works
|
|
118
|
+
### 📖 API Reference
|
|
89
119
|
|
|
90
|
-
|
|
120
|
+
#### NodeFlowProvider
|
|
91
121
|
|
|
92
|
-
|
|
122
|
+
Full Provider component with WagmiProvider + AppKit configuration.
|
|
93
123
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
```
|
|
124
|
+
| Prop | Type | Default | Description |
|
|
125
|
+
| :--- | :--- | :--- | :--- |
|
|
126
|
+
| `projectId` | `string` | **Required** | WalletConnect project ID from [cloud.reown.com](https://cloud.reown.com) |
|
|
127
|
+
| `env` | `'production' \| 'development'` | `'production'` | Environment mode. 'development' uses testnets |
|
|
128
|
+
| `metadata` | `object` | `defaultMetadata` | App metadata for WalletConnect |
|
|
129
|
+
| `apiUrl` | `string` | Auto | Backend API URL. Automatically switches based on `env` |
|
|
130
|
+
| `adapter` | `WagmiAdapter` | `null` | Optional custom Wagmi adapter |
|
|
131
|
+
| `networks` | `Array` | Auto | **[NEW]** Custom network list (overrides env default) |
|
|
132
|
+
| `featuredWallets` | `Array<string>` | MetaMask, OKX... | **[NEW]** Featured wallet IDs |
|
|
133
|
+
| `themeMode` | `'dark' \| 'light'` | `'dark'` | **[NEW]** Theme mode |
|
|
122
134
|
|
|
123
|
-
|
|
135
|
+
#### NodeFlowConfig (NEW)
|
|
124
136
|
|
|
125
|
-
|
|
137
|
+
Lightweight config component **without WagmiProvider**. For projects with existing Wagmi setup.
|
|
126
138
|
|
|
139
|
+
```jsx
|
|
140
|
+
// Use when you already have WagmiProvider
|
|
141
|
+
<YourExistingWagmiProvider>
|
|
142
|
+
<NodeFlowConfig env="production" apiUrl="...">
|
|
143
|
+
<NodeFlowModal />
|
|
144
|
+
<YourApp />
|
|
145
|
+
</NodeFlowConfig>
|
|
146
|
+
</YourExistingWagmiProvider>
|
|
127
147
|
```
|
|
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
148
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
| Prop | Type | Required | Description |
|
|
149
|
+
| Prop | Type | Default | Description |
|
|
166
150
|
| :--- | :--- | :--- | :--- |
|
|
167
|
-
| `
|
|
168
|
-
| `apiUrl` | `string` |
|
|
169
|
-
| `themeMode` | `'dark' \| 'light'` |
|
|
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
|
|
151
|
+
| `env` | `'production' \| 'development'` | `'production'` | Environment mode |
|
|
152
|
+
| `apiUrl` | `string` | Auto | Backend API URL |
|
|
153
|
+
| `themeMode` | `'dark' \| 'light'` | `'dark'` | Theme mode |
|
|
179
154
|
|
|
180
|
-
####
|
|
155
|
+
#### nodeFlowSend
|
|
181
156
|
|
|
182
|
-
Lightning
|
|
157
|
+
Bridge assets from **Lightning Network to EVM** chains. **Now returns a Promise!**
|
|
183
158
|
|
|
184
|
-
|
|
|
159
|
+
| Parameter | Type | Description |
|
|
185
160
|
| :--- | :--- | :--- |
|
|
186
|
-
| `assetId` | `string` |
|
|
161
|
+
| `assetId` | `string` | The ID of the asset to bridge |
|
|
187
162
|
| `amount` | `number` | Amount in satoshis |
|
|
188
|
-
| `
|
|
189
|
-
| `
|
|
190
|
-
| `
|
|
163
|
+
| `waitConfirm` | `boolean` | Whether to wait for confirmation (default: `true`) |
|
|
164
|
+
| `onNodeFlowInvoice` | `function` | [Legacy] Callback: `(invoice, tx, txUrl) => void` |
|
|
165
|
+
| `onProgress` | `function` | **[NEW]** Progress callback: `(step, data) => void` |
|
|
166
|
+
| `onSuccess` | `function` | **[NEW]** Success callback: `(result) => void` |
|
|
167
|
+
| `onError` | `function` | **[NEW]** Error callback: `(error) => void` |
|
|
168
|
+
| `showModal` | `boolean` | **[NEW]** Show Modal UI (default: `true`) |
|
|
191
169
|
|
|
192
|
-
**Progress
|
|
170
|
+
**Progress Steps**: `'init'` → `'signature'` → `'deposit'` → `'pending'` → `'complete'`
|
|
193
171
|
|
|
194
172
|
```javascript
|
|
173
|
+
// NEW: Promise-based API with callbacks
|
|
195
174
|
const result = await nodeFlowSend({
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
onProgress: (step) => console.log(
|
|
199
|
-
onSuccess: (result) => console.log(
|
|
175
|
+
amount: 10000,
|
|
176
|
+
assetId: "...",
|
|
177
|
+
onProgress: (step, data) => console.log(`Step: ${step}`, data),
|
|
178
|
+
onSuccess: (result) => console.log("Success!", result),
|
|
179
|
+
onError: (error) => console.error("Error:", error),
|
|
200
180
|
});
|
|
201
181
|
```
|
|
202
182
|
|
|
203
|
-
####
|
|
183
|
+
#### nodeFlowReceive
|
|
204
184
|
|
|
205
|
-
EVM
|
|
185
|
+
Bridge assets from **EVM chains to Lightning Network**. **Now returns a Promise!**
|
|
206
186
|
|
|
207
|
-
|
|
|
187
|
+
| Parameter | Type | Description |
|
|
208
188
|
| :--- | :--- | :--- |
|
|
209
|
-
| `assetId` | `string` |
|
|
210
|
-
| `invoice` | `string` | Lightning invoice
|
|
211
|
-
| `onProgress` | `(step, data) => void` |
|
|
212
|
-
| `onSuccess` | `(result) => void` |
|
|
213
|
-
| `onError` | `(error) => void` |
|
|
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()`
|
|
189
|
+
| `assetId` | `string` | The ID of the asset to bridge |
|
|
190
|
+
| `invoice` | `string` | The Lightning Network invoice |
|
|
191
|
+
| `onProgress` | `function` | **[NEW]** Progress callback: `(step, data) => void` |
|
|
192
|
+
| `onSuccess` | `function` | **[NEW]** Success callback: `(result) => void` |
|
|
193
|
+
| `onError` | `function` | **[NEW]** Error callback: `(error) => void` |
|
|
194
|
+
| `showModal` | `boolean` | **[NEW]** Show Modal UI (default: `true`) |
|
|
230
195
|
|
|
231
|
-
|
|
196
|
+
**Progress Steps**: `'init'` → `'approve'` → `'deposit'` → `'complete'`
|
|
232
197
|
|
|
233
|
-
|
|
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
|
-
```
|
|
198
|
+
### 🛠️ Technical Stack
|
|
242
199
|
|
|
243
|
-
|
|
200
|
+
- **React 18** - UI library
|
|
201
|
+
- **Wagmi & Viem** - Ethereum hooks & interface
|
|
202
|
+
- **Reown AppKit** - Wallet connection
|
|
203
|
+
- **Ant Design** - UI components (with `nodeflow` prefix)
|
|
204
|
+
- **Zustand** - State management
|
|
244
205
|
|
|
245
|
-
|
|
206
|
+
### 📄 License
|
|
246
207
|
|
|
247
|
-
|
|
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
|
-
```
|
|
208
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
255
209
|
|
|
256
210
|
---
|
|
257
211
|
|
|
258
|
-
|
|
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';
|
|
212
|
+
### 🔄 Changelog
|
|
264
213
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
214
|
+
#### v1.0.0
|
|
215
|
+
- Renamed to `nodeflow-sdk`
|
|
216
|
+
- Rebranded API from Astra to NodeFlow
|
|
217
|
+
- Official release
|
|
218
|
+
- Added comprehensive environment configuration support
|
|
219
|
+
- Updated API callback signatures
|
|
271
220
|
|
|
272
221
|
---
|
|
273
222
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
MIT
|
|
223
|
+
Built with ❤️ by the NodeFlow Labs team
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as l, L as G, M as O, R as f, S as g, O as E, P as S, Q as U, T as D, U as B, V as P, X as b, Y as M, Z as C, _ as z, $ as R, a0 as V, a1 as x, a2 as H, a3 as $, a4 as Q, a5 as q } from "./index-
|
|
1
|
+
import { N as l, L as G, M as O, R as f, S as g, O as E, P as S, Q as U, T as D, U as B, V as P, X as b, Y as M, Z as C, _ as z, $ as R, a0 as V, a1 as x, a2 as H, a3 as $, a4 as Q, a5 as q } from "./index-2T8jmZ4H.js";
|
|
2
2
|
const I = {
|
|
3
3
|
getGasPriceInEther(n, t) {
|
|
4
4
|
const o = t * n;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as C } from "./index-
|
|
1
|
+
import { D as C } from "./index-2T8jmZ4H.js";
|
|
2
2
|
const o = C`<svg viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.90029 1.71429C4.09883 0.736183 4.96358 0 6.00028 0C7.03698 0 7.90173 0.736183 8.10027 1.71429H9.41533C9.42361 1.71417 9.4319 1.71417 9.44022 1.71429H10.286C10.7594 1.71429 11.1431 2.09804 11.1431 2.57143C11.1431 3.04482 10.7594 3.42857 10.286 3.42857H10.1855L9.73675 7.01877C9.6785 7.48493 9.6279 7.88983 9.55601 8.22075C9.47948 8.57304 9.36472 8.91574 9.13613 9.22925C8.91553 9.53181 8.63151 9.78254 8.30392 9.96392C7.96448 10.1519 7.61019 10.2232 7.25112 10.2555C6.91385 10.2858 6.50581 10.2857 6.03603 10.2857H5.96453C5.49475 10.2857 5.08671 10.2858 4.74944 10.2555C4.39037 10.2232 4.03608 10.1519 3.69664 9.96392C3.36905 9.78254 3.08503 9.53181 2.86442 9.22925C2.63583 8.91574 2.52108 8.57304 2.44455 8.22075C2.37266 7.88984 2.32206 7.48496 2.26382 7.0188L1.81504 3.42857H1.71456C1.24118 3.42857 0.857422 3.04482 0.857422 2.57143C0.857422 2.09804 1.24118 1.71429 1.71456 1.71429H2.56034C2.56866 1.71417 2.57695 1.71417 2.58522 1.71429H3.90029ZM3.54266 3.42857L3.96043 6.77068C4.02441 7.2825 4.06617 7.61016 4.11976 7.85681C4.17051 8.09045 4.21726 8.17492 4.2496 8.21928C4.32314 8.32013 4.41781 8.4037 4.52701 8.46416C4.57504 8.49076 4.66465 8.52666 4.90278 8.54805C5.15417 8.57063 5.48448 8.57143 6.00028 8.57143C6.51608 8.57143 6.84638 8.57063 7.09778 8.54805C7.33591 8.52666 7.42552 8.49076 7.47355 8.46416C7.58275 8.4037 7.67742 8.32013 7.75096 8.21928C7.7833 8.17491 7.83005 8.09045 7.8808 7.85681C7.93439 7.61016 7.97615 7.2825 8.04013 6.77068L8.4579 3.42857H3.54266Z" fill="currentColor"/>
|
|
4
4
|
</svg>
|
package/dist/build-info.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.0.0
|
|
1
|
+
{"version":"1.0.0","buildHash":"a3d47ae421cd6246800fe9137a75f611de6f40b8c87a9207c5c7d408f0450cb9","buildTime":"2026-01-27T09:49:14Z"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ab as w, ac as O, ad as F, ae as b, af as E, ag as A, ah as M, ai as N, aj as C, ak as I, al as P, am as R, an as D, ao as y, ap as G, aq as k, ar as T, as as v, at as m, au as H, av as j, aw as U, ax as B, ay as L, az as _ } from "./index-
|
|
1
|
+
import { ab as w, ac as O, ad as F, ae as b, af as E, ag as A, ah as M, ai as N, aj as C, ak as I, al as P, am as R, an as D, ao as y, ap as G, aq as k, ar as T, as as v, at as m, au as H, av as j, aw as U, ax as B, ay as L, az as _ } from "./index-2T8jmZ4H.js";
|
|
2
2
|
class z extends w {
|
|
3
3
|
constructor({ callbackSelector: s, cause: a, data: r, extraData: t, sender: o, urls: n }) {
|
|
4
4
|
var c;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as i } from "./index-
|
|
1
|
+
import { D as i } from "./index-2T8jmZ4H.js";
|
|
2
2
|
const t = i`<svg width="4" height="4" viewBox="0 0 4 4" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<circle cx="2" cy="2" r="2" fill="white" fill-opacity="0.2"/>
|
|
4
4
|
</svg>
|