@omnisat/lasereyes 0.0.77 → 0.0.78
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 +16 -4
- package/dist/index.mjs +16 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -997,12 +997,21 @@ var LaserEyesProvider = ({
|
|
|
997
997
|
throw error;
|
|
998
998
|
}
|
|
999
999
|
});
|
|
1000
|
+
const getOkxLibrary = (0, import_react.useCallback)(() => {
|
|
1001
|
+
var _a, _b;
|
|
1002
|
+
let foundOkx;
|
|
1003
|
+
if (network === TESTNET || network === TESTNET4 || network === SIGNET || network === FRACTAL_TESTNET) {
|
|
1004
|
+
foundOkx = (_a = window == null ? void 0 : window.okxwallet) == null ? void 0 : _a.bitcoinTestnet;
|
|
1005
|
+
} else if (network === MAINNET || network === FRACTAL_MAINNET) {
|
|
1006
|
+
foundOkx = (_b = window == null ? void 0 : window.okxwallet) == null ? void 0 : _b.bitcoin;
|
|
1007
|
+
}
|
|
1008
|
+
return foundOkx;
|
|
1009
|
+
}, []);
|
|
1000
1010
|
const connectOkx = (0, import_react.useCallback)(() => __async(void 0, null, function* () {
|
|
1001
1011
|
var _a;
|
|
1002
1012
|
try {
|
|
1003
1013
|
localStorage == null ? void 0 : localStorage.setItem(LOCAL_STORAGE_DEFAULT_WALLET, OKX);
|
|
1004
|
-
|
|
1005
|
-
const lib = network === TESTNET || network === TESTNET4 || network === FRACTAL_TESTNET ? window.okxwallet.bitcoinTestnet : network === SIGNET ? window.okxwallet.bitcoinSignet : window.okxwallet.bitcoin;
|
|
1014
|
+
const lib = getOkxLibrary();
|
|
1006
1015
|
const okxAccounts = yield lib.connect();
|
|
1007
1016
|
if (!okxAccounts)
|
|
1008
1017
|
throw new Error("No accounts found");
|
|
@@ -1018,6 +1027,7 @@ var LaserEyesProvider = ({
|
|
|
1018
1027
|
setPublicKey(okxAccounts.publicKey);
|
|
1019
1028
|
setPaymentPublicKey(okxAccounts.publicKey);
|
|
1020
1029
|
setLibrary(lib);
|
|
1030
|
+
console.log("lib", lib);
|
|
1021
1031
|
setProvider(OKX);
|
|
1022
1032
|
setConnected(true);
|
|
1023
1033
|
const balance2 = yield lib == null ? void 0 : lib.getBalance();
|
|
@@ -1746,7 +1756,8 @@ var LaserEyesProvider = ({
|
|
|
1746
1756
|
});
|
|
1747
1757
|
return signedMessage;
|
|
1748
1758
|
} else if (provider === OKX) {
|
|
1749
|
-
|
|
1759
|
+
const lib = getOkxLibrary();
|
|
1760
|
+
return yield lib == null ? void 0 : lib.signMessage(message);
|
|
1750
1761
|
} else if (provider === LEATHER) {
|
|
1751
1762
|
const paymentType = toSignAddress === address2 ? P2TR : P2WPKH;
|
|
1752
1763
|
if (toSignAddress !== address2 && toSignAddress !== paymentAddress) {
|
|
@@ -2026,7 +2037,8 @@ var LaserEyesProvider = ({
|
|
|
2026
2037
|
};
|
|
2027
2038
|
}
|
|
2028
2039
|
} else if (provider === OKX) {
|
|
2029
|
-
const
|
|
2040
|
+
const lib = getOkxLibrary();
|
|
2041
|
+
const signedPsbt = yield lib == null ? void 0 : lib.signPsbt(psbtHex, {
|
|
2030
2042
|
autoFinalized: finalize
|
|
2031
2043
|
});
|
|
2032
2044
|
const psbtSignedPsbt = bitcoin2.Psbt.fromHex(signedPsbt);
|
package/dist/index.mjs
CHANGED
|
@@ -898,12 +898,21 @@ var LaserEyesProvider = ({
|
|
|
898
898
|
throw error;
|
|
899
899
|
}
|
|
900
900
|
});
|
|
901
|
+
const getOkxLibrary = useCallback(() => {
|
|
902
|
+
var _a, _b;
|
|
903
|
+
let foundOkx;
|
|
904
|
+
if (network === TESTNET || network === TESTNET4 || network === SIGNET || network === FRACTAL_TESTNET) {
|
|
905
|
+
foundOkx = (_a = window == null ? void 0 : window.okxwallet) == null ? void 0 : _a.bitcoinTestnet;
|
|
906
|
+
} else if (network === MAINNET || network === FRACTAL_MAINNET) {
|
|
907
|
+
foundOkx = (_b = window == null ? void 0 : window.okxwallet) == null ? void 0 : _b.bitcoin;
|
|
908
|
+
}
|
|
909
|
+
return foundOkx;
|
|
910
|
+
}, []);
|
|
901
911
|
const connectOkx = useCallback(() => __async(void 0, null, function* () {
|
|
902
912
|
var _a;
|
|
903
913
|
try {
|
|
904
914
|
localStorage == null ? void 0 : localStorage.setItem(LOCAL_STORAGE_DEFAULT_WALLET, OKX);
|
|
905
|
-
|
|
906
|
-
const lib = network === TESTNET || network === TESTNET4 || network === FRACTAL_TESTNET ? window.okxwallet.bitcoinTestnet : network === SIGNET ? window.okxwallet.bitcoinSignet : window.okxwallet.bitcoin;
|
|
915
|
+
const lib = getOkxLibrary();
|
|
907
916
|
const okxAccounts = yield lib.connect();
|
|
908
917
|
if (!okxAccounts)
|
|
909
918
|
throw new Error("No accounts found");
|
|
@@ -919,6 +928,7 @@ var LaserEyesProvider = ({
|
|
|
919
928
|
setPublicKey(okxAccounts.publicKey);
|
|
920
929
|
setPaymentPublicKey(okxAccounts.publicKey);
|
|
921
930
|
setLibrary(lib);
|
|
931
|
+
console.log("lib", lib);
|
|
922
932
|
setProvider(OKX);
|
|
923
933
|
setConnected(true);
|
|
924
934
|
const balance2 = yield lib == null ? void 0 : lib.getBalance();
|
|
@@ -1647,7 +1657,8 @@ var LaserEyesProvider = ({
|
|
|
1647
1657
|
});
|
|
1648
1658
|
return signedMessage;
|
|
1649
1659
|
} else if (provider === OKX) {
|
|
1650
|
-
|
|
1660
|
+
const lib = getOkxLibrary();
|
|
1661
|
+
return yield lib == null ? void 0 : lib.signMessage(message);
|
|
1651
1662
|
} else if (provider === LEATHER) {
|
|
1652
1663
|
const paymentType = toSignAddress === address2 ? P2TR : P2WPKH;
|
|
1653
1664
|
if (toSignAddress !== address2 && toSignAddress !== paymentAddress) {
|
|
@@ -1927,7 +1938,8 @@ var LaserEyesProvider = ({
|
|
|
1927
1938
|
};
|
|
1928
1939
|
}
|
|
1929
1940
|
} else if (provider === OKX) {
|
|
1930
|
-
const
|
|
1941
|
+
const lib = getOkxLibrary();
|
|
1942
|
+
const signedPsbt = yield lib == null ? void 0 : lib.signPsbt(psbtHex, {
|
|
1931
1943
|
autoFinalized: finalize
|
|
1932
1944
|
});
|
|
1933
1945
|
const psbtSignedPsbt = bitcoin2.Psbt.fromHex(signedPsbt);
|