astra-modal-test 1.0.10 → 1.0.12
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 +206 -134
- package/dist/{SwapController-DyormRqe.js → SwapController-mYFErPzx.js} +1 -1
- package/dist/{add-C1zIRxeS.js → add-CXtFvysR.js} +1 -1
- package/dist/{all-wallets-5a2U9fLw.js → all-wallets-B9fFXw5x.js} +1 -1
- package/dist/{app-store-2IKrZeLe.js → app-store-BXf1yvR8.js} +1 -1
- package/dist/{apple-DH9ESSKX.js → apple-DtcOcX1n.js} +1 -1
- package/dist/{arrow-bottom-BxAPS43J.js → arrow-bottom-BXeLKqSV.js} +1 -1
- package/dist/{arrow-bottom-circle-Cy5Gjca4.js → arrow-bottom-circle-BVUU200N.js} +1 -1
- package/dist/{arrow-left-CBX7JaHB.js → arrow-left-LguJPyNR.js} +1 -1
- package/dist/{arrow-right-G72bt1-M.js → arrow-right-D9kKZzGG.js} +1 -1
- package/dist/{arrow-top-DCkQG0Dq.js → arrow-top-C5JcaCqz.js} +1 -1
- package/dist/{bank-FNxAUs8r.js → bank-DgbCzr0A.js} +1 -1
- package/dist/{bin-B-c2CIPW.js → bin-ykHym2bC.js} +1 -1
- package/dist/{bitcoin-jk4NLDu1.js → bitcoin-B8jzy_uV.js} +1 -1
- package/dist/{browser-D6w0J78l.js → browser-Bk8u8PAA.js} +1 -1
- package/dist/{card-BLWRKU-r.js → card-DcwQMUca.js} +1 -1
- package/dist/ccip-CwJvuExU.js +239 -0
- package/dist/{checkmark-C1pTfaGr.js → checkmark-D3aEYZ8B.js} +1 -1
- package/dist/{checkmark-bold-UzogCu8g.js → checkmark-bold-5H7N-CDG.js} +1 -1
- package/dist/{chevron-bottom-w_rMAO7x.js → chevron-bottom-BA3C4MR1.js} +1 -1
- package/dist/{chevron-left-DGNJGxiP.js → chevron-left-BX18UWKM.js} +1 -1
- package/dist/{chevron-right-VFQCvCyG.js → chevron-right-DG7ovxTe.js} +1 -1
- package/dist/{chevron-top-DVhFmsKp.js → chevron-top-DHfev7lV.js} +1 -1
- package/dist/{chrome-store-BkYX3All.js → chrome-store-BSVzpGdu.js} +1 -1
- package/dist/{circle-B1A3j4eP.js → circle-SYFB9f2-.js} +1 -1
- package/dist/{clock-BKr-VHDU.js → clock-Cygqlf1g.js} +1 -1
- package/dist/{close-BEacRQ8Q.js → close-B43cuuko.js} +1 -1
- package/dist/{coinPlaceholder-0ZwtMAHl.js → coinPlaceholder-BHdR6bKb.js} +1 -1
- package/dist/{compass-pulK-BFi.js → compass-7S6b6wyA.js} +1 -1
- package/dist/{copy-MWCQE0T4.js → copy-CT53bEwd.js} +1 -1
- package/dist/{cursor-transparent-Co_5p0du.js → cursor-transparent-LmjzjsFm.js} +1 -1
- package/dist/{cursor-C2GVfUuM.js → cursor-vtqRnrF7.js} +1 -1
- package/dist/{desktop-C91EoSqM.js → desktop-Doa7TQsq.js} +1 -1
- package/dist/{disconnect-BWg1-rml.js → disconnect-C5G6Ncu_.js} +1 -1
- package/dist/{discord-Bi0Bfa_e.js → discord-DX7Cl3Ko.js} +1 -1
- package/dist/{email-U2WCRPFh.js → email-CyHWh9wL.js} +1 -1
- package/dist/{embedded-wallet-B6P0kU9A.js → embedded-wallet-BZQImi7s.js} +8 -8
- package/dist/{ethereum-BeZyayQW.js → ethereum-Bwvtk5-_.js} +1 -1
- package/dist/{etherscan-BQTsufjv.js → etherscan-CyVRICvw.js} +1 -1
- package/dist/{exclamation-triangle-JT-YKNXX.js → exclamation-triangle-BDbPL3nL.js} +1 -1
- package/dist/{extension-TnYLHoFA.js → extension-Cx3t2k-R.js} +1 -1
- package/dist/{external-link-Dhgai9sc.js → external-link-DZCYpOZI.js} +1 -1
- package/dist/{facebook-C6XFGRDw.js → facebook-BEnPrhG3.js} +1 -1
- package/dist/{farcaster-CvYbxZQq.js → farcaster-DyBPLb_k.js} +1 -1
- package/dist/{filters-DwVRjAav.js → filters-CTwxivn_.js} +1 -1
- package/dist/{github-BVZSx-z9.js → github-kzQb61pT.js} +1 -1
- package/dist/{google-NbJiQLc5.js → google-DSC-rYNu.js} +1 -1
- package/dist/{help-circle-Cum2UOMJ.js → help-circle-C5XfimVx.js} +1 -1
- package/dist/{id-kRR6YgVc.js → id-B9fQOT4E.js} +1 -1
- package/dist/{image-BWUCRAmp.js → image-1CCj36XM.js} +1 -1
- package/dist/{index-RFYbqmu0.js → index-Bjik7E9u.js} +1 -1
- package/dist/{index-DQ5AZLMt.js → index-C1fgrzi0.js} +16 -16
- package/dist/{index-BZZHE-1t.js → index-CyeGBcX0.js} +1 -1
- package/dist/{index-Dq0LIBEh.js → index-DKEMW9N8.js} +25 -25
- package/dist/{index-2vYoun4O.js → index-LucuShOc.js} +45292 -56275
- package/dist/{info-Br-SBtj3.js → info-Begf9tO0.js} +1 -1
- package/dist/{info-circle-Ew4RoR_Q.js → info-circle-Bo1H2OXh.js} +1 -1
- package/dist/{lightbulb-BRBVOE_b.js → lightbulb-C-SU_z2I.js} +1 -1
- package/dist/{mail-Dzi4AncY.js → mail-CXsYiNAT.js} +1 -1
- package/dist/{mobile-BGGxQ5be.js → mobile-C7bUjgog.js} +1 -1
- package/dist/{more-BmNaKbYJ.js → more-29BC-wmy.js} +1 -1
- package/dist/{network-placeholder-EMiMf4q1.js → network-placeholder-B-x3-6jN.js} +1 -1
- package/dist/{nftPlaceholder-CvSqy3Sd.js → nftPlaceholder-pM-Hmswq.js} +1 -1
- package/dist/nodeflow-sdk.es.js +15 -0
- package/dist/{off-DF9uz0Nc.js → off-DEa_uc7_.js} +1 -1
- package/dist/{onramp-cKzTmKku.js → onramp-ZXqyloYt.js} +10 -10
- package/dist/{play-store-CGxW4MgL.js → play-store-WgSEpEI1.js} +1 -1
- package/dist/{plus-CQ6wWkN0.js → plus-u4UZhYAg.js} +1 -1
- package/dist/{qr-code-VBqx9nAF.js → qr-code-DxZGxoPE.js} +1 -1
- package/dist/{receive-CVzkHmKR.js → receive-Ct_mQWzk.js} +1 -1
- package/dist/{recycle-horizontal-Oq1YtvUx.js → recycle-horizontal-BWVpmHJc.js} +1 -1
- package/dist/{refresh-BDlGAzmY.js → refresh-gi4TfgEU.js} +1 -1
- package/dist/{reown-logo-BlIpXIlG.js → reown-logo-Bg731n4w.js} +1 -1
- package/dist/{search-DfmCmp0m.js → search-BQv7DVJG.js} +1 -1
- package/dist/{send-BXudz514.js → send-BzmnFT2p.js} +1 -1
- package/dist/{send-Cz0L5LmE.js → send-CyxKtrQ9.js} +17 -17
- package/dist/{socials-CDOh8MRf.js → socials-vziOn4zi.js} +5 -5
- package/dist/{solana-CbiyOE-8.js → solana-Dz48awbr.js} +1 -1
- package/dist/{swapHorizontal-DyU1TH_e.js → swapHorizontal-Cwe1PoMp.js} +1 -1
- package/dist/{swapHorizontalBold-CGXW7Ocj.js → swapHorizontalBold-Dxu58sRG.js} +1 -1
- package/dist/{swapHorizontalMedium-2KTcj67d.js → swapHorizontalMedium-DOZZthlB.js} +1 -1
- package/dist/{swapHorizontalRoundedBold-TxFtmmda.js → swapHorizontalRoundedBold-BkIZQXnD.js} +1 -1
- package/dist/{swapVertical-BKD6lxM3.js → swapVertical-LSq66ctC.js} +1 -1
- package/dist/{swaps-BuGsEQaI.js → swaps-C2EO6dQA.js} +9 -9
- package/dist/{telegram-CAsl9DeG.js → telegram-ITq9s69Y.js} +1 -1
- package/dist/{three-dots-BoE2aHZi.js → three-dots-JH3A1TFR.js} +1 -1
- package/dist/{transactions-C1NtsnD6.js → transactions-DpMVZVap.js} +1 -1
- package/dist/{twitch-CvkZZxgT.js → twitch-BKs5FlDf.js} +1 -1
- package/dist/{twitterIcon-CrhnOl_O.js → twitterIcon-CCXEj_Nv.js} +1 -1
- package/dist/{ui-BJcuThPA.js → ui-D5ULRvGt.js} +6 -6
- package/dist/{user-BZRWUXG7.js → user-CBgAUjZv.js} +1 -1
- package/dist/{verify-y9F4DcJ4.js → verify-BPlPPkhG.js} +1 -1
- package/dist/{verify-filled-X_8-BhMk.js → verify-filled-qTRg0OWM.js} +1 -1
- package/dist/{w3m-modal-BX--v1Nc.js → w3m-modal-DSdDfy32.js} +27 -27
- package/dist/{wallet-CIaVVkjQ.js → wallet-BuDEi_8z.js} +1 -1
- package/dist/{wallet-placeholder-Cq1ofde1.js → wallet-placeholder-D4DKTuB_.js} +1 -1
- package/dist/{walletconnect-CINzSCJ3.js → walletconnect-Dt3q5XFc.js} +1 -1
- package/dist/{warning-circle-BvBNhMKH.js → warning-circle-B8Fkc0_4.js} +1 -1
- package/dist/{x-xHY7JehW.js → x-Cm_V3zUI.js} +1 -1
- package/dist/{x-mark-DEmnBt6u.js → x-mark-BVvwdxda.js} +1 -1
- package/package.json +11 -10
- package/.github/workflows/code-quality.yml +0 -43
- package/.github/workflows/publish.yml +0 -64
- package/dist/astra-sdk.es.js +0 -9
- package/dist/ccip-DkYvh7hg.js +0 -149
- package/dist/clsx.m-DCYaa4RU.js +0 -20
- package/dist/index-BDE-2VTp.js +0 -315
- package/dist/index-BjLIiJQa.js +0 -21034
- package/dist/index-CIr4zlVp.js +0 -386
- package/dist/index-ChxXyuZj.js +0 -572
- package/dist/index-D-T7kk3G.js +0 -15911
- package/dist/index-DSX3HrTS.js +0 -10785
- package/dist/secp256k1-CsKSDHNi.js +0 -1257
- package/eslint.config.mjs +0 -41
- package/index.html +0 -13
- package/public/font/ClashDisplay-Variable.ttf +0 -0
- package/public/font/ClashDisplay-Variable.woff +0 -0
- package/public/font/ClashDisplay-Variable.woff2 +0 -0
- package/public/vite.svg +0 -1
- package/src/App.css +0 -170
- package/src/apis/lspApi.js +0 -82
- package/src/apis/request.js +0 -59
- package/src/assets/arrow-right.svg +0 -3
- package/src/assets/astr.svg +0 -13
- package/src/assets/bridge-loading.png +0 -0
- package/src/assets/ln.png +0 -0
- package/src/assets/network/Arbitrum.png +0 -0
- package/src/assets/network/Polygon.png +0 -0
- package/src/assets/network/Solana.png +0 -0
- package/src/assets/network/base.png +0 -0
- package/src/assets/network/botanix.png +0 -0
- package/src/assets/network/bsc.svg +0 -13
- package/src/assets/network/eth.png +0 -0
- package/src/assets/network/lighting.png +0 -0
- package/src/assets/network/ligtning.svg +0 -22
- package/src/assets/network/solona.png +0 -0
- package/src/assets/pay.png +0 -0
- package/src/assets/powerby.svg +0 -14
- package/src/assets/react.svg +0 -1
- package/src/assets/success.svg +0 -3
- package/src/assets/tip.svg +0 -5
- package/src/assets/tokens/sol.png +0 -0
- package/src/assets/tokens/usdc.png +0 -0
- package/src/assets/tokens/usdt.png +0 -0
- package/src/comps/AstraImage.jsx +0 -37
- package/src/comps/AstraModal.jsx +0 -202
- package/src/comps/AstraModalLogo.jsx +0 -29
- package/src/comps/AstraNetwork.jsx +0 -261
- package/src/comps/CheckErc20Button.jsx +0 -28
- package/src/comps/CommonStyle.jsx +0 -4
- package/src/comps/ConnectButton.jsx +0 -19
- package/src/comps/EllipsisMiddle.jsx +0 -42
- package/src/comps/ResultModal.jsx +0 -312
- package/src/comps/ToLightning.jsx +0 -653
- package/src/comps/ToToken.jsx +0 -550
- package/src/constants/index.js +0 -21
- package/src/font/ClashDisplay-Variable.ttf +0 -0
- package/src/font/ClashDisplay-Variable.woff +0 -0
- package/src/font/ClashDisplay-Variable.woff2 +0 -0
- package/src/hooks/useContract.js +0 -179
- package/src/hooks/useGetMinAndMax.js +0 -48
- package/src/hooks/useLspApi.js +0 -70
- package/src/hooks/useParseInvoice.js +0 -95
- package/src/index.css +0 -69
- package/src/index.jsx +0 -161
- package/src/lib/bolt11.min.js +0 -1
- package/src/main.jsx +0 -75
- package/src/store/index.js +0 -25
- package/src/theme.js +0 -108
- package/src/utils/index.js +0 -267
- package/vite.config.js +0 -50
package/README.md
CHANGED
|
@@ -1,204 +1,276 @@
|
|
|
1
|
-
#
|
|
1
|
+
# NodeFlow SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
NodeFlow SDK is a React library that enables seamless asset bridging between EVM chains and the Bitcoin Lightning Network.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
7
|
- **Cross-Chain Bridge**: Bridge assets between EVM chains and Lightning Network
|
|
8
|
-
- **Multi-Chain Support**:
|
|
9
|
-
- **Wallet Integration**: Built-in
|
|
10
|
-
- **
|
|
11
|
-
- **Responsive
|
|
12
|
-
- **Real-time Updates**: Live transaction status and balance updates
|
|
13
|
-
- **Customizable Theme**: Dark theme with customizable styling
|
|
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
|
|
14
12
|
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
### Installation
|
|
13
|
+
## Installation
|
|
18
14
|
|
|
19
15
|
```bash
|
|
20
|
-
|
|
16
|
+
yarn add @lnfi-network/nodeflow-sdk
|
|
21
17
|
# or
|
|
22
|
-
|
|
18
|
+
npm install @lnfi-network/nodeflow-sdk
|
|
23
19
|
```
|
|
24
20
|
|
|
25
|
-
|
|
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
|
|
26
34
|
|
|
27
35
|
```jsx
|
|
28
|
-
import
|
|
29
|
-
|
|
36
|
+
import {
|
|
37
|
+
NodeFlowProvider,
|
|
38
|
+
NodeFlowModal,
|
|
39
|
+
nodeFlowSend,
|
|
40
|
+
nodeFlowReceive,
|
|
41
|
+
useNodeFlowPairs // Hook to get available asset pairs
|
|
42
|
+
} from '@lnfi-network/nodeflow-sdk';
|
|
30
43
|
|
|
31
44
|
function App() {
|
|
32
45
|
return (
|
|
33
|
-
<
|
|
34
|
-
projectId="your-project-id"
|
|
46
|
+
<NodeFlowProvider
|
|
47
|
+
projectId="your-walletconnect-project-id"
|
|
48
|
+
apiUrl="<API_BASE_URL>"
|
|
35
49
|
>
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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)
|
|
42
69
|
})}>
|
|
43
|
-
|
|
70
|
+
Get Tokens (Pay Lightning)
|
|
44
71
|
</button>
|
|
45
72
|
|
|
46
|
-
{/* EVM
|
|
47
|
-
<button onClick={() =>
|
|
48
|
-
assetId:
|
|
49
|
-
invoice: "lnbc..."
|
|
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)
|
|
50
78
|
})}>
|
|
51
|
-
|
|
79
|
+
Pay Invoice (Use Tokens)
|
|
52
80
|
</button>
|
|
53
|
-
</
|
|
81
|
+
</div>
|
|
54
82
|
);
|
|
55
83
|
}
|
|
56
84
|
```
|
|
57
85
|
|
|
58
|
-
|
|
86
|
+
---
|
|
59
87
|
|
|
60
|
-
|
|
88
|
+
## How It Works
|
|
61
89
|
|
|
62
|
-
|
|
90
|
+
### Lightning → EVM (Get Tokens)
|
|
91
|
+
|
|
92
|
+
User pays a Lightning invoice to receive EVM tokens.
|
|
63
93
|
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
+
◄──────────────────────────────│ │
|
|
70
121
|
```
|
|
71
122
|
|
|
72
|
-
###
|
|
123
|
+
### EVM → Lightning (Pay Invoice)
|
|
73
124
|
|
|
74
|
-
|
|
125
|
+
User pays a Lightning invoice using their EVM tokens.
|
|
75
126
|
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
+
◄──────────────────────────────│ │
|
|
82
153
|
```
|
|
83
154
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
Bridge assets from EVM chains to Lightning Network.
|
|
155
|
+
---
|
|
87
156
|
|
|
88
|
-
|
|
89
|
-
astraReceive({
|
|
90
|
-
assetId: string, // Asset identifier
|
|
91
|
-
invoice: string // Lightning invoice
|
|
92
|
-
});
|
|
93
|
-
```
|
|
157
|
+
## API Reference
|
|
94
158
|
|
|
95
|
-
|
|
159
|
+
### Components
|
|
96
160
|
|
|
97
|
-
|
|
161
|
+
#### `<NodeFlowProvider>`
|
|
98
162
|
|
|
99
|
-
|
|
100
|
-
- npm or yarn
|
|
101
|
-
- React 18+
|
|
163
|
+
Main provider component. Wrap your app with this.
|
|
102
164
|
|
|
103
|
-
|
|
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 |
|
|
104
171
|
|
|
105
|
-
|
|
106
|
-
# Clone the repository
|
|
107
|
-
git clone <repository-url>
|
|
108
|
-
cd astrasdk
|
|
172
|
+
#### `<NodeFlowModal>`
|
|
109
173
|
|
|
110
|
-
|
|
111
|
-
npm install
|
|
174
|
+
Modal component for transaction UI. Add once inside the provider.
|
|
112
175
|
|
|
113
|
-
|
|
114
|
-
npm run dev
|
|
176
|
+
---
|
|
115
177
|
|
|
116
|
-
|
|
117
|
-
npm run build
|
|
178
|
+
### Functions
|
|
118
179
|
|
|
119
|
-
|
|
120
|
-
npm run lint
|
|
121
|
-
```
|
|
180
|
+
#### `nodeFlowSend(options)`
|
|
122
181
|
|
|
123
|
-
|
|
182
|
+
Lightning → EVM: Get tokens by paying a Lightning invoice.
|
|
124
183
|
|
|
125
|
-
|
|
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 |
|
|
126
191
|
|
|
127
|
-
|
|
192
|
+
**Progress steps**: `'init'` → `'signature'` → `'deposit'` → `'pending'` → `'complete'`
|
|
128
193
|
|
|
129
|
-
```
|
|
130
|
-
const
|
|
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
|
+
});
|
|
131
201
|
```
|
|
132
202
|
|
|
133
|
-
|
|
203
|
+
#### `nodeFlowReceive(options)`
|
|
134
204
|
|
|
135
|
-
|
|
136
|
-
- **Wagmi** - React hooks for Ethereum
|
|
137
|
-
- **Viem** - TypeScript interface for Ethereum
|
|
138
|
-
- **Reown AppKit** - Wallet connection
|
|
139
|
-
- **Ant Design** - UI components
|
|
140
|
-
- **Styled Components** - CSS-in-JS styling
|
|
141
|
-
- **Zustand** - State management
|
|
142
|
-
- **Axios** - HTTP client
|
|
143
|
-
- **Decimal.js** - Precise decimal arithmetic
|
|
205
|
+
EVM → Lightning: Pay a Lightning invoice using tokens.
|
|
144
206
|
|
|
145
|
-
|
|
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 |
|
|
146
214
|
|
|
147
|
-
|
|
148
|
-
- **BSC** - Binance Smart Chain
|
|
149
|
-
- **Base** - Coinbase Layer 2
|
|
215
|
+
**Progress steps**: `'init'` → `'approve'` → `'deposit'` → `'complete'`
|
|
150
216
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
217
|
+
```javascript
|
|
218
|
+
const result = await nodeFlowReceive({
|
|
219
|
+
assetId: defaultAssetId,
|
|
220
|
+
invoice: 'lnbc...',
|
|
221
|
+
onSuccess: (result) => console.log('Paid:', result),
|
|
222
|
+
});
|
|
223
|
+
```
|
|
155
224
|
|
|
156
|
-
|
|
225
|
+
---
|
|
157
226
|
|
|
158
|
-
|
|
159
|
-
- Touch-friendly interfaces
|
|
160
|
-
- Responsive modal design
|
|
161
|
-
- Mobile wallet compatibility
|
|
162
|
-
- Optimized font sizes and spacing
|
|
227
|
+
### Hooks
|
|
163
228
|
|
|
164
|
-
|
|
229
|
+
#### `useNodeFlowPairs()`
|
|
165
230
|
|
|
166
|
-
|
|
167
|
-
- Transaction validation and verification
|
|
168
|
-
- Real-time status monitoring
|
|
169
|
-
- Error handling and user feedback
|
|
170
|
-
- Safe contract interactions
|
|
231
|
+
Get available trading pairs for the current chain.
|
|
171
232
|
|
|
172
|
-
|
|
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
|
+
```
|
|
173
242
|
|
|
174
|
-
|
|
243
|
+
#### `useNodeFlowState()`
|
|
175
244
|
|
|
176
|
-
|
|
245
|
+
Get SDK configuration state.
|
|
177
246
|
|
|
178
|
-
|
|
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
|
+
```
|
|
179
255
|
|
|
180
|
-
|
|
181
|
-
2. Create a feature branch
|
|
182
|
-
3. Make your changes
|
|
183
|
-
4. Add tests if applicable
|
|
184
|
-
5. Submit a pull request
|
|
256
|
+
---
|
|
185
257
|
|
|
186
|
-
##
|
|
258
|
+
## Using NodeFlowConfig (Existing Wagmi Setup)
|
|
187
259
|
|
|
188
|
-
|
|
189
|
-
- Create an issue in the GitHub repository
|
|
190
|
-
- Check the documentation
|
|
191
|
-
- Review example implementations
|
|
260
|
+
If you already have Wagmi configured in your app, use `NodeFlowConfig` instead:
|
|
192
261
|
|
|
193
|
-
|
|
262
|
+
```jsx
|
|
263
|
+
import { NodeFlowConfig, NodeFlowModal } from '@lnfi-network/nodeflow-sdk';
|
|
194
264
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
265
|
+
// Inside your existing WagmiProvider
|
|
266
|
+
<NodeFlowConfig apiUrl="<API_BASE_URL>">
|
|
267
|
+
<NodeFlowModal />
|
|
268
|
+
<YourApp />
|
|
269
|
+
</NodeFlowConfig>
|
|
270
|
+
```
|
|
201
271
|
|
|
202
272
|
---
|
|
203
273
|
|
|
204
|
-
|
|
274
|
+
## License
|
|
275
|
+
|
|
276
|
+
MIT
|
|
@@ -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-LucuShOc.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-LucuShOc.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>
|