@omnisat/lasereyes 0.0.13 → 0.0.14
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/dist/index.js +28 -3
- package/dist/index.mjs +31 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -582,11 +582,12 @@ var LaserEyesProvider = ({
|
|
|
582
582
|
(0, import_react.useEffect)(() => {
|
|
583
583
|
}, []);
|
|
584
584
|
(0, import_react.useEffect)(() => {
|
|
585
|
+
var _a, _b;
|
|
585
586
|
let foundOkx;
|
|
586
587
|
if (network === TESTNET) {
|
|
587
|
-
foundOkx = window.okxwallet.bitcoinTestnet;
|
|
588
|
+
foundOkx = (_a = window.okxwallet) == null ? void 0 : _a.bitcoinTestnet;
|
|
588
589
|
} else if (network === MAINNET) {
|
|
589
|
-
foundOkx = window.okxwallet.bitcoin;
|
|
590
|
+
foundOkx = (_b = window.okxwallet) == null ? void 0 : _b.bitcoin;
|
|
590
591
|
}
|
|
591
592
|
setHasOkx(!!foundOkx);
|
|
592
593
|
}, []);
|
|
@@ -711,6 +712,9 @@ var LaserEyesProvider = ({
|
|
|
711
712
|
setProvider(OYL);
|
|
712
713
|
handleAccountsChanged(result);
|
|
713
714
|
setConnected(true);
|
|
715
|
+
getBTCBalance(result[1]).then((totalBalance) => {
|
|
716
|
+
setBalance(totalBalance);
|
|
717
|
+
});
|
|
714
718
|
} catch (error) {
|
|
715
719
|
throw new Error(`Can't lasereyes to ${OYL} wallet`);
|
|
716
720
|
}
|
|
@@ -1215,7 +1219,7 @@ var LaserEyesProvider = ({
|
|
|
1215
1219
|
network,
|
|
1216
1220
|
7
|
|
1217
1221
|
);
|
|
1218
|
-
const psbt = yield signPsbt(
|
|
1222
|
+
const psbt = yield signPsbt(psbtHex, true, true);
|
|
1219
1223
|
if (!psbt)
|
|
1220
1224
|
throw new Error("Error sending BTC");
|
|
1221
1225
|
return psbt.txId;
|
|
@@ -1290,6 +1294,27 @@ var LaserEyesProvider = ({
|
|
|
1290
1294
|
throw new Error("Error signing message: " + response.error.message);
|
|
1291
1295
|
}
|
|
1292
1296
|
}
|
|
1297
|
+
} else if (provider === MAGIC_EDEN) {
|
|
1298
|
+
let signedMessage;
|
|
1299
|
+
yield (0, import_sats_connect.signMessage)({
|
|
1300
|
+
getProvider: () => __async(void 0, null, function* () {
|
|
1301
|
+
return window.magicEden.bitcoin;
|
|
1302
|
+
}),
|
|
1303
|
+
payload: {
|
|
1304
|
+
network: {
|
|
1305
|
+
type: import_sats_connect.BitcoinNetworkType.Mainnet
|
|
1306
|
+
},
|
|
1307
|
+
address: address2,
|
|
1308
|
+
message
|
|
1309
|
+
},
|
|
1310
|
+
onFinish: (response) => {
|
|
1311
|
+
signedMessage = response;
|
|
1312
|
+
},
|
|
1313
|
+
onCancel: () => {
|
|
1314
|
+
alert("Request canceled");
|
|
1315
|
+
}
|
|
1316
|
+
});
|
|
1317
|
+
return signedMessage;
|
|
1293
1318
|
} else if (provider === OKX) {
|
|
1294
1319
|
return yield library == null ? void 0 : library.signMessage(message);
|
|
1295
1320
|
} else if (provider === LEATHER) {
|
package/dist/index.mjs
CHANGED
|
@@ -431,10 +431,12 @@ function getRedeemScript(paymentPublicKey, network) {
|
|
|
431
431
|
|
|
432
432
|
// src/providers/LaserEyesProvider.tsx
|
|
433
433
|
import {
|
|
434
|
+
BitcoinNetworkType,
|
|
434
435
|
getAddress,
|
|
435
436
|
request,
|
|
436
437
|
RpcErrorCode,
|
|
437
|
-
signTransaction
|
|
438
|
+
signTransaction,
|
|
439
|
+
signMessage as signMessageSatsConnect
|
|
438
440
|
} from "sats-connect";
|
|
439
441
|
import { fromOutputScript } from "bitcoinjs-lib/src/address";
|
|
440
442
|
import axios2 from "axios";
|
|
@@ -504,11 +506,12 @@ var LaserEyesProvider = ({
|
|
|
504
506
|
useEffect(() => {
|
|
505
507
|
}, []);
|
|
506
508
|
useEffect(() => {
|
|
509
|
+
var _a, _b;
|
|
507
510
|
let foundOkx;
|
|
508
511
|
if (network === TESTNET) {
|
|
509
|
-
foundOkx = window.okxwallet.bitcoinTestnet;
|
|
512
|
+
foundOkx = (_a = window.okxwallet) == null ? void 0 : _a.bitcoinTestnet;
|
|
510
513
|
} else if (network === MAINNET) {
|
|
511
|
-
foundOkx = window.okxwallet.bitcoin;
|
|
514
|
+
foundOkx = (_b = window.okxwallet) == null ? void 0 : _b.bitcoin;
|
|
512
515
|
}
|
|
513
516
|
setHasOkx(!!foundOkx);
|
|
514
517
|
}, []);
|
|
@@ -633,6 +636,9 @@ var LaserEyesProvider = ({
|
|
|
633
636
|
setProvider(OYL);
|
|
634
637
|
handleAccountsChanged(result);
|
|
635
638
|
setConnected(true);
|
|
639
|
+
getBTCBalance(result[1]).then((totalBalance) => {
|
|
640
|
+
setBalance(totalBalance);
|
|
641
|
+
});
|
|
636
642
|
} catch (error) {
|
|
637
643
|
throw new Error(`Can't lasereyes to ${OYL} wallet`);
|
|
638
644
|
}
|
|
@@ -1137,7 +1143,7 @@ var LaserEyesProvider = ({
|
|
|
1137
1143
|
network,
|
|
1138
1144
|
7
|
|
1139
1145
|
);
|
|
1140
|
-
const psbt = yield signPsbt(
|
|
1146
|
+
const psbt = yield signPsbt(psbtHex, true, true);
|
|
1141
1147
|
if (!psbt)
|
|
1142
1148
|
throw new Error("Error sending BTC");
|
|
1143
1149
|
return psbt.txId;
|
|
@@ -1212,6 +1218,27 @@ var LaserEyesProvider = ({
|
|
|
1212
1218
|
throw new Error("Error signing message: " + response.error.message);
|
|
1213
1219
|
}
|
|
1214
1220
|
}
|
|
1221
|
+
} else if (provider === MAGIC_EDEN) {
|
|
1222
|
+
let signedMessage;
|
|
1223
|
+
yield signMessageSatsConnect({
|
|
1224
|
+
getProvider: () => __async(void 0, null, function* () {
|
|
1225
|
+
return window.magicEden.bitcoin;
|
|
1226
|
+
}),
|
|
1227
|
+
payload: {
|
|
1228
|
+
network: {
|
|
1229
|
+
type: BitcoinNetworkType.Mainnet
|
|
1230
|
+
},
|
|
1231
|
+
address: address2,
|
|
1232
|
+
message
|
|
1233
|
+
},
|
|
1234
|
+
onFinish: (response) => {
|
|
1235
|
+
signedMessage = response;
|
|
1236
|
+
},
|
|
1237
|
+
onCancel: () => {
|
|
1238
|
+
alert("Request canceled");
|
|
1239
|
+
}
|
|
1240
|
+
});
|
|
1241
|
+
return signedMessage;
|
|
1215
1242
|
} else if (provider === OKX) {
|
|
1216
1243
|
return yield library == null ? void 0 : library.signMessage(message);
|
|
1217
1244
|
} else if (provider === LEATHER) {
|