Skip to content

Problems to use RPCSPEC06 and RPCSPEC07 namespaces #1137

@PhilippeR26

Description

@PhilippeR26

Describe the bug
2 problems encountered :

1. No Vscode help in RPC spacename

Reading the Starknet.js code, I understand that the paths to use
the enums located in src/types/api/rpcspec_0_6/nonspec.ts or in spec 07 are :

import {  types,  RPC } from "starknet";
const lastBlockTag=types.RPC.RPCSPEC06.EBlockTag.LATEST;
const lastBlockTag2=RPC.RPCSPEC06.EBlockTag.LATEST;
const lastBlockTag3=types.RPC.RPCSPEC07.EBlockTag.LATEST;
const lastBlockTag4=RPC.RPCSPEC07.EBlockTag.LATEST;
const lastBlockTag5=types.RPC.EBlockTag.LATEST;
const lastBlockTag6=RPC.EBlockTag.LATEST;

Long and complicated path.... but it works.
After typing types., vsCode is helping to reach RPC :
image
But after selecting RPC, there is no more help from vsCode :
image
There it becomes complicated. Only digging in a very nested source code can help you.

2. use of RPC types

If you add to the previous code :

const callOpt:types.RPC.RPCSPEC06.SPEC.SIERRA_ENTRY_POINT={selector: "0x123",function_idx:2};

The compilation fails :

TSError: ⨯ Unable to compile TypeScript:
src/tmp/26.testSepolia.ts:38:25 - error TS2694: Namespace 'index$2' has no exported member 'RPC'.

38     const callOpt:types.RPC.RPCSPEC06.SPEC.SIERRA_ENTRY_POINT={selector: "0x123",function_idx:2};
                           ~~~

So, how to use these types?

To Reproduce
See above

Expected behavior
Good user experience to use RPC enums.
Have a way to use types of RPC.

Screenshots
See above.

Desktop (please complete the following information):

  • Browser & version [e.g. chrome, safari, webworker] : any
  • Node version [e.g. 16.0.1] ts-node": "^10.9.2
  • Starknet.js version : v6.9.0
  • Network [devnet, testnet] : any

Additional context

Warning

Currently not open to contributors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions