@dedot/chaintypes 0.13.0 → 0.15.0

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.
@@ -12,12 +12,14 @@ import type {
12
12
  Bytes,
13
13
  BytesLike,
14
14
  AccountId32Like,
15
+ AccountId32,
15
16
  } from 'dedot/codecs';
16
17
  import type {
17
18
  SpConsensusSlotsSlotDuration,
18
19
  SpConsensusAuraSr25519AppSr25519Public,
19
20
  SpConsensusSlotsSlot,
20
21
  SpRuntimeBlock,
22
+ SpRuntimeExtrinsicInclusionMode,
21
23
  SpCoreOpaqueMetadata,
22
24
  SpRuntimeTransactionValidityTransactionValidityError,
23
25
  SpInherentsInherentData,
@@ -30,7 +32,16 @@ import type {
30
32
  PalletTransactionPaymentFeeDetails,
31
33
  SpWeightsWeightV2Weight,
32
34
  AssetHubKusamaRuntimeRuntimeCallLike,
35
+ XcmVersionedAssetId,
36
+ XcmRuntimeApisFeesError,
37
+ XcmVersionedXcm,
33
38
  XcmVersionedAssets,
39
+ XcmVersionedLocation,
40
+ XcmRuntimeApisDryRunCallDryRunEffects,
41
+ XcmRuntimeApisDryRunError,
42
+ AssetHubKusamaRuntimeOriginCaller,
43
+ XcmRuntimeApisDryRunXcmDryRunEffects,
44
+ XcmRuntimeApisConversionsError,
34
45
  AssetsCommonRuntimeApiFungiblesAccessError,
35
46
  CumulusPrimitivesCoreCollationInfo,
36
47
  } from './types';
@@ -108,12 +119,12 @@ export interface RuntimeApis<Rv extends RpcVersion> extends GenericRuntimeApis<R
108
119
  executeBlock: GenericRuntimeApiMethod<Rv, (block: SpRuntimeBlock) => Promise<[]>>;
109
120
 
110
121
  /**
111
- * Initialize a block with the given header.
122
+ * Initialize a block with the given header and return the runtime executive mode.
112
123
  *
113
124
  * @callname: Core_initialize_block
114
125
  * @param {Header} header
115
126
  **/
116
- initializeBlock: GenericRuntimeApiMethod<Rv, (header: Header) => Promise<[]>>;
127
+ initializeBlock: GenericRuntimeApiMethod<Rv, (header: Header) => Promise<SpRuntimeExtrinsicInclusionMode>>;
117
128
 
118
129
  /**
119
130
  * Generic runtime api call
@@ -479,6 +490,143 @@ export interface RuntimeApis<Rv extends RpcVersion> extends GenericRuntimeApis<R
479
490
  **/
480
491
  [method: string]: GenericRuntimeApiMethod<Rv>;
481
492
  };
493
+ /**
494
+ * @runtimeapi: XcmPaymentApi - 0x6ff52ee858e6c5bd
495
+ **/
496
+ xcmPaymentApi: {
497
+ /**
498
+ * Returns a list of acceptable payment assets.
499
+ *
500
+ * # Arguments
501
+ *
502
+ * * `xcm_version`: Version.
503
+ *
504
+ * @callname: XcmPaymentApi_query_acceptable_payment_assets
505
+ * @param {number} xcm_version
506
+ **/
507
+ queryAcceptablePaymentAssets: GenericRuntimeApiMethod<
508
+ Rv,
509
+ (xcmVersion: number) => Promise<Result<Array<XcmVersionedAssetId>, XcmRuntimeApisFeesError>>
510
+ >;
511
+
512
+ /**
513
+ * Returns a weight needed to execute a XCM.
514
+ *
515
+ * # Arguments
516
+ *
517
+ * * `message`: `VersionedXcm`.
518
+ *
519
+ * @callname: XcmPaymentApi_query_xcm_weight
520
+ * @param {XcmVersionedXcm} message
521
+ **/
522
+ queryXcmWeight: GenericRuntimeApiMethod<
523
+ Rv,
524
+ (message: XcmVersionedXcm) => Promise<Result<SpWeightsWeightV2Weight, XcmRuntimeApisFeesError>>
525
+ >;
526
+
527
+ /**
528
+ * Converts a weight into a fee for the specified `AssetId`.
529
+ *
530
+ * # Arguments
531
+ *
532
+ * * `weight`: convertible `Weight`.
533
+ * * `asset`: `VersionedAssetId`.
534
+ *
535
+ * @callname: XcmPaymentApi_query_weight_to_asset_fee
536
+ * @param {SpWeightsWeightV2Weight} weight
537
+ * @param {XcmVersionedAssetId} asset
538
+ **/
539
+ queryWeightToAssetFee: GenericRuntimeApiMethod<
540
+ Rv,
541
+ (weight: SpWeightsWeightV2Weight, asset: XcmVersionedAssetId) => Promise<Result<bigint, XcmRuntimeApisFeesError>>
542
+ >;
543
+
544
+ /**
545
+ * Get delivery fees for sending a specific `message` to a `destination`.
546
+ * These always come in a specific asset, defined by the chain.
547
+ *
548
+ * # Arguments
549
+ * * `message`: The message that'll be sent, necessary because most delivery fees are based on the
550
+ * size of the message.
551
+ * * `destination`: The destination to send the message to. Different destinations may use
552
+ * different senders that charge different fees.
553
+ *
554
+ * @callname: XcmPaymentApi_query_delivery_fees
555
+ * @param {XcmVersionedLocation} destination
556
+ * @param {XcmVersionedXcm} message
557
+ **/
558
+ queryDeliveryFees: GenericRuntimeApiMethod<
559
+ Rv,
560
+ (
561
+ destination: XcmVersionedLocation,
562
+ message: XcmVersionedXcm,
563
+ ) => Promise<Result<XcmVersionedAssets, XcmRuntimeApisFeesError>>
564
+ >;
565
+
566
+ /**
567
+ * Generic runtime api call
568
+ **/
569
+ [method: string]: GenericRuntimeApiMethod<Rv>;
570
+ };
571
+ /**
572
+ * @runtimeapi: DryRunApi - 0x91b1c8b16328eb92
573
+ **/
574
+ dryRunApi: {
575
+ /**
576
+ * Dry run call.
577
+ *
578
+ * @callname: DryRunApi_dry_run_call
579
+ * @param {AssetHubKusamaRuntimeOriginCaller} origin
580
+ * @param {AssetHubKusamaRuntimeRuntimeCallLike} call
581
+ **/
582
+ dryRunCall: GenericRuntimeApiMethod<
583
+ Rv,
584
+ (
585
+ origin: AssetHubKusamaRuntimeOriginCaller,
586
+ call: AssetHubKusamaRuntimeRuntimeCallLike,
587
+ ) => Promise<Result<XcmRuntimeApisDryRunCallDryRunEffects, XcmRuntimeApisDryRunError>>
588
+ >;
589
+
590
+ /**
591
+ * Dry run XCM program
592
+ *
593
+ * @callname: DryRunApi_dry_run_xcm
594
+ * @param {XcmVersionedLocation} origin_location
595
+ * @param {XcmVersionedXcm} xcm
596
+ **/
597
+ dryRunXcm: GenericRuntimeApiMethod<
598
+ Rv,
599
+ (
600
+ originLocation: XcmVersionedLocation,
601
+ xcm: XcmVersionedXcm,
602
+ ) => Promise<Result<XcmRuntimeApisDryRunXcmDryRunEffects, XcmRuntimeApisDryRunError>>
603
+ >;
604
+
605
+ /**
606
+ * Generic runtime api call
607
+ **/
608
+ [method: string]: GenericRuntimeApiMethod<Rv>;
609
+ };
610
+ /**
611
+ * @runtimeapi: LocationToAccountApi - 0x9ffb505aa738d69c
612
+ **/
613
+ locationToAccountApi: {
614
+ /**
615
+ * Converts `Location` to `AccountId`.
616
+ *
617
+ * @callname: LocationToAccountApi_convert_location
618
+ * @param {XcmVersionedLocation} location
619
+ **/
620
+ convertLocation: GenericRuntimeApiMethod<
621
+ Rv,
622
+ (location: XcmVersionedLocation) => Promise<Result<AccountId32, XcmRuntimeApisConversionsError>>
623
+ >;
624
+
625
+ /**
626
+ * Generic runtime api call
627
+ **/
628
+ [method: string]: GenericRuntimeApiMethod<Rv>;
629
+ };
482
630
  /**
483
631
  * @runtimeapi: FungiblesApi - 0xde92b8a0426b9bf6
484
632
  **/
@@ -524,28 +672,51 @@ export interface RuntimeApis<Rv extends RpcVersion> extends GenericRuntimeApis<R
524
672
  **/
525
673
  genesisBuilder: {
526
674
  /**
527
- * Creates the default `GenesisConfig` and returns it as a JSON blob.
675
+ * Build `RuntimeGenesisConfig` from a JSON blob not using any defaults and store it in the
676
+ * storage.
677
+ *
678
+ * In the case of a FRAME-based runtime, this function deserializes the full `RuntimeGenesisConfig` from the given JSON blob and
679
+ * puts it into the storage. If the provided JSON blob is incorrect or incomplete or the
680
+ * deserialization fails, an error is returned.
528
681
  *
529
- * This function instantiates the default `GenesisConfig` struct for the runtime and serializes it into a JSON
530
- * blob. It returns a `Vec<u8>` containing the JSON representation of the default `GenesisConfig`.
682
+ * Please note that provided JSON blob must contain all `RuntimeGenesisConfig` fields, no
683
+ * defaults will be used.
531
684
  *
532
- * @callname: GenesisBuilder_create_default_config
685
+ * @callname: GenesisBuilder_build_state
686
+ * @param {BytesLike} json
533
687
  **/
534
- createDefaultConfig: GenericRuntimeApiMethod<Rv, () => Promise<Bytes>>;
688
+ buildState: GenericRuntimeApiMethod<Rv, (json: BytesLike) => Promise<Result<[], string>>>;
535
689
 
536
690
  /**
537
- * Build `GenesisConfig` from a JSON blob not using any defaults and store it in the storage.
691
+ * Returns a JSON blob representation of the built-in `RuntimeGenesisConfig` identified by
692
+ * `id`.
538
693
  *
539
- * This function deserializes the full `GenesisConfig` from the given JSON blob and puts it into the storage.
540
- * If the provided JSON blob is incorrect or incomplete or the deserialization fails, an error is returned.
541
- * It is recommended to log any errors encountered during the process.
694
+ * If `id` is `None` the function returns JSON blob representation of the default
695
+ * `RuntimeGenesisConfig` struct of the runtime. Implementation must provide default
696
+ * `RuntimeGenesisConfig`.
542
697
  *
543
- * Please note that provided json blob must contain all `GenesisConfig` fields, no defaults will be used.
698
+ * Otherwise function returns a JSON representation of the built-in, named
699
+ * `RuntimeGenesisConfig` preset identified by `id`, or `None` if such preset does not
700
+ * exists. Returned `Vec<u8>` contains bytes of JSON blob (patch) which comprises a list of
701
+ * (potentially nested) key-value pairs that are intended for customizing the default
702
+ * runtime genesis config. The patch shall be merged (rfc7386) with the JSON representation
703
+ * of the default `RuntimeGenesisConfig` to create a comprehensive genesis config that can
704
+ * be used in `build_state` method.
544
705
  *
545
- * @callname: GenesisBuilder_build_config
546
- * @param {BytesLike} json
706
+ * @callname: GenesisBuilder_get_preset
707
+ * @param {string | undefined} id
708
+ **/
709
+ getPreset: GenericRuntimeApiMethod<Rv, (id?: string | undefined) => Promise<Bytes | undefined>>;
710
+
711
+ /**
712
+ * Returns a list of identifiers for available builtin `RuntimeGenesisConfig` presets.
713
+ *
714
+ * The presets from the list can be queried with [`GenesisBuilder::get_preset`] method. If
715
+ * no named presets are provided by the runtime the list is empty.
716
+ *
717
+ * @callname: GenesisBuilder_preset_names
547
718
  **/
548
- buildConfig: GenericRuntimeApiMethod<Rv, (json: BytesLike) => Promise<Result<[], string>>>;
719
+ presetNames: GenericRuntimeApiMethod<Rv, () => Promise<Array<string>>>;
549
720
 
550
721
  /**
551
722
  * Generic runtime api call