diff --git a/src/js/utils/saga.js b/src/js/utils/saga.js
index 2b6ffb45..8db019b0 100644
--- a/src/js/utils/saga.js
+++ b/src/js/utils/saga.js
@@ -48,7 +48,7 @@ export function *doTransaction(preSuccess, success, failed, {value = 0, toSend})
}
}
-export function contractEventChannel(contract, event, filter, emitter) {
+export function contractOnceEventChannel(contract, event, filter, emitter) {
contract.once(event, {filter}, (err, result) => {
if (err) {
emitter({err});
@@ -60,8 +60,28 @@ export function contractEventChannel(contract, event, filter, emitter) {
return () => {};
}
-export function *contractEvent(contract, event, filter, successType) {
- const channel = eventChannel(contractEventChannel.bind(null, contract, event, filter));
+export function contractEventChannel(contract, event, filter, emitter) {
+ const sub = contract.events[event]({
+ filter
+ }, (err, result) => {
+ if (err) {
+ emitter({err});
+ return emitter(END);
+ }
+ emitter({result});
+ });
+ return () => {
+ sub.unsubscribe();
+ };
+}
+
+export function *contractEvent(contract, event, filter, successType, perpetualEvent) {
+ let channel;
+ if (perpetualEvent) {
+ channel = eventChannel(contractEventChannel.bind(null, contract, event, filter));
+ } else {
+ channel = eventChannel(contractOnceEventChannel.bind(null, contract, event, filter));
+ }
while (true) {
const {result, error} = yield take(channel);
if (result) {
diff --git a/yarn.lock b/yarn.lock
index 406cb081..63d1b251 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4392,6 +4392,11 @@ ccount@^1.0.3:
resolved "https://registry.yarnpkg.com/ccount/-/ccount-1.0.3.tgz#f1cec43f332e2ea5a569fd46f9f5bde4e6102aff"
integrity sha512-Jt9tIBkRc9POUof7QA/VwWd+58fKkEEfI+/t1/eOlxKM7ZhrczNzMFefge7Ai+39y1pR/pP6cI19guHy3FSLmw==
+chain-function@^1.0.0:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/chain-function/-/chain-function-1.0.1.tgz#c63045e5b4b663fb86f1c6e186adaf1de402a1cc"
+ integrity sha512-SxltgMwL9uCko5/ZCLiyG2B7R9fY4pDZUw7hJ4MhirdjBLosoDqkWABi3XMucddHdLiFJMb7PD2MZifZriuMTg==
+
chalk@2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e"
@@ -4603,7 +4608,7 @@ class-utils@^0.3.5:
isobject "^3.0.0"
static-extend "^0.1.1"
-classnames@^2.2.0, classnames@^2.2.3, classnames@^2.2.5, classnames@^2.2.6:
+classnames@^2.1.1, classnames@^2.2.0, classnames@^2.2.3, classnames@^2.2.5, classnames@^2.2.6:
version "2.2.6"
resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.2.6.tgz#43935bffdd291f326dad0a205309b38d00f650ce"
integrity sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q==
@@ -6022,7 +6027,7 @@ dom-converter@^0.2:
dependencies:
utila "~0.4"
-dom-helpers@^3.2.1, dom-helpers@^3.4.0:
+dom-helpers@^3.2.0, dom-helpers@^3.2.1, dom-helpers@^3.4.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-3.4.0.tgz#e9b369700f959f62ecde5a6babde4bccd9169af8"
integrity sha512-LnuPJ+dwqKDIyotW1VzmOZ5TONUN7CwkCR5hrgawTUbkBGYdeoNLZo6nNfGkCrjtE1nXXaj7iMMpDa8/d9WoIA==
@@ -14104,7 +14109,7 @@ prop-types-extra@^1.0.1:
react-is "^16.3.2"
warning "^3.0.0"
-prop-types@15.x, prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.7, prop-types@^15.5.8, prop-types@^15.5.9, prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2:
+prop-types@15.x, prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.6, prop-types@^15.5.7, prop-types@^15.5.8, prop-types@^15.5.9, prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2:
version "15.7.2"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
@@ -14729,6 +14734,15 @@ react-modal@^3.6.1:
react-lifecycles-compat "^3.0.0"
warning "^3.0.0"
+react-notifications@^1.4.3:
+ version "1.4.3"
+ resolved "https://registry.yarnpkg.com/react-notifications/-/react-notifications-1.4.3.tgz#7060d339896f125a5b183ebcd04526980a433222"
+ integrity sha1-cGDTOYlvElpbGD680EUmmApDMiI=
+ dependencies:
+ classnames "^2.1.1"
+ prop-types "^15.5.10"
+ react-transition-group "^1.2.0"
+
react-onclickoutside@^6.5.0:
version "6.8.0"
resolved "https://registry.yarnpkg.com/react-onclickoutside/-/react-onclickoutside-6.8.0.tgz#9f91b5b3ed59f4d9e43fd71620dc200773a4d569"
@@ -14892,6 +14906,17 @@ react-textarea-autosize@^7.0.4:
"@babel/runtime" "^7.1.2"
prop-types "^15.6.0"
+react-transition-group@^1.2.0:
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-1.2.1.tgz#e11f72b257f921b213229a774df46612346c7ca6"
+ integrity sha512-CWaL3laCmgAFdxdKbhhps+c0HRGF4c+hdM4H23+FI1QBNUyx/AMeIJGWorehPNSaKnQNOAxL7PQmqMu78CDj3Q==
+ dependencies:
+ chain-function "^1.0.0"
+ dom-helpers "^3.2.0"
+ loose-envify "^1.3.1"
+ prop-types "^15.5.6"
+ warning "^3.0.0"
+
react-transition-group@^2.0.0, react-transition-group@^2.2.0, react-transition-group@^2.3.1:
version "2.9.0"
resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-2.9.0.tgz#df9cdb025796211151a436c69a8f3b97b5b07c8d"