Skip to content
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

refactor: review fixes and improvements #390

Merged

Conversation

evilrobot-01
Copy link
Contributor

@evilrobot-01 evilrobot-01 commented Dec 18, 2024

Various fixes and improvements from reviewing #371

Copy link

codecov bot commented Dec 18, 2024

Codecov Report

Attention: Patch coverage is 22.44898% with 38 lines in your changes missing coverage. Please review.

Project coverage is 74.96%. Comparing base (4663b5e) to head (6963c84).
Report is 1 commits behind head on peter/feat-wallet-integration.

Files with missing lines Patch % Lines
crates/pop-cli/src/commands/up/contract.rs 0.00% 22 Missing and 4 partials ⚠️
crates/pop-cli/src/common/wallet.rs 0.00% 5 Missing ⚠️
crates/pop-contracts/src/up.rs 64.28% 4 Missing and 1 partial ⚠️
crates/pop-cli/src/commands/call/contract.rs 0.00% 2 Missing ⚠️
@@                        Coverage Diff                        @@
##           peter/feat-wallet-integration     #390      +/-   ##
=================================================================
- Coverage                          74.97%   74.96%   -0.02%     
=================================================================
  Files                                 61       61              
  Lines                              13656    13650       -6     
  Branches                           13656    13650       -6     
=================================================================
- Hits                               10239    10233       -6     
- Misses                              2075     2076       +1     
+ Partials                            1342     1341       -1     
Files with missing lines Coverage Δ
crates/pop-cli/src/commands/call/chain.rs 74.52% <ø> (ø)
crates/pop-cli/src/wallet_integration.rs 96.13% <100.00%> (+0.73%) ⬆️
crates/pop-contracts/src/node.rs 66.25% <100.00%> (ø)
crates/pop-cli/src/commands/call/contract.rs 80.71% <0.00%> (ø)
crates/pop-cli/src/common/wallet.rs 12.90% <0.00%> (+0.40%) ⬆️
crates/pop-contracts/src/up.rs 70.45% <64.28%> (-0.34%) ⬇️
crates/pop-cli/src/commands/up/contract.rs 34.54% <0.00%> (-0.54%) ⬇️

@evilrobot-01 evilrobot-01 marked this pull request as ready for review December 18, 2024 15:52
@evilrobot-01 evilrobot-01 requested review from peterwht, AlexD10S and al3mart and removed request for peterwht and AlexD10S December 18, 2024 15:52
@@ -194,14 +194,18 @@ impl UpContractCommand {
spinner.start("Uploading contract...");

if self.upload_only {
let result = upload_contract_signed(self.url.as_str(), payload).await;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous versions were less code, but resulted in the need for an expect/unwrap which is eliminated by using a match.

@@ -344,7 +352,7 @@ impl UpContractCommand {

// get the call data and contract code hash
async fn get_contract_data(&self) -> anyhow::Result<(Vec<u8>, [u8; 32])> {
let contract_code = get_contract_code(self.path.as_ref()).await?;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Async unnecessary

@@ -480,7 +488,6 @@ mod tests {
#[tokio::test]
async fn get_upload_and_instantiate_call_data_works() -> anyhow::Result<()> {
let (contracts_node_process, port, temp_dir) = start_test_environment().await?;
let localhost_url = format!("ws://127.0.0.1:{}", port);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

@@ -22,13 +22,12 @@ pub async fn request_signature(call_data: Vec<u8>, rpc: String) -> anyhow::Resul
let transaction_data = TransactionData::new(rpc, call_data);
// Starts server with port 9090.
let mut wallet = WalletIntegrationManager::new(ui, transaction_data, Some(9090));
let url = wallet.server_url.clone();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removes a few unnecessary clones and simplifys the code.

Copy link
Contributor

@al3mart al3mart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice ones! Thanks

Copy link
Collaborator

@AlexD10S AlexD10S left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks for taking care of this!

@AlexD10S AlexD10S merged commit b757ac1 into peter/feat-wallet-integration Dec 18, 2024
13 of 25 checks passed
@AlexD10S AlexD10S deleted the frank/feat-wallet-integration-review branch December 18, 2024 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants