diff --git a/packages/account-wasm/pkg/account_wasm_bg.js b/packages/account-wasm/pkg/account_wasm_bg.js index e1feb6033..519eb8ee8 100644 --- a/packages/account-wasm/pkg/account_wasm_bg.js +++ b/packages/account-wasm/pkg/account_wasm_bg.js @@ -443,11 +443,6 @@ export function __wbindgen_object_drop_ref(arg0) { takeObject(arg0); }; -export function __wbindgen_string_new(arg0, arg1) { - const ret = getStringFromWasm0(arg0, arg1); - return addHeapObject(ret); -}; - export function __wbindgen_error_new(arg0, arg1) { const ret = new Error(getStringFromWasm0(arg0, arg1)); return addHeapObject(ret); @@ -482,16 +477,6 @@ export function __wbindgen_jsval_eq(arg0, arg1) { return ret; }; -export function __wbindgen_cb_drop(arg0) { - const obj = takeObject(arg0).original; - if (obj.cnt-- == 1) { - obj.a = 0; - return true; - } - const ret = false; - return ret; -}; - export function __wbindgen_boolean_get(arg0) { const v = getObject(arg0); const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2; @@ -526,6 +511,16 @@ export function __wbindgen_is_undefined(arg0) { return ret; }; +export function __wbindgen_cb_drop(arg0) { + const obj = takeObject(arg0).original; + if (obj.cnt-- == 1) { + obj.a = 0; + return true; + } + const ret = false; + return ret; +}; + export function __wbindgen_jsval_loose_eq(arg0, arg1) { const ret = getObject(arg0) == getObject(arg1); return ret; @@ -536,6 +531,11 @@ export function __wbindgen_number_new(arg0) { return addHeapObject(ret); }; +export function __wbindgen_string_new(arg0, arg1) { + const ret = getStringFromWasm0(arg0, arg1); + return addHeapObject(ret); +}; + export function __wbg_getwithrefkey_edc2c8960f0f1191(arg0, arg1) { const ret = getObject(arg0)[getObject(arg1)]; return addHeapObject(ret); @@ -1002,8 +1002,8 @@ export function __wbindgen_memory() { return addHeapObject(ret); }; -export function __wbindgen_closure_wrapper1521(arg0, arg1, arg2) { - const ret = makeMutClosure(arg0, arg1, 516, __wbg_adapter_48); +export function __wbindgen_closure_wrapper1519(arg0, arg1, arg2) { + const ret = makeMutClosure(arg0, arg1, 512, __wbg_adapter_48); return addHeapObject(ret); }; diff --git a/packages/account-wasm/pkg/account_wasm_bg.wasm b/packages/account-wasm/pkg/account_wasm_bg.wasm index 43c9da051..5c5398f73 100644 Binary files a/packages/account-wasm/pkg/account_wasm_bg.wasm and b/packages/account-wasm/pkg/account_wasm_bg.wasm differ diff --git a/packages/account-wasm/src/lib.rs b/packages/account-wasm/src/lib.rs index c3c99db8b..7cf114478 100644 --- a/packages/account-wasm/src/lib.rs +++ b/packages/account-wasm/src/lib.rs @@ -48,9 +48,8 @@ use types::invocation::JsInvocationsDetails; use types::outside_execution::JsOutsideExecution; use types::session::{JsCredentials, JsSession}; use url::Url; -use utils::{policies_match, set_panic_hook, calculate_contract_address}; +use utils::{policies_match, set_panic_hook}; use wasm_bindgen::prelude::*; -use web_sys::console; use crate::types::TryFromJsValue; @@ -62,8 +61,6 @@ pub struct CartridgeAccount { device_signer: DeviceSigner, username: String, rpc_url: Url, - rp_id: String, - origin: String, } #[wasm_bindgen] @@ -120,9 +117,7 @@ impl CartridgeAccount { account, device_signer, username, - rpc_url, - rp_id, - origin, + rpc_url }) } @@ -320,13 +315,6 @@ impl CartridgeAccount { constructor_calldata[0] = Felt::TWO; // incorrect signer enum from serialization constructor_calldata.push(Felt::ONE); // no guardian - let address = calculate_contract_address(starknetutils::cairo_short_string_to_felt(&self.username)?, Felt::from_str(ACCOUNT_CLASS_HASH)?, &constructor_calldata); - console::log_1(&format!("constructor {:#?}", constructor_calldata).into()); - console::log_1(&format!("deployment address: {:#x}", address).into()); - console::log_1(&format!("backend address: {:#x}", self.account.address()).into()); - console::log_1(&format!("rp_id: {}", self.rp_id).into()); - console::log_1(&format!("origin: {}", self.origin).into()); - let factory = CartridgeAccountFactory::new( Felt::from_str(ACCOUNT_CLASS_HASH)?, self.account.chain_id(), diff --git a/packages/account-wasm/src/utils.rs b/packages/account-wasm/src/utils.rs index 5fcf961f0..7dca12dac 100644 --- a/packages/account-wasm/src/utils.rs +++ b/packages/account-wasm/src/utils.rs @@ -1,27 +1,11 @@ use std::collections::HashMap; use starknet::accounts::Call; -use starknet::core::crypto::compute_hash_on_elements; -use starknet::core::types::{Felt, NonZeroFelt}; +use starknet::core::types::Felt; use starknet::core::utils::get_selector_from_name; use crate::types::policy::JsPolicy; -const PREFIX_CONTRACT_ADDRESS: Felt = Felt::from_raw([ - 533439743893157637, - 8635008616843941496, - 17289941567720117366, - 3829237882463328880, -]); - -const ADDR_BOUND: NonZeroFelt = NonZeroFelt::from_raw([ - 576459263475590224, - 18446744073709255680, - 160989183, - 18446743986131443745, -]); - - pub fn set_panic_hook() { // When the `console_error_panic_hook` feature is enabled, we can call the // `set_panic_hook` function at least once during initialization, and then @@ -47,15 +31,4 @@ pub fn policies_match(calls: &[Call], policies: &[JsPolicy]) -> bool { calls .iter() .all(|call| policy_map.contains_key(&call.selector)) -} - -pub fn calculate_contract_address(salt: Felt, class_hash: Felt, constructor_calldata: &[Felt]) -> Felt { - compute_hash_on_elements(&[ - PREFIX_CONTRACT_ADDRESS, - Felt::ZERO, - salt, - class_hash, - compute_hash_on_elements(constructor_calldata), - ]) - .mod_floor(&ADDR_BOUND) } \ No newline at end of file diff --git a/packages/keychain/src/components/connect/Login.tsx b/packages/keychain/src/components/connect/Login.tsx index abb42a2e1..081bf0511 100644 --- a/packages/keychain/src/components/connect/Login.tsx +++ b/packages/keychain/src/components/connect/Login.tsx @@ -131,6 +131,7 @@ export function Login({ }} autoFocus placeholder="Username" + textTransform="lowercase" touched={meta.touched} error={meta.error} isLoading={props.isValidating} diff --git a/packages/keychain/src/components/connect/Signup.tsx b/packages/keychain/src/components/connect/Signup.tsx index 7667f61c8..a6e815794 100644 --- a/packages/keychain/src/components/connect/Signup.tsx +++ b/packages/keychain/src/components/connect/Signup.tsx @@ -168,6 +168,7 @@ function Form({ isSlot, onLogin, onSuccess }: SignupProps) { {...field} autoFocus placeholder="Username" + textTransform="lowercase" touched={meta.touched} error={meta.error || errors?.username} onChange={(e) => {