astra-modal-test 1.0.11 → 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 +224 -122
- package/dist/{SwapController-Ck3TYcMp.js → SwapController-mYFErPzx.js} +1 -1
- package/dist/{add-BmBLHIEe.js → add-CXtFvysR.js} +1 -1
- package/dist/{all-wallets-H2aaJ2oP.js → all-wallets-B9fFXw5x.js} +1 -1
- package/dist/{app-store-Bvhe1BkA.js → app-store-BXf1yvR8.js} +1 -1
- package/dist/{apple-BCIKns5c.js → apple-DtcOcX1n.js} +1 -1
- package/dist/{arrow-bottom-i1ChNkSf.js → arrow-bottom-BXeLKqSV.js} +1 -1
- package/dist/{arrow-bottom-circle-Dpcn0z0p.js → arrow-bottom-circle-BVUU200N.js} +1 -1
- package/dist/{arrow-left-Dj8tzUf6.js → arrow-left-LguJPyNR.js} +1 -1
- package/dist/{arrow-right-DVd3R-0K.js → arrow-right-D9kKZzGG.js} +1 -1
- package/dist/{arrow-top-DcD5wbZL.js → arrow-top-C5JcaCqz.js} +1 -1
- package/dist/{bank-CToLOTy3.js → bank-DgbCzr0A.js} +1 -1
- package/dist/{bin-D8m48Dk5.js → bin-ykHym2bC.js} +1 -1
- package/dist/{bitcoin-y6S4LO0p.js → bitcoin-B8jzy_uV.js} +1 -1
- package/dist/{browser-DRhVaQQT.js → browser-Bk8u8PAA.js} +1 -1
- package/dist/{card-BK0q3S4W.js → card-DcwQMUca.js} +1 -1
- package/dist/ccip-CwJvuExU.js +239 -0
- package/dist/{checkmark-C7H1vH4H.js → checkmark-D3aEYZ8B.js} +1 -1
- package/dist/{checkmark-bold-DfvIWKpu.js → checkmark-bold-5H7N-CDG.js} +1 -1
- package/dist/{chevron-bottom-CcAEP6cD.js → chevron-bottom-BA3C4MR1.js} +1 -1
- package/dist/{chevron-left-DMnhSBVl.js → chevron-left-BX18UWKM.js} +1 -1
- package/dist/{chevron-right-pPhw9ZBC.js → chevron-right-DG7ovxTe.js} +1 -1
- package/dist/{chevron-top-DjqOCRAL.js → chevron-top-DHfev7lV.js} +1 -1
- package/dist/{chrome-store-B-9bRAPM.js → chrome-store-BSVzpGdu.js} +1 -1
- package/dist/{circle-SPbxfVZq.js → circle-SYFB9f2-.js} +1 -1
- package/dist/{clock-BLAT4wv4.js → clock-Cygqlf1g.js} +1 -1
- package/dist/{close-D1AyyJzy.js → close-B43cuuko.js} +1 -1
- package/dist/{coinPlaceholder-DGk1in74.js → coinPlaceholder-BHdR6bKb.js} +1 -1
- package/dist/{compass-C0-SVkSt.js → compass-7S6b6wyA.js} +1 -1
- package/dist/{copy-CPcvwITz.js → copy-CT53bEwd.js} +1 -1
- package/dist/{cursor-transparent-BJsEpe-G.js → cursor-transparent-LmjzjsFm.js} +1 -1
- package/dist/{cursor-ChlOWEcO.js → cursor-vtqRnrF7.js} +1 -1
- package/dist/{desktop-Z8iZvVCW.js → desktop-Doa7TQsq.js} +1 -1
- package/dist/{disconnect-DkPQjiLk.js → disconnect-C5G6Ncu_.js} +1 -1
- package/dist/{discord-CwRdgvGZ.js → discord-DX7Cl3Ko.js} +1 -1
- package/dist/{email-DA_5xt-j.js → email-CyHWh9wL.js} +1 -1
- package/dist/{embedded-wallet-DYnGl5tL.js → embedded-wallet-BZQImi7s.js} +8 -8
- package/dist/{ethereum-Dwse3Umc.js → ethereum-Bwvtk5-_.js} +1 -1
- package/dist/{etherscan-CNmwyrRn.js → etherscan-CyVRICvw.js} +1 -1
- package/dist/{exclamation-triangle-CU8gn-bU.js → exclamation-triangle-BDbPL3nL.js} +1 -1
- package/dist/{extension-rikwXWrg.js → extension-Cx3t2k-R.js} +1 -1
- package/dist/{external-link-mDp8JVE0.js → external-link-DZCYpOZI.js} +1 -1
- package/dist/{facebook-c0IS1D9G.js → facebook-BEnPrhG3.js} +1 -1
- package/dist/{farcaster-DpvSDnGl.js → farcaster-DyBPLb_k.js} +1 -1
- package/dist/{filters-B42-1BLn.js → filters-CTwxivn_.js} +1 -1
- package/dist/{github-DvjZxkXF.js → github-kzQb61pT.js} +1 -1
- package/dist/{google-CLHf_zAz.js → google-DSC-rYNu.js} +1 -1
- package/dist/{help-circle-BI5xgPAz.js → help-circle-C5XfimVx.js} +1 -1
- package/dist/{id-BxI79dX4.js → id-B9fQOT4E.js} +1 -1
- package/dist/{image-Cr1qAxG-.js → image-1CCj36XM.js} +1 -1
- package/dist/{index-C_3PUMa7.js → index-Bjik7E9u.js} +1 -1
- package/dist/{index-DtAG8k9M.js → index-C1fgrzi0.js} +16 -16
- package/dist/{index-D7jufxlk.js → index-CyeGBcX0.js} +1 -1
- package/dist/{index-C49-8bCQ.js → index-DKEMW9N8.js} +25 -25
- package/dist/{index-Zh6wUpmX.js → index-LucuShOc.js} +45070 -56076
- package/dist/{info-BUp5BYav.js → info-Begf9tO0.js} +1 -1
- package/dist/{info-circle-D5anzkYK.js → info-circle-Bo1H2OXh.js} +1 -1
- package/dist/{lightbulb-DmuhLv29.js → lightbulb-C-SU_z2I.js} +1 -1
- package/dist/{mail-D2hRmmgi.js → mail-CXsYiNAT.js} +1 -1
- package/dist/{mobile-Cq-9uJHv.js → mobile-C7bUjgog.js} +1 -1
- package/dist/{more-DJMBaB2z.js → more-29BC-wmy.js} +1 -1
- package/dist/{network-placeholder-3ip1roR0.js → network-placeholder-B-x3-6jN.js} +1 -1
- package/dist/{nftPlaceholder-C7r74zYS.js → nftPlaceholder-pM-Hmswq.js} +1 -1
- package/dist/nodeflow-sdk.es.js +15 -0
- package/dist/{off-CJE6Z_MK.js → off-DEa_uc7_.js} +1 -1
- package/dist/{onramp-BMRgbt2I.js → onramp-ZXqyloYt.js} +10 -10
- package/dist/{play-store-CxusWynI.js → play-store-WgSEpEI1.js} +1 -1
- package/dist/{plus-Bjkqj5g6.js → plus-u4UZhYAg.js} +1 -1
- package/dist/{qr-code-4C0zboga.js → qr-code-DxZGxoPE.js} +1 -1
- package/dist/{receive-Cc8moHBZ.js → receive-Ct_mQWzk.js} +1 -1
- package/dist/{recycle-horizontal-BdSgk84g.js → recycle-horizontal-BWVpmHJc.js} +1 -1
- package/dist/{refresh-BsRodAS7.js → refresh-gi4TfgEU.js} +1 -1
- package/dist/{reown-logo-DOVlqCDK.js → reown-logo-Bg731n4w.js} +1 -1
- package/dist/{search-BIyHtky-.js → search-BQv7DVJG.js} +1 -1
- package/dist/{send-9eSi58hW.js → send-BzmnFT2p.js} +1 -1
- package/dist/{send-CBFTcYtn.js → send-CyxKtrQ9.js} +17 -17
- package/dist/{socials-CeOJULFV.js → socials-vziOn4zi.js} +5 -5
- package/dist/{solana-BNptwYvn.js → solana-Dz48awbr.js} +1 -1
- package/dist/{swapHorizontal-COlgqyzt.js → swapHorizontal-Cwe1PoMp.js} +1 -1
- package/dist/{swapHorizontalBold-Odce2JOe.js → swapHorizontalBold-Dxu58sRG.js} +1 -1
- package/dist/{swapHorizontalMedium-B9nkEBPD.js → swapHorizontalMedium-DOZZthlB.js} +1 -1
- package/dist/{swapHorizontalRoundedBold-DPMzz6nz.js → swapHorizontalRoundedBold-BkIZQXnD.js} +1 -1
- package/dist/{swapVertical-FqQP9GBP.js → swapVertical-LSq66ctC.js} +1 -1
- package/dist/{swaps-BG9GOayX.js → swaps-C2EO6dQA.js} +9 -9
- package/dist/{telegram-BMY9Hs9Z.js → telegram-ITq9s69Y.js} +1 -1
- package/dist/{three-dots-DDKmexHU.js → three-dots-JH3A1TFR.js} +1 -1
- package/dist/{transactions-C_GII6kW.js → transactions-DpMVZVap.js} +1 -1
- package/dist/{twitch-x_s0neNg.js → twitch-BKs5FlDf.js} +1 -1
- package/dist/{twitterIcon-CKsSxEuJ.js → twitterIcon-CCXEj_Nv.js} +1 -1
- package/dist/{ui-CZH-vf5h.js → ui-D5ULRvGt.js} +6 -6
- package/dist/{user-CZfvQDJ_.js → user-CBgAUjZv.js} +1 -1
- package/dist/{verify-Bnvbadnx.js → verify-BPlPPkhG.js} +1 -1
- package/dist/{verify-filled-CnEopkW-.js → verify-filled-qTRg0OWM.js} +1 -1
- package/dist/{w3m-modal-DkI2TPJW.js → w3m-modal-DSdDfy32.js} +27 -27
- package/dist/{wallet-B3oN4n4q.js → wallet-BuDEi_8z.js} +1 -1
- package/dist/{wallet-placeholder-CI0oiAcd.js → wallet-placeholder-D4DKTuB_.js} +1 -1
- package/dist/{walletconnect-D4vMcjqO.js → walletconnect-Dt3q5XFc.js} +1 -1
- package/dist/{warning-circle-DjI8aRBs.js → warning-circle-B8Fkc0_4.js} +1 -1
- package/dist/{x-BgRWY62H.js → x-Cm_V3zUI.js} +1 -1
- package/dist/{x-mark-Cdqd-Hm4.js → x-mark-BVvwdxda.js} +1 -1
- package/package.json +6 -10
- package/dist/astra-sdk.es.js +0 -9
- package/dist/ccip-CH1B6Zeh.js +0 -149
- package/dist/clsx.m-DCYaa4RU.js +0 -20
- package/dist/index-C0USsgDi.js +0 -15911
- package/dist/index-CH4T0JAz.js +0 -10785
- package/dist/index-CWAoFGd1.js +0 -315
- package/dist/index-ChxXyuZj.js +0 -572
- package/dist/index-DZiQey0J.js +0 -386
- package/dist/index-utoSbRla.js +0 -21034
- package/dist/secp256k1-B2Gq-iIr.js +0 -1257
package/README.md
CHANGED
|
@@ -1,174 +1,276 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
Astra 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 Astra SDK
|
|
24
|
-
participant L as LSP Node
|
|
25
|
-
participant E as EVM Chain
|
|
26
|
-
|
|
27
|
-
U->>S: astraSend(amount, assetId)
|
|
28
|
-
S->>L: Request Quote & Astra 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
|
-
```
|
|
1
|
+
# NodeFlow SDK
|
|
35
2
|
|
|
36
|
-
|
|
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 Astra SDK
|
|
43
|
-
participant E as EVM Chain
|
|
44
|
-
participant L as LSP Node
|
|
45
|
-
|
|
46
|
-
U->>S: astraReceive(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
|
-
```
|
|
3
|
+
NodeFlow SDK is a React library that enables seamless asset bridging between EVM chains and the Bitcoin Lightning Network.
|
|
52
4
|
|
|
53
|
-
|
|
5
|
+
## Features
|
|
54
6
|
|
|
55
|
-
|
|
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
|
|
56
12
|
|
|
57
|
-
|
|
13
|
+
## Installation
|
|
58
14
|
|
|
59
15
|
```bash
|
|
60
|
-
|
|
16
|
+
yarn add @lnfi-network/nodeflow-sdk
|
|
17
|
+
# or
|
|
18
|
+
npm install @lnfi-network/nodeflow-sdk
|
|
61
19
|
```
|
|
62
20
|
|
|
63
|
-
|
|
21
|
+
> Peer dependencies (wagmi, viem, @reown/appkit, etc.) will be installed automatically.
|
|
64
22
|
|
|
65
|
-
|
|
23
|
+
## Configuration
|
|
66
24
|
|
|
67
25
|
| Item | Value | Description |
|
|
68
26
|
| :--- | :--- | :--- |
|
|
69
|
-
| **Project ID** |
|
|
70
|
-
| **
|
|
71
|
-
| **
|
|
72
|
-
| **Token Address** | `0x616F1207D8BbC71549b8AC41f4797df72EA39297` | **USDT** (Base Regtest) |
|
|
73
|
-
| **Invoice Generator** | [lnexchange](https://devoflnexchange.unift.xyz/) | Generate Regtest invoices for testing |
|
|
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 |
|
|
74
30
|
|
|
75
|
-
|
|
31
|
+
---
|
|
76
32
|
|
|
77
|
-
|
|
33
|
+
## Quick Start
|
|
78
34
|
|
|
79
35
|
```jsx
|
|
80
|
-
import
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
36
|
+
import {
|
|
37
|
+
NodeFlowProvider,
|
|
38
|
+
NodeFlowModal,
|
|
39
|
+
nodeFlowSend,
|
|
40
|
+
nodeFlowReceive,
|
|
41
|
+
useNodeFlowPairs // Hook to get available asset pairs
|
|
42
|
+
} from '@lnfi-network/nodeflow-sdk';
|
|
85
43
|
|
|
86
44
|
function App() {
|
|
87
45
|
return (
|
|
88
|
-
<
|
|
89
|
-
projectId="
|
|
90
|
-
|
|
46
|
+
<NodeFlowProvider
|
|
47
|
+
projectId="your-walletconnect-project-id"
|
|
48
|
+
apiUrl="<API_BASE_URL>"
|
|
91
49
|
>
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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)
|
|
102
69
|
})}>
|
|
103
|
-
Get
|
|
70
|
+
Get Tokens (Pay Lightning)
|
|
104
71
|
</button>
|
|
105
72
|
|
|
106
|
-
{/*
|
|
107
|
-
<button onClick={() =>
|
|
108
|
-
assetId:
|
|
109
|
-
invoice: "
|
|
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)
|
|
110
78
|
})}>
|
|
111
|
-
Pay
|
|
79
|
+
Pay Invoice (Use Tokens)
|
|
112
80
|
</button>
|
|
113
|
-
</
|
|
81
|
+
</div>
|
|
114
82
|
);
|
|
115
83
|
}
|
|
116
84
|
```
|
|
117
85
|
|
|
118
|
-
|
|
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
|
|
119
160
|
|
|
120
|
-
####
|
|
161
|
+
#### `<NodeFlowProvider>`
|
|
121
162
|
|
|
122
|
-
|
|
163
|
+
Main provider component. Wrap your app with this.
|
|
164
|
+
|
|
165
|
+
| Prop | Type | Required | Description |
|
|
123
166
|
| :--- | :--- | :--- | :--- |
|
|
124
|
-
| `projectId` | `string` |
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
127
|
-
| `
|
|
128
|
-
|
|
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.
|
|
129
175
|
|
|
130
|
-
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### Functions
|
|
179
|
+
|
|
180
|
+
#### `nodeFlowSend(options)`
|
|
131
181
|
|
|
132
|
-
|
|
182
|
+
Lightning → EVM: Get tokens by paying a Lightning invoice.
|
|
133
183
|
|
|
134
|
-
|
|
|
184
|
+
| Option | Type | Description |
|
|
135
185
|
| :--- | :--- | :--- |
|
|
136
|
-
| `assetId` | `string` |
|
|
186
|
+
| `assetId` | `string` | Asset ID (get from `useNodeFlowPairs`) |
|
|
137
187
|
| `amount` | `number` | Amount in satoshis |
|
|
138
|
-
| `
|
|
139
|
-
| `
|
|
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
|
+
```
|
|
140
202
|
|
|
141
|
-
####
|
|
203
|
+
#### `nodeFlowReceive(options)`
|
|
142
204
|
|
|
143
|
-
|
|
205
|
+
EVM → Lightning: Pay a Lightning invoice using tokens.
|
|
144
206
|
|
|
145
|
-
|
|
|
207
|
+
| Option | Type | Description |
|
|
146
208
|
| :--- | :--- | :--- |
|
|
147
|
-
| `assetId` | `string` |
|
|
148
|
-
| `invoice` | `string` |
|
|
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
|
+
```
|
|
149
224
|
|
|
150
|
-
|
|
225
|
+
---
|
|
151
226
|
|
|
152
|
-
|
|
153
|
-
- **Wagmi & Viem** - Ethereum hooks & interface
|
|
154
|
-
- **Reown AppKit** - Wallet connection
|
|
155
|
-
- **Ant Design** - UI components (with `astra` prefix)
|
|
156
|
-
- **Zustand** - State management
|
|
227
|
+
### Hooks
|
|
157
228
|
|
|
158
|
-
|
|
229
|
+
#### `useNodeFlowPairs()`
|
|
159
230
|
|
|
160
|
-
|
|
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
|
+
```
|
|
161
255
|
|
|
162
256
|
---
|
|
163
257
|
|
|
164
|
-
|
|
258
|
+
## Using NodeFlowConfig (Existing Wagmi Setup)
|
|
165
259
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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
|
+
```
|
|
171
271
|
|
|
172
272
|
---
|
|
173
273
|
|
|
174
|
-
|
|
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>
|