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