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.
Files changed (65) hide show
  1. package/README.md +0 -0
  2. package/dist/astra-sdk.es.js +8 -0
  3. package/dist/astra-sdk.umd.js +12576 -0
  4. package/dist/ccip-Bpb4GlU6.mjs +146 -0
  5. package/dist/hooks.module-BBZfodGH.mjs +506 -0
  6. package/dist/index-BTsa09iy.mjs +84805 -0
  7. package/dist/index-CEtKkuP2.mjs +133 -0
  8. package/dist/index-CbWGAz3l.mjs +445 -0
  9. package/dist/index-DRPxIWUd.mjs +13720 -0
  10. package/dist/index-h9_6XS0r.mjs +2929 -0
  11. package/dist/secp256k1-3OC5y4qp.mjs +1578 -0
  12. package/dist/vite.svg +1 -0
  13. package/dist/w3m-modal-R9m1z1SQ.mjs +267 -0
  14. package/eslint.config.js +39 -0
  15. package/index.html +13 -0
  16. package/package.json +50 -0
  17. package/public/vite.svg +1 -0
  18. package/src/App.css +170 -0
  19. package/src/apis/lspApi.js +59 -0
  20. package/src/apis/request.js +59 -0
  21. package/src/assets/arrow-right.svg +3 -0
  22. package/src/assets/astr.svg +13 -0
  23. package/src/assets/bridge-loading.png +0 -0
  24. package/src/assets/network/base.png +0 -0
  25. package/src/assets/network/eth.png +0 -0
  26. package/src/assets/network/lighting.png +0 -0
  27. package/src/assets/network/ligtning.svg +22 -0
  28. package/src/assets/network/solona.png +0 -0
  29. package/src/assets/powerby.svg +14 -0
  30. package/src/assets/react.svg +1 -0
  31. package/src/assets/success.svg +3 -0
  32. package/src/assets/tip.svg +5 -0
  33. package/src/assets/tokens/sol.png +0 -0
  34. package/src/assets/tokens/usdc.png +0 -0
  35. package/src/assets/tokens/usdt.png +0 -0
  36. package/src/comps/AstraImage.jsx +23 -0
  37. package/src/comps/AstraModal.jsx +207 -0
  38. package/src/comps/AstraModalLogo.jsx +53 -0
  39. package/src/comps/AstraNetwork.jsx +115 -0
  40. package/src/comps/CheckErc20Button.jsx +28 -0
  41. package/src/comps/ConnectButton.jsx +37 -0
  42. package/src/comps/EllipsisMiddle.jsx +42 -0
  43. package/src/comps/ResultModal.jsx +307 -0
  44. package/src/comps/ToLightning.jsx +502 -0
  45. package/src/comps/ToToken.jsx +467 -0
  46. package/src/constants/contracts/abi/bridge.js +1246 -0
  47. package/src/constants/contracts/abi/index.js +3 -0
  48. package/src/constants/contracts/abi/usdt.js +130 -0
  49. package/src/constants/contracts/abi/watcher.js +523 -0
  50. package/src/constants/contracts/index.js +37 -0
  51. package/src/constants/index.js +5 -0
  52. package/src/font/ClashDisplay-Variable.ttf +0 -0
  53. package/src/font/ClashDisplay-Variable.woff +0 -0
  54. package/src/font/ClashDisplay-Variable.woff2 +0 -0
  55. package/src/hooks/useContract.js +127 -0
  56. package/src/hooks/useLspApi.js +53 -0
  57. package/src/hooks/useParseInvoice.js +85 -0
  58. package/src/index.css +69 -0
  59. package/src/index.jsx +112 -0
  60. package/src/lib/bolt11.min.js +1 -0
  61. package/src/main.jsx +41 -0
  62. package/src/store/index.js +25 -0
  63. package/src/theme.js +108 -0
  64. package/src/utils/index.js +36 -0
  65. package/vite.config.js +44 -0
@@ -0,0 +1,3 @@
1
+ export * from "./bridge";
2
+ export * from "./watcher";
3
+ export * from "./usdt";
@@ -0,0 +1,130 @@
1
+ export const USDT_ABI = [
2
+ {
3
+ type: "function",
4
+ name: "allowance",
5
+ inputs: [
6
+ { name: "owner", type: "address", internalType: "address" },
7
+ { name: "spender", type: "address", internalType: "address" },
8
+ ],
9
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
10
+ stateMutability: "view",
11
+ },
12
+ {
13
+ type: "function",
14
+ name: "approve",
15
+ inputs: [
16
+ { name: "spender", type: "address", internalType: "address" },
17
+ { name: "amount", type: "uint256", internalType: "uint256" },
18
+ ],
19
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
20
+ stateMutability: "nonpayable",
21
+ },
22
+ {
23
+ type: "function",
24
+ name: "balanceOf",
25
+ inputs: [
26
+ { name: "account", type: "address", internalType: "address" },
27
+ ],
28
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
29
+ stateMutability: "view",
30
+ },
31
+ {
32
+ type: "function",
33
+ name: "decimals",
34
+ inputs: [],
35
+ outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
36
+ stateMutability: "view",
37
+ },
38
+ {
39
+ type: "function",
40
+ name: "name",
41
+ inputs: [],
42
+ outputs: [{ name: "", type: "string", internalType: "string" }],
43
+ stateMutability: "view",
44
+ },
45
+ {
46
+ type: "function",
47
+ name: "symbol",
48
+ inputs: [],
49
+ outputs: [{ name: "", type: "string", internalType: "string" }],
50
+ stateMutability: "view",
51
+ },
52
+ {
53
+ type: "function",
54
+ name: "totalSupply",
55
+ inputs: [],
56
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
57
+ stateMutability: "view",
58
+ },
59
+ {
60
+ type: "function",
61
+ name: "transfer",
62
+ inputs: [
63
+ { name: "to", type: "address", internalType: "address" },
64
+ { name: "amount", type: "uint256", internalType: "uint256" },
65
+ ],
66
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
67
+ stateMutability: "nonpayable",
68
+ },
69
+ {
70
+ type: "function",
71
+ name: "transferFrom",
72
+ inputs: [
73
+ { name: "from", type: "address", internalType: "address" },
74
+ { name: "to", type: "address", internalType: "address" },
75
+ { name: "amount", type: "uint256", internalType: "uint256" },
76
+ ],
77
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
78
+ stateMutability: "nonpayable",
79
+ },
80
+ {
81
+ type: "event",
82
+ name: "Approval",
83
+ inputs: [
84
+ {
85
+ name: "owner",
86
+ type: "address",
87
+ indexed: true,
88
+ internalType: "address",
89
+ },
90
+ {
91
+ name: "spender",
92
+ type: "address",
93
+ indexed: true,
94
+ internalType: "address",
95
+ },
96
+ {
97
+ name: "value",
98
+ type: "uint256",
99
+ indexed: false,
100
+ internalType: "uint256",
101
+ },
102
+ ],
103
+ anonymous: false,
104
+ },
105
+ {
106
+ type: "event",
107
+ name: "Transfer",
108
+ inputs: [
109
+ {
110
+ name: "from",
111
+ type: "address",
112
+ indexed: true,
113
+ internalType: "address",
114
+ },
115
+ {
116
+ name: "to",
117
+ type: "address",
118
+ indexed: true,
119
+ internalType: "address",
120
+ },
121
+ {
122
+ name: "value",
123
+ type: "uint256",
124
+ indexed: false,
125
+ internalType: "uint256",
126
+ },
127
+ ],
128
+ anonymous: false,
129
+ },
130
+ ]
@@ -0,0 +1,523 @@
1
+ export const WATHER_ABI = [
2
+ {
3
+ "inputs": [],
4
+ "name": "InvalidInitialization",
5
+ "type": "error"
6
+ },
7
+ {
8
+ "inputs": [],
9
+ "name": "NotInitializing",
10
+ "type": "error"
11
+ },
12
+ {
13
+ "inputs": [
14
+ {
15
+ "internalType": "address",
16
+ "name": "owner",
17
+ "type": "address"
18
+ }
19
+ ],
20
+ "name": "OwnableInvalidOwner",
21
+ "type": "error"
22
+ },
23
+ {
24
+ "inputs": [
25
+ {
26
+ "internalType": "address",
27
+ "name": "account",
28
+ "type": "address"
29
+ }
30
+ ],
31
+ "name": "OwnableUnauthorizedAccount",
32
+ "type": "error"
33
+ },
34
+ {
35
+ "inputs": [
36
+ {
37
+ "internalType": "address",
38
+ "name": "token",
39
+ "type": "address"
40
+ }
41
+ ],
42
+ "name": "SafeERC20FailedOperation",
43
+ "type": "error"
44
+ },
45
+ {
46
+ "anonymous": false,
47
+ "inputs": [
48
+ {
49
+ "indexed": false,
50
+ "internalType": "address",
51
+ "name": "sender",
52
+ "type": "address"
53
+ },
54
+ {
55
+ "indexed": false,
56
+ "internalType": "uint256",
57
+ "name": "amount",
58
+ "type": "uint256"
59
+ }
60
+ ],
61
+ "name": "FallbackCalled",
62
+ "type": "event"
63
+ },
64
+ {
65
+ "anonymous": false,
66
+ "inputs": [
67
+ {
68
+ "indexed": false,
69
+ "internalType": "uint64",
70
+ "name": "version",
71
+ "type": "uint64"
72
+ }
73
+ ],
74
+ "name": "Initialized",
75
+ "type": "event"
76
+ },
77
+ {
78
+ "anonymous": false,
79
+ "inputs": [
80
+ {
81
+ "indexed": true,
82
+ "internalType": "address",
83
+ "name": "previousOwner",
84
+ "type": "address"
85
+ },
86
+ {
87
+ "indexed": true,
88
+ "internalType": "address",
89
+ "name": "newOwner",
90
+ "type": "address"
91
+ }
92
+ ],
93
+ "name": "OwnershipTransferred",
94
+ "type": "event"
95
+ },
96
+ {
97
+ "anonymous": false,
98
+ "inputs": [
99
+ {
100
+ "indexed": false,
101
+ "internalType": "address",
102
+ "name": "sender",
103
+ "type": "address"
104
+ },
105
+ {
106
+ "indexed": false,
107
+ "internalType": "uint256",
108
+ "name": "amount",
109
+ "type": "uint256"
110
+ }
111
+ ],
112
+ "name": "Received",
113
+ "type": "event"
114
+ },
115
+ {
116
+ "stateMutability": "payable",
117
+ "type": "fallback"
118
+ },
119
+ {
120
+ "inputs": [],
121
+ "name": "astraBridge",
122
+ "outputs": [
123
+ {
124
+ "internalType": "contract IAstraBridge",
125
+ "name": "",
126
+ "type": "address"
127
+ }
128
+ ],
129
+ "stateMutability": "view",
130
+ "type": "function"
131
+ },
132
+ {
133
+ "inputs": [],
134
+ "name": "getAllPairs",
135
+ "outputs": [
136
+ {
137
+ "components": [
138
+ {
139
+ "components": [
140
+ {
141
+ "internalType": "address",
142
+ "name": "token",
143
+ "type": "address"
144
+ },
145
+ {
146
+ "internalType": "string",
147
+ "name": "name",
148
+ "type": "string"
149
+ },
150
+ {
151
+ "internalType": "uint8",
152
+ "name": "decimal",
153
+ "type": "uint8"
154
+ },
155
+ {
156
+ "internalType": "bool",
157
+ "name": "stake",
158
+ "type": "bool"
159
+ }
160
+ ],
161
+ "internalType": "struct IAstraBridge.TokenInfo",
162
+ "name": "token",
163
+ "type": "tuple"
164
+ },
165
+ {
166
+ "components": [
167
+ {
168
+ "internalType": "bytes32",
169
+ "name": "assetId",
170
+ "type": "bytes32"
171
+ },
172
+ {
173
+ "internalType": "string",
174
+ "name": "name",
175
+ "type": "string"
176
+ },
177
+ {
178
+ "internalType": "uint8",
179
+ "name": "decimal",
180
+ "type": "uint8"
181
+ }
182
+ ],
183
+ "internalType": "struct IAstraBridge.AssetInfo",
184
+ "name": "asset",
185
+ "type": "tuple"
186
+ }
187
+ ],
188
+ "internalType": "struct IAstraBridge.Pair[]",
189
+ "name": "pairs",
190
+ "type": "tuple[]"
191
+ }
192
+ ],
193
+ "stateMutability": "view",
194
+ "type": "function"
195
+ },
196
+ {
197
+ "inputs": [
198
+ {
199
+ "internalType": "address[]",
200
+ "name": "_addressesList",
201
+ "type": "address[]"
202
+ }
203
+ ],
204
+ "name": "getBalanceList",
205
+ "outputs": [
206
+ {
207
+ "internalType": "address[]",
208
+ "name": "addresses",
209
+ "type": "address[]"
210
+ },
211
+ {
212
+ "internalType": "uint256[]",
213
+ "name": "balances",
214
+ "type": "uint256[]"
215
+ }
216
+ ],
217
+ "stateMutability": "view",
218
+ "type": "function"
219
+ },
220
+ {
221
+ "inputs": [],
222
+ "name": "getBridge",
223
+ "outputs": [
224
+ {
225
+ "internalType": "contract IAstraBridge",
226
+ "name": "",
227
+ "type": "address"
228
+ }
229
+ ],
230
+ "stateMutability": "view",
231
+ "type": "function"
232
+ },
233
+ {
234
+ "inputs": [
235
+ {
236
+ "internalType": "uint256",
237
+ "name": "_index",
238
+ "type": "uint256"
239
+ },
240
+ {
241
+ "internalType": "uint256",
242
+ "name": "_count",
243
+ "type": "uint256"
244
+ }
245
+ ],
246
+ "name": "getContractList",
247
+ "outputs": [
248
+ {
249
+ "components": [
250
+ {
251
+ "internalType": "bytes32",
252
+ "name": "hashlock",
253
+ "type": "bytes32"
254
+ },
255
+ {
256
+ "internalType": "address payable",
257
+ "name": "sender",
258
+ "type": "address"
259
+ },
260
+ {
261
+ "internalType": "address payable",
262
+ "name": "receiver",
263
+ "type": "address"
264
+ },
265
+ {
266
+ "internalType": "address",
267
+ "name": "token",
268
+ "type": "address"
269
+ },
270
+ {
271
+ "internalType": "uint256",
272
+ "name": "amount",
273
+ "type": "uint256"
274
+ },
275
+ {
276
+ "internalType": "uint256",
277
+ "name": "fee",
278
+ "type": "uint256"
279
+ },
280
+ {
281
+ "internalType": "uint256",
282
+ "name": "createTime",
283
+ "type": "uint256"
284
+ },
285
+ {
286
+ "internalType": "uint256",
287
+ "name": "timelock",
288
+ "type": "uint256"
289
+ },
290
+ {
291
+ "internalType": "bool",
292
+ "name": "toLightning",
293
+ "type": "bool"
294
+ },
295
+ {
296
+ "internalType": "bytes32",
297
+ "name": "preimage",
298
+ "type": "bytes32"
299
+ },
300
+ {
301
+ "internalType": "address payable",
302
+ "name": "watcher",
303
+ "type": "address"
304
+ },
305
+ {
306
+ "internalType": "uint8",
307
+ "name": "status",
308
+ "type": "uint8"
309
+ }
310
+ ],
311
+ "internalType": "struct IAstraBridge.HtlcContract[]",
312
+ "name": "result",
313
+ "type": "tuple[]"
314
+ }
315
+ ],
316
+ "stateMutability": "view",
317
+ "type": "function"
318
+ },
319
+ {
320
+ "inputs": [
321
+ {
322
+ "internalType": "uint256",
323
+ "name": "page",
324
+ "type": "uint256"
325
+ },
326
+ {
327
+ "internalType": "uint256",
328
+ "name": "size",
329
+ "type": "uint256"
330
+ }
331
+ ],
332
+ "name": "getContracts",
333
+ "outputs": [
334
+ {
335
+ "components": [
336
+ {
337
+ "internalType": "bytes32",
338
+ "name": "hashlock",
339
+ "type": "bytes32"
340
+ },
341
+ {
342
+ "internalType": "address payable",
343
+ "name": "sender",
344
+ "type": "address"
345
+ },
346
+ {
347
+ "internalType": "address payable",
348
+ "name": "receiver",
349
+ "type": "address"
350
+ },
351
+ {
352
+ "internalType": "address",
353
+ "name": "token",
354
+ "type": "address"
355
+ },
356
+ {
357
+ "internalType": "uint256",
358
+ "name": "amount",
359
+ "type": "uint256"
360
+ },
361
+ {
362
+ "internalType": "uint256",
363
+ "name": "fee",
364
+ "type": "uint256"
365
+ },
366
+ {
367
+ "internalType": "uint256",
368
+ "name": "createTime",
369
+ "type": "uint256"
370
+ },
371
+ {
372
+ "internalType": "uint256",
373
+ "name": "timelock",
374
+ "type": "uint256"
375
+ },
376
+ {
377
+ "internalType": "bool",
378
+ "name": "toLightning",
379
+ "type": "bool"
380
+ },
381
+ {
382
+ "internalType": "bytes32",
383
+ "name": "preimage",
384
+ "type": "bytes32"
385
+ },
386
+ {
387
+ "internalType": "address payable",
388
+ "name": "watcher",
389
+ "type": "address"
390
+ },
391
+ {
392
+ "internalType": "uint8",
393
+ "name": "status",
394
+ "type": "uint8"
395
+ }
396
+ ],
397
+ "internalType": "struct IAstraBridge.HtlcContract[]",
398
+ "name": "",
399
+ "type": "tuple[]"
400
+ }
401
+ ],
402
+ "stateMutability": "view",
403
+ "type": "function"
404
+ },
405
+ {
406
+ "inputs": [
407
+ {
408
+ "internalType": "address",
409
+ "name": "_bridge",
410
+ "type": "address"
411
+ }
412
+ ],
413
+ "name": "initialize",
414
+ "outputs": [],
415
+ "stateMutability": "nonpayable",
416
+ "type": "function"
417
+ },
418
+ {
419
+ "inputs": [],
420
+ "name": "owner",
421
+ "outputs": [
422
+ {
423
+ "internalType": "address",
424
+ "name": "",
425
+ "type": "address"
426
+ }
427
+ ],
428
+ "stateMutability": "view",
429
+ "type": "function"
430
+ },
431
+ {
432
+ "inputs": [
433
+ {
434
+ "internalType": "bytes32[]",
435
+ "name": "_keyList",
436
+ "type": "bytes32[]"
437
+ }
438
+ ],
439
+ "name": "refundList",
440
+ "outputs": [],
441
+ "stateMutability": "nonpayable",
442
+ "type": "function"
443
+ },
444
+ {
445
+ "inputs": [],
446
+ "name": "renounceOwnership",
447
+ "outputs": [],
448
+ "stateMutability": "nonpayable",
449
+ "type": "function"
450
+ },
451
+ {
452
+ "inputs": [
453
+ {
454
+ "internalType": "address",
455
+ "name": "_bridge",
456
+ "type": "address"
457
+ }
458
+ ],
459
+ "name": "setBridge",
460
+ "outputs": [],
461
+ "stateMutability": "nonpayable",
462
+ "type": "function"
463
+ },
464
+ {
465
+ "inputs": [
466
+ {
467
+ "internalType": "address",
468
+ "name": "newOwner",
469
+ "type": "address"
470
+ }
471
+ ],
472
+ "name": "transferOwnership",
473
+ "outputs": [],
474
+ "stateMutability": "nonpayable",
475
+ "type": "function"
476
+ },
477
+ {
478
+ "inputs": [
479
+ {
480
+ "internalType": "bytes32[]",
481
+ "name": "_preImageList",
482
+ "type": "bytes32[]"
483
+ }
484
+ ],
485
+ "name": "withDrawList",
486
+ "outputs": [],
487
+ "stateMutability": "nonpayable",
488
+ "type": "function"
489
+ },
490
+ {
491
+ "inputs": [
492
+ {
493
+ "internalType": "address",
494
+ "name": "_token",
495
+ "type": "address"
496
+ },
497
+ {
498
+ "internalType": "address",
499
+ "name": "_to",
500
+ "type": "address"
501
+ },
502
+ {
503
+ "internalType": "uint256",
504
+ "name": "_amount",
505
+ "type": "uint256"
506
+ }
507
+ ],
508
+ "name": "withdrawToken",
509
+ "outputs": [
510
+ {
511
+ "internalType": "bool",
512
+ "name": "",
513
+ "type": "bool"
514
+ }
515
+ ],
516
+ "stateMutability": "nonpayable",
517
+ "type": "function"
518
+ },
519
+ {
520
+ "stateMutability": "payable",
521
+ "type": "receive"
522
+ }
523
+ ]
@@ -0,0 +1,37 @@
1
+ /**
2
+ * This file is autogenerated by Scaffold-ETH.
3
+ * You should not edit it manually or your changes might be overwritten.
4
+ */
5
+ import { HashedTimelock_ABI, USDT_ABI, WATHER_ABI } from "./abi";
6
+ const contractConfig = {
7
+ 11155111: {
8
+ RPC_URL: ['https://eth-sepolia.g.alchemy.com/v2/ClvXGqSMvZ6nEb_G5ekJGsZwNdsp72oz', 'https://eth-sepolia.public.blastapi.io', 'https://sepolia.drpc.org', 'https://1rpc.io/sepolia'],
9
+ Bridge: {
10
+ address: "0xceA1e4EAB8A352e757F302EFFB3C977975f52E75",
11
+ abi: HashedTimelock_ABI,
12
+ },
13
+ Watcher: {
14
+ address: "0x4518DfAA37312C665a940A2734F008aBe6ABc1fF",
15
+ abi: WATHER_ABI,
16
+ },
17
+ USDT: {
18
+ abi: USDT_ABI,
19
+ },
20
+ },
21
+ 84532: {
22
+ RPC_URL: ["https://sepolia.base.org"],
23
+ Bridge: {
24
+ address: "0x9956De2ef4a70abD7c1e76bFEB19c781718Acf2C",
25
+ abi: HashedTimelock_ABI,
26
+ },
27
+ Watcher: {
28
+ address: "0x4F5913e1239aE0Df0ca7Ee693A587A64Cfa3112f",
29
+ abi: WATHER_ABI,
30
+ },
31
+ USDT: {
32
+ abi: USDT_ABI,
33
+ },
34
+ },
35
+ };
36
+
37
+ export default contractConfig;
@@ -0,0 +1,5 @@
1
+ export const MODAL_DISPLAY_TYPE = {
2
+ DEFAULT: 0,
3
+ TO_LIGHTNING: 1,
4
+ TO_EVM: 2
5
+ }