astra-modal-test 1.0.5 → 1.0.7
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/.github/workflows/code-quality.yml +43 -0
- package/.github/workflows/publish.yml +64 -0
- package/README.md +204 -0
- package/dist/SwapController-CsNqEWIM.js +447 -0
- package/dist/add-Dm_oSEbv.js +19 -0
- package/dist/all-wallets-DfLlzQJ3.js +10 -0
- package/dist/app-store-BMdJkp6P.js +21 -0
- package/dist/apple-BetlVMKw.js +22 -0
- package/dist/arrow-bottom-BddPptxy.js +12 -0
- package/dist/arrow-bottom-circle-CvdJJniv.js +15 -0
- package/dist/arrow-left-Bbq-z1nQ.js +12 -0
- package/dist/arrow-right-Bu4_SVLC.js +12 -0
- package/dist/arrow-top-CynlXB-M.js +12 -0
- package/dist/astra-sdk.es.js +4 -4
- package/dist/bank-B9QscNnS.js +18 -0
- package/dist/bin-v-tshf8_.js +8 -0
- package/dist/bitcoin-C01gkYyN.js +17 -0
- package/dist/browser-9uNaCY31.js +18 -0
- package/dist/card-hKR9lRzU.js +18 -0
- package/dist/{ccip-oZOrZYR9.js → ccip-CUCziAPw.js} +52 -49
- package/dist/checkmark-D1M40aM5.js +15 -0
- package/dist/checkmark-bold-1_UGl24m.js +12 -0
- package/dist/chevron-bottom-BleoRNRL.js +12 -0
- package/dist/chevron-left-C9JMU-3B.js +12 -0
- package/dist/chevron-right-Daue4WBx.js +12 -0
- package/dist/chevron-top-yuXekbUC.js +12 -0
- package/dist/chrome-store-BsUFRR7F.js +65 -0
- package/dist/circle-BCxdhM5X.js +8 -0
- package/dist/clock-7a-DWZQa.js +12 -0
- package/dist/close-DMQYuJ0z.js +12 -0
- package/dist/clsx.m-DCYaa4RU.js +20 -0
- package/dist/coinPlaceholder-DjQ-HnSH.js +12 -0
- package/dist/compass-AMecXNVm.js +12 -0
- package/dist/copy-CgIPGYbU.js +19 -0
- package/dist/cursor-DpYbTNcO.js +7 -0
- package/dist/cursor-transparent-C8iPJkn8.js +16 -0
- package/dist/desktop-BWVQVGng.js +13 -0
- package/dist/disconnect-C6IQRrtF.js +12 -0
- package/dist/discord-gH3i-QsC.js +21 -0
- package/dist/email-BxYwJC5T.js +10 -0
- package/dist/embedded-wallet-DCcVNgkc.js +464 -0
- package/dist/ethereum-CGWsmZaC.js +14 -0
- package/dist/etherscan-D4EFsAJ4.js +10 -0
- package/dist/exclamation-triangle-DNwQ1Xq6.js +8 -0
- package/dist/extension-DxQPsN2z.js +12 -0
- package/dist/external-link-BeEzrdgR.js +12 -0
- package/dist/facebook-B2Ix8_d3.js +30 -0
- package/dist/farcaster-BB83p8dC.js +16 -0
- package/dist/filters-PzdIomB1.js +12 -0
- package/dist/github-gcp1rxX0.js +22 -0
- package/dist/google-Qv9lTZcz.js +22 -0
- package/dist/help-circle-BLXTMjzX.js +16 -0
- package/dist/id-BHg2CRhj.js +16 -0
- package/dist/image-DWi1V30x.js +8 -0
- package/dist/index-4lbsZ6RQ.js +33 -0
- package/dist/index-64U3D9_n.js +21034 -0
- package/dist/index-CRU49I0g.js +15911 -0
- package/dist/index-ChxXyuZj.js +572 -0
- package/dist/index-ClS956E1.js +74511 -0
- package/dist/index-Cs4fWw01.js +386 -0
- package/dist/index-DfWqgW4h.js +709 -0
- package/dist/index-VYNI76FM.js +315 -0
- package/dist/index-qfkTLN90.js +10785 -0
- package/dist/index-r2ztgVN2.js +1060 -0
- package/dist/index-wvh7Yd5J.js +70 -0
- package/dist/info-Bl5tmiBJ.js +7 -0
- package/dist/info-circle-D2uYywg-.js +16 -0
- package/dist/lightbulb-HvXH2AVF.js +7 -0
- package/dist/mail-DXOPfnog.js +12 -0
- package/dist/mobile-Dd0Gj4vZ.js +13 -0
- package/dist/more-DYcnClbB.js +15 -0
- package/dist/network-placeholder-CfRZGQfi.js +18 -0
- package/dist/nftPlaceholder-DHmFkY55.js +12 -0
- package/dist/off-CG2Y30qN.js +8 -0
- package/dist/onramp-DoAMTeNm.js +917 -0
- package/dist/play-store-B5EYBQto.js +36 -0
- package/dist/plus-DPo25_zL.js +17 -0
- package/dist/qr-code-BRTO19PL.js +10 -0
- package/dist/receive-BvclNdV_.js +179 -0
- package/dist/recycle-horizontal-ng_b2eJV.js +13 -0
- package/dist/refresh-3kiwRV0w.js +12 -0
- package/dist/reown-logo-_9cuIfJD.js +16 -0
- package/dist/search-CoJvIxpi.js +12 -0
- package/dist/secp256k1-wZyK2iIX.js +1257 -0
- package/dist/send-BVKGSR-Z.js +19 -0
- package/dist/send-Bkj5YtHe.js +1039 -0
- package/dist/socials-DL42HlL5.js +589 -0
- package/dist/solana-BjP-_Ioa.js +17 -0
- package/dist/swapHorizontal-Do3uBbum.js +12 -0
- package/dist/swapHorizontalBold-D7N75BE-.js +12 -0
- package/dist/swapHorizontalMedium-BahEVO2x.js +20 -0
- package/dist/swapHorizontalRoundedBold-D6Hoi132.js +12 -0
- package/dist/swapVertical-P-fnrADh.js +12 -0
- package/dist/swaps-DZgbVJZ2.js +1713 -0
- package/dist/telegram-DmaL2iB8.js +20 -0
- package/dist/three-dots-oXyAsUA6.js +9 -0
- package/dist/transactions-BjB5yZN7.js +35 -0
- package/dist/twitch-0UGrMr2K.js +22 -0
- package/dist/twitterIcon-B97KAbaJ.js +10 -0
- package/dist/ui-r6nnVhBA.js +812 -0
- package/dist/user-BG1yp56Q.js +7 -0
- package/dist/verify-CgzkMSuV.js +12 -0
- package/dist/verify-filled-D-TRpWtN.js +12 -0
- package/dist/w3m-modal-Drsibcs0.js +1041 -0
- package/dist/wallet-CAHsZdfj.js +12 -0
- package/dist/wallet-placeholder-agbbreqw.js +18 -0
- package/dist/walletconnect-Yd8iXqY9.js +36 -0
- package/dist/warning-circle-C0hqC6h_.js +16 -0
- package/dist/x-mark-D9_ai2sI.js +7 -0
- package/dist/x-z6v1Jegg.js +16 -0
- package/eslint.config.mjs +1 -1
- package/package.json +14 -13
- package/src/apis/lspApi.js +47 -24
- 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/botanix.png +0 -0
- package/src/assets/network/bsc.svg +13 -0
- package/src/assets/pay.png +0 -0
- package/src/assets/tokens/usdc.png +0 -0
- package/src/assets/tokens/usdt.png +0 -0
- package/src/comps/AstraImage.jsx +17 -3
- package/src/comps/AstraModal.jsx +22 -16
- package/src/comps/AstraModalLogo.jsx +9 -9
- package/src/comps/AstraNetwork.jsx +174 -45
- package/src/comps/CheckErc20Button.jsx +1 -1
- package/src/comps/CommonStyle.jsx +4 -0
- package/src/comps/ConnectButton.jsx +16 -33
- package/src/comps/ResultModal.jsx +45 -39
- package/src/comps/ToLightning.jsx +207 -80
- package/src/comps/ToToken.jsx +278 -217
- package/src/constants/index.js +20 -4
- package/src/hooks/useContract.js +164 -125
- package/src/hooks/useGetMinAndMax.js +48 -0
- package/src/hooks/useLspApi.js +56 -39
- package/src/hooks/useParseInvoice.js +82 -72
- package/src/index.jsx +43 -10
- package/src/main.jsx +36 -5
- package/src/utils/index.js +136 -24
- package/vite.config.js +7 -1
- package/dist/astra-sdk.umd.js +0 -12578
- package/dist/hooks.module-BBZfodGH.js +0 -506
- package/dist/index-BKKAfRrw.js +0 -87520
- package/dist/index-C2MAIRET.js +0 -2929
- package/dist/index-CsRxokSv.js +0 -445
- package/dist/index-DQ6iiHxJ.js +0 -13720
- package/dist/index-SJhlkSif.js +0 -133
- package/dist/w3m-modal-CYJpmgnf.js +0 -267
- package/src/constants/contracts/abi/bridge.js +0 -1281
- package/src/constants/contracts/abi/index.js +0 -3
- package/src/constants/contracts/abi/usdt.js +0 -130
- package/src/constants/contracts/abi/watcher.js +0 -437
- package/src/constants/contracts/index.js +0 -37
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: Code Quality Check
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- develop
|
|
8
|
+
pull_request:
|
|
9
|
+
branches:
|
|
10
|
+
- main
|
|
11
|
+
- develop
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
security:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
permissions:
|
|
17
|
+
contents: read
|
|
18
|
+
security-events: write
|
|
19
|
+
actions: read
|
|
20
|
+
checks: write
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
with:
|
|
24
|
+
fetch-depth: 0
|
|
25
|
+
|
|
26
|
+
- uses: github/codeql-action/init@v3
|
|
27
|
+
with:
|
|
28
|
+
languages: javascript
|
|
29
|
+
|
|
30
|
+
- uses: github/codeql-action/analyze@v3
|
|
31
|
+
|
|
32
|
+
eslint:
|
|
33
|
+
runs-on: ubuntu-latest
|
|
34
|
+
permissions:
|
|
35
|
+
contents: read
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@v4
|
|
38
|
+
- uses: actions/setup-node@v4
|
|
39
|
+
with:
|
|
40
|
+
node-version: 22
|
|
41
|
+
cache: "npm"
|
|
42
|
+
- run: yarn install
|
|
43
|
+
- run: yarn lint
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
name: Build and Publish to NPM
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
build-and-publish:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
environment: prod-deploy
|
|
10
|
+
steps:
|
|
11
|
+
- name: Checkout
|
|
12
|
+
uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- name: Setup Node.js
|
|
15
|
+
uses: actions/setup-node@v4
|
|
16
|
+
with:
|
|
17
|
+
node-version: 22
|
|
18
|
+
registry-url: https://registry.npmjs.org
|
|
19
|
+
cache: "yarn"
|
|
20
|
+
|
|
21
|
+
- name: Install dependencies
|
|
22
|
+
run: yarn install
|
|
23
|
+
|
|
24
|
+
- name: Build
|
|
25
|
+
run: npm run build
|
|
26
|
+
|
|
27
|
+
- name: Generate build hash
|
|
28
|
+
id: build-hash
|
|
29
|
+
run: |
|
|
30
|
+
BUILD_HASH=$(find dist -type f -exec sha256sum {} \; | sha256sum | cut -d' ' -f1)
|
|
31
|
+
echo "build_hash=$BUILD_HASH" >> $GITHUB_OUTPUT
|
|
32
|
+
echo "Build hash: $BUILD_HASH"
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
|
|
36
|
+
BUILD_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
37
|
+
echo "{\"version\":\"$PACKAGE_VERSION\",\"buildHash\":\"$BUILD_HASH\",\"buildTime\":\"$BUILD_TIME\"}" > dist/build-info.json
|
|
38
|
+
|
|
39
|
+
- name: Check if package should be published
|
|
40
|
+
id: check-publish
|
|
41
|
+
run: |
|
|
42
|
+
PACKAGE_NAME=$(node -p "require('./package.json').name")
|
|
43
|
+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
|
|
44
|
+
if npm view $PACKAGE_NAME@$PACKAGE_VERSION version > /dev/null 2>&1; then
|
|
45
|
+
echo "Version $PACKAGE_VERSION of $PACKAGE_NAME is already published on NPM. Skipping publish."
|
|
46
|
+
echo "should_publish=false" >> $GITHUB_OUTPUT
|
|
47
|
+
else
|
|
48
|
+
echo "Version $PACKAGE_VERSION of $PACKAGE_NAME is new. Proceeding to publish."
|
|
49
|
+
echo "should_publish=true" >> $GITHUB_OUTPUT
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
- name: Upload build artifacts
|
|
53
|
+
uses: actions/upload-artifact@v4
|
|
54
|
+
with:
|
|
55
|
+
name: build-artifacts-${{ steps.build-hash.outputs.build_hash }}
|
|
56
|
+
path: |
|
|
57
|
+
dist/
|
|
58
|
+
!dist/**/*.map
|
|
59
|
+
|
|
60
|
+
- name: Publish new version
|
|
61
|
+
if: steps.check-publish.outputs.should_publish == 'true'
|
|
62
|
+
run: npm publish --access public
|
|
63
|
+
env:
|
|
64
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/README.md
CHANGED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Astra SDK
|
|
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
|
+
## 🚀 Quick Start
|
|
16
|
+
|
|
17
|
+
### Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install astra-modal
|
|
21
|
+
# or
|
|
22
|
+
yarn add astra-modal
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Basic Usage
|
|
26
|
+
|
|
27
|
+
```jsx
|
|
28
|
+
import React from 'react';
|
|
29
|
+
import { AstraProvider, AstraModal, astraSend, astraReceive } from 'astra-modal';
|
|
30
|
+
|
|
31
|
+
function App() {
|
|
32
|
+
return (
|
|
33
|
+
<AstraProvider
|
|
34
|
+
projectId="your-project-id"
|
|
35
|
+
>
|
|
36
|
+
<AstraModal />
|
|
37
|
+
|
|
38
|
+
{/* Lightning to EVM */}
|
|
39
|
+
<button onClick={() => astraSend({
|
|
40
|
+
assetId: "your-asset-id",
|
|
41
|
+
amount: 1000
|
|
42
|
+
})}>
|
|
43
|
+
Bridge from Lightning
|
|
44
|
+
</button>
|
|
45
|
+
|
|
46
|
+
{/* EVM to Lightning */}
|
|
47
|
+
<button onClick={() => astraReceive({
|
|
48
|
+
assetId: "your-asset-id",
|
|
49
|
+
invoice: "lnbc..."
|
|
50
|
+
})}>
|
|
51
|
+
Bridge to Lightning
|
|
52
|
+
</button>
|
|
53
|
+
</AstraProvider>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## 📖 API Reference
|
|
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
|
|
98
|
+
|
|
99
|
+
- Node.js 16+
|
|
100
|
+
- npm or yarn
|
|
101
|
+
- React 18+
|
|
102
|
+
|
|
103
|
+
### Local Development
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# Clone the repository
|
|
107
|
+
git clone <repository-url>
|
|
108
|
+
cd astrasdk
|
|
109
|
+
|
|
110
|
+
# Install dependencies (use npm only)
|
|
111
|
+
npm install
|
|
112
|
+
|
|
113
|
+
# Start development server
|
|
114
|
+
npm run dev
|
|
115
|
+
|
|
116
|
+
# Build for production
|
|
117
|
+
npm run build
|
|
118
|
+
|
|
119
|
+
# Run linter
|
|
120
|
+
npm run lint
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Note**: This project uses npm as the package manager. Please avoid using yarn to prevent compatibility issues.
|
|
124
|
+
|
|
125
|
+
### Environment Configuration
|
|
126
|
+
|
|
127
|
+
For development, you can use the provided test configuration:
|
|
128
|
+
|
|
129
|
+
```jsx
|
|
130
|
+
const projectId = "your-test-project-id";
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## 🔧 Technical Stack
|
|
134
|
+
|
|
135
|
+
- **React 18** - UI library
|
|
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
|
|
144
|
+
|
|
145
|
+
## 🌐 Supported Networks
|
|
146
|
+
|
|
147
|
+
### Production Networks
|
|
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
|
|
173
|
+
|
|
174
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
175
|
+
|
|
176
|
+
## 🤝 Contributing
|
|
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
|
|
192
|
+
|
|
193
|
+
## 🔄 Changelog
|
|
194
|
+
|
|
195
|
+
### v1.0.34
|
|
196
|
+
- Initial public release
|
|
197
|
+
- EVM ↔ Lightning bridge functionality
|
|
198
|
+
- Multi-chain support
|
|
199
|
+
- Wallet integration
|
|
200
|
+
- Responsive design
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
Built with ❤️ by the Astra Labs team
|