astra-modal-test 1.0.9 → 1.0.11
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 +118 -148
- package/dist/{SwapController-rSbURdpJ.js → SwapController-Ck3TYcMp.js} +1 -1
- package/dist/{add-CpqI0qih.js → add-BmBLHIEe.js} +1 -1
- package/dist/{all-wallets-BCS6tMyX.js → all-wallets-H2aaJ2oP.js} +1 -1
- package/dist/{app-store-BJcpQsmn.js → app-store-Bvhe1BkA.js} +1 -1
- package/dist/{apple-BYXq8xra.js → apple-BCIKns5c.js} +1 -1
- package/dist/{arrow-bottom-circle-7zz6Cez4.js → arrow-bottom-circle-Dpcn0z0p.js} +1 -1
- package/dist/{arrow-bottom-DyDya01u.js → arrow-bottom-i1ChNkSf.js} +1 -1
- package/dist/{arrow-left-DFjTrDxq.js → arrow-left-Dj8tzUf6.js} +1 -1
- package/dist/{arrow-right-BeKBpPGZ.js → arrow-right-DVd3R-0K.js} +1 -1
- package/dist/{arrow-top-C8kkMQwd.js → arrow-top-DcD5wbZL.js} +1 -1
- package/dist/astra-sdk.es.js +1 -1
- package/dist/{bank-FSmmDSOr.js → bank-CToLOTy3.js} +1 -1
- package/dist/{bin-BxSWmf4U.js → bin-D8m48Dk5.js} +1 -1
- package/dist/{bitcoin-DOtAY1tg.js → bitcoin-y6S4LO0p.js} +1 -1
- package/dist/{browser-CxU-j1-l.js → browser-DRhVaQQT.js} +1 -1
- package/dist/{card-CjYkck9C.js → card-BK0q3S4W.js} +1 -1
- package/dist/{ccip-Dzjn7iUj.js → ccip-CH1B6Zeh.js} +1 -1
- package/dist/{checkmark-BQzWjMBG.js → checkmark-C7H1vH4H.js} +1 -1
- package/dist/{checkmark-bold-CydTLhCY.js → checkmark-bold-DfvIWKpu.js} +1 -1
- package/dist/{chevron-bottom-CA607zpT.js → chevron-bottom-CcAEP6cD.js} +1 -1
- package/dist/{chevron-left-BGmBZSZo.js → chevron-left-DMnhSBVl.js} +1 -1
- package/dist/{chevron-right-NBRpcLa8.js → chevron-right-pPhw9ZBC.js} +1 -1
- package/dist/{chevron-top-Cw5I5ZOR.js → chevron-top-DjqOCRAL.js} +1 -1
- package/dist/{chrome-store-Bg96vfCc.js → chrome-store-B-9bRAPM.js} +1 -1
- package/dist/{circle-D_QW929y.js → circle-SPbxfVZq.js} +1 -1
- package/dist/{clock-o4gqCbWO.js → clock-BLAT4wv4.js} +1 -1
- package/dist/{close-z2Y-xc4H.js → close-D1AyyJzy.js} +1 -1
- package/dist/{coinPlaceholder-D_9U8ws8.js → coinPlaceholder-DGk1in74.js} +1 -1
- package/dist/{compass-BVM30Hj-.js → compass-C0-SVkSt.js} +1 -1
- package/dist/{copy-BvKR_En_.js → copy-CPcvwITz.js} +1 -1
- package/dist/{cursor-DKFz2C-k.js → cursor-ChlOWEcO.js} +1 -1
- package/dist/{cursor-transparent-DwsHTJdY.js → cursor-transparent-BJsEpe-G.js} +1 -1
- package/dist/{desktop-_hiZGUrG.js → desktop-Z8iZvVCW.js} +1 -1
- package/dist/{disconnect-DbmK87x7.js → disconnect-DkPQjiLk.js} +1 -1
- package/dist/{discord-CGEs_Ewv.js → discord-CwRdgvGZ.js} +1 -1
- package/dist/{email-B64OZpkU.js → email-DA_5xt-j.js} +1 -1
- package/dist/{embedded-wallet-CdFJiA0M.js → embedded-wallet-DYnGl5tL.js} +1 -1
- package/dist/{ethereum-ByYB2hkU.js → ethereum-Dwse3Umc.js} +1 -1
- package/dist/{etherscan-BbjvIHaL.js → etherscan-CNmwyrRn.js} +1 -1
- package/dist/{exclamation-triangle-CdD-9Mg9.js → exclamation-triangle-CU8gn-bU.js} +1 -1
- package/dist/{extension-CwWz_fIf.js → extension-rikwXWrg.js} +1 -1
- package/dist/{external-link-B-H5cp6t.js → external-link-mDp8JVE0.js} +1 -1
- package/dist/{facebook-BCVDL-tg.js → facebook-c0IS1D9G.js} +1 -1
- package/dist/{farcaster-jtO1GaIa.js → farcaster-DpvSDnGl.js} +1 -1
- package/dist/{filters-D-d663Tl.js → filters-B42-1BLn.js} +1 -1
- package/dist/{github-GYbnMtDL.js → github-DvjZxkXF.js} +1 -1
- package/dist/{google-D0T6MiMp.js → google-CLHf_zAz.js} +1 -1
- package/dist/{help-circle-S_PJYnAb.js → help-circle-BI5xgPAz.js} +1 -1
- package/dist/{id-ovWduNYl.js → id-BxI79dX4.js} +1 -1
- package/dist/{image-DWMmztGY.js → image-Cr1qAxG-.js} +1 -1
- package/dist/{index-RJEV23nN.js → index-C0USsgDi.js} +1 -1
- package/dist/{index-D49QXkg7.js → index-C49-8bCQ.js} +1 -1
- package/dist/{index-DEIfu1o6.js → index-CH4T0JAz.js} +1 -1
- package/dist/{index-CJ7s8Rmk.js → index-CWAoFGd1.js} +6 -6
- package/dist/{index-3RuZHNxg.js → index-C_3PUMa7.js} +1 -1
- package/dist/{index-Dv7m_bJu.js → index-D7jufxlk.js} +1 -1
- package/dist/{index-BrVBbGpA.js → index-DZiQey0J.js} +1 -1
- package/dist/{index-CXZjl-KY.js → index-DtAG8k9M.js} +1 -1
- package/dist/{index-DpJh5yXk.js → index-Zh6wUpmX.js} +4008 -3984
- package/dist/{index-CTtOlAw3.js → index-utoSbRla.js} +1 -1
- package/dist/{info-B_t5Wxs5.js → info-BUp5BYav.js} +1 -1
- package/dist/{info-circle-BE3c4h9q.js → info-circle-D5anzkYK.js} +1 -1
- package/dist/{lightbulb-WY74qWMh.js → lightbulb-DmuhLv29.js} +1 -1
- package/dist/{mail-BZffBQJn.js → mail-D2hRmmgi.js} +1 -1
- package/dist/{mobile-BzoKYXrP.js → mobile-Cq-9uJHv.js} +1 -1
- package/dist/{more-DLl0U_yq.js → more-DJMBaB2z.js} +1 -1
- package/dist/{network-placeholder-GUlJsW90.js → network-placeholder-3ip1roR0.js} +1 -1
- package/dist/{nftPlaceholder-URobOrrj.js → nftPlaceholder-C7r74zYS.js} +1 -1
- package/dist/{off-Dd3KIizg.js → off-CJE6Z_MK.js} +1 -1
- package/dist/{onramp-D3nPDHgs.js → onramp-BMRgbt2I.js} +1 -1
- package/dist/{play-store-DQcCWm53.js → play-store-CxusWynI.js} +1 -1
- package/dist/{plus-CBsitvpf.js → plus-Bjkqj5g6.js} +1 -1
- package/dist/{qr-code-BLKOY5TH.js → qr-code-4C0zboga.js} +1 -1
- package/dist/{receive-Cs7OrQ5H.js → receive-Cc8moHBZ.js} +1 -1
- package/dist/{recycle-horizontal-DA3_DhRi.js → recycle-horizontal-BdSgk84g.js} +1 -1
- package/dist/{refresh-DA83X8jf.js → refresh-BsRodAS7.js} +1 -1
- package/dist/{reown-logo-CYujsMCS.js → reown-logo-DOVlqCDK.js} +1 -1
- package/dist/{search-dhyszWwL.js → search-BIyHtky-.js} +1 -1
- package/dist/{secp256k1-BzR-XYTV.js → secp256k1-B2Gq-iIr.js} +1 -1
- package/dist/{send-Djdyyp-y.js → send-9eSi58hW.js} +1 -1
- package/dist/{send-Dio4rhmI.js → send-CBFTcYtn.js} +3 -3
- package/dist/{socials-CyiUMsk1.js → socials-CeOJULFV.js} +1 -1
- package/dist/{solana-B01U90Av.js → solana-BNptwYvn.js} +1 -1
- package/dist/{swapHorizontal-BazEPj1l.js → swapHorizontal-COlgqyzt.js} +1 -1
- package/dist/{swapHorizontalBold-DOjBCDPH.js → swapHorizontalBold-Odce2JOe.js} +1 -1
- package/dist/{swapHorizontalMedium-Bp7rqwQ_.js → swapHorizontalMedium-B9nkEBPD.js} +1 -1
- package/dist/{swapHorizontalRoundedBold-fXXQeesr.js → swapHorizontalRoundedBold-DPMzz6nz.js} +1 -1
- package/dist/{swapVertical-lb6FRfr-.js → swapVertical-FqQP9GBP.js} +1 -1
- package/dist/{swaps-DXWgEjt_.js → swaps-BG9GOayX.js} +3 -3
- package/dist/{telegram-Cw3woU3F.js → telegram-BMY9Hs9Z.js} +1 -1
- package/dist/{three-dots-CrS1ZJoA.js → three-dots-DDKmexHU.js} +1 -1
- package/dist/{transactions-ClKYRDBc.js → transactions-C_GII6kW.js} +1 -1
- package/dist/{twitch-BTFS8sbh.js → twitch-x_s0neNg.js} +1 -1
- package/dist/{twitterIcon-BEey2zuH.js → twitterIcon-CKsSxEuJ.js} +1 -1
- package/dist/{ui-xSZiungl.js → ui-CZH-vf5h.js} +2 -2
- package/dist/{user-fcwj6TqA.js → user-CZfvQDJ_.js} +1 -1
- package/dist/{verify-BLatL5Dw.js → verify-Bnvbadnx.js} +1 -1
- package/dist/{verify-filled-DPYDyDVg.js → verify-filled-CnEopkW-.js} +1 -1
- package/dist/{w3m-modal-IpSIarQs.js → w3m-modal-DkI2TPJW.js} +2 -2
- package/dist/{wallet-Cgmznx42.js → wallet-B3oN4n4q.js} +1 -1
- package/dist/{wallet-placeholder-B7P5m3g1.js → wallet-placeholder-CI0oiAcd.js} +1 -1
- package/dist/{walletconnect-DPJfWPxF.js → walletconnect-D4vMcjqO.js} +1 -1
- package/dist/{warning-circle-yU7or6qZ.js → warning-circle-DjI8aRBs.js} +1 -1
- package/dist/{x-Cr3BPl_T.js → x-BgRWY62H.js} +1 -1
- package/dist/{x-mark-CZyZTZeg.js → x-mark-Cdqd-Hm4.js} +1 -1
- package/package.json +6 -1
- package/.github/workflows/code-quality.yml +0 -43
- package/.github/workflows/publish.yml +0 -64
- 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
|
@@ -2,202 +2,172 @@
|
|
|
2
2
|
|
|
3
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
4
|
|
|
5
|
-
|
|
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
|
+
```
|
|
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 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
|
+
```
|
|
6
52
|
|
|
7
|
-
|
|
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
|
|
53
|
+
### 🚀 Quick Start
|
|
14
54
|
|
|
15
|
-
|
|
55
|
+
#### Installation
|
|
16
56
|
|
|
17
|
-
|
|
57
|
+
Astra SDK requires several peer dependencies to be installed in your project:
|
|
18
58
|
|
|
19
59
|
```bash
|
|
20
|
-
npm install astra-
|
|
21
|
-
# or
|
|
22
|
-
yarn add astra-modal
|
|
60
|
+
npm install @lnfi-network/astra-sdk wagmi viem @reown/appkit @reown/appkit-adapter-wagmi @tanstack/react-query
|
|
23
61
|
```
|
|
24
62
|
|
|
25
|
-
###
|
|
63
|
+
### 🧪 Testnet Environment Setup
|
|
64
|
+
|
|
65
|
+
To help you get started quickly on the **Base Regtest** testnet, use the following configuration:
|
|
66
|
+
|
|
67
|
+
| Item | Value | Description |
|
|
68
|
+
| :--- | :--- | :--- |
|
|
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 |
|
|
74
|
+
|
|
75
|
+
#### Quick Start Example
|
|
76
|
+
|
|
77
|
+
Here is a copy-paste ready example for Regtest / Base Sepolia :
|
|
26
78
|
|
|
27
79
|
```jsx
|
|
28
80
|
import React from 'react';
|
|
29
|
-
import { AstraProvider, AstraModal, astraSend, astraReceive } from 'astra-
|
|
81
|
+
import { AstraProvider, AstraModal, astraSend, astraReceive } from '@lnfi-network/astra-sdk';
|
|
82
|
+
|
|
83
|
+
// Testnet Asset ID for USDT
|
|
84
|
+
const USDT_ASSET_ID = "f7ac99f2c068f1157c787012f50cb043437505c309c6d8685e135cd8481b1e9d";
|
|
30
85
|
|
|
31
86
|
function App() {
|
|
32
87
|
return (
|
|
33
88
|
<AstraProvider
|
|
34
|
-
projectId="
|
|
89
|
+
projectId="92461524d3cfcb3d78b38b5dbd6a6ce3"
|
|
90
|
+
env="development"
|
|
35
91
|
>
|
|
36
92
|
<AstraModal />
|
|
37
93
|
|
|
38
|
-
{/* Lightning to EVM */}
|
|
94
|
+
{/* 1. Lightning to EVM (Withdraw USDT) */}
|
|
39
95
|
<button onClick={() => astraSend({
|
|
40
|
-
assetId:
|
|
41
|
-
amount:
|
|
96
|
+
assetId: USDT_ASSET_ID,
|
|
97
|
+
amount: 10000,
|
|
98
|
+
waitConfirm: true,
|
|
99
|
+
onAstraInvoice: (invoice, tx, txUrl) => {
|
|
100
|
+
console.log("Pay this Invoice:", invoice);
|
|
101
|
+
}
|
|
42
102
|
})}>
|
|
43
|
-
|
|
103
|
+
Get USDT on Base Sepolia
|
|
44
104
|
</button>
|
|
45
105
|
|
|
46
|
-
{/* EVM to Lightning */}
|
|
106
|
+
{/* 2. EVM to Lightning (Deposit USDT) */}
|
|
47
107
|
<button onClick={() => astraReceive({
|
|
48
|
-
assetId:
|
|
49
|
-
invoice: "
|
|
108
|
+
assetId: USDT_ASSET_ID,
|
|
109
|
+
invoice: "lnbcrt1..." // Get a test invoice from: https://devoflnexchange.unift.xyz/
|
|
50
110
|
})}>
|
|
51
|
-
|
|
111
|
+
Pay Lightning Invoice with USDT
|
|
52
112
|
</button>
|
|
53
113
|
</AstraProvider>
|
|
54
114
|
);
|
|
55
115
|
}
|
|
56
116
|
```
|
|
57
117
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
### AstraProvider
|
|
61
|
-
|
|
62
|
-
The main provider component that wraps your application.
|
|
63
|
-
|
|
64
|
-
```jsx
|
|
65
|
-
<AstraProvider
|
|
66
|
-
projectId={string} // WalletConnect project ID (required)
|
|
67
|
-
>
|
|
68
|
-
{children}
|
|
69
|
-
</AstraProvider>
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### astraSend
|
|
73
|
-
|
|
74
|
-
Bridge assets from Lightning Network to EVM chains.
|
|
75
|
-
|
|
76
|
-
```jsx
|
|
77
|
-
astraSend({
|
|
78
|
-
assetId: string, // Asset identifier
|
|
79
|
-
amount: number, // Amount to bridge (in satoshis)
|
|
80
|
-
onAstraInvoice?: (invoice, tx, txUrl) => void, // Callback for invoice
|
|
81
|
-
});
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### astraReceive
|
|
85
|
-
|
|
86
|
-
Bridge assets from EVM chains to Lightning Network.
|
|
87
|
-
|
|
88
|
-
```jsx
|
|
89
|
-
astraReceive({
|
|
90
|
-
assetId: string, // Asset identifier
|
|
91
|
-
invoice: string // Lightning invoice
|
|
92
|
-
});
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## 🏗️ Development
|
|
96
|
-
|
|
97
|
-
### Prerequisites
|
|
118
|
+
### 📖 API Reference
|
|
98
119
|
|
|
99
|
-
|
|
100
|
-
- npm or yarn
|
|
101
|
-
- React 18+
|
|
120
|
+
#### AstraProvider
|
|
102
121
|
|
|
103
|
-
|
|
122
|
+
| Prop | Type | Default | Description |
|
|
123
|
+
| :--- | :--- | :--- | :--- |
|
|
124
|
+
| `projectId` | `string` | **Required** | WalletConnect project ID from [cloud.reown.com](https://cloud.reown.com) |
|
|
125
|
+
| `env` | `'production' \| 'development'` | `'production'` | Environment mode. 'development' uses testnets (Sepolia, Base Sepolia) |
|
|
126
|
+
| `metadata` | `object` | `defaultMetadata` | App metadata for WalletConnect (name, description, url, icons) |
|
|
127
|
+
| `apiUrl` | `string` | See note | Backend API URL. Automatically switches based on `env` |
|
|
128
|
+
| `adapter` | `WagmiAdapter` | `null` | Optional custom Wagmi adapter if you want to reuse existing configuration |
|
|
104
129
|
|
|
105
|
-
|
|
106
|
-
# Clone the repository
|
|
107
|
-
git clone <repository-url>
|
|
108
|
-
cd astrasdk
|
|
109
|
-
|
|
110
|
-
# Install dependencies (use npm only)
|
|
111
|
-
npm install
|
|
130
|
+
#### astraSend
|
|
112
131
|
|
|
113
|
-
|
|
114
|
-
npm run dev
|
|
132
|
+
Bridge assets from **Lightning Network to EVM** chains.
|
|
115
133
|
|
|
116
|
-
|
|
117
|
-
|
|
134
|
+
| Parameter | Type | Description |
|
|
135
|
+
| :--- | :--- | :--- |
|
|
136
|
+
| `assetId` | `string` | The ID of the asset to bridge |
|
|
137
|
+
| `amount` | `number` | Amount in satoshis |
|
|
138
|
+
| `waitConfirm` | `boolean` | Whether to wait for transaction confirmation (default: `true`) |
|
|
139
|
+
| `onAstraInvoice` | `function` | Callback: `(invoice, tx, txUrl) => void` |
|
|
118
140
|
|
|
119
|
-
|
|
120
|
-
npm run lint
|
|
121
|
-
```
|
|
141
|
+
#### astraReceive
|
|
122
142
|
|
|
123
|
-
|
|
143
|
+
Bridge assets from **EVM chains to Lightning Network**.
|
|
124
144
|
|
|
125
|
-
|
|
145
|
+
| Parameter | Type | Description |
|
|
146
|
+
| :--- | :--- | :--- |
|
|
147
|
+
| `assetId` | `string` | The ID of the asset to bridge |
|
|
148
|
+
| `invoice` | `string` | The Lightning Network invoice where you want to receive funds |
|
|
126
149
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
```jsx
|
|
130
|
-
const projectId = "your-test-project-id";
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
## 🔧 Technical Stack
|
|
150
|
+
### 🛠️ Technical Stack
|
|
134
151
|
|
|
135
152
|
- **React 18** - UI library
|
|
136
|
-
- **Wagmi** -
|
|
137
|
-
- **Viem** - TypeScript interface for Ethereum
|
|
153
|
+
- **Wagmi & Viem** - Ethereum hooks & interface
|
|
138
154
|
- **Reown AppKit** - Wallet connection
|
|
139
|
-
- **Ant Design** - UI components
|
|
140
|
-
- **Styled Components** - CSS-in-JS styling
|
|
155
|
+
- **Ant Design** - UI components (with `astra` prefix)
|
|
141
156
|
- **Zustand** - State management
|
|
142
|
-
- **Axios** - HTTP client
|
|
143
|
-
- **Decimal.js** - Precise decimal arithmetic
|
|
144
|
-
|
|
145
|
-
## 🌐 Supported Networks
|
|
146
157
|
|
|
147
|
-
###
|
|
148
|
-
- **BSC** - Binance Smart Chain
|
|
149
|
-
- **Base** - Coinbase Layer 2
|
|
150
|
-
|
|
151
|
-
### Development Networks
|
|
152
|
-
- **Sepolia** - Ethereum testnet
|
|
153
|
-
- **Base Sepolia** - Base testnet
|
|
154
|
-
- **Botanix** - Bitcoin EVM testnet
|
|
155
|
-
|
|
156
|
-
## 📱 Mobile Support
|
|
157
|
-
|
|
158
|
-
The SDK is fully responsive and optimized for mobile devices with:
|
|
159
|
-
- Touch-friendly interfaces
|
|
160
|
-
- Responsive modal design
|
|
161
|
-
- Mobile wallet compatibility
|
|
162
|
-
- Optimized font sizes and spacing
|
|
163
|
-
|
|
164
|
-
## 🔐 Security Features
|
|
165
|
-
|
|
166
|
-
- Secure wallet connections via WalletConnect
|
|
167
|
-
- Transaction validation and verification
|
|
168
|
-
- Real-time status monitoring
|
|
169
|
-
- Error handling and user feedback
|
|
170
|
-
- Safe contract interactions
|
|
171
|
-
|
|
172
|
-
## 📄 License
|
|
158
|
+
### 📄 License
|
|
173
159
|
|
|
174
160
|
MIT License - see [LICENSE](LICENSE) file for details.
|
|
175
161
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
We welcome contributions! Please see our contributing guidelines:
|
|
179
|
-
|
|
180
|
-
1. Fork the repository
|
|
181
|
-
2. Create a feature branch
|
|
182
|
-
3. Make your changes
|
|
183
|
-
4. Add tests if applicable
|
|
184
|
-
5. Submit a pull request
|
|
185
|
-
|
|
186
|
-
## 📞 Support
|
|
187
|
-
|
|
188
|
-
For support and questions:
|
|
189
|
-
- Create an issue in the GitHub repository
|
|
190
|
-
- Check the documentation
|
|
191
|
-
- Review example implementations
|
|
162
|
+
---
|
|
192
163
|
|
|
193
|
-
|
|
164
|
+
### � Changelog
|
|
194
165
|
|
|
195
|
-
|
|
196
|
-
-
|
|
197
|
-
-
|
|
198
|
-
-
|
|
199
|
-
-
|
|
200
|
-
- Responsive design
|
|
166
|
+
#### v1.0.1
|
|
167
|
+
- Official release
|
|
168
|
+
- Corrected package name to `@lnfi-network/astra-sdk`
|
|
169
|
+
- Added comprehensive environment configuration support
|
|
170
|
+
- Updated API callback signatures
|
|
201
171
|
|
|
202
172
|
---
|
|
203
173
|
|
|
@@ -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-Zh6wUpmX.js";
|
|
2
2
|
const I = {
|
|
3
3
|
getGasPriceInEther(n, t) {
|
|
4
4
|
const o = t * n;
|
package/dist/astra-sdk.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as C } from "./index-
|
|
1
|
+
import { D as C } from "./index-Zh6wUpmX.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>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { af as p, ag as y, ah as w, ai as k, aj as b, ak as L, al as O, am as E, an as x, ao as R, ap as m, aq as M } from "./index-
|
|
1
|
+
import { af as p, ag as y, ah as w, ai as k, aj as b, ak as L, al as O, am as E, an as x, ao as R, ap as m, aq as M } from "./index-Zh6wUpmX.js";
|
|
2
2
|
class q extends p {
|
|
3
3
|
constructor({ callbackSelector: r, cause: a, data: n, extraData: i, sender: f, urls: t }) {
|
|
4
4
|
var o;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as i } from "./index-
|
|
1
|
+
import { D as i } from "./index-Zh6wUpmX.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>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as v, J as h, aI as E, K as l, a3 as P, at as _, aP as D, av as p, I as f, a1 as N, F as M, H as g, au as j, P as C, aQ as k, aR as c, _ as A, Y as U, aS as H, Q as y, T as x, V as T, U as $, S as V, aT as F, R as z } from "./index-
|
|
1
|
+
import { E as v, J as h, aI as E, K as l, a3 as P, at as _, aP as D, av as p, I as f, a1 as N, F as M, H as g, au as j, P as C, aQ as k, aR as c, _ as A, Y as U, aS as H, Q as y, T as x, V as T, U as $, S as V, aT as F, R as z } from "./index-Zh6wUpmX.js";
|
|
2
2
|
const Y = v`
|
|
3
3
|
div {
|
|
4
4
|
width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as l } from "./index-
|
|
1
|
+
import { D as l } from "./index-Zh6wUpmX.js";
|
|
2
2
|
const r = l`<svg width="13" height="12" viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<path d="M6.66686 12C9.9805 12 12.6667 9.31371 12.6667 6C12.6667 2.68629 9.9805 0 6.66686 0C3.35323 0 0.666992 2.68629 0.666992 6C0.666992 9.31371 3.35323 12 6.66686 12Z" fill="var(--wui-color-gray-glass-005)"/>
|
|
4
4
|
<path d="M6.6658 1.50098V4.82739L9.47712 6.08381L6.6658 1.50098Z" fill="var(--wui-color-gray-glass-060)"/>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as C } from "./index-
|
|
1
|
+
import { D as C } from "./index-Zh6wUpmX.js";
|
|
2
2
|
const t = C`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
3
3
|
<path d="M15.0162 11.6312L9.55059 2.13937C9.39228 1.86862 9.16584 1.64405 8.8938 1.48798C8.62176 1.33192 8.3136 1.2498 7.99997 1.2498C7.68634 1.2498 7.37817 1.33192 7.10613 1.48798C6.83409 1.64405 6.60765 1.86862 6.44934 2.13937L0.983716 11.6312C0.830104 11.894 0.749146 12.1928 0.749146 12.4972C0.749146 12.8015 0.830104 13.1004 0.983716 13.3631C1.14027 13.6352 1.3664 13.8608 1.63889 14.0166C1.91139 14.1725 2.22044 14.253 2.53434 14.25H13.4656C13.7793 14.2528 14.0881 14.1721 14.3603 14.0163C14.6326 13.8604 14.8585 13.635 15.015 13.3631C15.1688 13.1005 15.2499 12.8017 15.2502 12.4973C15.2504 12.193 15.1696 11.8941 15.0162 11.6312ZM13.7162 12.6125C13.6908 12.6558 13.6541 12.6914 13.6101 12.7157C13.5661 12.7399 13.5164 12.7517 13.4662 12.75H2.53434C2.48415 12.7517 2.43442 12.7399 2.39042 12.7157C2.34641 12.6914 2.30976 12.6558 2.28434 12.6125C2.26278 12.5774 2.25137 12.5371 2.25137 12.4959C2.25137 12.4548 2.26278 12.4144 2.28434 12.3794L7.74997 2.88749C7.77703 2.84583 7.81408 2.8116 7.85774 2.7879C7.9014 2.7642 7.95029 2.75178 7.99997 2.75178C8.04964 2.75178 8.09854 2.7642 8.1422 2.7879C8.18586 2.8116 8.2229 2.84583 8.24997 2.88749L13.715 12.3794C13.7367 12.4143 13.7483 12.4546 13.7486 12.4958C13.7488 12.5369 13.7376 12.5773 13.7162 12.6125ZM7.24997 8.49999V6.49999C7.24997 6.30108 7.32898 6.11031 7.46964 5.96966C7.61029 5.82901 7.80105 5.74999 7.99997 5.74999C8.19888 5.74999 8.38964 5.82901 8.5303 5.96966C8.67095 6.11031 8.74997 6.30108 8.74997 6.49999V8.49999C8.74997 8.6989 8.67095 8.88967 8.5303 9.03032C8.38964 9.17097 8.19888 9.24999 7.99997 9.24999C7.80105 9.24999 7.61029 9.17097 7.46964 9.03032C7.32898 8.88967 7.24997 8.6989 7.24997 8.49999ZM8.99997 11C8.99997 11.1978 8.94132 11.3911 8.83144 11.5556C8.72155 11.72 8.56538 11.8482 8.38265 11.9239C8.19992 11.9996 7.99886 12.0194 7.80488 11.9808C7.6109 11.9422 7.43271 11.847 7.29286 11.7071C7.15301 11.5672 7.05777 11.3891 7.01918 11.1951C6.9806 11.0011 7.0004 10.8 7.07609 10.6173C7.15177 10.4346 7.27995 10.2784 7.4444 10.1685C7.60885 10.0586 7.80219 9.99999 7.99997 9.99999C8.26518 9.99999 8.51954 10.1053 8.70707 10.2929C8.89461 10.4804 8.99997 10.7348 8.99997 11Z" fill="currentColor"/>
|
|
4
4
|
</svg>
|