starknet.js
starknet.js copied to clipboard
Problems to use RPCSPEC06 and RPCSPEC07 namespaces
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 :
But after selecting
RPC, there is no more help from vsCode :
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.
@PhilippeR26 let me hop on this
@EjembiEmmanuel Feel free to jump onto this one if you can figure it out.
'index$2' do contain RPC on final build so I am not sure what is the issue here. The only workaround until we figure it out is to use starknet-types directly
import { SPEC } from 'starknet-types';
async function main() {
const a: SPEC.SIERRA_ENTRY_POINT = { selector: '0x123', function_idx: 2 };
:tada: This issue has been resolved in version 6.10.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version 7.0.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket: