astra-modal-test 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/dist/astra-sdk.es.js +8 -0
- package/dist/astra-sdk.umd.js +12576 -0
- package/dist/ccip-Bpb4GlU6.mjs +146 -0
- package/dist/hooks.module-BBZfodGH.mjs +506 -0
- package/dist/index-BTsa09iy.mjs +84805 -0
- package/dist/index-CEtKkuP2.mjs +133 -0
- package/dist/index-CbWGAz3l.mjs +445 -0
- package/dist/index-DRPxIWUd.mjs +13720 -0
- package/dist/index-h9_6XS0r.mjs +2929 -0
- package/dist/secp256k1-3OC5y4qp.mjs +1578 -0
- package/dist/vite.svg +1 -0
- package/dist/w3m-modal-R9m1z1SQ.mjs +267 -0
- package/eslint.config.js +39 -0
- package/index.html +13 -0
- package/package.json +50 -0
- package/public/vite.svg +1 -0
- package/src/App.css +170 -0
- package/src/apis/lspApi.js +59 -0
- package/src/apis/request.js +59 -0
- package/src/assets/arrow-right.svg +3 -0
- package/src/assets/astr.svg +13 -0
- package/src/assets/bridge-loading.png +0 -0
- package/src/assets/network/base.png +0 -0
- package/src/assets/network/eth.png +0 -0
- package/src/assets/network/lighting.png +0 -0
- package/src/assets/network/ligtning.svg +22 -0
- package/src/assets/network/solona.png +0 -0
- package/src/assets/powerby.svg +14 -0
- package/src/assets/react.svg +1 -0
- package/src/assets/success.svg +3 -0
- package/src/assets/tip.svg +5 -0
- 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 +23 -0
- package/src/comps/AstraModal.jsx +207 -0
- package/src/comps/AstraModalLogo.jsx +53 -0
- package/src/comps/AstraNetwork.jsx +115 -0
- package/src/comps/CheckErc20Button.jsx +28 -0
- package/src/comps/ConnectButton.jsx +37 -0
- package/src/comps/EllipsisMiddle.jsx +42 -0
- package/src/comps/ResultModal.jsx +307 -0
- package/src/comps/ToLightning.jsx +502 -0
- package/src/comps/ToToken.jsx +467 -0
- package/src/constants/contracts/abi/bridge.js +1246 -0
- package/src/constants/contracts/abi/index.js +3 -0
- package/src/constants/contracts/abi/usdt.js +130 -0
- package/src/constants/contracts/abi/watcher.js +523 -0
- package/src/constants/contracts/index.js +37 -0
- package/src/constants/index.js +5 -0
- 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 +127 -0
- package/src/hooks/useLspApi.js +53 -0
- package/src/hooks/useParseInvoice.js +85 -0
- package/src/index.css +69 -0
- package/src/index.jsx +112 -0
- package/src/lib/bolt11.min.js +1 -0
- package/src/main.jsx +41 -0
- package/src/store/index.js +25 -0
- package/src/theme.js +108 -0
- package/src/utils/index.js +36 -0
- package/vite.config.js +44 -0
package/dist/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { i as v, b as y, O as w, M as s, C as h, aW as k, E as g, x as p, R as u, S as b, U as C, l as x, d as E, g as A, aX as L, f as m, c as N, aY as T } from "./index-BTsa09iy.mjs";
|
|
2
|
+
const O = v`
|
|
3
|
+
:host {
|
|
4
|
+
z-index: var(--w3m-z-index);
|
|
5
|
+
display: block;
|
|
6
|
+
backface-visibility: hidden;
|
|
7
|
+
will-change: opacity;
|
|
8
|
+
position: fixed;
|
|
9
|
+
top: 0;
|
|
10
|
+
left: 0;
|
|
11
|
+
right: 0;
|
|
12
|
+
bottom: 0;
|
|
13
|
+
pointer-events: none;
|
|
14
|
+
opacity: 0;
|
|
15
|
+
background-color: var(--wui-cover);
|
|
16
|
+
transition: opacity 0.2s var(--wui-ease-out-power-2);
|
|
17
|
+
will-change: opacity;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:host(.open) {
|
|
21
|
+
opacity: 1;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host(.embedded) {
|
|
25
|
+
position: relative;
|
|
26
|
+
pointer-events: unset;
|
|
27
|
+
background: none;
|
|
28
|
+
width: 100%;
|
|
29
|
+
opacity: 1;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
wui-card {
|
|
33
|
+
max-width: var(--w3m-modal-width);
|
|
34
|
+
width: 100%;
|
|
35
|
+
position: relative;
|
|
36
|
+
animation: zoom-in 0.2s var(--wui-ease-out-power-2);
|
|
37
|
+
animation-fill-mode: backwards;
|
|
38
|
+
outline: none;
|
|
39
|
+
transition: border-radius var(--wui-duration-lg) var(--wui-ease-out-power-1);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:host(.embedded) wui-card {
|
|
43
|
+
max-width: 400px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
wui-card[shake='true'] {
|
|
47
|
+
animation:
|
|
48
|
+
zoom-in 0.2s var(--wui-ease-out-power-2),
|
|
49
|
+
w3m-shake 0.5s var(--wui-ease-out-power-2);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
wui-flex {
|
|
53
|
+
overflow-x: hidden;
|
|
54
|
+
overflow-y: auto;
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
width: 100%;
|
|
59
|
+
height: 100%;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@media (max-height: 700px) and (min-width: 431px) {
|
|
63
|
+
wui-flex {
|
|
64
|
+
align-items: flex-start;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
wui-card {
|
|
68
|
+
margin: var(--wui-spacing-xxl) 0px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@media (max-width: 430px) {
|
|
73
|
+
wui-flex {
|
|
74
|
+
align-items: flex-end;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
wui-card {
|
|
78
|
+
max-width: 100%;
|
|
79
|
+
border-bottom-left-radius: var(--local-border-bottom-mobile-radius);
|
|
80
|
+
border-bottom-right-radius: var(--local-border-bottom-mobile-radius);
|
|
81
|
+
border-bottom: none;
|
|
82
|
+
animation: slide-in 0.2s var(--wui-ease-out-power-2);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
wui-card[shake='true'] {
|
|
86
|
+
animation:
|
|
87
|
+
slide-in 0.2s var(--wui-ease-out-power-2),
|
|
88
|
+
w3m-shake 0.5s var(--wui-ease-out-power-2);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@keyframes zoom-in {
|
|
93
|
+
0% {
|
|
94
|
+
transform: scale(0.95) translateY(0);
|
|
95
|
+
}
|
|
96
|
+
100% {
|
|
97
|
+
transform: scale(1) translateY(0);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@keyframes slide-in {
|
|
102
|
+
0% {
|
|
103
|
+
transform: scale(1) translateY(50px);
|
|
104
|
+
}
|
|
105
|
+
100% {
|
|
106
|
+
transform: scale(1) translateY(0);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@keyframes w3m-shake {
|
|
111
|
+
0% {
|
|
112
|
+
transform: scale(1) rotate(0deg);
|
|
113
|
+
}
|
|
114
|
+
20% {
|
|
115
|
+
transform: scale(1) rotate(-1deg);
|
|
116
|
+
}
|
|
117
|
+
40% {
|
|
118
|
+
transform: scale(1) rotate(1.5deg);
|
|
119
|
+
}
|
|
120
|
+
60% {
|
|
121
|
+
transform: scale(1) rotate(-1.5deg);
|
|
122
|
+
}
|
|
123
|
+
80% {
|
|
124
|
+
transform: scale(1) rotate(1deg);
|
|
125
|
+
}
|
|
126
|
+
100% {
|
|
127
|
+
transform: scale(1) rotate(0deg);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@keyframes w3m-view-height {
|
|
132
|
+
from {
|
|
133
|
+
height: var(--prev-height);
|
|
134
|
+
}
|
|
135
|
+
to {
|
|
136
|
+
height: var(--new-height);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
`;
|
|
140
|
+
var d = function(c, e, t, o) {
|
|
141
|
+
var a = arguments.length, i = a < 3 ? e : o === null ? o = Object.getOwnPropertyDescriptor(e, t) : o, n;
|
|
142
|
+
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(c, e, t, o);
|
|
143
|
+
else for (var l = c.length - 1; l >= 0; l--) (n = c[l]) && (i = (a < 3 ? n(i) : a > 3 ? n(e, t, i) : n(e, t)) || i);
|
|
144
|
+
return a > 3 && i && Object.defineProperty(e, t, i), i;
|
|
145
|
+
};
|
|
146
|
+
const f = "scroll-lock";
|
|
147
|
+
let r = class extends y {
|
|
148
|
+
constructor() {
|
|
149
|
+
super(), this.unsubscribe = [], this.abortController = void 0, this.enableEmbedded = w.state.enableEmbedded, this.open = s.state.open, this.caipAddress = h.state.activeCaipAddress, this.caipNetwork = h.state.activeCaipNetwork, this.shake = s.state.shake, this.initializeTheming(), k.prefetch(), this.unsubscribe.push(s.subscribeKey("open", (e) => e ? this.onOpen() : this.onClose()), s.subscribeKey("shake", (e) => this.shake = e), h.subscribeKey("activeCaipNetwork", (e) => this.onNewNetwork(e)), h.subscribeKey("activeCaipAddress", (e) => this.onNewAddress(e))), g.sendEvent({ type: "track", event: "MODAL_LOADED" });
|
|
150
|
+
}
|
|
151
|
+
firstUpdated() {
|
|
152
|
+
w.setEnableEmbedded(this.enableEmbedded), this.enableEmbedded && this.caipAddress && s.close();
|
|
153
|
+
}
|
|
154
|
+
disconnectedCallback() {
|
|
155
|
+
this.unsubscribe.forEach((e) => e()), this.onRemoveKeyboardListener();
|
|
156
|
+
}
|
|
157
|
+
render() {
|
|
158
|
+
return this.style.cssText = `
|
|
159
|
+
--local-border-bottom-mobile-radius: ${this.enableEmbedded ? "clamp(0px, var(--wui-border-radius-l), 44px)" : "0px"};
|
|
160
|
+
`, this.enableEmbedded ? p`${this.contentTemplate()}
|
|
161
|
+
<w3m-tooltip></w3m-tooltip> ` : this.open ? p`
|
|
162
|
+
<wui-flex @click=${this.onOverlayClick.bind(this)} data-testid="w3m-modal-overlay">
|
|
163
|
+
${this.contentTemplate()}
|
|
164
|
+
</wui-flex>
|
|
165
|
+
<w3m-tooltip></w3m-tooltip>
|
|
166
|
+
` : null;
|
|
167
|
+
}
|
|
168
|
+
contentTemplate() {
|
|
169
|
+
return p` <wui-card
|
|
170
|
+
shake="${this.shake}"
|
|
171
|
+
role="alertdialog"
|
|
172
|
+
aria-modal="true"
|
|
173
|
+
tabindex="0"
|
|
174
|
+
data-testid="w3m-modal-card"
|
|
175
|
+
>
|
|
176
|
+
<w3m-header></w3m-header>
|
|
177
|
+
<w3m-router></w3m-router>
|
|
178
|
+
<w3m-snackbar></w3m-snackbar>
|
|
179
|
+
<w3m-alertbar></w3m-alertbar>
|
|
180
|
+
</wui-card>`;
|
|
181
|
+
}
|
|
182
|
+
async onOverlayClick(e) {
|
|
183
|
+
e.target === e.currentTarget && await this.handleClose();
|
|
184
|
+
}
|
|
185
|
+
async handleClose() {
|
|
186
|
+
u.state.view === "UnsupportedChain" || await b.isSIWXCloseDisabled() ? s.shake() : s.close();
|
|
187
|
+
}
|
|
188
|
+
initializeTheming() {
|
|
189
|
+
const { themeVariables: e, themeMode: t } = T.state, o = C.getColorTheme(t);
|
|
190
|
+
x(e, o);
|
|
191
|
+
}
|
|
192
|
+
onClose() {
|
|
193
|
+
this.open = !1, this.classList.remove("open"), this.onScrollUnlock(), E.hide(), this.onRemoveKeyboardListener();
|
|
194
|
+
}
|
|
195
|
+
onOpen() {
|
|
196
|
+
this.open = !0, this.classList.add("open"), this.onScrollLock(), this.onAddKeyboardListener();
|
|
197
|
+
}
|
|
198
|
+
onScrollLock() {
|
|
199
|
+
const e = document.createElement("style");
|
|
200
|
+
e.dataset.w3m = f, e.textContent = `
|
|
201
|
+
body {
|
|
202
|
+
touch-action: none;
|
|
203
|
+
overflow: hidden;
|
|
204
|
+
overscroll-behavior: contain;
|
|
205
|
+
}
|
|
206
|
+
w3m-modal {
|
|
207
|
+
pointer-events: auto;
|
|
208
|
+
}
|
|
209
|
+
`, document.head.appendChild(e);
|
|
210
|
+
}
|
|
211
|
+
onScrollUnlock() {
|
|
212
|
+
const e = document.head.querySelector(`style[data-w3m="${f}"]`);
|
|
213
|
+
e && e.remove();
|
|
214
|
+
}
|
|
215
|
+
onAddKeyboardListener() {
|
|
216
|
+
var t;
|
|
217
|
+
this.abortController = new AbortController();
|
|
218
|
+
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("wui-card");
|
|
219
|
+
e == null || e.focus(), window.addEventListener("keydown", (o) => {
|
|
220
|
+
if (o.key === "Escape")
|
|
221
|
+
this.handleClose();
|
|
222
|
+
else if (o.key === "Tab") {
|
|
223
|
+
const { tagName: a } = o.target;
|
|
224
|
+
a && !a.includes("W3M-") && !a.includes("WUI-") && (e == null || e.focus());
|
|
225
|
+
}
|
|
226
|
+
}, this.abortController);
|
|
227
|
+
}
|
|
228
|
+
onRemoveKeyboardListener() {
|
|
229
|
+
var e;
|
|
230
|
+
(e = this.abortController) == null || e.abort(), this.abortController = void 0;
|
|
231
|
+
}
|
|
232
|
+
async onNewAddress(e) {
|
|
233
|
+
const t = A.getPlainAddress(e);
|
|
234
|
+
this.caipAddress = e, await b.initializeIfEnabled(), (!t || this.enableEmbedded) && s.close();
|
|
235
|
+
}
|
|
236
|
+
onNewNetwork(e) {
|
|
237
|
+
var a, i, n, l;
|
|
238
|
+
if (!this.caipAddress) {
|
|
239
|
+
this.caipNetwork = e, u.goBack();
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
const t = (i = (a = this.caipNetwork) == null ? void 0 : a.caipNetworkId) == null ? void 0 : i.toString(), o = (n = e == null ? void 0 : e.caipNetworkId) == null ? void 0 : n.toString();
|
|
243
|
+
t && o && t !== o && ((l = this.caipNetwork) == null ? void 0 : l.name) !== "Unknown Network" && u.goBack(), this.caipNetwork = e;
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
r.styles = O;
|
|
247
|
+
d([
|
|
248
|
+
L({ type: Boolean })
|
|
249
|
+
], r.prototype, "enableEmbedded", void 0);
|
|
250
|
+
d([
|
|
251
|
+
m()
|
|
252
|
+
], r.prototype, "open", void 0);
|
|
253
|
+
d([
|
|
254
|
+
m()
|
|
255
|
+
], r.prototype, "caipAddress", void 0);
|
|
256
|
+
d([
|
|
257
|
+
m()
|
|
258
|
+
], r.prototype, "caipNetwork", void 0);
|
|
259
|
+
d([
|
|
260
|
+
m()
|
|
261
|
+
], r.prototype, "shake", void 0);
|
|
262
|
+
r = d([
|
|
263
|
+
N("w3m-modal")
|
|
264
|
+
], r);
|
|
265
|
+
export {
|
|
266
|
+
r as W3mModal
|
|
267
|
+
};
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import globals from 'globals'
|
|
3
|
+
import react from 'eslint-plugin-react'
|
|
4
|
+
import reactHooks from 'eslint-plugin-react-hooks'
|
|
5
|
+
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
6
|
+
|
|
7
|
+
export default [
|
|
8
|
+
{ ignores: ['dist'] },
|
|
9
|
+
{
|
|
10
|
+
files: ['**/*.{js,jsx}'],
|
|
11
|
+
languageOptions: {
|
|
12
|
+
ecmaVersion: 2020,
|
|
13
|
+
globals: globals.browser,
|
|
14
|
+
parserOptions: {
|
|
15
|
+
ecmaVersion: 'latest',
|
|
16
|
+
ecmaFeatures: { jsx: true },
|
|
17
|
+
sourceType: 'module',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
settings: { react: { version: '18.3' } },
|
|
21
|
+
plugins: {
|
|
22
|
+
react,
|
|
23
|
+
'react-hooks': reactHooks,
|
|
24
|
+
'react-refresh': reactRefresh,
|
|
25
|
+
},
|
|
26
|
+
rules: {
|
|
27
|
+
...js.configs.recommended.rules,
|
|
28
|
+
...react.configs.recommended.rules,
|
|
29
|
+
...react.configs['jsx-runtime'].rules,
|
|
30
|
+
...reactHooks.configs.recommended.rules,
|
|
31
|
+
'react/jsx-no-target-blank': 'off',
|
|
32
|
+
'react-refresh/only-export-components': [
|
|
33
|
+
'warn',
|
|
34
|
+
{ allowConstantExport: true },
|
|
35
|
+
],
|
|
36
|
+
'react/prop-types': 'off',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
]
|
package/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vite + React</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.jsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "astra-modal-test",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"main": "dist/astra-sdk.es.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"lint": "eslint .",
|
|
10
|
+
"preview": "vite preview"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@ant-design/icons": "^5.5.2",
|
|
14
|
+
"@reown/appkit": "^1.6.0",
|
|
15
|
+
"@reown/appkit-adapter-wagmi": "^1.6.0",
|
|
16
|
+
"@tanstack/react-query": "^5.62.7",
|
|
17
|
+
"ahooks": "^3.8.4",
|
|
18
|
+
"antd": "^5.22.4",
|
|
19
|
+
"axios": "^1.7.9",
|
|
20
|
+
"dayjs": "^1.11.13",
|
|
21
|
+
"decimal.js": "^10.4.3",
|
|
22
|
+
"react": "^18.3.1",
|
|
23
|
+
"react-dom": "^18.3.1",
|
|
24
|
+
"styled-components": "^6.1.13",
|
|
25
|
+
"viem": "^2.21.54",
|
|
26
|
+
"wagmi": "^2.14.0",
|
|
27
|
+
"zustand": "^5.0.2"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"@reown/appkit": "^1.6.0",
|
|
31
|
+
"@reown/appkit-adapter-wagmi": "^1.6.0",
|
|
32
|
+
"@tanstack/react-query": "^5.62.7",
|
|
33
|
+
"viem": "^2.21.54",
|
|
34
|
+
"wagmi": "^2.14.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@eslint/js": "^9.15.0",
|
|
38
|
+
"@types/react": "^18.3.12",
|
|
39
|
+
"@types/react-dom": "^18.3.1",
|
|
40
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
41
|
+
"eslint": "^9.15.0",
|
|
42
|
+
"eslint-plugin-react": "^7.37.2",
|
|
43
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
44
|
+
"eslint-plugin-react-refresh": "^0.4.14",
|
|
45
|
+
"globals": "^15.12.0",
|
|
46
|
+
"vite": "^6.0.3",
|
|
47
|
+
"vite-plugin-node-polyfills": "^0.22.0",
|
|
48
|
+
"vite-plugin-style-import": "^2.0.0"
|
|
49
|
+
}
|
|
50
|
+
}
|
package/public/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/src/App.css
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/* #root {
|
|
2
|
+
max-width: 1280px;
|
|
3
|
+
margin: 0 auto;
|
|
4
|
+
padding: 2rem;
|
|
5
|
+
text-align: center;
|
|
6
|
+
}
|
|
7
|
+
@font-face {
|
|
8
|
+
font-family: "ClashDisplay";
|
|
9
|
+
src: url("./font/ClashDisplay-Variable.ttf");
|
|
10
|
+
}
|
|
11
|
+
* {
|
|
12
|
+
font-family: ClashDisplay;
|
|
13
|
+
font-weight: 400;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.logo {
|
|
17
|
+
height: 6em;
|
|
18
|
+
padding: 1.5em;
|
|
19
|
+
will-change: filter;
|
|
20
|
+
transition: filter 300ms;
|
|
21
|
+
}
|
|
22
|
+
.logo:hover {
|
|
23
|
+
filter: drop-shadow(0 0 2em #646cffaa);
|
|
24
|
+
}
|
|
25
|
+
.logo.react:hover {
|
|
26
|
+
filter: drop-shadow(0 0 2em #61dafbaa);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@keyframes logo-spin {
|
|
30
|
+
from {
|
|
31
|
+
transform: rotate(0deg);
|
|
32
|
+
}
|
|
33
|
+
to {
|
|
34
|
+
transform: rotate(360deg);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
39
|
+
a:nth-of-type(2) .logo {
|
|
40
|
+
animation: logo-spin infinite 20s linear;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.card {
|
|
45
|
+
padding: 2em;
|
|
46
|
+
}
|
|
47
|
+
.read-the-docs {
|
|
48
|
+
color: #888;
|
|
49
|
+
}
|
|
50
|
+
.fw500 {
|
|
51
|
+
font-weight: 500;
|
|
52
|
+
}
|
|
53
|
+
.colorcaff33 {
|
|
54
|
+
color: #caff33;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.astra-modal {
|
|
58
|
+
background: transparent;
|
|
59
|
+
}
|
|
60
|
+
.astra-modal .astra-modal-content {
|
|
61
|
+
background: rgba(51, 51, 51, 0.2);
|
|
62
|
+
border: 1px solid;
|
|
63
|
+
|
|
64
|
+
border-image-source: linear-gradient(
|
|
65
|
+
147.76deg,
|
|
66
|
+
#333333 0.7%,
|
|
67
|
+
rgba(51, 51, 51, 0) 98.42%
|
|
68
|
+
);
|
|
69
|
+
backdrop-filter: blur(50px);
|
|
70
|
+
padding: 20px 30px;
|
|
71
|
+
}
|
|
72
|
+
.astra-modal .astra-modal-content .astra-modal-header {
|
|
73
|
+
background: transparent;
|
|
74
|
+
}
|
|
75
|
+
.astra-modal .astra-modal-content .astra-modal-header .modal-title {
|
|
76
|
+
font-size: 20px;
|
|
77
|
+
font-weight: 500;
|
|
78
|
+
}
|
|
79
|
+
.astra-typography {
|
|
80
|
+
font-family: ClashDisplay;
|
|
81
|
+
}
|
|
82
|
+
.form-item-pair {
|
|
83
|
+
padding: 8px 20px 8px 10px;
|
|
84
|
+
border-radius: 12px;
|
|
85
|
+
background: rgba(166, 166, 166, 0.1);
|
|
86
|
+
border: 1px solid rgba(166, 166, 166, 1);
|
|
87
|
+
margin-bottom: 10px;
|
|
88
|
+
}
|
|
89
|
+
.astra-sending-received {
|
|
90
|
+
padding: 8px 20px;
|
|
91
|
+
border-radius: 12px;
|
|
92
|
+
background: rgba(166, 166, 166, 0.1);
|
|
93
|
+
margin-bottom: 14px;
|
|
94
|
+
}
|
|
95
|
+
.astra-form-item {
|
|
96
|
+
margin-bottom: 14px;
|
|
97
|
+
}
|
|
98
|
+
.astra-form-item-other {
|
|
99
|
+
padding: 0 20px;
|
|
100
|
+
}
|
|
101
|
+
.custom-connect-button {
|
|
102
|
+
width: 100%;
|
|
103
|
+
}
|
|
104
|
+
.custom-connect-button::part(button) {
|
|
105
|
+
width: 100%;
|
|
106
|
+
background: #caff33;
|
|
107
|
+
}
|
|
108
|
+
@media (max-width: 575px) {
|
|
109
|
+
.astra-form .astra-form-item .astra-form-item-label,
|
|
110
|
+
.astra-form .astra-form-item .astra-form-item-control {
|
|
111
|
+
flex: auto !important;
|
|
112
|
+
max-width: auto !important;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
@media (max-width: 768px) {
|
|
116
|
+
.css-var-r1.astra-form-css-var {
|
|
117
|
+
--astra-form-label-font-size: 12px !important;
|
|
118
|
+
}
|
|
119
|
+
.css-var-r1 {
|
|
120
|
+
--astra-font-size: 12px !important;
|
|
121
|
+
}
|
|
122
|
+
.astra-col {
|
|
123
|
+
font-size: 12;
|
|
124
|
+
}
|
|
125
|
+
.astra-modal {
|
|
126
|
+
background: transparent;
|
|
127
|
+
font-size: 12px;
|
|
128
|
+
}
|
|
129
|
+
.astra-modal .astra-modal-content {
|
|
130
|
+
background: rgba(51, 51, 51, 0.2);
|
|
131
|
+
border: 1px solid;
|
|
132
|
+
|
|
133
|
+
border-image-source: linear-gradient(
|
|
134
|
+
147.76deg,
|
|
135
|
+
#333333 0.7%,
|
|
136
|
+
rgba(51, 51, 51, 0) 98.42%
|
|
137
|
+
);
|
|
138
|
+
backdrop-filter: blur(50px);
|
|
139
|
+
padding: 20px 10px;
|
|
140
|
+
}
|
|
141
|
+
.astra-modal .astra-modal-content .astra-modal-header {
|
|
142
|
+
background: transparent;
|
|
143
|
+
}
|
|
144
|
+
.astra-modal .astra-modal-content .astra-modal-header .modal-title {
|
|
145
|
+
font-size: 18px;
|
|
146
|
+
font-weight: 500;
|
|
147
|
+
}
|
|
148
|
+
.astra-typography {
|
|
149
|
+
font-family: ClashDisplay;
|
|
150
|
+
}
|
|
151
|
+
.form-item-pair {
|
|
152
|
+
padding: 8px 10px 8px 5px;
|
|
153
|
+
border-radius: 12px;
|
|
154
|
+
background: rgba(166, 166, 166, 0.1);
|
|
155
|
+
border: 1px solid rgba(166, 166, 166, 1);
|
|
156
|
+
margin-bottom: 10px;
|
|
157
|
+
}
|
|
158
|
+
.astra-sending-received {
|
|
159
|
+
padding: 8px 10px;
|
|
160
|
+
border-radius: 12px;
|
|
161
|
+
background: rgba(166, 166, 166, 0.1);
|
|
162
|
+
margin-bottom: 14px;
|
|
163
|
+
}
|
|
164
|
+
.astra-form-item {
|
|
165
|
+
margin-bottom: 14px;
|
|
166
|
+
}
|
|
167
|
+
.astra-form-item-other {
|
|
168
|
+
padding: 0 10px;
|
|
169
|
+
}
|
|
170
|
+
} */
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import getRequest from "./request";
|
|
2
|
+
export const getTransaction = ({ hashlock }) => {
|
|
3
|
+
const request = getRequest();
|
|
4
|
+
return request.get(`/api/lsp/transaction`, {
|
|
5
|
+
params: {
|
|
6
|
+
hashlock: hashlock
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export const getReserveInfo = ({ assetId, chainId, pairName }) => {
|
|
11
|
+
const request = getRequest();
|
|
12
|
+
return request.get(`/api/lsp/reserveInfo`, {
|
|
13
|
+
params: {
|
|
14
|
+
assetId,
|
|
15
|
+
chainId,
|
|
16
|
+
pairName
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export const getPairs = ({ chainId }) => {
|
|
21
|
+
const request = getRequest();
|
|
22
|
+
return request.get(`/api/lsp/pairs`, {
|
|
23
|
+
params: {
|
|
24
|
+
chainId
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export const getSignature = ({ chainId, amount, pairName }) => {
|
|
29
|
+
const request = getRequest();
|
|
30
|
+
return request.post(`/api/lsp/signature`, {
|
|
31
|
+
chainId,
|
|
32
|
+
amount,
|
|
33
|
+
pairName
|
|
34
|
+
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
export const toLightning = ({ assetId, chainId, amount, lnInvoice, depositTx }) => {
|
|
39
|
+
const request = getRequest();
|
|
40
|
+
return request.post(`/api/lsp/toLightning`, {
|
|
41
|
+
assetId,
|
|
42
|
+
chainId,
|
|
43
|
+
amount,
|
|
44
|
+
lnInvoice,
|
|
45
|
+
depositTx
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const toEVM = ({ assetId, chainId, amount, hashlock, pairName, depositTx }) => {
|
|
50
|
+
const request = getRequest();
|
|
51
|
+
return request.post(`/api/lsp/toEVM`, {
|
|
52
|
+
assetId,
|
|
53
|
+
chainId,
|
|
54
|
+
hashlock,
|
|
55
|
+
amount,
|
|
56
|
+
pairName,
|
|
57
|
+
depositTx
|
|
58
|
+
});
|
|
59
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import store from '../store';
|
|
3
|
+
const cacheRequest = {}
|
|
4
|
+
const getRequest = (baseUrl) => {
|
|
5
|
+
const baseUri = store.getState().astraApiUrl || baseUrl
|
|
6
|
+
if (!baseUri) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
if (cacheRequest.base) {
|
|
10
|
+
return cacheRequest.base
|
|
11
|
+
}
|
|
12
|
+
cacheRequest.base = axios.create({
|
|
13
|
+
baseURL: baseUri,
|
|
14
|
+
headers: {
|
|
15
|
+
"Content-Type": "application/json;charset=utf-8"
|
|
16
|
+
},
|
|
17
|
+
timeout: 30000
|
|
18
|
+
});
|
|
19
|
+
cacheRequest.base.interceptors.request.use(
|
|
20
|
+
async (config) => {
|
|
21
|
+
const { contentType } = config;
|
|
22
|
+
if (contentType) {
|
|
23
|
+
config.headers['Content-Type'] = contentType
|
|
24
|
+
}
|
|
25
|
+
return config;
|
|
26
|
+
},
|
|
27
|
+
(error) => {
|
|
28
|
+
console.log("error", error);
|
|
29
|
+
return error;
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
cacheRequest.base.interceptors.response.use(
|
|
34
|
+
(response) => {
|
|
35
|
+
const { data } = response;
|
|
36
|
+
const { config } = response;
|
|
37
|
+
const enableIcp = config?.enableIcp;
|
|
38
|
+
if (enableIcp) {
|
|
39
|
+
return data;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
...data
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
(error) => {
|
|
46
|
+
const { config } = error;
|
|
47
|
+
const enableIcp = config?.enableIcp;
|
|
48
|
+
if (enableIcp) {
|
|
49
|
+
if (error.message) {
|
|
50
|
+
throw new Error(error.message)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return error;
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
return cacheRequest.base
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default getRequest;
|