@omnisat/lasereyes 0.0.12 → 0.0.13
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.d.ts +18 -2
- package/dist/index.js +615 -8
- package/dist/index.mjs +604 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -77,9 +77,13 @@ __export(src_exports, {
|
|
|
77
77
|
LEATHER_MAINNET: () => LEATHER_MAINNET,
|
|
78
78
|
LEATHER_TESTNET: () => LEATHER_TESTNET,
|
|
79
79
|
LaserEyesProvider: () => LaserEyesProvider,
|
|
80
|
+
MAGIC_EDEN: () => MAGIC_EDEN,
|
|
80
81
|
MAINNET: () => MAINNET,
|
|
81
82
|
MEMPOOL_SPACE_TESTNET_URL: () => MEMPOOL_SPACE_TESTNET_URL,
|
|
82
83
|
MEMPOOL_SPACE_URL: () => MEMPOOL_SPACE_URL,
|
|
84
|
+
OKX: () => OKX,
|
|
85
|
+
OKX_MAINNET: () => OKX_MAINNET,
|
|
86
|
+
OKX_TESTNET: () => OKX_TESTNET,
|
|
83
87
|
OYL: () => OYL,
|
|
84
88
|
P2PKH: () => P2PKH,
|
|
85
89
|
P2PSH: () => P2PSH,
|
|
@@ -89,11 +93,15 @@ __export(src_exports, {
|
|
|
89
93
|
P2WSH: () => P2WSH,
|
|
90
94
|
PHANTOM: () => PHANTOM,
|
|
91
95
|
REGTEST: () => REGTEST,
|
|
96
|
+
SIGNET: () => SIGNET,
|
|
92
97
|
TESTNET: () => TESTNET,
|
|
93
98
|
UNISAT: () => UNISAT,
|
|
94
99
|
UNISAT_MAINNET: () => UNISAT_MAINNET,
|
|
95
100
|
UNISAT_TESTNET: () => UNISAT_TESTNET,
|
|
96
101
|
WALLETS: () => WALLETS,
|
|
102
|
+
WIZZ: () => WIZZ,
|
|
103
|
+
WIZZ_MAINNET: () => WIZZ_MAINNET,
|
|
104
|
+
WIZZ_TESTNET: () => WIZZ_TESTNET,
|
|
97
105
|
XVERSE: () => XVERSE,
|
|
98
106
|
XVERSE_MAINNET: () => XVERSE_MAINNET,
|
|
99
107
|
XVERSE_NETWORK: () => XVERSE_NETWORK,
|
|
@@ -110,10 +118,13 @@ __export(src_exports, {
|
|
|
110
118
|
getLeatherNetwork: () => getLeatherNetwork,
|
|
111
119
|
getMempoolSpaceUrl: () => getMempoolSpaceUrl,
|
|
112
120
|
getNetworkForLeather: () => getNetworkForLeather,
|
|
121
|
+
getNetworkForOkx: () => getNetworkForOkx,
|
|
113
122
|
getNetworkForUnisat: () => getNetworkForUnisat,
|
|
123
|
+
getNetworkForWizz: () => getNetworkForWizz,
|
|
114
124
|
getNetworkForXverse: () => getNetworkForXverse,
|
|
115
125
|
getRedeemScript: () => getRedeemScript,
|
|
116
126
|
getUnisatNetwork: () => getUnisatNetwork,
|
|
127
|
+
getWizzNetwork: () => getWizzNetwork,
|
|
117
128
|
getXverseNetwork: () => getXverseNetwork,
|
|
118
129
|
isBase64: () => isBase64,
|
|
119
130
|
isHex: () => isHex,
|
|
@@ -128,9 +139,14 @@ var UNISAT_MAINNET = "livenet";
|
|
|
128
139
|
var UNISAT_TESTNET = "testnet";
|
|
129
140
|
var XVERSE_MAINNET = "Mainnet";
|
|
130
141
|
var XVERSE_TESTNET = "Testnet";
|
|
142
|
+
var OKX_MAINNET = "livenet";
|
|
143
|
+
var OKX_TESTNET = "testnet";
|
|
144
|
+
var WIZZ_MAINNET = "livenet";
|
|
145
|
+
var WIZZ_TESTNET = "testnet";
|
|
131
146
|
var LEATHER_MAINNET = "mainnet";
|
|
132
147
|
var LEATHER_TESTNET = "testnet";
|
|
133
148
|
var MAINNET = "mainnet";
|
|
149
|
+
var SIGNET = "signet";
|
|
134
150
|
var TESTNET = "testnet";
|
|
135
151
|
var REGTEST = "regtest";
|
|
136
152
|
var getXverseNetwork = (network) => {
|
|
@@ -154,6 +170,13 @@ var getUnisatNetwork = (network) => {
|
|
|
154
170
|
return UNISAT_TESTNET;
|
|
155
171
|
return UNISAT_MAINNET;
|
|
156
172
|
};
|
|
173
|
+
var getWizzNetwork = (network) => {
|
|
174
|
+
if (network === MAINNET)
|
|
175
|
+
return WIZZ_MAINNET;
|
|
176
|
+
if (network === TESTNET)
|
|
177
|
+
return WIZZ_TESTNET;
|
|
178
|
+
return WIZZ_MAINNET;
|
|
179
|
+
};
|
|
157
180
|
var getNetworkForUnisat = (network) => {
|
|
158
181
|
if (network === UNISAT_MAINNET)
|
|
159
182
|
return MAINNET;
|
|
@@ -175,6 +198,20 @@ var getNetworkForLeather = (network) => {
|
|
|
175
198
|
return TESTNET;
|
|
176
199
|
return MAINNET;
|
|
177
200
|
};
|
|
201
|
+
var getNetworkForOkx = (network) => {
|
|
202
|
+
if (network === OKX_MAINNET)
|
|
203
|
+
return MAINNET;
|
|
204
|
+
if (network === OKX_TESTNET)
|
|
205
|
+
return TESTNET;
|
|
206
|
+
return MAINNET;
|
|
207
|
+
};
|
|
208
|
+
var getNetworkForWizz = (network) => {
|
|
209
|
+
if (network === WIZZ_MAINNET)
|
|
210
|
+
return MAINNET;
|
|
211
|
+
if (network === WIZZ_TESTNET)
|
|
212
|
+
return TESTNET;
|
|
213
|
+
return MAINNET;
|
|
214
|
+
};
|
|
178
215
|
var MEMPOOL_SPACE_URL = "https://mempool.space";
|
|
179
216
|
var MEMPOOL_SPACE_TESTNET_URL = "https://mempool.space/testnet";
|
|
180
217
|
var getMempoolSpaceUrl = (network) => network === TESTNET ? MEMPOOL_SPACE_TESTNET_URL : MEMPOOL_SPACE_URL;
|
|
@@ -185,6 +222,9 @@ var UNISAT = "unisat";
|
|
|
185
222
|
var XVERSE = "xverse";
|
|
186
223
|
var PHANTOM = "phantom";
|
|
187
224
|
var LEATHER = "leather";
|
|
225
|
+
var MAGIC_EDEN = "magic-eden";
|
|
226
|
+
var OKX = "okx";
|
|
227
|
+
var WIZZ = "wizz";
|
|
188
228
|
var P2TR = "p2tr";
|
|
189
229
|
var P2PKH = "p2pkh";
|
|
190
230
|
var P2WPKH = "p2wpkh";
|
|
@@ -237,6 +277,11 @@ var initialWalletContext = {
|
|
|
237
277
|
hasUnisat: false,
|
|
238
278
|
hasXverse: false,
|
|
239
279
|
hasOyl: false,
|
|
280
|
+
hasMagicEden: false,
|
|
281
|
+
hasOkx: false,
|
|
282
|
+
hasLeather: false,
|
|
283
|
+
hasPhantom: false,
|
|
284
|
+
hasWizz: false,
|
|
240
285
|
connected: false,
|
|
241
286
|
isConnecting: false,
|
|
242
287
|
publicKey: "",
|
|
@@ -416,7 +461,7 @@ function createSendBtcPsbt(address2, paymentAddress, recipientAddress, amount, p
|
|
|
416
461
|
value
|
|
417
462
|
}
|
|
418
463
|
});
|
|
419
|
-
if (isTaprootOnly) {
|
|
464
|
+
if (!isTaprootOnly) {
|
|
420
465
|
const redeemScript = getRedeemScript(paymentPublicKey, network);
|
|
421
466
|
psbt.updateInput(counter, { redeemScript });
|
|
422
467
|
}
|
|
@@ -470,6 +515,7 @@ function getRedeemScript(paymentPublicKey, network) {
|
|
|
470
515
|
// src/providers/LaserEyesProvider.tsx
|
|
471
516
|
var import_sats_connect = require("sats-connect");
|
|
472
517
|
var import_address = require("bitcoinjs-lib/src/address");
|
|
518
|
+
var import_axios2 = __toESM(require("axios"));
|
|
473
519
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
474
520
|
var LaserEyesContext = (0, import_react.createContext)(initialWalletContext);
|
|
475
521
|
var useLaserEyes = () => {
|
|
@@ -496,6 +542,11 @@ var LaserEyesProvider = ({
|
|
|
496
542
|
const [hasUnisat, setHasUnisat] = (0, import_react.useState)(false);
|
|
497
543
|
const [hasXverse, setHasXverse] = (0, import_react.useState)(false);
|
|
498
544
|
const [hasOyl, setHasOyl] = (0, import_react.useState)(false);
|
|
545
|
+
const [hasMagicEden, setHasMagicEden] = (0, import_react.useState)(false);
|
|
546
|
+
const [hasOkx, setHasOkx] = (0, import_react.useState)(false);
|
|
547
|
+
const [hasLeather, setHasLeather] = (0, import_react.useState)(false);
|
|
548
|
+
const [hasPhantom, setHasPhantom] = (0, import_react.useState)(false);
|
|
549
|
+
const [hasWizz, setHasWizz] = (0, import_react.useState)(false);
|
|
499
550
|
const [network, setNetwork] = (0, import_usehooks_ts.useLocalStorage)("network", MAINNET, {
|
|
500
551
|
initializeWithValue: false
|
|
501
552
|
});
|
|
@@ -524,11 +575,43 @@ var LaserEyesProvider = ({
|
|
|
524
575
|
const oylLib = window == null ? void 0 : window.oyl;
|
|
525
576
|
setHasOyl(!!oylLib);
|
|
526
577
|
}, []);
|
|
578
|
+
(0, import_react.useEffect)(() => {
|
|
579
|
+
const magicEdenLib = window == null ? void 0 : window.magicEden;
|
|
580
|
+
setHasMagicEden(!!magicEdenLib);
|
|
581
|
+
}, []);
|
|
582
|
+
(0, import_react.useEffect)(() => {
|
|
583
|
+
}, []);
|
|
584
|
+
(0, import_react.useEffect)(() => {
|
|
585
|
+
let foundOkx;
|
|
586
|
+
if (network === TESTNET) {
|
|
587
|
+
foundOkx = window.okxwallet.bitcoinTestnet;
|
|
588
|
+
} else if (network === MAINNET) {
|
|
589
|
+
foundOkx = window.okxwallet.bitcoin;
|
|
590
|
+
}
|
|
591
|
+
setHasOkx(!!foundOkx);
|
|
592
|
+
}, []);
|
|
593
|
+
(0, import_react.useEffect)(() => {
|
|
594
|
+
const leatherLib = window == null ? void 0 : window.LeatherProvider;
|
|
595
|
+
setHasLeather(!!leatherLib);
|
|
596
|
+
}, []);
|
|
597
|
+
(0, import_react.useEffect)(() => {
|
|
598
|
+
var _a;
|
|
599
|
+
const phantomLib = (_a = window == null ? void 0 : window.phantom) == null ? void 0 : _a.bitcoin;
|
|
600
|
+
if (phantomLib && phantomLib.isPhantom) {
|
|
601
|
+
setHasPhantom(!!phantomLib);
|
|
602
|
+
} else {
|
|
603
|
+
setHasPhantom(false);
|
|
604
|
+
}
|
|
605
|
+
}, []);
|
|
606
|
+
(0, import_react.useEffect)(() => {
|
|
607
|
+
const wissLib = window == null ? void 0 : window.wizz;
|
|
608
|
+
setHasWizz(!!wissLib);
|
|
609
|
+
}, []);
|
|
527
610
|
(0, import_react.useEffect)(() => {
|
|
528
611
|
setBalance(void 0);
|
|
529
612
|
}, [network]);
|
|
530
613
|
(0, import_react.useEffect)(() => {
|
|
531
|
-
if (provider !== UNISAT) {
|
|
614
|
+
if (provider !== UNISAT && provider !== WIZZ) {
|
|
532
615
|
return;
|
|
533
616
|
}
|
|
534
617
|
library.getAccounts().then((accounts2) => {
|
|
@@ -632,19 +715,189 @@ var LaserEyesProvider = ({
|
|
|
632
715
|
throw new Error(`Can't lasereyes to ${OYL} wallet`);
|
|
633
716
|
}
|
|
634
717
|
});
|
|
718
|
+
const connectMagicEden = () => __async(void 0, null, function* () {
|
|
719
|
+
try {
|
|
720
|
+
localStorage == null ? void 0 : localStorage.setItem(LOCAL_STORAGE_DEFAULT_WALLET, MAGIC_EDEN);
|
|
721
|
+
let xverseNetwork = getXverseNetwork((config == null ? void 0 : config.network) || MAINNET);
|
|
722
|
+
const getAddressOptions = {
|
|
723
|
+
getProvider: () => __async(void 0, null, function* () {
|
|
724
|
+
return window.magicEden.bitcoin;
|
|
725
|
+
}),
|
|
726
|
+
payload: {
|
|
727
|
+
purposes: ["ordinals", "payment"],
|
|
728
|
+
message: "Address for receiving Ordinals and payments",
|
|
729
|
+
network: {
|
|
730
|
+
type: xverseNetwork
|
|
731
|
+
}
|
|
732
|
+
},
|
|
733
|
+
onFinish: (response) => {
|
|
734
|
+
setPublicKey(String(response.addresses[0].publicKey));
|
|
735
|
+
setPaymentPublicKey(String(response.addresses[1].publicKey));
|
|
736
|
+
const foundAddress = findOrdinalsAddress(response.addresses);
|
|
737
|
+
const foundPaymentAddress = findPaymentAddress(response.addresses);
|
|
738
|
+
if (foundAddress && foundPaymentAddress) {
|
|
739
|
+
setAddress(foundAddress.address);
|
|
740
|
+
setPaymentAddress(foundPaymentAddress.address);
|
|
741
|
+
setProvider(MAGIC_EDEN);
|
|
742
|
+
setLibrary(window.magicEden.bitcoin);
|
|
743
|
+
}
|
|
744
|
+
getBTCBalance(foundPaymentAddress.address).then((totalBalance) => {
|
|
745
|
+
setBalance(totalBalance);
|
|
746
|
+
});
|
|
747
|
+
},
|
|
748
|
+
onCancel: () => {
|
|
749
|
+
throw new Error(`User canceled lasereyes to ${MAGIC_EDEN} wallet`);
|
|
750
|
+
},
|
|
751
|
+
onError: (error) => {
|
|
752
|
+
throw new Error(`Can't lasereyes to ${MAGIC_EDEN} wallet`);
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
console.log(JSON.stringify(getAddressOptions));
|
|
756
|
+
yield (0, import_sats_connect.getAddress)(getAddressOptions);
|
|
757
|
+
setConnected(true);
|
|
758
|
+
} catch (error) {
|
|
759
|
+
console.log("error", error);
|
|
760
|
+
throw error;
|
|
761
|
+
}
|
|
762
|
+
});
|
|
763
|
+
const connectOkx = () => __async(void 0, null, function* () {
|
|
764
|
+
try {
|
|
765
|
+
localStorage == null ? void 0 : localStorage.setItem(LOCAL_STORAGE_DEFAULT_WALLET, OKX);
|
|
766
|
+
const lib = network === TESTNET ? window.okxwallet.bitcoinTestnet : window.okxwallet.bitcoin;
|
|
767
|
+
const okxAccounts = yield lib.requestAccounts();
|
|
768
|
+
if (!okxAccounts)
|
|
769
|
+
throw new Error("No accounts found");
|
|
770
|
+
const okxPubKey = yield lib.getPublicKey();
|
|
771
|
+
if (!okxPubKey)
|
|
772
|
+
throw new Error("No public key found");
|
|
773
|
+
setAccounts(okxAccounts);
|
|
774
|
+
setAddress(okxAccounts[0]);
|
|
775
|
+
setPaymentAddress(okxAccounts[0]);
|
|
776
|
+
setPublicKey(okxPubKey);
|
|
777
|
+
setPaymentPublicKey(okxPubKey);
|
|
778
|
+
setLibrary(lib);
|
|
779
|
+
setProvider(OKX);
|
|
780
|
+
setConnected(true);
|
|
781
|
+
const balance2 = yield lib == null ? void 0 : lib.getBalance();
|
|
782
|
+
setBalance(balance2 == null ? void 0 : balance2.total);
|
|
783
|
+
} catch (error) {
|
|
784
|
+
throw error;
|
|
785
|
+
}
|
|
786
|
+
});
|
|
787
|
+
const connectLeather = () => __async(void 0, null, function* () {
|
|
788
|
+
try {
|
|
789
|
+
localStorage == null ? void 0 : localStorage.setItem(LOCAL_STORAGE_DEFAULT_WALLET, LEATHER);
|
|
790
|
+
const lib = window.LeatherProvider;
|
|
791
|
+
const getAddressesResponse = yield lib.request(
|
|
792
|
+
"getAddresses"
|
|
793
|
+
);
|
|
794
|
+
const addressesResponse = getAddressesResponse.result;
|
|
795
|
+
const addresses = addressesResponse.addresses;
|
|
796
|
+
const leatherAccountsParsed = addresses.map(
|
|
797
|
+
(address3) => address3.address
|
|
798
|
+
);
|
|
799
|
+
const taprootAddress = addresses.find(
|
|
800
|
+
(address3) => address3.type === P2TR
|
|
801
|
+
);
|
|
802
|
+
const segwitAddress = addresses.find(
|
|
803
|
+
(address3) => address3.type === P2WPKH
|
|
804
|
+
);
|
|
805
|
+
setAccounts(leatherAccountsParsed);
|
|
806
|
+
setAddress(String(taprootAddress == null ? void 0 : taprootAddress.address));
|
|
807
|
+
setPublicKey(String(taprootAddress == null ? void 0 : taprootAddress.publicKey));
|
|
808
|
+
setPaymentAddress(String(segwitAddress == null ? void 0 : segwitAddress.address));
|
|
809
|
+
setPaymentPublicKey(String(segwitAddress == null ? void 0 : segwitAddress.publicKey));
|
|
810
|
+
setLibrary(lib);
|
|
811
|
+
setProvider(LEATHER);
|
|
812
|
+
const balance2 = yield getBTCBalance(String(segwitAddress == null ? void 0 : segwitAddress.address));
|
|
813
|
+
setBalance(balance2);
|
|
814
|
+
handleAccountsChanged(leatherAccountsParsed);
|
|
815
|
+
setConnected(true);
|
|
816
|
+
yield getNetwork().then((network2) => {
|
|
817
|
+
if (!network2) {
|
|
818
|
+
setNetwork(MAINNET);
|
|
819
|
+
} else {
|
|
820
|
+
setNetwork(network2);
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
setConnected(true);
|
|
824
|
+
} catch (error) {
|
|
825
|
+
new Error(`Can't lasereyes to ${LEATHER} wallet`);
|
|
826
|
+
}
|
|
827
|
+
});
|
|
828
|
+
const connectPhantom = () => __async(void 0, null, function* () {
|
|
829
|
+
try {
|
|
830
|
+
localStorage == null ? void 0 : localStorage.setItem(LOCAL_STORAGE_DEFAULT_WALLET, PHANTOM);
|
|
831
|
+
const lib = window.phantom.bitcoin;
|
|
832
|
+
const phantomAccounts = yield lib.requestAccounts();
|
|
833
|
+
const phantomAccountsParsed = phantomAccounts.map(
|
|
834
|
+
(account) => account.address
|
|
835
|
+
);
|
|
836
|
+
setAccounts(phantomAccountsParsed);
|
|
837
|
+
const ordinalsAccount = phantomAccounts.find(
|
|
838
|
+
(account) => account.purpose === "ordinals"
|
|
839
|
+
);
|
|
840
|
+
const paymentAccount = phantomAccounts.find(
|
|
841
|
+
(account) => account.purpose === "payment"
|
|
842
|
+
);
|
|
843
|
+
setAddress(ordinalsAccount == null ? void 0 : ordinalsAccount.address);
|
|
844
|
+
setPublicKey(ordinalsAccount == null ? void 0 : ordinalsAccount.publicKey);
|
|
845
|
+
setPaymentAddress(paymentAccount == null ? void 0 : paymentAccount.address);
|
|
846
|
+
setPaymentPublicKey(paymentAccount == null ? void 0 : paymentAccount.publicKey);
|
|
847
|
+
setLibrary(lib);
|
|
848
|
+
setProvider(PHANTOM);
|
|
849
|
+
const balance2 = yield getBTCBalance(String(paymentAccount == null ? void 0 : paymentAccount.address));
|
|
850
|
+
setBalance(balance2);
|
|
851
|
+
setConnected(true);
|
|
852
|
+
} catch (error) {
|
|
853
|
+
throw new Error(`Can't lasereyes to ${PHANTOM} wallet`);
|
|
854
|
+
}
|
|
855
|
+
});
|
|
856
|
+
const connectWizz = () => __async(void 0, null, function* () {
|
|
857
|
+
try {
|
|
858
|
+
localStorage == null ? void 0 : localStorage.setItem(LOCAL_STORAGE_DEFAULT_WALLET, WIZZ);
|
|
859
|
+
const lib = window.wizz;
|
|
860
|
+
const wizzAccounts = yield lib.requestAccounts();
|
|
861
|
+
if (!wizzAccounts)
|
|
862
|
+
throw new Error("No accounts found");
|
|
863
|
+
const wizzPubKey = yield lib.getPublicKey();
|
|
864
|
+
if (!wizzPubKey)
|
|
865
|
+
throw new Error("No public key found");
|
|
866
|
+
setAccounts(wizzAccounts);
|
|
867
|
+
setAddress(wizzAccounts[0]);
|
|
868
|
+
setPaymentAddress(wizzAccounts[0]);
|
|
869
|
+
setPublicKey(wizzPubKey);
|
|
870
|
+
setPaymentPublicKey(wizzPubKey);
|
|
871
|
+
setLibrary(lib);
|
|
872
|
+
setProvider(WIZZ);
|
|
873
|
+
setConnected(true);
|
|
874
|
+
const balance2 = yield lib == null ? void 0 : lib.getBalance();
|
|
875
|
+
setBalance(balance2 == null ? void 0 : balance2.total);
|
|
876
|
+
} catch (error) {
|
|
877
|
+
throw error;
|
|
878
|
+
}
|
|
879
|
+
});
|
|
635
880
|
const connect = (walletName) => __async(void 0, null, function* () {
|
|
636
881
|
setIsConnecting(true);
|
|
637
882
|
try {
|
|
638
883
|
if (!walletName)
|
|
639
884
|
throw new Error("No wallet provided");
|
|
640
885
|
if (walletName === UNISAT) {
|
|
641
|
-
console.log("connectin unisat");
|
|
642
886
|
yield connectUnisat();
|
|
643
887
|
} else if (walletName === XVERSE) {
|
|
644
888
|
yield connectXverse();
|
|
645
889
|
} else if (walletName === OYL) {
|
|
646
|
-
console.log("connectin oyl");
|
|
647
890
|
yield connectOyl();
|
|
891
|
+
} else if (walletName === MAGIC_EDEN) {
|
|
892
|
+
yield connectMagicEden();
|
|
893
|
+
} else if (walletName === OKX) {
|
|
894
|
+
yield connectOkx();
|
|
895
|
+
} else if (walletName === LEATHER) {
|
|
896
|
+
yield connectLeather();
|
|
897
|
+
} else if (walletName === PHANTOM) {
|
|
898
|
+
yield connectPhantom();
|
|
899
|
+
} else if (walletName === WIZZ) {
|
|
900
|
+
yield connectWizz();
|
|
648
901
|
} else {
|
|
649
902
|
throw new Error("Unsupported wallet..");
|
|
650
903
|
}
|
|
@@ -679,7 +932,6 @@ var LaserEyesProvider = ({
|
|
|
679
932
|
if (self.accounts[0] === _accounts[0]) {
|
|
680
933
|
return;
|
|
681
934
|
}
|
|
682
|
-
console.log("acct changed", _accounts[0]);
|
|
683
935
|
self.accounts = _accounts;
|
|
684
936
|
if (_accounts.length > 0) {
|
|
685
937
|
connect(UNISAT);
|
|
@@ -696,6 +948,10 @@ var LaserEyesProvider = ({
|
|
|
696
948
|
connect(provider);
|
|
697
949
|
} else if (provider === XVERSE) {
|
|
698
950
|
throw new Error("Not implemented");
|
|
951
|
+
} else if (provider === WIZZ) {
|
|
952
|
+
foundNetwork = getNetworkForWizz(network2);
|
|
953
|
+
setNetwork(foundNetwork);
|
|
954
|
+
connect(provider);
|
|
699
955
|
} else {
|
|
700
956
|
throw new Error("The connected wallet doesn't support this method..");
|
|
701
957
|
}
|
|
@@ -734,6 +990,48 @@ var LaserEyesProvider = ({
|
|
|
734
990
|
return [address2];
|
|
735
991
|
} else if (provider === OYL) {
|
|
736
992
|
return yield library.requestAccounts();
|
|
993
|
+
} else if (provider === OKX) {
|
|
994
|
+
return yield library.requestAccounts();
|
|
995
|
+
} else if (provider === LEATHER) {
|
|
996
|
+
localStorage == null ? void 0 : localStorage.setItem(LOCAL_STORAGE_DEFAULT_WALLET, LEATHER);
|
|
997
|
+
const lib = window.LeatherProvider;
|
|
998
|
+
const getAddressesResponse = yield lib.request(
|
|
999
|
+
"getAddresses"
|
|
1000
|
+
);
|
|
1001
|
+
const addressesResponse = getAddressesResponse.result;
|
|
1002
|
+
const addresses = addressesResponse.addresses;
|
|
1003
|
+
const leatherAccountsParsed = addresses.map(
|
|
1004
|
+
(address3) => address3.address
|
|
1005
|
+
);
|
|
1006
|
+
const taprootAddress = addresses.find(
|
|
1007
|
+
(address3) => address3.type === P2TR
|
|
1008
|
+
);
|
|
1009
|
+
const segwitAddress = addresses.find(
|
|
1010
|
+
(address3) => address3.type === P2WPKH
|
|
1011
|
+
);
|
|
1012
|
+
setAccounts(leatherAccountsParsed);
|
|
1013
|
+
setAddress(String(taprootAddress == null ? void 0 : taprootAddress.address));
|
|
1014
|
+
setPaymentAddress(String(segwitAddress == null ? void 0 : segwitAddress.address));
|
|
1015
|
+
setLibrary(lib);
|
|
1016
|
+
setProvider(LEATHER);
|
|
1017
|
+
handleAccountsChanged(leatherAccountsParsed);
|
|
1018
|
+
setConnected(true);
|
|
1019
|
+
yield getNetwork().then((network2) => {
|
|
1020
|
+
if (!network2) {
|
|
1021
|
+
setNetwork(MAINNET);
|
|
1022
|
+
} else {
|
|
1023
|
+
setNetwork(network2);
|
|
1024
|
+
}
|
|
1025
|
+
});
|
|
1026
|
+
setConnected(true);
|
|
1027
|
+
} else if (provider === PHANTOM) {
|
|
1028
|
+
const phantomAccounts = yield library.requestAccounts();
|
|
1029
|
+
const phantomAccountsParsed = phantomAccounts.map(
|
|
1030
|
+
(account) => account.address
|
|
1031
|
+
);
|
|
1032
|
+
return phantomAccountsParsed;
|
|
1033
|
+
} else if (provider === WIZZ) {
|
|
1034
|
+
return yield library.requestAccounts();
|
|
737
1035
|
} else {
|
|
738
1036
|
throw new Error("The connected wallet doesn't support this method..");
|
|
739
1037
|
}
|
|
@@ -761,6 +1059,29 @@ var LaserEyesProvider = ({
|
|
|
761
1059
|
return TESTNET;
|
|
762
1060
|
}
|
|
763
1061
|
return MAINNET;
|
|
1062
|
+
} else if (provider === MAGIC_EDEN) {
|
|
1063
|
+
if (address2.slice(0, 1) === "t") {
|
|
1064
|
+
return TESTNET;
|
|
1065
|
+
}
|
|
1066
|
+
return MAINNET;
|
|
1067
|
+
} else if (provider === OKX) {
|
|
1068
|
+
const okxNetwork = yield library == null ? void 0 : library.getNetwork();
|
|
1069
|
+
const foundNetwork = getNetworkForOkx(okxNetwork);
|
|
1070
|
+
setNetwork(foundNetwork);
|
|
1071
|
+
} else if (provider === LEATHER) {
|
|
1072
|
+
if (address2.slice(0, 1) === "t") {
|
|
1073
|
+
return TESTNET;
|
|
1074
|
+
}
|
|
1075
|
+
return MAINNET;
|
|
1076
|
+
} else if (provider === PHANTOM) {
|
|
1077
|
+
if (address2.slice(0, 1) === "t") {
|
|
1078
|
+
return TESTNET;
|
|
1079
|
+
}
|
|
1080
|
+
return MAINNET;
|
|
1081
|
+
} else if (provider === WIZZ) {
|
|
1082
|
+
const wizzNetwork = yield library == null ? void 0 : library.getNetwork();
|
|
1083
|
+
const foundNetwork = getNetworkForWizz(wizzNetwork);
|
|
1084
|
+
setNetwork(foundNetwork);
|
|
764
1085
|
}
|
|
765
1086
|
return (_a = config == null ? void 0 : config.network) != null ? _a : MAINNET;
|
|
766
1087
|
} catch (error) {
|
|
@@ -772,7 +1093,11 @@ var LaserEyesProvider = ({
|
|
|
772
1093
|
if (!library)
|
|
773
1094
|
return;
|
|
774
1095
|
if (provider === UNISAT) {
|
|
775
|
-
const wantedNetwork =
|
|
1096
|
+
const wantedNetwork = getWizzNetwork(network2);
|
|
1097
|
+
yield library == null ? void 0 : library.switchNetwork(wantedNetwork);
|
|
1098
|
+
setNetwork(network2);
|
|
1099
|
+
} else if (provider === WIZZ) {
|
|
1100
|
+
const wantedNetwork = getNetworkForWizz(network2);
|
|
776
1101
|
yield library == null ? void 0 : library.switchNetwork(wantedNetwork);
|
|
777
1102
|
setNetwork(network2);
|
|
778
1103
|
} else {
|
|
@@ -790,6 +1115,10 @@ var LaserEyesProvider = ({
|
|
|
790
1115
|
return yield library == null ? void 0 : library.getPublicKey();
|
|
791
1116
|
} else if (provider === OYL) {
|
|
792
1117
|
return yield library == null ? void 0 : library.getPublicKey();
|
|
1118
|
+
} else if (provider === OKX) {
|
|
1119
|
+
return yield library == null ? void 0 : library.getPublicKey();
|
|
1120
|
+
} else if (provider === WIZZ) {
|
|
1121
|
+
return yield library == null ? void 0 : library.getPublicKey();
|
|
793
1122
|
} else {
|
|
794
1123
|
throw new Error("The connected wallet doesn't support this method..");
|
|
795
1124
|
}
|
|
@@ -808,6 +1137,17 @@ var LaserEyesProvider = ({
|
|
|
808
1137
|
} else if (provider === OYL) {
|
|
809
1138
|
const balanceResponse = yield library.getBalance();
|
|
810
1139
|
return balanceResponse.btc.total * 1e8;
|
|
1140
|
+
} else if (provider === MAGIC_EDEN) {
|
|
1141
|
+
return yield getBTCBalance(paymentAddress);
|
|
1142
|
+
} else if (provider === OKX) {
|
|
1143
|
+
return yield getBTCBalance(paymentAddress);
|
|
1144
|
+
} else if (provider === LEATHER) {
|
|
1145
|
+
return yield getBTCBalance(paymentAddress);
|
|
1146
|
+
} else if (provider === PHANTOM) {
|
|
1147
|
+
return yield getBTCBalance(paymentAddress);
|
|
1148
|
+
} else if (provider === WIZZ) {
|
|
1149
|
+
const balanceResponse = yield library.getBalance();
|
|
1150
|
+
return balanceResponse.total * 1e8;
|
|
811
1151
|
}
|
|
812
1152
|
} catch (error) {
|
|
813
1153
|
throw error;
|
|
@@ -821,6 +1161,10 @@ var LaserEyesProvider = ({
|
|
|
821
1161
|
return yield library.getInscriptions(0, 10);
|
|
822
1162
|
} else if (provider === OYL) {
|
|
823
1163
|
return yield library.getInscriptions(0, 10);
|
|
1164
|
+
} else if (provider === OKX) {
|
|
1165
|
+
return yield library.getInscriptions(0, 10);
|
|
1166
|
+
} else if (provider === WIZZ) {
|
|
1167
|
+
return yield library.getInscriptions(0, 10);
|
|
824
1168
|
} else {
|
|
825
1169
|
throw new Error("The connected wallet doesn't support this method..");
|
|
826
1170
|
}
|
|
@@ -829,6 +1173,7 @@ var LaserEyesProvider = ({
|
|
|
829
1173
|
}
|
|
830
1174
|
});
|
|
831
1175
|
const sendBTC = (to, amount) => __async(void 0, null, function* () {
|
|
1176
|
+
var _a;
|
|
832
1177
|
try {
|
|
833
1178
|
if (amount <= 0)
|
|
834
1179
|
throw new Error("Amount must be greater than 0");
|
|
@@ -874,12 +1219,58 @@ var LaserEyesProvider = ({
|
|
|
874
1219
|
if (!psbt)
|
|
875
1220
|
throw new Error("Error sending BTC");
|
|
876
1221
|
return psbt.txId;
|
|
1222
|
+
} else if (provider === MAGIC_EDEN) {
|
|
1223
|
+
const { psbtHex, psbtBase64 } = yield createSendBtcPsbt(
|
|
1224
|
+
address2,
|
|
1225
|
+
paymentAddress,
|
|
1226
|
+
to,
|
|
1227
|
+
amount,
|
|
1228
|
+
paymentPublicKey,
|
|
1229
|
+
//@ts-ignore
|
|
1230
|
+
network,
|
|
1231
|
+
7
|
|
1232
|
+
);
|
|
1233
|
+
const psbt = yield signPsbt(psbtBase64, true, true);
|
|
1234
|
+
if (!psbt)
|
|
1235
|
+
throw new Error("Error sending BTC");
|
|
1236
|
+
return psbt.txId;
|
|
1237
|
+
} else if (provider === OKX) {
|
|
1238
|
+
const txId = yield library == null ? void 0 : library.sendBitcoin(to, amount);
|
|
1239
|
+
if (!txId)
|
|
1240
|
+
throw new Error("Transaction failed");
|
|
1241
|
+
return txId;
|
|
1242
|
+
} else if (provider === LEATHER) {
|
|
1243
|
+
const response = yield library == null ? void 0 : library.request("sendTransfer", {
|
|
1244
|
+
recipients: [
|
|
1245
|
+
{
|
|
1246
|
+
address: to,
|
|
1247
|
+
amount
|
|
1248
|
+
}
|
|
1249
|
+
]
|
|
1250
|
+
});
|
|
1251
|
+
if ((_a = response == null ? void 0 : response.result) == null ? void 0 : _a.txid) {
|
|
1252
|
+
return response.result.txid;
|
|
1253
|
+
} else {
|
|
1254
|
+
if (response.error.code === import_sats_connect.RpcErrorCode.USER_REJECTION) {
|
|
1255
|
+
throw new Error("User rejected the request");
|
|
1256
|
+
} else {
|
|
1257
|
+
throw new Error("Error sending BTC: " + response.error.message);
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
} else if (provider === WIZZ) {
|
|
1261
|
+
const txId = yield library == null ? void 0 : library.sendBitcoin(to, amount);
|
|
1262
|
+
if (txId) {
|
|
1263
|
+
return txId;
|
|
1264
|
+
} else {
|
|
1265
|
+
throw new Error("Error sending BTC");
|
|
1266
|
+
}
|
|
877
1267
|
}
|
|
878
1268
|
} catch (error) {
|
|
879
1269
|
throw error;
|
|
880
1270
|
}
|
|
881
1271
|
});
|
|
882
1272
|
const signMessage = (message) => __async(void 0, null, function* () {
|
|
1273
|
+
var _a;
|
|
883
1274
|
try {
|
|
884
1275
|
if (!library)
|
|
885
1276
|
return;
|
|
@@ -899,6 +1290,26 @@ var LaserEyesProvider = ({
|
|
|
899
1290
|
throw new Error("Error signing message: " + response.error.message);
|
|
900
1291
|
}
|
|
901
1292
|
}
|
|
1293
|
+
} else if (provider === OKX) {
|
|
1294
|
+
return yield library == null ? void 0 : library.signMessage(message);
|
|
1295
|
+
} else if (provider === LEATHER) {
|
|
1296
|
+
const signed = yield library == null ? void 0 : library.request("signMessage", {
|
|
1297
|
+
message,
|
|
1298
|
+
paymentType: P2TR
|
|
1299
|
+
});
|
|
1300
|
+
console.log(signed);
|
|
1301
|
+
return (_a = signed == null ? void 0 : signed.result) == null ? void 0 : _a.signature;
|
|
1302
|
+
} else if (provider === PHANTOM) {
|
|
1303
|
+
const utf8Bytes = new TextEncoder().encode(message);
|
|
1304
|
+
const uintArray = new Uint8Array(utf8Bytes);
|
|
1305
|
+
const response = yield library == null ? void 0 : library.signMessage(address2, uintArray);
|
|
1306
|
+
console.log(response);
|
|
1307
|
+
const binaryString = String.fromCharCode(...response.signature);
|
|
1308
|
+
return btoa(binaryString);
|
|
1309
|
+
} else if (provider === WIZZ) {
|
|
1310
|
+
return yield library == null ? void 0 : library.signMessage(message);
|
|
1311
|
+
} else {
|
|
1312
|
+
throw new Error("The connected wallet doesn't support this method..");
|
|
902
1313
|
}
|
|
903
1314
|
} catch (error) {
|
|
904
1315
|
throw error;
|
|
@@ -1036,11 +1447,183 @@ var LaserEyesProvider = ({
|
|
|
1036
1447
|
txId: void 0
|
|
1037
1448
|
};
|
|
1038
1449
|
}
|
|
1450
|
+
} else if (provider === MAGIC_EDEN) {
|
|
1451
|
+
const toSignPsbt = bitcoin2.Psbt.fromBase64(String(psbtBase64), {
|
|
1452
|
+
network: getBitcoinNetwork(network)
|
|
1453
|
+
});
|
|
1454
|
+
const inputs = toSignPsbt.data.inputs;
|
|
1455
|
+
const inputsToSign = [];
|
|
1456
|
+
const ordinalAddressData = {
|
|
1457
|
+
address: address2,
|
|
1458
|
+
signingIndexes: []
|
|
1459
|
+
};
|
|
1460
|
+
const paymentsAddressData = {
|
|
1461
|
+
address: paymentAddress,
|
|
1462
|
+
signingIndexes: []
|
|
1463
|
+
};
|
|
1464
|
+
let counter = 0;
|
|
1465
|
+
try {
|
|
1466
|
+
for (var iter2 = __forAwait(inputs), more2, temp2, error2; more2 = !(temp2 = yield iter2.next()).done; more2 = false) {
|
|
1467
|
+
let input = temp2.value;
|
|
1468
|
+
const { script } = input.witnessUtxo;
|
|
1469
|
+
const addressFromScript = (0, import_address.fromOutputScript)(
|
|
1470
|
+
script,
|
|
1471
|
+
getBitcoinNetwork(network)
|
|
1472
|
+
);
|
|
1473
|
+
if (addressFromScript === paymentAddress) {
|
|
1474
|
+
paymentsAddressData.signingIndexes.push(Number(counter));
|
|
1475
|
+
} else if (addressFromScript === address2) {
|
|
1476
|
+
ordinalAddressData.signingIndexes.push(Number(counter));
|
|
1477
|
+
}
|
|
1478
|
+
counter++;
|
|
1479
|
+
}
|
|
1480
|
+
} catch (temp2) {
|
|
1481
|
+
error2 = [temp2];
|
|
1482
|
+
} finally {
|
|
1483
|
+
try {
|
|
1484
|
+
more2 && (temp2 = iter2.return) && (yield temp2.call(iter2));
|
|
1485
|
+
} finally {
|
|
1486
|
+
if (error2)
|
|
1487
|
+
throw error2[0];
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
if (ordinalAddressData.signingIndexes.length > 0) {
|
|
1491
|
+
inputsToSign.push(ordinalAddressData);
|
|
1492
|
+
}
|
|
1493
|
+
if (paymentsAddressData.signingIndexes.length > 0) {
|
|
1494
|
+
inputsToSign.push(paymentsAddressData);
|
|
1495
|
+
}
|
|
1496
|
+
let txId, signedPsbtHex, signedPsbtBase64;
|
|
1497
|
+
const xverseNetwork = getXverseNetwork(network);
|
|
1498
|
+
const signPsbtOptions = {
|
|
1499
|
+
getProvider: () => __async(void 0, null, function* () {
|
|
1500
|
+
return window.magicEden.bitcoin;
|
|
1501
|
+
}),
|
|
1502
|
+
payload: {
|
|
1503
|
+
network: {
|
|
1504
|
+
type: xverseNetwork
|
|
1505
|
+
},
|
|
1506
|
+
message: "Sign Transaction",
|
|
1507
|
+
psbtBase64: toSignPsbt.toBase64(),
|
|
1508
|
+
broadcast,
|
|
1509
|
+
inputsToSign
|
|
1510
|
+
},
|
|
1511
|
+
onFinish: (response) => {
|
|
1512
|
+
if (response.psbtBase64) {
|
|
1513
|
+
const signedPsbt = bitcoin2.Psbt.fromBase64(
|
|
1514
|
+
String(response.psbtBase64),
|
|
1515
|
+
{
|
|
1516
|
+
network: getBitcoinNetwork(network)
|
|
1517
|
+
}
|
|
1518
|
+
);
|
|
1519
|
+
signedPsbtHex = signedPsbt.toHex();
|
|
1520
|
+
signedPsbtBase64 = signedPsbt.toBase64();
|
|
1521
|
+
}
|
|
1522
|
+
},
|
|
1523
|
+
onCancel: () => {
|
|
1524
|
+
console.log("Canceled");
|
|
1525
|
+
throw new Error("User canceled the request");
|
|
1526
|
+
},
|
|
1527
|
+
onError: (error3) => {
|
|
1528
|
+
console.log("error", error3);
|
|
1529
|
+
throw error3;
|
|
1530
|
+
}
|
|
1531
|
+
};
|
|
1532
|
+
yield (0, import_sats_connect.signTransaction)(signPsbtOptions);
|
|
1533
|
+
if (broadcast) {
|
|
1534
|
+
const signed = bitcoin2.Psbt.fromBase64(String(signedPsbtBase64));
|
|
1535
|
+
const finalized = signed.finalizeAllInputs();
|
|
1536
|
+
const extracted = finalized.extractTransaction();
|
|
1537
|
+
const txId2 = yield pushPsbt(extracted.toHex());
|
|
1538
|
+
return {
|
|
1539
|
+
signedPsbtHex: extracted.toHex(),
|
|
1540
|
+
signedPsbtBase64: "test",
|
|
1541
|
+
txId: txId2
|
|
1542
|
+
};
|
|
1543
|
+
} else {
|
|
1544
|
+
return {
|
|
1545
|
+
signedPsbtHex,
|
|
1546
|
+
signedPsbtBase64,
|
|
1547
|
+
txId
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1550
|
+
} else if (provider === OKX) {
|
|
1551
|
+
const signedPsbt = yield library == null ? void 0 : library.signPsbt(psbtHex, {
|
|
1552
|
+
autoFinalized: finalize
|
|
1553
|
+
});
|
|
1554
|
+
const psbtSignedPsbt = bitcoin2.Psbt.fromHex(signedPsbt);
|
|
1555
|
+
if (finalize && broadcast) {
|
|
1556
|
+
const txId = yield pushPsbt(signedPsbt);
|
|
1557
|
+
return {
|
|
1558
|
+
signedPsbtHex: psbtSignedPsbt.toHex(),
|
|
1559
|
+
signedPsbtBase64: psbtSignedPsbt.toBase64(),
|
|
1560
|
+
txId
|
|
1561
|
+
};
|
|
1562
|
+
}
|
|
1563
|
+
return {
|
|
1564
|
+
signedPsbtHex: psbtSignedPsbt.toHex(),
|
|
1565
|
+
signedPsbtBase64: psbtSignedPsbt.toBase64(),
|
|
1566
|
+
txId: void 0
|
|
1567
|
+
};
|
|
1568
|
+
} else if (provider === LEATHER) {
|
|
1569
|
+
const requestParams = {
|
|
1570
|
+
hex: psbtHex,
|
|
1571
|
+
broadcast
|
|
1572
|
+
};
|
|
1573
|
+
const response = yield library == null ? void 0 : library.request(
|
|
1574
|
+
"signPsbt",
|
|
1575
|
+
requestParams
|
|
1576
|
+
);
|
|
1577
|
+
const leatherHexResult = response.result;
|
|
1578
|
+
const signedTx = leatherHexResult.hex;
|
|
1579
|
+
const signed = bitcoin2.Psbt.fromBase64(String(signedTx));
|
|
1580
|
+
if (finalize && broadcast) {
|
|
1581
|
+
const finalized = signed.finalizeAllInputs();
|
|
1582
|
+
const extracted = finalized.extractTransaction();
|
|
1583
|
+
const txId = yield pushPsbt(extracted.toHex());
|
|
1584
|
+
return {
|
|
1585
|
+
signedPsbtHex: signed.toHex(),
|
|
1586
|
+
signedPsbtBase64: signed.toBase64(),
|
|
1587
|
+
txId
|
|
1588
|
+
};
|
|
1589
|
+
} else if (finalize) {
|
|
1590
|
+
const finalized = signed.finalizeAllInputs();
|
|
1591
|
+
return {
|
|
1592
|
+
signedPsbtHex: finalized.toHex(),
|
|
1593
|
+
signedPsbtBase64: finalized.toBase64(),
|
|
1594
|
+
txId: void 0
|
|
1595
|
+
};
|
|
1596
|
+
} else {
|
|
1597
|
+
return {
|
|
1598
|
+
signedPsbtHex: signed.toHex(),
|
|
1599
|
+
signedPsbtBase64: signed.toBase64(),
|
|
1600
|
+
txId: void 0
|
|
1601
|
+
};
|
|
1602
|
+
}
|
|
1603
|
+
} else if (provider === WIZZ) {
|
|
1604
|
+
const signedPsbt = yield library == null ? void 0 : library.signPsbt(psbtHex, {
|
|
1605
|
+
autoFinalized: finalize,
|
|
1606
|
+
broadcast: false
|
|
1607
|
+
});
|
|
1608
|
+
const psbtSignedPsbt = bitcoin2.Psbt.fromHex(signedPsbt);
|
|
1609
|
+
if (finalize && broadcast) {
|
|
1610
|
+
const txId = yield pushPsbt(signedPsbt);
|
|
1611
|
+
return {
|
|
1612
|
+
signedPsbtHex: psbtSignedPsbt.toHex(),
|
|
1613
|
+
signedPsbtBase64: psbtSignedPsbt.toBase64(),
|
|
1614
|
+
txId
|
|
1615
|
+
};
|
|
1616
|
+
}
|
|
1617
|
+
return {
|
|
1618
|
+
signedPsbtHex: psbtSignedPsbt.toHex(),
|
|
1619
|
+
signedPsbtBase64: psbtSignedPsbt.toBase64(),
|
|
1620
|
+
txId: void 0
|
|
1621
|
+
};
|
|
1039
1622
|
} else {
|
|
1040
1623
|
throw new Error("The connected wallet doesn't support this method..");
|
|
1041
1624
|
}
|
|
1042
|
-
} catch (
|
|
1043
|
-
throw
|
|
1625
|
+
} catch (error3) {
|
|
1626
|
+
throw error3;
|
|
1044
1627
|
}
|
|
1045
1628
|
});
|
|
1046
1629
|
const pushPsbt = (psbt) => __async(void 0, null, function* () {
|
|
@@ -1051,6 +1634,14 @@ var LaserEyesProvider = ({
|
|
|
1051
1634
|
return yield library == null ? void 0 : library.pushPsbt(psbt);
|
|
1052
1635
|
} else if (provider === OYL) {
|
|
1053
1636
|
return yield library == null ? void 0 : library.pushPsbt(psbt);
|
|
1637
|
+
} else if (provider === OKX) {
|
|
1638
|
+
return yield library == null ? void 0 : library.pushPsbt(psbt);
|
|
1639
|
+
} else if (provider === MAGIC_EDEN) {
|
|
1640
|
+
return yield import_axios2.default.post("https://mempool.space/api/tx", psbt).then((res) => res.data);
|
|
1641
|
+
} else if (provider === LEATHER) {
|
|
1642
|
+
return yield import_axios2.default.post("https://mempool.space/api/tx", psbt).then((res) => res.data);
|
|
1643
|
+
} else if (provider === WIZZ) {
|
|
1644
|
+
return yield library == null ? void 0 : library.pushPsbt(psbt);
|
|
1054
1645
|
} else {
|
|
1055
1646
|
throw new Error("The connected wallet doesn't support this method..");
|
|
1056
1647
|
}
|
|
@@ -1076,6 +1667,11 @@ var LaserEyesProvider = ({
|
|
|
1076
1667
|
hasUnisat,
|
|
1077
1668
|
hasXverse,
|
|
1078
1669
|
hasOyl,
|
|
1670
|
+
hasMagicEden,
|
|
1671
|
+
hasOkx,
|
|
1672
|
+
hasLeather,
|
|
1673
|
+
hasPhantom,
|
|
1674
|
+
hasWizz,
|
|
1079
1675
|
// functions
|
|
1080
1676
|
connect,
|
|
1081
1677
|
disconnect,
|
|
@@ -1100,9 +1696,13 @@ var LaserEyesProvider = ({
|
|
|
1100
1696
|
LEATHER_MAINNET,
|
|
1101
1697
|
LEATHER_TESTNET,
|
|
1102
1698
|
LaserEyesProvider,
|
|
1699
|
+
MAGIC_EDEN,
|
|
1103
1700
|
MAINNET,
|
|
1104
1701
|
MEMPOOL_SPACE_TESTNET_URL,
|
|
1105
1702
|
MEMPOOL_SPACE_URL,
|
|
1703
|
+
OKX,
|
|
1704
|
+
OKX_MAINNET,
|
|
1705
|
+
OKX_TESTNET,
|
|
1106
1706
|
OYL,
|
|
1107
1707
|
P2PKH,
|
|
1108
1708
|
P2PSH,
|
|
@@ -1112,11 +1712,15 @@ var LaserEyesProvider = ({
|
|
|
1112
1712
|
P2WSH,
|
|
1113
1713
|
PHANTOM,
|
|
1114
1714
|
REGTEST,
|
|
1715
|
+
SIGNET,
|
|
1115
1716
|
TESTNET,
|
|
1116
1717
|
UNISAT,
|
|
1117
1718
|
UNISAT_MAINNET,
|
|
1118
1719
|
UNISAT_TESTNET,
|
|
1119
1720
|
WALLETS,
|
|
1721
|
+
WIZZ,
|
|
1722
|
+
WIZZ_MAINNET,
|
|
1723
|
+
WIZZ_TESTNET,
|
|
1120
1724
|
XVERSE,
|
|
1121
1725
|
XVERSE_MAINNET,
|
|
1122
1726
|
XVERSE_NETWORK,
|
|
@@ -1133,10 +1737,13 @@ var LaserEyesProvider = ({
|
|
|
1133
1737
|
getLeatherNetwork,
|
|
1134
1738
|
getMempoolSpaceUrl,
|
|
1135
1739
|
getNetworkForLeather,
|
|
1740
|
+
getNetworkForOkx,
|
|
1136
1741
|
getNetworkForUnisat,
|
|
1742
|
+
getNetworkForWizz,
|
|
1137
1743
|
getNetworkForXverse,
|
|
1138
1744
|
getRedeemScript,
|
|
1139
1745
|
getUnisatNetwork,
|
|
1746
|
+
getWizzNetwork,
|
|
1140
1747
|
getXverseNetwork,
|
|
1141
1748
|
isBase64,
|
|
1142
1749
|
isHex,
|