diff --git a/examples/deploy_argent_account.rs b/examples/deploy_argent_account.rs index e56ac833..140dcc79 100644 --- a/examples/deploy_argent_account.rs +++ b/examples/deploy_argent_account.rs @@ -8,9 +8,8 @@ use starknet::{ #[tokio::main] async fn main() { - // Latest hashes as of 2023-01-21. For demo only. - let proxy_hash = felt!("0x025ec026985a3bf9d0cc1fe17326b245dfdc3ff89b8fde106542a3ea56c5a918"); - let impl_hash = felt!("0x033434ad846cdd5f23eb73ff09fe6fddd568284a0fb7d1be20ee482f044dabe2"); + // Latest hash as of 2023-09-15. For demo only. + let class_hash = felt!("0x01a736d6ed154502257f02b1ccdf4d9d1089f80811cd6acad48e6b6a9d1f2003"); // Anything you like here as salt let salt = felt!("12345678"); @@ -21,8 +20,7 @@ async fn main() { )); let factory = ArgentAccountFactory::new( - proxy_hash, - impl_hash, + class_hash, chain_id::TESTNET, FieldElement::ZERO, signer, diff --git a/examples/parse_jsonrpc_request.rs b/examples/parse_jsonrpc_request.rs index 760ef2ea..d325cf2c 100644 --- a/examples/parse_jsonrpc_request.rs +++ b/examples/parse_jsonrpc_request.rs @@ -2,12 +2,12 @@ use starknet_providers::jsonrpc::{JsonRpcRequest, JsonRpcRequestData}; fn main() { // Let's pretend this is the raw request body coming from HTTP - let raw_request = r###"{ + let raw_request = r#"{ "id": 1, "jsonrpc": "2.0", "method": "starknet_getBlockTransactionCount", "params": [{ "block_number": 200 }] -}"###; +}"#; // Your server framework should handle this for you. Here we deserialize manually to see what's // going on. diff --git a/starknet-accounts/src/factory/argent.rs b/starknet-accounts/src/factory/argent.rs index 667de9f1..acc73419 100644 --- a/starknet-accounts/src/factory/argent.rs +++ b/starknet-accounts/src/factory/argent.rs @@ -5,19 +5,10 @@ use starknet_core::types::FieldElement; use starknet_providers::Provider; use starknet_signers::Signer; -/// Selector for "initialize" -const SELECTOR_INITIALIZE: FieldElement = FieldElement::from_mont([ - 14382173896205878522, - 7380089477680411368, - 4404362358337226556, - 132905214994424316, -]); - pub struct ArgentAccountFactory { - proxy_class_hash: FieldElement, - impl_class_hash: FieldElement, + class_hash: FieldElement, chain_id: FieldElement, - signer_public_key: FieldElement, + owner_public_key: FieldElement, guardian_public_key: FieldElement, signer: S, provider: P, @@ -28,8 +19,7 @@ where S: Signer, { pub async fn new( - proxy_class_hash: FieldElement, - impl_class_hash: FieldElement, + class_hash: FieldElement, chain_id: FieldElement, guardian_public_key: FieldElement, signer: S, @@ -37,10 +27,9 @@ where ) -> Result { let signer_public_key = signer.get_public_key().await?; Ok(Self { - proxy_class_hash, - impl_class_hash, + class_hash, chain_id, - signer_public_key: signer_public_key.scalar(), + owner_public_key: signer_public_key.scalar(), guardian_public_key, signer, provider, @@ -59,17 +48,11 @@ where type SignError = S::SignError; fn class_hash(&self) -> FieldElement { - self.proxy_class_hash + self.class_hash } fn calldata(&self) -> Vec { - vec![ - self.impl_class_hash, - SELECTOR_INITIALIZE, - FieldElement::TWO, - self.signer_public_key, - self.guardian_public_key, - ] + vec![self.owner_public_key, self.guardian_public_key] } fn chain_id(&self) -> FieldElement {