Skip to content

Commit

Permalink
Integrate WASM IndexedDb jl777#928 (jl777#952)
Browse files Browse the repository at this point in the history
* Refactor `ws_transport`, `spawn_ws_transport` error types
* Remove the `WebSocketError::UnderlyingError` error

* Integrate the browser 'IndexedDb' database
* Add wasm_indexed_db.rs
* Implement the `IndexedDb` initialization

* Fix the 'common' crate warnings
* Remove 'allow(dead_code)' for wasm32 arch
* Remove 'allow(unused_import)' for wasm32 arch
* Add the 'cfg_wasm32', 'cfg_native' macros
* Separated 'WasmUnwrapExt' into 'WasmUnwrapExt' and 'WasmUnwrapErrExt'

* Refactor `IndexedDb`
* Add `IndexedDbBuilder`
* Add 'DbTransaction'

* Add add/get items methods to 'IndexedDb'
* Add 'IndexedDb::add_item', 'IndexedDb::get_items'
* Refactor wasm_ws tests

* Add 'IndexedDb::replace_item'

* Add the aborted flag to the open table/transaction

* Add 'DbTable::get_item_ids'

* Add 'TxHistoryDb' with the implementation depending on the arch
* Add common::panic_w
* Add 'DbTable::clear' method

* Add 'TxHistoryDb' with the implementation depending on the arch
* Add 'DbTable::delete_item' method, use it on 'TxHistory::clear'
* Separate 'wasm_indexed_db::tests::test_add_get_item' to itself, 'test_replace_item', 'test_delete_item', 'test_clear'

* Make the reading/changing tx history non-blocking

* Fix rustfmt warnings

* Replace tokio::fs with async_std::fs
* Use ticker and wallet_address to identify the history items
  • Loading branch information
sergeyboyko0791 authored May 27, 2021
1 parent da02fa1 commit d049502
Show file tree
Hide file tree
Showing 18 changed files with 1,965 additions and 197 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions mm2src/coins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ path = "lp_coins.rs"
doctest = false

[dependencies]
async-std = { version = "1.5", features = ["unstable"] }
async-trait = "0.1"
base64 = "0.10.0"
bigdecimal = { version = "0.1.0", features = ["serde"] }
bitcoin-cash-slp = "0.3.1"
bitcrypto = { git = "https://github.com/artemii235/parity-bitcoin.git" }
byteorder = "1.3"
bytes = "0.4"
cfg-if = "1.0"
chain = { git = "https://github.com/artemii235/parity-bitcoin.git" }
common = { path = "../common" }
derive_more = "0.99"
Expand Down
2 changes: 2 additions & 0 deletions mm2src/coins/lp_coins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ use qrc20::{qrc20_coin_from_conf_and_request, Qrc20Coin, Qrc20FeeDetails};
pub mod test_coin;
pub use test_coin::TestCoin;

pub mod tx_history_db;

#[cfg(not(target_arch = "wasm32"))] pub mod z_coin;

pub type BalanceResult<T> = Result<T, MmError<BalanceError>>;
Expand Down
Loading

0 comments on commit d049502

Please sign in to comment.