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