-
Notifications
You must be signed in to change notification settings - Fork 758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: add example to provider.ts in utils #1114
Conversation
# [6.8.0](starknet-io/starknet.js@v6.7.0...v6.8.0) (2024-04-23) ### Bug Fixes * starkne types 0.7 ([starknet-io#1087](starknet-io#1087)) ([b038c76](starknet-io@b038c76)) * tslib ([starknet-io#1068](starknet-io#1068)) ([dd7dc10](starknet-io@dd7dc10)) * **utils:** fix block identifier ([starknet-io#1076](starknet-io#1076)) ([0a3499d](starknet-io@0a3499d)) ### Features * add getGasPrice rpc provider method ([starknet-io#1056](starknet-io#1056)) ([d396275](starknet-io@d396275)) * Export function parseCalldataField() ([4d59658](starknet-io@4d59658)) * rpc 0.7.1 ([starknet-io#1071](starknet-io#1071)) ([11dc600](starknet-io@11dc600))
also, please locally retarget to |
Done |
@vibenedict thanks for resolving conflicts, but my previous comment is not yet addressed, regarding adding missing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As explained in Telegram https://t.me/c/2066195975/59 ,
please follow very rigorously the template of this PR #1100, especially for the examples : result always in a result
variable, result displayed in a comment (//
);
@@ -51,6 +76,25 @@ export function createSierraContractClass(contract: CompiledSierra): SierraContr | |||
* Create Contract Class from a given CompiledContract or string | |||
* | |||
* (CompiledContract or string) -> ContractClass | |||
* | |||
* @param {CompiledContract | string} contract - Compiled contract or string | |||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing returns
@@ -37,6 +43,25 @@ export function wait(delay: number) { | |||
* Create Sierra Contract Class from a given Compiled Sierra | |||
* | |||
* CompiledSierra -> SierraContractClass | |||
* | |||
* @param {CompiledSierra} contract - Compiled sierra code | |||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing returns
@@ -26,6 +26,12 @@ import type { GetTransactionReceiptResponse } from './transactionReceipt'; | |||
|
|||
/** | |||
* Helper - Async Sleep for 'delay' time | |||
* | |||
* @param {number} delay - Number of milliseconds to delay. | |||
* @example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing returns
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some work remains.
@@ -34,7 +34,15 @@ export function computePoseidonHash(a: BigNumberish, b: BigNumberish): string { | |||
|
|||
/** | |||
* Compute pedersen hash from data | |||
* | |||
* @param {BigNumberish[]} data - Data to compute hash on | |||
* @returns format: hex-string - pedersen hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As explained here : https://jsdoc.app/tags-returns
The return format has to be wrapped in {}. Here it was not made properly.
A correct typing is :
@returns {string} Hex string
To be verified everywhere.
* | ||
* @example | ||
* ```typescript | ||
* const result = computeHashOnElements(['0xabc', '0x123', '0xabc123']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the functions of this file are accessible only in the hash
namespace.
You have to add hash.
before each function.
@@ -89,6 +107,11 @@ function nullSkipReplacer(key: string, value: any) { | |||
* Format json-string to conform starknet json-string | |||
* @param json json-string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to verify also that parameters types are wrapped in {}.
Here :
@param {string} json
* @example | ||
* ```typescript | ||
* const result = formatSpaces("{'onchain': true, 'isStarknet': true}") | ||
* // result = {'onchain': true, 'isStarknet': true} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we can think that the result is an object.
To avoid this error, wrap the result in " "
@@ -89,6 +107,11 @@ function nullSkipReplacer(key: string, value: any) { | |||
* Format json-string to conform starknet json-string | |||
* @param json json-string | |||
* @returns format: json-string | |||
* @example | |||
* ```typescript | |||
* const result = formatSpaces("{'onchain': true, 'isStarknet': true}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this project we like to add a ;
at the end of TS line of code.
To add everywhere.
* ```typescript | ||
* const result = formatSpaces("{'onchain': true, 'isStarknet': true}") | ||
* // result = {'onchain': true, 'isStarknet': true} | ||
* ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why other functions until the end haven't been modified?
* @param {number} delay - Number of milliseconds to delay. | ||
* @example | ||
* ```typescript | ||
* wait(1000) // 1000 milliseconds == 1 second |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an async function.
You have to add the await
prefix.
All the functions of this file are in the provider
space. To correct.
"0x65", | ||
"0x52616e6765436865636b",...}) | ||
* // result = {sierra_program: 'H4sIAAAAAAAAA6x9WZbsrI7uVGqd53qgb8ZynwzYY7jDv5JAAmxHZuQ+96yq/L0jIzEINZ8axP/5j/q/+j//+z/wH9f/o/p/zPbh+Iot49+u9v8G3//rTdDhDDF4Z0MKPthQ+m+S2v6n1S//638VvdXW2PQ6RvxuDG+jiybCXKJ7Hef6ZRi9E+Q89WmKLilfqbrsL6PUCf8...} | ||
* ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last function hasn't been made.
"0x65", | ||
"0x52616e6765436865636b",...}) | ||
* // result = {sierra_program: 'H4sIAAAAAAAAA6x9WZbsrI7uVGqd53qgb8ZynwzYY7jDv5JAAmxHZuQ+96yq/L0jIzEINZ8axP/5j/q/+j//+z/wH9f/o/p/zPbh+Iot49+u9v8G3//rTdDhDDF4Z0MKPthQ+m+S2v6n1S//638VvdXW2PQ6RvxuDG+jiybCXKJ7Hef6ZRi9E+Q89WmKLilfqbrsL6PUCf8...} | ||
* ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createSierraContractClass
and parseContract
are performing the opposite action of the other, but you have the same example and result for both cases.
You should re-test these examples ; you will quickly find your error.
Motivation and Resolution
Closes #1090
...
RPC version (if applicable)
...
Usage related changes
Development related changes
Checklist: