@typeberry/lib 0.3.1-27dfdd9 → 0.4.0-1ad1b89

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.
Files changed (4) hide show
  1. package/index.cjs +60 -63
  2. package/index.d.ts +7 -11
  3. package/index.js +60 -63
  4. package/package.json +1 -1
package/index.cjs CHANGED
@@ -78,8 +78,8 @@ class Compatibility {
78
78
  /**
79
79
  * Allows selecting different values for different Gray Paper versions from one record.
80
80
  *
81
- * @param fallback The default value to return if no value is found for the current.
82
- * @param record A record mapping versions to values, checking if the version is greater or equal to the current version.
81
+ * fallback The default value to return if no value is found for the current.
82
+ * versions A record mapping versions to values, checking if the version is greater or equal to the current version.
83
83
  * @returns The value for the current version, or the default value.
84
84
  */
85
85
  static selectIfGreaterOrEqual({ fallback, versions, }) {
@@ -239,7 +239,7 @@ const workspacePathFix = env.NODE_ENV === "development"
239
239
  : () => (p) => p;
240
240
 
241
241
  /**
242
- * @fileoverview `Opaque<Type, Token>` constructs a unique type which is a subset of Type with a
242
+ * `Opaque<Type, Token>` constructs a unique type which is a subset of Type with a
243
243
  * specified unique token Token. It means that base type cannot be assigned to unique type by accident.
244
244
  * Good examples of opaque types include:
245
245
  * - JWTs or other tokens - these are special kinds of string used for authorization purposes.
@@ -6712,6 +6712,8 @@ var index$m = /*#__PURE__*/Object.freeze({
6712
6712
  SEGMENT_BYTES: SEGMENT_BYTES,
6713
6713
  TicketsMarker: TicketsMarker,
6714
6714
  ValidatorKeys: ValidatorKeys,
6715
+ W_E: W_E,
6716
+ W_S: W_S,
6715
6717
  assurances: assurances,
6716
6718
  codecPerEpochBlock: codecPerEpochBlock,
6717
6719
  codecPerValidator: codecPerValidator,
@@ -7100,12 +7102,12 @@ const workRefineLoadFromJson = json.object({
7100
7102
  extrinsic_count: "number",
7101
7103
  extrinsic_size: "number",
7102
7104
  exports: "number",
7103
- }, ({ gas_used, imports, extrinsic_count, extrinsic_size, exports }) => WorkRefineLoad.create({
7105
+ }, ({ gas_used, imports, extrinsic_count, extrinsic_size, exports: exports$1 }) => WorkRefineLoad.create({
7104
7106
  gasUsed: tryAsServiceGas(gas_used),
7105
7107
  importedSegments: tryAsU32(imports),
7106
7108
  extrinsicCount: tryAsU32(extrinsic_count),
7107
7109
  extrinsicSize: tryAsU32(extrinsic_size),
7108
- exportedSegments: tryAsU32(exports),
7110
+ exportedSegments: tryAsU32(exports$1),
7109
7111
  }));
7110
7112
  const workResultFromJson = json.object({
7111
7113
  service_id: "number",
@@ -7267,7 +7269,7 @@ function parseBootnode(v) {
7267
7269
  if (name === "" || ip === "" || port === "") {
7268
7270
  throw new Error(`Invalid bootnode format, expected: <name>@<ip>:<port>, got: "${v}"`);
7269
7271
  }
7270
- const portNumber = Number.parseInt(port);
7272
+ const portNumber = Number.parseInt(port, 10);
7271
7273
  if (!isU16(portNumber)) {
7272
7274
  throw new Error(`Invalid port number: "${port}"`);
7273
7275
  }
@@ -8872,7 +8874,7 @@ class CoreStatistics {
8872
8874
  /** `i` */
8873
8875
  imports,
8874
8876
  /** `e` */
8875
- exports,
8877
+ exports$1,
8876
8878
  /** `z` */
8877
8879
  extrinsicSize,
8878
8880
  /** `x` */
@@ -8884,7 +8886,7 @@ class CoreStatistics {
8884
8886
  this.dataAvailabilityLoad = dataAvailabilityLoad;
8885
8887
  this.popularity = popularity;
8886
8888
  this.imports = imports;
8887
- this.exports = exports;
8889
+ this.exports = exports$1;
8888
8890
  this.extrinsicSize = extrinsicSize;
8889
8891
  this.extrinsicCount = extrinsicCount;
8890
8892
  this.bundleSize = bundleSize;
@@ -8977,7 +8979,7 @@ class ServiceStatistics {
8977
8979
  /** `i` */
8978
8980
  imports,
8979
8981
  /** `e` */
8980
- exports,
8982
+ exports$1,
8981
8983
  /** `z` */
8982
8984
  extrinsicSize,
8983
8985
  /** `x` */
@@ -8995,7 +8997,7 @@ class ServiceStatistics {
8995
8997
  this.refinementCount = refinementCount;
8996
8998
  this.refinementGasUsed = refinementGasUsed;
8997
8999
  this.imports = imports;
8998
- this.exports = exports;
9000
+ this.exports = exports$1;
8999
9001
  this.extrinsicSize = extrinsicSize;
9000
9002
  this.extrinsicCount = extrinsicCount;
9001
9003
  this.accumulateCount = accumulateCount;
@@ -10376,7 +10378,6 @@ class LeafNode {
10376
10378
  /**
10377
10379
  * Get the byte length of embedded value.
10378
10380
  *
10379
- * @remark
10380
10381
  * Note in case this node only contains hash this is going to be 0.
10381
10382
  */
10382
10383
  getValueLength() {
@@ -10387,7 +10388,6 @@ class LeafNode {
10387
10388
  /**
10388
10389
  * Returns the embedded value.
10389
10390
  *
10390
- * @remark
10391
10391
  * Note that this is going to be empty for a regular leaf node (i.e. containing a hash).
10392
10392
  */
10393
10393
  getValue() {
@@ -10397,7 +10397,6 @@ class LeafNode {
10397
10397
  /**
10398
10398
  * Returns contained value hash.
10399
10399
  *
10400
- * @remark
10401
10400
  * Note that for embedded value this is going to be full 0-padded 32 bytes.
10402
10401
  */
10403
10402
  getValueHash() {
@@ -16837,18 +16836,18 @@ async function instantiate$1(module, imports = {}) {
16837
16836
  },
16838
16837
  }, Object.assign(Object.create(globalThis), imports.env || {})),
16839
16838
  };
16840
- const { exports } = await WebAssembly.instantiate(module, adaptedImports);
16841
- const memory = exports.memory || imports.env.memory;
16839
+ const { exports: exports$1 } = await WebAssembly.instantiate(module, adaptedImports);
16840
+ const memory = exports$1.memory || imports.env.memory;
16842
16841
  const adaptedExports = Object.setPrototypeOf({
16843
16842
  getAssembly(p) {
16844
16843
  // assembly/api-internal/getAssembly(assembly/program/Program) => ~lib/string/String
16845
16844
  p = __lowerInternref(p) || __notnull();
16846
- return __liftString(exports.getAssembly(p) >>> 0);
16845
+ return __liftString(exports$1.getAssembly(p) >>> 0);
16847
16846
  },
16848
16847
  wrapAsProgram(bytecode) {
16849
16848
  // assembly/program-build/wrapAsProgram(~lib/typedarray/Uint8Array) => ~lib/typedarray/Uint8Array
16850
16849
  bytecode = __lowerTypedArray(Uint8Array, 10, 0, bytecode) || __notnull();
16851
- return __liftTypedArray(Uint8Array, exports.wrapAsProgram(bytecode) >>> 0);
16850
+ return __liftTypedArray(Uint8Array, exports$1.wrapAsProgram(bytecode) >>> 0);
16852
16851
  },
16853
16852
  resetJAM(program, pc, initialGas, args, hasMetadata) {
16854
16853
  // assembly/api-debugger/resetJAM(~lib/array/Array<u8>, f64, i64, ~lib/array/Array<u8>, bool?) => void
@@ -16857,8 +16856,8 @@ async function instantiate$1(module, imports = {}) {
16857
16856
  args = __lowerArray(__setU8, 6, 0, args) || __notnull();
16858
16857
  hasMetadata = hasMetadata ? 1 : 0;
16859
16858
  try {
16860
- exports.__setArgumentsLength(arguments.length);
16861
- exports.resetJAM(program, pc, initialGas, args, hasMetadata);
16859
+ exports$1.__setArgumentsLength(arguments.length);
16860
+ exports$1.resetJAM(program, pc, initialGas, args, hasMetadata);
16862
16861
  } finally {
16863
16862
  __release(program);
16864
16863
  }
@@ -16870,8 +16869,8 @@ async function instantiate$1(module, imports = {}) {
16870
16869
  initialGas = initialGas || 0n;
16871
16870
  hasMetadata = hasMetadata ? 1 : 0;
16872
16871
  try {
16873
- exports.__setArgumentsLength(arguments.length);
16874
- exports.resetGeneric(program, flatRegisters, initialGas, hasMetadata);
16872
+ exports$1.__setArgumentsLength(arguments.length);
16873
+ exports$1.resetGeneric(program, flatRegisters, initialGas, hasMetadata);
16875
16874
  } finally {
16876
16875
  __release(program);
16877
16876
  }
@@ -16885,8 +16884,8 @@ async function instantiate$1(module, imports = {}) {
16885
16884
  initialGas = initialGas || 0n;
16886
16885
  hasMetadata = hasMetadata ? 1 : 0;
16887
16886
  try {
16888
- exports.__setArgumentsLength(arguments.length);
16889
- exports.resetGenericWithMemory(program, flatRegisters, pageMap, chunks, initialGas, hasMetadata);
16887
+ exports$1.__setArgumentsLength(arguments.length);
16888
+ exports$1.resetGenericWithMemory(program, flatRegisters, pageMap, chunks, initialGas, hasMetadata);
16890
16889
  } finally {
16891
16890
  __release(program);
16892
16891
  __release(flatRegisters);
@@ -16895,68 +16894,68 @@ async function instantiate$1(module, imports = {}) {
16895
16894
  },
16896
16895
  nextStep() {
16897
16896
  // assembly/api-debugger/nextStep() => bool
16898
- return exports.nextStep() != 0;
16897
+ return exports$1.nextStep() != 0;
16899
16898
  },
16900
16899
  nSteps(steps) {
16901
16900
  // assembly/api-debugger/nSteps(u32) => bool
16902
- return exports.nSteps(steps) != 0;
16901
+ return exports$1.nSteps(steps) != 0;
16903
16902
  },
16904
16903
  getProgramCounter() {
16905
16904
  // assembly/api-debugger/getProgramCounter() => u32
16906
- return exports.getProgramCounter() >>> 0;
16905
+ return exports$1.getProgramCounter() >>> 0;
16907
16906
  },
16908
16907
  getExitArg() {
16909
16908
  // assembly/api-debugger/getExitArg() => u32
16910
- return exports.getExitArg() >>> 0;
16909
+ return exports$1.getExitArg() >>> 0;
16911
16910
  },
16912
16911
  setGasLeft(gas) {
16913
16912
  // assembly/api-debugger/setGasLeft(i64) => void
16914
16913
  gas = gas || 0n;
16915
- exports.setGasLeft(gas);
16914
+ exports$1.setGasLeft(gas);
16916
16915
  },
16917
16916
  getRegisters() {
16918
16917
  // assembly/api-debugger/getRegisters() => ~lib/typedarray/Uint8Array
16919
- return __liftTypedArray(Uint8Array, exports.getRegisters() >>> 0);
16918
+ return __liftTypedArray(Uint8Array, exports$1.getRegisters() >>> 0);
16920
16919
  },
16921
16920
  setRegisters(flatRegisters) {
16922
16921
  // assembly/api-debugger/setRegisters(~lib/array/Array<u8>) => void
16923
16922
  flatRegisters = __lowerArray(__setU8, 6, 0, flatRegisters) || __notnull();
16924
- exports.setRegisters(flatRegisters);
16923
+ exports$1.setRegisters(flatRegisters);
16925
16924
  },
16926
16925
  getPageDump(index) {
16927
16926
  // assembly/api-debugger/getPageDump(u32) => ~lib/typedarray/Uint8Array
16928
- return __liftTypedArray(Uint8Array, exports.getPageDump(index) >>> 0);
16927
+ return __liftTypedArray(Uint8Array, exports$1.getPageDump(index) >>> 0);
16929
16928
  },
16930
16929
  getMemory(address, length) {
16931
16930
  // assembly/api-debugger/getMemory(u32, u32) => ~lib/typedarray/Uint8Array | null
16932
- return __liftTypedArray(Uint8Array, exports.getMemory(address, length) >>> 0);
16931
+ return __liftTypedArray(Uint8Array, exports$1.getMemory(address, length) >>> 0);
16933
16932
  },
16934
16933
  setMemory(address, data) {
16935
16934
  // assembly/api-debugger/setMemory(u32, ~lib/typedarray/Uint8Array) => bool
16936
16935
  data = __lowerTypedArray(Uint8Array, 10, 0, data) || __notnull();
16937
- return exports.setMemory(address, data) != 0;
16936
+ return exports$1.setMemory(address, data) != 0;
16938
16937
  },
16939
16938
  InputKind: (values => (
16940
16939
  // assembly/api-utils/InputKind
16941
- values[values.Generic = exports["InputKind.Generic"].valueOf()] = "Generic",
16942
- values[values.SPI = exports["InputKind.SPI"].valueOf()] = "SPI",
16940
+ values[values.Generic = exports$1["InputKind.Generic"].valueOf()] = "Generic",
16941
+ values[values.SPI = exports$1["InputKind.SPI"].valueOf()] = "SPI",
16943
16942
  values
16944
16943
  ))({}),
16945
16944
  HasMetadata: (values => (
16946
16945
  // assembly/api-utils/HasMetadata
16947
- values[values.Yes = exports["HasMetadata.Yes"].valueOf()] = "Yes",
16948
- values[values.No = exports["HasMetadata.No"].valueOf()] = "No",
16946
+ values[values.Yes = exports$1["HasMetadata.Yes"].valueOf()] = "Yes",
16947
+ values[values.No = exports$1["HasMetadata.No"].valueOf()] = "No",
16949
16948
  values
16950
16949
  ))({}),
16951
16950
  getGasCosts(input, kind, withMetadata) {
16952
16951
  // assembly/api-utils/getGasCosts(~lib/array/Array<u8>, i32, i32) => ~lib/array/Array<assembly/gas-costs/BlockGasCost>
16953
16952
  input = __lowerArray(__setU8, 6, 0, input) || __notnull();
16954
- return __liftArray(pointer => __liftRecord50(__getU32(pointer)), 2, exports.getGasCosts(input, kind, withMetadata) >>> 0);
16953
+ return __liftArray(pointer => __liftRecord50(__getU32(pointer)), 2, exports$1.getGasCosts(input, kind, withMetadata) >>> 0);
16955
16954
  },
16956
16955
  disassemble(input, kind, withMetadata) {
16957
16956
  // assembly/api-utils/disassemble(~lib/array/Array<u8>, i32, i32) => ~lib/string/String
16958
16957
  input = __lowerArray(__setU8, 6, 0, input) || __notnull();
16959
- return __liftString(exports.disassemble(input, kind, withMetadata) >>> 0);
16958
+ return __liftString(exports$1.disassemble(input, kind, withMetadata) >>> 0);
16960
16959
  },
16961
16960
  prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args) {
16962
16961
  // assembly/api-utils/prepareProgram(i32, i32, ~lib/array/Array<u8>, ~lib/array/Array<u64>, ~lib/array/Array<assembly/api-internal/InitialPage>, ~lib/array/Array<assembly/api-internal/InitialChunk>, ~lib/array/Array<u8>) => assembly/spi/StandardProgram
@@ -16966,7 +16965,7 @@ async function instantiate$1(module, imports = {}) {
16966
16965
  initialMemory = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord48(value) || __notnull()); }, 49, 2, initialMemory) || __notnull());
16967
16966
  args = __lowerArray(__setU8, 6, 0, args) || __notnull();
16968
16967
  try {
16969
- return __liftInternref(exports.prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args) >>> 0);
16968
+ return __liftInternref(exports$1.prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args) >>> 0);
16970
16969
  } finally {
16971
16970
  __release(program);
16972
16971
  __release(initialRegisters);
@@ -16980,10 +16979,10 @@ async function instantiate$1(module, imports = {}) {
16980
16979
  initialGas = initialGas || 0n;
16981
16980
  logs = logs ? 1 : 0;
16982
16981
  useSbrkGas = useSbrkGas ? 1 : 0;
16983
- exports.__setArgumentsLength(arguments.length);
16984
- return __liftRecord55(exports.runProgram(program, initialGas, programCounter, logs, useSbrkGas) >>> 0);
16982
+ exports$1.__setArgumentsLength(arguments.length);
16983
+ return __liftRecord55(exports$1.runProgram(program, initialGas, programCounter, logs, useSbrkGas) >>> 0);
16985
16984
  },
16986
- }, exports);
16985
+ }, exports$1);
16987
16986
  function __liftRecord50(pointer) {
16988
16987
  // assembly/gas-costs/BlockGasCost
16989
16988
  // Hint: Opt-out from lifting as a record by providing an empty constructor
@@ -16997,21 +16996,21 @@ async function instantiate$1(module, imports = {}) {
16997
16996
  // assembly/api-internal/InitialPage
16998
16997
  // Hint: Opt-out from lowering as a record by providing an empty constructor
16999
16998
  if (value == null) return 0;
17000
- const pointer = exports.__pin(exports.__new(12, 46));
16999
+ const pointer = exports$1.__pin(exports$1.__new(12, 46));
17001
17000
  __setU32(pointer + 0, value.address);
17002
17001
  __setU32(pointer + 4, value.length);
17003
17002
  __setU32(pointer + 8, value.access);
17004
- exports.__unpin(pointer);
17003
+ exports$1.__unpin(pointer);
17005
17004
  return pointer;
17006
17005
  }
17007
17006
  function __lowerRecord48(value) {
17008
17007
  // assembly/api-internal/InitialChunk
17009
17008
  // Hint: Opt-out from lowering as a record by providing an empty constructor
17010
17009
  if (value == null) return 0;
17011
- const pointer = exports.__pin(exports.__new(8, 48));
17010
+ const pointer = exports$1.__pin(exports$1.__new(8, 48));
17012
17011
  __setU32(pointer + 0, value.address);
17013
17012
  __setU32(pointer + 4, __lowerArray(__setU8, 6, 0, value.data) || __notnull());
17014
- exports.__unpin(pointer);
17013
+ exports$1.__unpin(pointer);
17015
17014
  return pointer;
17016
17015
  }
17017
17016
  function __liftRecord48(pointer) {
@@ -17060,15 +17059,15 @@ async function instantiate$1(module, imports = {}) {
17060
17059
  if (values == null) return 0;
17061
17060
  const
17062
17061
  length = values.length,
17063
- buffer = exports.__pin(exports.__new(length << align, 1)) >>> 0,
17064
- header = exports.__pin(exports.__new(16, id)) >>> 0;
17062
+ buffer = exports$1.__pin(exports$1.__new(length << align, 1)) >>> 0,
17063
+ header = exports$1.__pin(exports$1.__new(16, id)) >>> 0;
17065
17064
  __setU32(header + 0, buffer);
17066
17065
  __dataview.setUint32(header + 4, buffer, true);
17067
17066
  __dataview.setUint32(header + 8, length << align, true);
17068
17067
  __dataview.setUint32(header + 12, length, true);
17069
17068
  for (let i = 0; i < length; ++i) lowerElement(buffer + (i << align >>> 0), values[i]);
17070
- exports.__unpin(buffer);
17071
- exports.__unpin(header);
17069
+ exports$1.__unpin(buffer);
17070
+ exports$1.__unpin(header);
17072
17071
  return header;
17073
17072
  }
17074
17073
  function __liftTypedArray(constructor, pointer) {
@@ -17083,13 +17082,13 @@ async function instantiate$1(module, imports = {}) {
17083
17082
  if (values == null) return 0;
17084
17083
  const
17085
17084
  length = values.length,
17086
- buffer = exports.__pin(exports.__new(length << align, 1)) >>> 0,
17087
- header = exports.__new(12, id) >>> 0;
17085
+ buffer = exports$1.__pin(exports$1.__new(length << align, 1)) >>> 0,
17086
+ header = exports$1.__new(12, id) >>> 0;
17088
17087
  __setU32(header + 0, buffer);
17089
17088
  __dataview.setUint32(header + 4, buffer, true);
17090
17089
  __dataview.setUint32(header + 8, length << align, true);
17091
17090
  new constructor(memory.buffer, buffer, length).set(values);
17092
- exports.__unpin(buffer);
17091
+ exports$1.__unpin(buffer);
17093
17092
  return header;
17094
17093
  }
17095
17094
  class Internref extends Number {}
@@ -17110,14 +17109,14 @@ async function instantiate$1(module, imports = {}) {
17110
17109
  if (pointer) {
17111
17110
  const refcount = refcounts.get(pointer);
17112
17111
  if (refcount) refcounts.set(pointer, refcount + 1);
17113
- else refcounts.set(exports.__pin(pointer), 1);
17112
+ else refcounts.set(exports$1.__pin(pointer), 1);
17114
17113
  }
17115
17114
  return pointer;
17116
17115
  }
17117
17116
  function __release(pointer) {
17118
17117
  if (pointer) {
17119
17118
  const refcount = refcounts.get(pointer);
17120
- if (refcount === 1) exports.__unpin(pointer), refcounts.delete(pointer);
17119
+ if (refcount === 1) exports$1.__unpin(pointer), refcounts.delete(pointer);
17121
17120
  else if (refcount) refcounts.set(pointer, refcount - 1);
17122
17121
  else throw Error(`invalid refcount '${refcount}' for reference '${pointer}'`);
17123
17122
  }
@@ -18065,12 +18064,12 @@ class JsonCoreStatistics {
18065
18064
  extrinsic_count: "number",
18066
18065
  bundle_size: "number",
18067
18066
  gas_used: json.fromBigInt(tryAsServiceGas),
18068
- }, ({ da_load, popularity, imports, exports, extrinsic_size, extrinsic_count, bundle_size, gas_used }) => {
18067
+ }, ({ da_load, popularity, imports, exports: exports$1, extrinsic_size, extrinsic_count, bundle_size, gas_used }) => {
18069
18068
  return CoreStatistics.create({
18070
18069
  dataAvailabilityLoad: da_load,
18071
18070
  popularity,
18072
18071
  imports,
18073
- exports,
18072
+ exports: exports$1,
18074
18073
  extrinsicSize: extrinsic_size,
18075
18074
  extrinsicCount: extrinsic_count,
18076
18075
  bundleSize: bundle_size,
@@ -18104,14 +18103,14 @@ class JsonServiceStatistics {
18104
18103
  on_transfers_gas_used: json.fromBigInt(tryAsServiceGas),
18105
18104
  }
18106
18105
  : {}),
18107
- }, ({ provided_count, provided_size, refinement_count, refinement_gas_used, imports, exports, extrinsic_size, extrinsic_count, accumulate_count, accumulate_gas_used, on_transfers_count, on_transfers_gas_used, }) => {
18106
+ }, ({ provided_count, provided_size, refinement_count, refinement_gas_used, imports, exports: exports$1, extrinsic_size, extrinsic_count, accumulate_count, accumulate_gas_used, on_transfers_count, on_transfers_gas_used, }) => {
18108
18107
  return ServiceStatistics.create({
18109
18108
  providedCount: provided_count,
18110
18109
  providedSize: provided_size,
18111
18110
  refinementCount: refinement_count,
18112
18111
  refinementGasUsed: refinement_gas_used,
18113
18112
  imports,
18114
- exports,
18113
+ exports: exports$1,
18115
18114
  extrinsicSize: extrinsic_size,
18116
18115
  extrinsicCount: extrinsic_count,
18117
18116
  accumulateCount: accumulate_count,
@@ -18319,11 +18318,9 @@ var index$1 = /*#__PURE__*/Object.freeze({
18319
18318
 
18320
18319
  /** Helper function to create most used hashes in the block */
18321
18320
  class TransitionHasher {
18322
- context;
18323
18321
  keccakHasher;
18324
18322
  blake2b;
18325
- constructor(context, keccakHasher, blake2b) {
18326
- this.context = context;
18323
+ constructor(keccakHasher, blake2b) {
18327
18324
  this.keccakHasher = keccakHasher;
18328
18325
  this.blake2b = blake2b;
18329
18326
  }
package/index.d.ts CHANGED
@@ -85,8 +85,8 @@ declare class Compatibility {
85
85
  /**
86
86
  * Allows selecting different values for different Gray Paper versions from one record.
87
87
  *
88
- * @param fallback The default value to return if no value is found for the current.
89
- * @param record A record mapping versions to values, checking if the version is greater or equal to the current version.
88
+ * fallback The default value to return if no value is found for the current.
89
+ * versions A record mapping versions to values, checking if the version is greater or equal to the current version.
90
90
  * @returns The value for the current version, or the default value.
91
91
  */
92
92
  static selectIfGreaterOrEqual<T>({
@@ -274,7 +274,7 @@ declare const workspacePathFix =
274
274
  : () => (p: string) => p;
275
275
 
276
276
  /**
277
- * @fileoverview `Opaque<Type, Token>` constructs a unique type which is a subset of Type with a
277
+ * `Opaque<Type, Token>` constructs a unique type which is a subset of Type with a
278
278
  * specified unique token Token. It means that base type cannot be assigned to unique type by accident.
279
279
  * Good examples of opaque types include:
280
280
  * - JWTs or other tokens - these are special kinds of string used for authorization purposes.
@@ -431,7 +431,7 @@ declare const Result$2 = {
431
431
  // - https://onnxruntime.ai/docs/tutorials/web/large-models.html#maximum-size-of-arraybuffer
432
432
  declare const MAX_LENGTH$1 = 2145386496;
433
433
 
434
- declare function safeAllocUint8Array(length: number) {
434
+ declare function safeAllocUint8Array(length: number): Uint8Array {
435
435
  if (length > MAX_LENGTH) {
436
436
  // biome-ignore lint/suspicious/noConsole: can't have a dependency on logger here
437
437
  console.warn(`Trying to allocate ${length} bytes, which is greater than the maximum of ${MAX_LENGTH}.`);
@@ -2435,10 +2435,10 @@ type ClassConstructor<T> = {
2435
2435
  type Codec<T> = Encode<T> & Decode<T>;
2436
2436
 
2437
2437
  /** A codec descriptor with extra view. */
2438
- type CodecWithView<T, V> = Codec<T> & {
2438
+ interface CodecWithView<T, V> extends Codec<T> {
2439
2439
  /** encoded data view codec. */
2440
2440
  View: Codec<V>;
2441
- };
2441
+ }
2442
2442
 
2443
2443
  /**
2444
2444
  * Type descriptor definition.
@@ -7911,7 +7911,7 @@ declare function parseBootnode(v: string): Bootnode {
7911
7911
  throw new Error(`Invalid bootnode format, expected: <name>@<ip>:<port>, got: "${v}"`);
7912
7912
  }
7913
7913
 
7914
- const portNumber = Number.parseInt(port);
7914
+ const portNumber = Number.parseInt(port, 10);
7915
7915
  if (!isU16(portNumber)) {
7916
7916
  throw new Error(`Invalid port number: "${port}"`);
7917
7917
  }
@@ -8695,7 +8695,6 @@ declare class LeafNode {
8695
8695
  /**
8696
8696
  * Get the byte length of embedded value.
8697
8697
  *
8698
- * @remark
8699
8698
  * Note in case this node only contains hash this is going to be 0.
8700
8699
  */
8701
8700
  getValueLength(): number {
@@ -8707,7 +8706,6 @@ declare class LeafNode {
8707
8706
  /**
8708
8707
  * Returns the embedded value.
8709
8708
  *
8710
- * @remark
8711
8709
  * Note that this is going to be empty for a regular leaf node (i.e. containing a hash).
8712
8710
  */
8713
8711
  getValue(): BytesBlob {
@@ -8718,7 +8716,6 @@ declare class LeafNode {
8718
8716
  /**
8719
8717
  * Returns contained value hash.
8720
8718
  *
8721
- * @remark
8722
8719
  * Note that for embedded value this is going to be full 0-padded 32 bytes.
8723
8720
  */
8724
8721
  getValueHash(): ValueHash {
@@ -20539,7 +20536,6 @@ declare namespace index$1 {
20539
20536
  /** Helper function to create most used hashes in the block */
20540
20537
  declare class TransitionHasher implements MmrHasher<KeccakHash> {
20541
20538
  constructor(
20542
- private readonly context: ChainSpec,
20543
20539
  private readonly keccakHasher: KeccakHasher,
20544
20540
  public readonly blake2b: Blake2b,
20545
20541
  ) {}
package/index.js CHANGED
@@ -75,8 +75,8 @@ class Compatibility {
75
75
  /**
76
76
  * Allows selecting different values for different Gray Paper versions from one record.
77
77
  *
78
- * @param fallback The default value to return if no value is found for the current.
79
- * @param record A record mapping versions to values, checking if the version is greater or equal to the current version.
78
+ * fallback The default value to return if no value is found for the current.
79
+ * versions A record mapping versions to values, checking if the version is greater or equal to the current version.
80
80
  * @returns The value for the current version, or the default value.
81
81
  */
82
82
  static selectIfGreaterOrEqual({ fallback, versions, }) {
@@ -236,7 +236,7 @@ const workspacePathFix = env.NODE_ENV === "development"
236
236
  : () => (p) => p;
237
237
 
238
238
  /**
239
- * @fileoverview `Opaque<Type, Token>` constructs a unique type which is a subset of Type with a
239
+ * `Opaque<Type, Token>` constructs a unique type which is a subset of Type with a
240
240
  * specified unique token Token. It means that base type cannot be assigned to unique type by accident.
241
241
  * Good examples of opaque types include:
242
242
  * - JWTs or other tokens - these are special kinds of string used for authorization purposes.
@@ -6709,6 +6709,8 @@ var index$m = /*#__PURE__*/Object.freeze({
6709
6709
  SEGMENT_BYTES: SEGMENT_BYTES,
6710
6710
  TicketsMarker: TicketsMarker,
6711
6711
  ValidatorKeys: ValidatorKeys,
6712
+ W_E: W_E,
6713
+ W_S: W_S,
6712
6714
  assurances: assurances,
6713
6715
  codecPerEpochBlock: codecPerEpochBlock,
6714
6716
  codecPerValidator: codecPerValidator,
@@ -7097,12 +7099,12 @@ const workRefineLoadFromJson = json.object({
7097
7099
  extrinsic_count: "number",
7098
7100
  extrinsic_size: "number",
7099
7101
  exports: "number",
7100
- }, ({ gas_used, imports, extrinsic_count, extrinsic_size, exports }) => WorkRefineLoad.create({
7102
+ }, ({ gas_used, imports, extrinsic_count, extrinsic_size, exports: exports$1 }) => WorkRefineLoad.create({
7101
7103
  gasUsed: tryAsServiceGas(gas_used),
7102
7104
  importedSegments: tryAsU32(imports),
7103
7105
  extrinsicCount: tryAsU32(extrinsic_count),
7104
7106
  extrinsicSize: tryAsU32(extrinsic_size),
7105
- exportedSegments: tryAsU32(exports),
7107
+ exportedSegments: tryAsU32(exports$1),
7106
7108
  }));
7107
7109
  const workResultFromJson = json.object({
7108
7110
  service_id: "number",
@@ -7264,7 +7266,7 @@ function parseBootnode(v) {
7264
7266
  if (name === "" || ip === "" || port === "") {
7265
7267
  throw new Error(`Invalid bootnode format, expected: <name>@<ip>:<port>, got: "${v}"`);
7266
7268
  }
7267
- const portNumber = Number.parseInt(port);
7269
+ const portNumber = Number.parseInt(port, 10);
7268
7270
  if (!isU16(portNumber)) {
7269
7271
  throw new Error(`Invalid port number: "${port}"`);
7270
7272
  }
@@ -8869,7 +8871,7 @@ class CoreStatistics {
8869
8871
  /** `i` */
8870
8872
  imports,
8871
8873
  /** `e` */
8872
- exports,
8874
+ exports$1,
8873
8875
  /** `z` */
8874
8876
  extrinsicSize,
8875
8877
  /** `x` */
@@ -8881,7 +8883,7 @@ class CoreStatistics {
8881
8883
  this.dataAvailabilityLoad = dataAvailabilityLoad;
8882
8884
  this.popularity = popularity;
8883
8885
  this.imports = imports;
8884
- this.exports = exports;
8886
+ this.exports = exports$1;
8885
8887
  this.extrinsicSize = extrinsicSize;
8886
8888
  this.extrinsicCount = extrinsicCount;
8887
8889
  this.bundleSize = bundleSize;
@@ -8974,7 +8976,7 @@ class ServiceStatistics {
8974
8976
  /** `i` */
8975
8977
  imports,
8976
8978
  /** `e` */
8977
- exports,
8979
+ exports$1,
8978
8980
  /** `z` */
8979
8981
  extrinsicSize,
8980
8982
  /** `x` */
@@ -8992,7 +8994,7 @@ class ServiceStatistics {
8992
8994
  this.refinementCount = refinementCount;
8993
8995
  this.refinementGasUsed = refinementGasUsed;
8994
8996
  this.imports = imports;
8995
- this.exports = exports;
8997
+ this.exports = exports$1;
8996
8998
  this.extrinsicSize = extrinsicSize;
8997
8999
  this.extrinsicCount = extrinsicCount;
8998
9000
  this.accumulateCount = accumulateCount;
@@ -10373,7 +10375,6 @@ class LeafNode {
10373
10375
  /**
10374
10376
  * Get the byte length of embedded value.
10375
10377
  *
10376
- * @remark
10377
10378
  * Note in case this node only contains hash this is going to be 0.
10378
10379
  */
10379
10380
  getValueLength() {
@@ -10384,7 +10385,6 @@ class LeafNode {
10384
10385
  /**
10385
10386
  * Returns the embedded value.
10386
10387
  *
10387
- * @remark
10388
10388
  * Note that this is going to be empty for a regular leaf node (i.e. containing a hash).
10389
10389
  */
10390
10390
  getValue() {
@@ -10394,7 +10394,6 @@ class LeafNode {
10394
10394
  /**
10395
10395
  * Returns contained value hash.
10396
10396
  *
10397
- * @remark
10398
10397
  * Note that for embedded value this is going to be full 0-padded 32 bytes.
10399
10398
  */
10400
10399
  getValueHash() {
@@ -16834,18 +16833,18 @@ async function instantiate$1(module, imports = {}) {
16834
16833
  },
16835
16834
  }, Object.assign(Object.create(globalThis), imports.env || {})),
16836
16835
  };
16837
- const { exports } = await WebAssembly.instantiate(module, adaptedImports);
16838
- const memory = exports.memory || imports.env.memory;
16836
+ const { exports: exports$1 } = await WebAssembly.instantiate(module, adaptedImports);
16837
+ const memory = exports$1.memory || imports.env.memory;
16839
16838
  const adaptedExports = Object.setPrototypeOf({
16840
16839
  getAssembly(p) {
16841
16840
  // assembly/api-internal/getAssembly(assembly/program/Program) => ~lib/string/String
16842
16841
  p = __lowerInternref(p) || __notnull();
16843
- return __liftString(exports.getAssembly(p) >>> 0);
16842
+ return __liftString(exports$1.getAssembly(p) >>> 0);
16844
16843
  },
16845
16844
  wrapAsProgram(bytecode) {
16846
16845
  // assembly/program-build/wrapAsProgram(~lib/typedarray/Uint8Array) => ~lib/typedarray/Uint8Array
16847
16846
  bytecode = __lowerTypedArray(Uint8Array, 10, 0, bytecode) || __notnull();
16848
- return __liftTypedArray(Uint8Array, exports.wrapAsProgram(bytecode) >>> 0);
16847
+ return __liftTypedArray(Uint8Array, exports$1.wrapAsProgram(bytecode) >>> 0);
16849
16848
  },
16850
16849
  resetJAM(program, pc, initialGas, args, hasMetadata) {
16851
16850
  // assembly/api-debugger/resetJAM(~lib/array/Array<u8>, f64, i64, ~lib/array/Array<u8>, bool?) => void
@@ -16854,8 +16853,8 @@ async function instantiate$1(module, imports = {}) {
16854
16853
  args = __lowerArray(__setU8, 6, 0, args) || __notnull();
16855
16854
  hasMetadata = hasMetadata ? 1 : 0;
16856
16855
  try {
16857
- exports.__setArgumentsLength(arguments.length);
16858
- exports.resetJAM(program, pc, initialGas, args, hasMetadata);
16856
+ exports$1.__setArgumentsLength(arguments.length);
16857
+ exports$1.resetJAM(program, pc, initialGas, args, hasMetadata);
16859
16858
  } finally {
16860
16859
  __release(program);
16861
16860
  }
@@ -16867,8 +16866,8 @@ async function instantiate$1(module, imports = {}) {
16867
16866
  initialGas = initialGas || 0n;
16868
16867
  hasMetadata = hasMetadata ? 1 : 0;
16869
16868
  try {
16870
- exports.__setArgumentsLength(arguments.length);
16871
- exports.resetGeneric(program, flatRegisters, initialGas, hasMetadata);
16869
+ exports$1.__setArgumentsLength(arguments.length);
16870
+ exports$1.resetGeneric(program, flatRegisters, initialGas, hasMetadata);
16872
16871
  } finally {
16873
16872
  __release(program);
16874
16873
  }
@@ -16882,8 +16881,8 @@ async function instantiate$1(module, imports = {}) {
16882
16881
  initialGas = initialGas || 0n;
16883
16882
  hasMetadata = hasMetadata ? 1 : 0;
16884
16883
  try {
16885
- exports.__setArgumentsLength(arguments.length);
16886
- exports.resetGenericWithMemory(program, flatRegisters, pageMap, chunks, initialGas, hasMetadata);
16884
+ exports$1.__setArgumentsLength(arguments.length);
16885
+ exports$1.resetGenericWithMemory(program, flatRegisters, pageMap, chunks, initialGas, hasMetadata);
16887
16886
  } finally {
16888
16887
  __release(program);
16889
16888
  __release(flatRegisters);
@@ -16892,68 +16891,68 @@ async function instantiate$1(module, imports = {}) {
16892
16891
  },
16893
16892
  nextStep() {
16894
16893
  // assembly/api-debugger/nextStep() => bool
16895
- return exports.nextStep() != 0;
16894
+ return exports$1.nextStep() != 0;
16896
16895
  },
16897
16896
  nSteps(steps) {
16898
16897
  // assembly/api-debugger/nSteps(u32) => bool
16899
- return exports.nSteps(steps) != 0;
16898
+ return exports$1.nSteps(steps) != 0;
16900
16899
  },
16901
16900
  getProgramCounter() {
16902
16901
  // assembly/api-debugger/getProgramCounter() => u32
16903
- return exports.getProgramCounter() >>> 0;
16902
+ return exports$1.getProgramCounter() >>> 0;
16904
16903
  },
16905
16904
  getExitArg() {
16906
16905
  // assembly/api-debugger/getExitArg() => u32
16907
- return exports.getExitArg() >>> 0;
16906
+ return exports$1.getExitArg() >>> 0;
16908
16907
  },
16909
16908
  setGasLeft(gas) {
16910
16909
  // assembly/api-debugger/setGasLeft(i64) => void
16911
16910
  gas = gas || 0n;
16912
- exports.setGasLeft(gas);
16911
+ exports$1.setGasLeft(gas);
16913
16912
  },
16914
16913
  getRegisters() {
16915
16914
  // assembly/api-debugger/getRegisters() => ~lib/typedarray/Uint8Array
16916
- return __liftTypedArray(Uint8Array, exports.getRegisters() >>> 0);
16915
+ return __liftTypedArray(Uint8Array, exports$1.getRegisters() >>> 0);
16917
16916
  },
16918
16917
  setRegisters(flatRegisters) {
16919
16918
  // assembly/api-debugger/setRegisters(~lib/array/Array<u8>) => void
16920
16919
  flatRegisters = __lowerArray(__setU8, 6, 0, flatRegisters) || __notnull();
16921
- exports.setRegisters(flatRegisters);
16920
+ exports$1.setRegisters(flatRegisters);
16922
16921
  },
16923
16922
  getPageDump(index) {
16924
16923
  // assembly/api-debugger/getPageDump(u32) => ~lib/typedarray/Uint8Array
16925
- return __liftTypedArray(Uint8Array, exports.getPageDump(index) >>> 0);
16924
+ return __liftTypedArray(Uint8Array, exports$1.getPageDump(index) >>> 0);
16926
16925
  },
16927
16926
  getMemory(address, length) {
16928
16927
  // assembly/api-debugger/getMemory(u32, u32) => ~lib/typedarray/Uint8Array | null
16929
- return __liftTypedArray(Uint8Array, exports.getMemory(address, length) >>> 0);
16928
+ return __liftTypedArray(Uint8Array, exports$1.getMemory(address, length) >>> 0);
16930
16929
  },
16931
16930
  setMemory(address, data) {
16932
16931
  // assembly/api-debugger/setMemory(u32, ~lib/typedarray/Uint8Array) => bool
16933
16932
  data = __lowerTypedArray(Uint8Array, 10, 0, data) || __notnull();
16934
- return exports.setMemory(address, data) != 0;
16933
+ return exports$1.setMemory(address, data) != 0;
16935
16934
  },
16936
16935
  InputKind: (values => (
16937
16936
  // assembly/api-utils/InputKind
16938
- values[values.Generic = exports["InputKind.Generic"].valueOf()] = "Generic",
16939
- values[values.SPI = exports["InputKind.SPI"].valueOf()] = "SPI",
16937
+ values[values.Generic = exports$1["InputKind.Generic"].valueOf()] = "Generic",
16938
+ values[values.SPI = exports$1["InputKind.SPI"].valueOf()] = "SPI",
16940
16939
  values
16941
16940
  ))({}),
16942
16941
  HasMetadata: (values => (
16943
16942
  // assembly/api-utils/HasMetadata
16944
- values[values.Yes = exports["HasMetadata.Yes"].valueOf()] = "Yes",
16945
- values[values.No = exports["HasMetadata.No"].valueOf()] = "No",
16943
+ values[values.Yes = exports$1["HasMetadata.Yes"].valueOf()] = "Yes",
16944
+ values[values.No = exports$1["HasMetadata.No"].valueOf()] = "No",
16946
16945
  values
16947
16946
  ))({}),
16948
16947
  getGasCosts(input, kind, withMetadata) {
16949
16948
  // assembly/api-utils/getGasCosts(~lib/array/Array<u8>, i32, i32) => ~lib/array/Array<assembly/gas-costs/BlockGasCost>
16950
16949
  input = __lowerArray(__setU8, 6, 0, input) || __notnull();
16951
- return __liftArray(pointer => __liftRecord50(__getU32(pointer)), 2, exports.getGasCosts(input, kind, withMetadata) >>> 0);
16950
+ return __liftArray(pointer => __liftRecord50(__getU32(pointer)), 2, exports$1.getGasCosts(input, kind, withMetadata) >>> 0);
16952
16951
  },
16953
16952
  disassemble(input, kind, withMetadata) {
16954
16953
  // assembly/api-utils/disassemble(~lib/array/Array<u8>, i32, i32) => ~lib/string/String
16955
16954
  input = __lowerArray(__setU8, 6, 0, input) || __notnull();
16956
- return __liftString(exports.disassemble(input, kind, withMetadata) >>> 0);
16955
+ return __liftString(exports$1.disassemble(input, kind, withMetadata) >>> 0);
16957
16956
  },
16958
16957
  prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args) {
16959
16958
  // assembly/api-utils/prepareProgram(i32, i32, ~lib/array/Array<u8>, ~lib/array/Array<u64>, ~lib/array/Array<assembly/api-internal/InitialPage>, ~lib/array/Array<assembly/api-internal/InitialChunk>, ~lib/array/Array<u8>) => assembly/spi/StandardProgram
@@ -16963,7 +16962,7 @@ async function instantiate$1(module, imports = {}) {
16963
16962
  initialMemory = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerRecord48(value) || __notnull()); }, 49, 2, initialMemory) || __notnull());
16964
16963
  args = __lowerArray(__setU8, 6, 0, args) || __notnull();
16965
16964
  try {
16966
- return __liftInternref(exports.prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args) >>> 0);
16965
+ return __liftInternref(exports$1.prepareProgram(kind, hasMetadata, program, initialRegisters, initialPageMap, initialMemory, args) >>> 0);
16967
16966
  } finally {
16968
16967
  __release(program);
16969
16968
  __release(initialRegisters);
@@ -16977,10 +16976,10 @@ async function instantiate$1(module, imports = {}) {
16977
16976
  initialGas = initialGas || 0n;
16978
16977
  logs = logs ? 1 : 0;
16979
16978
  useSbrkGas = useSbrkGas ? 1 : 0;
16980
- exports.__setArgumentsLength(arguments.length);
16981
- return __liftRecord55(exports.runProgram(program, initialGas, programCounter, logs, useSbrkGas) >>> 0);
16979
+ exports$1.__setArgumentsLength(arguments.length);
16980
+ return __liftRecord55(exports$1.runProgram(program, initialGas, programCounter, logs, useSbrkGas) >>> 0);
16982
16981
  },
16983
- }, exports);
16982
+ }, exports$1);
16984
16983
  function __liftRecord50(pointer) {
16985
16984
  // assembly/gas-costs/BlockGasCost
16986
16985
  // Hint: Opt-out from lifting as a record by providing an empty constructor
@@ -16994,21 +16993,21 @@ async function instantiate$1(module, imports = {}) {
16994
16993
  // assembly/api-internal/InitialPage
16995
16994
  // Hint: Opt-out from lowering as a record by providing an empty constructor
16996
16995
  if (value == null) return 0;
16997
- const pointer = exports.__pin(exports.__new(12, 46));
16996
+ const pointer = exports$1.__pin(exports$1.__new(12, 46));
16998
16997
  __setU32(pointer + 0, value.address);
16999
16998
  __setU32(pointer + 4, value.length);
17000
16999
  __setU32(pointer + 8, value.access);
17001
- exports.__unpin(pointer);
17000
+ exports$1.__unpin(pointer);
17002
17001
  return pointer;
17003
17002
  }
17004
17003
  function __lowerRecord48(value) {
17005
17004
  // assembly/api-internal/InitialChunk
17006
17005
  // Hint: Opt-out from lowering as a record by providing an empty constructor
17007
17006
  if (value == null) return 0;
17008
- const pointer = exports.__pin(exports.__new(8, 48));
17007
+ const pointer = exports$1.__pin(exports$1.__new(8, 48));
17009
17008
  __setU32(pointer + 0, value.address);
17010
17009
  __setU32(pointer + 4, __lowerArray(__setU8, 6, 0, value.data) || __notnull());
17011
- exports.__unpin(pointer);
17010
+ exports$1.__unpin(pointer);
17012
17011
  return pointer;
17013
17012
  }
17014
17013
  function __liftRecord48(pointer) {
@@ -17057,15 +17056,15 @@ async function instantiate$1(module, imports = {}) {
17057
17056
  if (values == null) return 0;
17058
17057
  const
17059
17058
  length = values.length,
17060
- buffer = exports.__pin(exports.__new(length << align, 1)) >>> 0,
17061
- header = exports.__pin(exports.__new(16, id)) >>> 0;
17059
+ buffer = exports$1.__pin(exports$1.__new(length << align, 1)) >>> 0,
17060
+ header = exports$1.__pin(exports$1.__new(16, id)) >>> 0;
17062
17061
  __setU32(header + 0, buffer);
17063
17062
  __dataview.setUint32(header + 4, buffer, true);
17064
17063
  __dataview.setUint32(header + 8, length << align, true);
17065
17064
  __dataview.setUint32(header + 12, length, true);
17066
17065
  for (let i = 0; i < length; ++i) lowerElement(buffer + (i << align >>> 0), values[i]);
17067
- exports.__unpin(buffer);
17068
- exports.__unpin(header);
17066
+ exports$1.__unpin(buffer);
17067
+ exports$1.__unpin(header);
17069
17068
  return header;
17070
17069
  }
17071
17070
  function __liftTypedArray(constructor, pointer) {
@@ -17080,13 +17079,13 @@ async function instantiate$1(module, imports = {}) {
17080
17079
  if (values == null) return 0;
17081
17080
  const
17082
17081
  length = values.length,
17083
- buffer = exports.__pin(exports.__new(length << align, 1)) >>> 0,
17084
- header = exports.__new(12, id) >>> 0;
17082
+ buffer = exports$1.__pin(exports$1.__new(length << align, 1)) >>> 0,
17083
+ header = exports$1.__new(12, id) >>> 0;
17085
17084
  __setU32(header + 0, buffer);
17086
17085
  __dataview.setUint32(header + 4, buffer, true);
17087
17086
  __dataview.setUint32(header + 8, length << align, true);
17088
17087
  new constructor(memory.buffer, buffer, length).set(values);
17089
- exports.__unpin(buffer);
17088
+ exports$1.__unpin(buffer);
17090
17089
  return header;
17091
17090
  }
17092
17091
  class Internref extends Number {}
@@ -17107,14 +17106,14 @@ async function instantiate$1(module, imports = {}) {
17107
17106
  if (pointer) {
17108
17107
  const refcount = refcounts.get(pointer);
17109
17108
  if (refcount) refcounts.set(pointer, refcount + 1);
17110
- else refcounts.set(exports.__pin(pointer), 1);
17109
+ else refcounts.set(exports$1.__pin(pointer), 1);
17111
17110
  }
17112
17111
  return pointer;
17113
17112
  }
17114
17113
  function __release(pointer) {
17115
17114
  if (pointer) {
17116
17115
  const refcount = refcounts.get(pointer);
17117
- if (refcount === 1) exports.__unpin(pointer), refcounts.delete(pointer);
17116
+ if (refcount === 1) exports$1.__unpin(pointer), refcounts.delete(pointer);
17118
17117
  else if (refcount) refcounts.set(pointer, refcount - 1);
17119
17118
  else throw Error(`invalid refcount '${refcount}' for reference '${pointer}'`);
17120
17119
  }
@@ -18062,12 +18061,12 @@ class JsonCoreStatistics {
18062
18061
  extrinsic_count: "number",
18063
18062
  bundle_size: "number",
18064
18063
  gas_used: json.fromBigInt(tryAsServiceGas),
18065
- }, ({ da_load, popularity, imports, exports, extrinsic_size, extrinsic_count, bundle_size, gas_used }) => {
18064
+ }, ({ da_load, popularity, imports, exports: exports$1, extrinsic_size, extrinsic_count, bundle_size, gas_used }) => {
18066
18065
  return CoreStatistics.create({
18067
18066
  dataAvailabilityLoad: da_load,
18068
18067
  popularity,
18069
18068
  imports,
18070
- exports,
18069
+ exports: exports$1,
18071
18070
  extrinsicSize: extrinsic_size,
18072
18071
  extrinsicCount: extrinsic_count,
18073
18072
  bundleSize: bundle_size,
@@ -18101,14 +18100,14 @@ class JsonServiceStatistics {
18101
18100
  on_transfers_gas_used: json.fromBigInt(tryAsServiceGas),
18102
18101
  }
18103
18102
  : {}),
18104
- }, ({ provided_count, provided_size, refinement_count, refinement_gas_used, imports, exports, extrinsic_size, extrinsic_count, accumulate_count, accumulate_gas_used, on_transfers_count, on_transfers_gas_used, }) => {
18103
+ }, ({ provided_count, provided_size, refinement_count, refinement_gas_used, imports, exports: exports$1, extrinsic_size, extrinsic_count, accumulate_count, accumulate_gas_used, on_transfers_count, on_transfers_gas_used, }) => {
18105
18104
  return ServiceStatistics.create({
18106
18105
  providedCount: provided_count,
18107
18106
  providedSize: provided_size,
18108
18107
  refinementCount: refinement_count,
18109
18108
  refinementGasUsed: refinement_gas_used,
18110
18109
  imports,
18111
- exports,
18110
+ exports: exports$1,
18112
18111
  extrinsicSize: extrinsic_size,
18113
18112
  extrinsicCount: extrinsic_count,
18114
18113
  accumulateCount: accumulate_count,
@@ -18316,11 +18315,9 @@ var index$1 = /*#__PURE__*/Object.freeze({
18316
18315
 
18317
18316
  /** Helper function to create most used hashes in the block */
18318
18317
  class TransitionHasher {
18319
- context;
18320
18318
  keccakHasher;
18321
18319
  blake2b;
18322
- constructor(context, keccakHasher, blake2b) {
18323
- this.context = context;
18320
+ constructor(keccakHasher, blake2b) {
18324
18321
  this.keccakHasher = keccakHasher;
18325
18322
  this.blake2b = blake2b;
18326
18323
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typeberry/lib",
3
- "version": "0.3.1-27dfdd9",
3
+ "version": "0.4.0-1ad1b89",
4
4
  "main": "index.js",
5
5
  "author": "Fluffy Labs",
6
6
  "license": "MPL-2.0",