diff --git a/Cargo.lock b/Cargo.lock index e3024c1f5c..8feec02a4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -295,7 +295,7 @@ checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" dependencies = [ "async-trait", "axum-core", - "bitflags 1.3.2", + "bitflags", "bytes 1.4.0", "futures-util", "http 0.2.12", @@ -507,12 +507,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "bitflags" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - [[package]] name = "bitvec" version = "0.18.5" @@ -807,7 +801,7 @@ version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] @@ -3182,7 +3176,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" dependencies = [ "arrayvec 0.5.1", - "bitflags 1.3.2", + "bitflags", "cfg-if 1.0.0", "ryu", "static_assertions", @@ -4512,7 +4506,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9ea4302b9759a7a88242299225ea3688e63c85ea136371bb6cf94fd674efaab" dependencies = [ "anyhow", - "bitflags 1.3.2", + "bitflags", "byteorder", "libc", "netlink-packet-core", @@ -4574,7 +4568,7 @@ version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ - "bitflags 1.3.2", + "bitflags", "cfg-if 1.0.0", "libc", ] @@ -4804,7 +4798,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" dependencies = [ "lock_api", - "parking_lot_core 0.9.10", + "parking_lot_core 0.9.1", ] [[package]] @@ -4824,15 +4818,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.10" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +checksum = "28141e0cc4143da2443301914478dc976a61ffdb3f043058310c70df2fed8954" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.5.6", + "redox_syscall 0.2.10", "smallvec 1.6.1", - "windows-targets 0.52.6", + "windows-sys 0.32.0", ] [[package]] @@ -4965,7 +4959,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ "autocfg 1.1.0", - "bitflags 1.3.2", + "bitflags", "cfg-if 1.0.0", "concurrent-queue 2.2.0", "libc", @@ -5477,7 +5471,7 @@ version = "10.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c49596760fce12ca21550ac21dc5a9617b2ea4b6e0aa7d8dab8ff2824fc2bba" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] @@ -5513,16 +5507,7 @@ version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_syscall" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "355ae415ccd3a04315d3f8246e86d67689ea74d88d915576e1589a351062a13b" -dependencies = [ - "bitflags 2.6.0", + "bitflags", ] [[package]] @@ -5840,7 +5825,7 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01e213bc3ecb39ac32e81e51ebe31fd888a940515173e3a18a35f8c6e896422a" dependencies = [ - "bitflags 1.3.2", + "bitflags", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -5909,7 +5894,7 @@ version = "0.36.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc" dependencies = [ - "bitflags 1.3.2", + "bitflags", "errno 0.2.8", "io-lifetimes", "libc", @@ -5923,7 +5908,7 @@ version = "0.37.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2aae838e49b3d63e9274e1c01833cc8139d3fec468c3b84688c628f44b1ae11d" dependencies = [ - "bitflags 1.3.2", + "bitflags", "errno 0.3.1", "io-lifetimes", "libc", @@ -6178,7 +6163,7 @@ version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ - "bitflags 1.3.2", + "bitflags", "core-foundation", "core-foundation-sys", "libc", @@ -6652,7 +6637,7 @@ version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77963e2aa8fadb589118c3aede2e78b6c4bcf1c01d588fbf33e915b390825fbd" dependencies = [ - "bitflags 1.3.2", + "bitflags", "byteorder", "hash-db", "hash256-std-hasher", @@ -6956,7 +6941,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ - "bitflags 1.3.2", + "bitflags", "core-foundation", "system-configuration-sys", ] @@ -8126,6 +8111,19 @@ dependencies = [ "windows_x86_64_msvc 0.34.0", ] +[[package]] +name = "windows-sys" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3df6e476185f92a12c072be4a189a0210dcdcf512a1891d6dff9edb874deadc6" +dependencies = [ + "windows_aarch64_msvc 0.32.0", + "windows_i686_gnu 0.32.0", + "windows_i686_msvc 0.32.0", + "windows_x86_64_gnu 0.32.0", + "windows_x86_64_msvc 0.32.0", +] + [[package]] name = "windows-sys" version = "0.42.0" @@ -8189,22 +8187,6 @@ dependencies = [ "windows_x86_64_msvc 0.48.0", ] -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - [[package]] name = "windows_aarch64_gnullvm" version = "0.42.1" @@ -8218,10 +8200,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" [[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" +name = "windows_aarch64_msvc" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5" [[package]] name = "windows_aarch64_msvc" @@ -8242,10 +8224,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" [[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" +name = "windows_i686_gnu" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615" [[package]] name = "windows_i686_gnu" @@ -8266,16 +8248,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" [[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" +name = "windows_i686_msvc" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172" [[package]] name = "windows_i686_msvc" @@ -8296,10 +8272,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" [[package]] -name = "windows_i686_msvc" -version = "0.52.6" +name = "windows_x86_64_gnu" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc" [[package]] name = "windows_x86_64_gnu" @@ -8319,12 +8295,6 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - [[package]] name = "windows_x86_64_gnullvm" version = "0.42.1" @@ -8338,10 +8308,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" [[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" +name = "windows_x86_64_msvc" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316" [[package]] name = "windows_x86_64_msvc" @@ -8361,12 +8331,6 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - [[package]] name = "winnow" version = "0.6.20" diff --git a/mm2src/coins/eth.rs b/mm2src/coins/eth.rs index dee2f28340..f21ccd1e18 100644 --- a/mm2src/coins/eth.rs +++ b/mm2src/coins/eth.rs @@ -2916,7 +2916,8 @@ async fn sign_raw_eth_tx(coin: &EthCoin, args: &SignEthTransactionParams) -> Raw // e.g Metamask let wc = { let ctx = MmArc::from_weak(&coin.ctx).expect("No context"); - WalletConnectCtx::from_ctx(&ctx).expect("WalletConnectCtx should be initialized by now!") + WalletConnectCtx::from_ctx(&ctx) + .expect("TODO: handle error when enable kdf initialization without key.") }; let my_address = coin .derivation_method @@ -3913,7 +3914,8 @@ impl EthCoin { EthPrivKeyPolicy::WalletConnect { .. } => { let wc = { let ctx = MmArc::from_weak(&coin.ctx).expect("No context"); - WalletConnectCtx::from_ctx(&ctx).expect("WalletConnectCtx should be initialized by now!") + WalletConnectCtx::from_ctx(&ctx) + .expect("TODO: handle error when enable kdf initialization without key.") }; let address = coin .derivation_method diff --git a/mm2src/coins/eth/eth_withdraw.rs b/mm2src/coins/eth/eth_withdraw.rs index 30676758aa..b53b2685b8 100644 --- a/mm2src/coins/eth/eth_withdraw.rs +++ b/mm2src/coins/eth/eth_withdraw.rs @@ -302,7 +302,9 @@ where }, EthPrivKeyPolicy::WalletConnect { .. } => { let ctx = MmArc::from_weak(&coin.ctx).expect("No context"); - let wc = WalletConnectCtx::from_ctx(&ctx).expect("WalletConnectCtx should be initialized by now!"); + + let wc = WalletConnectCtx::from_ctx(&ctx) + .expect("TODO: handle error when enable kdf initialization without key."); let gas_price = pay_for_gas_option.get_gas_price(); let (nonce, _) = coin .clone() diff --git a/mm2src/coins/eth/wallet_connect.rs b/mm2src/coins/eth/wallet_connect.rs index e494192942..f3acc4d66c 100644 --- a/mm2src/coins/eth/wallet_connect.rs +++ b/mm2src/coins/eth/wallet_connect.rs @@ -59,7 +59,7 @@ impl<'a> WcEthTxParams<'a> { let mut tx_json = json!({ "nonce": u256_to_hex(self.nonce), - "from": self.my_address.to_string(), + "from": format!("{:x}", self.my_address), "gas": u256_to_hex(self.gas), "value": u256_to_hex(self.value), "data": format!("0x{}", hex::encode(self.data)) @@ -134,7 +134,6 @@ impl WalletConnectOps for EthCoin { .await? }; - println!("TX_JSON: {tx_hash:?}"); let tx_hash = tx_hash.strip_prefix("0x").unwrap_or(&tx_hash); let maybe_signed_tx = { self.wait_for_tx_appears_on_rpc(H256::from_slice(&hex::decode(tx_hash)?), WAIT_RPC_TIMEOUT_SECS, 1.) diff --git a/mm2src/coins/lp_coins.rs b/mm2src/coins/lp_coins.rs index 5560327c27..623b5a09b7 100644 --- a/mm2src/coins/lp_coins.rs +++ b/mm2src/coins/lp_coins.rs @@ -3870,7 +3870,7 @@ impl PrivKeyActivationPolicy { /// a hardware device like Trezor, or even external sources like Metamask. #[derive(Clone, Debug)] pub enum PrivKeyPolicy { - /// The legacy private key policy. + /// Legacy private key policy. /// /// This policy corresponds to a one-to-one mapping of private keys to addresses. /// In this scheme, only a single key and corresponding address is activated per coin, @@ -3898,13 +3898,19 @@ pub enum PrivKeyPolicy { /// Details about how the keys are managed with the Trezor device /// are abstracted away and are not directly managed by this policy. Trezor, - /// The Metamask private key policy, specific to the WASM target architecture. + /// Metamask private key policy, specific to the WASM target architecture. /// /// This variant encapsulates details about how keys are managed when interfacing /// with the Metamask extension, especially within web-based contexts. #[cfg(target_arch = "wasm32")] Metamask(EthMetamaskPolicy), - + /// WalletConnect private key policy. + /// + /// This variant represents the key management details for connections + /// established via WalletConnect. It includes both compressed and uncompressed + /// public keys. + /// - `public_key`: Compressed public key, represented as [H264]. + /// - `public_key_uncompressed`: Uncompressed public key, represented as [H520]. WalletConnect { public_key: H264, public_key_uncompressed: H520, diff --git a/mm2src/coins_activation/src/eth_with_token_activation.rs b/mm2src/coins_activation/src/eth_with_token_activation.rs index d408b0f0e9..005d120a57 100644 --- a/mm2src/coins_activation/src/eth_with_token_activation.rs +++ b/mm2src/coins_activation/src/eth_with_token_activation.rs @@ -488,7 +488,8 @@ async fn eth_priv_key_build_policy( }, EthPrivKeyActivationPolicy::Trezor => Ok(EthPrivKeyBuildPolicy::Trezor), EthPrivKeyActivationPolicy::WalletConnect => { - let wc = WalletConnectCtx::from_ctx(ctx).expect("WalletConnectCtx should be initialized by now!"); + let wc = WalletConnectCtx::from_ctx(ctx) + .expect("TODO: handle error when enable kdf initialization without key."); let chain_id = conf["chain_id"].as_u64().ok_or(EthActivationV2Error::ChainIdNotSet)?; let (public_key_uncompressed, address) = eth_request_wc_personal_sign(&wc, chain_id) .await diff --git a/mm2src/coins_activation/src/tendermint_with_assets_activation.rs b/mm2src/coins_activation/src/tendermint_with_assets_activation.rs index 645e7dbcef..85a1366d28 100644 --- a/mm2src/coins_activation/src/tendermint_with_assets_activation.rs +++ b/mm2src/coins_activation/src/tendermint_with_assets_activation.rs @@ -234,7 +234,7 @@ async fn activate_with_walletconnect( chain_id: &str, ticker: &str, ) -> MmResult<(TendermintActivationPolicy, TendermintWalletConnectionType), TendermintInitError> { - let wc = WalletConnectCtx::from_ctx(ctx).expect("WalletConnectCtx should be initialized by now!"); + let wc = WalletConnectCtx::from_ctx(ctx).expect("TODO: handle error when enable kdf initialization without key."); let account = cosmos_get_accounts_impl(&wc, chain_id) .await .mm_err(|err| TendermintInitError {