Commit 0afcf575 authored by Max's avatar Max

Merge branch 'move-history-writer' into 'next'

Storage: Move history to local 2

See merge request !44
parents 564bbdbf 59380aa4
......@@ -173,7 +173,6 @@ let update_limits ?fee ?gas_limit ?storage_limit op =
let node_mac_storage_limit = Misc.unopt mac.node_mac_storage_limit storage_limit in
NManage_account {mac with node_mac_fee; node_mac_gas_limit; node_mac_storage_limit}
| op -> op in
Printf.printf "DIFF SIZE %d\n%!" diff_size;
op, diff_size
let update_counter counter = function
......
......@@ -464,6 +464,11 @@ module To_js = struct
account##.history := network_assoc (of_list block_operation) a.history;
account
let accounts_history l =
let o : accounts_history_entry t = Unsafe.obj [||] in
o##.history := def @@ of_list account_history l;
o
let network network =
let data : network_entry t = Unsafe.obj [||] in
data##.network := def (string (Mhelpers.network_to_string network));
......
......@@ -74,7 +74,10 @@ let add_account ?(select=false) ?callback ?accounts account =
callback accounts)
| None, true ->
Some (fun () -> update_selected (Some account.pkh)) in
Chrome.Storage.set ?callback Chrome.sync (To_js.accounts accounts) in
let update_history ?callback () =
Chrome.Storage.set ?callback Chrome.Storage.local (To_js.accounts_history accounts) in
let callback () = update_history ?callback () in
Chrome.Storage.set ~callback Chrome.sync (To_js.accounts accounts) in
match accounts with
| None -> get_accounts aux
| Some accounts -> aux accounts
......@@ -85,7 +88,10 @@ let remove_account ?callback ?accounts account_pkh =
let callback = match callback with
| None -> None
| Some callback -> Some (fun () -> callback accounts) in
Chrome.Storage.set ?callback Chrome.sync (To_js.accounts accounts) in
let update_history ?callback () =
Chrome.Storage.set ?callback Chrome.Storage.local (To_js.accounts_history accounts) in
let callback () = update_history ?callback () in
Chrome.Storage.set ~callback Chrome.sync (To_js.accounts accounts) in
match accounts with
| None -> get_accounts aux
| Some accounts -> aux accounts
......@@ -96,7 +102,10 @@ let update_account ?callback ?accounts account =
let callback = match callback with
| None -> None
| Some callback -> Some (fun () -> callback account) in
Chrome.Storage.set ?callback Chrome.sync (To_js.accounts accounts) in
let update_history ?callback () =
Chrome.Storage.set ?callback Chrome.Storage.local (To_js.accounts_history accounts) in
let callback () = update_history ?callback () in
Chrome.Storage.set ~callback Chrome.sync (To_js.accounts accounts) in
match accounts with
| None -> get_accounts aux
| Some accounts -> aux accounts
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment