Skip to content

issue in litesvm, when calling setSlotHashes #178

@pradyuman-verma

Description

@pradyuman-verma
import { FailedTransactionMetadata, LiteSVM } from "litesvm";

export class BaseSetup {
  client = new LiteSVM();

  setupSystemVars() {
    // prettier-ignore
    const newClock = new Clock(BigInt(1000), BigInt(1), BigInt(100), BigInt(3), BigInt(Math.floor(Date.now() / 1000)));
    this.client.setClock(newClock);
    this.client.withBuiltins();
    this.client.withSplPrograms();
    this.client.withTransactionHistory(BigInt(50));

    this.client.setSlotHashes([
      {
        slot: BigInt(1000),
        hash: "G4caYtkdHZW5aPWokD6r1E3pnAxJmvXBsw3JtQFkMY8z",
      },
    ]);
  }
}

When trying to run setupSystemVars getting following error:

    Failed to recover `SlotHash` type from napi value
      157 |     this.client.withTransactionHistory(BigInt(50));
      158 |
    > 159 |     this.client.setSlotHashes([
          |                 ^
      160 |       {
      161 |         slot: BigInt(1000),
      162 |         hash: "G4caYtkdHZW5aPWokD6r1E3pnAxJmvXBsw3JtQFkMY8z",

      at LiteSVM.setSlotHashes (node_modules/litesvm/litesvm/index.ts:457:14)
      at LiquidityBaseSetup.setupSystemVars (tests/baseTests.ts:159:17)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions