diff --git a/mm2src/mm2_db/src/indexed_db/indexed_db.rs b/mm2src/mm2_db/src/indexed_db/indexed_db.rs index d6e8ab15d4..f7d04dfddb 100644 --- a/mm2src/mm2_db/src/indexed_db/indexed_db.rs +++ b/mm2src/mm2_db/src/indexed_db/indexed_db.rs @@ -34,7 +34,7 @@ macro_rules! try_serialize_index_value { return MmError::err(DbTransactionError::ErrorSerializingIndex { index: $index.to_owned(), description: ser_err.to_string(), - }) + }); }, } }}; @@ -326,6 +326,7 @@ impl AddOrIgnoreResult { } } } + impl<'transaction, Table: TableSignature> DbTable<'transaction, Table> { /// Adds the given item to the table. /// https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/add @@ -830,7 +831,10 @@ fn open_cursor( /// Detects the current execution environment (window or worker) and follows the appropriate way /// of getting `web_sys::IdbFactory` instance. pub(crate) fn get_idb_factory() -> Result { - let global = js_sys::global(); + // try getting global with type safety and explicit type conversion. + let global = js_sys::global() + .dyn_into::() + .map_err(|err| InitDbError::NotSupported(format!("{err:?}")))?; let idb_factory = if let Some(window) = global.dyn_ref::() { window.indexed_db() @@ -1216,7 +1220,7 @@ mod tests { .expect("Couldn't get items by the index 'ticker=RICK'"); assert_eq!(actual_rick_txs, vec![ (rick_tx_1_id, rick_tx_1_updated), - (rick_tx_2_id, rick_tx_2) + (rick_tx_2_id, rick_tx_2), ]); } diff --git a/mm2src/mm2_test_helpers/src/for_tests.rs b/mm2src/mm2_test_helpers/src/for_tests.rs index 4d6d74fd71..0a637f5d15 100644 --- a/mm2src/mm2_test_helpers/src/for_tests.rs +++ b/mm2src/mm2_test_helpers/src/for_tests.rs @@ -1935,7 +1935,6 @@ pub async fn enable_eth_coin( json::from_str(&enable.1).unwrap() } - pub async fn enable_spl(mm: &MarketMakerIt, coin: &str) -> Json { let req = json!({ "userpass": mm.userpass,