starknet-io / starknet.js

JavaScript library for StarkNet
https://www.starknetjs.com
MIT License
1.22k stars 742 forks source link

Impossible to use computeHintedClassHash hash function #1135

Closed PhilippeR26 closed 3 months ago

PhilippeR26 commented 4 months ago

Describe the bug In utils/hash, the computeHintedClassHash() function is set a default export : https://github.com/starknet-io/starknet.js/blob/66a5c0341eccfef0dcdf1312c15627b7d4f6b675/src/utils/hash/classHash.ts#L115 As a Starknet.js library user, I am not able to import and use this function. Error message :

TSError: ⨯ Unable to compile TypeScript:
src/tmp/26.testSepolia.ts:33:25 - error TS2551: Property 'computeHintedClassHash' does not exist on type 'typeof index$1'. Did you mean 'computeCompiledClassHash'?

33     const result = hash.computeHintedClassHash()
                           ~~~~~~~~~~~~~~~~~~~~~~

To Reproduce In a ts-node script :

import { hash } from "starknet";
const result = hash.computeHintedClassHash();

Expected behavior To be able to use this function.

Screenshots N/A Desktop (please complete the following information):

Additional context

[!WARNING] Currently not open to contributors.

martinvibes commented 4 months ago

@PhilippeR26 can i hop on this?

PhilippeR26 commented 4 months ago

Not yet. I am creating today several issues, that have to be first discussed internally. The team will then decide if it will be solved internally or with contributors.

tabaktoni commented 4 months ago

FIx: Add into starknet.js/src/utils/hash/index.ts

export { default as computeHintedClassHash } from './classHash';

But I don't think we need to have default export anyway, so just remove default, run test if all ok resolved.