@sats-connect/core 0.4.0-d60f0ef → 0.4.0-de32322

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -134,15 +134,43 @@ __export(src_exports, {
134
134
  signMessageRequestMessageSchema: () => signMessageRequestMessageSchema,
135
135
  signMessageResultSchema: () => signMessageResultSchema,
136
136
  signMultipleTransactions: () => signMultipleTransactions,
137
+ signPsbtMethodName: () => signPsbtMethodName,
138
+ signPsbtParamsSchema: () => signPsbtParamsSchema,
139
+ signPsbtRequestMessageSchema: () => signPsbtRequestMessageSchema,
140
+ signPsbtResultSchema: () => signPsbtResultSchema,
137
141
  signTransaction: () => signTransaction,
142
+ stxCallContractMethodName: () => stxCallContractMethodName,
143
+ stxCallContractParamsSchema: () => stxCallContractParamsSchema,
144
+ stxCallContractRequestMessageSchema: () => stxCallContractRequestMessageSchema,
145
+ stxCallContractResultSchema: () => stxCallContractResultSchema,
146
+ stxDeployContractMethodName: () => stxDeployContractMethodName,
147
+ stxDeployContractParamsSchema: () => stxDeployContractParamsSchema,
148
+ stxDeployContractRequestMessageSchema: () => stxDeployContractRequestMessageSchema,
149
+ stxDeployContractResultSchema: () => stxDeployContractResultSchema,
150
+ stxGetAccountsMethodName: () => stxGetAccountsMethodName,
151
+ stxGetAccountsParamsSchema: () => stxGetAccountsParamsSchema,
152
+ stxGetAccountsRequestMessageSchema: () => stxGetAccountsRequestMessageSchema,
153
+ stxGetAccountsResultSchema: () => stxGetAccountsResultSchema,
138
154
  stxGetAddressesMethodName: () => stxGetAddressesMethodName,
139
155
  stxGetAddressesParamsSchema: () => stxGetAddressesParamsSchema,
140
156
  stxGetAddressesRequestMessageSchema: () => stxGetAddressesRequestMessageSchema,
141
157
  stxGetAddressesResultSchema: () => stxGetAddressesResultSchema,
158
+ stxSignMessageMethodName: () => stxSignMessageMethodName,
159
+ stxSignMessageParamsSchema: () => stxSignMessageParamsSchema,
160
+ stxSignMessageRequestMessageSchema: () => stxSignMessageRequestMessageSchema,
161
+ stxSignMessageResultSchema: () => stxSignMessageResultSchema,
162
+ stxSignStructuredMessageMethodName: () => stxSignStructuredMessageMethodName,
163
+ stxSignStructuredMessageParamsSchema: () => stxSignStructuredMessageParamsSchema,
164
+ stxSignStructuredMessageRequestMessageSchema: () => stxSignStructuredMessageRequestMessageSchema,
165
+ stxSignStructuredMessageResultSchema: () => stxSignStructuredMessageResultSchema,
142
166
  stxSignTransactionMethodName: () => stxSignTransactionMethodName,
143
167
  stxSignTransactionParamsSchema: () => stxSignTransactionParamsSchema,
144
168
  stxSignTransactionRequestMessageSchema: () => stxSignTransactionRequestMessageSchema,
145
169
  stxSignTransactionResultSchema: () => stxSignTransactionResultSchema,
170
+ stxTransferStxMethodName: () => stxTransferStxMethodName,
171
+ stxTransferStxParamsSchema: () => stxTransferStxParamsSchema,
172
+ stxTransferStxRequestMessageSchema: () => stxTransferStxRequestMessageSchema,
173
+ stxTransferStxResultSchema: () => stxTransferStxResultSchema,
146
174
  transferRunesMethodName: () => transferRunesMethodName,
147
175
  transferRunesParamsSchema: () => transferRunesParamsSchema,
148
176
  transferRunesRequestSchema: () => transferRunesRequestSchema,
@@ -267,16 +295,127 @@ var rpcResponseMessageSchema = v2.union([
267
295
  ]);
268
296
 
269
297
  // src/request/index.ts
270
- var v10 = __toESM(require("valibot"));
298
+ var v17 = __toESM(require("valibot"));
271
299
 
272
- // src/request/types/stxMethods.ts
300
+ // src/request/types/stxMethods/callContract.ts
301
+ var v3 = __toESM(require("valibot"));
302
+ var stxCallContractMethodName = "stx_callContract";
303
+ var stxCallContractParamsSchema = v3.object({
304
+ /**
305
+ * The contract principal.
306
+ *
307
+ * E.g. `"SPKE...GD5C.my-contract"`
308
+ */
309
+ contract: v3.string(),
310
+ /**
311
+ * The name of the function to call.
312
+ *
313
+ * Note: spec changes ongoing,
314
+ * https://github.com/stacksgov/sips/pull/166#pullrequestreview-1914236999
315
+ */
316
+ functionName: v3.string(),
317
+ /**
318
+ * The function's arguments. The arguments are expected to be hex-encoded
319
+ * strings of Clarity values.
320
+ *
321
+ * To convert Clarity values to their hex representation, the `cvToString`
322
+ * helper from the `@stacks/transactions` package may be helpful.
323
+ *
324
+ * ```js
325
+ * import { cvToString } from '@stacks/transactions';
326
+ *
327
+ * const functionArgs = [someClarityValue1, someClarityValue2];
328
+ * const hexArgs = functionArgs.map(cvToString);
329
+ * ```
330
+ */
331
+ arguments: v3.optional(v3.array(v3.string()))
332
+ });
333
+ var stxCallContractResultSchema = v3.object({
334
+ /**
335
+ * The ID of the transaction.
336
+ */
337
+ txid: v3.string(),
338
+ /**
339
+ * A Stacks transaction as a hex-encoded string.
340
+ */
341
+ transaction: v3.string()
342
+ });
343
+ var stxCallContractRequestMessageSchema = v3.object({
344
+ ...rpcRequestMessageSchema.entries,
345
+ ...v3.object({
346
+ method: v3.literal(stxCallContractMethodName),
347
+ params: stxCallContractParamsSchema,
348
+ id: v3.string()
349
+ }).entries
350
+ });
351
+
352
+ // src/request/types/stxMethods/deployContract.ts
273
353
  var v4 = __toESM(require("valibot"));
354
+ var stxDeployContractMethodName = "stx_deployContract";
355
+ var stxDeployContractParamsSchema = v4.object({
356
+ /**
357
+ * Name of the contract.
358
+ */
359
+ name: v4.string(),
360
+ /**
361
+ * The source code of the Clarity contract.
362
+ */
363
+ clarityCode: v4.string(),
364
+ /**
365
+ * The version of the Clarity contract.
366
+ */
367
+ clarityVersion: v4.optional(v4.string())
368
+ });
369
+ var stxDeployContractResultSchema = v4.object({
370
+ /**
371
+ * The ID of the transaction.
372
+ */
373
+ txid: v4.string(),
374
+ /**
375
+ * A Stacks transaction as a hex-encoded string.
376
+ */
377
+ transaction: v4.string()
378
+ });
379
+ var stxDeployContractRequestMessageSchema = v4.object({
380
+ ...rpcRequestMessageSchema.entries,
381
+ ...v4.object({
382
+ method: v4.literal(stxDeployContractMethodName),
383
+ params: stxDeployContractParamsSchema,
384
+ id: v4.string()
385
+ }).entries
386
+ });
387
+
388
+ // src/request/types/stxMethods/getAccounts.ts
389
+ var v5 = __toESM(require("valibot"));
390
+ var stxGetAccountsMethodName = "stx_getAccounts";
391
+ var stxGetAccountsParamsSchema = v5.nullish(v5.null());
392
+ var stxGetAccountsResultSchema = v5.object({
393
+ /**
394
+ * The addresses generated for the given purposes.
395
+ */
396
+ addresses: v5.array(
397
+ v5.object({
398
+ address: v5.string(),
399
+ publicKey: v5.string(),
400
+ gaiaHubUrl: v5.string(),
401
+ gaiaAppKey: v5.string()
402
+ })
403
+ )
404
+ });
405
+ var stxGetAccountsRequestMessageSchema = v5.object({
406
+ ...rpcRequestMessageSchema.entries,
407
+ ...v5.object({
408
+ method: v5.literal(stxGetAccountsMethodName),
409
+ params: stxGetAccountsParamsSchema,
410
+ id: v5.string()
411
+ }).entries
412
+ });
274
413
 
275
414
  // src/addresses/index.ts
276
415
  var import_jsontokens = require("jsontokens");
277
416
 
278
417
  // src/addresses/types.ts
279
- var v3 = __toESM(require("valibot"));
418
+ var v6 = __toESM(require("valibot"));
280
419
  var AddressPurpose = /* @__PURE__ */ ((AddressPurpose2) => {
281
420
  AddressPurpose2["Ordinals"] = "ordinals";
282
421
  AddressPurpose2["Payment"] = "payment";
@@ -292,11 +431,11 @@ var AddressType = /* @__PURE__ */ ((AddressType3) => {
292
431
  AddressType3["stacks"] = "stacks";
293
432
  return AddressType3;
294
433
  })(AddressType || {});
295
- var addressSchema = v3.object({
296
- address: v3.string(),
297
- publicKey: v3.string(),
298
- purpose: v3.enum(AddressPurpose),
299
- addressType: v3.enum(AddressType)
434
+ var addressSchema = v6.object({
435
+ address: v6.string(),
436
+ publicKey: v6.string(),
437
+ purpose: v6.enum(AddressPurpose),
438
+ addressType: v6.enum(AddressType)
300
439
  });
301
440
 
302
441
  // src/addresses/index.ts
@@ -316,118 +455,269 @@ var getAddress = async (options) => {
316
455
  }
317
456
  };
318
457
 
319
- // src/request/types/stxMethods.ts
458
+ // src/request/types/stxMethods/getAddresses.ts
459
+ var v7 = __toESM(require("valibot"));
320
460
  var stxGetAddressesMethodName = "stx_getAddresses";
321
- var stxGetAddressesParamsSchema = v4.nullish(
322
- v4.object({
461
+ var stxGetAddressesParamsSchema = v7.nullish(
462
+ v7.object({
323
463
  /**
324
464
  * A message to be displayed to the user in the request prompt.
325
465
  */
326
- message: v4.optional(v4.string())
466
+ message: v7.optional(v7.string())
327
467
  })
328
468
  );
329
- var stxGetAddressesResultSchema = v4.object({
469
+ var stxGetAddressesResultSchema = v7.object({
330
470
  /**
331
471
  * The addresses generated for the given purposes.
332
472
  */
333
- addresses: v4.array(addressSchema)
473
+ addresses: v7.array(addressSchema)
334
474
  });
335
- var stxGetAddressesRequestMessageSchema = v4.object({
475
+ var stxGetAddressesRequestMessageSchema = v7.object({
336
476
  ...rpcRequestMessageSchema.entries,
337
- ...v4.object({
338
- method: v4.literal(stxGetAddressesMethodName),
477
+ ...v7.object({
478
+ method: v7.literal(stxGetAddressesMethodName),
339
479
  params: stxGetAddressesParamsSchema,
340
- id: v4.string()
480
+ id: v7.string()
481
+ }).entries
482
+ });
483
+
484
+ // src/request/types/stxMethods/signMessage.ts
485
+ var v8 = __toESM(require("valibot"));
486
+ var stxSignMessageMethodName = "stx_signMessage";
487
+ var stxSignMessageParamsSchema = v8.object({
488
+ /**
489
+ * The message to sign.
490
+ */
491
+ message: v8.string(),
492
+ /**
493
+ * The public key to sign the message with.
494
+ */
495
+ publicKey: v8.string(),
496
+ /**
497
+ * The format version of the parameter.
498
+ */
499
+ parameterFormatVersion: v8.optional(v8.number())
500
+ });
501
+ var stxSignMessageResultSchema = v8.object({
502
+ /**
503
+ * The signature of the message.
504
+ */
505
+ signature: v8.string(),
506
+ /**
507
+ * The public key used to sign the message.
508
+ */
509
+ publicKey: v8.string()
510
+ });
511
+ var stxSignMessageRequestMessageSchema = v8.object({
512
+ ...rpcRequestMessageSchema.entries,
513
+ ...v8.object({
514
+ method: v8.literal(stxSignMessageMethodName),
515
+ params: stxSignMessageParamsSchema,
516
+ id: v8.string()
517
+ }).entries
518
+ });
519
+
520
+ // src/request/types/stxMethods/signStructuredMessage.ts
521
+ var v9 = __toESM(require("valibot"));
522
+ var stxSignStructuredMessageMethodName = "stx_signStructuredMessage";
523
+ var stxSignStructuredMessageParamsSchema = v9.object({
524
+ /**
525
+ * The domain to be signed.
526
+ */
527
+ domain: v9.string(),
528
+ /**
529
+ * Message payload to be signed.
530
+ */
531
+ message: v9.string(),
532
+ /**
533
+ * The format version of the parameter.
534
+ */
535
+ parameterFormatVersion: v9.optional(v9.number()),
536
+ /**
537
+ * The public key to sign the message with.
538
+ */
539
+ publicKey: v9.optional(v9.string())
540
+ });
541
+ var stxSignStructuredMessageResultSchema = v9.object({
542
+ /**
543
+ * Signature of the message.
544
+ */
545
+ signature: v9.string(),
546
+ /**
547
+ * Public key as hex-encoded string.
548
+ */
549
+ publicKey: v9.string()
550
+ });
551
+ var stxSignStructuredMessageRequestMessageSchema = v9.object({
552
+ ...rpcRequestMessageSchema.entries,
553
+ ...v9.object({
554
+ method: v9.literal(stxSignStructuredMessageMethodName),
555
+ params: stxSignStructuredMessageParamsSchema,
556
+ id: v9.string()
341
557
  }).entries
342
558
  });
559
+
560
+ // src/request/types/stxMethods/signTransaction.ts
561
+ var v10 = __toESM(require("valibot"));
343
562
  var stxSignTransactionMethodName = "stx_signTransaction";
344
- var stxSignTransactionParamsSchema = v4.object({
563
+ var stxSignTransactionParamsSchema = v10.object({
345
564
  /**
346
565
  * The transaction to sign as a hex-encoded string.
347
566
  */
348
- transaction: v4.string(),
567
+ transaction: v10.string(),
349
568
  /**
350
569
  * The public key to sign the transaction with. The wallet may use any key
351
570
  * when not provided.
352
571
  */
353
- pubkey: v4.optional(v4.string()),
572
+ pubkey: v10.optional(v10.string()),
354
573
  /**
355
574
  * Whether to broadcast the transaction after signing. Defaults to `true`.
356
575
  */
357
- broadcast: v4.optional(v4.boolean())
576
+ broadcast: v10.optional(v10.boolean())
358
577
  });
359
- var stxSignTransactionResultSchema = v4.object({
578
+ var stxSignTransactionResultSchema = v10.object({
360
579
  /**
361
580
  * The signed transaction as a hex-encoded string.
362
581
  */
363
- transaction: v4.string()
582
+ transaction: v10.string()
364
583
  });
365
- var stxSignTransactionRequestMessageSchema = v4.object({
584
+ var stxSignTransactionRequestMessageSchema = v10.object({
366
585
  ...rpcRequestMessageSchema.entries,
367
- ...v4.object({
368
- method: v4.literal(stxSignTransactionMethodName),
586
+ ...v10.object({
587
+ method: v10.literal(stxSignTransactionMethodName),
369
588
  params: stxSignTransactionParamsSchema,
370
- id: v4.string()
589
+ id: v10.string()
590
+ }).entries
591
+ });
592
+
593
+ // src/request/types/stxMethods/transferStx.ts
594
+ var v11 = __toESM(require("valibot"));
595
+ var stxTransferStxMethodName = "stx_transferStx";
596
+ var stxTransferStxParamsSchema = v11.object({
597
+ /**
598
+ * Amount of STX tokens to transfer in microstacks as a string. Anything
599
+ * parseable by `BigInt` is acceptable.
600
+ *
601
+ * Example,
602
+ *
603
+ * ```js
604
+ * const amount1 = 1234;
605
+ * const amount2 = 1234n;
606
+ * const amount3 = '1234';
607
+ * ```
608
+ */
609
+ amount: v11.union([v11.number(), v11.string()]),
610
+ /**
611
+ * The recipeint's principal.
612
+ */
613
+ recipient: v11.string(),
614
+ /**
615
+ * A string representing the memo.
616
+ */
617
+ memo: v11.optional(v11.string()),
618
+ /**
619
+ * Version of parameter format.
620
+ */
621
+ version: v11.optional(v11.string()),
622
+ /**
623
+ * The mode of the post conditions.
624
+ */
625
+ postConditionMode: v11.optional(v11.number()),
626
+ /**
627
+ * A hex-encoded string representing the post conditions.
628
+ *
629
+ * A post condition may be converted to it's hex representation using the `serializePostCondition` helper from the `@stacks/transactions` package,
630
+ *
631
+ * ```js
632
+ * import { serializePostCondition } from '@stacks/transactions';
633
+ *
634
+ * const postCondition = somePostCondition;
635
+ * const hexPostCondition = serializePostCondition(postCondition).toString('hex');
636
+ * ```
637
+ */
638
+ postConditions: v11.optional(v11.array(v11.string())),
639
+ /**
640
+ * The public key to sign the transaction with. The wallet may use any key
641
+ * when not provided.
642
+ */
643
+ pubkey: v11.optional(v11.string())
644
+ });
645
+ var stxTransferStxResultSchema = v11.object({
646
+ /**
647
+ * The ID of the transaction.
648
+ */
649
+ txid: v11.string(),
650
+ /**
651
+ * A Stacks transaction as a hex-encoded string.
652
+ */
653
+ transaction: v11.string()
654
+ });
655
+ var stxTransferStxRequestMessageSchema = v11.object({
656
+ ...rpcRequestMessageSchema.entries,
657
+ ...v11.object({
658
+ method: v11.literal(stxTransferStxMethodName),
659
+ params: stxTransferStxParamsSchema,
660
+ id: v11.string()
371
661
  }).entries
372
662
  });
373
663
 
374
664
  // src/request/types/btcMethods.ts
375
- var v6 = __toESM(require("valibot"));
665
+ var v13 = __toESM(require("valibot"));
376
666
 
377
667
  // src/request/types/common.ts
378
- var v5 = __toESM(require("valibot"));
668
+ var v12 = __toESM(require("valibot"));
379
669
  var walletTypes = ["software", "ledger"];
380
- var walletTypeSchema = v5.picklist(walletTypes);
670
+ var walletTypeSchema = v12.picklist(walletTypes);
381
671
 
382
672
  // src/request/types/btcMethods.ts
383
673
  var getInfoMethodName = "getInfo";
384
- var getInfoParamsSchema = v6.nullish(v6.null());
385
- var getInfoResultSchema = v6.object({
674
+ var getInfoParamsSchema = v13.nullish(v13.null());
675
+ var getInfoResultSchema = v13.object({
386
676
  /**
387
677
  * Version of the wallet.
388
678
  */
389
- version: v6.string(),
679
+ version: v13.string(),
390
680
  /**
391
681
  * [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
392
682
  */
393
- methods: v6.optional(v6.array(v6.string())),
683
+ methods: v13.optional(v13.array(v13.string())),
394
684
  /**
395
685
  * List of WBIP standards supported by the wallet. Not currently used.
396
686
  */
397
- supports: v6.array(v6.string())
687
+ supports: v13.array(v13.string())
398
688
  });
399
- var getInfoRequestMessageSchema = v6.object({
689
+ var getInfoRequestMessageSchema = v13.object({
400
690
  ...rpcRequestMessageSchema.entries,
401
- ...v6.object({
402
- method: v6.literal(getInfoMethodName),
691
+ ...v13.object({
692
+ method: v13.literal(getInfoMethodName),
403
693
  params: getInfoParamsSchema,
404
- id: v6.string()
694
+ id: v13.string()
405
695
  }).entries
406
696
  });
407
697
  var getAddressesMethodName = "getAddresses";
408
- var getAddressesParamsSchema = v6.object({
698
+ var getAddressesParamsSchema = v13.object({
409
699
  /**
410
700
  * The purposes for which to generate addresses. See
411
701
  * {@linkcode AddressPurpose} for available purposes.
412
702
  */
413
- purposes: v6.array(v6.enum(AddressPurpose)),
703
+ purposes: v13.array(v13.enum(AddressPurpose)),
414
704
  /**
415
705
  * A message to be displayed to the user in the request prompt.
416
706
  */
417
- message: v6.optional(v6.string())
707
+ message: v13.optional(v13.string())
418
708
  });
419
- var getAddressesResultSchema = v6.object({
709
+ var getAddressesResultSchema = v13.object({
420
710
  /**
421
711
  * The addresses generated for the given purposes.
422
712
  */
423
- addresses: v6.array(addressSchema)
713
+ addresses: v13.array(addressSchema)
424
714
  });
425
- var getAddressesRequestMessageSchema = v6.object({
715
+ var getAddressesRequestMessageSchema = v13.object({
426
716
  ...rpcRequestMessageSchema.entries,
427
- ...v6.object({
428
- method: v6.literal(getAddressesMethodName),
717
+ ...v13.object({
718
+ method: v13.literal(getAddressesMethodName),
429
719
  params: getAddressesParamsSchema,
430
- id: v6.string()
720
+ id: v13.string()
431
721
  }).entries
432
722
  });
433
723
  var signMessageMethodName = "signMessage";
@@ -436,328 +726,364 @@ var MessageSigningProtocols = /* @__PURE__ */ ((MessageSigningProtocols2) => {
436
726
  MessageSigningProtocols2["BIP322"] = "BIP322";
437
727
  return MessageSigningProtocols2;
438
728
  })(MessageSigningProtocols || {});
439
- var signMessageParamsSchema = v6.object({
729
+ var signMessageParamsSchema = v13.object({
440
730
  /**
441
731
  * The address used for signing.
442
732
  **/
443
- address: v6.string(),
733
+ address: v13.string(),
444
734
  /**
445
735
  * The message to sign.
446
736
  **/
447
- message: v6.string(),
737
+ message: v13.string(),
448
738
  /**
449
739
  * The protocol to use for signing the message.
450
740
  */
451
- protocol: v6.optional(v6.enum(MessageSigningProtocols))
741
+ protocol: v13.optional(v13.enum(MessageSigningProtocols))
452
742
  });
453
- var signMessageResultSchema = v6.object({
743
+ var signMessageResultSchema = v13.object({
454
744
  /**
455
745
  * The signature of the message.
456
746
  */
457
- signature: v6.string(),
747
+ signature: v13.string(),
458
748
  /**
459
749
  * hash of the message.
460
750
  */
461
- messageHash: v6.string(),
751
+ messageHash: v13.string(),
462
752
  /**
463
753
  * The address used for signing.
464
754
  */
465
- address: v6.string(),
755
+ address: v13.string(),
466
756
  /**
467
757
  * The protocol to use for signing the message.
468
758
  */
469
- protocol: v6.enum(MessageSigningProtocols)
759
+ protocol: v13.enum(MessageSigningProtocols)
470
760
  });
471
- var signMessageRequestMessageSchema = v6.object({
761
+ var signMessageRequestMessageSchema = v13.object({
472
762
  ...rpcRequestMessageSchema.entries,
473
- ...v6.object({
474
- method: v6.literal(signMessageMethodName),
763
+ ...v13.object({
764
+ method: v13.literal(signMessageMethodName),
475
765
  params: signMessageParamsSchema,
476
- id: v6.string()
766
+ id: v13.string()
477
767
  }).entries
478
768
  });
479
769
  var sendTransferMethodName = "sendTransfer";
480
- var sendTransferParamsSchema = v6.object({
770
+ var sendTransferParamsSchema = v13.object({
481
771
  /**
482
772
  * Array of recipients to send to.
483
773
  * The amount to send to each recipient is in satoshis.
484
774
  */
485
- recipients: v6.array(
486
- v6.object({
487
- address: v6.string(),
488
- amount: v6.number()
775
+ recipients: v13.array(
776
+ v13.object({
777
+ address: v13.string(),
778
+ amount: v13.number()
489
779
  })
490
780
  )
491
781
  });
492
- var sendTransferResultSchema = v6.object({
782
+ var sendTransferResultSchema = v13.object({
493
783
  /**
494
784
  * The transaction id as a hex-encoded string.
495
785
  */
496
- txid: v6.string()
786
+ txid: v13.string()
497
787
  });
498
- var sendTransferRequestMessageSchema = v6.object({
788
+ var sendTransferRequestMessageSchema = v13.object({
499
789
  ...rpcRequestMessageSchema.entries,
500
- ...v6.object({
501
- method: v6.literal(sendTransferMethodName),
790
+ ...v13.object({
791
+ method: v13.literal(sendTransferMethodName),
502
792
  params: sendTransferParamsSchema,
503
- id: v6.string()
793
+ id: v13.string()
794
+ }).entries
795
+ });
796
+ var signPsbtMethodName = "signPsbt";
797
+ var signPsbtParamsSchema = v13.object({
798
+ /**
799
+ * The base64 encoded PSBT to sign.
800
+ */
801
+ psbt: v13.string(),
802
+ /**
803
+ * The inputs to sign.
804
+ * The key is the address and the value is an array of indexes of the inputs to sign.
805
+ */
806
+ signInputs: v13.record(v13.string(), v13.array(v13.number())),
807
+ allowedSignHash: v13.optional(v13.number()),
808
+ /**
809
+ * Whether to broadcast the transaction after signing.
810
+ **/
811
+ broadcast: v13.optional(v13.boolean())
812
+ });
813
+ var signPsbtResultSchema = v13.object({
814
+ /**
815
+ * The base64 encoded PSBT after signing.
816
+ */
817
+ psbt: v13.string(),
818
+ /**
819
+ * The transaction id as a hex-encoded string.
820
+ * This is only returned if the transaction was broadcast.
821
+ **/
822
+ txid: v13.optional(v13.string())
823
+ });
824
+ var signPsbtRequestMessageSchema = v13.object({
825
+ ...rpcRequestMessageSchema.entries,
826
+ ...v13.object({
827
+ method: v13.literal(signPsbtMethodName),
828
+ params: signPsbtParamsSchema,
829
+ id: v13.string()
504
830
  }).entries
505
831
  });
506
832
  var getAccountsMethodName = "getAccounts";
507
- var getAccountsParamsSchema = v6.object({
833
+ var getAccountsParamsSchema = v13.object({
508
834
  /**
509
835
  * The purposes for which to generate addresses. See
510
836
  * {@linkcode AddressPurpose} for available purposes.
511
837
  */
512
- purposes: v6.array(v6.enum(AddressPurpose)),
838
+ purposes: v13.array(v13.enum(AddressPurpose)),
513
839
  /**
514
840
  * A message to be displayed to the user in the request prompt.
515
841
  */
516
- message: v6.optional(v6.string())
842
+ message: v13.optional(v13.string())
517
843
  });
518
- var getAccountsResultSchema = v6.array(
519
- v6.object({
844
+ var getAccountsResultSchema = v13.array(
845
+ v13.object({
520
846
  ...addressSchema.entries,
521
- ...v6.object({
847
+ ...v13.object({
522
848
  walletType: walletTypeSchema
523
849
  }).entries
524
850
  })
525
851
  );
526
- var getAccountsRequestMessageSchema = v6.object({
852
+ var getAccountsRequestMessageSchema = v13.object({
527
853
  ...rpcRequestMessageSchema.entries,
528
- ...v6.object({
529
- method: v6.literal(getAccountsMethodName),
854
+ ...v13.object({
855
+ method: v13.literal(getAccountsMethodName),
530
856
  params: getAccountsParamsSchema,
531
- id: v6.string()
857
+ id: v13.string()
532
858
  }).entries
533
859
  });
534
860
  var getBalanceMethodName = "getBalance";
535
- var getBalanceParamsSchema = v6.nullish(v6.null());
536
- var getBalanceResultSchema = v6.object({
861
+ var getBalanceParamsSchema = v13.nullish(v13.null());
862
+ var getBalanceResultSchema = v13.object({
537
863
  /**
538
864
  * The confirmed balance of the wallet in sats. Using a string due to chrome
539
865
  * messages not supporting bigint
540
866
  * (https://issues.chromium.org/issues/40116184).
541
867
  */
542
- confirmed: v6.string(),
868
+ confirmed: v13.string(),
543
869
  /**
544
870
  * The unconfirmed balance of the wallet in sats. Using a string due to chrome
545
871
  * messages not supporting bigint
546
872
  * (https://issues.chromium.org/issues/40116184).
547
873
  */
548
- unconfirmed: v6.string(),
874
+ unconfirmed: v13.string(),
549
875
  /**
550
876
  * The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
551
877
  * sats. Using a string due to chrome messages not supporting bigint
552
878
  * (https://issues.chromium.org/issues/40116184).
553
879
  */
554
- total: v6.string()
880
+ total: v13.string()
555
881
  });
556
- var getBalanceRequestMessageSchema = v6.object({
882
+ var getBalanceRequestMessageSchema = v13.object({
557
883
  ...rpcRequestMessageSchema.entries,
558
- ...v6.object({
559
- method: v6.literal(getBalanceMethodName),
560
- id: v6.string()
884
+ ...v13.object({
885
+ method: v13.literal(getBalanceMethodName),
886
+ id: v13.string()
561
887
  }).entries
562
888
  });
563
889
 
564
890
  // src/request/types/walletMethods.ts
565
- var v7 = __toESM(require("valibot"));
891
+ var v14 = __toESM(require("valibot"));
566
892
  var import_xverse_core = require("@secretkeylabs/xverse-core");
567
- var permissionTemplate = v7.variant("type", [
568
- v7.object({
569
- ...v7.omit(import_xverse_core.permissions.resources.account.accountPermissionSchema, ["clientId", "actions"]).entries,
570
- actions: v7.partial(import_xverse_core.permissions.resources.account.accountActionsSchema)
893
+ var permissionTemplate = v14.variant("type", [
894
+ v14.object({
895
+ ...v14.omit(import_xverse_core.permissions.resources.account.accountPermissionSchema, ["clientId", "actions"]).entries,
896
+ actions: v14.partial(import_xverse_core.permissions.resources.account.accountActionsSchema)
571
897
  }),
572
- v7.object({
573
- ...v7.omit(import_xverse_core.permissions.resources.wallet.walletPermissionSchema, ["clientId"]).entries,
574
- actions: v7.partial(import_xverse_core.permissions.resources.wallet.walletActionsSchema)
898
+ v14.object({
899
+ ...v14.omit(import_xverse_core.permissions.resources.wallet.walletPermissionSchema, ["clientId"]).entries,
900
+ actions: v14.partial(import_xverse_core.permissions.resources.wallet.walletActionsSchema)
575
901
  })
576
902
  ]);
577
903
  var requestPermissionsMethodName = "wallet_requestPermissions";
578
- var requestPermissionsParamsSchema = v7.nullish(v7.array(permissionTemplate));
579
- var requestPermissionsResultSchema = v7.literal(true);
580
- var requestPermissionsRequestMessageSchema = v7.object({
904
+ var requestPermissionsParamsSchema = v14.nullish(v14.array(permissionTemplate));
905
+ var requestPermissionsResultSchema = v14.literal(true);
906
+ var requestPermissionsRequestMessageSchema = v14.object({
581
907
  ...rpcRequestMessageSchema.entries,
582
- ...v7.object({
583
- method: v7.literal(requestPermissionsMethodName),
908
+ ...v14.object({
909
+ method: v14.literal(requestPermissionsMethodName),
584
910
  params: requestPermissionsParamsSchema,
585
- id: v7.string()
911
+ id: v14.string()
586
912
  }).entries
587
913
  });
588
914
  var renouncePermissionsMethodName = "wallet_renouncePermissions";
589
- var renouncePermissionsParamsSchema = v7.nullish(v7.null());
590
- var renouncePermissionsResultSchema = v7.nullish(v7.null());
591
- var renouncePermissionsRequestMessageSchema = v7.object({
915
+ var renouncePermissionsParamsSchema = v14.nullish(v14.null());
916
+ var renouncePermissionsResultSchema = v14.nullish(v14.null());
917
+ var renouncePermissionsRequestMessageSchema = v14.object({
592
918
  ...rpcRequestMessageSchema.entries,
593
- ...v7.object({
594
- method: v7.literal(renouncePermissionsMethodName),
919
+ ...v14.object({
920
+ method: v14.literal(renouncePermissionsMethodName),
595
921
  params: renouncePermissionsParamsSchema,
596
- id: v7.string()
922
+ id: v14.string()
597
923
  }).entries
598
924
  });
599
925
  var disconnectMethodName = "wallet_disconnect";
600
- var disconnectParamsSchema = v7.nullish(v7.null());
601
- var disconnectResultSchema = v7.nullish(v7.null());
602
- var disconnectRequestMessageSchema = v7.object({
926
+ var disconnectParamsSchema = v14.nullish(v14.null());
927
+ var disconnectResultSchema = v14.nullish(v14.null());
928
+ var disconnectRequestMessageSchema = v14.object({
603
929
  ...rpcRequestMessageSchema.entries,
604
- ...v7.object({
605
- method: v7.literal(disconnectMethodName),
930
+ ...v14.object({
931
+ method: v14.literal(disconnectMethodName),
606
932
  params: disconnectParamsSchema,
607
- id: v7.string()
933
+ id: v14.string()
608
934
  }).entries
609
935
  });
610
936
  var getWalletTypeMethodName = "wallet_getWalletType";
611
- var getWalletTypeParamsSchema = v7.nullish(v7.null());
937
+ var getWalletTypeParamsSchema = v14.nullish(v14.null());
612
938
  var getWalletTypeResultSchema = walletTypeSchema;
613
- var getWalletTypeRequestMessageSchema = v7.object({
939
+ var getWalletTypeRequestMessageSchema = v14.object({
614
940
  ...rpcRequestMessageSchema.entries,
615
- ...v7.object({
616
- method: v7.literal(getWalletTypeMethodName),
941
+ ...v14.object({
942
+ method: v14.literal(getWalletTypeMethodName),
617
943
  params: getWalletTypeParamsSchema,
618
- id: v7.string()
944
+ id: v14.string()
619
945
  }).entries
620
946
  });
621
947
  var getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
622
- var getCurrentPermissionsParamsSchema = v7.nullish(v7.null());
623
- var getCurrentPermissionsResultSchema = v7.array(import_xverse_core.permissions.store.permission);
624
- var getCurrentPermissionsRequestMessageSchema = v7.object({
948
+ var getCurrentPermissionsParamsSchema = v14.nullish(v14.null());
949
+ var getCurrentPermissionsResultSchema = v14.array(import_xverse_core.permissions.store.permission);
950
+ var getCurrentPermissionsRequestMessageSchema = v14.object({
625
951
  ...rpcRequestMessageSchema.entries,
626
- ...v7.object({
627
- method: v7.literal(getCurrentPermissionsMethodName),
952
+ ...v14.object({
953
+ method: v14.literal(getCurrentPermissionsMethodName),
628
954
  params: getCurrentPermissionsParamsSchema,
629
- id: v7.string()
955
+ id: v14.string()
630
956
  }).entries
631
957
  });
632
958
  var getAccountMethodName = "wallet_getAccount";
633
- var getAccountParamsSchema = v7.nullish(v7.null());
634
- var getAccountResultSchema = v7.object({
959
+ var getAccountParamsSchema = v14.nullish(v14.null());
960
+ var getAccountResultSchema = v14.object({
635
961
  id: import_xverse_core.permissions.utils.account.accountIdSchema,
636
- addresses: v7.array(addressSchema),
962
+ addresses: v14.array(addressSchema),
637
963
  walletType: walletTypeSchema
638
964
  });
639
- var getAccountRequestMessageSchema = v7.object({
965
+ var getAccountRequestMessageSchema = v14.object({
640
966
  ...rpcRequestMessageSchema.entries,
641
- ...v7.object({
642
- method: v7.literal(getAccountMethodName),
967
+ ...v14.object({
968
+ method: v14.literal(getAccountMethodName),
643
969
  params: getAccountParamsSchema,
644
- id: v7.string()
970
+ id: v14.string()
645
971
  }).entries
646
972
  });
647
973
  var connectMethodName = "wallet_connect";
648
- var connectParamsSchema = v7.nullish(
649
- v7.object({
650
- permissions: v7.optional(v7.array(permissionTemplate))
974
+ var connectParamsSchema = v14.nullish(
975
+ v14.object({
976
+ permissions: v14.optional(v14.array(permissionTemplate))
651
977
  })
652
978
  );
653
979
  var connectResultSchema = getAccountResultSchema;
654
- var connectRequestMessageSchema = v7.object({
980
+ var connectRequestMessageSchema = v14.object({
655
981
  ...rpcRequestMessageSchema.entries,
656
- ...v7.object({
657
- method: v7.literal(connectMethodName),
982
+ ...v14.object({
983
+ method: v14.literal(connectMethodName),
658
984
  params: connectParamsSchema,
659
- id: v7.string()
985
+ id: v14.string()
660
986
  }).entries
661
987
  });
662
988
 
663
989
  // src/request/types/runesMethods.ts
664
- var v8 = __toESM(require("valibot"));
990
+ var v15 = __toESM(require("valibot"));
665
991
  var getRunesBalanceMethodName = "runes_getBalance";
666
- var getRunesBalanceParamsSchema = v8.nullish(v8.null());
667
- var getRunesBalanceResultSchema = v8.object({
668
- balances: v8.array(
669
- v8.object({
670
- runeName: v8.string(),
671
- amount: v8.string(),
672
- divisibility: v8.number(),
673
- symbol: v8.string(),
674
- inscriptionId: v8.nullish(v8.string())
992
+ var getRunesBalanceParamsSchema = v15.nullish(v15.null());
993
+ var getRunesBalanceResultSchema = v15.object({
994
+ balances: v15.array(
995
+ v15.object({
996
+ runeName: v15.string(),
997
+ amount: v15.string(),
998
+ divisibility: v15.number(),
999
+ symbol: v15.string(),
1000
+ inscriptionId: v15.nullish(v15.string())
675
1001
  })
676
1002
  )
677
1003
  });
678
- var getRunesBalanceRequestMessageSchema = v8.object({
1004
+ var getRunesBalanceRequestMessageSchema = v15.object({
679
1005
  ...rpcRequestMessageSchema.entries,
680
- ...v8.object({
681
- method: v8.literal(getRunesBalanceMethodName),
1006
+ ...v15.object({
1007
+ method: v15.literal(getRunesBalanceMethodName),
682
1008
  params: getRunesBalanceParamsSchema,
683
- id: v8.string()
1009
+ id: v15.string()
684
1010
  }).entries
685
1011
  });
686
1012
  var transferRunesMethodName = "runes_transfer";
687
- var transferRunesParamsSchema = v8.object({
688
- recipients: v8.array(
689
- v8.object({
690
- runeName: v8.string(),
691
- amount: v8.string(),
692
- address: v8.string()
1013
+ var transferRunesParamsSchema = v15.object({
1014
+ recipients: v15.array(
1015
+ v15.object({
1016
+ runeName: v15.string(),
1017
+ amount: v15.string(),
1018
+ address: v15.string()
693
1019
  })
694
1020
  )
695
1021
  });
696
- var transferRunesRequestSchema = v8.object({
1022
+ var transferRunesRequestSchema = v15.object({
697
1023
  ...rpcRequestMessageSchema.entries,
698
- ...v8.object({
699
- method: v8.literal(transferRunesMethodName),
1024
+ ...v15.object({
1025
+ method: v15.literal(transferRunesMethodName),
700
1026
  params: transferRunesParamsSchema,
701
- id: v8.string()
1027
+ id: v15.string()
702
1028
  }).entries
703
1029
  });
704
- var TransferRunesResultSchema = v8.object({
705
- txid: v8.string()
1030
+ var TransferRunesResultSchema = v15.object({
1031
+ txid: v15.string()
706
1032
  });
707
1033
 
708
1034
  // src/request/types/ordinalsMethods.ts
709
- var v9 = __toESM(require("valibot"));
1035
+ var v16 = __toESM(require("valibot"));
710
1036
  var getInscriptionsMethodName = "ord_getInscriptions";
711
- var getInscriptionsParamsSchema = v9.object({
712
- offset: v9.number(),
713
- limit: v9.number()
714
- });
715
- var getInscriptionsResultSchema = v9.object({
716
- total: v9.number(),
717
- limit: v9.number(),
718
- offset: v9.number(),
719
- inscriptions: v9.array(
720
- v9.object({
721
- inscriptionId: v9.string(),
722
- inscriptionNumber: v9.string(),
723
- address: v9.string(),
724
- collectionName: v9.optional(v9.string()),
725
- postage: v9.string(),
726
- contentLength: v9.string(),
727
- contentType: v9.string(),
728
- timestamp: v9.number(),
729
- offset: v9.number(),
730
- genesisTransaction: v9.string(),
731
- output: v9.string()
1037
+ var getInscriptionsParamsSchema = v16.object({
1038
+ offset: v16.number(),
1039
+ limit: v16.number()
1040
+ });
1041
+ var getInscriptionsResultSchema = v16.object({
1042
+ total: v16.number(),
1043
+ limit: v16.number(),
1044
+ offset: v16.number(),
1045
+ inscriptions: v16.array(
1046
+ v16.object({
1047
+ inscriptionId: v16.string(),
1048
+ inscriptionNumber: v16.string(),
1049
+ address: v16.string(),
1050
+ collectionName: v16.optional(v16.string()),
1051
+ postage: v16.string(),
1052
+ contentLength: v16.string(),
1053
+ contentType: v16.string(),
1054
+ timestamp: v16.number(),
1055
+ offset: v16.number(),
1056
+ genesisTransaction: v16.string(),
1057
+ output: v16.string()
732
1058
  })
733
1059
  )
734
1060
  });
735
- var getInscriptionsSchema = v9.object({
1061
+ var getInscriptionsSchema = v16.object({
736
1062
  ...rpcRequestMessageSchema.entries,
737
- ...v9.object({
738
- method: v9.literal(getInscriptionsMethodName),
1063
+ ...v16.object({
1064
+ method: v16.literal(getInscriptionsMethodName),
739
1065
  params: getInscriptionsParamsSchema,
740
- id: v9.string()
1066
+ id: v16.string()
741
1067
  }).entries
742
1068
  });
743
1069
  var sendInscriptionsMethodName = "ord_sendInscriptions";
744
- var sendInscriptionsParamsSchema = v9.object({
745
- transfers: v9.array(
746
- v9.object({
747
- address: v9.string(),
748
- inscriptionId: v9.string()
1070
+ var sendInscriptionsParamsSchema = v16.object({
1071
+ transfers: v16.array(
1072
+ v16.object({
1073
+ address: v16.string(),
1074
+ inscriptionId: v16.string()
749
1075
  })
750
1076
  )
751
1077
  });
752
- var sendInscriptionsResultSchema = v9.object({
753
- txid: v9.string()
1078
+ var sendInscriptionsResultSchema = v16.object({
1079
+ txid: v16.string()
754
1080
  });
755
- var sendInscriptionsSchema = v9.object({
1081
+ var sendInscriptionsSchema = v16.object({
756
1082
  ...rpcRequestMessageSchema.entries,
757
- ...v9.object({
758
- method: v9.literal(sendInscriptionsMethodName),
1083
+ ...v16.object({
1084
+ method: v16.literal(sendInscriptionsMethodName),
759
1085
  params: sendInscriptionsParamsSchema,
760
- id: v9.string()
1086
+ id: v16.string()
761
1087
  }).entries
762
1088
  });
763
1089
 
@@ -774,13 +1100,13 @@ var request = async (method, params, providerId) => {
774
1100
  throw new Error("A wallet method is required");
775
1101
  }
776
1102
  const response = await provider.request(method, params);
777
- if (v10.is(rpcErrorResponseMessageSchema, response)) {
1103
+ if (v17.is(rpcErrorResponseMessageSchema, response)) {
778
1104
  return {
779
1105
  status: "error",
780
1106
  error: response.error
781
1107
  };
782
1108
  }
783
- if (v10.is(rpcSuccessResponseMessageSchema, response)) {
1109
+ if (v17.is(rpcSuccessResponseMessageSchema, response)) {
784
1110
  return {
785
1111
  status: "success",
786
1112
  result: response.result
@@ -1827,15 +2153,43 @@ var signMultipleTransactions = async (options) => {
1827
2153
  signMessageRequestMessageSchema,
1828
2154
  signMessageResultSchema,
1829
2155
  signMultipleTransactions,
2156
+ signPsbtMethodName,
2157
+ signPsbtParamsSchema,
2158
+ signPsbtRequestMessageSchema,
2159
+ signPsbtResultSchema,
1830
2160
  signTransaction,
2161
+ stxCallContractMethodName,
2162
+ stxCallContractParamsSchema,
2163
+ stxCallContractRequestMessageSchema,
2164
+ stxCallContractResultSchema,
2165
+ stxDeployContractMethodName,
2166
+ stxDeployContractParamsSchema,
2167
+ stxDeployContractRequestMessageSchema,
2168
+ stxDeployContractResultSchema,
2169
+ stxGetAccountsMethodName,
2170
+ stxGetAccountsParamsSchema,
2171
+ stxGetAccountsRequestMessageSchema,
2172
+ stxGetAccountsResultSchema,
1831
2173
  stxGetAddressesMethodName,
1832
2174
  stxGetAddressesParamsSchema,
1833
2175
  stxGetAddressesRequestMessageSchema,
1834
2176
  stxGetAddressesResultSchema,
2177
+ stxSignMessageMethodName,
2178
+ stxSignMessageParamsSchema,
2179
+ stxSignMessageRequestMessageSchema,
2180
+ stxSignMessageResultSchema,
2181
+ stxSignStructuredMessageMethodName,
2182
+ stxSignStructuredMessageParamsSchema,
2183
+ stxSignStructuredMessageRequestMessageSchema,
2184
+ stxSignStructuredMessageResultSchema,
1835
2185
  stxSignTransactionMethodName,
1836
2186
  stxSignTransactionParamsSchema,
1837
2187
  stxSignTransactionRequestMessageSchema,
1838
2188
  stxSignTransactionResultSchema,
2189
+ stxTransferStxMethodName,
2190
+ stxTransferStxParamsSchema,
2191
+ stxTransferStxRequestMessageSchema,
2192
+ stxTransferStxResultSchema,
1839
2193
  transferRunesMethodName,
1840
2194
  transferRunesParamsSchema,
1841
2195
  transferRunesRequestSchema,