@bestinslot/wallet-kit 0.9.0 → 0.10.0

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.
@@ -1,25 +1,25 @@
1
- import { x as l, y as x, z as k, d, A as B, B as p, f as S, C as P, D as T } from "./mint-BXVHw4CQ.js";
1
+ import { D as l, C as x, E as b, d, S as B, G as p, f as S, T, Q as P } from "./mint-CA_-62SJ.js";
2
2
  async function X() {
3
3
  if (!window.LeatherProvider)
4
4
  throw new Error("Leather extension not found.");
5
- const n = await window.LeatherProvider.request("getAddresses");
6
- if (!n)
5
+ const e = await window.LeatherProvider.request("getAddresses");
6
+ if (!e)
7
7
  throw new Error("Failed to get wallets.");
8
- return n.result.addresses.map((t) => ({
8
+ return e.result.addresses.map((t) => ({
9
9
  address: t.address,
10
10
  pubkey: t.publicKey || null,
11
11
  purpose: t.type === "p2wpkh" ? "payment" : t.type === "p2tr" ? "ordinals" : "stx"
12
12
  }));
13
13
  }
14
- async function $(n, e) {
14
+ async function $(e, n) {
15
15
  if (!window.LeatherProvider)
16
16
  throw new Error("Leather extension not found.");
17
- if (!e)
17
+ if (!n)
18
18
  throw new Error("Wallet type is required for signing messages with Leather.");
19
19
  try {
20
20
  const t = await window.LeatherProvider.request("signMessage", {
21
- message: n,
22
- paymentType: e === "ordinals" ? "p2tr" : "p2wpkh",
21
+ message: e,
22
+ paymentType: n === "ordinals" ? "p2tr" : "p2wpkh",
23
23
  network: d()
24
24
  });
25
25
  return p.from(t.result.signature, "base64").toString("hex");
@@ -27,32 +27,32 @@ async function $(n, e) {
27
27
  throw new Error(`Failed to sign message: ${t.message}`);
28
28
  }
29
29
  }
30
- async function F(n) {
30
+ async function L(e) {
31
31
  if (!window.LeatherProvider)
32
32
  throw new Error("Leather extension not found.");
33
33
  try {
34
- const e = await window.LeatherProvider.request("signMessage", {
35
- message: n,
34
+ const n = await window.LeatherProvider.request("signMessage", {
35
+ message: e,
36
36
  paymentType: "p2wpkh",
37
37
  network: d()
38
38
  });
39
39
  return {
40
- signature: p.from(e.result.signature, "base64").toString("hex"),
41
- address: e.result.address
40
+ signature: p.from(n.result.signature, "base64").toString("hex"),
41
+ address: n.result.address
42
42
  };
43
- } catch (e) {
44
- throw new Error(`Failed to sign message: ${e.message}`);
43
+ } catch (n) {
44
+ throw new Error(`Failed to sign message: ${n.message}`);
45
45
  }
46
46
  }
47
- async function L(n, e) {
47
+ async function F(e, n) {
48
48
  if (!window.LeatherProvider)
49
49
  throw new Error("Leather extension not found.");
50
50
  try {
51
51
  return (await window.LeatherProvider.request("sendTransfer", {
52
52
  recipients: [
53
53
  {
54
- address: e,
55
- amount: n.toString()
54
+ address: n,
55
+ amount: e.toString()
56
56
  }
57
57
  ],
58
58
  network: d()
@@ -61,7 +61,7 @@ async function L(n, e) {
61
61
  throw new Error(`Failed to send BTC: ${t.message}`);
62
62
  }
63
63
  }
64
- async function M(n, e, t) {
64
+ async function M(e, n, t) {
65
65
  if (!window.LeatherProvider)
66
66
  throw new Error("Leather extension not found.");
67
67
  const s = [];
@@ -69,19 +69,19 @@ async function M(n, e, t) {
69
69
  for (let r = 0; r < t[i].signingIndexes.length; r++)
70
70
  s.push(t[i].signingIndexes[r]);
71
71
  return (await window.LeatherProvider.request("signPsbt", {
72
- hex: B(n),
72
+ hex: B(e),
73
73
  network: d(),
74
- broadcast: e,
74
+ broadcast: n,
75
75
  signAtIndex: s
76
76
  })).result?.hex ?? "";
77
77
  }
78
- async function C(n, e, t, s, o, i) {
79
- const r = l.Psbt.fromHex(n), a = [];
78
+ async function I(e, n, t, s, o, i) {
79
+ const r = l.Psbt.fromHex(e), a = [];
80
80
  for (let w = 0; w < r.inputCount; w++)
81
81
  i && i.includes(w) || s.includes(w) || a.push(w);
82
- const c = await M(x(n), !1, [
82
+ const c = await M(x(e), !1, [
83
83
  {
84
- address: e,
84
+ address: n,
85
85
  signingIndexes: a,
86
86
  sigHash: l.Transaction.SIGHASH_DEFAULT
87
87
  },
@@ -90,95 +90,116 @@ async function C(n, e, t, s, o, i) {
90
90
  signingIndexes: s,
91
91
  sigHash: l.Transaction.SIGHASH_DEFAULT
92
92
  }
93
- ]), g = l.Psbt.fromHex(c);
94
- k(g, i);
95
- const u = g.extractTransaction(), f = u.toHex();
93
+ ]), u = l.Psbt.fromHex(c);
94
+ b(u, i);
95
+ const g = u.extractTransaction(), f = g.toHex();
96
96
  return {
97
- txId: u.getId(),
97
+ txId: g.getId(),
98
98
  signedTxHex: f
99
99
  };
100
100
  }
101
- const I = {
101
+ const A = {
102
102
  getWallets: X,
103
103
  signMessage: $,
104
- signMessageDeterministic: F,
105
- sendBTC: L,
104
+ signMessageDeterministic: L,
105
+ sendBTC: F,
106
106
  signPSBT: M,
107
- sign: C
107
+ sign: I
108
108
  };
109
109
  async function K() {
110
110
  if (!window.okxwallet)
111
111
  throw new Error("OKX extension not found.");
112
- const n = d();
113
- let e;
114
- if (n === "mainnet")
115
- e = await window.okxwallet.bitcoin.connect();
116
- else if (n === "testnet")
117
- e = await window.okxwallet.bitcoinTestnet.connect();
118
- else if (n === "signet")
119
- e = await window.okxwallet.bitcoinSignet.connect();
112
+ const e = d();
113
+ let n;
114
+ if (e === "mainnet")
115
+ n = await window.okxwallet.bitcoin.connect();
116
+ else if (e === "testnet")
117
+ n = await window.okxwallet.bitcoinTestnet.connect();
118
+ else if (e === "signet")
119
+ n = await window.okxwallet.bitcoinSignet.connect();
120
120
  else throw new Error("Unsupported network for OKX.");
121
- if (!e)
121
+ if (!n)
122
122
  throw new Error("Error fetching wallet data.");
123
123
  return [
124
124
  {
125
- address: e.address,
126
- pubkey: e.publicKey,
125
+ address: n.address,
126
+ pubkey: n.publicKey,
127
127
  purpose: "all"
128
128
  }
129
129
  ];
130
130
  }
131
- async function U(n) {
131
+ function C() {
132
+ const e = d();
133
+ if (e === "mainnet")
134
+ return window.okxwallet?.bitcoin;
135
+ if (e === "testnet")
136
+ return window.okxwallet?.bitcoinTestnet;
137
+ if (e === "signet")
138
+ return window.okxwallet?.bitcoinSignet;
139
+ }
140
+ async function U() {
141
+ const e = C();
142
+ return typeof e?.getAccounts != "function" ? [] : await e.getAccounts() ?? [];
143
+ }
144
+ function D(e) {
145
+ const n = C();
146
+ if (typeof n?.on != "function")
147
+ return () => {
148
+ };
149
+ const t = (s) => e(s?.address ? [s.address] : []);
150
+ return n.on("accountChanged", t), () => n.removeListener?.("accountChanged", t);
151
+ }
152
+ async function N(e) {
132
153
  if (!window.okxwallet)
133
154
  throw new Error("OKX extension not found.");
134
- const e = d();
155
+ const n = d();
135
156
  let t;
136
- if (e === "mainnet")
137
- t = await window.okxwallet.bitcoin.signMessage(n, "bip322-simple");
138
- else if (e === "testnet")
139
- t = await window.okxwallet.bitcoinTestnet.signMessage(n, "bip322-simple");
140
- else if (e === "signet")
141
- t = await window.okxwallet.bitcoinSignet.signMessage(n, "bip322-simple");
157
+ if (n === "mainnet")
158
+ t = await window.okxwallet.bitcoin.signMessage(e, "bip322-simple");
159
+ else if (n === "testnet")
160
+ t = await window.okxwallet.bitcoinTestnet.signMessage(e, "bip322-simple");
161
+ else if (n === "signet")
162
+ t = await window.okxwallet.bitcoinSignet.signMessage(e, "bip322-simple");
142
163
  else throw new Error("Unsupported network for OKX.");
143
164
  return p.from(t, "base64").toString("hex");
144
165
  }
145
- async function D(n) {
166
+ async function q(e) {
146
167
  if (!window.okxwallet)
147
168
  throw new Error("OKX extension not found.");
148
- const e = S();
149
- if (!e)
169
+ const n = S();
170
+ if (!n)
150
171
  throw new Error("No payment wallet found.");
151
- const t = e.address, s = d();
172
+ const t = n.address, s = d();
152
173
  let o;
153
174
  if (s === "mainnet")
154
- o = await window.okxwallet.bitcoin.signMessage(n, "ecdsa");
175
+ o = await window.okxwallet.bitcoin.signMessage(e, "ecdsa");
155
176
  else if (s === "testnet")
156
- o = await window.okxwallet.bitcoinTestnet.signMessage(n, "ecdsa");
177
+ o = await window.okxwallet.bitcoinTestnet.signMessage(e, "ecdsa");
157
178
  else if (s === "signet")
158
- o = await window.okxwallet.bitcoinSignet.signMessage(n, "ecdsa");
179
+ o = await window.okxwallet.bitcoinSignet.signMessage(e, "ecdsa");
159
180
  else throw new Error("Unsupported network for OKX.");
160
181
  return {
161
182
  signature: p.from(o, "base64").toString("hex"),
162
183
  address: t
163
184
  };
164
185
  }
165
- async function q(n, e) {
186
+ async function O(e, n) {
166
187
  if (!window.okxwallet)
167
188
  throw new Error("OKX extension not found.");
168
189
  const t = d();
169
190
  let s;
170
191
  if (t === "mainnet")
171
- s = await window.okxwallet.bitcoin.sendBitcoin(e, n);
192
+ s = await window.okxwallet.bitcoin.sendBitcoin(n, e);
172
193
  else if (t === "testnet")
173
- s = await window.okxwallet.bitcoinTestnet.sendBitcoin(e, n);
194
+ s = await window.okxwallet.bitcoinTestnet.sendBitcoin(n, e);
174
195
  else if (t === "signet")
175
- s = await window.okxwallet.bitcoinSignet.sendBitcoin(e, n);
196
+ s = await window.okxwallet.bitcoinSignet.sendBitcoin(n, e);
176
197
  else
177
198
  throw new Error("Unsupported network for OKX.");
178
199
  return s;
179
200
  }
180
- async function E(n, e, t) {
181
- const s = B(n);
201
+ async function v(e, n, t) {
202
+ const s = B(e);
182
203
  let o = null;
183
204
  if (t.length !== 0) {
184
205
  const i = [];
@@ -196,31 +217,31 @@ async function E(n, e, t) {
196
217
  }
197
218
  if (d() === "mainnet") {
198
219
  let i = null;
199
- return o ? i = await window.okxwallet.bitcoin.signPsbt(s, o) : i = await window.okxwallet.bitcoin.signPsbt(s), e && await window.okxwallet.bitcoin.pushPsbt(i), i;
220
+ return o ? i = await window.okxwallet.bitcoin.signPsbt(s, o) : i = await window.okxwallet.bitcoin.signPsbt(s), n && await window.okxwallet.bitcoin.pushPsbt(i), i;
200
221
  } else if (d() === "testnet") {
201
- if (e)
222
+ if (n)
202
223
  throw new Error("Cannot broadcast on testnet with okx");
203
224
  let i = null;
204
225
  return o ? i = await window.okxwallet.bitcoinTestnet.signPsbt(s, o) : i = await window.okxwallet.bitcoinTestnet.signPsbt(s), i;
205
226
  } else if (d() === "signet") {
206
- if (e)
227
+ if (n)
207
228
  throw new Error("Cannot broadcast on signet with okx");
208
229
  let i = null;
209
230
  return o ? i = await window.okxwallet.bitcoinSignet.signPsbt(s, o) : i = await window.okxwallet.bitcoinSignet.signPsbt(s), i;
210
231
  } else
211
232
  throw new Error("Unsupported network for OKX.");
212
233
  }
213
- async function N(n, e, t, s, o, i) {
234
+ async function W(e, n, t, s, o, i) {
214
235
  let r = null;
215
- if (!e)
216
- r = await E(x(n), !1, []);
236
+ if (!n)
237
+ r = await v(x(e), !1, []);
217
238
  else {
218
- const u = l.Psbt.fromHex(n), f = [];
219
- for (let w = 0; w < u.inputCount; w++)
239
+ const g = l.Psbt.fromHex(e), f = [];
240
+ for (let w = 0; w < g.inputCount; w++)
220
241
  i && i.includes(w) || s.includes(w) || f.push(w);
221
- r = await E(x(n), !1, [
242
+ r = await v(x(e), !1, [
222
243
  {
223
- address: e,
244
+ address: n,
224
245
  signingIndexes: f
225
246
  },
226
247
  {
@@ -230,55 +251,68 @@ async function N(n, e, t, s, o, i) {
230
251
  ]);
231
252
  }
232
253
  const a = l.Psbt.fromHex(r);
233
- k(a, i);
234
- const c = a.extractTransaction(), g = c.toHex();
254
+ b(a, i);
255
+ const c = a.extractTransaction(), u = c.toHex();
235
256
  return {
236
257
  txId: c.getId(),
237
- signedTxHex: g
258
+ signedTxHex: u
238
259
  };
239
260
  }
240
- const O = {
261
+ const _ = {
241
262
  getWallets: K,
242
- signMessage: U,
243
- signMessageDeterministic: D,
244
- sendBTC: q,
245
- signPSBT: E,
246
- sign: N
263
+ getAccounts: U,
264
+ onAccountsChanged: D,
265
+ signMessage: N,
266
+ signMessageDeterministic: q,
267
+ sendBTC: O,
268
+ signPSBT: v,
269
+ sign: W
247
270
  };
248
- async function b() {
271
+ async function k() {
249
272
  if (!window.unisat)
250
273
  throw new Error("UniSat not found.");
251
- const n = await window.unisat.getNetwork(), e = d();
252
- n !== "livenet" && e === "mainnet" ? await window.unisat.switchNetwork("livenet") : n === "livenet" && (e === "testnet" || e === "signet") && await window.unisat.switchNetwork("testnet");
274
+ const e = await window.unisat.getNetwork(), n = d();
275
+ e !== "livenet" && n === "mainnet" ? await window.unisat.switchNetwork("livenet") : e === "livenet" && (n === "testnet" || n === "signet") && await window.unisat.switchNetwork("testnet");
253
276
  }
254
- async function W() {
255
- await b();
256
- const n = await window.unisat?.requestAccounts(), e = await window.unisat?.getPublicKey();
257
- if (!n)
277
+ async function G() {
278
+ await k();
279
+ const e = await window.unisat?.requestAccounts(), n = await window.unisat?.getPublicKey();
280
+ if (!e)
258
281
  throw new Error("Failed to get wallets.");
259
- return n.map((s) => ({
282
+ return e.map((s) => ({
260
283
  address: s,
261
- pubkey: e,
284
+ pubkey: n,
262
285
  purpose: "all"
263
286
  }));
264
287
  }
265
- async function A(n) {
266
- await b();
288
+ async function z() {
289
+ return typeof window.unisat?.getAccounts != "function" ? [] : await window.unisat.getAccounts() ?? [];
290
+ }
291
+ function R(e) {
292
+ const n = window.unisat;
293
+ if (!n?.on)
294
+ return () => {
295
+ };
296
+ const t = (s) => e(s ?? []);
297
+ return n.on("accountsChanged", t), () => n.removeListener?.("accountsChanged", t);
298
+ }
299
+ async function j(e) {
300
+ await k();
267
301
  try {
268
- const e = await window.unisat.signMessage(n, "bip322-simple");
269
- return p.from(e, "base64").toString("hex");
270
- } catch (e) {
271
- throw console.error("Failed to sign message", e), new Error("Failed to sign message.");
302
+ const n = await window.unisat.signMessage(e, "bip322-simple");
303
+ return p.from(n, "base64").toString("hex");
304
+ } catch (n) {
305
+ throw console.error("Failed to sign message", n), new Error("Failed to sign message.");
272
306
  }
273
307
  }
274
- async function _(n) {
275
- await b();
276
- const e = S();
277
- if (!e)
308
+ async function Q(e) {
309
+ await k();
310
+ const n = S();
311
+ if (!n)
278
312
  throw new Error("No payment wallet found.");
279
- const t = e.address;
313
+ const t = n.address;
280
314
  try {
281
- const s = await window.unisat.signMessage(n, "ecdsa");
315
+ const s = await window.unisat.signMessage(e, "ecdsa");
282
316
  return {
283
317
  signature: p.from(s, "base64").toString("hex"),
284
318
  address: t
@@ -287,18 +321,18 @@ async function _(n) {
287
321
  throw console.error("Failed to sign message", s), new Error("Failed to sign message.");
288
322
  }
289
323
  }
290
- async function z(n, e) {
291
- await b();
324
+ async function V(e, n) {
325
+ await k();
292
326
  try {
293
- return await window.unisat.sendBitcoin(e, n);
327
+ return await window.unisat.sendBitcoin(n, e);
294
328
  } catch (t) {
295
329
  throw console.error("Failed to send BTC", t), new Error("Failed to send BTC.");
296
330
  }
297
331
  }
298
- async function v(n, e, t) {
299
- if (await b(), !window.unisat)
332
+ async function E(e, n, t) {
333
+ if (await k(), !window.unisat)
300
334
  throw new Error("UniSat not found.");
301
- const s = B(n);
335
+ const s = B(e);
302
336
  let o = null;
303
337
  if (t.length === 0)
304
338
  o = await window.unisat.signPsbt(s);
@@ -317,109 +351,111 @@ async function v(n, e, t) {
317
351
  };
318
352
  o = await window.unisat.signPsbt(s, r);
319
353
  }
320
- return e && (o = await window.unisat.pushPsbt(o)), o;
354
+ return n && (o = await window.unisat.pushPsbt(o)), o;
321
355
  }
322
- async function G(n, e, t, s, o, i) {
356
+ async function J(e, n, t, s, o, i) {
323
357
  let r = null;
324
- if (!e)
325
- r = await v(x(n), !1, []);
358
+ if (!n)
359
+ r = await E(x(e), !1, []);
326
360
  else {
327
- const u = l.Psbt.fromHex(n), f = [], w = [], y = [];
328
- for (let h = 0; h < u.inputCount; h++)
361
+ const g = l.Psbt.fromHex(e), f = [], w = [], m = [];
362
+ for (let h = 0; h < g.inputCount; h++)
329
363
  if (!(i && i.includes(h))) {
330
364
  if (s.includes(h)) {
331
- o && o.includes(h) ? y.push(!0) : o && y.push(!1);
365
+ o && o.includes(h) ? m.push(!0) : o && m.push(!1);
332
366
  continue;
333
367
  }
334
368
  f.push(h), o && o.includes(h) ? w.push(!0) : o && w.push(!1);
335
369
  }
336
- r = await v(x(n), !1, [
370
+ r = await E(x(e), !1, [
337
371
  {
338
- address: e,
372
+ address: n,
339
373
  signingIndexes: f,
340
374
  useTweakedSigner: w
341
375
  },
342
376
  {
343
377
  address: t,
344
378
  signingIndexes: s,
345
- useTweakedSigner: y
379
+ useTweakedSigner: m
346
380
  }
347
381
  ]);
348
382
  }
349
383
  const a = l.Psbt.fromHex(r);
350
- k(a, i);
351
- const c = a.extractTransaction(), g = c.toHex();
384
+ b(a, i);
385
+ const c = a.extractTransaction(), u = c.toHex();
352
386
  return {
353
387
  txId: c.getId(),
354
- signedTxHex: g
388
+ signedTxHex: u
355
389
  };
356
390
  }
357
- const R = {
358
- checkNetwork: b,
359
- getWallets: W,
360
- signMessage: A,
361
- signMessageDeterministic: _,
362
- sendBTC: z,
363
- signPSBT: v,
364
- sign: G
391
+ const Y = {
392
+ checkNetwork: k,
393
+ getWallets: G,
394
+ getAccounts: z,
395
+ onAccountsChanged: R,
396
+ signMessage: j,
397
+ signMessageDeterministic: Q,
398
+ sendBTC: V,
399
+ signPSBT: E,
400
+ sign: J
365
401
  };
366
- function m() {
367
- const n = d();
368
- if (n === "mainnet")
402
+ function y() {
403
+ const e = d();
404
+ if (e === "mainnet")
369
405
  return "Mainnet";
370
- if (n === "testnet")
406
+ if (e === "testnet")
371
407
  return "Testnet4";
372
- if (n === "signet")
408
+ if (e === "signet")
373
409
  return "Signet";
374
410
  throw new Error("Unknown BTC network type.");
375
411
  }
376
- async function j() {
412
+ async function Z() {
377
413
  if (!window.XverseProviders?.BitcoinProvider)
378
414
  throw new Error("Xverse extension not found.");
379
- const n = P({
415
+ const e = T({
380
416
  purposes: ["ordinals", "payment"],
381
417
  message: "[Best in Slot] wants to know your addresses!",
382
418
  network: {
383
- type: m()
419
+ type: y()
384
420
  }
385
- }), e = await window.XverseProviders.BitcoinProvider?.connect(n);
386
- if (!e)
421
+ }), n = await window.XverseProviders.BitcoinProvider?.connect(e);
422
+ if (!n)
387
423
  throw new Error("Error fetching wallet data.");
388
- return e.addresses.map((s) => ({
424
+ return n.addresses.map((s) => ({
389
425
  address: s.address,
390
426
  pubkey: s.publicKey,
391
427
  purpose: s.purpose
392
428
  }));
393
429
  }
394
- async function V(n, e) {
430
+ async function ee(e, n, t) {
395
431
  if (!window.XverseProviders?.BitcoinProvider)
396
432
  throw new Error("Xverse extension not found.");
397
- const t = P({
398
- address: e,
399
- message: n,
433
+ const s = T({
434
+ address: t,
435
+ message: e,
400
436
  protocol: "BIP322",
401
437
  network: {
402
- type: m()
438
+ type: y()
403
439
  }
404
- }), s = await window.XverseProviders.BitcoinProvider.signMessage(t).catch(
405
- (o) => {
406
- throw console.error("Failed to sign message.", o), new Error("Failed to sign message.");
440
+ }), o = await window.XverseProviders.BitcoinProvider.signMessage(s).catch(
441
+ (i) => {
442
+ throw console.error("Failed to sign message.", i), new Error("Failed to sign message.");
407
443
  }
408
444
  );
409
- return p.from(s, "base64").toString("hex");
445
+ return p.from(o, "base64").toString("hex");
410
446
  }
411
- async function J(n) {
447
+ async function ne(e) {
412
448
  if (!window.XverseProviders?.BitcoinProvider)
413
449
  throw new Error("Xverse extension not found.");
414
- const e = S();
415
- if (!e)
450
+ const n = S();
451
+ if (!n)
416
452
  throw new Error("No payment wallet found.");
417
- const t = e.address, s = P({
453
+ const t = n.address, s = T({
418
454
  address: t,
419
- message: n,
455
+ message: e,
420
456
  protocol: "ECDSA",
421
457
  network: {
422
- type: m()
458
+ type: y()
423
459
  }
424
460
  }), o = await window.XverseProviders.BitcoinProvider.signMessage(s).catch(
425
461
  (i) => {
@@ -431,42 +467,42 @@ async function J(n) {
431
467
  address: t
432
468
  };
433
469
  }
434
- async function Q(n, e) {
470
+ async function te(e, n) {
435
471
  if (!window.XverseProviders?.BitcoinProvider)
436
472
  throw new Error("Xverse extension not found.");
437
473
  return (await window.XverseProviders.BitcoinProvider.request("sendTransfer", {
438
474
  recipients: [
439
475
  {
440
- address: e,
441
- amount: n
476
+ address: n,
477
+ amount: e
442
478
  }
443
479
  ]
444
480
  })).result.txid;
445
481
  }
446
- async function H(n, e, t, s) {
482
+ async function H(e, n, t, s) {
447
483
  if (!window.XverseProviders?.BitcoinProvider)
448
484
  throw new Error("Xverse extension not found.");
449
- const o = P({
485
+ const o = T({
450
486
  network: {
451
- type: m()
487
+ type: y()
452
488
  },
453
489
  message: s || "Sign Transaction",
454
- psbtBase64: n,
455
- broadcast: e,
490
+ psbtBase64: e,
491
+ broadcast: n,
456
492
  inputsToSign: t
457
493
  });
458
494
  return await window.XverseProviders.BitcoinProvider.signTransaction(o);
459
495
  }
460
- async function Y(n, e, t, s, o, i) {
461
- const r = l.Psbt.fromHex(n), a = [];
496
+ async function se(e, n, t, s, o, i) {
497
+ const r = l.Psbt.fromHex(e), a = [];
462
498
  for (let w = 0; w < r.inputCount; w++)
463
499
  i && i.includes(w) || s.includes(w) || a.push(w);
464
500
  const c = await H(
465
- x(n),
501
+ x(e),
466
502
  !1,
467
503
  [
468
504
  {
469
- address: e,
505
+ address: n,
470
506
  signingIndexes: a,
471
507
  sigHash: l.Transaction.SIGHASH_DEFAULT
472
508
  },
@@ -477,23 +513,23 @@ async function Y(n, e, t, s, o, i) {
477
513
  }
478
514
  ],
479
515
  "sign this pls"
480
- ), g = l.Psbt.fromBase64(c.psbtBase64);
481
- k(g, i);
482
- const u = g.extractTransaction(), f = u.toHex();
516
+ ), u = l.Psbt.fromBase64(c.psbtBase64);
517
+ b(u, i);
518
+ const g = u.extractTransaction(), f = g.toHex();
483
519
  return {
484
- txId: u.getId(),
520
+ txId: g.getId(),
485
521
  signedTxHex: f
486
522
  };
487
523
  }
488
- const Z = {
489
- getWallets: j,
490
- signMessage: V,
491
- signMessageDeterministic: J,
492
- sendBTC: Q,
524
+ const ie = {
525
+ getWallets: Z,
526
+ signMessage: ee,
527
+ signMessageDeterministic: ne,
528
+ sendBTC: te,
493
529
  signPSBT: H,
494
- sign: Y
530
+ sign: se
495
531
  };
496
- T("leather", I);
497
- T("okx", O);
498
- T("unisat", R);
499
- T("xverse", Z);
532
+ P("leather", A);
533
+ P("okx", _);
534
+ P("unisat", Y);
535
+ P("xverse", ie);