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