@sats-connect/core 0.4.0-8f3e1e5 → 0.4.0-8f77109

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.mjs CHANGED
@@ -1,6 +1,3 @@
1
- // src/provider/index.ts
2
- import omit from "lodash.omit";
3
-
4
1
  // src/provider/types.ts
5
2
  import * as v from "valibot";
6
3
  var accountChangeEventName = "accountChange";
@@ -30,8 +27,7 @@ async function getProviderOrThrow(getProvider) {
30
27
  return provider;
31
28
  }
32
29
  function getProviders() {
33
- if (!window.btc_providers)
34
- window.btc_providers = [];
30
+ if (!window.btc_providers) window.btc_providers = [];
35
31
  return window.btc_providers;
36
32
  }
37
33
  function getProviderById(providerId) {
@@ -50,12 +46,7 @@ function removeDefaultProvider() {
50
46
  localStorage.removeItem("sats-connect_defaultProvider");
51
47
  }
52
48
  function getSupportedWallets() {
53
- const btc_providers = getProviders();
54
- const allProviders = [...btc_providers];
55
- for (const key in omit(DefaultAdaptersInfo, ["xverse"])) {
56
- allProviders.push(DefaultAdaptersInfo[key]);
57
- }
58
- const wallets = allProviders.map((provider) => {
49
+ const wallets = Object.values(DefaultAdaptersInfo).map((provider) => {
59
50
  {
60
51
  return {
61
52
  ...provider,
@@ -68,11 +59,11 @@ function getSupportedWallets() {
68
59
 
69
60
  // src/types.ts
70
61
  import * as v2 from "valibot";
71
- var BitcoinNetworkType = /* @__PURE__ */ ((BitcoinNetworkType3) => {
72
- BitcoinNetworkType3["Mainnet"] = "Mainnet";
73
- BitcoinNetworkType3["Testnet"] = "Testnet";
74
- BitcoinNetworkType3["Signet"] = "Signet";
75
- return BitcoinNetworkType3;
62
+ var BitcoinNetworkType = /* @__PURE__ */ ((BitcoinNetworkType2) => {
63
+ BitcoinNetworkType2["Mainnet"] = "Mainnet";
64
+ BitcoinNetworkType2["Testnet"] = "Testnet";
65
+ BitcoinNetworkType2["Signet"] = "Signet";
66
+ return BitcoinNetworkType2;
76
67
  })(BitcoinNetworkType || {});
77
68
  var RpcIdSchema = v2.optional(v2.union([v2.string(), v2.number(), v2.null()]));
78
69
  var rpcRequestMessageSchema = v2.object({
@@ -89,7 +80,7 @@ var rpcRequestMessageSchema = v2.object({
89
80
  v2.null()
90
81
  ])
91
82
  ),
92
- id: RpcIdSchema
83
+ id: v2.unwrap(RpcIdSchema)
93
84
  });
94
85
  var RpcErrorCode = /* @__PURE__ */ ((RpcErrorCode2) => {
95
86
  RpcErrorCode2[RpcErrorCode2["PARSE_ERROR"] = -32700] = "PARSE_ERROR";
@@ -118,13 +109,127 @@ var rpcResponseMessageSchema = v2.union([
118
109
  ]);
119
110
 
120
111
  // src/request/index.ts
121
- import * as v10 from "valibot";
112
+ import * as v20 from "valibot";
113
+
114
+ // src/request/types/stxMethods/callContract.ts
115
+ import * as v3 from "valibot";
116
+ var stxCallContractMethodName = "stx_callContract";
117
+ var stxCallContractParamsSchema = v3.object({
118
+ /**
119
+ * The contract principal.
120
+ *
121
+ * E.g. `"SPKE...GD5C.my-contract"`
122
+ */
123
+ contract: v3.string(),
124
+ /**
125
+ * The name of the function to call.
126
+ *
127
+ * Note: spec changes ongoing,
128
+ * https://github.com/stacksgov/sips/pull/166#pullrequestreview-1914236999
129
+ */
130
+ functionName: v3.string(),
131
+ /**
132
+ * The function's arguments. The arguments are expected to be hex-encoded
133
+ * strings of Clarity values.
134
+ *
135
+ * To convert Clarity values to their hex representation, the `cvToString`
136
+ * helper from the `@stacks/transactions` package may be helpful.
137
+ *
138
+ * ```js
139
+ * import { cvToString } from '@stacks/transactions';
140
+ *
141
+ * const functionArgs = [someClarityValue1, someClarityValue2];
142
+ * const hexArgs = functionArgs.map(cvToString);
143
+ * ```
144
+ */
145
+ arguments: v3.optional(v3.array(v3.string()))
146
+ });
147
+ var stxCallContractResultSchema = v3.object({
148
+ /**
149
+ * The ID of the transaction.
150
+ */
151
+ txid: v3.string(),
152
+ /**
153
+ * A Stacks transaction as a hex-encoded string.
154
+ */
155
+ transaction: v3.string()
156
+ });
157
+ var stxCallContractRequestMessageSchema = v3.object({
158
+ ...rpcRequestMessageSchema.entries,
159
+ ...v3.object({
160
+ method: v3.literal(stxCallContractMethodName),
161
+ params: stxCallContractParamsSchema,
162
+ id: v3.string()
163
+ }).entries
164
+ });
165
+
166
+ // src/request/types/stxMethods/deployContract.ts
167
+ import * as v4 from "valibot";
168
+ var stxDeployContractMethodName = "stx_deployContract";
169
+ var stxDeployContractParamsSchema = v4.object({
170
+ /**
171
+ * Name of the contract.
172
+ */
173
+ name: v4.string(),
174
+ /**
175
+ * The source code of the Clarity contract.
176
+ */
177
+ clarityCode: v4.string(),
178
+ /**
179
+ * The version of the Clarity contract.
180
+ */
181
+ clarityVersion: v4.optional(v4.string())
182
+ });
183
+ var stxDeployContractResultSchema = v4.object({
184
+ /**
185
+ * The ID of the transaction.
186
+ */
187
+ txid: v4.string(),
188
+ /**
189
+ * A Stacks transaction as a hex-encoded string.
190
+ */
191
+ transaction: v4.string()
192
+ });
193
+ var stxDeployContractRequestMessageSchema = v4.object({
194
+ ...rpcRequestMessageSchema.entries,
195
+ ...v4.object({
196
+ method: v4.literal(stxDeployContractMethodName),
197
+ params: stxDeployContractParamsSchema,
198
+ id: v4.string()
199
+ }).entries
200
+ });
201
+
202
+ // src/request/types/stxMethods/getAccounts.ts
203
+ import * as v5 from "valibot";
204
+ var stxGetAccountsMethodName = "stx_getAccounts";
205
+ var stxGetAccountsParamsSchema = v5.nullish(v5.null());
206
+ var stxGetAccountsResultSchema = v5.object({
207
+ /**
208
+ * The addresses generated for the given purposes.
209
+ */
210
+ addresses: v5.array(
211
+ v5.object({
212
+ address: v5.string(),
213
+ publicKey: v5.string(),
214
+ gaiaHubUrl: v5.string(),
215
+ gaiaAppKey: v5.string()
216
+ })
217
+ )
218
+ });
219
+ var stxGetAccountsRequestMessageSchema = v5.object({
220
+ ...rpcRequestMessageSchema.entries,
221
+ ...v5.object({
222
+ method: v5.literal(stxGetAccountsMethodName),
223
+ params: stxGetAccountsParamsSchema,
224
+ id: v5.string()
225
+ }).entries
226
+ });
122
227
 
123
228
  // src/addresses/index.ts
124
229
  import { createUnsecuredToken } from "jsontokens";
125
230
 
126
231
  // src/addresses/types.ts
127
- import * as v3 from "valibot";
232
+ import * as v6 from "valibot";
128
233
  var AddressPurpose = /* @__PURE__ */ ((AddressPurpose2) => {
129
234
  AddressPurpose2["Ordinals"] = "ordinals";
130
235
  AddressPurpose2["Payment"] = "payment";
@@ -140,11 +245,11 @@ var AddressType = /* @__PURE__ */ ((AddressType3) => {
140
245
  AddressType3["stacks"] = "stacks";
141
246
  return AddressType3;
142
247
  })(AddressType || {});
143
- var addressSchema = v3.object({
144
- address: v3.string(),
145
- publicKey: v3.string(),
146
- purpose: v3.enum(AddressPurpose),
147
- addressType: v3.enum(AddressType)
248
+ var addressSchema = v6.object({
249
+ address: v6.string(),
250
+ publicKey: v6.string(),
251
+ purpose: v6.enum(AddressPurpose),
252
+ addressType: v6.enum(AddressType)
148
253
  });
149
254
 
150
255
  // src/addresses/index.ts
@@ -164,119 +269,269 @@ var getAddress = async (options) => {
164
269
  }
165
270
  };
166
271
 
167
- // src/request/types/stxMethods.ts
168
- import * as v4 from "valibot";
272
+ // src/request/types/stxMethods/getAddresses.ts
273
+ import * as v7 from "valibot";
169
274
  var stxGetAddressesMethodName = "stx_getAddresses";
170
- var stxGetAddressesParamsSchema = v4.nullish(
171
- v4.object({
275
+ var stxGetAddressesParamsSchema = v7.nullish(
276
+ v7.object({
172
277
  /**
173
278
  * A message to be displayed to the user in the request prompt.
174
279
  */
175
- message: v4.optional(v4.string())
280
+ message: v7.optional(v7.string())
176
281
  })
177
282
  );
178
- var stxGetAddressesResultSchema = v4.object({
283
+ var stxGetAddressesResultSchema = v7.object({
179
284
  /**
180
285
  * The addresses generated for the given purposes.
181
286
  */
182
- addresses: v4.array(addressSchema)
287
+ addresses: v7.array(addressSchema)
183
288
  });
184
- var stxGetAddressesRequestMessageSchema = v4.object({
289
+ var stxGetAddressesRequestMessageSchema = v7.object({
185
290
  ...rpcRequestMessageSchema.entries,
186
- ...v4.object({
187
- method: v4.literal(stxGetAddressesMethodName),
291
+ ...v7.object({
292
+ method: v7.literal(stxGetAddressesMethodName),
188
293
  params: stxGetAddressesParamsSchema,
189
- id: v4.string()
294
+ id: v7.string()
295
+ }).entries
296
+ });
297
+
298
+ // src/request/types/stxMethods/signMessage.ts
299
+ import * as v8 from "valibot";
300
+ var stxSignMessageMethodName = "stx_signMessage";
301
+ var stxSignMessageParamsSchema = v8.object({
302
+ /**
303
+ * The message to sign.
304
+ */
305
+ message: v8.string(),
306
+ /**
307
+ * The public key to sign the message with.
308
+ */
309
+ publicKey: v8.string(),
310
+ /**
311
+ * The format version of the parameter.
312
+ */
313
+ parameterFormatVersion: v8.optional(v8.number())
314
+ });
315
+ var stxSignMessageResultSchema = v8.object({
316
+ /**
317
+ * The signature of the message.
318
+ */
319
+ signature: v8.string(),
320
+ /**
321
+ * The public key used to sign the message.
322
+ */
323
+ publicKey: v8.string()
324
+ });
325
+ var stxSignMessageRequestMessageSchema = v8.object({
326
+ ...rpcRequestMessageSchema.entries,
327
+ ...v8.object({
328
+ method: v8.literal(stxSignMessageMethodName),
329
+ params: stxSignMessageParamsSchema,
330
+ id: v8.string()
190
331
  }).entries
191
332
  });
333
+
334
+ // src/request/types/stxMethods/signStructuredMessage.ts
335
+ import * as v9 from "valibot";
336
+ var stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
337
+ var stxSignStructuredMessageParamsSchema = v9.object({
338
+ /**
339
+ * The domain to be signed.
340
+ */
341
+ domain: v9.string(),
342
+ /**
343
+ * Message payload to be signed.
344
+ */
345
+ message: v9.string(),
346
+ /**
347
+ * The format version of the parameter.
348
+ */
349
+ parameterFormatVersion: v9.optional(v9.number()),
350
+ /**
351
+ * The public key to sign the message with.
352
+ */
353
+ publicKey: v9.optional(v9.string())
354
+ });
355
+ var stxSignStructuredMessageResultSchema = v9.object({
356
+ /**
357
+ * Signature of the message.
358
+ */
359
+ signature: v9.string(),
360
+ /**
361
+ * Public key as hex-encoded string.
362
+ */
363
+ publicKey: v9.string()
364
+ });
365
+ var stxSignStructuredMessageRequestMessageSchema = v9.object({
366
+ ...rpcRequestMessageSchema.entries,
367
+ ...v9.object({
368
+ method: v9.literal(stxSignStructuredMessageMethodName),
369
+ params: stxSignStructuredMessageParamsSchema,
370
+ id: v9.string()
371
+ }).entries
372
+ });
373
+
374
+ // src/request/types/stxMethods/signTransaction.ts
375
+ import * as v10 from "valibot";
192
376
  var stxSignTransactionMethodName = "stx_signTransaction";
193
- var stxSignTransactionParamsSchema = v4.object({
377
+ var stxSignTransactionParamsSchema = v10.object({
194
378
  /**
195
379
  * The transaction to sign as a hex-encoded string.
196
380
  */
197
- transaction: v4.string(),
381
+ transaction: v10.string(),
198
382
  /**
199
383
  * The public key to sign the transaction with. The wallet may use any key
200
384
  * when not provided.
201
385
  */
202
- pubkey: v4.optional(v4.string()),
386
+ pubkey: v10.optional(v10.string()),
203
387
  /**
204
388
  * Whether to broadcast the transaction after signing. Defaults to `true`.
205
389
  */
206
- broadcast: v4.optional(v4.boolean())
390
+ broadcast: v10.optional(v10.boolean())
207
391
  });
208
- var stxSignTransactionResultSchema = v4.object({
392
+ var stxSignTransactionResultSchema = v10.object({
209
393
  /**
210
394
  * The signed transaction as a hex-encoded string.
211
395
  */
212
- transaction: v4.string()
396
+ transaction: v10.string()
213
397
  });
214
- var stxSignTransactionRequestMessageSchema = v4.object({
398
+ var stxSignTransactionRequestMessageSchema = v10.object({
215
399
  ...rpcRequestMessageSchema.entries,
216
- ...v4.object({
217
- method: v4.literal(stxSignTransactionMethodName),
400
+ ...v10.object({
401
+ method: v10.literal(stxSignTransactionMethodName),
218
402
  params: stxSignTransactionParamsSchema,
219
- id: v4.string()
403
+ id: v10.string()
404
+ }).entries
405
+ });
406
+
407
+ // src/request/types/stxMethods/transferStx.ts
408
+ import * as v11 from "valibot";
409
+ var stxTransferStxMethodName = "stx_transferStx";
410
+ var stxTransferStxParamsSchema = v11.object({
411
+ /**
412
+ * Amount of STX tokens to transfer in microstacks as a string. Anything
413
+ * parseable by `BigInt` is acceptable.
414
+ *
415
+ * Example,
416
+ *
417
+ * ```js
418
+ * const amount1 = 1234;
419
+ * const amount2 = 1234n;
420
+ * const amount3 = '1234';
421
+ * ```
422
+ */
423
+ amount: v11.union([v11.number(), v11.string()]),
424
+ /**
425
+ * The recipeint's principal.
426
+ */
427
+ recipient: v11.string(),
428
+ /**
429
+ * A string representing the memo.
430
+ */
431
+ memo: v11.optional(v11.string()),
432
+ /**
433
+ * Version of parameter format.
434
+ */
435
+ version: v11.optional(v11.string()),
436
+ /**
437
+ * The mode of the post conditions.
438
+ */
439
+ postConditionMode: v11.optional(v11.number()),
440
+ /**
441
+ * A hex-encoded string representing the post conditions.
442
+ *
443
+ * A post condition may be converted to it's hex representation using the `serializePostCondition` helper from the `@stacks/transactions` package,
444
+ *
445
+ * ```js
446
+ * import { serializePostCondition } from '@stacks/transactions';
447
+ *
448
+ * const postCondition = somePostCondition;
449
+ * const hexPostCondition = serializePostCondition(postCondition).toString('hex');
450
+ * ```
451
+ */
452
+ postConditions: v11.optional(v11.array(v11.string())),
453
+ /**
454
+ * The public key to sign the transaction with. The wallet may use any key
455
+ * when not provided.
456
+ */
457
+ pubkey: v11.optional(v11.string())
458
+ });
459
+ var stxTransferStxResultSchema = v11.object({
460
+ /**
461
+ * The ID of the transaction.
462
+ */
463
+ txid: v11.string(),
464
+ /**
465
+ * A Stacks transaction as a hex-encoded string.
466
+ */
467
+ transaction: v11.string()
468
+ });
469
+ var stxTransferStxRequestMessageSchema = v11.object({
470
+ ...rpcRequestMessageSchema.entries,
471
+ ...v11.object({
472
+ method: v11.literal(stxTransferStxMethodName),
473
+ params: stxTransferStxParamsSchema,
474
+ id: v11.string()
220
475
  }).entries
221
476
  });
222
477
 
223
478
  // src/request/types/btcMethods.ts
224
- import * as v6 from "valibot";
479
+ import * as v13 from "valibot";
225
480
 
226
481
  // src/request/types/common.ts
227
- import * as v5 from "valibot";
482
+ import * as v12 from "valibot";
228
483
  var walletTypes = ["software", "ledger"];
229
- var walletTypeSchema = v5.picklist(walletTypes);
484
+ var walletTypeSchema = v12.picklist(walletTypes);
230
485
 
231
486
  // src/request/types/btcMethods.ts
232
487
  var getInfoMethodName = "getInfo";
233
- var getInfoParamsSchema = v6.nullish(v6.null());
234
- var getInfoResultSchema = v6.object({
488
+ var getInfoParamsSchema = v13.nullish(v13.null());
489
+ var getInfoResultSchema = v13.object({
235
490
  /**
236
491
  * Version of the wallet.
237
492
  */
238
- version: v6.string(),
493
+ version: v13.string(),
239
494
  /**
240
495
  * [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
241
496
  */
242
- methods: v6.optional(v6.array(v6.string())),
497
+ methods: v13.optional(v13.array(v13.string())),
243
498
  /**
244
499
  * List of WBIP standards supported by the wallet. Not currently used.
245
500
  */
246
- supports: v6.array(v6.string())
501
+ supports: v13.array(v13.string())
247
502
  });
248
- var getInfoRequestMessageSchema = v6.object({
503
+ var getInfoRequestMessageSchema = v13.object({
249
504
  ...rpcRequestMessageSchema.entries,
250
- ...v6.object({
251
- method: v6.literal(getInfoMethodName),
505
+ ...v13.object({
506
+ method: v13.literal(getInfoMethodName),
252
507
  params: getInfoParamsSchema,
253
- id: v6.string()
508
+ id: v13.string()
254
509
  }).entries
255
510
  });
256
511
  var getAddressesMethodName = "getAddresses";
257
- var getAddressesParamsSchema = v6.object({
512
+ var getAddressesParamsSchema = v13.object({
258
513
  /**
259
514
  * The purposes for which to generate addresses. See
260
515
  * {@linkcode AddressPurpose} for available purposes.
261
516
  */
262
- purposes: v6.array(v6.enum(AddressPurpose)),
517
+ purposes: v13.array(v13.enum(AddressPurpose)),
263
518
  /**
264
519
  * A message to be displayed to the user in the request prompt.
265
520
  */
266
- message: v6.optional(v6.string())
521
+ message: v13.optional(v13.string())
267
522
  });
268
- var getAddressesResultSchema = v6.object({
523
+ var getAddressesResultSchema = v13.object({
269
524
  /**
270
525
  * The addresses generated for the given purposes.
271
526
  */
272
- addresses: v6.array(addressSchema)
527
+ addresses: v13.array(addressSchema)
273
528
  });
274
- var getAddressesRequestMessageSchema = v6.object({
529
+ var getAddressesRequestMessageSchema = v13.object({
275
530
  ...rpcRequestMessageSchema.entries,
276
- ...v6.object({
277
- method: v6.literal(getAddressesMethodName),
531
+ ...v13.object({
532
+ method: v13.literal(getAddressesMethodName),
278
533
  params: getAddressesParamsSchema,
279
- id: v6.string()
534
+ id: v13.string()
280
535
  }).entries
281
536
  });
282
537
  var signMessageMethodName = "signMessage";
@@ -285,318 +540,456 @@ var MessageSigningProtocols = /* @__PURE__ */ ((MessageSigningProtocols2) => {
285
540
  MessageSigningProtocols2["BIP322"] = "BIP322";
286
541
  return MessageSigningProtocols2;
287
542
  })(MessageSigningProtocols || {});
288
- var signMessageParamsSchema = v6.object({
543
+ var signMessageParamsSchema = v13.object({
289
544
  /**
290
545
  * The address used for signing.
291
546
  **/
292
- address: v6.string(),
547
+ address: v13.string(),
293
548
  /**
294
549
  * The message to sign.
295
550
  **/
296
- message: v6.string(),
551
+ message: v13.string(),
297
552
  /**
298
553
  * The protocol to use for signing the message.
299
554
  */
300
- protocol: v6.optional(v6.enum(MessageSigningProtocols))
555
+ protocol: v13.optional(v13.enum(MessageSigningProtocols))
301
556
  });
302
- var signMessageResultSchema = v6.object({
557
+ var signMessageResultSchema = v13.object({
303
558
  /**
304
559
  * The signature of the message.
305
560
  */
306
- signature: v6.string(),
561
+ signature: v13.string(),
307
562
  /**
308
563
  * hash of the message.
309
564
  */
310
- messageHash: v6.string(),
565
+ messageHash: v13.string(),
311
566
  /**
312
567
  * The address used for signing.
313
568
  */
314
- address: v6.string(),
569
+ address: v13.string(),
315
570
  /**
316
571
  * The protocol to use for signing the message.
317
572
  */
318
- protocol: v6.enum(MessageSigningProtocols)
573
+ protocol: v13.enum(MessageSigningProtocols)
319
574
  });
320
- var signMessageRequestMessageSchema = v6.object({
575
+ var signMessageRequestMessageSchema = v13.object({
321
576
  ...rpcRequestMessageSchema.entries,
322
- ...v6.object({
323
- method: v6.literal(signMessageMethodName),
577
+ ...v13.object({
578
+ method: v13.literal(signMessageMethodName),
324
579
  params: signMessageParamsSchema,
325
- id: v6.string()
580
+ id: v13.string()
581
+ }).entries
582
+ });
583
+ var sendTransferMethodName = "sendTransfer";
584
+ var sendTransferParamsSchema = v13.object({
585
+ /**
586
+ * Array of recipients to send to.
587
+ * The amount to send to each recipient is in satoshis.
588
+ */
589
+ recipients: v13.array(
590
+ v13.object({
591
+ address: v13.string(),
592
+ amount: v13.number()
593
+ })
594
+ )
595
+ });
596
+ var sendTransferResultSchema = v13.object({
597
+ /**
598
+ * The transaction id as a hex-encoded string.
599
+ */
600
+ txid: v13.string()
601
+ });
602
+ var sendTransferRequestMessageSchema = v13.object({
603
+ ...rpcRequestMessageSchema.entries,
604
+ ...v13.object({
605
+ method: v13.literal(sendTransferMethodName),
606
+ params: sendTransferParamsSchema,
607
+ id: v13.string()
608
+ }).entries
609
+ });
610
+ var signPsbtMethodName = "signPsbt";
611
+ var signPsbtParamsSchema = v13.object({
612
+ /**
613
+ * The base64 encoded PSBT to sign.
614
+ */
615
+ psbt: v13.string(),
616
+ /**
617
+ * The inputs to sign.
618
+ * The key is the address and the value is an array of indexes of the inputs to sign.
619
+ */
620
+ signInputs: v13.record(v13.string(), v13.array(v13.number())),
621
+ /**
622
+ * Whether to broadcast the transaction after signing.
623
+ **/
624
+ broadcast: v13.optional(v13.boolean())
625
+ });
626
+ var signPsbtResultSchema = v13.object({
627
+ /**
628
+ * The base64 encoded PSBT after signing.
629
+ */
630
+ psbt: v13.string(),
631
+ /**
632
+ * The transaction id as a hex-encoded string.
633
+ * This is only returned if the transaction was broadcast.
634
+ **/
635
+ txid: v13.optional(v13.string())
636
+ });
637
+ var signPsbtRequestMessageSchema = v13.object({
638
+ ...rpcRequestMessageSchema.entries,
639
+ ...v13.object({
640
+ method: v13.literal(signPsbtMethodName),
641
+ params: signPsbtParamsSchema,
642
+ id: v13.string()
326
643
  }).entries
327
644
  });
328
645
  var getAccountsMethodName = "getAccounts";
329
- var getAccountsParamsSchema = v6.object({
646
+ var getAccountsParamsSchema = v13.object({
330
647
  /**
331
648
  * The purposes for which to generate addresses. See
332
649
  * {@linkcode AddressPurpose} for available purposes.
333
650
  */
334
- purposes: v6.array(v6.enum(AddressPurpose)),
651
+ purposes: v13.array(v13.enum(AddressPurpose)),
335
652
  /**
336
653
  * A message to be displayed to the user in the request prompt.
337
654
  */
338
- message: v6.optional(v6.string())
655
+ message: v13.optional(v13.string())
339
656
  });
340
- var getAccountsResultSchema = v6.array(
341
- v6.object({
657
+ var getAccountsResultSchema = v13.array(
658
+ v13.object({
342
659
  ...addressSchema.entries,
343
- ...v6.object({
660
+ ...v13.object({
344
661
  walletType: walletTypeSchema
345
662
  }).entries
346
663
  })
347
664
  );
348
- var getAccountsRequestMessageSchema = v6.object({
665
+ var getAccountsRequestMessageSchema = v13.object({
349
666
  ...rpcRequestMessageSchema.entries,
350
- ...v6.object({
351
- method: v6.literal(getAccountsMethodName),
667
+ ...v13.object({
668
+ method: v13.literal(getAccountsMethodName),
352
669
  params: getAccountsParamsSchema,
353
- id: v6.string()
670
+ id: v13.string()
354
671
  }).entries
355
672
  });
356
673
  var getBalanceMethodName = "getBalance";
357
- var getBalanceParamsSchema = v6.nullish(v6.null());
358
- var getBalanceResultSchema = v6.object({
674
+ var getBalanceParamsSchema = v13.nullish(v13.null());
675
+ var getBalanceResultSchema = v13.object({
359
676
  /**
360
677
  * The confirmed balance of the wallet in sats. Using a string due to chrome
361
678
  * messages not supporting bigint
362
679
  * (https://issues.chromium.org/issues/40116184).
363
680
  */
364
- confirmed: v6.string(),
681
+ confirmed: v13.string(),
365
682
  /**
366
683
  * The unconfirmed balance of the wallet in sats. Using a string due to chrome
367
684
  * messages not supporting bigint
368
685
  * (https://issues.chromium.org/issues/40116184).
369
686
  */
370
- unconfirmed: v6.string(),
687
+ unconfirmed: v13.string(),
371
688
  /**
372
689
  * The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
373
690
  * sats. Using a string due to chrome messages not supporting bigint
374
691
  * (https://issues.chromium.org/issues/40116184).
375
692
  */
376
- total: v6.string()
693
+ total: v13.string()
377
694
  });
378
- var getBalanceRequestMessageSchema = v6.object({
695
+ var getBalanceRequestMessageSchema = v13.object({
379
696
  ...rpcRequestMessageSchema.entries,
380
- ...v6.object({
381
- method: v6.literal(getBalanceMethodName),
382
- id: v6.string()
697
+ ...v13.object({
698
+ method: v13.literal(getBalanceMethodName),
699
+ id: v13.string()
383
700
  }).entries
384
701
  });
385
702
 
386
703
  // src/request/types/walletMethods.ts
387
- import * as v7 from "valibot";
388
- import { permissions } from "@secretkeylabs/xverse-core";
389
- var permissionTemplate = v7.variant("type", [
390
- v7.object({
391
- ...v7.omit(permissions.resources.account.accountPermissionSchema, ["clientId", "actions"]).entries,
392
- actions: v7.partial(permissions.resources.account.accountActionsSchema)
704
+ import * as v14 from "valibot";
705
+ var accountActionsSchema = v14.object({
706
+ read: v14.optional(v14.boolean())
707
+ });
708
+ var walletActionsSchema = v14.object({});
709
+ var accountPermissionSchema = v14.object({
710
+ type: v14.literal("account"),
711
+ resourceId: v14.string(),
712
+ clientId: v14.string(),
713
+ actions: accountActionsSchema
714
+ });
715
+ var walletPermissionSchema = v14.object({
716
+ type: v14.literal("wallet"),
717
+ resourceId: v14.string(),
718
+ clientId: v14.string(),
719
+ actions: walletActionsSchema
720
+ });
721
+ var PermissionRequestParams = v14.variant("type", [
722
+ v14.object({
723
+ ...v14.omit(accountPermissionSchema, ["clientId"]).entries
393
724
  }),
394
- v7.object({
395
- ...v7.omit(permissions.resources.wallet.walletPermissionSchema, ["clientId"]).entries,
396
- actions: v7.partial(permissions.resources.wallet.walletActionsSchema)
725
+ v14.object({
726
+ ...v14.omit(walletPermissionSchema, ["clientId"]).entries
397
727
  })
398
728
  ]);
729
+ var permission = v14.variant("type", [accountPermissionSchema, walletPermissionSchema]);
399
730
  var requestPermissionsMethodName = "wallet_requestPermissions";
400
- var requestPermissionsParamsSchema = v7.nullish(v7.array(permissionTemplate));
401
- var requestPermissionsResultSchema = v7.literal(true);
402
- var requestPermissionsRequestMessageSchema = v7.object({
731
+ var requestPermissionsParamsSchema = v14.nullish(v14.array(PermissionRequestParams));
732
+ var requestPermissionsResultSchema = v14.literal(true);
733
+ var requestPermissionsRequestMessageSchema = v14.object({
403
734
  ...rpcRequestMessageSchema.entries,
404
- ...v7.object({
405
- method: v7.literal(requestPermissionsMethodName),
735
+ ...v14.object({
736
+ method: v14.literal(requestPermissionsMethodName),
406
737
  params: requestPermissionsParamsSchema,
407
- id: v7.string()
738
+ id: v14.string()
408
739
  }).entries
409
740
  });
410
741
  var renouncePermissionsMethodName = "wallet_renouncePermissions";
411
- var renouncePermissionsParamsSchema = v7.nullish(v7.null());
412
- var renouncePermissionsResultSchema = v7.nullish(v7.null());
413
- var renouncePermissionsRequestMessageSchema = v7.object({
742
+ var renouncePermissionsParamsSchema = v14.nullish(v14.null());
743
+ var renouncePermissionsResultSchema = v14.nullish(v14.null());
744
+ var renouncePermissionsRequestMessageSchema = v14.object({
414
745
  ...rpcRequestMessageSchema.entries,
415
- ...v7.object({
416
- method: v7.literal(renouncePermissionsMethodName),
746
+ ...v14.object({
747
+ method: v14.literal(renouncePermissionsMethodName),
417
748
  params: renouncePermissionsParamsSchema,
418
- id: v7.string()
749
+ id: v14.string()
419
750
  }).entries
420
751
  });
421
752
  var disconnectMethodName = "wallet_disconnect";
422
- var disconnectParamsSchema = v7.nullish(v7.null());
423
- var disconnectResultSchema = v7.nullish(v7.null());
424
- var disconnectRequestMessageSchema = v7.object({
753
+ var disconnectParamsSchema = v14.nullish(v14.null());
754
+ var disconnectResultSchema = v14.nullish(v14.null());
755
+ var disconnectRequestMessageSchema = v14.object({
425
756
  ...rpcRequestMessageSchema.entries,
426
- ...v7.object({
427
- method: v7.literal(disconnectMethodName),
757
+ ...v14.object({
758
+ method: v14.literal(disconnectMethodName),
428
759
  params: disconnectParamsSchema,
429
- id: v7.string()
760
+ id: v14.string()
430
761
  }).entries
431
762
  });
432
763
  var getWalletTypeMethodName = "wallet_getWalletType";
433
- var getWalletTypeParamsSchema = v7.nullish(v7.null());
764
+ var getWalletTypeParamsSchema = v14.nullish(v14.null());
434
765
  var getWalletTypeResultSchema = walletTypeSchema;
435
- var getWalletTypeRequestMessageSchema = v7.object({
766
+ var getWalletTypeRequestMessageSchema = v14.object({
436
767
  ...rpcRequestMessageSchema.entries,
437
- ...v7.object({
438
- method: v7.literal(getWalletTypeMethodName),
768
+ ...v14.object({
769
+ method: v14.literal(getWalletTypeMethodName),
439
770
  params: getWalletTypeParamsSchema,
440
- id: v7.string()
771
+ id: v14.string()
441
772
  }).entries
442
773
  });
443
774
  var getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
444
- var getCurrentPermissionsParamsSchema = v7.nullish(v7.null());
445
- var getCurrentPermissionsResultSchema = v7.array(permissions.store.permission);
446
- var getCurrentPermissionsRequestMessageSchema = v7.object({
775
+ var getCurrentPermissionsParamsSchema = v14.nullish(v14.null());
776
+ var getCurrentPermissionsResultSchema = v14.array(permission);
777
+ var getCurrentPermissionsRequestMessageSchema = v14.object({
447
778
  ...rpcRequestMessageSchema.entries,
448
- ...v7.object({
449
- method: v7.literal(getCurrentPermissionsMethodName),
779
+ ...v14.object({
780
+ method: v14.literal(getCurrentPermissionsMethodName),
450
781
  params: getCurrentPermissionsParamsSchema,
451
- id: v7.string()
782
+ id: v14.string()
452
783
  }).entries
453
784
  });
454
785
  var getAccountMethodName = "wallet_getAccount";
455
- var getAccountParamsSchema = v7.nullish(v7.null());
456
- var getAccountResultSchema = v7.object({
457
- id: permissions.utils.account.accountIdSchema,
458
- addresses: v7.array(addressSchema),
786
+ var getAccountParamsSchema = v14.nullish(v14.null());
787
+ var getAccountResultSchema = v14.object({
788
+ id: v14.string(),
789
+ addresses: v14.array(addressSchema),
459
790
  walletType: walletTypeSchema
460
791
  });
461
- var getAccountRequestMessageSchema = v7.object({
792
+ var getAccountRequestMessageSchema = v14.object({
462
793
  ...rpcRequestMessageSchema.entries,
463
- ...v7.object({
464
- method: v7.literal(getAccountMethodName),
794
+ ...v14.object({
795
+ method: v14.literal(getAccountMethodName),
465
796
  params: getAccountParamsSchema,
466
- id: v7.string()
467
- }).entries
468
- });
469
- var registerClientMethodName = "wallet_registerClient";
470
- var registerClientParamsSchema = v7.object({
471
- name: v7.optional(v7.string()),
472
- description: v7.optional(v7.string())
473
- });
474
- var registerClientResultSchema = v7.object({
475
- id: v7.string()
476
- });
477
- var registerClientRequestMessageSchema = v7.object({
478
- ...rpcRequestMessageSchema.entries,
479
- ...v7.object({
480
- method: v7.literal(registerClientMethodName),
481
- params: registerClientParamsSchema,
482
- id: v7.string()
797
+ id: v14.string()
483
798
  }).entries
484
799
  });
485
800
  var connectMethodName = "wallet_connect";
486
- var connectParamsSchema = v7.nullish(
487
- v7.object({
488
- permissions: v7.optional(v7.array(permissionTemplate)),
489
- clientInfo: registerClientParamsSchema
801
+ var connectParamsSchema = v14.nullish(
802
+ v14.object({
803
+ permissions: v14.optional(v14.array(PermissionRequestParams)),
804
+ addresses: v14.optional(v14.array(v14.enum(AddressPurpose))),
805
+ message: v14.optional(
806
+ v14.pipe(v14.string(), v14.maxLength(80, "The message must not exceed 80 characters."))
807
+ )
490
808
  })
491
809
  );
492
810
  var connectResultSchema = getAccountResultSchema;
493
- var connectRequestMessageSchema = v7.object({
811
+ var connectRequestMessageSchema = v14.object({
494
812
  ...rpcRequestMessageSchema.entries,
495
- ...v7.object({
496
- method: v7.literal(connectMethodName),
813
+ ...v14.object({
814
+ method: v14.literal(connectMethodName),
497
815
  params: connectParamsSchema,
498
- id: v7.string()
816
+ id: v14.string()
499
817
  }).entries
500
818
  });
501
819
 
502
- // src/request/types/runesMethods.ts
503
- import * as v8 from "valibot";
504
- var getRunesBalanceMethodName = "runes_getBalance";
505
- var getRunesBalanceParamsSchema = v8.nullish(v8.null());
506
- var getRunesBalanceResultSchema = v8.object({
507
- balances: v8.array(
508
- v8.object({
509
- runeName: v8.string(),
510
- amount: v8.string(),
511
- divisibility: v8.number(),
512
- symbol: v8.string(),
513
- inscriptionId: v8.nullish(v8.string())
820
+ // src/request/types/runesMethods/etch.ts
821
+ import * as v15 from "valibot";
822
+ var runesEtchMethodName = "runes_etch";
823
+ var etchTermsSchema = v15.object({
824
+ amount: v15.string(),
825
+ cap: v15.string(),
826
+ heightStart: v15.optional(v15.string()),
827
+ heightEnd: v15.optional(v15.string()),
828
+ offsetStart: v15.optional(v15.string()),
829
+ offsetEnd: v15.optional(v15.string())
830
+ });
831
+ var inscriptionDetailsSchema = v15.object({
832
+ contentType: v15.string(),
833
+ contentBase64: v15.string()
834
+ });
835
+ var runesEtchParamsSchema = v15.object({
836
+ runeName: v15.string(),
837
+ divisibility: v15.optional(v15.number()),
838
+ symbol: v15.optional(v15.string()),
839
+ premine: v15.optional(v15.string()),
840
+ isMintable: v15.boolean(),
841
+ delegateInscriptionId: v15.optional(v15.string()),
842
+ destinationAddress: v15.string(),
843
+ refundAddress: v15.string(),
844
+ feeRate: v15.number(),
845
+ appServiceFee: v15.optional(v15.number()),
846
+ appServiceFeeAddress: v15.optional(v15.string()),
847
+ terms: v15.optional(etchTermsSchema),
848
+ inscriptionDetails: v15.optional(inscriptionDetailsSchema),
849
+ network: v15.optional(v15.enum(BitcoinNetworkType))
850
+ });
851
+ var runesEtchResultSchema = v15.object({
852
+ orderId: v15.string(),
853
+ fundTransactionId: v15.string(),
854
+ fundingAddress: v15.string()
855
+ });
856
+ var runesEtchRequestMessageSchema = v15.object({
857
+ ...rpcRequestMessageSchema.entries,
858
+ ...v15.object({
859
+ method: v15.literal(runesEtchMethodName),
860
+ params: runesEtchParamsSchema,
861
+ id: v15.string()
862
+ }).entries
863
+ });
864
+
865
+ // src/request/types/runesMethods/getBalance.ts
866
+ import * as v16 from "valibot";
867
+ var runesGetBalanceMethodName = "runes_getBalance";
868
+ var runesGetBalanceParamsSchema = v16.nullish(v16.null());
869
+ var runesGetBalanceResultSchema = v16.object({
870
+ balances: v16.array(
871
+ v16.object({
872
+ runeName: v16.string(),
873
+ amount: v16.string(),
874
+ divisibility: v16.number(),
875
+ symbol: v16.string(),
876
+ inscriptionId: v16.nullish(v16.string())
514
877
  })
515
878
  )
516
879
  });
517
- var getRunesBalanceRequestMessageSchema = v8.object({
880
+ var runesGetBalanceRequestMessageSchema = v16.object({
518
881
  ...rpcRequestMessageSchema.entries,
519
- ...v8.object({
520
- method: v8.literal(getRunesBalanceMethodName),
521
- params: getRunesBalanceParamsSchema,
522
- id: v8.string()
882
+ ...v16.object({
883
+ method: v16.literal(runesGetBalanceMethodName),
884
+ params: runesGetBalanceParamsSchema,
885
+ id: v16.string()
523
886
  }).entries
524
887
  });
525
- var transferRunesMethodName = "runes_transfer";
526
- var transferRunesParamsSchema = v8.object({
527
- recipients: v8.array(
528
- v8.object({
529
- runeName: v8.string(),
530
- amount: v8.string(),
531
- address: v8.string()
888
+
889
+ // src/request/types/runesMethods/mint.ts
890
+ import * as v17 from "valibot";
891
+ var runesMintMethodName = "runes_mint";
892
+ var runesMintParamsSchema = v17.object({
893
+ appServiceFee: v17.optional(v17.number()),
894
+ appServiceFeeAddress: v17.optional(v17.string()),
895
+ destinationAddress: v17.string(),
896
+ feeRate: v17.number(),
897
+ refundAddress: v17.string(),
898
+ repeats: v17.number(),
899
+ runeName: v17.string(),
900
+ network: v17.optional(v17.enum(BitcoinNetworkType))
901
+ });
902
+ var runesMintResultSchema = v17.object({
903
+ orderId: v17.string(),
904
+ fundTransactionId: v17.string(),
905
+ fundingAddress: v17.string()
906
+ });
907
+ var runesMintRequestMessageSchema = v17.object({
908
+ ...rpcRequestMessageSchema.entries,
909
+ ...v17.object({
910
+ method: v17.literal(runesMintMethodName),
911
+ params: runesMintParamsSchema,
912
+ id: v17.string()
913
+ }).entries
914
+ });
915
+
916
+ // src/request/types/runesMethods/transfer.ts
917
+ import * as v18 from "valibot";
918
+ var runesTransferMethodName = "runes_transfer";
919
+ var runesTransferParamsSchema = v18.object({
920
+ recipients: v18.array(
921
+ v18.object({
922
+ runeName: v18.string(),
923
+ amount: v18.string(),
924
+ address: v18.string()
532
925
  })
533
926
  )
534
927
  });
535
- var transferRunesRequestSchema = v8.object({
928
+ var runesTransferResultSchema = v18.object({
929
+ txid: v18.string()
930
+ });
931
+ var runesTransferRequestMessageSchema = v18.object({
536
932
  ...rpcRequestMessageSchema.entries,
537
- ...v8.object({
538
- method: v8.literal(transferRunesMethodName),
539
- params: transferRunesParamsSchema,
540
- id: v8.string()
933
+ ...v18.object({
934
+ method: v18.literal(runesTransferMethodName),
935
+ params: runesTransferParamsSchema,
936
+ id: v18.string()
541
937
  }).entries
542
938
  });
543
- var TransferRunesResultSchema = v8.object({
544
- txid: v8.string()
545
- });
546
939
 
547
940
  // src/request/types/ordinalsMethods.ts
548
- import * as v9 from "valibot";
941
+ import * as v19 from "valibot";
549
942
  var getInscriptionsMethodName = "ord_getInscriptions";
550
- var getInscriptionsParamsSchema = v9.object({
551
- offset: v9.number(),
552
- limit: v9.number()
553
- });
554
- var getInscriptionsResultSchema = v9.object({
555
- total: v9.number(),
556
- limit: v9.number(),
557
- offset: v9.number(),
558
- inscriptions: v9.array(
559
- v9.object({
560
- inscriptionId: v9.string(),
561
- inscriptionNumber: v9.string(),
562
- address: v9.string(),
563
- collectionName: v9.optional(v9.string()),
564
- postage: v9.string(),
565
- contentLength: v9.string(),
566
- contentType: v9.string(),
567
- timestamp: v9.number(),
568
- offset: v9.number(),
569
- genesisTransaction: v9.string(),
570
- output: v9.string()
943
+ var getInscriptionsParamsSchema = v19.object({
944
+ offset: v19.number(),
945
+ limit: v19.number()
946
+ });
947
+ var getInscriptionsResultSchema = v19.object({
948
+ total: v19.number(),
949
+ limit: v19.number(),
950
+ offset: v19.number(),
951
+ inscriptions: v19.array(
952
+ v19.object({
953
+ inscriptionId: v19.string(),
954
+ inscriptionNumber: v19.string(),
955
+ address: v19.string(),
956
+ collectionName: v19.optional(v19.string()),
957
+ postage: v19.string(),
958
+ contentLength: v19.string(),
959
+ contentType: v19.string(),
960
+ timestamp: v19.number(),
961
+ offset: v19.number(),
962
+ genesisTransaction: v19.string(),
963
+ output: v19.string()
571
964
  })
572
965
  )
573
966
  });
574
- var getInscriptionsSchema = v9.object({
967
+ var getInscriptionsRequestMessageSchema = v19.object({
575
968
  ...rpcRequestMessageSchema.entries,
576
- ...v9.object({
577
- method: v9.literal(getInscriptionsMethodName),
969
+ ...v19.object({
970
+ method: v19.literal(getInscriptionsMethodName),
578
971
  params: getInscriptionsParamsSchema,
579
- id: v9.string()
972
+ id: v19.string()
580
973
  }).entries
581
974
  });
582
975
  var sendInscriptionsMethodName = "ord_sendInscriptions";
583
- var sendInscriptionsParamsSchema = v9.object({
584
- transfers: v9.array(
585
- v9.object({
586
- address: v9.string(),
587
- inscriptionId: v9.string()
976
+ var sendInscriptionsParamsSchema = v19.object({
977
+ transfers: v19.array(
978
+ v19.object({
979
+ address: v19.string(),
980
+ inscriptionId: v19.string()
588
981
  })
589
982
  )
590
983
  });
591
- var sendInscriptionsResultSchema = v9.object({
592
- txid: v9.string()
984
+ var sendInscriptionsResultSchema = v19.object({
985
+ txid: v19.string()
593
986
  });
594
- var sendInscriptionsSchema = v9.object({
987
+ var sendInscriptionsRequestMessageSchema = v19.object({
595
988
  ...rpcRequestMessageSchema.entries,
596
- ...v9.object({
597
- method: v9.literal(sendInscriptionsMethodName),
989
+ ...v19.object({
990
+ method: v19.literal(sendInscriptionsMethodName),
598
991
  params: sendInscriptionsParamsSchema,
599
- id: v9.string()
992
+ id: v19.string()
600
993
  }).entries
601
994
  });
602
995
 
@@ -613,13 +1006,13 @@ var request = async (method, params, providerId) => {
613
1006
  throw new Error("A wallet method is required");
614
1007
  }
615
1008
  const response = await provider.request(method, params);
616
- if (v10.is(rpcErrorResponseMessageSchema, response)) {
1009
+ if (v20.is(rpcErrorResponseMessageSchema, response)) {
617
1010
  return {
618
1011
  status: "error",
619
1012
  error: response.error
620
1013
  };
621
1014
  }
622
- if (v10.is(rpcSuccessResponseMessageSchema, response)) {
1015
+ if (v20.is(rpcSuccessResponseMessageSchema, response)) {
623
1016
  return {
624
1017
  status: "success",
625
1018
  result: response.result
@@ -1130,17 +1523,16 @@ var XverseAdapter = class extends SatsConnectAdapter {
1130
1523
  };
1131
1524
 
1132
1525
  // src/adapters/unisat.ts
1133
- import { Buffer } from "buffer";
1134
1526
  import { AddressType as AddressType2, getAddressInfo } from "bitcoin-address-validation";
1135
- function convertSignInputsToInputType(signInputs, allowedSignHash) {
1527
+ import { Buffer } from "buffer";
1528
+ function convertSignInputsToInputType(signInputs) {
1136
1529
  let result = [];
1137
1530
  for (let address in signInputs) {
1138
1531
  let indexes = signInputs[address];
1139
1532
  for (let index of indexes) {
1140
1533
  result.push({
1141
1534
  index,
1142
- address,
1143
- sighashTypes: allowedSignHash ? [allowedSignHash] : void 0
1535
+ address
1144
1536
  });
1145
1537
  }
1146
1538
  }
@@ -1172,10 +1564,10 @@ var UnisatAdapter = class extends SatsConnectAdapter {
1172
1564
  };
1173
1565
  const response = [];
1174
1566
  if (purposes.includes("payment" /* Payment */)) {
1175
- response.push(paymentAddress);
1567
+ response.push({ ...paymentAddress, walletType: "software" });
1176
1568
  }
1177
1569
  if (purposes.includes("ordinals" /* Ordinals */)) {
1178
- response.push(ordinalsAddress);
1570
+ response.push({ ...ordinalsAddress, walletType: "software" });
1179
1571
  }
1180
1572
  return response;
1181
1573
  }
@@ -1188,14 +1580,16 @@ var UnisatAdapter = class extends SatsConnectAdapter {
1188
1580
  return {
1189
1581
  address,
1190
1582
  messageHash: "",
1191
- signature: response2
1583
+ signature: response2,
1584
+ protocol: "BIP322" /* BIP322 */
1192
1585
  };
1193
1586
  }
1194
1587
  const response = await window.unisat.signMessage(message, "ecdsa");
1195
1588
  return {
1196
1589
  address,
1197
1590
  messageHash: "",
1198
- signature: response
1591
+ signature: response,
1592
+ protocol: "ECDSA" /* ECDSA */
1199
1593
  };
1200
1594
  }
1201
1595
  async sendTransfer(params) {
@@ -1209,21 +1603,20 @@ var UnisatAdapter = class extends SatsConnectAdapter {
1209
1603
  };
1210
1604
  }
1211
1605
  async signPsbt(params) {
1212
- const { psbt, signInputs, allowedSignHash, broadcast } = params;
1606
+ const { psbt, signInputs, broadcast } = params;
1213
1607
  const psbtHex = Buffer.from(psbt, "base64").toString("hex");
1214
1608
  const signedPsbt = await window.unisat.signPsbt(psbtHex, {
1215
1609
  autoFinalized: broadcast,
1216
- toSignInputs: convertSignInputsToInputType(signInputs, allowedSignHash)
1610
+ toSignInputs: convertSignInputsToInputType(signInputs)
1217
1611
  });
1612
+ const signedPsbtBase64 = Buffer.from(signedPsbt, "hex").toString("base64");
1613
+ let txid;
1218
1614
  if (broadcast) {
1219
- const txid = await window.unisat.pushPsbt(psbtHex);
1220
- return {
1221
- psbt: signedPsbt,
1222
- txid
1223
- };
1615
+ txid = await window.unisat.pushPsbt(signedPsbt);
1224
1616
  }
1225
1617
  return {
1226
- psbt: psbtHex
1618
+ psbt: signedPsbtBase64,
1619
+ txid
1227
1620
  };
1228
1621
  }
1229
1622
  requestInternal = async (method, params) => {
@@ -1283,6 +1676,33 @@ var UnisatAdapter = class extends SatsConnectAdapter {
1283
1676
  };
1284
1677
  }
1285
1678
  };
1679
+ addListener = (eventName, cb) => {
1680
+ switch (eventName) {
1681
+ case "accountChange": {
1682
+ const handler = () => {
1683
+ cb({ type: "accountChange" });
1684
+ };
1685
+ window.unisat.on("accountsChanged", handler);
1686
+ return () => {
1687
+ window.unisat.removeListener("accountsChanged", handler);
1688
+ };
1689
+ }
1690
+ case "networkChange": {
1691
+ const handler = () => {
1692
+ cb({ type: "networkChange" });
1693
+ };
1694
+ window.unisat.on("networkChanged", handler);
1695
+ return () => {
1696
+ window.unisat.removeListener("networkChanged", handler);
1697
+ };
1698
+ }
1699
+ default: {
1700
+ console.error("Event not supported by the selected wallet");
1701
+ return () => {
1702
+ };
1703
+ }
1704
+ }
1705
+ };
1286
1706
  };
1287
1707
 
1288
1708
  // src/adapters/BaseAdapter.ts
@@ -1347,8 +1767,7 @@ var extractOrValidateCapabilities = (provider, reportedCapabilities) => {
1347
1767
  addListener: validateCapability("addListener")
1348
1768
  };
1349
1769
  return Object.entries(capabilityMap).reduce((acc, [capability, value]) => {
1350
- if (value)
1351
- return [...acc, capability];
1770
+ if (value) return [...acc, capability];
1352
1771
  return acc;
1353
1772
  }, []);
1354
1773
  };
@@ -1539,12 +1958,14 @@ export {
1539
1958
  BitcoinNetworkType,
1540
1959
  DefaultAdaptersInfo,
1541
1960
  MessageSigningProtocols,
1961
+ PermissionRequestParams,
1542
1962
  RpcErrorCode,
1543
1963
  RpcIdSchema,
1544
1964
  SatsConnectAdapter,
1545
- TransferRunesResultSchema,
1965
+ accountActionsSchema,
1546
1966
  accountChangeEventName,
1547
1967
  accountChangeSchema,
1968
+ accountPermissionSchema,
1548
1969
  addListener,
1549
1970
  addressSchema,
1550
1971
  connectMethodName,
@@ -1589,15 +2010,11 @@ export {
1589
2010
  getInfoResultSchema,
1590
2011
  getInscriptionsMethodName,
1591
2012
  getInscriptionsParamsSchema,
2013
+ getInscriptionsRequestMessageSchema,
1592
2014
  getInscriptionsResultSchema,
1593
- getInscriptionsSchema,
1594
2015
  getProviderById,
1595
2016
  getProviderOrThrow,
1596
2017
  getProviders,
1597
- getRunesBalanceMethodName,
1598
- getRunesBalanceParamsSchema,
1599
- getRunesBalanceRequestMessageSchema,
1600
- getRunesBalanceResultSchema,
1601
2018
  getSupportedWallets,
1602
2019
  getWalletTypeMethodName,
1603
2020
  getWalletTypeParamsSchema,
@@ -1606,11 +2023,7 @@ export {
1606
2023
  isProviderInstalled,
1607
2024
  networkChangeEventName,
1608
2025
  networkChangeSchema,
1609
- permissionTemplate,
1610
- registerClientMethodName,
1611
- registerClientParamsSchema,
1612
- registerClientRequestMessageSchema,
1613
- registerClientResultSchema,
2026
+ permission,
1614
2027
  removeDefaultProvider,
1615
2028
  renouncePermissionsMethodName,
1616
2029
  renouncePermissionsParamsSchema,
@@ -1625,11 +2038,31 @@ export {
1625
2038
  rpcRequestMessageSchema,
1626
2039
  rpcResponseMessageSchema,
1627
2040
  rpcSuccessResponseMessageSchema,
2041
+ runesEtchMethodName,
2042
+ runesEtchParamsSchema,
2043
+ runesEtchRequestMessageSchema,
2044
+ runesEtchResultSchema,
2045
+ runesGetBalanceMethodName,
2046
+ runesGetBalanceParamsSchema,
2047
+ runesGetBalanceRequestMessageSchema,
2048
+ runesGetBalanceResultSchema,
2049
+ runesMintMethodName,
2050
+ runesMintParamsSchema,
2051
+ runesMintRequestMessageSchema,
2052
+ runesMintResultSchema,
2053
+ runesTransferMethodName,
2054
+ runesTransferParamsSchema,
2055
+ runesTransferRequestMessageSchema,
2056
+ runesTransferResultSchema,
1628
2057
  sendBtcTransaction,
1629
2058
  sendInscriptionsMethodName,
1630
2059
  sendInscriptionsParamsSchema,
2060
+ sendInscriptionsRequestMessageSchema,
1631
2061
  sendInscriptionsResultSchema,
1632
- sendInscriptionsSchema,
2062
+ sendTransferMethodName,
2063
+ sendTransferParamsSchema,
2064
+ sendTransferRequestMessageSchema,
2065
+ sendTransferResultSchema,
1633
2066
  setDefaultProvider,
1634
2067
  signMessage,
1635
2068
  signMessageMethodName,
@@ -1637,19 +2070,46 @@ export {
1637
2070
  signMessageRequestMessageSchema,
1638
2071
  signMessageResultSchema,
1639
2072
  signMultipleTransactions,
2073
+ signPsbtMethodName,
2074
+ signPsbtParamsSchema,
2075
+ signPsbtRequestMessageSchema,
2076
+ signPsbtResultSchema,
1640
2077
  signTransaction,
2078
+ stxCallContractMethodName,
2079
+ stxCallContractParamsSchema,
2080
+ stxCallContractRequestMessageSchema,
2081
+ stxCallContractResultSchema,
2082
+ stxDeployContractMethodName,
2083
+ stxDeployContractParamsSchema,
2084
+ stxDeployContractRequestMessageSchema,
2085
+ stxDeployContractResultSchema,
2086
+ stxGetAccountsMethodName,
2087
+ stxGetAccountsParamsSchema,
2088
+ stxGetAccountsRequestMessageSchema,
2089
+ stxGetAccountsResultSchema,
1641
2090
  stxGetAddressesMethodName,
1642
2091
  stxGetAddressesParamsSchema,
1643
2092
  stxGetAddressesRequestMessageSchema,
1644
2093
  stxGetAddressesResultSchema,
2094
+ stxSignMessageMethodName,
2095
+ stxSignMessageParamsSchema,
2096
+ stxSignMessageRequestMessageSchema,
2097
+ stxSignMessageResultSchema,
2098
+ stxSignStructuredMessageMethodName,
2099
+ stxSignStructuredMessageParamsSchema,
2100
+ stxSignStructuredMessageRequestMessageSchema,
2101
+ stxSignStructuredMessageResultSchema,
1645
2102
  stxSignTransactionMethodName,
1646
2103
  stxSignTransactionParamsSchema,
1647
2104
  stxSignTransactionRequestMessageSchema,
1648
2105
  stxSignTransactionResultSchema,
1649
- transferRunesMethodName,
1650
- transferRunesParamsSchema,
1651
- transferRunesRequestSchema,
2106
+ stxTransferStxMethodName,
2107
+ stxTransferStxParamsSchema,
2108
+ stxTransferStxRequestMessageSchema,
2109
+ stxTransferStxResultSchema,
2110
+ walletActionsSchema,
1652
2111
  walletEventSchema,
2112
+ walletPermissionSchema,
1653
2113
  walletTypeSchema,
1654
2114
  walletTypes
1655
2115
  };