yeagerai / genlayer-js

MIT License
1 stars 1 forks source link

Problem in exported simulator chain #23

Closed AgustinRamiroDiaz closed 4 days ago

AgustinRamiroDiaz commented 5 days ago

I'm using version 0.3.3

I cannot use the import from the docs

import { simulator } from 'genlayer-js/chains';

I have to use

import { simulator } from "genlayer-js/src/chains/simulator";

which is not the expected import (as per the npm docs)

denishacquin commented 5 days ago

Just tried the import itself here with 0.3.3 and it seems to work fine.

Could you be having this problem however:


    client = createClient({
      chain: simulator, // !! This key is named 'network' in the docs, but it has to be 'chain'
      // account
    });
  }
AgustinRamiroDiaz commented 5 days ago

@denishacquin

az@canela ~/y/A/deploy-on-genlayer (main) [1]> npm list
deploy-on-genlayer@ /home/az/yeagerai/AYBABTU/deploy-on-genlayer
├── @types/node@22.9.0
├── genlayer-js@0.3.3
├── ts-node@10.9.2
└── typescript@5.6.3

az@canela ~/y/A/deploy-on-genlayer (main)> npm start

> start
> ts-node database.update.ts

/home/az/yeagerai/AYBABTU/deploy-on-genlayer/node_modules/ts-node/src/index.ts:859
    return new TSError(diagnosticText, diagnosticCodes, diagnostics);
           ^
TSError: ⨯ Unable to compile TypeScript:
database.update.ts:3:27 - error TS2307: Cannot find module 'genlayer-js/chains' or its corresponding type declarations.

3 import { simulator } from "genlayer-js/chains";
                            ~~~~~~~~~~~~~~~~~~~~
AgustinRamiroDiaz commented 5 days ago

now that I see it, maybe it's a problem with my tsconfig

AgustinRamiroDiaz commented 4 days ago

Sorry for the noise, it was actually a problem with my tsconfig.json

This is what has worked for me

// tsconfig.json
{
  "compilerOptions": {
    "module": "esnext",
    "moduleResolution": "bundler"
  }
}

plus using `tsx` to run the typescript script