@omnisat/lasereyes 0.0.26 → 0.0.28
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 +6 -4
- package/dist/index.js +1489 -284
- package/dist/index.mjs +1667 -296
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -48,6 +48,8 @@ var __forAwait = (obj, it, method) => {
|
|
|
48
48
|
var XVERSE_NETWORK = "Mainnet";
|
|
49
49
|
var UNISAT_MAINNET = "livenet";
|
|
50
50
|
var UNISAT_TESTNET = "testnet";
|
|
51
|
+
var OP_WALLET_MAINNET = "livenet";
|
|
52
|
+
var OP_WALLET_TESTNET = "testnet";
|
|
51
53
|
var XVERSE_MAINNET = "Mainnet";
|
|
52
54
|
var XVERSE_TESTNET = "Testnet";
|
|
53
55
|
var XVERSE_SIGNET = "Signet";
|
|
@@ -184,14 +186,14 @@ var createConfig = (config) => {
|
|
|
184
186
|
|
|
185
187
|
// src/providers/LaserEyesProvider.tsx
|
|
186
188
|
import {
|
|
187
|
-
createContext,
|
|
188
|
-
useCallback,
|
|
189
|
-
useContext,
|
|
190
|
-
useEffect,
|
|
191
|
-
useRef,
|
|
192
|
-
useState
|
|
189
|
+
createContext as createContext13,
|
|
190
|
+
useCallback as useCallback25,
|
|
191
|
+
useContext as useContext13,
|
|
192
|
+
useEffect as useEffect25,
|
|
193
|
+
useRef as useRef13,
|
|
194
|
+
useState as useState25
|
|
193
195
|
} from "react";
|
|
194
|
-
import * as
|
|
196
|
+
import * as bitcoin15 from "bitcoinjs-lib";
|
|
195
197
|
|
|
196
198
|
// src/consts/settings.ts
|
|
197
199
|
var LOCAL_STORAGE_DEFAULT_WALLET = "defaultWallet";
|
|
@@ -212,253 +214,1621 @@ var initialWalletContext = {
|
|
|
212
214
|
paymentAddress: "",
|
|
213
215
|
paymentPublicKey: "",
|
|
214
216
|
balance: void 0,
|
|
215
|
-
network: MAINNET,
|
|
217
|
+
network: MAINNET,
|
|
218
|
+
library: null,
|
|
219
|
+
provider: null,
|
|
220
|
+
accounts: [],
|
|
221
|
+
connect: (walletName) => __async(void 0, null, function* () {
|
|
222
|
+
}),
|
|
223
|
+
disconnect: () => {
|
|
224
|
+
},
|
|
225
|
+
requestAccounts: () => __async(void 0, null, function* () {
|
|
226
|
+
return [];
|
|
227
|
+
}),
|
|
228
|
+
getNetwork: () => __async(void 0, null, function* () {
|
|
229
|
+
return MAINNET;
|
|
230
|
+
}),
|
|
231
|
+
switchNetwork: (network) => __async(void 0, null, function* () {
|
|
232
|
+
}),
|
|
233
|
+
getPublicKey: () => __async(void 0, null, function* () {
|
|
234
|
+
return "";
|
|
235
|
+
}),
|
|
236
|
+
getBalance: () => __async(void 0, null, function* () {
|
|
237
|
+
return "";
|
|
238
|
+
}),
|
|
239
|
+
getInscriptions: () => __async(void 0, null, function* () {
|
|
240
|
+
return [];
|
|
241
|
+
}),
|
|
242
|
+
sendBTC: (to, amount) => __async(void 0, null, function* () {
|
|
243
|
+
return "";
|
|
244
|
+
}),
|
|
245
|
+
signMessage: (message) => __async(void 0, null, function* () {
|
|
246
|
+
return "";
|
|
247
|
+
}),
|
|
248
|
+
signPsbt: (tx) => __async(void 0, null, function* () {
|
|
249
|
+
return {
|
|
250
|
+
signedPsbtHex: "",
|
|
251
|
+
signedPsbtBase64: "",
|
|
252
|
+
txId: ""
|
|
253
|
+
};
|
|
254
|
+
}),
|
|
255
|
+
pushPsbt: (tx) => __async(void 0, null, function* () {
|
|
256
|
+
return "";
|
|
257
|
+
}),
|
|
258
|
+
inscribe: (content) => __async(void 0, null, function* () {
|
|
259
|
+
return "";
|
|
260
|
+
}),
|
|
261
|
+
isCreatingCommit: false,
|
|
262
|
+
isInscribing: false
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
// src/providers/LaserEyesProvider.tsx
|
|
266
|
+
import { useLocalStorage as useLocalStorage13 } from "usehooks-ts";
|
|
267
|
+
|
|
268
|
+
// src/lib/helpers.ts
|
|
269
|
+
import * as bitcoin from "bitcoinjs-lib";
|
|
270
|
+
import axios from "axios";
|
|
271
|
+
|
|
272
|
+
// src/lib/urls.ts
|
|
273
|
+
var MEMPOOL_SPACE_URL2 = "https://mempool.space";
|
|
274
|
+
var MEMPOOL_SPACE_TESTNET_URL2 = "https://mempool.space/testnet";
|
|
275
|
+
var getMempoolSpaceUrl2 = (network) => network === TESTNET ? MEMPOOL_SPACE_TESTNET_URL2 : MEMPOOL_SPACE_URL2;
|
|
276
|
+
|
|
277
|
+
// src/lib/helpers.ts
|
|
278
|
+
import * as ecc from "@bitcoinerlab/secp256k1";
|
|
279
|
+
bitcoin.initEccLib(ecc);
|
|
280
|
+
var getBitcoinNetwork = (network) => {
|
|
281
|
+
if (network === TESTNET) {
|
|
282
|
+
return bitcoin.networks.testnet;
|
|
283
|
+
} else if (network === SIGNET) {
|
|
284
|
+
return bitcoin.networks.testnet;
|
|
285
|
+
} else if (network === REGTEST) {
|
|
286
|
+
return bitcoin.networks.regtest;
|
|
287
|
+
} else {
|
|
288
|
+
return bitcoin.networks.bitcoin;
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
var findOrdinalsAddress = (addresses) => {
|
|
292
|
+
return addresses.find(
|
|
293
|
+
({ purpose }) => purpose === "ordinals"
|
|
294
|
+
);
|
|
295
|
+
};
|
|
296
|
+
var findPaymentAddress = (addresses) => {
|
|
297
|
+
return addresses.find(
|
|
298
|
+
({ purpose }) => purpose === "payment"
|
|
299
|
+
);
|
|
300
|
+
};
|
|
301
|
+
var getBTCBalance = (address3) => __async(void 0, null, function* () {
|
|
302
|
+
try {
|
|
303
|
+
return yield axios.get(`https://blockchain.info/q/addressbalance/${address3}`).then((response) => response.data);
|
|
304
|
+
} catch (error) {
|
|
305
|
+
console.error("Error fetching BTC balance:", error);
|
|
306
|
+
throw new Error("Failed to fetch BTC balance");
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
var satoshisToBTC = (satoshis) => {
|
|
310
|
+
if (Number.isNaN(satoshis) || satoshis === void 0)
|
|
311
|
+
return "--";
|
|
312
|
+
const btcValue = satoshis / 1e8;
|
|
313
|
+
return btcValue.toFixed(8);
|
|
314
|
+
};
|
|
315
|
+
var isBase64 = (str) => {
|
|
316
|
+
const base64Regex = /^(?:[A-Za-z0-9+\/]{4})*?(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/;
|
|
317
|
+
return base64Regex.test(str);
|
|
318
|
+
};
|
|
319
|
+
var isHex = (str) => {
|
|
320
|
+
const hexRegex = /^[a-fA-F0-9]+$/;
|
|
321
|
+
return hexRegex.test(str);
|
|
322
|
+
};
|
|
323
|
+
function estimateTxSize(taprootInputCount, nonTaprootInputCount, outputCount) {
|
|
324
|
+
const baseTxSize = 10;
|
|
325
|
+
const taprootInputSize = 57;
|
|
326
|
+
const nonTaprootInputSize = 41;
|
|
327
|
+
const outputSize = 34;
|
|
328
|
+
const totalInputSize = taprootInputCount * taprootInputSize + nonTaprootInputCount * nonTaprootInputSize;
|
|
329
|
+
const totalOutputSize = outputCount * outputSize;
|
|
330
|
+
return baseTxSize + totalInputSize + totalOutputSize;
|
|
331
|
+
}
|
|
332
|
+
function createSendBtcPsbt(address3, paymentAddress, recipientAddress, amount, paymentPublicKey, network, feeRate = 7) {
|
|
333
|
+
return __async(this, null, function* () {
|
|
334
|
+
const isTaprootOnly = address3 === paymentAddress;
|
|
335
|
+
const mempoolUrl = `${getMempoolSpaceUrl2(
|
|
336
|
+
network
|
|
337
|
+
)}/api/address/${paymentAddress}/utxo`;
|
|
338
|
+
const utxos = yield axios.get(mempoolUrl).then((response) => response.data);
|
|
339
|
+
const sortedUtxos = utxos.sort(
|
|
340
|
+
(a, b) => b.value - a.value
|
|
341
|
+
);
|
|
342
|
+
const psbt = new bitcoin.Psbt({ network: getBitcoinNetwork(network) });
|
|
343
|
+
const estTxSize = estimateTxSize(1, 0, 2);
|
|
344
|
+
const satsNeeded = Math.floor(estTxSize * feeRate) + amount;
|
|
345
|
+
let amountGathered = 0;
|
|
346
|
+
let counter = 0;
|
|
347
|
+
try {
|
|
348
|
+
for (var iter = __forAwait(sortedUtxos), more, temp, error; more = !(temp = yield iter.next()).done; more = false) {
|
|
349
|
+
let utxo = temp.value;
|
|
350
|
+
const { txid, vout, value } = utxo;
|
|
351
|
+
const script = bitcoin.address.toOutputScript(
|
|
352
|
+
paymentAddress,
|
|
353
|
+
getBitcoinNetwork(network)
|
|
354
|
+
);
|
|
355
|
+
psbt.addInput({
|
|
356
|
+
hash: txid,
|
|
357
|
+
index: vout,
|
|
358
|
+
witnessUtxo: {
|
|
359
|
+
script,
|
|
360
|
+
value
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
if (!isTaprootOnly) {
|
|
364
|
+
const redeemScript = getRedeemScript(paymentPublicKey, network);
|
|
365
|
+
psbt.updateInput(counter, { redeemScript });
|
|
366
|
+
}
|
|
367
|
+
amountGathered += value;
|
|
368
|
+
if (amountGathered >= satsNeeded) {
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
} catch (temp) {
|
|
373
|
+
error = [temp];
|
|
374
|
+
} finally {
|
|
375
|
+
try {
|
|
376
|
+
more && (temp = iter.return) && (yield temp.call(iter));
|
|
377
|
+
} finally {
|
|
378
|
+
if (error)
|
|
379
|
+
throw error[0];
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
if (amountGathered < satsNeeded) {
|
|
383
|
+
throw new Error("Insufficient funds");
|
|
384
|
+
}
|
|
385
|
+
psbt.addOutput({
|
|
386
|
+
address: recipientAddress,
|
|
387
|
+
value: amount
|
|
388
|
+
});
|
|
389
|
+
if (amountGathered > satsNeeded) {
|
|
390
|
+
psbt.addOutput({
|
|
391
|
+
address: paymentAddress,
|
|
392
|
+
value: amountGathered - satsNeeded - amount
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
return {
|
|
396
|
+
psbtBase64: psbt.toBase64(),
|
|
397
|
+
psbtHex: psbt.toHex()
|
|
398
|
+
};
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
function getRedeemScript(paymentPublicKey, network) {
|
|
402
|
+
var _a;
|
|
403
|
+
const p2wpkh = bitcoin.payments.p2wpkh({
|
|
404
|
+
pubkey: Buffer.from(paymentPublicKey, "hex"),
|
|
405
|
+
network: getBitcoinNetwork(network)
|
|
406
|
+
});
|
|
407
|
+
const p2sh = bitcoin.payments.p2sh({
|
|
408
|
+
redeem: p2wpkh,
|
|
409
|
+
network: getBitcoinNetwork(network)
|
|
410
|
+
});
|
|
411
|
+
return (_a = p2sh == null ? void 0 : p2sh.redeem) == null ? void 0 : _a.output;
|
|
412
|
+
}
|
|
413
|
+
function delay(ms) {
|
|
414
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// src/providers/LaserEyesProvider.tsx
|
|
418
|
+
import {
|
|
419
|
+
BitcoinNetworkType as BitcoinNetworkType13,
|
|
420
|
+
getAddress as getAddress13,
|
|
421
|
+
request as request13,
|
|
422
|
+
RpcErrorCode as RpcErrorCode13,
|
|
423
|
+
signMessage as signMessageSatsConnect13,
|
|
424
|
+
signTransaction as signTransaction13
|
|
425
|
+
} from "sats-connect";
|
|
426
|
+
import { fromOutputScript as fromOutputScript13 } from "bitcoinjs-lib/src/address";
|
|
427
|
+
import axios27 from "axios";
|
|
428
|
+
|
|
429
|
+
// dist/index.mjs
|
|
430
|
+
import {
|
|
431
|
+
createContext as createContext12,
|
|
432
|
+
useCallback as useCallback23,
|
|
433
|
+
useContext as useContext12,
|
|
434
|
+
useEffect as useEffect23,
|
|
435
|
+
useRef as useRef12,
|
|
436
|
+
useState as useState23
|
|
437
|
+
} from "react";
|
|
438
|
+
import * as bitcoin14 from "bitcoinjs-lib";
|
|
439
|
+
import { useLocalStorage as useLocalStorage12 } from "usehooks-ts";
|
|
440
|
+
import * as bitcoin2 from "bitcoinjs-lib";
|
|
441
|
+
import axios2 from "axios";
|
|
442
|
+
import * as ecc2 from "@bitcoinerlab/secp256k1";
|
|
443
|
+
import {
|
|
444
|
+
BitcoinNetworkType as BitcoinNetworkType12,
|
|
445
|
+
getAddress as getAddress12,
|
|
446
|
+
request as request12,
|
|
447
|
+
RpcErrorCode as RpcErrorCode12,
|
|
448
|
+
signMessage as signMessageSatsConnect12,
|
|
449
|
+
signTransaction as signTransaction12
|
|
450
|
+
} from "sats-connect";
|
|
451
|
+
import { fromOutputScript as fromOutputScript12 } from "bitcoinjs-lib/src/address";
|
|
452
|
+
import axios25 from "axios";
|
|
453
|
+
import {
|
|
454
|
+
createContext as createContext11,
|
|
455
|
+
useCallback as useCallback21,
|
|
456
|
+
useContext as useContext11,
|
|
457
|
+
useEffect as useEffect21,
|
|
458
|
+
useRef as useRef11,
|
|
459
|
+
useState as useState21
|
|
460
|
+
} from "react";
|
|
461
|
+
import * as bitcoin13 from "bitcoinjs-lib";
|
|
462
|
+
import { useLocalStorage as useLocalStorage11 } from "usehooks-ts";
|
|
463
|
+
import * as bitcoin22 from "bitcoinjs-lib";
|
|
464
|
+
import axios22 from "axios";
|
|
465
|
+
import * as ecc22 from "@bitcoinerlab/secp256k1";
|
|
466
|
+
import {
|
|
467
|
+
BitcoinNetworkType as BitcoinNetworkType11,
|
|
468
|
+
getAddress as getAddress11,
|
|
469
|
+
request as request11,
|
|
470
|
+
RpcErrorCode as RpcErrorCode11,
|
|
471
|
+
signMessage as signMessageSatsConnect11,
|
|
472
|
+
signTransaction as signTransaction11
|
|
473
|
+
} from "sats-connect";
|
|
474
|
+
import { fromOutputScript as fromOutputScript11 } from "bitcoinjs-lib/src/address";
|
|
475
|
+
import axios23 from "axios";
|
|
476
|
+
import {
|
|
477
|
+
createContext as createContext10,
|
|
478
|
+
useCallback as useCallback19,
|
|
479
|
+
useContext as useContext10,
|
|
480
|
+
useEffect as useEffect19,
|
|
481
|
+
useRef as useRef10,
|
|
482
|
+
useState as useState19
|
|
483
|
+
} from "react";
|
|
484
|
+
import * as bitcoin12 from "bitcoinjs-lib";
|
|
485
|
+
import { useLocalStorage as useLocalStorage10 } from "usehooks-ts";
|
|
486
|
+
import * as bitcoin222 from "bitcoinjs-lib";
|
|
487
|
+
import axios222 from "axios";
|
|
488
|
+
import * as ecc222 from "@bitcoinerlab/secp256k1";
|
|
489
|
+
import {
|
|
490
|
+
BitcoinNetworkType as BitcoinNetworkType10,
|
|
491
|
+
getAddress as getAddress10,
|
|
492
|
+
request as request10,
|
|
493
|
+
RpcErrorCode as RpcErrorCode10,
|
|
494
|
+
signMessage as signMessageSatsConnect10,
|
|
495
|
+
signTransaction as signTransaction10
|
|
496
|
+
} from "sats-connect";
|
|
497
|
+
import { fromOutputScript as fromOutputScript10 } from "bitcoinjs-lib/src/address";
|
|
498
|
+
import axios20 from "axios";
|
|
499
|
+
import {
|
|
500
|
+
createContext as createContext9,
|
|
501
|
+
useCallback as useCallback17,
|
|
502
|
+
useContext as useContext9,
|
|
503
|
+
useEffect as useEffect17,
|
|
504
|
+
useRef as useRef9,
|
|
505
|
+
useState as useState17
|
|
506
|
+
} from "react";
|
|
507
|
+
import * as bitcoin11 from "bitcoinjs-lib";
|
|
508
|
+
import { useLocalStorage as useLocalStorage9 } from "usehooks-ts";
|
|
509
|
+
import * as bitcoin2222 from "bitcoinjs-lib";
|
|
510
|
+
import axios2222 from "axios";
|
|
511
|
+
import * as ecc2222 from "@bitcoinerlab/secp256k1";
|
|
512
|
+
import {
|
|
513
|
+
BitcoinNetworkType as BitcoinNetworkType9,
|
|
514
|
+
getAddress as getAddress9,
|
|
515
|
+
request as request9,
|
|
516
|
+
RpcErrorCode as RpcErrorCode9,
|
|
517
|
+
signMessage as signMessageSatsConnect9,
|
|
518
|
+
signTransaction as signTransaction9
|
|
519
|
+
} from "sats-connect";
|
|
520
|
+
import { fromOutputScript as fromOutputScript9 } from "bitcoinjs-lib/src/address";
|
|
521
|
+
import axios18 from "axios";
|
|
522
|
+
import {
|
|
523
|
+
createContext as createContext8,
|
|
524
|
+
useCallback as useCallback15,
|
|
525
|
+
useContext as useContext8,
|
|
526
|
+
useEffect as useEffect15,
|
|
527
|
+
useRef as useRef8,
|
|
528
|
+
useState as useState15
|
|
529
|
+
} from "react";
|
|
530
|
+
import * as bitcoin10 from "bitcoinjs-lib";
|
|
531
|
+
import { useLocalStorage as useLocalStorage8 } from "usehooks-ts";
|
|
532
|
+
import * as bitcoin22222 from "bitcoinjs-lib";
|
|
533
|
+
import axios22222 from "axios";
|
|
534
|
+
import * as ecc22222 from "@bitcoinerlab/secp256k1";
|
|
535
|
+
import {
|
|
536
|
+
BitcoinNetworkType as BitcoinNetworkType8,
|
|
537
|
+
getAddress as getAddress8,
|
|
538
|
+
request as request8,
|
|
539
|
+
RpcErrorCode as RpcErrorCode8,
|
|
540
|
+
signMessage as signMessageSatsConnect8,
|
|
541
|
+
signTransaction as signTransaction8
|
|
542
|
+
} from "sats-connect";
|
|
543
|
+
import { fromOutputScript as fromOutputScript8 } from "bitcoinjs-lib/src/address";
|
|
544
|
+
import axios16 from "axios";
|
|
545
|
+
import {
|
|
546
|
+
createContext as createContext7,
|
|
547
|
+
useCallback as useCallback13,
|
|
548
|
+
useContext as useContext7,
|
|
549
|
+
useEffect as useEffect13,
|
|
550
|
+
useRef as useRef7,
|
|
551
|
+
useState as useState13
|
|
552
|
+
} from "react";
|
|
553
|
+
import * as bitcoin9 from "bitcoinjs-lib";
|
|
554
|
+
import { useLocalStorage as useLocalStorage7 } from "usehooks-ts";
|
|
555
|
+
import * as bitcoin222222 from "bitcoinjs-lib";
|
|
556
|
+
import axios222222 from "axios";
|
|
557
|
+
import * as ecc222222 from "@bitcoinerlab/secp256k1";
|
|
558
|
+
import {
|
|
559
|
+
BitcoinNetworkType as BitcoinNetworkType7,
|
|
560
|
+
getAddress as getAddress7,
|
|
561
|
+
request as request7,
|
|
562
|
+
RpcErrorCode as RpcErrorCode7,
|
|
563
|
+
signMessage as signMessageSatsConnect7,
|
|
564
|
+
signTransaction as signTransaction7
|
|
565
|
+
} from "sats-connect";
|
|
566
|
+
import { fromOutputScript as fromOutputScript7 } from "bitcoinjs-lib/src/address";
|
|
567
|
+
import axios14 from "axios";
|
|
568
|
+
import {
|
|
569
|
+
createContext as createContext6,
|
|
570
|
+
useCallback as useCallback11,
|
|
571
|
+
useContext as useContext6,
|
|
572
|
+
useEffect as useEffect11,
|
|
573
|
+
useRef as useRef6,
|
|
574
|
+
useState as useState11
|
|
575
|
+
} from "react";
|
|
576
|
+
import * as bitcoin8 from "bitcoinjs-lib";
|
|
577
|
+
import { useLocalStorage as useLocalStorage6 } from "usehooks-ts";
|
|
578
|
+
import * as bitcoin2222222 from "bitcoinjs-lib";
|
|
579
|
+
import axios2222222 from "axios";
|
|
580
|
+
import * as ecc2222222 from "@bitcoinerlab/secp256k1";
|
|
581
|
+
import {
|
|
582
|
+
BitcoinNetworkType as BitcoinNetworkType6,
|
|
583
|
+
getAddress as getAddress6,
|
|
584
|
+
request as request6,
|
|
585
|
+
RpcErrorCode as RpcErrorCode6,
|
|
586
|
+
signMessage as signMessageSatsConnect6,
|
|
587
|
+
signTransaction as signTransaction6
|
|
588
|
+
} from "sats-connect";
|
|
589
|
+
import { fromOutputScript as fromOutputScript6 } from "bitcoinjs-lib/src/address";
|
|
590
|
+
import axios12 from "axios";
|
|
591
|
+
import {
|
|
592
|
+
createContext as createContext5,
|
|
593
|
+
useCallback as useCallback9,
|
|
594
|
+
useContext as useContext5,
|
|
595
|
+
useEffect as useEffect9,
|
|
596
|
+
useRef as useRef5,
|
|
597
|
+
useState as useState9
|
|
598
|
+
} from "react";
|
|
599
|
+
import * as bitcoin7 from "bitcoinjs-lib";
|
|
600
|
+
import { useLocalStorage as useLocalStorage5 } from "usehooks-ts";
|
|
601
|
+
import * as bitcoin22222222 from "bitcoinjs-lib";
|
|
602
|
+
import axios22222222 from "axios";
|
|
603
|
+
import * as ecc22222222 from "@bitcoinerlab/secp256k1";
|
|
604
|
+
import {
|
|
605
|
+
BitcoinNetworkType as BitcoinNetworkType5,
|
|
606
|
+
getAddress as getAddress5,
|
|
607
|
+
request as request5,
|
|
608
|
+
RpcErrorCode as RpcErrorCode5,
|
|
609
|
+
signMessage as signMessageSatsConnect5,
|
|
610
|
+
signTransaction as signTransaction5
|
|
611
|
+
} from "sats-connect";
|
|
612
|
+
import { fromOutputScript as fromOutputScript5 } from "bitcoinjs-lib/src/address";
|
|
613
|
+
import axios10 from "axios";
|
|
614
|
+
import {
|
|
615
|
+
createContext as createContext4,
|
|
616
|
+
useCallback as useCallback7,
|
|
617
|
+
useContext as useContext4,
|
|
618
|
+
useEffect as useEffect7,
|
|
619
|
+
useRef as useRef4,
|
|
620
|
+
useState as useState7
|
|
621
|
+
} from "react";
|
|
622
|
+
import * as bitcoin6 from "bitcoinjs-lib";
|
|
623
|
+
import { useLocalStorage as useLocalStorage4 } from "usehooks-ts";
|
|
624
|
+
import * as bitcoin222222222 from "bitcoinjs-lib";
|
|
625
|
+
import axios222222222 from "axios";
|
|
626
|
+
import * as ecc222222222 from "@bitcoinerlab/secp256k1";
|
|
627
|
+
import {
|
|
628
|
+
BitcoinNetworkType as BitcoinNetworkType4,
|
|
629
|
+
getAddress as getAddress4,
|
|
630
|
+
request as request4,
|
|
631
|
+
RpcErrorCode as RpcErrorCode4,
|
|
632
|
+
signMessage as signMessageSatsConnect4,
|
|
633
|
+
signTransaction as signTransaction4
|
|
634
|
+
} from "sats-connect";
|
|
635
|
+
import { fromOutputScript as fromOutputScript4 } from "bitcoinjs-lib/src/address";
|
|
636
|
+
import axios8 from "axios";
|
|
637
|
+
import {
|
|
638
|
+
createContext as createContext3,
|
|
639
|
+
useCallback as useCallback5,
|
|
640
|
+
useContext as useContext3,
|
|
641
|
+
useEffect as useEffect5,
|
|
642
|
+
useRef as useRef3,
|
|
643
|
+
useState as useState5
|
|
644
|
+
} from "react";
|
|
645
|
+
import * as bitcoin5 from "bitcoinjs-lib";
|
|
646
|
+
import { useLocalStorage as useLocalStorage3 } from "usehooks-ts";
|
|
647
|
+
import * as bitcoin2222222222 from "bitcoinjs-lib";
|
|
648
|
+
import axios2222222222 from "axios";
|
|
649
|
+
import * as ecc2222222222 from "@bitcoinerlab/secp256k1";
|
|
650
|
+
import {
|
|
651
|
+
BitcoinNetworkType as BitcoinNetworkType3,
|
|
652
|
+
getAddress as getAddress3,
|
|
653
|
+
request as request3,
|
|
654
|
+
RpcErrorCode as RpcErrorCode3,
|
|
655
|
+
signMessage as signMessageSatsConnect3,
|
|
656
|
+
signTransaction as signTransaction3
|
|
657
|
+
} from "sats-connect";
|
|
658
|
+
import { fromOutputScript as fromOutputScript3 } from "bitcoinjs-lib/src/address";
|
|
659
|
+
import axios6 from "axios";
|
|
660
|
+
import {
|
|
661
|
+
createContext as createContext2,
|
|
662
|
+
useCallback as useCallback3,
|
|
663
|
+
useContext as useContext2,
|
|
664
|
+
useEffect as useEffect3,
|
|
665
|
+
useRef as useRef2,
|
|
666
|
+
useState as useState3
|
|
667
|
+
} from "react";
|
|
668
|
+
import * as bitcoin4 from "bitcoinjs-lib";
|
|
669
|
+
import { useLocalStorage as useLocalStorage2 } from "usehooks-ts";
|
|
670
|
+
import * as bitcoin22222222222 from "bitcoinjs-lib";
|
|
671
|
+
import axios22222222222 from "axios";
|
|
672
|
+
import * as ecc22222222222 from "@bitcoinerlab/secp256k1";
|
|
673
|
+
import {
|
|
674
|
+
BitcoinNetworkType as BitcoinNetworkType2,
|
|
675
|
+
getAddress as getAddress2,
|
|
676
|
+
request as request2,
|
|
677
|
+
RpcErrorCode as RpcErrorCode2,
|
|
678
|
+
signMessage as signMessageSatsConnect2,
|
|
679
|
+
signTransaction as signTransaction2
|
|
680
|
+
} from "sats-connect";
|
|
681
|
+
import { fromOutputScript as fromOutputScript2 } from "bitcoinjs-lib/src/address";
|
|
682
|
+
import axios4 from "axios";
|
|
683
|
+
import {
|
|
684
|
+
createContext,
|
|
685
|
+
useCallback,
|
|
686
|
+
useContext,
|
|
687
|
+
useEffect,
|
|
688
|
+
useRef,
|
|
689
|
+
useState
|
|
690
|
+
} from "react";
|
|
691
|
+
import * as bitcoin222222222222 from "bitcoinjs-lib";
|
|
692
|
+
import { useLocalStorage } from "usehooks-ts";
|
|
693
|
+
import * as bitcoin3 from "bitcoinjs-lib";
|
|
694
|
+
import axios222222222222 from "axios";
|
|
695
|
+
import * as ecc222222222222 from "@bitcoinerlab/secp256k1";
|
|
696
|
+
import {
|
|
697
|
+
BitcoinNetworkType,
|
|
698
|
+
getAddress,
|
|
699
|
+
request,
|
|
700
|
+
RpcErrorCode,
|
|
701
|
+
signMessage as signMessageSatsConnect,
|
|
702
|
+
signTransaction
|
|
703
|
+
} from "sats-connect";
|
|
704
|
+
import { fromOutputScript } from "bitcoinjs-lib/src/address";
|
|
705
|
+
import axios2222222222222 from "axios";
|
|
706
|
+
import { jsx } from "react/jsx-runtime";
|
|
707
|
+
import { useCallback as useCallback2, useEffect as useEffect2, useState as useState2 } from "react";
|
|
708
|
+
import axios3 from "axios";
|
|
709
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
710
|
+
import { useCallback as useCallback4, useEffect as useEffect4, useState as useState4 } from "react";
|
|
711
|
+
import axios5 from "axios";
|
|
712
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
713
|
+
import { useCallback as useCallback6, useEffect as useEffect6, useState as useState6 } from "react";
|
|
714
|
+
import axios7 from "axios";
|
|
715
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
716
|
+
import { useCallback as useCallback8, useEffect as useEffect8, useState as useState8 } from "react";
|
|
717
|
+
import axios9 from "axios";
|
|
718
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
719
|
+
import { useCallback as useCallback10, useEffect as useEffect10, useState as useState10 } from "react";
|
|
720
|
+
import axios11 from "axios";
|
|
721
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
722
|
+
import { useCallback as useCallback12, useEffect as useEffect12, useState as useState12 } from "react";
|
|
723
|
+
import axios13 from "axios";
|
|
724
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
725
|
+
import { useCallback as useCallback14, useEffect as useEffect14, useState as useState14 } from "react";
|
|
726
|
+
import axios15 from "axios";
|
|
727
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
728
|
+
import { useCallback as useCallback16, useEffect as useEffect16, useState as useState16 } from "react";
|
|
729
|
+
import axios17 from "axios";
|
|
730
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
731
|
+
import { useCallback as useCallback18, useEffect as useEffect18, useState as useState18 } from "react";
|
|
732
|
+
import axios19 from "axios";
|
|
733
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
734
|
+
import { useCallback as useCallback20, useEffect as useEffect20, useState as useState20 } from "react";
|
|
735
|
+
import axios21 from "axios";
|
|
736
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
737
|
+
import { useCallback as useCallback22, useEffect as useEffect22, useState as useState22 } from "react";
|
|
738
|
+
import axios24 from "axios";
|
|
739
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
740
|
+
import { useCallback as useCallback24, useEffect as useEffect24, useState as useState24 } from "react";
|
|
741
|
+
import axios26 from "axios";
|
|
742
|
+
var __async2 = (__this, __arguments, generator) => {
|
|
743
|
+
return new Promise((resolve, reject) => {
|
|
744
|
+
var fulfilled = (value) => {
|
|
745
|
+
try {
|
|
746
|
+
step(generator.next(value));
|
|
747
|
+
} catch (e) {
|
|
748
|
+
reject(e);
|
|
749
|
+
}
|
|
750
|
+
};
|
|
751
|
+
var rejected = (value) => {
|
|
752
|
+
try {
|
|
753
|
+
step(generator.throw(value));
|
|
754
|
+
} catch (e) {
|
|
755
|
+
reject(e);
|
|
756
|
+
}
|
|
757
|
+
};
|
|
758
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
759
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
760
|
+
});
|
|
761
|
+
};
|
|
762
|
+
var MAINNET4 = "mainnet";
|
|
763
|
+
var SIGNET3 = "signet";
|
|
764
|
+
var TESTNET3 = "testnet";
|
|
765
|
+
var initialWalletContext2 = {
|
|
766
|
+
hasUnisat: false,
|
|
767
|
+
hasXverse: false,
|
|
768
|
+
hasOyl: false,
|
|
769
|
+
hasMagicEden: false,
|
|
770
|
+
hasOkx: false,
|
|
771
|
+
hasLeather: false,
|
|
772
|
+
hasPhantom: false,
|
|
773
|
+
hasWizz: false,
|
|
774
|
+
isInitializing: true,
|
|
775
|
+
connected: false,
|
|
776
|
+
isConnecting: false,
|
|
777
|
+
publicKey: "",
|
|
778
|
+
address: "",
|
|
779
|
+
paymentAddress: "",
|
|
780
|
+
paymentPublicKey: "",
|
|
781
|
+
balance: void 0,
|
|
782
|
+
network: MAINNET4,
|
|
783
|
+
library: null,
|
|
784
|
+
provider: null,
|
|
785
|
+
accounts: [],
|
|
786
|
+
connect: (walletName) => __async2(void 0, null, function* () {
|
|
787
|
+
}),
|
|
788
|
+
disconnect: () => {
|
|
789
|
+
},
|
|
790
|
+
requestAccounts: () => __async2(void 0, null, function* () {
|
|
791
|
+
return [];
|
|
792
|
+
}),
|
|
793
|
+
getNetwork: () => __async2(void 0, null, function* () {
|
|
794
|
+
return MAINNET4;
|
|
795
|
+
}),
|
|
796
|
+
switchNetwork: (network) => __async2(void 0, null, function* () {
|
|
797
|
+
}),
|
|
798
|
+
getPublicKey: () => __async2(void 0, null, function* () {
|
|
799
|
+
return "";
|
|
800
|
+
}),
|
|
801
|
+
getBalance: () => __async2(void 0, null, function* () {
|
|
802
|
+
return "";
|
|
803
|
+
}),
|
|
804
|
+
getInscriptions: () => __async2(void 0, null, function* () {
|
|
805
|
+
return [];
|
|
806
|
+
}),
|
|
807
|
+
sendBTC: (to, amount) => __async2(void 0, null, function* () {
|
|
808
|
+
return "";
|
|
809
|
+
}),
|
|
810
|
+
signMessage: (message) => __async2(void 0, null, function* () {
|
|
811
|
+
return "";
|
|
812
|
+
}),
|
|
813
|
+
signPsbt: (tx) => __async2(void 0, null, function* () {
|
|
814
|
+
return {
|
|
815
|
+
signedPsbtHex: "",
|
|
816
|
+
signedPsbtBase64: "",
|
|
817
|
+
txId: ""
|
|
818
|
+
};
|
|
819
|
+
}),
|
|
820
|
+
pushPsbt: (tx) => __async2(void 0, null, function* () {
|
|
821
|
+
return "";
|
|
822
|
+
}),
|
|
823
|
+
inscribe: (content) => __async2(void 0, null, function* () {
|
|
824
|
+
return "";
|
|
825
|
+
}),
|
|
826
|
+
isCreatingCommit: false,
|
|
827
|
+
isInscribing: false
|
|
828
|
+
};
|
|
829
|
+
bitcoin2.initEccLib(ecc2);
|
|
830
|
+
var __async22 = (__this, __arguments, generator) => {
|
|
831
|
+
return new Promise((resolve, reject) => {
|
|
832
|
+
var fulfilled = (value) => {
|
|
833
|
+
try {
|
|
834
|
+
step(generator.next(value));
|
|
835
|
+
} catch (e) {
|
|
836
|
+
reject(e);
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
var rejected = (value) => {
|
|
840
|
+
try {
|
|
841
|
+
step(generator.throw(value));
|
|
842
|
+
} catch (e) {
|
|
843
|
+
reject(e);
|
|
844
|
+
}
|
|
845
|
+
};
|
|
846
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
847
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
848
|
+
});
|
|
849
|
+
};
|
|
850
|
+
var MAINNET42 = "mainnet";
|
|
851
|
+
var initialWalletContext22 = {
|
|
852
|
+
hasUnisat: false,
|
|
853
|
+
hasXverse: false,
|
|
854
|
+
hasOyl: false,
|
|
855
|
+
hasMagicEden: false,
|
|
856
|
+
hasOkx: false,
|
|
857
|
+
hasLeather: false,
|
|
858
|
+
hasPhantom: false,
|
|
859
|
+
hasWizz: false,
|
|
860
|
+
isInitializing: true,
|
|
861
|
+
connected: false,
|
|
862
|
+
isConnecting: false,
|
|
863
|
+
publicKey: "",
|
|
864
|
+
address: "",
|
|
865
|
+
paymentAddress: "",
|
|
866
|
+
paymentPublicKey: "",
|
|
867
|
+
balance: void 0,
|
|
868
|
+
network: MAINNET42,
|
|
869
|
+
library: null,
|
|
870
|
+
provider: null,
|
|
871
|
+
accounts: [],
|
|
872
|
+
connect: (walletName) => __async22(void 0, null, function* () {
|
|
873
|
+
}),
|
|
874
|
+
disconnect: () => {
|
|
875
|
+
},
|
|
876
|
+
requestAccounts: () => __async22(void 0, null, function* () {
|
|
877
|
+
return [];
|
|
878
|
+
}),
|
|
879
|
+
getNetwork: () => __async22(void 0, null, function* () {
|
|
880
|
+
return MAINNET42;
|
|
881
|
+
}),
|
|
882
|
+
switchNetwork: (network) => __async22(void 0, null, function* () {
|
|
883
|
+
}),
|
|
884
|
+
getPublicKey: () => __async22(void 0, null, function* () {
|
|
885
|
+
return "";
|
|
886
|
+
}),
|
|
887
|
+
getBalance: () => __async22(void 0, null, function* () {
|
|
888
|
+
return "";
|
|
889
|
+
}),
|
|
890
|
+
getInscriptions: () => __async22(void 0, null, function* () {
|
|
891
|
+
return [];
|
|
892
|
+
}),
|
|
893
|
+
sendBTC: (to, amount) => __async22(void 0, null, function* () {
|
|
894
|
+
return "";
|
|
895
|
+
}),
|
|
896
|
+
signMessage: (message) => __async22(void 0, null, function* () {
|
|
897
|
+
return "";
|
|
898
|
+
}),
|
|
899
|
+
signPsbt: (tx) => __async22(void 0, null, function* () {
|
|
900
|
+
return {
|
|
901
|
+
signedPsbtHex: "",
|
|
902
|
+
signedPsbtBase64: "",
|
|
903
|
+
txId: ""
|
|
904
|
+
};
|
|
905
|
+
}),
|
|
906
|
+
pushPsbt: (tx) => __async22(void 0, null, function* () {
|
|
907
|
+
return "";
|
|
908
|
+
}),
|
|
909
|
+
inscribe: (content) => __async22(void 0, null, function* () {
|
|
910
|
+
return "";
|
|
911
|
+
}),
|
|
912
|
+
isCreatingCommit: false,
|
|
913
|
+
isInscribing: false
|
|
914
|
+
};
|
|
915
|
+
bitcoin22.initEccLib(ecc22);
|
|
916
|
+
var __async222 = (__this, __arguments, generator) => {
|
|
917
|
+
return new Promise((resolve, reject) => {
|
|
918
|
+
var fulfilled = (value) => {
|
|
919
|
+
try {
|
|
920
|
+
step(generator.next(value));
|
|
921
|
+
} catch (e) {
|
|
922
|
+
reject(e);
|
|
923
|
+
}
|
|
924
|
+
};
|
|
925
|
+
var rejected = (value) => {
|
|
926
|
+
try {
|
|
927
|
+
step(generator.throw(value));
|
|
928
|
+
} catch (e) {
|
|
929
|
+
reject(e);
|
|
930
|
+
}
|
|
931
|
+
};
|
|
932
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
933
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
934
|
+
});
|
|
935
|
+
};
|
|
936
|
+
var MAINNET422 = "mainnet";
|
|
937
|
+
var initialWalletContext222 = {
|
|
938
|
+
hasUnisat: false,
|
|
939
|
+
hasXverse: false,
|
|
940
|
+
hasOyl: false,
|
|
941
|
+
hasMagicEden: false,
|
|
942
|
+
hasOkx: false,
|
|
943
|
+
hasLeather: false,
|
|
944
|
+
hasPhantom: false,
|
|
945
|
+
hasWizz: false,
|
|
946
|
+
isInitializing: true,
|
|
947
|
+
connected: false,
|
|
948
|
+
isConnecting: false,
|
|
949
|
+
publicKey: "",
|
|
950
|
+
address: "",
|
|
951
|
+
paymentAddress: "",
|
|
952
|
+
paymentPublicKey: "",
|
|
953
|
+
balance: void 0,
|
|
954
|
+
network: MAINNET422,
|
|
955
|
+
library: null,
|
|
956
|
+
provider: null,
|
|
957
|
+
accounts: [],
|
|
958
|
+
connect: (walletName) => __async222(void 0, null, function* () {
|
|
959
|
+
}),
|
|
960
|
+
disconnect: () => {
|
|
961
|
+
},
|
|
962
|
+
requestAccounts: () => __async222(void 0, null, function* () {
|
|
963
|
+
return [];
|
|
964
|
+
}),
|
|
965
|
+
getNetwork: () => __async222(void 0, null, function* () {
|
|
966
|
+
return MAINNET422;
|
|
967
|
+
}),
|
|
968
|
+
switchNetwork: (network) => __async222(void 0, null, function* () {
|
|
969
|
+
}),
|
|
970
|
+
getPublicKey: () => __async222(void 0, null, function* () {
|
|
971
|
+
return "";
|
|
972
|
+
}),
|
|
973
|
+
getBalance: () => __async222(void 0, null, function* () {
|
|
974
|
+
return "";
|
|
975
|
+
}),
|
|
976
|
+
getInscriptions: () => __async222(void 0, null, function* () {
|
|
977
|
+
return [];
|
|
978
|
+
}),
|
|
979
|
+
sendBTC: (to, amount) => __async222(void 0, null, function* () {
|
|
980
|
+
return "";
|
|
981
|
+
}),
|
|
982
|
+
signMessage: (message) => __async222(void 0, null, function* () {
|
|
983
|
+
return "";
|
|
984
|
+
}),
|
|
985
|
+
signPsbt: (tx) => __async222(void 0, null, function* () {
|
|
986
|
+
return {
|
|
987
|
+
signedPsbtHex: "",
|
|
988
|
+
signedPsbtBase64: "",
|
|
989
|
+
txId: ""
|
|
990
|
+
};
|
|
991
|
+
}),
|
|
992
|
+
pushPsbt: (tx) => __async222(void 0, null, function* () {
|
|
993
|
+
return "";
|
|
994
|
+
}),
|
|
995
|
+
inscribe: (content) => __async222(void 0, null, function* () {
|
|
996
|
+
return "";
|
|
997
|
+
}),
|
|
998
|
+
isCreatingCommit: false,
|
|
999
|
+
isInscribing: false
|
|
1000
|
+
};
|
|
1001
|
+
bitcoin222.initEccLib(ecc222);
|
|
1002
|
+
var __async2222 = (__this, __arguments, generator) => {
|
|
1003
|
+
return new Promise((resolve, reject) => {
|
|
1004
|
+
var fulfilled = (value) => {
|
|
1005
|
+
try {
|
|
1006
|
+
step(generator.next(value));
|
|
1007
|
+
} catch (e) {
|
|
1008
|
+
reject(e);
|
|
1009
|
+
}
|
|
1010
|
+
};
|
|
1011
|
+
var rejected = (value) => {
|
|
1012
|
+
try {
|
|
1013
|
+
step(generator.throw(value));
|
|
1014
|
+
} catch (e) {
|
|
1015
|
+
reject(e);
|
|
1016
|
+
}
|
|
1017
|
+
};
|
|
1018
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1019
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
1020
|
+
});
|
|
1021
|
+
};
|
|
1022
|
+
var MAINNET4222 = "mainnet";
|
|
1023
|
+
var initialWalletContext2222 = {
|
|
1024
|
+
hasUnisat: false,
|
|
1025
|
+
hasXverse: false,
|
|
1026
|
+
hasOyl: false,
|
|
1027
|
+
hasMagicEden: false,
|
|
1028
|
+
hasOkx: false,
|
|
1029
|
+
hasLeather: false,
|
|
1030
|
+
hasPhantom: false,
|
|
1031
|
+
hasWizz: false,
|
|
1032
|
+
isInitializing: true,
|
|
1033
|
+
connected: false,
|
|
1034
|
+
isConnecting: false,
|
|
1035
|
+
publicKey: "",
|
|
1036
|
+
address: "",
|
|
1037
|
+
paymentAddress: "",
|
|
1038
|
+
paymentPublicKey: "",
|
|
1039
|
+
balance: void 0,
|
|
1040
|
+
network: MAINNET4222,
|
|
1041
|
+
library: null,
|
|
1042
|
+
provider: null,
|
|
1043
|
+
accounts: [],
|
|
1044
|
+
connect: (walletName) => __async2222(void 0, null, function* () {
|
|
1045
|
+
}),
|
|
1046
|
+
disconnect: () => {
|
|
1047
|
+
},
|
|
1048
|
+
requestAccounts: () => __async2222(void 0, null, function* () {
|
|
1049
|
+
return [];
|
|
1050
|
+
}),
|
|
1051
|
+
getNetwork: () => __async2222(void 0, null, function* () {
|
|
1052
|
+
return MAINNET4222;
|
|
1053
|
+
}),
|
|
1054
|
+
switchNetwork: (network) => __async2222(void 0, null, function* () {
|
|
1055
|
+
}),
|
|
1056
|
+
getPublicKey: () => __async2222(void 0, null, function* () {
|
|
1057
|
+
return "";
|
|
1058
|
+
}),
|
|
1059
|
+
getBalance: () => __async2222(void 0, null, function* () {
|
|
1060
|
+
return "";
|
|
1061
|
+
}),
|
|
1062
|
+
getInscriptions: () => __async2222(void 0, null, function* () {
|
|
1063
|
+
return [];
|
|
1064
|
+
}),
|
|
1065
|
+
sendBTC: (to, amount) => __async2222(void 0, null, function* () {
|
|
1066
|
+
return "";
|
|
1067
|
+
}),
|
|
1068
|
+
signMessage: (message) => __async2222(void 0, null, function* () {
|
|
1069
|
+
return "";
|
|
1070
|
+
}),
|
|
1071
|
+
signPsbt: (tx) => __async2222(void 0, null, function* () {
|
|
1072
|
+
return {
|
|
1073
|
+
signedPsbtHex: "",
|
|
1074
|
+
signedPsbtBase64: "",
|
|
1075
|
+
txId: ""
|
|
1076
|
+
};
|
|
1077
|
+
}),
|
|
1078
|
+
pushPsbt: (tx) => __async2222(void 0, null, function* () {
|
|
1079
|
+
return "";
|
|
1080
|
+
}),
|
|
1081
|
+
inscribe: (content) => __async2222(void 0, null, function* () {
|
|
1082
|
+
return "";
|
|
1083
|
+
}),
|
|
1084
|
+
isCreatingCommit: false,
|
|
1085
|
+
isInscribing: false
|
|
1086
|
+
};
|
|
1087
|
+
bitcoin2222.initEccLib(ecc2222);
|
|
1088
|
+
var __async22222 = (__this, __arguments, generator) => {
|
|
1089
|
+
return new Promise((resolve, reject) => {
|
|
1090
|
+
var fulfilled = (value) => {
|
|
1091
|
+
try {
|
|
1092
|
+
step(generator.next(value));
|
|
1093
|
+
} catch (e) {
|
|
1094
|
+
reject(e);
|
|
1095
|
+
}
|
|
1096
|
+
};
|
|
1097
|
+
var rejected = (value) => {
|
|
1098
|
+
try {
|
|
1099
|
+
step(generator.throw(value));
|
|
1100
|
+
} catch (e) {
|
|
1101
|
+
reject(e);
|
|
1102
|
+
}
|
|
1103
|
+
};
|
|
1104
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1105
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
1106
|
+
});
|
|
1107
|
+
};
|
|
1108
|
+
var MAINNET42222 = "mainnet";
|
|
1109
|
+
var initialWalletContext22222 = {
|
|
1110
|
+
hasUnisat: false,
|
|
1111
|
+
hasXverse: false,
|
|
1112
|
+
hasOyl: false,
|
|
1113
|
+
hasMagicEden: false,
|
|
1114
|
+
hasOkx: false,
|
|
1115
|
+
hasLeather: false,
|
|
1116
|
+
hasPhantom: false,
|
|
1117
|
+
hasWizz: false,
|
|
1118
|
+
isInitializing: true,
|
|
1119
|
+
connected: false,
|
|
1120
|
+
isConnecting: false,
|
|
1121
|
+
publicKey: "",
|
|
1122
|
+
address: "",
|
|
1123
|
+
paymentAddress: "",
|
|
1124
|
+
paymentPublicKey: "",
|
|
1125
|
+
balance: void 0,
|
|
1126
|
+
network: MAINNET42222,
|
|
1127
|
+
library: null,
|
|
1128
|
+
provider: null,
|
|
1129
|
+
accounts: [],
|
|
1130
|
+
connect: (walletName) => __async22222(void 0, null, function* () {
|
|
1131
|
+
}),
|
|
1132
|
+
disconnect: () => {
|
|
1133
|
+
},
|
|
1134
|
+
requestAccounts: () => __async22222(void 0, null, function* () {
|
|
1135
|
+
return [];
|
|
1136
|
+
}),
|
|
1137
|
+
getNetwork: () => __async22222(void 0, null, function* () {
|
|
1138
|
+
return MAINNET42222;
|
|
1139
|
+
}),
|
|
1140
|
+
switchNetwork: (network) => __async22222(void 0, null, function* () {
|
|
1141
|
+
}),
|
|
1142
|
+
getPublicKey: () => __async22222(void 0, null, function* () {
|
|
1143
|
+
return "";
|
|
1144
|
+
}),
|
|
1145
|
+
getBalance: () => __async22222(void 0, null, function* () {
|
|
1146
|
+
return "";
|
|
1147
|
+
}),
|
|
1148
|
+
getInscriptions: () => __async22222(void 0, null, function* () {
|
|
1149
|
+
return [];
|
|
1150
|
+
}),
|
|
1151
|
+
sendBTC: (to, amount) => __async22222(void 0, null, function* () {
|
|
1152
|
+
return "";
|
|
1153
|
+
}),
|
|
1154
|
+
signMessage: (message) => __async22222(void 0, null, function* () {
|
|
1155
|
+
return "";
|
|
1156
|
+
}),
|
|
1157
|
+
signPsbt: (tx) => __async22222(void 0, null, function* () {
|
|
1158
|
+
return {
|
|
1159
|
+
signedPsbtHex: "",
|
|
1160
|
+
signedPsbtBase64: "",
|
|
1161
|
+
txId: ""
|
|
1162
|
+
};
|
|
1163
|
+
}),
|
|
1164
|
+
pushPsbt: (tx) => __async22222(void 0, null, function* () {
|
|
1165
|
+
return "";
|
|
1166
|
+
}),
|
|
1167
|
+
inscribe: (content) => __async22222(void 0, null, function* () {
|
|
1168
|
+
return "";
|
|
1169
|
+
}),
|
|
1170
|
+
isCreatingCommit: false,
|
|
1171
|
+
isInscribing: false
|
|
1172
|
+
};
|
|
1173
|
+
bitcoin22222.initEccLib(ecc22222);
|
|
1174
|
+
var __async222222 = (__this, __arguments, generator) => {
|
|
1175
|
+
return new Promise((resolve, reject) => {
|
|
1176
|
+
var fulfilled = (value) => {
|
|
1177
|
+
try {
|
|
1178
|
+
step(generator.next(value));
|
|
1179
|
+
} catch (e) {
|
|
1180
|
+
reject(e);
|
|
1181
|
+
}
|
|
1182
|
+
};
|
|
1183
|
+
var rejected = (value) => {
|
|
1184
|
+
try {
|
|
1185
|
+
step(generator.throw(value));
|
|
1186
|
+
} catch (e) {
|
|
1187
|
+
reject(e);
|
|
1188
|
+
}
|
|
1189
|
+
};
|
|
1190
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1191
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
1192
|
+
});
|
|
1193
|
+
};
|
|
1194
|
+
var MAINNET422222 = "mainnet";
|
|
1195
|
+
var initialWalletContext222222 = {
|
|
1196
|
+
hasUnisat: false,
|
|
1197
|
+
hasXverse: false,
|
|
1198
|
+
hasOyl: false,
|
|
1199
|
+
hasMagicEden: false,
|
|
1200
|
+
hasOkx: false,
|
|
1201
|
+
hasLeather: false,
|
|
1202
|
+
hasPhantom: false,
|
|
1203
|
+
hasWizz: false,
|
|
1204
|
+
isInitializing: true,
|
|
1205
|
+
connected: false,
|
|
1206
|
+
isConnecting: false,
|
|
1207
|
+
publicKey: "",
|
|
1208
|
+
address: "",
|
|
1209
|
+
paymentAddress: "",
|
|
1210
|
+
paymentPublicKey: "",
|
|
1211
|
+
balance: void 0,
|
|
1212
|
+
network: MAINNET422222,
|
|
1213
|
+
library: null,
|
|
1214
|
+
provider: null,
|
|
1215
|
+
accounts: [],
|
|
1216
|
+
connect: (walletName) => __async222222(void 0, null, function* () {
|
|
1217
|
+
}),
|
|
1218
|
+
disconnect: () => {
|
|
1219
|
+
},
|
|
1220
|
+
requestAccounts: () => __async222222(void 0, null, function* () {
|
|
1221
|
+
return [];
|
|
1222
|
+
}),
|
|
1223
|
+
getNetwork: () => __async222222(void 0, null, function* () {
|
|
1224
|
+
return MAINNET422222;
|
|
1225
|
+
}),
|
|
1226
|
+
switchNetwork: (network) => __async222222(void 0, null, function* () {
|
|
1227
|
+
}),
|
|
1228
|
+
getPublicKey: () => __async222222(void 0, null, function* () {
|
|
1229
|
+
return "";
|
|
1230
|
+
}),
|
|
1231
|
+
getBalance: () => __async222222(void 0, null, function* () {
|
|
1232
|
+
return "";
|
|
1233
|
+
}),
|
|
1234
|
+
getInscriptions: () => __async222222(void 0, null, function* () {
|
|
1235
|
+
return [];
|
|
1236
|
+
}),
|
|
1237
|
+
sendBTC: (to, amount) => __async222222(void 0, null, function* () {
|
|
1238
|
+
return "";
|
|
1239
|
+
}),
|
|
1240
|
+
signMessage: (message) => __async222222(void 0, null, function* () {
|
|
1241
|
+
return "";
|
|
1242
|
+
}),
|
|
1243
|
+
signPsbt: (tx) => __async222222(void 0, null, function* () {
|
|
1244
|
+
return {
|
|
1245
|
+
signedPsbtHex: "",
|
|
1246
|
+
signedPsbtBase64: "",
|
|
1247
|
+
txId: ""
|
|
1248
|
+
};
|
|
1249
|
+
}),
|
|
1250
|
+
pushPsbt: (tx) => __async222222(void 0, null, function* () {
|
|
1251
|
+
return "";
|
|
1252
|
+
}),
|
|
1253
|
+
inscribe: (content) => __async222222(void 0, null, function* () {
|
|
1254
|
+
return "";
|
|
1255
|
+
}),
|
|
1256
|
+
isCreatingCommit: false,
|
|
1257
|
+
isInscribing: false
|
|
1258
|
+
};
|
|
1259
|
+
bitcoin222222.initEccLib(ecc222222);
|
|
1260
|
+
var __async2222222 = (__this, __arguments, generator) => {
|
|
1261
|
+
return new Promise((resolve, reject) => {
|
|
1262
|
+
var fulfilled = (value) => {
|
|
1263
|
+
try {
|
|
1264
|
+
step(generator.next(value));
|
|
1265
|
+
} catch (e) {
|
|
1266
|
+
reject(e);
|
|
1267
|
+
}
|
|
1268
|
+
};
|
|
1269
|
+
var rejected = (value) => {
|
|
1270
|
+
try {
|
|
1271
|
+
step(generator.throw(value));
|
|
1272
|
+
} catch (e) {
|
|
1273
|
+
reject(e);
|
|
1274
|
+
}
|
|
1275
|
+
};
|
|
1276
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1277
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
1278
|
+
});
|
|
1279
|
+
};
|
|
1280
|
+
var MAINNET4222222 = "mainnet";
|
|
1281
|
+
var initialWalletContext2222222 = {
|
|
1282
|
+
hasUnisat: false,
|
|
1283
|
+
hasXverse: false,
|
|
1284
|
+
hasOyl: false,
|
|
1285
|
+
hasMagicEden: false,
|
|
1286
|
+
hasOkx: false,
|
|
1287
|
+
hasLeather: false,
|
|
1288
|
+
hasPhantom: false,
|
|
1289
|
+
hasWizz: false,
|
|
1290
|
+
isInitializing: true,
|
|
1291
|
+
connected: false,
|
|
1292
|
+
isConnecting: false,
|
|
1293
|
+
publicKey: "",
|
|
1294
|
+
address: "",
|
|
1295
|
+
paymentAddress: "",
|
|
1296
|
+
paymentPublicKey: "",
|
|
1297
|
+
balance: void 0,
|
|
1298
|
+
network: MAINNET4222222,
|
|
1299
|
+
library: null,
|
|
1300
|
+
provider: null,
|
|
1301
|
+
accounts: [],
|
|
1302
|
+
connect: (walletName) => __async2222222(void 0, null, function* () {
|
|
1303
|
+
}),
|
|
1304
|
+
disconnect: () => {
|
|
1305
|
+
},
|
|
1306
|
+
requestAccounts: () => __async2222222(void 0, null, function* () {
|
|
1307
|
+
return [];
|
|
1308
|
+
}),
|
|
1309
|
+
getNetwork: () => __async2222222(void 0, null, function* () {
|
|
1310
|
+
return MAINNET4222222;
|
|
1311
|
+
}),
|
|
1312
|
+
switchNetwork: (network) => __async2222222(void 0, null, function* () {
|
|
1313
|
+
}),
|
|
1314
|
+
getPublicKey: () => __async2222222(void 0, null, function* () {
|
|
1315
|
+
return "";
|
|
1316
|
+
}),
|
|
1317
|
+
getBalance: () => __async2222222(void 0, null, function* () {
|
|
1318
|
+
return "";
|
|
1319
|
+
}),
|
|
1320
|
+
getInscriptions: () => __async2222222(void 0, null, function* () {
|
|
1321
|
+
return [];
|
|
1322
|
+
}),
|
|
1323
|
+
sendBTC: (to, amount) => __async2222222(void 0, null, function* () {
|
|
1324
|
+
return "";
|
|
1325
|
+
}),
|
|
1326
|
+
signMessage: (message) => __async2222222(void 0, null, function* () {
|
|
1327
|
+
return "";
|
|
1328
|
+
}),
|
|
1329
|
+
signPsbt: (tx) => __async2222222(void 0, null, function* () {
|
|
1330
|
+
return {
|
|
1331
|
+
signedPsbtHex: "",
|
|
1332
|
+
signedPsbtBase64: "",
|
|
1333
|
+
txId: ""
|
|
1334
|
+
};
|
|
1335
|
+
}),
|
|
1336
|
+
pushPsbt: (tx) => __async2222222(void 0, null, function* () {
|
|
1337
|
+
return "";
|
|
1338
|
+
}),
|
|
1339
|
+
inscribe: (content) => __async2222222(void 0, null, function* () {
|
|
1340
|
+
return "";
|
|
1341
|
+
}),
|
|
1342
|
+
isCreatingCommit: false,
|
|
1343
|
+
isInscribing: false
|
|
1344
|
+
};
|
|
1345
|
+
bitcoin2222222.initEccLib(ecc2222222);
|
|
1346
|
+
var __async22222222 = (__this, __arguments, generator) => {
|
|
1347
|
+
return new Promise((resolve, reject) => {
|
|
1348
|
+
var fulfilled = (value) => {
|
|
1349
|
+
try {
|
|
1350
|
+
step(generator.next(value));
|
|
1351
|
+
} catch (e) {
|
|
1352
|
+
reject(e);
|
|
1353
|
+
}
|
|
1354
|
+
};
|
|
1355
|
+
var rejected = (value) => {
|
|
1356
|
+
try {
|
|
1357
|
+
step(generator.throw(value));
|
|
1358
|
+
} catch (e) {
|
|
1359
|
+
reject(e);
|
|
1360
|
+
}
|
|
1361
|
+
};
|
|
1362
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1363
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
1364
|
+
});
|
|
1365
|
+
};
|
|
1366
|
+
var MAINNET42222222 = "mainnet";
|
|
1367
|
+
var initialWalletContext22222222 = {
|
|
1368
|
+
hasUnisat: false,
|
|
1369
|
+
hasXverse: false,
|
|
1370
|
+
hasOyl: false,
|
|
1371
|
+
hasMagicEden: false,
|
|
1372
|
+
hasOkx: false,
|
|
1373
|
+
hasLeather: false,
|
|
1374
|
+
hasPhantom: false,
|
|
1375
|
+
hasWizz: false,
|
|
1376
|
+
isInitializing: true,
|
|
1377
|
+
connected: false,
|
|
1378
|
+
isConnecting: false,
|
|
1379
|
+
publicKey: "",
|
|
1380
|
+
address: "",
|
|
1381
|
+
paymentAddress: "",
|
|
1382
|
+
paymentPublicKey: "",
|
|
1383
|
+
balance: void 0,
|
|
1384
|
+
network: MAINNET42222222,
|
|
1385
|
+
library: null,
|
|
1386
|
+
provider: null,
|
|
1387
|
+
accounts: [],
|
|
1388
|
+
connect: (walletName) => __async22222222(void 0, null, function* () {
|
|
1389
|
+
}),
|
|
1390
|
+
disconnect: () => {
|
|
1391
|
+
},
|
|
1392
|
+
requestAccounts: () => __async22222222(void 0, null, function* () {
|
|
1393
|
+
return [];
|
|
1394
|
+
}),
|
|
1395
|
+
getNetwork: () => __async22222222(void 0, null, function* () {
|
|
1396
|
+
return MAINNET42222222;
|
|
1397
|
+
}),
|
|
1398
|
+
switchNetwork: (network) => __async22222222(void 0, null, function* () {
|
|
1399
|
+
}),
|
|
1400
|
+
getPublicKey: () => __async22222222(void 0, null, function* () {
|
|
1401
|
+
return "";
|
|
1402
|
+
}),
|
|
1403
|
+
getBalance: () => __async22222222(void 0, null, function* () {
|
|
1404
|
+
return "";
|
|
1405
|
+
}),
|
|
1406
|
+
getInscriptions: () => __async22222222(void 0, null, function* () {
|
|
1407
|
+
return [];
|
|
1408
|
+
}),
|
|
1409
|
+
sendBTC: (to, amount) => __async22222222(void 0, null, function* () {
|
|
1410
|
+
return "";
|
|
1411
|
+
}),
|
|
1412
|
+
signMessage: (message) => __async22222222(void 0, null, function* () {
|
|
1413
|
+
return "";
|
|
1414
|
+
}),
|
|
1415
|
+
signPsbt: (tx) => __async22222222(void 0, null, function* () {
|
|
1416
|
+
return {
|
|
1417
|
+
signedPsbtHex: "",
|
|
1418
|
+
signedPsbtBase64: "",
|
|
1419
|
+
txId: ""
|
|
1420
|
+
};
|
|
1421
|
+
}),
|
|
1422
|
+
pushPsbt: (tx) => __async22222222(void 0, null, function* () {
|
|
1423
|
+
return "";
|
|
1424
|
+
}),
|
|
1425
|
+
inscribe: (content) => __async22222222(void 0, null, function* () {
|
|
1426
|
+
return "";
|
|
1427
|
+
}),
|
|
1428
|
+
isCreatingCommit: false,
|
|
1429
|
+
isInscribing: false
|
|
1430
|
+
};
|
|
1431
|
+
bitcoin22222222.initEccLib(ecc22222222);
|
|
1432
|
+
var __async222222222 = (__this, __arguments, generator) => {
|
|
1433
|
+
return new Promise((resolve, reject) => {
|
|
1434
|
+
var fulfilled = (value) => {
|
|
1435
|
+
try {
|
|
1436
|
+
step(generator.next(value));
|
|
1437
|
+
} catch (e) {
|
|
1438
|
+
reject(e);
|
|
1439
|
+
}
|
|
1440
|
+
};
|
|
1441
|
+
var rejected = (value) => {
|
|
1442
|
+
try {
|
|
1443
|
+
step(generator.throw(value));
|
|
1444
|
+
} catch (e) {
|
|
1445
|
+
reject(e);
|
|
1446
|
+
}
|
|
1447
|
+
};
|
|
1448
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1449
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
1450
|
+
});
|
|
1451
|
+
};
|
|
1452
|
+
var MAINNET422222222 = "mainnet";
|
|
1453
|
+
var initialWalletContext222222222 = {
|
|
1454
|
+
hasUnisat: false,
|
|
1455
|
+
hasXverse: false,
|
|
1456
|
+
hasOyl: false,
|
|
1457
|
+
hasMagicEden: false,
|
|
1458
|
+
hasOkx: false,
|
|
1459
|
+
hasLeather: false,
|
|
1460
|
+
hasPhantom: false,
|
|
1461
|
+
hasWizz: false,
|
|
1462
|
+
isInitializing: true,
|
|
1463
|
+
connected: false,
|
|
1464
|
+
isConnecting: false,
|
|
1465
|
+
publicKey: "",
|
|
1466
|
+
address: "",
|
|
1467
|
+
paymentAddress: "",
|
|
1468
|
+
paymentPublicKey: "",
|
|
1469
|
+
balance: void 0,
|
|
1470
|
+
network: MAINNET422222222,
|
|
1471
|
+
library: null,
|
|
1472
|
+
provider: null,
|
|
1473
|
+
accounts: [],
|
|
1474
|
+
connect: (walletName) => __async222222222(void 0, null, function* () {
|
|
1475
|
+
}),
|
|
1476
|
+
disconnect: () => {
|
|
1477
|
+
},
|
|
1478
|
+
requestAccounts: () => __async222222222(void 0, null, function* () {
|
|
1479
|
+
return [];
|
|
1480
|
+
}),
|
|
1481
|
+
getNetwork: () => __async222222222(void 0, null, function* () {
|
|
1482
|
+
return MAINNET422222222;
|
|
1483
|
+
}),
|
|
1484
|
+
switchNetwork: (network) => __async222222222(void 0, null, function* () {
|
|
1485
|
+
}),
|
|
1486
|
+
getPublicKey: () => __async222222222(void 0, null, function* () {
|
|
1487
|
+
return "";
|
|
1488
|
+
}),
|
|
1489
|
+
getBalance: () => __async222222222(void 0, null, function* () {
|
|
1490
|
+
return "";
|
|
1491
|
+
}),
|
|
1492
|
+
getInscriptions: () => __async222222222(void 0, null, function* () {
|
|
1493
|
+
return [];
|
|
1494
|
+
}),
|
|
1495
|
+
sendBTC: (to, amount) => __async222222222(void 0, null, function* () {
|
|
1496
|
+
return "";
|
|
1497
|
+
}),
|
|
1498
|
+
signMessage: (message) => __async222222222(void 0, null, function* () {
|
|
1499
|
+
return "";
|
|
1500
|
+
}),
|
|
1501
|
+
signPsbt: (tx) => __async222222222(void 0, null, function* () {
|
|
1502
|
+
return {
|
|
1503
|
+
signedPsbtHex: "",
|
|
1504
|
+
signedPsbtBase64: "",
|
|
1505
|
+
txId: ""
|
|
1506
|
+
};
|
|
1507
|
+
}),
|
|
1508
|
+
pushPsbt: (tx) => __async222222222(void 0, null, function* () {
|
|
1509
|
+
return "";
|
|
1510
|
+
}),
|
|
1511
|
+
inscribe: (content) => __async222222222(void 0, null, function* () {
|
|
1512
|
+
return "";
|
|
1513
|
+
}),
|
|
1514
|
+
isCreatingCommit: false,
|
|
1515
|
+
isInscribing: false
|
|
1516
|
+
};
|
|
1517
|
+
bitcoin222222222.initEccLib(ecc222222222);
|
|
1518
|
+
var __async2222222222 = (__this, __arguments, generator) => {
|
|
1519
|
+
return new Promise((resolve, reject) => {
|
|
1520
|
+
var fulfilled = (value) => {
|
|
1521
|
+
try {
|
|
1522
|
+
step(generator.next(value));
|
|
1523
|
+
} catch (e) {
|
|
1524
|
+
reject(e);
|
|
1525
|
+
}
|
|
1526
|
+
};
|
|
1527
|
+
var rejected = (value) => {
|
|
1528
|
+
try {
|
|
1529
|
+
step(generator.throw(value));
|
|
1530
|
+
} catch (e) {
|
|
1531
|
+
reject(e);
|
|
1532
|
+
}
|
|
1533
|
+
};
|
|
1534
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1535
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
1536
|
+
});
|
|
1537
|
+
};
|
|
1538
|
+
var MAINNET4222222222 = "mainnet";
|
|
1539
|
+
var initialWalletContext2222222222 = {
|
|
1540
|
+
hasUnisat: false,
|
|
1541
|
+
hasXverse: false,
|
|
1542
|
+
hasOyl: false,
|
|
1543
|
+
hasMagicEden: false,
|
|
1544
|
+
hasOkx: false,
|
|
1545
|
+
hasLeather: false,
|
|
1546
|
+
hasPhantom: false,
|
|
1547
|
+
hasWizz: false,
|
|
1548
|
+
isInitializing: true,
|
|
1549
|
+
connected: false,
|
|
1550
|
+
isConnecting: false,
|
|
1551
|
+
publicKey: "",
|
|
1552
|
+
address: "",
|
|
1553
|
+
paymentAddress: "",
|
|
1554
|
+
paymentPublicKey: "",
|
|
1555
|
+
balance: void 0,
|
|
1556
|
+
network: MAINNET4222222222,
|
|
1557
|
+
library: null,
|
|
1558
|
+
provider: null,
|
|
1559
|
+
accounts: [],
|
|
1560
|
+
connect: (walletName) => __async2222222222(void 0, null, function* () {
|
|
1561
|
+
}),
|
|
1562
|
+
disconnect: () => {
|
|
1563
|
+
},
|
|
1564
|
+
requestAccounts: () => __async2222222222(void 0, null, function* () {
|
|
1565
|
+
return [];
|
|
1566
|
+
}),
|
|
1567
|
+
getNetwork: () => __async2222222222(void 0, null, function* () {
|
|
1568
|
+
return MAINNET4222222222;
|
|
1569
|
+
}),
|
|
1570
|
+
switchNetwork: (network) => __async2222222222(void 0, null, function* () {
|
|
1571
|
+
}),
|
|
1572
|
+
getPublicKey: () => __async2222222222(void 0, null, function* () {
|
|
1573
|
+
return "";
|
|
1574
|
+
}),
|
|
1575
|
+
getBalance: () => __async2222222222(void 0, null, function* () {
|
|
1576
|
+
return "";
|
|
1577
|
+
}),
|
|
1578
|
+
getInscriptions: () => __async2222222222(void 0, null, function* () {
|
|
1579
|
+
return [];
|
|
1580
|
+
}),
|
|
1581
|
+
sendBTC: (to, amount) => __async2222222222(void 0, null, function* () {
|
|
1582
|
+
return "";
|
|
1583
|
+
}),
|
|
1584
|
+
signMessage: (message) => __async2222222222(void 0, null, function* () {
|
|
1585
|
+
return "";
|
|
1586
|
+
}),
|
|
1587
|
+
signPsbt: (tx) => __async2222222222(void 0, null, function* () {
|
|
1588
|
+
return {
|
|
1589
|
+
signedPsbtHex: "",
|
|
1590
|
+
signedPsbtBase64: "",
|
|
1591
|
+
txId: ""
|
|
1592
|
+
};
|
|
1593
|
+
}),
|
|
1594
|
+
pushPsbt: (tx) => __async2222222222(void 0, null, function* () {
|
|
1595
|
+
return "";
|
|
1596
|
+
}),
|
|
1597
|
+
inscribe: (content) => __async2222222222(void 0, null, function* () {
|
|
1598
|
+
return "";
|
|
1599
|
+
}),
|
|
1600
|
+
isCreatingCommit: false,
|
|
1601
|
+
isInscribing: false
|
|
1602
|
+
};
|
|
1603
|
+
bitcoin2222222222.initEccLib(ecc2222222222);
|
|
1604
|
+
var __async22222222222 = (__this, __arguments, generator) => {
|
|
1605
|
+
return new Promise((resolve, reject) => {
|
|
1606
|
+
var fulfilled = (value) => {
|
|
1607
|
+
try {
|
|
1608
|
+
step(generator.next(value));
|
|
1609
|
+
} catch (e) {
|
|
1610
|
+
reject(e);
|
|
1611
|
+
}
|
|
1612
|
+
};
|
|
1613
|
+
var rejected = (value) => {
|
|
1614
|
+
try {
|
|
1615
|
+
step(generator.throw(value));
|
|
1616
|
+
} catch (e) {
|
|
1617
|
+
reject(e);
|
|
1618
|
+
}
|
|
1619
|
+
};
|
|
1620
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1621
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
1622
|
+
});
|
|
1623
|
+
};
|
|
1624
|
+
var MAINNET42222222222 = "mainnet";
|
|
1625
|
+
var initialWalletContext22222222222 = {
|
|
1626
|
+
hasUnisat: false,
|
|
1627
|
+
hasXverse: false,
|
|
1628
|
+
hasOyl: false,
|
|
1629
|
+
hasMagicEden: false,
|
|
1630
|
+
hasOkx: false,
|
|
1631
|
+
hasLeather: false,
|
|
1632
|
+
hasPhantom: false,
|
|
1633
|
+
hasWizz: false,
|
|
1634
|
+
isInitializing: true,
|
|
1635
|
+
connected: false,
|
|
1636
|
+
isConnecting: false,
|
|
1637
|
+
publicKey: "",
|
|
1638
|
+
address: "",
|
|
1639
|
+
paymentAddress: "",
|
|
1640
|
+
paymentPublicKey: "",
|
|
1641
|
+
balance: void 0,
|
|
1642
|
+
network: MAINNET42222222222,
|
|
216
1643
|
library: null,
|
|
217
1644
|
provider: null,
|
|
218
1645
|
accounts: [],
|
|
219
|
-
connect: (walletName) =>
|
|
1646
|
+
connect: (walletName) => __async22222222222(void 0, null, function* () {
|
|
220
1647
|
}),
|
|
221
1648
|
disconnect: () => {
|
|
222
1649
|
},
|
|
223
|
-
requestAccounts: () =>
|
|
1650
|
+
requestAccounts: () => __async22222222222(void 0, null, function* () {
|
|
224
1651
|
return [];
|
|
225
1652
|
}),
|
|
226
|
-
getNetwork: () =>
|
|
227
|
-
return
|
|
1653
|
+
getNetwork: () => __async22222222222(void 0, null, function* () {
|
|
1654
|
+
return MAINNET42222222222;
|
|
228
1655
|
}),
|
|
229
|
-
switchNetwork: (network) =>
|
|
1656
|
+
switchNetwork: (network) => __async22222222222(void 0, null, function* () {
|
|
230
1657
|
}),
|
|
231
|
-
getPublicKey: () =>
|
|
1658
|
+
getPublicKey: () => __async22222222222(void 0, null, function* () {
|
|
232
1659
|
return "";
|
|
233
1660
|
}),
|
|
234
|
-
getBalance: () =>
|
|
1661
|
+
getBalance: () => __async22222222222(void 0, null, function* () {
|
|
235
1662
|
return "";
|
|
236
1663
|
}),
|
|
237
|
-
getInscriptions: () =>
|
|
1664
|
+
getInscriptions: () => __async22222222222(void 0, null, function* () {
|
|
238
1665
|
return [];
|
|
239
1666
|
}),
|
|
240
|
-
sendBTC: (to, amount) =>
|
|
1667
|
+
sendBTC: (to, amount) => __async22222222222(void 0, null, function* () {
|
|
241
1668
|
return "";
|
|
242
1669
|
}),
|
|
243
|
-
signMessage: (message) =>
|
|
1670
|
+
signMessage: (message) => __async22222222222(void 0, null, function* () {
|
|
244
1671
|
return "";
|
|
245
1672
|
}),
|
|
246
|
-
signPsbt: (tx) =>
|
|
1673
|
+
signPsbt: (tx) => __async22222222222(void 0, null, function* () {
|
|
247
1674
|
return {
|
|
248
1675
|
signedPsbtHex: "",
|
|
249
1676
|
signedPsbtBase64: "",
|
|
250
1677
|
txId: ""
|
|
251
1678
|
};
|
|
252
1679
|
}),
|
|
253
|
-
pushPsbt: (tx) =>
|
|
1680
|
+
pushPsbt: (tx) => __async22222222222(void 0, null, function* () {
|
|
254
1681
|
return "";
|
|
255
1682
|
}),
|
|
256
|
-
inscribe: (content) =>
|
|
1683
|
+
inscribe: (content) => __async22222222222(void 0, null, function* () {
|
|
257
1684
|
return "";
|
|
258
1685
|
}),
|
|
259
1686
|
isCreatingCommit: false,
|
|
260
1687
|
isInscribing: false
|
|
261
1688
|
};
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
// src/lib/urls.ts
|
|
271
|
-
var MEMPOOL_SPACE_URL2 = "https://mempool.space";
|
|
272
|
-
var MEMPOOL_SPACE_TESTNET_URL2 = "https://mempool.space/testnet";
|
|
273
|
-
var getMempoolSpaceUrl2 = (network) => network === TESTNET ? MEMPOOL_SPACE_TESTNET_URL2 : MEMPOOL_SPACE_URL2;
|
|
274
|
-
|
|
275
|
-
// src/lib/helpers.ts
|
|
276
|
-
import * as ecc from "@bitcoinerlab/secp256k1";
|
|
277
|
-
bitcoin.initEccLib(ecc);
|
|
278
|
-
var getBitcoinNetwork = (network) => {
|
|
279
|
-
if (network === TESTNET) {
|
|
280
|
-
return bitcoin.networks.testnet;
|
|
281
|
-
} else if (network === SIGNET) {
|
|
282
|
-
return bitcoin.networks.testnet;
|
|
283
|
-
} else if (network === REGTEST) {
|
|
284
|
-
return bitcoin.networks.regtest;
|
|
285
|
-
} else {
|
|
286
|
-
return bitcoin.networks.bitcoin;
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
var findOrdinalsAddress = (addresses) => {
|
|
290
|
-
return addresses.find(
|
|
291
|
-
({ purpose }) => purpose === "ordinals"
|
|
292
|
-
);
|
|
293
|
-
};
|
|
294
|
-
var findPaymentAddress = (addresses) => {
|
|
295
|
-
return addresses.find(
|
|
296
|
-
({ purpose }) => purpose === "payment"
|
|
297
|
-
);
|
|
298
|
-
};
|
|
299
|
-
var getBTCBalance = (address2) => __async(void 0, null, function* () {
|
|
300
|
-
try {
|
|
301
|
-
return yield axios.get(`https://blockchain.info/q/addressbalance/${address2}`).then((response) => response.data);
|
|
302
|
-
} catch (error) {
|
|
303
|
-
console.error("Error fetching BTC balance:", error);
|
|
304
|
-
throw new Error("Failed to fetch BTC balance");
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
var satoshisToBTC = (satoshis) => {
|
|
308
|
-
if (Number.isNaN(satoshis) || satoshis === void 0)
|
|
309
|
-
return "--";
|
|
310
|
-
const btcValue = satoshis / 1e8;
|
|
311
|
-
return btcValue.toFixed(8);
|
|
312
|
-
};
|
|
313
|
-
var isBase64 = (str) => {
|
|
314
|
-
const base64Regex = /^(?:[A-Za-z0-9+\/]{4})*?(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/;
|
|
315
|
-
return base64Regex.test(str);
|
|
316
|
-
};
|
|
317
|
-
var isHex = (str) => {
|
|
318
|
-
const hexRegex = /^[a-fA-F0-9]+$/;
|
|
319
|
-
return hexRegex.test(str);
|
|
320
|
-
};
|
|
321
|
-
function estimateTxSize(taprootInputCount, nonTaprootInputCount, outputCount) {
|
|
322
|
-
const baseTxSize = 10;
|
|
323
|
-
const taprootInputSize = 57;
|
|
324
|
-
const nonTaprootInputSize = 41;
|
|
325
|
-
const outputSize = 34;
|
|
326
|
-
const totalInputSize = taprootInputCount * taprootInputSize + nonTaprootInputCount * nonTaprootInputSize;
|
|
327
|
-
const totalOutputSize = outputCount * outputSize;
|
|
328
|
-
return baseTxSize + totalInputSize + totalOutputSize;
|
|
329
|
-
}
|
|
330
|
-
function createSendBtcPsbt(address2, paymentAddress, recipientAddress, amount, paymentPublicKey, network, feeRate = 7) {
|
|
331
|
-
return __async(this, null, function* () {
|
|
332
|
-
const isTaprootOnly = address2 === paymentAddress;
|
|
333
|
-
const mempoolUrl = `${getMempoolSpaceUrl2(
|
|
334
|
-
network
|
|
335
|
-
)}/api/address/${paymentAddress}/utxo`;
|
|
336
|
-
const utxos = yield axios.get(mempoolUrl).then((response) => response.data);
|
|
337
|
-
const sortedUtxos = utxos.sort(
|
|
338
|
-
(a, b) => b.value - a.value
|
|
339
|
-
);
|
|
340
|
-
const psbt = new bitcoin.Psbt({ network: getBitcoinNetwork(network) });
|
|
341
|
-
const estTxSize = estimateTxSize(1, 0, 2);
|
|
342
|
-
const satsNeeded = Math.floor(estTxSize * feeRate) + amount;
|
|
343
|
-
let amountGathered = 0;
|
|
344
|
-
let counter = 0;
|
|
345
|
-
try {
|
|
346
|
-
for (var iter = __forAwait(sortedUtxos), more, temp, error; more = !(temp = yield iter.next()).done; more = false) {
|
|
347
|
-
let utxo = temp.value;
|
|
348
|
-
const { txid, vout, value } = utxo;
|
|
349
|
-
const script = bitcoin.address.toOutputScript(
|
|
350
|
-
paymentAddress,
|
|
351
|
-
getBitcoinNetwork(network)
|
|
352
|
-
);
|
|
353
|
-
psbt.addInput({
|
|
354
|
-
hash: txid,
|
|
355
|
-
index: vout,
|
|
356
|
-
witnessUtxo: {
|
|
357
|
-
script,
|
|
358
|
-
value
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
if (!isTaprootOnly) {
|
|
362
|
-
const redeemScript = getRedeemScript(paymentPublicKey, network);
|
|
363
|
-
psbt.updateInput(counter, { redeemScript });
|
|
364
|
-
}
|
|
365
|
-
amountGathered += value;
|
|
366
|
-
if (amountGathered >= satsNeeded) {
|
|
367
|
-
break;
|
|
368
|
-
}
|
|
1689
|
+
bitcoin22222222222.initEccLib(ecc22222222222);
|
|
1690
|
+
var __async222222222222 = (__this, __arguments, generator) => {
|
|
1691
|
+
return new Promise((resolve, reject) => {
|
|
1692
|
+
var fulfilled = (value) => {
|
|
1693
|
+
try {
|
|
1694
|
+
step(generator.next(value));
|
|
1695
|
+
} catch (e) {
|
|
1696
|
+
reject(e);
|
|
369
1697
|
}
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
} finally {
|
|
1698
|
+
};
|
|
1699
|
+
var rejected = (value) => {
|
|
373
1700
|
try {
|
|
374
|
-
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
throw error[0];
|
|
1701
|
+
step(generator.throw(value));
|
|
1702
|
+
} catch (e) {
|
|
1703
|
+
reject(e);
|
|
378
1704
|
}
|
|
379
|
-
}
|
|
380
|
-
if (amountGathered < satsNeeded) {
|
|
381
|
-
throw new Error("Insufficient funds");
|
|
382
|
-
}
|
|
383
|
-
psbt.addOutput({
|
|
384
|
-
address: recipientAddress,
|
|
385
|
-
value: amount
|
|
386
|
-
});
|
|
387
|
-
if (amountGathered > satsNeeded) {
|
|
388
|
-
psbt.addOutput({
|
|
389
|
-
address: paymentAddress,
|
|
390
|
-
value: amountGathered - satsNeeded - amount
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
return {
|
|
394
|
-
psbtBase64: psbt.toBase64(),
|
|
395
|
-
psbtHex: psbt.toHex()
|
|
396
1705
|
};
|
|
1706
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
1707
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
397
1708
|
});
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
1709
|
+
};
|
|
1710
|
+
var MAINNET422222222222 = "mainnet";
|
|
1711
|
+
var initialWalletContext222222222222 = {
|
|
1712
|
+
hasUnisat: false,
|
|
1713
|
+
hasXverse: false,
|
|
1714
|
+
hasOyl: false,
|
|
1715
|
+
hasMagicEden: false,
|
|
1716
|
+
hasOkx: false,
|
|
1717
|
+
hasLeather: false,
|
|
1718
|
+
hasPhantom: false,
|
|
1719
|
+
hasWizz: false,
|
|
1720
|
+
isInitializing: true,
|
|
1721
|
+
connected: false,
|
|
1722
|
+
isConnecting: false,
|
|
1723
|
+
publicKey: "",
|
|
1724
|
+
address: "",
|
|
1725
|
+
paymentAddress: "",
|
|
1726
|
+
paymentPublicKey: "",
|
|
1727
|
+
balance: void 0,
|
|
1728
|
+
network: MAINNET422222222222,
|
|
1729
|
+
library: null,
|
|
1730
|
+
provider: null,
|
|
1731
|
+
accounts: [],
|
|
1732
|
+
connect: (walletName) => __async222222222222(void 0, null, function* () {
|
|
1733
|
+
}),
|
|
1734
|
+
disconnect: () => {
|
|
1735
|
+
},
|
|
1736
|
+
requestAccounts: () => __async222222222222(void 0, null, function* () {
|
|
1737
|
+
return [];
|
|
1738
|
+
}),
|
|
1739
|
+
getNetwork: () => __async222222222222(void 0, null, function* () {
|
|
1740
|
+
return MAINNET422222222222;
|
|
1741
|
+
}),
|
|
1742
|
+
switchNetwork: (network) => __async222222222222(void 0, null, function* () {
|
|
1743
|
+
}),
|
|
1744
|
+
getPublicKey: () => __async222222222222(void 0, null, function* () {
|
|
1745
|
+
return "";
|
|
1746
|
+
}),
|
|
1747
|
+
getBalance: () => __async222222222222(void 0, null, function* () {
|
|
1748
|
+
return "";
|
|
1749
|
+
}),
|
|
1750
|
+
getInscriptions: () => __async222222222222(void 0, null, function* () {
|
|
1751
|
+
return [];
|
|
1752
|
+
}),
|
|
1753
|
+
sendBTC: (to, amount) => __async222222222222(void 0, null, function* () {
|
|
1754
|
+
return "";
|
|
1755
|
+
}),
|
|
1756
|
+
signMessage: (message) => __async222222222222(void 0, null, function* () {
|
|
1757
|
+
return "";
|
|
1758
|
+
}),
|
|
1759
|
+
signPsbt: (tx) => __async222222222222(void 0, null, function* () {
|
|
1760
|
+
return {
|
|
1761
|
+
signedPsbtHex: "",
|
|
1762
|
+
signedPsbtBase64: "",
|
|
1763
|
+
txId: ""
|
|
1764
|
+
};
|
|
1765
|
+
}),
|
|
1766
|
+
pushPsbt: (tx) => __async222222222222(void 0, null, function* () {
|
|
1767
|
+
return "";
|
|
1768
|
+
}),
|
|
1769
|
+
inscribe: (content) => __async222222222222(void 0, null, function* () {
|
|
1770
|
+
return "";
|
|
1771
|
+
}),
|
|
1772
|
+
isCreatingCommit: false,
|
|
1773
|
+
isInscribing: false
|
|
1774
|
+
};
|
|
1775
|
+
bitcoin3.initEccLib(ecc222222222222);
|
|
1776
|
+
var LaserEyesContext = createContext(initialWalletContext222222222222);
|
|
1777
|
+
var LaserEyesContext2 = createContext2(initialWalletContext22222222222);
|
|
1778
|
+
var LaserEyesContext3 = createContext3(initialWalletContext2222222222);
|
|
1779
|
+
var LaserEyesContext4 = createContext4(initialWalletContext222222222);
|
|
1780
|
+
var LaserEyesContext5 = createContext5(initialWalletContext22222222);
|
|
1781
|
+
var LaserEyesContext6 = createContext6(initialWalletContext2222222);
|
|
1782
|
+
var LaserEyesContext7 = createContext7(initialWalletContext222222);
|
|
1783
|
+
var LaserEyesContext8 = createContext8(initialWalletContext22222);
|
|
1784
|
+
var LaserEyesContext9 = createContext9(initialWalletContext2222);
|
|
1785
|
+
var LaserEyesContext10 = createContext10(initialWalletContext222);
|
|
1786
|
+
var LaserEyesContext11 = createContext11(initialWalletContext22);
|
|
1787
|
+
var LaserEyesContext12 = createContext12(initialWalletContext2);
|
|
1788
|
+
|
|
1789
|
+
// example/lib/urls.ts
|
|
1790
|
+
var MEMPOOL_SPACE_URL3 = "https://mempool.space";
|
|
1791
|
+
var MEMPOOL_SPACE_TESTNET_URL3 = "https://mempool.space/testnet";
|
|
1792
|
+
var MEMPOOL_SPACE_SIGNET_URL2 = "https://mempool.space/signet";
|
|
1793
|
+
var getMempoolSpaceUrl3 = (network) => network === TESTNET3 ? MEMPOOL_SPACE_TESTNET_URL3 : network === SIGNET3 ? MEMPOOL_SPACE_SIGNET_URL2 : MEMPOOL_SPACE_URL3;
|
|
414
1794
|
|
|
415
1795
|
// src/providers/LaserEyesProvider.tsx
|
|
416
|
-
import {
|
|
417
|
-
|
|
418
|
-
getAddress,
|
|
419
|
-
request,
|
|
420
|
-
RpcErrorCode,
|
|
421
|
-
signMessage as signMessageSatsConnect,
|
|
422
|
-
signTransaction
|
|
423
|
-
} from "sats-connect";
|
|
424
|
-
import { fromOutputScript } from "bitcoinjs-lib/src/address";
|
|
425
|
-
import axios2 from "axios";
|
|
426
|
-
import { jsx } from "react/jsx-runtime";
|
|
427
|
-
var LaserEyesContext = createContext(initialWalletContext);
|
|
1796
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1797
|
+
var LaserEyesContext13 = createContext13(initialWalletContext);
|
|
428
1798
|
var useLaserEyes = () => {
|
|
429
|
-
return
|
|
1799
|
+
return useContext13(LaserEyesContext13);
|
|
430
1800
|
};
|
|
431
1801
|
var LaserEyesProvider = ({
|
|
432
1802
|
children,
|
|
433
1803
|
config
|
|
434
1804
|
}) => {
|
|
435
|
-
const selfRef =
|
|
1805
|
+
const selfRef = useRef13({
|
|
436
1806
|
accounts: []
|
|
437
1807
|
});
|
|
438
1808
|
const self = selfRef.current;
|
|
439
|
-
const [library, setLibrary] =
|
|
440
|
-
const [provider, setProvider] =
|
|
441
|
-
const [isInitializing, setIsInitializing] =
|
|
442
|
-
const [connected, setConnected] =
|
|
443
|
-
const [isConnecting, setIsConnecting] =
|
|
444
|
-
const [accounts, setAccounts] =
|
|
445
|
-
const [publicKey, setPublicKey] =
|
|
446
|
-
const [paymentPublicKey, setPaymentPublicKey] =
|
|
447
|
-
const [
|
|
448
|
-
const [paymentAddress, setPaymentAddress] =
|
|
449
|
-
const [balance, setBalance] =
|
|
450
|
-
const [hasUnisat, setHasUnisat] =
|
|
451
|
-
const [hasXverse, setHasXverse] =
|
|
452
|
-
const [hasOyl, setHasOyl] =
|
|
453
|
-
const [hasMagicEden, setHasMagicEden] =
|
|
454
|
-
const [hasOkx, setHasOkx] =
|
|
455
|
-
const [hasLeather, setHasLeather] =
|
|
456
|
-
const [hasPhantom, setHasPhantom] =
|
|
457
|
-
const [hasWizz, setHasWizz] =
|
|
458
|
-
const [network, setNetwork] =
|
|
1809
|
+
const [library, setLibrary] = useState25(null);
|
|
1810
|
+
const [provider, setProvider] = useState25();
|
|
1811
|
+
const [isInitializing, setIsInitializing] = useState25(true);
|
|
1812
|
+
const [connected, setConnected] = useState25(false);
|
|
1813
|
+
const [isConnecting, setIsConnecting] = useState25(false);
|
|
1814
|
+
const [accounts, setAccounts] = useState25([]);
|
|
1815
|
+
const [publicKey, setPublicKey] = useState25("");
|
|
1816
|
+
const [paymentPublicKey, setPaymentPublicKey] = useState25("");
|
|
1817
|
+
const [address3, setAddress] = useState25("");
|
|
1818
|
+
const [paymentAddress, setPaymentAddress] = useState25("");
|
|
1819
|
+
const [balance, setBalance] = useState25();
|
|
1820
|
+
const [hasUnisat, setHasUnisat] = useState25(false);
|
|
1821
|
+
const [hasXverse, setHasXverse] = useState25(false);
|
|
1822
|
+
const [hasOyl, setHasOyl] = useState25(false);
|
|
1823
|
+
const [hasMagicEden, setHasMagicEden] = useState25(false);
|
|
1824
|
+
const [hasOkx, setHasOkx] = useState25(false);
|
|
1825
|
+
const [hasLeather, setHasLeather] = useState25(false);
|
|
1826
|
+
const [hasPhantom, setHasPhantom] = useState25(false);
|
|
1827
|
+
const [hasWizz, setHasWizz] = useState25(false);
|
|
1828
|
+
const [network, setNetwork] = useLocalStorage13("network", MAINNET, {
|
|
459
1829
|
initializeWithValue: false
|
|
460
1830
|
});
|
|
461
|
-
|
|
1831
|
+
useEffect25(() => {
|
|
462
1832
|
if (config) {
|
|
463
1833
|
setNetwork(config.network);
|
|
464
1834
|
getNetwork().then((foundNetwork) => {
|
|
@@ -475,7 +1845,7 @@ var LaserEyesProvider = ({
|
|
|
475
1845
|
setIsInitializing(false);
|
|
476
1846
|
}
|
|
477
1847
|
};
|
|
478
|
-
|
|
1848
|
+
useEffect25(() => {
|
|
479
1849
|
const observer = new MutationObserver(() => {
|
|
480
1850
|
const unisatLib = window == null ? void 0 : window.unisat;
|
|
481
1851
|
if (unisatLib) {
|
|
@@ -488,7 +1858,7 @@ var LaserEyesProvider = ({
|
|
|
488
1858
|
observer.disconnect();
|
|
489
1859
|
};
|
|
490
1860
|
}, []);
|
|
491
|
-
|
|
1861
|
+
useEffect25(() => {
|
|
492
1862
|
const observer = new MutationObserver(() => {
|
|
493
1863
|
var _a;
|
|
494
1864
|
const xverseLib = (_a = window == null ? void 0 : window.XverseProviders) == null ? void 0 : _a.BitcoinProvider;
|
|
@@ -502,7 +1872,7 @@ var LaserEyesProvider = ({
|
|
|
502
1872
|
observer.disconnect();
|
|
503
1873
|
};
|
|
504
1874
|
}, []);
|
|
505
|
-
|
|
1875
|
+
useEffect25(() => {
|
|
506
1876
|
const observer = new MutationObserver(() => {
|
|
507
1877
|
const oylLib = window == null ? void 0 : window.oyl;
|
|
508
1878
|
if (oylLib) {
|
|
@@ -515,7 +1885,7 @@ var LaserEyesProvider = ({
|
|
|
515
1885
|
observer.disconnect();
|
|
516
1886
|
};
|
|
517
1887
|
}, []);
|
|
518
|
-
|
|
1888
|
+
useEffect25(() => {
|
|
519
1889
|
const observer = new MutationObserver(() => {
|
|
520
1890
|
const magicEdenLib = window == null ? void 0 : window.magicEden;
|
|
521
1891
|
if (magicEdenLib) {
|
|
@@ -528,7 +1898,7 @@ var LaserEyesProvider = ({
|
|
|
528
1898
|
observer.disconnect();
|
|
529
1899
|
};
|
|
530
1900
|
}, []);
|
|
531
|
-
|
|
1901
|
+
useEffect25(() => {
|
|
532
1902
|
const observer = new MutationObserver(() => {
|
|
533
1903
|
var _a, _b;
|
|
534
1904
|
let foundOkx;
|
|
@@ -547,7 +1917,7 @@ var LaserEyesProvider = ({
|
|
|
547
1917
|
observer.disconnect();
|
|
548
1918
|
};
|
|
549
1919
|
}, [network]);
|
|
550
|
-
|
|
1920
|
+
useEffect25(() => {
|
|
551
1921
|
const observer = new MutationObserver(() => {
|
|
552
1922
|
const leatherLib = window == null ? void 0 : window.LeatherProvider;
|
|
553
1923
|
if (leatherLib) {
|
|
@@ -560,7 +1930,7 @@ var LaserEyesProvider = ({
|
|
|
560
1930
|
observer.disconnect();
|
|
561
1931
|
};
|
|
562
1932
|
}, []);
|
|
563
|
-
|
|
1933
|
+
useEffect25(() => {
|
|
564
1934
|
const observer = new MutationObserver(() => {
|
|
565
1935
|
var _a;
|
|
566
1936
|
const phantomLib = (_a = window == null ? void 0 : window.phantom) == null ? void 0 : _a.bitcoin;
|
|
@@ -577,7 +1947,7 @@ var LaserEyesProvider = ({
|
|
|
577
1947
|
observer.disconnect();
|
|
578
1948
|
};
|
|
579
1949
|
}, []);
|
|
580
|
-
|
|
1950
|
+
useEffect25(() => {
|
|
581
1951
|
const observer = new MutationObserver(() => {
|
|
582
1952
|
const wizzLib = window == null ? void 0 : window.wizz;
|
|
583
1953
|
if (wizzLib) {
|
|
@@ -590,7 +1960,7 @@ var LaserEyesProvider = ({
|
|
|
590
1960
|
observer.disconnect();
|
|
591
1961
|
};
|
|
592
1962
|
}, []);
|
|
593
|
-
|
|
1963
|
+
useEffect25(() => {
|
|
594
1964
|
checkInitializationComplete();
|
|
595
1965
|
}, [
|
|
596
1966
|
hasUnisat,
|
|
@@ -602,10 +1972,10 @@ var LaserEyesProvider = ({
|
|
|
602
1972
|
hasPhantom,
|
|
603
1973
|
hasWizz
|
|
604
1974
|
]);
|
|
605
|
-
|
|
1975
|
+
useEffect25(() => {
|
|
606
1976
|
setBalance(void 0);
|
|
607
1977
|
}, [network]);
|
|
608
|
-
|
|
1978
|
+
useEffect25(() => {
|
|
609
1979
|
if (provider !== UNISAT && provider !== WIZZ) {
|
|
610
1980
|
return;
|
|
611
1981
|
}
|
|
@@ -619,7 +1989,7 @@ var LaserEyesProvider = ({
|
|
|
619
1989
|
library.removeListener("networkChanged", handleNetworkChanged);
|
|
620
1990
|
};
|
|
621
1991
|
}, [library]);
|
|
622
|
-
|
|
1992
|
+
useEffect25(() => {
|
|
623
1993
|
if (!isInitializing) {
|
|
624
1994
|
const defaultWallet = localStorage == null ? void 0 : localStorage.getItem(
|
|
625
1995
|
LOCAL_STORAGE_DEFAULT_WALLET
|
|
@@ -630,7 +2000,7 @@ var LaserEyesProvider = ({
|
|
|
630
2000
|
}
|
|
631
2001
|
}
|
|
632
2002
|
}, [isInitializing]);
|
|
633
|
-
const connectUnisat =
|
|
2003
|
+
const connectUnisat = useCallback25(() => __async(void 0, null, function* () {
|
|
634
2004
|
try {
|
|
635
2005
|
localStorage == null ? void 0 : localStorage.setItem(LOCAL_STORAGE_DEFAULT_WALLET, UNISAT);
|
|
636
2006
|
const lib = window.unisat;
|
|
@@ -654,7 +2024,7 @@ var LaserEyesProvider = ({
|
|
|
654
2024
|
throw error;
|
|
655
2025
|
}
|
|
656
2026
|
}), [hasUnisat]);
|
|
657
|
-
const connectXverse =
|
|
2027
|
+
const connectXverse = useCallback25(() => __async(void 0, null, function* () {
|
|
658
2028
|
try {
|
|
659
2029
|
localStorage == null ? void 0 : localStorage.setItem(LOCAL_STORAGE_DEFAULT_WALLET, XVERSE);
|
|
660
2030
|
let xverseNetwork = getXverseNetwork((config == null ? void 0 : config.network) || MAINNET);
|
|
@@ -688,7 +2058,7 @@ var LaserEyesProvider = ({
|
|
|
688
2058
|
throw new Error(`Can't lasereyes to ${XVERSE} wallet`);
|
|
689
2059
|
}
|
|
690
2060
|
};
|
|
691
|
-
yield
|
|
2061
|
+
yield getAddress13(getAddressOptions);
|
|
692
2062
|
setConnected(true);
|
|
693
2063
|
} catch (error) {
|
|
694
2064
|
throw error;
|
|
@@ -753,7 +2123,7 @@ var LaserEyesProvider = ({
|
|
|
753
2123
|
}
|
|
754
2124
|
};
|
|
755
2125
|
console.log(JSON.stringify(getAddressOptions));
|
|
756
|
-
yield
|
|
2126
|
+
yield getAddress13(getAddressOptions);
|
|
757
2127
|
setConnected(true);
|
|
758
2128
|
} catch (error) {
|
|
759
2129
|
console.log("error", error);
|
|
@@ -784,7 +2154,7 @@ var LaserEyesProvider = ({
|
|
|
784
2154
|
throw error;
|
|
785
2155
|
}
|
|
786
2156
|
});
|
|
787
|
-
const connectLeather =
|
|
2157
|
+
const connectLeather = useCallback25(() => __async(void 0, null, function* () {
|
|
788
2158
|
try {
|
|
789
2159
|
localStorage == null ? void 0 : localStorage.setItem(LOCAL_STORAGE_DEFAULT_WALLET, LEATHER);
|
|
790
2160
|
const lib = window.LeatherProvider;
|
|
@@ -794,13 +2164,13 @@ var LaserEyesProvider = ({
|
|
|
794
2164
|
const addressesResponse = getAddressesResponse.result;
|
|
795
2165
|
const addresses = addressesResponse.addresses;
|
|
796
2166
|
const leatherAccountsParsed = addresses.map(
|
|
797
|
-
(
|
|
2167
|
+
(address4) => address4.address
|
|
798
2168
|
);
|
|
799
2169
|
const taprootAddress = addresses.find(
|
|
800
|
-
(
|
|
2170
|
+
(address4) => address4.type === P2TR
|
|
801
2171
|
);
|
|
802
2172
|
const segwitAddress = addresses.find(
|
|
803
|
-
(
|
|
2173
|
+
(address4) => address4.type === P2WPKH
|
|
804
2174
|
);
|
|
805
2175
|
setAccounts(leatherAccountsParsed);
|
|
806
2176
|
setAddress(String(taprootAddress == null ? void 0 : taprootAddress.address));
|
|
@@ -977,7 +2347,7 @@ var LaserEyesProvider = ({
|
|
|
977
2347
|
console.log("CANCELLED");
|
|
978
2348
|
}
|
|
979
2349
|
};
|
|
980
|
-
return [
|
|
2350
|
+
return [address3];
|
|
981
2351
|
} else if (provider === OYL) {
|
|
982
2352
|
return yield library.requestAccounts();
|
|
983
2353
|
} else if (provider === OKX) {
|
|
@@ -991,13 +2361,13 @@ var LaserEyesProvider = ({
|
|
|
991
2361
|
const addressesResponse = getAddressesResponse.result;
|
|
992
2362
|
const addresses = addressesResponse.addresses;
|
|
993
2363
|
const leatherAccountsParsed = addresses.map(
|
|
994
|
-
(
|
|
2364
|
+
(address4) => address4.address
|
|
995
2365
|
);
|
|
996
2366
|
const taprootAddress = addresses.find(
|
|
997
|
-
(
|
|
2367
|
+
(address4) => address4.type === P2TR
|
|
998
2368
|
);
|
|
999
2369
|
const segwitAddress = addresses.find(
|
|
1000
|
-
(
|
|
2370
|
+
(address4) => address4.type === P2WPKH
|
|
1001
2371
|
);
|
|
1002
2372
|
setAccounts(leatherAccountsParsed);
|
|
1003
2373
|
setAddress(String(taprootAddress == null ? void 0 : taprootAddress.address));
|
|
@@ -1040,17 +2410,17 @@ var LaserEyesProvider = ({
|
|
|
1040
2410
|
setNetwork(foundNetwork);
|
|
1041
2411
|
return foundNetwork;
|
|
1042
2412
|
} else if (provider === XVERSE) {
|
|
1043
|
-
if (
|
|
2413
|
+
if (address3.slice(0, 1) === "t") {
|
|
1044
2414
|
return TESTNET;
|
|
1045
2415
|
}
|
|
1046
2416
|
return MAINNET;
|
|
1047
2417
|
} else if (provider === OYL) {
|
|
1048
|
-
if (
|
|
2418
|
+
if (address3.slice(0, 1) === "t") {
|
|
1049
2419
|
return TESTNET;
|
|
1050
2420
|
}
|
|
1051
2421
|
return MAINNET;
|
|
1052
2422
|
} else if (provider === MAGIC_EDEN) {
|
|
1053
|
-
if (
|
|
2423
|
+
if (address3.slice(0, 1) === "t") {
|
|
1054
2424
|
return TESTNET;
|
|
1055
2425
|
}
|
|
1056
2426
|
return MAINNET;
|
|
@@ -1059,12 +2429,12 @@ var LaserEyesProvider = ({
|
|
|
1059
2429
|
const foundNetwork = getNetworkForOkx(okxNetwork);
|
|
1060
2430
|
setNetwork(foundNetwork);
|
|
1061
2431
|
} else if (provider === LEATHER) {
|
|
1062
|
-
if (
|
|
2432
|
+
if (address3.slice(0, 1) === "t") {
|
|
1063
2433
|
return TESTNET;
|
|
1064
2434
|
}
|
|
1065
2435
|
return MAINNET;
|
|
1066
2436
|
} else if (provider === PHANTOM) {
|
|
1067
|
-
if (
|
|
2437
|
+
if (address3.slice(0, 1) === "t") {
|
|
1068
2438
|
return TESTNET;
|
|
1069
2439
|
}
|
|
1070
2440
|
return MAINNET;
|
|
@@ -1177,7 +2547,7 @@ var LaserEyesProvider = ({
|
|
|
1177
2547
|
throw new Error("Transaction failed");
|
|
1178
2548
|
return txId;
|
|
1179
2549
|
} else if (provider === XVERSE) {
|
|
1180
|
-
const response = yield
|
|
2550
|
+
const response = yield request13("sendTransfer", {
|
|
1181
2551
|
recipients: [
|
|
1182
2552
|
{
|
|
1183
2553
|
address: to,
|
|
@@ -1188,7 +2558,7 @@ var LaserEyesProvider = ({
|
|
|
1188
2558
|
if (response.status === "success") {
|
|
1189
2559
|
return response.result.txid;
|
|
1190
2560
|
} else {
|
|
1191
|
-
if (response.error.code ===
|
|
2561
|
+
if (response.error.code === RpcErrorCode13.USER_REJECTION) {
|
|
1192
2562
|
throw new Error("User rejected the request");
|
|
1193
2563
|
} else {
|
|
1194
2564
|
throw new Error("Error sending BTC: " + response.error.message);
|
|
@@ -1196,7 +2566,7 @@ var LaserEyesProvider = ({
|
|
|
1196
2566
|
}
|
|
1197
2567
|
} else if (provider === OYL) {
|
|
1198
2568
|
const { psbtHex, psbtBase64 } = yield createSendBtcPsbt(
|
|
1199
|
-
|
|
2569
|
+
address3,
|
|
1200
2570
|
paymentAddress,
|
|
1201
2571
|
to,
|
|
1202
2572
|
amount,
|
|
@@ -1211,7 +2581,7 @@ var LaserEyesProvider = ({
|
|
|
1211
2581
|
return psbt.txId;
|
|
1212
2582
|
} else if (provider === MAGIC_EDEN) {
|
|
1213
2583
|
const { psbtHex, psbtBase64 } = yield createSendBtcPsbt(
|
|
1214
|
-
|
|
2584
|
+
address3,
|
|
1215
2585
|
paymentAddress,
|
|
1216
2586
|
to,
|
|
1217
2587
|
amount,
|
|
@@ -1241,7 +2611,7 @@ var LaserEyesProvider = ({
|
|
|
1241
2611
|
if ((_a = response == null ? void 0 : response.result) == null ? void 0 : _a.txid) {
|
|
1242
2612
|
return response.result.txid;
|
|
1243
2613
|
} else {
|
|
1244
|
-
if (response.error.code ===
|
|
2614
|
+
if (response.error.code === RpcErrorCode13.USER_REJECTION) {
|
|
1245
2615
|
throw new Error("User rejected the request");
|
|
1246
2616
|
} else {
|
|
1247
2617
|
throw new Error("Error sending BTC: " + response.error.message);
|
|
@@ -1267,14 +2637,14 @@ var LaserEyesProvider = ({
|
|
|
1267
2637
|
if (provider === UNISAT) {
|
|
1268
2638
|
return yield library == null ? void 0 : library.signMessage(message);
|
|
1269
2639
|
} else if (provider === XVERSE) {
|
|
1270
|
-
const response = yield
|
|
1271
|
-
address:
|
|
2640
|
+
const response = yield request13("signMessage", {
|
|
2641
|
+
address: address3,
|
|
1272
2642
|
message
|
|
1273
2643
|
});
|
|
1274
2644
|
if (response.status === "success") {
|
|
1275
2645
|
return response.result.signature;
|
|
1276
2646
|
} else {
|
|
1277
|
-
if (response.error.code ===
|
|
2647
|
+
if (response.error.code === RpcErrorCode13.USER_REJECTION) {
|
|
1278
2648
|
throw new Error("User rejected the request");
|
|
1279
2649
|
} else {
|
|
1280
2650
|
throw new Error("Error signing message: " + response.error.message);
|
|
@@ -1282,13 +2652,13 @@ var LaserEyesProvider = ({
|
|
|
1282
2652
|
}
|
|
1283
2653
|
} else if (provider === MAGIC_EDEN) {
|
|
1284
2654
|
let signedMessage;
|
|
1285
|
-
yield
|
|
2655
|
+
yield signMessageSatsConnect13({
|
|
1286
2656
|
getProvider: () => __async(void 0, null, function* () {
|
|
1287
2657
|
return window.magicEden.bitcoin;
|
|
1288
2658
|
}),
|
|
1289
2659
|
payload: {
|
|
1290
2660
|
network: {
|
|
1291
|
-
type:
|
|
2661
|
+
type: BitcoinNetworkType13.Mainnet
|
|
1292
2662
|
},
|
|
1293
2663
|
address: paymentAddress,
|
|
1294
2664
|
message
|
|
@@ -1312,7 +2682,7 @@ var LaserEyesProvider = ({
|
|
|
1312
2682
|
} else if (provider === PHANTOM) {
|
|
1313
2683
|
const utf8Bytes = new TextEncoder().encode(message);
|
|
1314
2684
|
const uintArray = new Uint8Array(utf8Bytes);
|
|
1315
|
-
const response = yield library == null ? void 0 : library.signMessage(
|
|
2685
|
+
const response = yield library == null ? void 0 : library.signMessage(address3, uintArray);
|
|
1316
2686
|
const binaryString = String.fromCharCode(...response.signature);
|
|
1317
2687
|
return btoa(binaryString);
|
|
1318
2688
|
} else if (provider === WIZZ) {
|
|
@@ -1332,11 +2702,11 @@ var LaserEyesProvider = ({
|
|
|
1332
2702
|
if (!psbt)
|
|
1333
2703
|
throw new Error("No PSBT provided");
|
|
1334
2704
|
if (isHex(psbt)) {
|
|
1335
|
-
psbtBase64 =
|
|
2705
|
+
psbtBase64 = bitcoin15.Psbt.fromHex(psbt).toBase64();
|
|
1336
2706
|
psbtHex = psbt;
|
|
1337
2707
|
} else if (isBase64(psbt)) {
|
|
1338
2708
|
psbtBase64 = psbt;
|
|
1339
|
-
psbtHex =
|
|
2709
|
+
psbtHex = bitcoin15.Psbt.fromBase64(psbt).toHex();
|
|
1340
2710
|
} else {
|
|
1341
2711
|
throw new Error("Invalid PSBT format");
|
|
1342
2712
|
}
|
|
@@ -1344,7 +2714,7 @@ var LaserEyesProvider = ({
|
|
|
1344
2714
|
const signedPsbt = yield library == null ? void 0 : library.signPsbt(psbtHex, {
|
|
1345
2715
|
autoFinalized: finalize
|
|
1346
2716
|
});
|
|
1347
|
-
const psbtSignedPsbt =
|
|
2717
|
+
const psbtSignedPsbt = bitcoin15.Psbt.fromHex(signedPsbt);
|
|
1348
2718
|
if (finalize && broadcast) {
|
|
1349
2719
|
const txId = yield pushPsbt(signedPsbt);
|
|
1350
2720
|
return {
|
|
@@ -1359,13 +2729,13 @@ var LaserEyesProvider = ({
|
|
|
1359
2729
|
txId: void 0
|
|
1360
2730
|
};
|
|
1361
2731
|
} else if (provider === XVERSE) {
|
|
1362
|
-
const toSignPsbt =
|
|
2732
|
+
const toSignPsbt = bitcoin15.Psbt.fromBase64(String(psbtBase64), {
|
|
1363
2733
|
network: getBitcoinNetwork(network)
|
|
1364
2734
|
});
|
|
1365
2735
|
const inputs = toSignPsbt.data.inputs;
|
|
1366
2736
|
const inputsToSign = [];
|
|
1367
2737
|
const ordinalAddressData = {
|
|
1368
|
-
address:
|
|
2738
|
+
address: address3,
|
|
1369
2739
|
signingIndexes: []
|
|
1370
2740
|
};
|
|
1371
2741
|
const paymentsAddressData = {
|
|
@@ -1377,13 +2747,13 @@ var LaserEyesProvider = ({
|
|
|
1377
2747
|
for (var iter = __forAwait(inputs), more, temp, error; more = !(temp = yield iter.next()).done; more = false) {
|
|
1378
2748
|
let input = temp.value;
|
|
1379
2749
|
const { script } = input.witnessUtxo;
|
|
1380
|
-
const addressFromScript =
|
|
2750
|
+
const addressFromScript = fromOutputScript13(
|
|
1381
2751
|
script,
|
|
1382
2752
|
getBitcoinNetwork(network)
|
|
1383
2753
|
);
|
|
1384
2754
|
if (addressFromScript === paymentAddress) {
|
|
1385
2755
|
paymentsAddressData.signingIndexes.push(Number(counter));
|
|
1386
|
-
} else if (addressFromScript ===
|
|
2756
|
+
} else if (addressFromScript === address3) {
|
|
1387
2757
|
ordinalAddressData.signingIndexes.push(Number(counter));
|
|
1388
2758
|
}
|
|
1389
2759
|
counter++;
|
|
@@ -1420,7 +2790,7 @@ var LaserEyesProvider = ({
|
|
|
1420
2790
|
if (response.txId) {
|
|
1421
2791
|
txId = response.txId;
|
|
1422
2792
|
} else if (response.psbtBase64) {
|
|
1423
|
-
const signedPsbt =
|
|
2793
|
+
const signedPsbt = bitcoin15.Psbt.fromBase64(
|
|
1424
2794
|
String(response.psbtBase64),
|
|
1425
2795
|
{
|
|
1426
2796
|
network: getBitcoinNetwork(network)
|
|
@@ -1432,7 +2802,7 @@ var LaserEyesProvider = ({
|
|
|
1432
2802
|
},
|
|
1433
2803
|
onCancel: () => console.log("Canceled")
|
|
1434
2804
|
};
|
|
1435
|
-
yield
|
|
2805
|
+
yield signTransaction13(signPsbtOptions);
|
|
1436
2806
|
return {
|
|
1437
2807
|
signedPsbtHex,
|
|
1438
2808
|
signedPsbtBase64,
|
|
@@ -1441,7 +2811,7 @@ var LaserEyesProvider = ({
|
|
|
1441
2811
|
} else if (provider === OYL) {
|
|
1442
2812
|
const signedPsbt = yield library == null ? void 0 : library.signPsbt(psbtHex, true, true);
|
|
1443
2813
|
console.log({ signedPsbt });
|
|
1444
|
-
const psbtSignedPsbt =
|
|
2814
|
+
const psbtSignedPsbt = bitcoin15.Psbt.fromHex(signedPsbt);
|
|
1445
2815
|
if (broadcast) {
|
|
1446
2816
|
const txId = yield pushPsbt(psbtSignedPsbt.toHex());
|
|
1447
2817
|
return {
|
|
@@ -1457,13 +2827,13 @@ var LaserEyesProvider = ({
|
|
|
1457
2827
|
};
|
|
1458
2828
|
}
|
|
1459
2829
|
} else if (provider === MAGIC_EDEN) {
|
|
1460
|
-
const toSignPsbt =
|
|
2830
|
+
const toSignPsbt = bitcoin15.Psbt.fromBase64(String(psbtBase64), {
|
|
1461
2831
|
network: getBitcoinNetwork(network)
|
|
1462
2832
|
});
|
|
1463
2833
|
const inputs = toSignPsbt.data.inputs;
|
|
1464
2834
|
const inputsToSign = [];
|
|
1465
2835
|
const ordinalAddressData = {
|
|
1466
|
-
address:
|
|
2836
|
+
address: address3,
|
|
1467
2837
|
signingIndexes: []
|
|
1468
2838
|
};
|
|
1469
2839
|
const paymentsAddressData = {
|
|
@@ -1475,13 +2845,13 @@ var LaserEyesProvider = ({
|
|
|
1475
2845
|
for (var iter2 = __forAwait(inputs), more2, temp2, error2; more2 = !(temp2 = yield iter2.next()).done; more2 = false) {
|
|
1476
2846
|
let input = temp2.value;
|
|
1477
2847
|
const { script } = input.witnessUtxo;
|
|
1478
|
-
const addressFromScript =
|
|
2848
|
+
const addressFromScript = fromOutputScript13(
|
|
1479
2849
|
script,
|
|
1480
2850
|
getBitcoinNetwork(network)
|
|
1481
2851
|
);
|
|
1482
2852
|
if (addressFromScript === paymentAddress) {
|
|
1483
2853
|
paymentsAddressData.signingIndexes.push(Number(counter));
|
|
1484
|
-
} else if (addressFromScript ===
|
|
2854
|
+
} else if (addressFromScript === address3) {
|
|
1485
2855
|
ordinalAddressData.signingIndexes.push(Number(counter));
|
|
1486
2856
|
}
|
|
1487
2857
|
counter++;
|
|
@@ -1519,7 +2889,7 @@ var LaserEyesProvider = ({
|
|
|
1519
2889
|
},
|
|
1520
2890
|
onFinish: (response) => {
|
|
1521
2891
|
if (response.psbtBase64) {
|
|
1522
|
-
const signedPsbt =
|
|
2892
|
+
const signedPsbt = bitcoin15.Psbt.fromBase64(
|
|
1523
2893
|
String(response.psbtBase64),
|
|
1524
2894
|
{
|
|
1525
2895
|
network: getBitcoinNetwork(network)
|
|
@@ -1538,9 +2908,9 @@ var LaserEyesProvider = ({
|
|
|
1538
2908
|
throw error3;
|
|
1539
2909
|
}
|
|
1540
2910
|
};
|
|
1541
|
-
yield
|
|
2911
|
+
yield signTransaction13(signPsbtOptions);
|
|
1542
2912
|
if (broadcast) {
|
|
1543
|
-
const signed =
|
|
2913
|
+
const signed = bitcoin15.Psbt.fromBase64(String(signedPsbtBase64));
|
|
1544
2914
|
const finalized = signed.finalizeAllInputs();
|
|
1545
2915
|
const extracted = finalized.extractTransaction();
|
|
1546
2916
|
const txId2 = yield pushPsbt(extracted.toHex());
|
|
@@ -1560,7 +2930,7 @@ var LaserEyesProvider = ({
|
|
|
1560
2930
|
const signedPsbt = yield library == null ? void 0 : library.signPsbt(psbtHex, {
|
|
1561
2931
|
autoFinalized: finalize
|
|
1562
2932
|
});
|
|
1563
|
-
const psbtSignedPsbt =
|
|
2933
|
+
const psbtSignedPsbt = bitcoin15.Psbt.fromHex(signedPsbt);
|
|
1564
2934
|
if (finalize && broadcast) {
|
|
1565
2935
|
const txId = yield pushPsbt(signedPsbt);
|
|
1566
2936
|
return {
|
|
@@ -1577,7 +2947,7 @@ var LaserEyesProvider = ({
|
|
|
1577
2947
|
} else if (provider === LEATHER) {
|
|
1578
2948
|
const requestParams = {
|
|
1579
2949
|
hex: psbtHex,
|
|
1580
|
-
broadcast,
|
|
2950
|
+
broadcast: false,
|
|
1581
2951
|
network
|
|
1582
2952
|
};
|
|
1583
2953
|
const response = yield library == null ? void 0 : library.request(
|
|
@@ -1586,11 +2956,10 @@ var LaserEyesProvider = ({
|
|
|
1586
2956
|
);
|
|
1587
2957
|
const leatherHexResult = response.result;
|
|
1588
2958
|
const signedTx = leatherHexResult.hex;
|
|
1589
|
-
const signed =
|
|
2959
|
+
const signed = bitcoin15.Psbt.fromHex(String(signedTx));
|
|
1590
2960
|
if (finalize && broadcast) {
|
|
1591
2961
|
const finalized = signed.finalizeAllInputs();
|
|
1592
|
-
const
|
|
1593
|
-
const txId = yield pushPsbt(extracted.toHex());
|
|
2962
|
+
const txId = yield pushPsbt(finalized.toHex());
|
|
1594
2963
|
return {
|
|
1595
2964
|
signedPsbtHex: signed.toHex(),
|
|
1596
2965
|
signedPsbtBase64: signed.toBase64(),
|
|
@@ -1615,7 +2984,7 @@ var LaserEyesProvider = ({
|
|
|
1615
2984
|
autoFinalized: finalize,
|
|
1616
2985
|
broadcast: false
|
|
1617
2986
|
});
|
|
1618
|
-
const psbtSignedPsbt =
|
|
2987
|
+
const psbtSignedPsbt = bitcoin15.Psbt.fromHex(signedPsbt);
|
|
1619
2988
|
if (finalize && broadcast) {
|
|
1620
2989
|
const txId = yield pushPsbt(signedPsbt);
|
|
1621
2990
|
return {
|
|
@@ -1647,11 +3016,11 @@ var LaserEyesProvider = ({
|
|
|
1647
3016
|
} else if (provider === OKX) {
|
|
1648
3017
|
return yield library == null ? void 0 : library.pushPsbt(psbt);
|
|
1649
3018
|
} else if (provider === MAGIC_EDEN) {
|
|
1650
|
-
return yield
|
|
3019
|
+
return yield axios27.post(`${getMempoolSpaceUrl3(network)}/api/tx`, psbt).then((res) => res.data);
|
|
1651
3020
|
} else if (provider === LEATHER) {
|
|
1652
|
-
const decoded =
|
|
3021
|
+
const decoded = bitcoin15.Psbt.fromHex(psbt);
|
|
1653
3022
|
const extracted = decoded.extractTransaction();
|
|
1654
|
-
return yield
|
|
3023
|
+
return yield axios27.post(`${getMempoolSpaceUrl3(network)}/api/tx`, extracted.toHex()).then((res) => res.data);
|
|
1655
3024
|
} else if (provider === WIZZ) {
|
|
1656
3025
|
return yield library == null ? void 0 : library.pushPsbt(psbt);
|
|
1657
3026
|
} else {
|
|
@@ -1661,14 +3030,14 @@ var LaserEyesProvider = ({
|
|
|
1661
3030
|
throw error;
|
|
1662
3031
|
}
|
|
1663
3032
|
});
|
|
1664
|
-
return /* @__PURE__ */
|
|
1665
|
-
|
|
3033
|
+
return /* @__PURE__ */ jsx13(
|
|
3034
|
+
LaserEyesContext13.Provider,
|
|
1666
3035
|
{
|
|
1667
3036
|
value: {
|
|
1668
3037
|
library,
|
|
1669
3038
|
accounts,
|
|
1670
3039
|
publicKey,
|
|
1671
|
-
address:
|
|
3040
|
+
address: address3,
|
|
1672
3041
|
paymentAddress,
|
|
1673
3042
|
paymentPublicKey,
|
|
1674
3043
|
provider,
|
|
@@ -1705,36 +3074,36 @@ var LaserEyesProvider = ({
|
|
|
1705
3074
|
};
|
|
1706
3075
|
|
|
1707
3076
|
// src/hooks/useInscriber.ts
|
|
1708
|
-
import { useCallback as
|
|
3077
|
+
import { useCallback as useCallback26, useEffect as useEffect26, useState as useState26 } from "react";
|
|
1709
3078
|
|
|
1710
3079
|
// src/consts/inscribe.ts
|
|
1711
3080
|
var MIME_TYPE_TEXT = "text/plain;charset=utf-8";
|
|
1712
3081
|
|
|
1713
3082
|
// src/hooks/useInscriber.ts
|
|
1714
|
-
import
|
|
3083
|
+
import axios28 from "axios";
|
|
1715
3084
|
var DESCRIBE_API_URL = "http://localhost:3000/api";
|
|
1716
3085
|
var useInscriber = ({
|
|
1717
3086
|
inscribeApiUrl = DESCRIBE_API_URL
|
|
1718
3087
|
}) => {
|
|
1719
|
-
const { address:
|
|
1720
|
-
const [content, setContent] =
|
|
1721
|
-
const [mimeType, setMimeType] =
|
|
1722
|
-
const [commitPsbtHex, setCommitPsbtHex] =
|
|
1723
|
-
const [commitPsbtBase64, setCommitPsbtBase64] =
|
|
1724
|
-
const [commitTxId, setCommitTxId] =
|
|
1725
|
-
const [feeRate, setFeeRate] =
|
|
1726
|
-
const [totalFees, setTotalFees] =
|
|
1727
|
-
const [inscriberAddress, setInscriberAddress] =
|
|
1728
|
-
const [inscriptionTxId, setInscriptionTxId] =
|
|
1729
|
-
const [previewUrl, setPreviewUrl] =
|
|
1730
|
-
const [isFetchingCommitPsbt, setIsFetchingCommitPsbt] =
|
|
1731
|
-
const [isInscribing, setIsInscribing] =
|
|
1732
|
-
|
|
3088
|
+
const { address: address3, paymentAddress, paymentPublicKey, publicKey, signPsbt } = useLaserEyes();
|
|
3089
|
+
const [content, setContent] = useState26("");
|
|
3090
|
+
const [mimeType, setMimeType] = useState26(MIME_TYPE_TEXT);
|
|
3091
|
+
const [commitPsbtHex, setCommitPsbtHex] = useState26("");
|
|
3092
|
+
const [commitPsbtBase64, setCommitPsbtBase64] = useState26("");
|
|
3093
|
+
const [commitTxId, setCommitTxId] = useState26("");
|
|
3094
|
+
const [feeRate, setFeeRate] = useState26(10);
|
|
3095
|
+
const [totalFees, setTotalFees] = useState26(0);
|
|
3096
|
+
const [inscriberAddress, setInscriberAddress] = useState26("");
|
|
3097
|
+
const [inscriptionTxId, setInscriptionTxId] = useState26("");
|
|
3098
|
+
const [previewUrl, setPreviewUrl] = useState26("");
|
|
3099
|
+
const [isFetchingCommitPsbt, setIsFetchingCommitPsbt] = useState26(false);
|
|
3100
|
+
const [isInscribing, setIsInscribing] = useState26(false);
|
|
3101
|
+
useEffect26(() => {
|
|
1733
3102
|
setCommitPsbtHex("");
|
|
1734
3103
|
setCommitPsbtBase64("");
|
|
1735
3104
|
setCommitTxId("");
|
|
1736
|
-
}, [content,
|
|
1737
|
-
const getCommitPsbt =
|
|
3105
|
+
}, [content, address3, mimeType, feeRate]);
|
|
3106
|
+
const getCommitPsbt = useCallback26(() => __async(void 0, null, function* () {
|
|
1738
3107
|
try {
|
|
1739
3108
|
if (!content)
|
|
1740
3109
|
throw new Error("missing content");
|
|
@@ -1747,7 +3116,7 @@ var useInscriber = ({
|
|
|
1747
3116
|
if (!mimeType)
|
|
1748
3117
|
throw new Error("missing mimeType");
|
|
1749
3118
|
setIsFetchingCommitPsbt(true);
|
|
1750
|
-
return yield
|
|
3119
|
+
return yield axios28.post(`${inscribeApiUrl}/create-inscription`, {
|
|
1751
3120
|
content,
|
|
1752
3121
|
paymentAddress,
|
|
1753
3122
|
paymentPublicKey,
|
|
@@ -1781,7 +3150,7 @@ var useInscriber = ({
|
|
|
1781
3150
|
throw e;
|
|
1782
3151
|
}
|
|
1783
3152
|
});
|
|
1784
|
-
const inscribe =
|
|
3153
|
+
const inscribe = useCallback26(
|
|
1785
3154
|
(_0) => __async(void 0, [_0], function* ({
|
|
1786
3155
|
content: providedContent,
|
|
1787
3156
|
mimeType: providedMimeType,
|
|
@@ -1791,7 +3160,7 @@ var useInscriber = ({
|
|
|
1791
3160
|
try {
|
|
1792
3161
|
const inscribeContent = providedContent != null ? providedContent : content;
|
|
1793
3162
|
const inscribeMimeType = providedMimeType != null ? providedMimeType : mimeType;
|
|
1794
|
-
const inscribeOutputAddress = providedAddress != null ? providedAddress :
|
|
3163
|
+
const inscribeOutputAddress = providedAddress != null ? providedAddress : address3;
|
|
1795
3164
|
let inscribeCommitTxId = providedCommitTxId != null ? providedCommitTxId : commitTxId;
|
|
1796
3165
|
if (!inscribeContent)
|
|
1797
3166
|
throw new Error("missing content");
|
|
@@ -1810,10 +3179,10 @@ var useInscriber = ({
|
|
|
1810
3179
|
yield delay(1e4);
|
|
1811
3180
|
if (!inscribeCommitTxId)
|
|
1812
3181
|
throw new Error("missing commitTxId");
|
|
1813
|
-
return yield
|
|
3182
|
+
return yield axios28.post(`${inscribeApiUrl}/inscribe`, {
|
|
1814
3183
|
content,
|
|
1815
3184
|
mimeType,
|
|
1816
|
-
ordinalAddress:
|
|
3185
|
+
ordinalAddress: address3,
|
|
1817
3186
|
commitTxId: inscribeCommitTxId
|
|
1818
3187
|
}).then((res) => res.data).then((data) => {
|
|
1819
3188
|
setInscriptionTxId(data);
|
|
@@ -1826,7 +3195,7 @@ var useInscriber = ({
|
|
|
1826
3195
|
setIsInscribing(false);
|
|
1827
3196
|
}
|
|
1828
3197
|
}),
|
|
1829
|
-
[
|
|
3198
|
+
[address3, commitTxId, content, mimeType]
|
|
1830
3199
|
);
|
|
1831
3200
|
const reset = () => {
|
|
1832
3201
|
setContent("");
|
|
@@ -1876,6 +3245,8 @@ export {
|
|
|
1876
3245
|
OKX,
|
|
1877
3246
|
OKX_MAINNET,
|
|
1878
3247
|
OKX_TESTNET,
|
|
3248
|
+
OP_WALLET_MAINNET,
|
|
3249
|
+
OP_WALLET_TESTNET,
|
|
1879
3250
|
OYL,
|
|
1880
3251
|
P2PKH,
|
|
1881
3252
|
P2PSH,
|