Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
julian-demox committed Oct 10, 2024
1 parent 4bfd7e5 commit 5819b7f
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 24 deletions.
6 changes: 4 additions & 2 deletions crates/rust-client/src/transactions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ impl<R: FeltRng> Client<R> {
// `get_transaction_inputs`
let authenticated_input_note_ids: Vec<NoteId> =
transaction_request.authenticated_input_note_ids().collect::<Vec<_>>();

let authenticated_note_records = maybe_await!(self
.store
.get_input_notes(NoteFilter::List(authenticated_input_note_ids.to_vec())))?;
Expand Down Expand Up @@ -331,7 +331,9 @@ impl<R: FeltRng> Client<R> {
) -> Result<ProvenTransaction, ClientError> {
let transaction_prover = LocalTransactionProver::new(ProvingOptions::default());
info!("Proving transaction...");
let proven_transaction = maybe_await!(transaction_prover.prove(tx_result.executed_transaction().clone().into()))?;
let proven_transaction = maybe_await!(
transaction_prover.prove(tx_result.executed_transaction().clone().into())
)?;
info!("Transaction proven.");

Ok(proven_transaction)
Expand Down
6 changes: 4 additions & 2 deletions crates/web-client/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ impl WebClient {
account_id: &AccountId,
) -> Result<AuthSecretKey, JsValue> {
if let Some(store) = &self.store {
let native_auth_secret_key =
store.fetch_and_cache_account_auth_by_pub_key(&account_id.to_string()).await.map_err(|err| {
let native_auth_secret_key = store
.fetch_and_cache_account_auth_by_pub_key(&account_id.to_string())
.await
.map_err(|err| {
JsValue::from_str(&format!("Failed to fetch and cache account auth: {}", err))
})?;

Expand Down
2 changes: 1 addition & 1 deletion crates/web-client/src/models/block_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ impl From<NativeBlockHeader> for BlockHeader {

impl From<&NativeBlockHeader> for BlockHeader {
fn from(header: &NativeBlockHeader) -> Self {
BlockHeader(header.clone())
BlockHeader(*header)
}
}
4 changes: 2 additions & 2 deletions crates/web-client/src/models/note_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl From<NativeNoteHeader> for NoteHeader {

impl From<&NativeNoteHeader> for NoteHeader {
fn from(native_note_header: &NativeNoteHeader) -> Self {
NoteHeader(native_note_header.clone())
NoteHeader(*native_note_header)
}
}

Expand All @@ -47,6 +47,6 @@ impl From<NoteHeader> for NativeNoteHeader {

impl From<&NoteHeader> for NativeNoteHeader {
fn from(note_header: &NoteHeader) -> Self {
note_header.0.clone()
note_header.0
}
}
2 changes: 1 addition & 1 deletion crates/web-client/src/models/transaction_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ impl From<NativeTransactionId> for TransactionId {

impl From<&NativeTransactionId> for TransactionId {
fn from(native_id: &NativeTransactionId) -> Self {
TransactionId(native_id.clone())
TransactionId(*native_id)
}
}
10 changes: 2 additions & 8 deletions crates/web-client/src/models/transaction_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,11 @@ impl TransactionStatus {
}

pub fn is_pending(&self) -> bool {
match self.0 {
NativeTransactionStatus::Pending => true,
_ => false,
}
matches!(self.0, NativeTransactionStatus::Pending)
}

pub fn is_committed(&self) -> bool {
match self.0 {
NativeTransactionStatus::Committed(_) => true,
_ => false,
}
matches!(self.0, NativeTransactionStatus::Committed(_))
}

pub fn get_block_num(&self) -> Option<u32> {
Expand Down
16 changes: 8 additions & 8 deletions crates/web-client/test/mocha.global.setup.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import * as chai from "chai";
import chaiAsPromised from "chai-as-promised";
import puppeteer from "puppeteer";
import { spawn } from "child_process";

Expand All @@ -26,10 +26,10 @@ before(async () => {
console.log("Starting test server...");
serverProcess = spawn("http-server", ["./dist", "-p", TEST_SERVER_PORT], {
stdio: "inherit",
shell: process.platform == 'win32'
shell: process.platform == "win32",
});

browser = await puppeteer.launch({ headless: true });
browser = await puppeteer.launch({ headless: true, protocolTimeout: 60000 });
testingPage = await browser.newPage();
await testingPage.goto(TEST_SERVER);

Expand All @@ -40,12 +40,12 @@ before(async () => {
// Creates the client in the test context and attach to window object
await testingPage.exposeFunction("create_client", async () => {
await testingPage.evaluate(async (port) => {
const {
const {
Account,
AccountHeader,
AccountHeader,
AccountStorageMode,
AdviceMap,
AuthSecretKey,
AuthSecretKey,
Felt,
FeltArray,
FungibleAsset,
Expand All @@ -68,7 +68,7 @@ before(async () => {
TransactionRequest,
TransactionScriptInputPair,
TransactionScriptInputPairArray,
WebClient
WebClient,
} = await import("./index.js");
let rpc_url = `http://localhost:${port}`;
const client = new WebClient();
Expand Down

0 comments on commit 5819b7f

Please sign in to comment.