aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/util/heartbeater_factory.ts
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-09 09:13:22 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-09 09:13:22 +0800
commit297a62fe80142897250f6dd6fddb4cdf1d3fe3ee (patch)
tree92bd8ba2f27d9144bdc1c8fbfda5b50e81015dd5 /packages/instant/src/util/heartbeater_factory.ts
parent1e39d56cf751fd922d6fec86ecc8bc70b20bc6bb (diff)
downloaddexon-sol-tools-297a62fe80142897250f6dd6fddb4cdf1d3fe3ee.tar.gz
dexon-sol-tools-297a62fe80142897250f6dd6fddb4cdf1d3fe3ee.tar.zst
dexon-sol-tools-297a62fe80142897250f6dd6fddb4cdf1d3fe3ee.zip
move files around and rename
Diffstat (limited to 'packages/instant/src/util/heartbeater_factory.ts')
-rw-r--r--packages/instant/src/util/heartbeater_factory.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/instant/src/util/heartbeater_factory.ts b/packages/instant/src/util/heartbeater_factory.ts
new file mode 100644
index 000000000..fc33787ee
--- /dev/null
+++ b/packages/instant/src/util/heartbeater_factory.ts
@@ -0,0 +1,18 @@
+import { asyncData } from '../redux/async_data';
+import { Store } from '../redux/store';
+
+import { updateBuyQuoteOrFlashErrorAsyncForState } from './buy_quote_fetcher';
+import { Heartbeater } from './heartbeater';
+
+export const generateAccountHeartbeater = (store: Store): Heartbeater => {
+ return new Heartbeater(async () => {
+ await asyncData.fetchAccountInfoAndDispatchToStore(store, { setLoading: false });
+ });
+};
+
+export const generateBuyQuoteHeartbeater = (store: Store): Heartbeater => {
+ return new Heartbeater(async () => {
+ await updateBuyQuoteOrFlashErrorAsyncForState(store.getState(), store.dispatch);
+ return Promise.resolve();
+ });
+};