Skip to content

Commit

Permalink
review deps, add todo for WC ctx initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
borngraced committed Dec 8, 2024
1 parent b96881e commit 738f941
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 93 deletions.
130 changes: 47 additions & 83 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions mm2src/coins/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion mm2src/coins/eth/eth_withdraw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 1 addition & 2 deletions mm2src/coins/eth/wallet_connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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.)
Expand Down
Loading

0 comments on commit 738f941

Please sign in to comment.