@omnisat/lasereyes 0.0.6 → 0.0.8
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/LICENSE +17 -0
- package/README.md +4 -1
- package/dist/index.js +10 -20
- package/dist/index.mjs +10 -20
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
Copyright (c) 2024 Laser Eyes
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
The above copyright notice and this permission notice shall be included in all
|
|
10
|
+
copies or substantial portions of the Software.
|
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
12
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
13
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
14
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
15
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
16
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
17
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -18,9 +18,12 @@
|
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
21
|
+
## Don't Trust, Verify
|
|
22
|
+
[Try It Out](https://demo.lasereyes.build)
|
|
23
|
+
|
|
21
24
|
## Documentation
|
|
22
25
|
|
|
23
|
-
For documentation and guides, visit [Laser Eyes Docs](https://lasereyes.
|
|
26
|
+
For documentation and guides, visit [Laser Eyes Docs](https://lasereyes.build/).
|
|
24
27
|
|
|
25
28
|
## Community
|
|
26
29
|
|
package/dist/index.js
CHANGED
|
@@ -411,7 +411,7 @@ var LaserEyesProvider = ({
|
|
|
411
411
|
const balance2 = yield lib == null ? void 0 : lib.getBalance();
|
|
412
412
|
setBalance(balance2 == null ? void 0 : balance2.total);
|
|
413
413
|
} catch (error) {
|
|
414
|
-
throw
|
|
414
|
+
throw error;
|
|
415
415
|
}
|
|
416
416
|
});
|
|
417
417
|
const handleAccountsChanged = (_accounts) => {
|
|
@@ -429,19 +429,6 @@ var LaserEyesProvider = ({
|
|
|
429
429
|
setConnected(false);
|
|
430
430
|
}
|
|
431
431
|
};
|
|
432
|
-
const getBasicInfo = () => __async(void 0, null, function* () {
|
|
433
|
-
if (provider !== UNISAT)
|
|
434
|
-
return;
|
|
435
|
-
const publicKey2 = yield library == null ? void 0 : library.getPublicKey();
|
|
436
|
-
setPublicKey(String(publicKey2));
|
|
437
|
-
const balance2 = yield library == null ? void 0 : library.getBalance();
|
|
438
|
-
setBalance(balance2);
|
|
439
|
-
const network2 = yield library == null ? void 0 : library.getNetwork();
|
|
440
|
-
if (network2) {
|
|
441
|
-
const foundNetwork = getNetworkForUnisat(String(network2));
|
|
442
|
-
setNetwork(foundNetwork);
|
|
443
|
-
}
|
|
444
|
-
});
|
|
445
432
|
const handleNetworkChanged = (network2) => {
|
|
446
433
|
try {
|
|
447
434
|
let foundNetwork = MAINNET;
|
|
@@ -479,6 +466,7 @@ var LaserEyesProvider = ({
|
|
|
479
466
|
setAddress("");
|
|
480
467
|
setPaymentAddress("");
|
|
481
468
|
setPublicKey("");
|
|
469
|
+
setPaymentPublicKey("");
|
|
482
470
|
setAccounts([]);
|
|
483
471
|
setProvider(void 0);
|
|
484
472
|
setLibrary(null);
|
|
@@ -603,7 +591,7 @@ var LaserEyesProvider = ({
|
|
|
603
591
|
throw error;
|
|
604
592
|
}
|
|
605
593
|
});
|
|
606
|
-
const signPsbt = (psbt, finalize = false, broadcast =
|
|
594
|
+
const signPsbt = (psbt, finalize = false, broadcast = false) => __async(void 0, null, function* () {
|
|
607
595
|
try {
|
|
608
596
|
let psbtHex, psbtBase64;
|
|
609
597
|
if (!library)
|
|
@@ -621,17 +609,19 @@ var LaserEyesProvider = ({
|
|
|
621
609
|
const signedPsbt = yield library == null ? void 0 : library.signPsbt(psbtHex, {
|
|
622
610
|
autoFinalized: finalize
|
|
623
611
|
});
|
|
624
|
-
|
|
612
|
+
const psbtSignedPsbt = bitcoin2.Psbt.fromHex(signedPsbt);
|
|
613
|
+
if (finalize && broadcast) {
|
|
625
614
|
const txId = yield pushPsbt(signedPsbt);
|
|
626
615
|
return {
|
|
627
|
-
signedPsbtHex:
|
|
628
|
-
signedPsbtBase64:
|
|
616
|
+
signedPsbtHex: psbtSignedPsbt.toHex(),
|
|
617
|
+
signedPsbtBase64: psbtSignedPsbt.toBase64(),
|
|
629
618
|
txId
|
|
630
619
|
};
|
|
631
620
|
}
|
|
632
621
|
return {
|
|
633
|
-
signedPsbtHex:
|
|
634
|
-
signedPsbtBase64:
|
|
622
|
+
signedPsbtHex: psbtSignedPsbt.toHex(),
|
|
623
|
+
signedPsbtBase64: psbtSignedPsbt.toBase64(),
|
|
624
|
+
txId: void 0
|
|
635
625
|
};
|
|
636
626
|
} else {
|
|
637
627
|
throw new Error("Unsupported wallet");
|
package/dist/index.mjs
CHANGED
|
@@ -345,7 +345,7 @@ var LaserEyesProvider = ({
|
|
|
345
345
|
const balance2 = yield lib == null ? void 0 : lib.getBalance();
|
|
346
346
|
setBalance(balance2 == null ? void 0 : balance2.total);
|
|
347
347
|
} catch (error) {
|
|
348
|
-
throw
|
|
348
|
+
throw error;
|
|
349
349
|
}
|
|
350
350
|
});
|
|
351
351
|
const handleAccountsChanged = (_accounts) => {
|
|
@@ -363,19 +363,6 @@ var LaserEyesProvider = ({
|
|
|
363
363
|
setConnected(false);
|
|
364
364
|
}
|
|
365
365
|
};
|
|
366
|
-
const getBasicInfo = () => __async(void 0, null, function* () {
|
|
367
|
-
if (provider !== UNISAT)
|
|
368
|
-
return;
|
|
369
|
-
const publicKey2 = yield library == null ? void 0 : library.getPublicKey();
|
|
370
|
-
setPublicKey(String(publicKey2));
|
|
371
|
-
const balance2 = yield library == null ? void 0 : library.getBalance();
|
|
372
|
-
setBalance(balance2);
|
|
373
|
-
const network2 = yield library == null ? void 0 : library.getNetwork();
|
|
374
|
-
if (network2) {
|
|
375
|
-
const foundNetwork = getNetworkForUnisat(String(network2));
|
|
376
|
-
setNetwork(foundNetwork);
|
|
377
|
-
}
|
|
378
|
-
});
|
|
379
366
|
const handleNetworkChanged = (network2) => {
|
|
380
367
|
try {
|
|
381
368
|
let foundNetwork = MAINNET;
|
|
@@ -413,6 +400,7 @@ var LaserEyesProvider = ({
|
|
|
413
400
|
setAddress("");
|
|
414
401
|
setPaymentAddress("");
|
|
415
402
|
setPublicKey("");
|
|
403
|
+
setPaymentPublicKey("");
|
|
416
404
|
setAccounts([]);
|
|
417
405
|
setProvider(void 0);
|
|
418
406
|
setLibrary(null);
|
|
@@ -537,7 +525,7 @@ var LaserEyesProvider = ({
|
|
|
537
525
|
throw error;
|
|
538
526
|
}
|
|
539
527
|
});
|
|
540
|
-
const signPsbt = (psbt, finalize = false, broadcast =
|
|
528
|
+
const signPsbt = (psbt, finalize = false, broadcast = false) => __async(void 0, null, function* () {
|
|
541
529
|
try {
|
|
542
530
|
let psbtHex, psbtBase64;
|
|
543
531
|
if (!library)
|
|
@@ -555,17 +543,19 @@ var LaserEyesProvider = ({
|
|
|
555
543
|
const signedPsbt = yield library == null ? void 0 : library.signPsbt(psbtHex, {
|
|
556
544
|
autoFinalized: finalize
|
|
557
545
|
});
|
|
558
|
-
|
|
546
|
+
const psbtSignedPsbt = bitcoin2.Psbt.fromHex(signedPsbt);
|
|
547
|
+
if (finalize && broadcast) {
|
|
559
548
|
const txId = yield pushPsbt(signedPsbt);
|
|
560
549
|
return {
|
|
561
|
-
signedPsbtHex:
|
|
562
|
-
signedPsbtBase64:
|
|
550
|
+
signedPsbtHex: psbtSignedPsbt.toHex(),
|
|
551
|
+
signedPsbtBase64: psbtSignedPsbt.toBase64(),
|
|
563
552
|
txId
|
|
564
553
|
};
|
|
565
554
|
}
|
|
566
555
|
return {
|
|
567
|
-
signedPsbtHex:
|
|
568
|
-
signedPsbtBase64:
|
|
556
|
+
signedPsbtHex: psbtSignedPsbt.toHex(),
|
|
557
|
+
signedPsbtBase64: psbtSignedPsbt.toBase64(),
|
|
558
|
+
txId: void 0
|
|
569
559
|
};
|
|
570
560
|
} else {
|
|
571
561
|
throw new Error("Unsupported wallet");
|