-
Notifications
You must be signed in to change notification settings - Fork 248
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
Add starknet_addDeclareTransaction
JSON-RPC endpoint
#318
Conversation
This is internal-use-only, mainly so that we can test with the integration environment while developing.
/// The hash of a StarkNet class. | ||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Deserialize, Serialize, PartialOrd, Ord)] | ||
pub struct ClassHash(pub StarkHash); | ||
|
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.
I think this is the same as ContractHash
? We should consider renaming things to be align with the new class concepts.
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.
I don't think it's the same (conceptually).
According to the documentation the contract hash contains the constructor arguments, which classes won't have.
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.
constructor arguments
Where do you see this? Entry point is not an argument.
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.
Hmm, you're right, I probably misread that... So should we call this a ContractHash or a ClassHash (which seems to be a name Starkware uses both in the documentation and in the OpenRPC specs)?
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.
They seem to have just renamed contract hash to class hash...
The contract_hash cairo function has been renamed to class_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.
This PR is already 10 files so I'd go with type alias or something, with a todo to rename all...?
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.
Yeah, renaming ContractHash
will be an extensive change, I can do that in a new PR.
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.
Would be nice to have an example added too
I've added an example. (Note that it's not working yet since the testnet sequencer doesn't support declare transactions at the moment.) |
This JSON-RPC endpoint is a proxy that forwards data received to the Starknet sequencer, just like other write API methods we have.
This PR also adds some missing fields to the
sequencer::reply::transaction::Transaction
type that are required so that we can parse the new DECLARE transaction JSON.