polkadot-api 0.7.2 → 0.9.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.
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ module.exports = __toCommonJS(src_exports);
32
32
  // src/client.ts
33
33
  var import_observable_client2 = require("@polkadot-api/observable-client");
34
34
  var import_substrate_client = require("@polkadot-api/substrate-client");
35
- var import_rxjs22 = require("rxjs");
35
+ var import_rxjs23 = require("rxjs");
36
36
 
37
37
  // src/constants.ts
38
38
  var import_rxjs = require("rxjs");
@@ -54,8 +54,7 @@ var createConstantEntry = (palletName, name, chainHead, compatibilityHelper2) =>
54
54
  };
55
55
  const fn = (runtime) => {
56
56
  if (runtime) {
57
- if (!isCompatible(runtime))
58
- throw checksumError();
57
+ if (!isCompatible(runtime)) throw checksumError();
59
58
  return getValueWithContext(runtime._getCtx());
60
59
  }
61
60
  return (0, import_rxjs.firstValueFrom)(
@@ -105,8 +104,7 @@ function firstValueFromWithSignal(source, signal) {
105
104
  reject(new Error("Observable completed without emitting"));
106
105
  }
107
106
  });
108
- if (!isDone)
109
- signal?.addEventListener("abort", onAbort);
107
+ if (!isDone) signal?.addEventListener("abort", onAbort);
110
108
  });
111
109
  }
112
110
 
@@ -231,8 +229,7 @@ var raceMap = (mapper, concurrent) => (source$) => new import_rxjs5.Observable((
231
229
  observer.error(err);
232
230
  },
233
231
  complete() {
234
- if (innerSubscriptions.length === 0)
235
- observer.complete();
232
+ if (innerSubscriptions.length === 0) observer.complete();
236
233
  isOuterDone = true;
237
234
  }
238
235
  });
@@ -255,10 +252,8 @@ var continueWith = (mapper) => (source) => new import_rxjs6.Observable((observer
255
252
  observer.error(e);
256
253
  },
257
254
  complete() {
258
- if (latestValue === NOTIN)
259
- observer.complete();
260
- else
261
- subscription = mapper(latestValue).subscribe(observer);
255
+ if (latestValue === NOTIN) observer.complete();
256
+ else subscription = mapper(latestValue).subscribe(observer);
262
257
  }
263
258
  });
264
259
  return () => {
@@ -324,7 +319,7 @@ var Runtime = class _Runtime {
324
319
  * @access package - Internal implementation detail. Do not use.
325
320
  */
326
321
  _getPalletChecksum(opType, pallet, name) {
327
- return this._checksums[this._descriptors.pallets[pallet][opType][name]];
322
+ return this._checksums[this._descriptors[opType][pallet][name]];
328
323
  }
329
324
  /**
330
325
  * @access package - Internal implementation detail. Do not use.
@@ -396,8 +391,7 @@ var compatibilityHelper = (runtimeApi, getDescriptorChecksum) => (getChecksum) =
396
391
  var import_utils4 = require("@polkadot-api/utils");
397
392
  var import_rxjs9 = require("rxjs");
398
393
  var isOptionalArg = (lastArg) => {
399
- if (typeof lastArg !== "object")
400
- return false;
394
+ if (typeof lastArg !== "object") return false;
401
395
  return Object.keys(lastArg).every(
402
396
  (k) => k === "at" && typeof lastArg.at === "string" || k === "signal" && lastArg.signal instanceof AbortSignal
403
397
  );
@@ -428,8 +422,7 @@ var createRuntimeCallEntry = (api, method, chainHead, compatibilityHelper2) => {
428
422
  var import_rxjs10 = require("rxjs");
429
423
  var import_observable_client = require("@polkadot-api/observable-client");
430
424
  var isOptionalArg2 = (lastArg) => {
431
- if (typeof lastArg !== "object")
432
- return false;
425
+ if (typeof lastArg !== "object") return false;
433
426
  return Object.keys(lastArg).every(
434
427
  (k) => k === "at" && typeof lastArg.at === "string" || k === "signal" && lastArg.signal instanceof AbortSignal
435
428
  );
@@ -469,15 +462,12 @@ var createStorageEntry = (pallet, name, chainHead, compatibilityHelper2) => {
469
462
  if (isSystemNumber) {
470
463
  result$ = chainHead.bestBlocks$.pipe(
471
464
  (0, import_rxjs10.map)((blocks) => {
472
- if (at === "finalized" || !at)
473
- return blocks.at(-1);
474
- if (at === "best")
475
- return blocks.at(0);
465
+ if (at === "finalized" || !at) return blocks.at(-1);
466
+ if (at === "best") return blocks.at(0);
476
467
  return blocks.find((block) => block.hash === at);
477
468
  }),
478
469
  (0, import_rxjs10.map)((block) => {
479
- if (!block)
480
- throw new import_observable_client.NotBestBlockError();
470
+ if (!block) throw new import_observable_client.NotBestBlockError();
481
471
  return block.number;
482
472
  }),
483
473
  (0, import_rxjs10.distinctUntilChanged)()
@@ -488,12 +478,10 @@ var createStorageEntry = (pallet, name, chainHead, compatibilityHelper2) => {
488
478
  at,
489
479
  "value",
490
480
  (ctx) => {
491
- if (!isCompatible2(ctx))
492
- throw checksumError();
481
+ if (!isCompatible2(ctx)) throw checksumError();
493
482
  const codecs = ctx.dynamicBuilder.buildStorage(pallet, name);
494
483
  const actualArgs = args.length === codecs.len ? args : args.slice(0, -1);
495
- if (args !== actualArgs && !isLastArgOptional)
496
- throw invalidArgs(args);
484
+ if (args !== actualArgs && !isLastArgOptional) throw invalidArgs(args);
497
485
  return codecs.enc(...actualArgs);
498
486
  },
499
487
  null,
@@ -515,11 +503,9 @@ var createStorageEntry = (pallet, name, chainHead, compatibilityHelper2) => {
515
503
  at,
516
504
  "descendantsValues",
517
505
  (ctx) => {
518
- if (!isCompatible2(ctx))
519
- throw checksumError();
506
+ if (!isCompatible2(ctx)) throw checksumError();
520
507
  const codecs = ctx.dynamicBuilder.buildStorage(pallet, name);
521
- if (args.length > codecs.len)
522
- throw invalidArgs(args);
508
+ if (args.length > codecs.len) throw invalidArgs(args);
523
509
  const actualArgs = args.length > 0 && isLastArgOptional ? args.slice(0, -1) : args;
524
510
  if (args.length === codecs.len && actualArgs === args)
525
511
  throw invalidArgs(args);
@@ -545,11 +531,11 @@ var createStorageEntry = (pallet, name, chainHead, compatibilityHelper2) => {
545
531
  // src/tx/tx.ts
546
532
  var import_substrate_bindings8 = require("@polkadot-api/substrate-bindings");
547
533
  var import_utils19 = require("@polkadot-api/utils");
548
- var import_rxjs21 = require("rxjs");
534
+ var import_rxjs22 = require("rxjs");
549
535
  var import_signer = require("@polkadot-api/signer");
550
536
 
551
537
  // src/tx/create-tx.ts
552
- var import_rxjs19 = require("rxjs");
538
+ var import_rxjs20 = require("rxjs");
553
539
 
554
540
  // src/tx/signed-extensions/user/ChargeTransactionPayment.ts
555
541
  var import_substrate_bindings2 = require("@polkadot-api/substrate-bindings");
@@ -572,8 +558,7 @@ var systemVersionProp$ = (propName, metadata) => {
572
558
  const constant = metadata.pallets.find((x) => x.name === "System").constants.find((s) => s.name === "Version");
573
559
  const systemVersion = lookupFn(constant.type);
574
560
  const systemVersionDec = dynamicBuilder.buildDefinition(constant.type).dec;
575
- if (systemVersion.type !== "struct")
576
- throw new Error("not a struct");
561
+ if (systemVersion.type !== "struct") throw new Error("not a struct");
577
562
  const valueEnc = dynamicBuilder.buildDefinition(
578
563
  systemVersion.value[propName].id
579
564
  ).enc;
@@ -645,6 +630,7 @@ var ChargeAssetTxPayment = (tip, asset) => (0, import_rxjs14.of)({
645
630
  var chain_exports = {};
646
631
  __export(chain_exports, {
647
632
  CheckGenesis: () => CheckGenesis,
633
+ CheckMetadataHash: () => CheckMetadataHash,
648
634
  CheckNonce: () => CheckNonce,
649
635
  CheckSpecVersion: () => CheckSpecVersion,
650
636
  CheckTxVersion: () => CheckTxVersion,
@@ -657,8 +643,15 @@ var CheckGenesis = (ctx) => genesisHashFromCtx(ctx).pipe(
657
643
  (0, import_rxjs15.map)((additionalSigned) => ({ value: empty, additionalSigned }))
658
644
  );
659
645
 
660
- // src/tx/signed-extensions/chain/CheckNonce.ts
646
+ // src/tx/signed-extensions/chain/CheckMetadataHash.ts
661
647
  var import_rxjs16 = require("rxjs");
648
+ var CheckMetadataHash = () => (0, import_rxjs16.of)({
649
+ value: Uint8Array.from([0]),
650
+ additionalSigned: Uint8Array.from([0])
651
+ });
652
+
653
+ // src/tx/signed-extensions/chain/CheckNonce.ts
654
+ var import_rxjs17 = require("rxjs");
662
655
  var import_substrate_bindings5 = require("@polkadot-api/substrate-bindings");
663
656
  var import_utils13 = require("@polkadot-api/utils");
664
657
  var NONCE_RUNTIME_CALL = "AccountNonceApi_account_nonce";
@@ -668,9 +661,9 @@ var lenToDecoder = {
668
661
  4: import_substrate_bindings5.u32.dec,
669
662
  8: import_substrate_bindings5.u64.dec
670
663
  };
671
- var getNonce = (input) => (0, import_rxjs16.of)({ value: import_substrate_bindings5.compact.enc(input), additionalSigned: empty });
664
+ var getNonce = (input) => (0, import_rxjs17.of)({ value: import_substrate_bindings5.compact.enc(input), additionalSigned: empty });
672
665
  var CheckNonce = (ctx) => ctx.chainHead.call$(ctx.at, NONCE_RUNTIME_CALL, (0, import_utils13.toHex)(ctx.from)).pipe(
673
- (0, import_rxjs16.mergeMap)((result) => {
666
+ (0, import_rxjs17.mergeMap)((result) => {
674
667
  const bytes = (0, import_utils13.fromHex)(result);
675
668
  const decoder = lenToDecoder[bytes.length];
676
669
  if (!decoder)
@@ -680,22 +673,22 @@ var CheckNonce = (ctx) => ctx.chainHead.call$(ctx.at, NONCE_RUNTIME_CALL, (0, im
680
673
  );
681
674
 
682
675
  // src/tx/signed-extensions/chain/CheckSpecVersion.ts
683
- var import_rxjs17 = require("rxjs");
676
+ var import_rxjs18 = require("rxjs");
684
677
  var CheckSpecVersion = ({ metadata }) => systemVersionProp$("spec_version", metadata).pipe(
685
- (0, import_rxjs17.map)((additionalSigned) => ({ additionalSigned, value: empty }))
678
+ (0, import_rxjs18.map)((additionalSigned) => ({ additionalSigned, value: empty }))
686
679
  );
687
680
 
688
681
  // src/tx/signed-extensions/chain/CheckTxVersion.ts
689
- var import_rxjs18 = require("rxjs");
682
+ var import_rxjs19 = require("rxjs");
690
683
  var CheckTxVersion = ({ metadata }) => systemVersionProp$("transaction_version", metadata).pipe(
691
- (0, import_rxjs18.map)((additionalSigned) => ({ additionalSigned, value: empty }))
684
+ (0, import_rxjs19.map)((additionalSigned) => ({ additionalSigned, value: empty }))
692
685
  );
693
686
 
694
687
  // src/tx/create-tx.ts
695
688
  var import_substrate_bindings6 = require("@polkadot-api/substrate-bindings");
696
689
  var createTx = (chainHead, signer, callData, atBlock, hinted = {}) => chainHead.getRuntimeContext$(atBlock.hash).pipe(
697
- (0, import_rxjs19.take)(1),
698
- (0, import_rxjs19.mergeMap)((ctx) => {
690
+ (0, import_rxjs20.take)(1),
691
+ (0, import_rxjs20.mergeMap)((ctx) => {
699
692
  const signedExtensionsCtx = {
700
693
  metadata: ctx.metadata,
701
694
  chainHead,
@@ -704,7 +697,7 @@ var createTx = (chainHead, signer, callData, atBlock, hinted = {}) => chainHead.
704
697
  from: signer.publicKey
705
698
  };
706
699
  const mortality = !hinted.mortality ? { period: 64, blockNumber: atBlock.number } : hinted.mortality.mortal ? { period: hinted.mortality.period, blockNumber: atBlock.number } : void 0;
707
- return (0, import_rxjs19.combineLatest)(
700
+ return (0, import_rxjs20.combineLatest)(
708
701
  ctx.metadata.extrinsic.signedExtensions.map(
709
702
  ({ identifier, type, additionalSigned }) => {
710
703
  if (identifier === "CheckMortality")
@@ -718,7 +711,7 @@ var createTx = (chainHead, signer, callData, atBlock, hinted = {}) => chainHead.
718
711
  const fn = chain_exports[identifier];
719
712
  if (!fn) {
720
713
  if (ctx.dynamicBuilder.buildDefinition(type) === import_substrate_bindings6._void && ctx.dynamicBuilder.buildDefinition(additionalSigned) === import_substrate_bindings6._void)
721
- return (0, import_rxjs19.of)({
714
+ return (0, import_rxjs20.of)({
722
715
  value: empty,
723
716
  additionalSigned: empty
724
717
  });
@@ -728,7 +721,7 @@ var createTx = (chainHead, signer, callData, atBlock, hinted = {}) => chainHead.
728
721
  }
729
722
  )
730
723
  ).pipe(
731
- (0, import_rxjs19.mergeMap)(
724
+ (0, import_rxjs20.mergeMap)(
732
725
  (signedExtensions) => signer.sign(
733
726
  callData,
734
727
  Object.fromEntries(
@@ -749,10 +742,10 @@ var createTx = (chainHead, signer, callData, atBlock, hinted = {}) => chainHead.
749
742
 
750
743
  // src/tx/submit-fns.ts
751
744
  var import_substrate_bindings7 = require("@polkadot-api/substrate-bindings");
752
- var import_rxjs20 = require("rxjs");
745
+ var import_rxjs21 = require("rxjs");
753
746
  var import_utils18 = require("@polkadot-api/utils");
754
747
  var hashFromTx = (tx) => (0, import_utils18.toHex)((0, import_substrate_bindings7.Blake2256)((0, import_utils18.fromHex)(tx)));
755
- var computeState = (analized$, blocks$) => new import_rxjs20.Observable((observer) => {
748
+ var computeState = (analized$, blocks$) => new import_rxjs21.Observable((observer) => {
756
749
  const analyzedBlocks = /* @__PURE__ */ new Map();
757
750
  let pinnedBlocks;
758
751
  let latestState;
@@ -761,41 +754,37 @@ var computeState = (analized$, blocks$) => new import_rxjs20.Observable((observe
761
754
  let analyzed = analyzedBlocks.get(current);
762
755
  while (!analyzed) {
763
756
  const block = pinnedBlocks.blocks.get(current);
764
- if (!block)
765
- break;
757
+ if (!block) break;
766
758
  analyzed = analyzedBlocks.get(current = block.parent);
767
759
  }
768
- if (!analyzed)
769
- return;
770
- const isFinalized = pinnedBlocks.blocks.get(analyzed.hash).number <= pinnedBlocks.blocks.get(pinnedBlocks.finalized).number;
760
+ if (!analyzed) return;
761
+ const analyzedNumber = pinnedBlocks.blocks.get(analyzed.hash).number;
762
+ const isFinalized = analyzedNumber <= pinnedBlocks.blocks.get(pinnedBlocks.finalized).number;
771
763
  const found = analyzed.found.type;
772
764
  if (found && typeof latestState === "object" && latestState.hash === analyzed.hash) {
773
- if (isFinalized)
774
- observer.complete();
765
+ if (isFinalized) observer.complete();
775
766
  return;
776
767
  }
777
768
  observer.next(
778
769
  latestState = found ? {
779
770
  hash: analyzed.hash,
771
+ number: analyzedNumber,
780
772
  ...analyzed.found
781
773
  } : analyzed.found.isValid
782
774
  );
783
775
  if (isFinalized) {
784
- if (found)
785
- observer.complete();
786
- else if (!analyzed.found.isValid)
787
- observer.error(new Error("Invalid"));
776
+ if (found) observer.complete();
777
+ else if (!analyzed.found.isValid) observer.error(new Error("Invalid"));
788
778
  }
789
779
  };
790
780
  const subscription = blocks$.pipe(
791
- (0, import_rxjs20.distinctUntilChanged)(
781
+ (0, import_rxjs21.distinctUntilChanged)(
792
782
  (a, b) => a.finalized === b.finalized && a.best === b.best
793
783
  )
794
784
  ).subscribe({
795
785
  next: (pinned) => {
796
786
  pinnedBlocks = pinned;
797
- if (analyzedBlocks.size === 0)
798
- return;
787
+ if (analyzedBlocks.size === 0) return;
799
788
  computeNextState();
800
789
  },
801
790
  error(e) {
@@ -814,7 +803,7 @@ var computeState = (analized$, blocks$) => new import_rxjs20.Observable((observe
814
803
  })
815
804
  );
816
805
  return subscription;
817
- }).pipe((0, import_rxjs20.distinctUntilChanged)((a, b) => a === b));
806
+ }).pipe((0, import_rxjs21.distinctUntilChanged)((a, b) => a === b));
818
807
  var getTxSuccessFromSystemEvents = (systemEvents, txIdx) => {
819
808
  const events = systemEvents.filter((x) => x.phase.type === "ApplyExtrinsic" && x.phase.value === txIdx).map((x) => x.event);
820
809
  const lastEvent = events[events.length - 1];
@@ -829,20 +818,20 @@ var submit$ = (chainHead, broadcastTx$, tx, at, emitSign = false) => {
829
818
  ...rest
830
819
  });
831
820
  const at$ = chainHead.pinnedBlocks$.pipe(
832
- (0, import_rxjs20.take)(1),
833
- (0, import_rxjs20.map)((blocks) => blocks.blocks.get(at)?.hash ?? blocks.finalized)
821
+ (0, import_rxjs21.take)(1),
822
+ (0, import_rxjs21.map)((blocks) => blocks.blocks.get(at)?.hash ?? blocks.finalized)
834
823
  );
835
824
  const validate$ = at$.pipe(
836
- (0, import_rxjs20.mergeMap)(
825
+ (0, import_rxjs21.mergeMap)(
837
826
  (at2) => chainHead.validateTx$(at2, tx).pipe(
838
- (0, import_rxjs20.filter)((x) => !x),
839
- (0, import_rxjs20.map)(() => {
827
+ (0, import_rxjs21.filter)((x) => !x),
828
+ (0, import_rxjs21.map)(() => {
840
829
  throw new Error("Invalid");
841
830
  })
842
831
  )
843
832
  )
844
833
  );
845
- const track$ = new import_rxjs20.Observable((observer) => {
834
+ const track$ = new import_rxjs21.Observable((observer) => {
846
835
  const subscription = chainHead.trackTx$(tx).subscribe(observer);
847
836
  subscription.add(
848
837
  broadcastTx$(tx).subscribe({
@@ -854,7 +843,7 @@ var submit$ = (chainHead, broadcastTx$, tx, at, emitSign = false) => {
854
843
  return subscription;
855
844
  });
856
845
  const bestBlockState$ = computeState(track$, chainHead.pinnedBlocks$).pipe(
857
- (0, import_rxjs20.map)((x) => {
846
+ (0, import_rxjs21.map)((x) => {
858
847
  if (x === true || x === false)
859
848
  return getTxEvent("txBestBlocksState", {
860
849
  found: false,
@@ -864,26 +853,26 @@ var submit$ = (chainHead, broadcastTx$, tx, at, emitSign = false) => {
864
853
  found: true,
865
854
  block: {
866
855
  index: x.index,
856
+ number: x.number,
867
857
  hash: x.hash
868
858
  },
869
859
  ...getTxSuccessFromSystemEvents(x.events, x.index)
870
860
  });
871
861
  })
872
862
  );
873
- return (0, import_rxjs20.concat)(
874
- emitSign ? (0, import_rxjs20.of)(getTxEvent("signed", {})) : import_rxjs20.EMPTY,
863
+ return (0, import_rxjs21.concat)(
864
+ emitSign ? (0, import_rxjs21.of)(getTxEvent("signed", {})) : import_rxjs21.EMPTY,
875
865
  validate$,
876
- (0, import_rxjs20.of)(getTxEvent("broadcasted", {})),
866
+ (0, import_rxjs21.of)(getTxEvent("broadcasted", {})),
877
867
  bestBlockState$.pipe(
878
868
  continueWith(
879
- ({ found, type, ...rest }) => found ? (0, import_rxjs20.of)(getTxEvent("finalized", rest)) : import_rxjs20.EMPTY
869
+ ({ found, type, ...rest }) => found ? (0, import_rxjs21.of)(getTxEvent("finalized", rest)) : import_rxjs21.EMPTY
880
870
  )
881
871
  )
882
872
  );
883
873
  };
884
- var submit = async (chainHead, broadcastTx$, transaction, at) => (0, import_rxjs20.lastValueFrom)(submit$(chainHead, broadcastTx$, transaction, at)).then((x) => {
885
- if (x.type !== "finalized")
886
- throw null;
874
+ var submit = async (chainHead, broadcastTx$, transaction, at) => (0, import_rxjs21.lastValueFrom)(submit$(chainHead, broadcastTx$, transaction, at)).then((x) => {
875
+ if (x.type !== "finalized") throw null;
887
876
  const result = { ...x };
888
877
  delete result.type;
889
878
  return result;
@@ -917,41 +906,40 @@ var createTxEntry = (pallet, name, assetChecksum, chainHead, broadcast, compatib
917
906
  };
918
907
  };
919
908
  const getCallData$ = (arg2, options = {}) => compatibleRuntime$(chainHead, null, checksumError).pipe(
920
- (0, import_rxjs21.map)((ctx) => getCallDataWithContext(ctx, arg2, options))
909
+ (0, import_rxjs22.map)((ctx) => getCallDataWithContext(ctx, arg2, options))
921
910
  );
922
911
  const getEncodedData = (runtime) => {
923
912
  if (!runtime)
924
- return (0, import_rxjs21.firstValueFrom)(getCallData$(arg).pipe((0, import_rxjs21.map)((x) => x.callData)));
925
- if (!isCompatible(runtime))
926
- throw checksumError();
913
+ return (0, import_rxjs22.firstValueFrom)(getCallData$(arg).pipe((0, import_rxjs22.map)((x) => x.callData)));
914
+ if (!isCompatible(runtime)) throw checksumError();
927
915
  return getCallDataWithContext(runtime._getCtx(), arg).callData;
928
916
  };
929
917
  const sign$ = (from, { ..._options }, atBlock) => getCallData$(arg, _options).pipe(
930
- (0, import_rxjs21.mergeMap)(
918
+ (0, import_rxjs22.mergeMap)(
931
919
  ({ callData, options }) => createTx(chainHead, from, callData.asBytes(), atBlock, options)
932
920
  )
933
921
  );
934
922
  const _sign = (from, { at, ..._options } = {}) => {
935
923
  return (!at || at === "finalized" ? chainHead.finalized$ : at === "best" ? chainHead.best$ : chainHead.bestBlocks$.pipe(
936
- (0, import_rxjs21.map)((x) => x.find((b) => b.hash === at))
924
+ (0, import_rxjs22.map)((x) => x.find((b) => b.hash === at))
937
925
  )).pipe(
938
- (0, import_rxjs21.take)(1),
939
- (0, import_rxjs21.mergeMap)(
926
+ (0, import_rxjs22.take)(1),
927
+ (0, import_rxjs22.mergeMap)(
940
928
  (atBlock) => atBlock ? sign$(from, _options, atBlock).pipe(
941
- (0, import_rxjs21.map)((signed) => ({
929
+ (0, import_rxjs22.map)((signed) => ({
942
930
  tx: (0, import_utils19.toHex)(signed),
943
931
  block: atBlock
944
932
  }))
945
- ) : (0, import_rxjs21.throwError)(() => new Error(`Uknown block ${at}`))
933
+ ) : (0, import_rxjs22.throwError)(() => new Error(`Uknown block ${at}`))
946
934
  )
947
935
  );
948
936
  };
949
- const sign = (from, options) => (0, import_rxjs21.firstValueFrom)(_sign(from, options)).then((x) => x.tx);
950
- const signAndSubmit = (from, _options) => (0, import_rxjs21.firstValueFrom)(_sign(from, _options)).then(
937
+ const sign = (from, options) => (0, import_rxjs22.firstValueFrom)(_sign(from, options)).then((x) => x.tx);
938
+ const signAndSubmit = (from, _options) => (0, import_rxjs22.firstValueFrom)(_sign(from, _options)).then(
951
939
  ({ tx, block }) => submit(chainHead, broadcast, tx, block.hash)
952
940
  );
953
941
  const signSubmitAndWatch = (from, _options) => _sign(from, _options).pipe(
954
- (0, import_rxjs21.mergeMap)(
942
+ (0, import_rxjs22.mergeMap)(
955
943
  ({ tx, block }) => submit$(chainHead, broadcast, tx, block.hash, true)
956
944
  )
957
945
  );
@@ -963,8 +951,8 @@ var createTxEntry = (pallet, name, assetChecksum, chainHead, broadcast, compatib
963
951
  );
964
952
  const encoded = (0, import_utils19.fromHex)(await sign(fakeSigner, _options));
965
953
  const args = (0, import_utils19.toHex)((0, import_utils19.mergeUint8)(encoded, import_substrate_bindings8.u32.enc(encoded.length)));
966
- return (0, import_rxjs21.firstValueFrom)(
967
- chainHead.call$(null, "TransactionPaymentApi_query_info", args).pipe((0, import_rxjs21.map)(queryInfoDec))
954
+ return (0, import_rxjs22.firstValueFrom)(
955
+ chainHead.call$(null, "TransactionPaymentApi_query_info", args).pipe((0, import_rxjs22.map)(queryInfoDec))
968
956
  );
969
957
  };
970
958
  return {
@@ -998,11 +986,9 @@ var createTypedApi = (chainDefinition, chainHead, broadcast$) => {
998
986
  const createProxyPath = (pathCall) => {
999
987
  const cache = {};
1000
988
  return createProxy((a) => {
1001
- if (!cache[a])
1002
- cache[a] = {};
989
+ if (!cache[a]) cache[a] = {};
1003
990
  return createProxy((b) => {
1004
- if (!cache[a][b])
1005
- cache[a][b] = pathCall(a, b);
991
+ if (!cache[a][b]) cache[a][b] = pathCall(a, b);
1006
992
  return cache[a][b];
1007
993
  });
1008
994
  });
@@ -1014,7 +1000,7 @@ var createTypedApi = (chainDefinition, chainHead, broadcast$) => {
1014
1000
  chainHead,
1015
1001
  compatibilityHelper(
1016
1002
  runtime,
1017
- (r) => r._getPalletChecksum(0 /* Storage */, pallet, name)
1003
+ (r) => r._getPalletChecksum("storage" /* Storage */, pallet, name)
1018
1004
  )
1019
1005
  )
1020
1006
  );
@@ -1027,7 +1013,7 @@ var createTypedApi = (chainDefinition, chainHead, broadcast$) => {
1027
1013
  broadcast$,
1028
1014
  compatibilityHelper(
1029
1015
  runtime,
1030
- (r) => r._getPalletChecksum(1 /* Tx */, pallet, name)
1016
+ (r) => r._getPalletChecksum("tx" /* Tx */, pallet, name)
1031
1017
  )
1032
1018
  )
1033
1019
  );
@@ -1038,7 +1024,7 @@ var createTypedApi = (chainDefinition, chainHead, broadcast$) => {
1038
1024
  chainHead,
1039
1025
  compatibilityHelper(
1040
1026
  runtime,
1041
- (r) => r._getPalletChecksum(2 /* Event */, pallet, name)
1027
+ (r) => r._getPalletChecksum("events" /* Event */, pallet, name)
1042
1028
  )
1043
1029
  )
1044
1030
  );
@@ -1049,7 +1035,7 @@ var createTypedApi = (chainDefinition, chainHead, broadcast$) => {
1049
1035
  chainHead,
1050
1036
  compatibilityHelper(
1051
1037
  runtime,
1052
- (r) => r._getPalletChecksum(4 /* Const */, pallet, name)
1038
+ (r) => r._getPalletChecksum("constants" /* Const */, pallet, name)
1053
1039
  )
1054
1040
  )
1055
1041
  );
@@ -1080,12 +1066,12 @@ function createClient(provider) {
1080
1066
  return {
1081
1067
  getChainSpecData,
1082
1068
  finalizedBlock$: chainHead.finalized$,
1083
- getFinalizedBlock: () => (0, import_rxjs22.firstValueFrom)(chainHead.finalized$),
1069
+ getFinalizedBlock: () => (0, import_rxjs23.firstValueFrom)(chainHead.finalized$),
1084
1070
  bestBlocks$: chainHead.bestBlocks$,
1085
- getBestBlocks: () => (0, import_rxjs22.firstValueFrom)(chainHead.bestBlocks$),
1071
+ getBestBlocks: () => (0, import_rxjs23.firstValueFrom)(chainHead.bestBlocks$),
1086
1072
  watchBlockBody: chainHead.body$,
1087
- getBlockBody: (hash) => (0, import_rxjs22.firstValueFrom)(chainHead.body$(hash)),
1088
- getBlockHeader: (hash) => (0, import_rxjs22.firstValueFrom)(chainHead.header$(hash ?? null)),
1073
+ getBlockBody: (hash) => (0, import_rxjs23.firstValueFrom)(chainHead.body$(hash)),
1074
+ getBlockHeader: (hash) => (0, import_rxjs23.firstValueFrom)(chainHead.header$(hash ?? null)),
1089
1075
  submit: (...args) => submit(chainHead, broadcastTx$, ...args),
1090
1076
  submitAndWatch: (...args) => submit$(chainHead, broadcastTx$, ...args),
1091
1077
  getTypedApi: (chainDefinition) => createTypedApi(chainDefinition, chainHead, broadcastTx$),