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