-
Notifications
You must be signed in to change notification settings - Fork 27
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
refactor: review fixes and improvements #390
Conversation
Eliminates the expects and unwraps.
Codecov ReportAttention: Patch coverage is
@@ 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
|
@@ -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; |
There was a problem hiding this comment.
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?; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice ones! Thanks
There was a problem hiding this 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!
b757ac1
into
peter/feat-wallet-integration
Various fixes and improvements from reviewing #371