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