@typeberry/lib 0.0.5-f91bac5 → 0.1.0-08a9db1

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 +24 -15
  2. package/index.d.ts +10 -5
  3. package/index.js +24 -15
  4. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -369,7 +369,7 @@ type Result$2<Ok, Error> = OkResult<Ok> | ErrorResult<Error>;
369
369
  /** An indication of two possible outcomes returned from a function. */
370
370
  declare const Result$2 = {
371
371
  /** Create new [`Result`] with `Ok` status. */
372
- ok: <Ok, Error>(ok: Ok): Result<Ok, Error> => {
372
+ ok: <Ok>(ok: Ok): OkResult<Ok> => {
373
373
  check(ok !== undefined, "`Ok` type cannot be undefined.");
374
374
  return {
375
375
  isOk: true,
@@ -379,7 +379,7 @@ declare const Result$2 = {
379
379
  },
380
380
 
381
381
  /** Create new [`Result`] with `Error` status. */
382
- error: <Ok, Error>(error: Error, details = ""): Result<Ok, Error> => {
382
+ error: <Error>(error: Error, details = ""): ErrorResult<Error> => {
383
383
  check(error !== undefined, "`Error` type cannot be undefined.");
384
384
  return {
385
385
  isOk: false,
@@ -3447,6 +3447,8 @@ type KeccakHash = Bytes<HASH_SIZE>;
3447
3447
  /** Truncated hash. */
3448
3448
  type TruncatedHash = Bytes<TRUNCATED_HASH_SIZE>;
3449
3449
 
3450
+ declare const ZERO_HASH = Bytes.zero(HASH_SIZE);
3451
+
3450
3452
  /**
3451
3453
  * Container for some object with a hash that is related to this object.
3452
3454
  *
@@ -3655,11 +3657,12 @@ type index$n_WithHash<THash extends OpaqueHash, TData> = WithHash<THash, TData>;
3655
3657
  declare const index$n_WithHash: typeof WithHash;
3656
3658
  type index$n_WithHashAndBytes<THash extends OpaqueHash, TData> = WithHashAndBytes<THash, TData>;
3657
3659
  declare const index$n_WithHashAndBytes: typeof WithHashAndBytes;
3660
+ declare const index$n_ZERO_HASH: typeof ZERO_HASH;
3658
3661
  declare const index$n_blake2b: typeof blake2b;
3659
3662
  declare const index$n_defaultAllocator: typeof defaultAllocator;
3660
3663
  declare const index$n_keccak: typeof keccak;
3661
3664
  declare namespace index$n {
3662
- export { index$n_PageAllocator as PageAllocator, index$n_SimpleAllocator as SimpleAllocator, index$n_WithHash as WithHash, index$n_WithHashAndBytes as WithHashAndBytes, index$n_blake2b as blake2b, index$n_defaultAllocator as defaultAllocator, index$n_keccak as keccak };
3665
+ export { index$n_PageAllocator as PageAllocator, index$n_SimpleAllocator as SimpleAllocator, index$n_WithHash as WithHash, index$n_WithHashAndBytes as WithHashAndBytes, index$n_ZERO_HASH as ZERO_HASH, index$n_blake2b as blake2b, index$n_defaultAllocator as defaultAllocator, index$n_keccak as keccak };
3663
3666
  export type { index$n_Blake2bHash as Blake2bHash, index$n_HASH_SIZE as HASH_SIZE, index$n_HashAllocator as HashAllocator, index$n_KeccakHash as KeccakHash, index$n_OpaqueHash as OpaqueHash, index$n_TRUNCATED_HASH_SIZE as TRUNCATED_HASH_SIZE, index$n_TruncatedHash as TruncatedHash };
3664
3667
  }
3665
3668
 
@@ -14443,6 +14446,8 @@ declare enum AccessType {
14443
14446
  WRITE = 1,
14444
14447
  }
14445
14448
 
14449
+ // const logger = Logger.new(import.meta.filename, "pvm:mem");
14450
+
14446
14451
  declare class Memory {
14447
14452
  static fromInitialMemory(initialMemoryState: InitialMemoryState) {
14448
14453
  return new Memory(
@@ -14479,7 +14484,7 @@ declare class Memory {
14479
14484
  return Result.ok(OK);
14480
14485
  }
14481
14486
 
14482
- logger.insane(`MEM[${address}] <- ${BytesBlob.blobFrom(bytes)}`);
14487
+ // logger.insane(`MEM[${address}] <- ${BytesBlob.blobFrom(bytes)}`);
14483
14488
  const pagesResult = this.getPages(address, bytes.length, AccessType.WRITE);
14484
14489
 
14485
14490
  if (pagesResult.isError) {
@@ -14568,7 +14573,7 @@ declare class Memory {
14568
14573
  bytesLeft -= bytesToRead;
14569
14574
  }
14570
14575
 
14571
- logger.insane(`MEM[${startAddress}] => ${BytesBlob.blobFrom(result)}`);
14576
+ // logger.insane(`MEM[${startAddress}] => ${BytesBlob.blobFrom(result)}`);
14572
14577
  return Result.ok(OK);
14573
14578
  }
14574
14579