@dedot/chaintypes 0.20.0 → 0.22.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
  SpConsensusAuraEd25519AppEd25519Public,
19
20
  SpConsensusSlotsSlot,
20
21
  SpRuntimeBlock,
22
+ SpRuntimeExtrinsicInclusionMode,
21
23
  SpCoreOpaqueMetadata,
22
24
  SpRuntimeTransactionValidityTransactionValidityError,
23
25
  SpInherentsInherentData,
@@ -29,7 +31,16 @@ import type {
29
31
  PalletTransactionPaymentFeeDetails,
30
32
  SpWeightsWeightV2Weight,
31
33
  AssetHubPolkadotRuntimeRuntimeCallLike,
34
+ XcmVersionedAssetId,
35
+ XcmRuntimeApisFeesError,
36
+ XcmVersionedXcm,
32
37
  XcmVersionedAssets,
38
+ XcmVersionedLocation,
39
+ XcmRuntimeApisDryRunCallDryRunEffects,
40
+ XcmRuntimeApisDryRunError,
41
+ AssetHubPolkadotRuntimeOriginCaller,
42
+ XcmRuntimeApisDryRunXcmDryRunEffects,
43
+ XcmRuntimeApisConversionsError,
33
44
  AssetsCommonRuntimeApiFungiblesAccessError,
34
45
  CumulusPrimitivesCoreCollationInfo,
35
46
  StagingXcmV3MultilocationMultiLocation,
@@ -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
@@ -414,6 +425,143 @@ export interface RuntimeApis<Rv extends RpcVersion> extends GenericRuntimeApis<R
414
425
  **/
415
426
  [method: string]: GenericRuntimeApiMethod<Rv>;
416
427
  };
428
+ /**
429
+ * @runtimeapi: XcmPaymentApi - 0x6ff52ee858e6c5bd
430
+ **/
431
+ xcmPaymentApi: {
432
+ /**
433
+ * Returns a list of acceptable payment assets.
434
+ *
435
+ * # Arguments
436
+ *
437
+ * * `xcm_version`: Version.
438
+ *
439
+ * @callname: XcmPaymentApi_query_acceptable_payment_assets
440
+ * @param {number} xcm_version
441
+ **/
442
+ queryAcceptablePaymentAssets: GenericRuntimeApiMethod<
443
+ Rv,
444
+ (xcmVersion: number) => Promise<Result<Array<XcmVersionedAssetId>, XcmRuntimeApisFeesError>>
445
+ >;
446
+
447
+ /**
448
+ * Returns a weight needed to execute a XCM.
449
+ *
450
+ * # Arguments
451
+ *
452
+ * * `message`: `VersionedXcm`.
453
+ *
454
+ * @callname: XcmPaymentApi_query_xcm_weight
455
+ * @param {XcmVersionedXcm} message
456
+ **/
457
+ queryXcmWeight: GenericRuntimeApiMethod<
458
+ Rv,
459
+ (message: XcmVersionedXcm) => Promise<Result<SpWeightsWeightV2Weight, XcmRuntimeApisFeesError>>
460
+ >;
461
+
462
+ /**
463
+ * Converts a weight into a fee for the specified `AssetId`.
464
+ *
465
+ * # Arguments
466
+ *
467
+ * * `weight`: convertible `Weight`.
468
+ * * `asset`: `VersionedAssetId`.
469
+ *
470
+ * @callname: XcmPaymentApi_query_weight_to_asset_fee
471
+ * @param {SpWeightsWeightV2Weight} weight
472
+ * @param {XcmVersionedAssetId} asset
473
+ **/
474
+ queryWeightToAssetFee: GenericRuntimeApiMethod<
475
+ Rv,
476
+ (weight: SpWeightsWeightV2Weight, asset: XcmVersionedAssetId) => Promise<Result<bigint, XcmRuntimeApisFeesError>>
477
+ >;
478
+
479
+ /**
480
+ * Get delivery fees for sending a specific `message` to a `destination`.
481
+ * These always come in a specific asset, defined by the chain.
482
+ *
483
+ * # Arguments
484
+ * * `message`: The message that'll be sent, necessary because most delivery fees are based on the
485
+ * size of the message.
486
+ * * `destination`: The destination to send the message to. Different destinations may use
487
+ * different senders that charge different fees.
488
+ *
489
+ * @callname: XcmPaymentApi_query_delivery_fees
490
+ * @param {XcmVersionedLocation} destination
491
+ * @param {XcmVersionedXcm} message
492
+ **/
493
+ queryDeliveryFees: GenericRuntimeApiMethod<
494
+ Rv,
495
+ (
496
+ destination: XcmVersionedLocation,
497
+ message: XcmVersionedXcm,
498
+ ) => Promise<Result<XcmVersionedAssets, XcmRuntimeApisFeesError>>
499
+ >;
500
+
501
+ /**
502
+ * Generic runtime api call
503
+ **/
504
+ [method: string]: GenericRuntimeApiMethod<Rv>;
505
+ };
506
+ /**
507
+ * @runtimeapi: DryRunApi - 0x91b1c8b16328eb92
508
+ **/
509
+ dryRunApi: {
510
+ /**
511
+ * Dry run call.
512
+ *
513
+ * @callname: DryRunApi_dry_run_call
514
+ * @param {AssetHubPolkadotRuntimeOriginCaller} origin
515
+ * @param {AssetHubPolkadotRuntimeRuntimeCallLike} call
516
+ **/
517
+ dryRunCall: GenericRuntimeApiMethod<
518
+ Rv,
519
+ (
520
+ origin: AssetHubPolkadotRuntimeOriginCaller,
521
+ call: AssetHubPolkadotRuntimeRuntimeCallLike,
522
+ ) => Promise<Result<XcmRuntimeApisDryRunCallDryRunEffects, XcmRuntimeApisDryRunError>>
523
+ >;
524
+
525
+ /**
526
+ * Dry run XCM program
527
+ *
528
+ * @callname: DryRunApi_dry_run_xcm
529
+ * @param {XcmVersionedLocation} origin_location
530
+ * @param {XcmVersionedXcm} xcm
531
+ **/
532
+ dryRunXcm: GenericRuntimeApiMethod<
533
+ Rv,
534
+ (
535
+ originLocation: XcmVersionedLocation,
536
+ xcm: XcmVersionedXcm,
537
+ ) => Promise<Result<XcmRuntimeApisDryRunXcmDryRunEffects, XcmRuntimeApisDryRunError>>
538
+ >;
539
+
540
+ /**
541
+ * Generic runtime api call
542
+ **/
543
+ [method: string]: GenericRuntimeApiMethod<Rv>;
544
+ };
545
+ /**
546
+ * @runtimeapi: LocationToAccountApi - 0x9ffb505aa738d69c
547
+ **/
548
+ locationToAccountApi: {
549
+ /**
550
+ * Converts `Location` to `AccountId`.
551
+ *
552
+ * @callname: LocationToAccountApi_convert_location
553
+ * @param {XcmVersionedLocation} location
554
+ **/
555
+ convertLocation: GenericRuntimeApiMethod<
556
+ Rv,
557
+ (location: XcmVersionedLocation) => Promise<Result<AccountId32, XcmRuntimeApisConversionsError>>
558
+ >;
559
+
560
+ /**
561
+ * Generic runtime api call
562
+ **/
563
+ [method: string]: GenericRuntimeApiMethod<Rv>;
564
+ };
417
565
  /**
418
566
  * @runtimeapi: FungiblesApi - 0xde92b8a0426b9bf6
419
567
  **/
@@ -459,28 +607,51 @@ export interface RuntimeApis<Rv extends RpcVersion> extends GenericRuntimeApis<R
459
607
  **/
460
608
  genesisBuilder: {
461
609
  /**
462
- * Creates the default `GenesisConfig` and returns it as a JSON blob.
610
+ * Build `RuntimeGenesisConfig` from a JSON blob not using any defaults and store it in the
611
+ * storage.
612
+ *
613
+ * In the case of a FRAME-based runtime, this function deserializes the full `RuntimeGenesisConfig` from the given JSON blob and
614
+ * puts it into the storage. If the provided JSON blob is incorrect or incomplete or the
615
+ * deserialization fails, an error is returned.
463
616
  *
464
- * This function instantiates the default `GenesisConfig` struct for the runtime and serializes it into a JSON
465
- * blob. It returns a `Vec<u8>` containing the JSON representation of the default `GenesisConfig`.
617
+ * Please note that provided JSON blob must contain all `RuntimeGenesisConfig` fields, no
618
+ * defaults will be used.
466
619
  *
467
- * @callname: GenesisBuilder_create_default_config
620
+ * @callname: GenesisBuilder_build_state
621
+ * @param {BytesLike} json
468
622
  **/
469
- createDefaultConfig: GenericRuntimeApiMethod<Rv, () => Promise<Bytes>>;
623
+ buildState: GenericRuntimeApiMethod<Rv, (json: BytesLike) => Promise<Result<[], string>>>;
470
624
 
471
625
  /**
472
- * Build `GenesisConfig` from a JSON blob not using any defaults and store it in the storage.
626
+ * Returns a JSON blob representation of the built-in `RuntimeGenesisConfig` identified by
627
+ * `id`.
473
628
  *
474
- * This function deserializes the full `GenesisConfig` from the given JSON blob and puts it into the storage.
475
- * If the provided JSON blob is incorrect or incomplete or the deserialization fails, an error is returned.
476
- * It is recommended to log any errors encountered during the process.
629
+ * If `id` is `None` the function returns JSON blob representation of the default
630
+ * `RuntimeGenesisConfig` struct of the runtime. Implementation must provide default
631
+ * `RuntimeGenesisConfig`.
477
632
  *
478
- * Please note that provided json blob must contain all `GenesisConfig` fields, no defaults will be used.
633
+ * Otherwise function returns a JSON representation of the built-in, named
634
+ * `RuntimeGenesisConfig` preset identified by `id`, or `None` if such preset does not
635
+ * exists. Returned `Vec<u8>` contains bytes of JSON blob (patch) which comprises a list of
636
+ * (potentially nested) key-value pairs that are intended for customizing the default
637
+ * runtime genesis config. The patch shall be merged (rfc7386) with the JSON representation
638
+ * of the default `RuntimeGenesisConfig` to create a comprehensive genesis config that can
639
+ * be used in `build_state` method.
479
640
  *
480
- * @callname: GenesisBuilder_build_config
481
- * @param {BytesLike} json
641
+ * @callname: GenesisBuilder_get_preset
642
+ * @param {string | undefined} id
643
+ **/
644
+ getPreset: GenericRuntimeApiMethod<Rv, (id?: string | undefined) => Promise<Bytes | undefined>>;
645
+
646
+ /**
647
+ * Returns a list of identifiers for available builtin `RuntimeGenesisConfig` presets.
648
+ *
649
+ * The presets from the list can be queried with [`GenesisBuilder::get_preset`] method. If
650
+ * no named presets are provided by the runtime the list is empty.
651
+ *
652
+ * @callname: GenesisBuilder_preset_names
482
653
  **/
483
- buildConfig: GenericRuntimeApiMethod<Rv, (json: BytesLike) => Promise<Result<[], string>>>;
654
+ presetNames: GenericRuntimeApiMethod<Rv, () => Promise<Array<string>>>;
484
655
 
485
656
  /**
486
657
  * Generic runtime api call