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