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