@sats-connect/core 0.4.0 → 0.4.1-364d53c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +42 -1
- package/dist/index.d.ts +42 -1
- package/dist/index.js +325 -288
- package/dist/index.mjs +321 -288
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -109,7 +109,7 @@ var rpcResponseMessageSchema = v2.union([
|
|
|
109
109
|
]);
|
|
110
110
|
|
|
111
111
|
// src/request/index.ts
|
|
112
|
-
import * as
|
|
112
|
+
import * as v21 from "valibot";
|
|
113
113
|
|
|
114
114
|
// src/request/types/stxMethods/callContract.ts
|
|
115
115
|
import * as v3 from "valibot";
|
|
@@ -404,10 +404,40 @@ var stxSignTransactionRequestMessageSchema = v10.object({
|
|
|
404
404
|
}).entries
|
|
405
405
|
});
|
|
406
406
|
|
|
407
|
-
// src/request/types/stxMethods/
|
|
407
|
+
// src/request/types/stxMethods/signTransactions.ts
|
|
408
408
|
import * as v11 from "valibot";
|
|
409
|
+
var stxSignTransactionsMethodName = "stx_signTransactions";
|
|
410
|
+
var stxSignTransactionsParamsSchema = v11.object({
|
|
411
|
+
/**
|
|
412
|
+
* The transactions to sign as hex-encoded strings.
|
|
413
|
+
*/
|
|
414
|
+
transactions: v11.array(v11.string()),
|
|
415
|
+
/**
|
|
416
|
+
* Whether the signed transactions should be broadcast after signing. Defaults
|
|
417
|
+
* to `true`.
|
|
418
|
+
*/
|
|
419
|
+
broadcast: v11.optional(v11.boolean())
|
|
420
|
+
});
|
|
421
|
+
var stxSignTransactionsResultSchema = v11.object({
|
|
422
|
+
/**
|
|
423
|
+
* The signed transactions as hex-encoded strings, in the same order as in the
|
|
424
|
+
* sign request.
|
|
425
|
+
*/
|
|
426
|
+
transactions: v11.array(v11.string())
|
|
427
|
+
});
|
|
428
|
+
var stxSignTransactionsRequestMessageSchema = v11.object({
|
|
429
|
+
...rpcRequestMessageSchema.entries,
|
|
430
|
+
...v11.object({
|
|
431
|
+
method: v11.literal(stxSignTransactionsMethodName),
|
|
432
|
+
params: stxSignTransactionsParamsSchema,
|
|
433
|
+
id: v11.string()
|
|
434
|
+
}).entries
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
// src/request/types/stxMethods/transferStx.ts
|
|
438
|
+
import * as v12 from "valibot";
|
|
409
439
|
var stxTransferStxMethodName = "stx_transferStx";
|
|
410
|
-
var stxTransferStxParamsSchema =
|
|
440
|
+
var stxTransferStxParamsSchema = v12.object({
|
|
411
441
|
/**
|
|
412
442
|
* Amount of STX tokens to transfer in microstacks as a string. Anything
|
|
413
443
|
* parseable by `BigInt` is acceptable.
|
|
@@ -420,23 +450,23 @@ var stxTransferStxParamsSchema = v11.object({
|
|
|
420
450
|
* const amount3 = '1234';
|
|
421
451
|
* ```
|
|
422
452
|
*/
|
|
423
|
-
amount:
|
|
453
|
+
amount: v12.union([v12.number(), v12.string()]),
|
|
424
454
|
/**
|
|
425
455
|
* The recipeint's principal.
|
|
426
456
|
*/
|
|
427
|
-
recipient:
|
|
457
|
+
recipient: v12.string(),
|
|
428
458
|
/**
|
|
429
459
|
* A string representing the memo.
|
|
430
460
|
*/
|
|
431
|
-
memo:
|
|
461
|
+
memo: v12.optional(v12.string()),
|
|
432
462
|
/**
|
|
433
463
|
* Version of parameter format.
|
|
434
464
|
*/
|
|
435
|
-
version:
|
|
465
|
+
version: v12.optional(v12.string()),
|
|
436
466
|
/**
|
|
437
467
|
* The mode of the post conditions.
|
|
438
468
|
*/
|
|
439
|
-
postConditionMode:
|
|
469
|
+
postConditionMode: v12.optional(v12.number()),
|
|
440
470
|
/**
|
|
441
471
|
* A hex-encoded string representing the post conditions.
|
|
442
472
|
*
|
|
@@ -449,89 +479,89 @@ var stxTransferStxParamsSchema = v11.object({
|
|
|
449
479
|
* const hexPostCondition = serializePostCondition(postCondition).toString('hex');
|
|
450
480
|
* ```
|
|
451
481
|
*/
|
|
452
|
-
postConditions:
|
|
482
|
+
postConditions: v12.optional(v12.array(v12.string())),
|
|
453
483
|
/**
|
|
454
484
|
* The public key to sign the transaction with. The wallet may use any key
|
|
455
485
|
* when not provided.
|
|
456
486
|
*/
|
|
457
|
-
pubkey:
|
|
487
|
+
pubkey: v12.optional(v12.string())
|
|
458
488
|
});
|
|
459
|
-
var stxTransferStxResultSchema =
|
|
489
|
+
var stxTransferStxResultSchema = v12.object({
|
|
460
490
|
/**
|
|
461
491
|
* The ID of the transaction.
|
|
462
492
|
*/
|
|
463
|
-
txid:
|
|
493
|
+
txid: v12.string(),
|
|
464
494
|
/**
|
|
465
495
|
* A Stacks transaction as a hex-encoded string.
|
|
466
496
|
*/
|
|
467
|
-
transaction:
|
|
497
|
+
transaction: v12.string()
|
|
468
498
|
});
|
|
469
|
-
var stxTransferStxRequestMessageSchema =
|
|
499
|
+
var stxTransferStxRequestMessageSchema = v12.object({
|
|
470
500
|
...rpcRequestMessageSchema.entries,
|
|
471
|
-
...
|
|
472
|
-
method:
|
|
501
|
+
...v12.object({
|
|
502
|
+
method: v12.literal(stxTransferStxMethodName),
|
|
473
503
|
params: stxTransferStxParamsSchema,
|
|
474
|
-
id:
|
|
504
|
+
id: v12.string()
|
|
475
505
|
}).entries
|
|
476
506
|
});
|
|
477
507
|
|
|
478
508
|
// src/request/types/btcMethods.ts
|
|
479
|
-
import * as
|
|
509
|
+
import * as v14 from "valibot";
|
|
480
510
|
|
|
481
511
|
// src/request/types/common.ts
|
|
482
|
-
import * as
|
|
512
|
+
import * as v13 from "valibot";
|
|
483
513
|
var walletTypes = ["software", "ledger"];
|
|
484
|
-
var walletTypeSchema =
|
|
514
|
+
var walletTypeSchema = v13.picklist(walletTypes);
|
|
485
515
|
|
|
486
516
|
// src/request/types/btcMethods.ts
|
|
487
517
|
var getInfoMethodName = "getInfo";
|
|
488
|
-
var getInfoParamsSchema =
|
|
489
|
-
var getInfoResultSchema =
|
|
518
|
+
var getInfoParamsSchema = v14.nullish(v14.null());
|
|
519
|
+
var getInfoResultSchema = v14.object({
|
|
490
520
|
/**
|
|
491
521
|
* Version of the wallet.
|
|
492
522
|
*/
|
|
493
|
-
version:
|
|
523
|
+
version: v14.string(),
|
|
494
524
|
/**
|
|
495
525
|
* [WBIP](https://wbips.netlify.app/wbips/WBIP002) methods supported by the wallet.
|
|
496
526
|
*/
|
|
497
|
-
methods:
|
|
527
|
+
methods: v14.optional(v14.array(v14.string())),
|
|
498
528
|
/**
|
|
499
529
|
* List of WBIP standards supported by the wallet. Not currently used.
|
|
500
530
|
*/
|
|
501
|
-
supports:
|
|
531
|
+
supports: v14.array(v14.string())
|
|
502
532
|
});
|
|
503
|
-
var getInfoRequestMessageSchema =
|
|
533
|
+
var getInfoRequestMessageSchema = v14.object({
|
|
504
534
|
...rpcRequestMessageSchema.entries,
|
|
505
|
-
...
|
|
506
|
-
method:
|
|
535
|
+
...v14.object({
|
|
536
|
+
method: v14.literal(getInfoMethodName),
|
|
507
537
|
params: getInfoParamsSchema,
|
|
508
|
-
id:
|
|
538
|
+
id: v14.string()
|
|
509
539
|
}).entries
|
|
510
540
|
});
|
|
511
541
|
var getAddressesMethodName = "getAddresses";
|
|
512
|
-
var getAddressesParamsSchema =
|
|
542
|
+
var getAddressesParamsSchema = v14.object({
|
|
513
543
|
/**
|
|
514
544
|
* The purposes for which to generate addresses. See
|
|
515
545
|
* {@linkcode AddressPurpose} for available purposes.
|
|
516
546
|
*/
|
|
517
|
-
purposes:
|
|
547
|
+
purposes: v14.array(v14.enum(AddressPurpose)),
|
|
518
548
|
/**
|
|
519
549
|
* A message to be displayed to the user in the request prompt.
|
|
520
550
|
*/
|
|
521
|
-
message:
|
|
551
|
+
message: v14.optional(v14.string())
|
|
522
552
|
});
|
|
523
|
-
var getAddressesResultSchema =
|
|
553
|
+
var getAddressesResultSchema = v14.object({
|
|
524
554
|
/**
|
|
525
555
|
* The addresses generated for the given purposes.
|
|
526
556
|
*/
|
|
527
|
-
addresses:
|
|
557
|
+
addresses: v14.array(addressSchema)
|
|
528
558
|
});
|
|
529
|
-
var getAddressesRequestMessageSchema =
|
|
559
|
+
var getAddressesRequestMessageSchema = v14.object({
|
|
530
560
|
...rpcRequestMessageSchema.entries,
|
|
531
|
-
...
|
|
532
|
-
method:
|
|
561
|
+
...v14.object({
|
|
562
|
+
method: v14.literal(getAddressesMethodName),
|
|
533
563
|
params: getAddressesParamsSchema,
|
|
534
|
-
id:
|
|
564
|
+
id: v14.string()
|
|
535
565
|
}).entries
|
|
536
566
|
});
|
|
537
567
|
var signMessageMethodName = "signMessage";
|
|
@@ -540,456 +570,456 @@ var MessageSigningProtocols = /* @__PURE__ */ ((MessageSigningProtocols2) => {
|
|
|
540
570
|
MessageSigningProtocols2["BIP322"] = "BIP322";
|
|
541
571
|
return MessageSigningProtocols2;
|
|
542
572
|
})(MessageSigningProtocols || {});
|
|
543
|
-
var signMessageParamsSchema =
|
|
573
|
+
var signMessageParamsSchema = v14.object({
|
|
544
574
|
/**
|
|
545
575
|
* The address used for signing.
|
|
546
576
|
**/
|
|
547
|
-
address:
|
|
577
|
+
address: v14.string(),
|
|
548
578
|
/**
|
|
549
579
|
* The message to sign.
|
|
550
580
|
**/
|
|
551
|
-
message:
|
|
581
|
+
message: v14.string(),
|
|
552
582
|
/**
|
|
553
583
|
* The protocol to use for signing the message.
|
|
554
584
|
*/
|
|
555
|
-
protocol:
|
|
585
|
+
protocol: v14.optional(v14.enum(MessageSigningProtocols))
|
|
556
586
|
});
|
|
557
|
-
var signMessageResultSchema =
|
|
587
|
+
var signMessageResultSchema = v14.object({
|
|
558
588
|
/**
|
|
559
589
|
* The signature of the message.
|
|
560
590
|
*/
|
|
561
|
-
signature:
|
|
591
|
+
signature: v14.string(),
|
|
562
592
|
/**
|
|
563
593
|
* hash of the message.
|
|
564
594
|
*/
|
|
565
|
-
messageHash:
|
|
595
|
+
messageHash: v14.string(),
|
|
566
596
|
/**
|
|
567
597
|
* The address used for signing.
|
|
568
598
|
*/
|
|
569
|
-
address:
|
|
599
|
+
address: v14.string(),
|
|
570
600
|
/**
|
|
571
601
|
* The protocol to use for signing the message.
|
|
572
602
|
*/
|
|
573
|
-
protocol:
|
|
603
|
+
protocol: v14.enum(MessageSigningProtocols)
|
|
574
604
|
});
|
|
575
|
-
var signMessageRequestMessageSchema =
|
|
605
|
+
var signMessageRequestMessageSchema = v14.object({
|
|
576
606
|
...rpcRequestMessageSchema.entries,
|
|
577
|
-
...
|
|
578
|
-
method:
|
|
607
|
+
...v14.object({
|
|
608
|
+
method: v14.literal(signMessageMethodName),
|
|
579
609
|
params: signMessageParamsSchema,
|
|
580
|
-
id:
|
|
610
|
+
id: v14.string()
|
|
581
611
|
}).entries
|
|
582
612
|
});
|
|
583
613
|
var sendTransferMethodName = "sendTransfer";
|
|
584
|
-
var sendTransferParamsSchema =
|
|
614
|
+
var sendTransferParamsSchema = v14.object({
|
|
585
615
|
/**
|
|
586
616
|
* Array of recipients to send to.
|
|
587
617
|
* The amount to send to each recipient is in satoshis.
|
|
588
618
|
*/
|
|
589
|
-
recipients:
|
|
590
|
-
|
|
591
|
-
address:
|
|
592
|
-
amount:
|
|
619
|
+
recipients: v14.array(
|
|
620
|
+
v14.object({
|
|
621
|
+
address: v14.string(),
|
|
622
|
+
amount: v14.number()
|
|
593
623
|
})
|
|
594
624
|
)
|
|
595
625
|
});
|
|
596
|
-
var sendTransferResultSchema =
|
|
626
|
+
var sendTransferResultSchema = v14.object({
|
|
597
627
|
/**
|
|
598
628
|
* The transaction id as a hex-encoded string.
|
|
599
629
|
*/
|
|
600
|
-
txid:
|
|
630
|
+
txid: v14.string()
|
|
601
631
|
});
|
|
602
|
-
var sendTransferRequestMessageSchema =
|
|
632
|
+
var sendTransferRequestMessageSchema = v14.object({
|
|
603
633
|
...rpcRequestMessageSchema.entries,
|
|
604
|
-
...
|
|
605
|
-
method:
|
|
634
|
+
...v14.object({
|
|
635
|
+
method: v14.literal(sendTransferMethodName),
|
|
606
636
|
params: sendTransferParamsSchema,
|
|
607
|
-
id:
|
|
637
|
+
id: v14.string()
|
|
608
638
|
}).entries
|
|
609
639
|
});
|
|
610
640
|
var signPsbtMethodName = "signPsbt";
|
|
611
|
-
var signPsbtParamsSchema =
|
|
641
|
+
var signPsbtParamsSchema = v14.object({
|
|
612
642
|
/**
|
|
613
643
|
* The base64 encoded PSBT to sign.
|
|
614
644
|
*/
|
|
615
|
-
psbt:
|
|
645
|
+
psbt: v14.string(),
|
|
616
646
|
/**
|
|
617
647
|
* The inputs to sign.
|
|
618
648
|
* The key is the address and the value is an array of indexes of the inputs to sign.
|
|
619
649
|
*/
|
|
620
|
-
signInputs:
|
|
650
|
+
signInputs: v14.record(v14.string(), v14.array(v14.number())),
|
|
621
651
|
/**
|
|
622
652
|
* Whether to broadcast the transaction after signing.
|
|
623
653
|
**/
|
|
624
|
-
broadcast:
|
|
654
|
+
broadcast: v14.optional(v14.boolean())
|
|
625
655
|
});
|
|
626
|
-
var signPsbtResultSchema =
|
|
656
|
+
var signPsbtResultSchema = v14.object({
|
|
627
657
|
/**
|
|
628
658
|
* The base64 encoded PSBT after signing.
|
|
629
659
|
*/
|
|
630
|
-
psbt:
|
|
660
|
+
psbt: v14.string(),
|
|
631
661
|
/**
|
|
632
662
|
* The transaction id as a hex-encoded string.
|
|
633
663
|
* This is only returned if the transaction was broadcast.
|
|
634
664
|
**/
|
|
635
|
-
txid:
|
|
665
|
+
txid: v14.optional(v14.string())
|
|
636
666
|
});
|
|
637
|
-
var signPsbtRequestMessageSchema =
|
|
667
|
+
var signPsbtRequestMessageSchema = v14.object({
|
|
638
668
|
...rpcRequestMessageSchema.entries,
|
|
639
|
-
...
|
|
640
|
-
method:
|
|
669
|
+
...v14.object({
|
|
670
|
+
method: v14.literal(signPsbtMethodName),
|
|
641
671
|
params: signPsbtParamsSchema,
|
|
642
|
-
id:
|
|
672
|
+
id: v14.string()
|
|
643
673
|
}).entries
|
|
644
674
|
});
|
|
645
675
|
var getAccountsMethodName = "getAccounts";
|
|
646
|
-
var getAccountsParamsSchema =
|
|
676
|
+
var getAccountsParamsSchema = v14.object({
|
|
647
677
|
/**
|
|
648
678
|
* The purposes for which to generate addresses. See
|
|
649
679
|
* {@linkcode AddressPurpose} for available purposes.
|
|
650
680
|
*/
|
|
651
|
-
purposes:
|
|
681
|
+
purposes: v14.array(v14.enum(AddressPurpose)),
|
|
652
682
|
/**
|
|
653
683
|
* A message to be displayed to the user in the request prompt.
|
|
654
684
|
*/
|
|
655
|
-
message:
|
|
685
|
+
message: v14.optional(v14.string())
|
|
656
686
|
});
|
|
657
|
-
var getAccountsResultSchema =
|
|
658
|
-
|
|
687
|
+
var getAccountsResultSchema = v14.array(
|
|
688
|
+
v14.object({
|
|
659
689
|
...addressSchema.entries,
|
|
660
|
-
...
|
|
690
|
+
...v14.object({
|
|
661
691
|
walletType: walletTypeSchema
|
|
662
692
|
}).entries
|
|
663
693
|
})
|
|
664
694
|
);
|
|
665
|
-
var getAccountsRequestMessageSchema =
|
|
695
|
+
var getAccountsRequestMessageSchema = v14.object({
|
|
666
696
|
...rpcRequestMessageSchema.entries,
|
|
667
|
-
...
|
|
668
|
-
method:
|
|
697
|
+
...v14.object({
|
|
698
|
+
method: v14.literal(getAccountsMethodName),
|
|
669
699
|
params: getAccountsParamsSchema,
|
|
670
|
-
id:
|
|
700
|
+
id: v14.string()
|
|
671
701
|
}).entries
|
|
672
702
|
});
|
|
673
703
|
var getBalanceMethodName = "getBalance";
|
|
674
|
-
var getBalanceParamsSchema =
|
|
675
|
-
var getBalanceResultSchema =
|
|
704
|
+
var getBalanceParamsSchema = v14.nullish(v14.null());
|
|
705
|
+
var getBalanceResultSchema = v14.object({
|
|
676
706
|
/**
|
|
677
707
|
* The confirmed balance of the wallet in sats. Using a string due to chrome
|
|
678
708
|
* messages not supporting bigint
|
|
679
709
|
* (https://issues.chromium.org/issues/40116184).
|
|
680
710
|
*/
|
|
681
|
-
confirmed:
|
|
711
|
+
confirmed: v14.string(),
|
|
682
712
|
/**
|
|
683
713
|
* The unconfirmed balance of the wallet in sats. Using a string due to chrome
|
|
684
714
|
* messages not supporting bigint
|
|
685
715
|
* (https://issues.chromium.org/issues/40116184).
|
|
686
716
|
*/
|
|
687
|
-
unconfirmed:
|
|
717
|
+
unconfirmed: v14.string(),
|
|
688
718
|
/**
|
|
689
719
|
* The total balance (both confirmed and unconfrimed UTXOs) of the wallet in
|
|
690
720
|
* sats. Using a string due to chrome messages not supporting bigint
|
|
691
721
|
* (https://issues.chromium.org/issues/40116184).
|
|
692
722
|
*/
|
|
693
|
-
total:
|
|
723
|
+
total: v14.string()
|
|
694
724
|
});
|
|
695
|
-
var getBalanceRequestMessageSchema =
|
|
725
|
+
var getBalanceRequestMessageSchema = v14.object({
|
|
696
726
|
...rpcRequestMessageSchema.entries,
|
|
697
|
-
...
|
|
698
|
-
method:
|
|
699
|
-
id:
|
|
727
|
+
...v14.object({
|
|
728
|
+
method: v14.literal(getBalanceMethodName),
|
|
729
|
+
id: v14.string()
|
|
700
730
|
}).entries
|
|
701
731
|
});
|
|
702
732
|
|
|
703
733
|
// src/request/types/walletMethods.ts
|
|
704
|
-
import * as
|
|
705
|
-
var accountActionsSchema =
|
|
706
|
-
read:
|
|
707
|
-
});
|
|
708
|
-
var walletActionsSchema =
|
|
709
|
-
var accountPermissionSchema =
|
|
710
|
-
type:
|
|
711
|
-
resourceId:
|
|
712
|
-
clientId:
|
|
734
|
+
import * as v15 from "valibot";
|
|
735
|
+
var accountActionsSchema = v15.object({
|
|
736
|
+
read: v15.optional(v15.boolean())
|
|
737
|
+
});
|
|
738
|
+
var walletActionsSchema = v15.object({});
|
|
739
|
+
var accountPermissionSchema = v15.object({
|
|
740
|
+
type: v15.literal("account"),
|
|
741
|
+
resourceId: v15.string(),
|
|
742
|
+
clientId: v15.string(),
|
|
713
743
|
actions: accountActionsSchema
|
|
714
744
|
});
|
|
715
|
-
var walletPermissionSchema =
|
|
716
|
-
type:
|
|
717
|
-
resourceId:
|
|
718
|
-
clientId:
|
|
745
|
+
var walletPermissionSchema = v15.object({
|
|
746
|
+
type: v15.literal("wallet"),
|
|
747
|
+
resourceId: v15.string(),
|
|
748
|
+
clientId: v15.string(),
|
|
719
749
|
actions: walletActionsSchema
|
|
720
750
|
});
|
|
721
|
-
var PermissionRequestParams =
|
|
722
|
-
|
|
723
|
-
...
|
|
751
|
+
var PermissionRequestParams = v15.variant("type", [
|
|
752
|
+
v15.object({
|
|
753
|
+
...v15.omit(accountPermissionSchema, ["clientId"]).entries
|
|
724
754
|
}),
|
|
725
|
-
|
|
726
|
-
...
|
|
755
|
+
v15.object({
|
|
756
|
+
...v15.omit(walletPermissionSchema, ["clientId"]).entries
|
|
727
757
|
})
|
|
728
758
|
]);
|
|
729
|
-
var permission =
|
|
759
|
+
var permission = v15.variant("type", [accountPermissionSchema, walletPermissionSchema]);
|
|
730
760
|
var requestPermissionsMethodName = "wallet_requestPermissions";
|
|
731
|
-
var requestPermissionsParamsSchema =
|
|
732
|
-
var requestPermissionsResultSchema =
|
|
733
|
-
var requestPermissionsRequestMessageSchema =
|
|
761
|
+
var requestPermissionsParamsSchema = v15.nullish(v15.array(PermissionRequestParams));
|
|
762
|
+
var requestPermissionsResultSchema = v15.literal(true);
|
|
763
|
+
var requestPermissionsRequestMessageSchema = v15.object({
|
|
734
764
|
...rpcRequestMessageSchema.entries,
|
|
735
|
-
...
|
|
736
|
-
method:
|
|
765
|
+
...v15.object({
|
|
766
|
+
method: v15.literal(requestPermissionsMethodName),
|
|
737
767
|
params: requestPermissionsParamsSchema,
|
|
738
|
-
id:
|
|
768
|
+
id: v15.string()
|
|
739
769
|
}).entries
|
|
740
770
|
});
|
|
741
771
|
var renouncePermissionsMethodName = "wallet_renouncePermissions";
|
|
742
|
-
var renouncePermissionsParamsSchema =
|
|
743
|
-
var renouncePermissionsResultSchema =
|
|
744
|
-
var renouncePermissionsRequestMessageSchema =
|
|
772
|
+
var renouncePermissionsParamsSchema = v15.nullish(v15.null());
|
|
773
|
+
var renouncePermissionsResultSchema = v15.nullish(v15.null());
|
|
774
|
+
var renouncePermissionsRequestMessageSchema = v15.object({
|
|
745
775
|
...rpcRequestMessageSchema.entries,
|
|
746
|
-
...
|
|
747
|
-
method:
|
|
776
|
+
...v15.object({
|
|
777
|
+
method: v15.literal(renouncePermissionsMethodName),
|
|
748
778
|
params: renouncePermissionsParamsSchema,
|
|
749
|
-
id:
|
|
779
|
+
id: v15.string()
|
|
750
780
|
}).entries
|
|
751
781
|
});
|
|
752
782
|
var disconnectMethodName = "wallet_disconnect";
|
|
753
|
-
var disconnectParamsSchema =
|
|
754
|
-
var disconnectResultSchema =
|
|
755
|
-
var disconnectRequestMessageSchema =
|
|
783
|
+
var disconnectParamsSchema = v15.nullish(v15.null());
|
|
784
|
+
var disconnectResultSchema = v15.nullish(v15.null());
|
|
785
|
+
var disconnectRequestMessageSchema = v15.object({
|
|
756
786
|
...rpcRequestMessageSchema.entries,
|
|
757
|
-
...
|
|
758
|
-
method:
|
|
787
|
+
...v15.object({
|
|
788
|
+
method: v15.literal(disconnectMethodName),
|
|
759
789
|
params: disconnectParamsSchema,
|
|
760
|
-
id:
|
|
790
|
+
id: v15.string()
|
|
761
791
|
}).entries
|
|
762
792
|
});
|
|
763
793
|
var getWalletTypeMethodName = "wallet_getWalletType";
|
|
764
|
-
var getWalletTypeParamsSchema =
|
|
794
|
+
var getWalletTypeParamsSchema = v15.nullish(v15.null());
|
|
765
795
|
var getWalletTypeResultSchema = walletTypeSchema;
|
|
766
|
-
var getWalletTypeRequestMessageSchema =
|
|
796
|
+
var getWalletTypeRequestMessageSchema = v15.object({
|
|
767
797
|
...rpcRequestMessageSchema.entries,
|
|
768
|
-
...
|
|
769
|
-
method:
|
|
798
|
+
...v15.object({
|
|
799
|
+
method: v15.literal(getWalletTypeMethodName),
|
|
770
800
|
params: getWalletTypeParamsSchema,
|
|
771
|
-
id:
|
|
801
|
+
id: v15.string()
|
|
772
802
|
}).entries
|
|
773
803
|
});
|
|
774
804
|
var getCurrentPermissionsMethodName = "wallet_getCurrentPermissions";
|
|
775
|
-
var getCurrentPermissionsParamsSchema =
|
|
776
|
-
var getCurrentPermissionsResultSchema =
|
|
777
|
-
var getCurrentPermissionsRequestMessageSchema =
|
|
805
|
+
var getCurrentPermissionsParamsSchema = v15.nullish(v15.null());
|
|
806
|
+
var getCurrentPermissionsResultSchema = v15.array(permission);
|
|
807
|
+
var getCurrentPermissionsRequestMessageSchema = v15.object({
|
|
778
808
|
...rpcRequestMessageSchema.entries,
|
|
779
|
-
...
|
|
780
|
-
method:
|
|
809
|
+
...v15.object({
|
|
810
|
+
method: v15.literal(getCurrentPermissionsMethodName),
|
|
781
811
|
params: getCurrentPermissionsParamsSchema,
|
|
782
|
-
id:
|
|
812
|
+
id: v15.string()
|
|
783
813
|
}).entries
|
|
784
814
|
});
|
|
785
815
|
var getAccountMethodName = "wallet_getAccount";
|
|
786
|
-
var getAccountParamsSchema =
|
|
787
|
-
var getAccountResultSchema =
|
|
788
|
-
id:
|
|
789
|
-
addresses:
|
|
816
|
+
var getAccountParamsSchema = v15.nullish(v15.null());
|
|
817
|
+
var getAccountResultSchema = v15.object({
|
|
818
|
+
id: v15.string(),
|
|
819
|
+
addresses: v15.array(addressSchema),
|
|
790
820
|
walletType: walletTypeSchema
|
|
791
821
|
});
|
|
792
|
-
var getAccountRequestMessageSchema =
|
|
822
|
+
var getAccountRequestMessageSchema = v15.object({
|
|
793
823
|
...rpcRequestMessageSchema.entries,
|
|
794
|
-
...
|
|
795
|
-
method:
|
|
824
|
+
...v15.object({
|
|
825
|
+
method: v15.literal(getAccountMethodName),
|
|
796
826
|
params: getAccountParamsSchema,
|
|
797
|
-
id:
|
|
827
|
+
id: v15.string()
|
|
798
828
|
}).entries
|
|
799
829
|
});
|
|
800
830
|
var connectMethodName = "wallet_connect";
|
|
801
|
-
var connectParamsSchema =
|
|
802
|
-
|
|
803
|
-
permissions:
|
|
804
|
-
addresses:
|
|
805
|
-
message:
|
|
806
|
-
|
|
831
|
+
var connectParamsSchema = v15.nullish(
|
|
832
|
+
v15.object({
|
|
833
|
+
permissions: v15.optional(v15.array(PermissionRequestParams)),
|
|
834
|
+
addresses: v15.optional(v15.array(v15.enum(AddressPurpose))),
|
|
835
|
+
message: v15.optional(
|
|
836
|
+
v15.pipe(v15.string(), v15.maxLength(80, "The message must not exceed 80 characters."))
|
|
807
837
|
)
|
|
808
838
|
})
|
|
809
839
|
);
|
|
810
840
|
var connectResultSchema = getAccountResultSchema;
|
|
811
|
-
var connectRequestMessageSchema =
|
|
841
|
+
var connectRequestMessageSchema = v15.object({
|
|
812
842
|
...rpcRequestMessageSchema.entries,
|
|
813
|
-
...
|
|
814
|
-
method:
|
|
843
|
+
...v15.object({
|
|
844
|
+
method: v15.literal(connectMethodName),
|
|
815
845
|
params: connectParamsSchema,
|
|
816
|
-
id:
|
|
846
|
+
id: v15.string()
|
|
817
847
|
}).entries
|
|
818
848
|
});
|
|
819
849
|
|
|
820
850
|
// src/request/types/runesMethods/etch.ts
|
|
821
|
-
import * as
|
|
851
|
+
import * as v16 from "valibot";
|
|
822
852
|
var runesEtchMethodName = "runes_etch";
|
|
823
|
-
var etchTermsSchema =
|
|
824
|
-
amount:
|
|
825
|
-
cap:
|
|
826
|
-
heightStart:
|
|
827
|
-
heightEnd:
|
|
828
|
-
offsetStart:
|
|
829
|
-
offsetEnd:
|
|
830
|
-
});
|
|
831
|
-
var inscriptionDetailsSchema =
|
|
832
|
-
contentType:
|
|
833
|
-
contentBase64:
|
|
834
|
-
});
|
|
835
|
-
var runesEtchParamsSchema =
|
|
836
|
-
runeName:
|
|
837
|
-
divisibility:
|
|
838
|
-
symbol:
|
|
839
|
-
premine:
|
|
840
|
-
isMintable:
|
|
841
|
-
delegateInscriptionId:
|
|
842
|
-
destinationAddress:
|
|
843
|
-
refundAddress:
|
|
844
|
-
feeRate:
|
|
845
|
-
appServiceFee:
|
|
846
|
-
appServiceFeeAddress:
|
|
847
|
-
terms:
|
|
848
|
-
inscriptionDetails:
|
|
849
|
-
network:
|
|
850
|
-
});
|
|
851
|
-
var runesEtchResultSchema =
|
|
852
|
-
orderId:
|
|
853
|
-
fundTransactionId:
|
|
854
|
-
fundingAddress:
|
|
855
|
-
});
|
|
856
|
-
var runesEtchRequestMessageSchema =
|
|
853
|
+
var etchTermsSchema = v16.object({
|
|
854
|
+
amount: v16.string(),
|
|
855
|
+
cap: v16.string(),
|
|
856
|
+
heightStart: v16.optional(v16.string()),
|
|
857
|
+
heightEnd: v16.optional(v16.string()),
|
|
858
|
+
offsetStart: v16.optional(v16.string()),
|
|
859
|
+
offsetEnd: v16.optional(v16.string())
|
|
860
|
+
});
|
|
861
|
+
var inscriptionDetailsSchema = v16.object({
|
|
862
|
+
contentType: v16.string(),
|
|
863
|
+
contentBase64: v16.string()
|
|
864
|
+
});
|
|
865
|
+
var runesEtchParamsSchema = v16.object({
|
|
866
|
+
runeName: v16.string(),
|
|
867
|
+
divisibility: v16.optional(v16.number()),
|
|
868
|
+
symbol: v16.optional(v16.string()),
|
|
869
|
+
premine: v16.optional(v16.string()),
|
|
870
|
+
isMintable: v16.boolean(),
|
|
871
|
+
delegateInscriptionId: v16.optional(v16.string()),
|
|
872
|
+
destinationAddress: v16.string(),
|
|
873
|
+
refundAddress: v16.string(),
|
|
874
|
+
feeRate: v16.number(),
|
|
875
|
+
appServiceFee: v16.optional(v16.number()),
|
|
876
|
+
appServiceFeeAddress: v16.optional(v16.string()),
|
|
877
|
+
terms: v16.optional(etchTermsSchema),
|
|
878
|
+
inscriptionDetails: v16.optional(inscriptionDetailsSchema),
|
|
879
|
+
network: v16.optional(v16.enum(BitcoinNetworkType))
|
|
880
|
+
});
|
|
881
|
+
var runesEtchResultSchema = v16.object({
|
|
882
|
+
orderId: v16.string(),
|
|
883
|
+
fundTransactionId: v16.string(),
|
|
884
|
+
fundingAddress: v16.string()
|
|
885
|
+
});
|
|
886
|
+
var runesEtchRequestMessageSchema = v16.object({
|
|
857
887
|
...rpcRequestMessageSchema.entries,
|
|
858
|
-
...
|
|
859
|
-
method:
|
|
888
|
+
...v16.object({
|
|
889
|
+
method: v16.literal(runesEtchMethodName),
|
|
860
890
|
params: runesEtchParamsSchema,
|
|
861
|
-
id:
|
|
891
|
+
id: v16.string()
|
|
862
892
|
}).entries
|
|
863
893
|
});
|
|
864
894
|
|
|
865
895
|
// src/request/types/runesMethods/getBalance.ts
|
|
866
|
-
import * as
|
|
896
|
+
import * as v17 from "valibot";
|
|
867
897
|
var runesGetBalanceMethodName = "runes_getBalance";
|
|
868
|
-
var runesGetBalanceParamsSchema =
|
|
869
|
-
var runesGetBalanceResultSchema =
|
|
870
|
-
balances:
|
|
871
|
-
|
|
872
|
-
runeName:
|
|
873
|
-
amount:
|
|
874
|
-
divisibility:
|
|
875
|
-
symbol:
|
|
876
|
-
inscriptionId:
|
|
898
|
+
var runesGetBalanceParamsSchema = v17.nullish(v17.null());
|
|
899
|
+
var runesGetBalanceResultSchema = v17.object({
|
|
900
|
+
balances: v17.array(
|
|
901
|
+
v17.object({
|
|
902
|
+
runeName: v17.string(),
|
|
903
|
+
amount: v17.string(),
|
|
904
|
+
divisibility: v17.number(),
|
|
905
|
+
symbol: v17.string(),
|
|
906
|
+
inscriptionId: v17.nullish(v17.string())
|
|
877
907
|
})
|
|
878
908
|
)
|
|
879
909
|
});
|
|
880
|
-
var runesGetBalanceRequestMessageSchema =
|
|
910
|
+
var runesGetBalanceRequestMessageSchema = v17.object({
|
|
881
911
|
...rpcRequestMessageSchema.entries,
|
|
882
|
-
...
|
|
883
|
-
method:
|
|
912
|
+
...v17.object({
|
|
913
|
+
method: v17.literal(runesGetBalanceMethodName),
|
|
884
914
|
params: runesGetBalanceParamsSchema,
|
|
885
|
-
id:
|
|
915
|
+
id: v17.string()
|
|
886
916
|
}).entries
|
|
887
917
|
});
|
|
888
918
|
|
|
889
919
|
// src/request/types/runesMethods/mint.ts
|
|
890
|
-
import * as
|
|
920
|
+
import * as v18 from "valibot";
|
|
891
921
|
var runesMintMethodName = "runes_mint";
|
|
892
|
-
var runesMintParamsSchema =
|
|
893
|
-
appServiceFee:
|
|
894
|
-
appServiceFeeAddress:
|
|
895
|
-
destinationAddress:
|
|
896
|
-
feeRate:
|
|
897
|
-
refundAddress:
|
|
898
|
-
repeats:
|
|
899
|
-
runeName:
|
|
900
|
-
network:
|
|
901
|
-
});
|
|
902
|
-
var runesMintResultSchema =
|
|
903
|
-
orderId:
|
|
904
|
-
fundTransactionId:
|
|
905
|
-
fundingAddress:
|
|
906
|
-
});
|
|
907
|
-
var runesMintRequestMessageSchema =
|
|
922
|
+
var runesMintParamsSchema = v18.object({
|
|
923
|
+
appServiceFee: v18.optional(v18.number()),
|
|
924
|
+
appServiceFeeAddress: v18.optional(v18.string()),
|
|
925
|
+
destinationAddress: v18.string(),
|
|
926
|
+
feeRate: v18.number(),
|
|
927
|
+
refundAddress: v18.string(),
|
|
928
|
+
repeats: v18.number(),
|
|
929
|
+
runeName: v18.string(),
|
|
930
|
+
network: v18.optional(v18.enum(BitcoinNetworkType))
|
|
931
|
+
});
|
|
932
|
+
var runesMintResultSchema = v18.object({
|
|
933
|
+
orderId: v18.string(),
|
|
934
|
+
fundTransactionId: v18.string(),
|
|
935
|
+
fundingAddress: v18.string()
|
|
936
|
+
});
|
|
937
|
+
var runesMintRequestMessageSchema = v18.object({
|
|
908
938
|
...rpcRequestMessageSchema.entries,
|
|
909
|
-
...
|
|
910
|
-
method:
|
|
939
|
+
...v18.object({
|
|
940
|
+
method: v18.literal(runesMintMethodName),
|
|
911
941
|
params: runesMintParamsSchema,
|
|
912
|
-
id:
|
|
942
|
+
id: v18.string()
|
|
913
943
|
}).entries
|
|
914
944
|
});
|
|
915
945
|
|
|
916
946
|
// src/request/types/runesMethods/transfer.ts
|
|
917
|
-
import * as
|
|
947
|
+
import * as v19 from "valibot";
|
|
918
948
|
var runesTransferMethodName = "runes_transfer";
|
|
919
|
-
var runesTransferParamsSchema =
|
|
920
|
-
recipients:
|
|
921
|
-
|
|
922
|
-
runeName:
|
|
923
|
-
amount:
|
|
924
|
-
address:
|
|
949
|
+
var runesTransferParamsSchema = v19.object({
|
|
950
|
+
recipients: v19.array(
|
|
951
|
+
v19.object({
|
|
952
|
+
runeName: v19.string(),
|
|
953
|
+
amount: v19.string(),
|
|
954
|
+
address: v19.string()
|
|
925
955
|
})
|
|
926
956
|
)
|
|
927
957
|
});
|
|
928
|
-
var runesTransferResultSchema =
|
|
929
|
-
txid:
|
|
958
|
+
var runesTransferResultSchema = v19.object({
|
|
959
|
+
txid: v19.string()
|
|
930
960
|
});
|
|
931
|
-
var runesTransferRequestMessageSchema =
|
|
961
|
+
var runesTransferRequestMessageSchema = v19.object({
|
|
932
962
|
...rpcRequestMessageSchema.entries,
|
|
933
|
-
...
|
|
934
|
-
method:
|
|
963
|
+
...v19.object({
|
|
964
|
+
method: v19.literal(runesTransferMethodName),
|
|
935
965
|
params: runesTransferParamsSchema,
|
|
936
|
-
id:
|
|
966
|
+
id: v19.string()
|
|
937
967
|
}).entries
|
|
938
968
|
});
|
|
939
969
|
|
|
940
970
|
// src/request/types/ordinalsMethods.ts
|
|
941
|
-
import * as
|
|
971
|
+
import * as v20 from "valibot";
|
|
942
972
|
var getInscriptionsMethodName = "ord_getInscriptions";
|
|
943
|
-
var getInscriptionsParamsSchema =
|
|
944
|
-
offset:
|
|
945
|
-
limit:
|
|
946
|
-
});
|
|
947
|
-
var getInscriptionsResultSchema =
|
|
948
|
-
total:
|
|
949
|
-
limit:
|
|
950
|
-
offset:
|
|
951
|
-
inscriptions:
|
|
952
|
-
|
|
953
|
-
inscriptionId:
|
|
954
|
-
inscriptionNumber:
|
|
955
|
-
address:
|
|
956
|
-
collectionName:
|
|
957
|
-
postage:
|
|
958
|
-
contentLength:
|
|
959
|
-
contentType:
|
|
960
|
-
timestamp:
|
|
961
|
-
offset:
|
|
962
|
-
genesisTransaction:
|
|
963
|
-
output:
|
|
973
|
+
var getInscriptionsParamsSchema = v20.object({
|
|
974
|
+
offset: v20.number(),
|
|
975
|
+
limit: v20.number()
|
|
976
|
+
});
|
|
977
|
+
var getInscriptionsResultSchema = v20.object({
|
|
978
|
+
total: v20.number(),
|
|
979
|
+
limit: v20.number(),
|
|
980
|
+
offset: v20.number(),
|
|
981
|
+
inscriptions: v20.array(
|
|
982
|
+
v20.object({
|
|
983
|
+
inscriptionId: v20.string(),
|
|
984
|
+
inscriptionNumber: v20.string(),
|
|
985
|
+
address: v20.string(),
|
|
986
|
+
collectionName: v20.optional(v20.string()),
|
|
987
|
+
postage: v20.string(),
|
|
988
|
+
contentLength: v20.string(),
|
|
989
|
+
contentType: v20.string(),
|
|
990
|
+
timestamp: v20.number(),
|
|
991
|
+
offset: v20.number(),
|
|
992
|
+
genesisTransaction: v20.string(),
|
|
993
|
+
output: v20.string()
|
|
964
994
|
})
|
|
965
995
|
)
|
|
966
996
|
});
|
|
967
|
-
var getInscriptionsRequestMessageSchema =
|
|
997
|
+
var getInscriptionsRequestMessageSchema = v20.object({
|
|
968
998
|
...rpcRequestMessageSchema.entries,
|
|
969
|
-
...
|
|
970
|
-
method:
|
|
999
|
+
...v20.object({
|
|
1000
|
+
method: v20.literal(getInscriptionsMethodName),
|
|
971
1001
|
params: getInscriptionsParamsSchema,
|
|
972
|
-
id:
|
|
1002
|
+
id: v20.string()
|
|
973
1003
|
}).entries
|
|
974
1004
|
});
|
|
975
1005
|
var sendInscriptionsMethodName = "ord_sendInscriptions";
|
|
976
|
-
var sendInscriptionsParamsSchema =
|
|
977
|
-
transfers:
|
|
978
|
-
|
|
979
|
-
address:
|
|
980
|
-
inscriptionId:
|
|
1006
|
+
var sendInscriptionsParamsSchema = v20.object({
|
|
1007
|
+
transfers: v20.array(
|
|
1008
|
+
v20.object({
|
|
1009
|
+
address: v20.string(),
|
|
1010
|
+
inscriptionId: v20.string()
|
|
981
1011
|
})
|
|
982
1012
|
)
|
|
983
1013
|
});
|
|
984
|
-
var sendInscriptionsResultSchema =
|
|
985
|
-
txid:
|
|
1014
|
+
var sendInscriptionsResultSchema = v20.object({
|
|
1015
|
+
txid: v20.string()
|
|
986
1016
|
});
|
|
987
|
-
var sendInscriptionsRequestMessageSchema =
|
|
1017
|
+
var sendInscriptionsRequestMessageSchema = v20.object({
|
|
988
1018
|
...rpcRequestMessageSchema.entries,
|
|
989
|
-
...
|
|
990
|
-
method:
|
|
1019
|
+
...v20.object({
|
|
1020
|
+
method: v20.literal(sendInscriptionsMethodName),
|
|
991
1021
|
params: sendInscriptionsParamsSchema,
|
|
992
|
-
id:
|
|
1022
|
+
id: v20.string()
|
|
993
1023
|
}).entries
|
|
994
1024
|
});
|
|
995
1025
|
|
|
@@ -1006,13 +1036,13 @@ var request = async (method, params, providerId) => {
|
|
|
1006
1036
|
throw new Error("A wallet method is required");
|
|
1007
1037
|
}
|
|
1008
1038
|
const response = await provider.request(method, params);
|
|
1009
|
-
if (
|
|
1039
|
+
if (v21.is(rpcErrorResponseMessageSchema, response)) {
|
|
1010
1040
|
return {
|
|
1011
1041
|
status: "error",
|
|
1012
1042
|
error: response.error
|
|
1013
1043
|
};
|
|
1014
1044
|
}
|
|
1015
|
-
if (
|
|
1045
|
+
if (v21.is(rpcSuccessResponseMessageSchema, response)) {
|
|
1016
1046
|
return {
|
|
1017
1047
|
status: "success",
|
|
1018
1048
|
result: response.result
|
|
@@ -1609,15 +1639,14 @@ var UnisatAdapter = class extends SatsConnectAdapter {
|
|
|
1609
1639
|
autoFinalized: broadcast,
|
|
1610
1640
|
toSignInputs: convertSignInputsToInputType(signInputs)
|
|
1611
1641
|
});
|
|
1642
|
+
const signedPsbtBase64 = Buffer.from(signedPsbt, "hex").toString("base64");
|
|
1643
|
+
let txid;
|
|
1612
1644
|
if (broadcast) {
|
|
1613
|
-
|
|
1614
|
-
return {
|
|
1615
|
-
psbt: signedPsbt,
|
|
1616
|
-
txid
|
|
1617
|
-
};
|
|
1645
|
+
txid = await window.unisat.pushPsbt(signedPsbt);
|
|
1618
1646
|
}
|
|
1619
1647
|
return {
|
|
1620
|
-
psbt:
|
|
1648
|
+
psbt: signedPsbtBase64,
|
|
1649
|
+
txid
|
|
1621
1650
|
};
|
|
1622
1651
|
}
|
|
1623
1652
|
requestInternal = async (method, params) => {
|
|
@@ -2104,6 +2133,10 @@ export {
|
|
|
2104
2133
|
stxSignTransactionParamsSchema,
|
|
2105
2134
|
stxSignTransactionRequestMessageSchema,
|
|
2106
2135
|
stxSignTransactionResultSchema,
|
|
2136
|
+
stxSignTransactionsMethodName,
|
|
2137
|
+
stxSignTransactionsParamsSchema,
|
|
2138
|
+
stxSignTransactionsRequestMessageSchema,
|
|
2139
|
+
stxSignTransactionsResultSchema,
|
|
2107
2140
|
stxTransferStxMethodName,
|
|
2108
2141
|
stxTransferStxParamsSchema,
|
|
2109
2142
|
stxTransferStxRequestMessageSchema,
|