Skip to content

Commit

Permalink
Add notify (#424)
Browse files Browse the repository at this point in the history
* Point to snapshot org

* Add notify
  • Loading branch information
makoto authored Aug 19, 2021
1 parent 484db1f commit 0026cd0
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 6 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"apollo-link-state": "^0.4.1",
"apollo-upload-client": "^10.0.0",
"apollo-utilities": "^1.0.21",
"bnc-notify": "^1.9.1",
"bnc-onboard": "^1.34.1",
"decimal.js": "^10.0.1",
"es6-promisify": "^6.0.0",
Expand Down
7 changes: 7 additions & 0 deletions src/GlobalState.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { withApollo } from 'react-apollo'
import jwt from 'jsonwebtoken'
import Web3 from 'web3'
import Onboard from 'bnc-onboard'
import Notify from 'bnc-notify'

import { track } from './api/analytics'
import {
Expand Down Expand Up @@ -134,6 +135,12 @@ class Provider extends Component {
}
})
this.setState({ onboard })

var notify = Notify({
dappId: BLOCKNATIVE_DAPPID || testid,
networkId: parseInt(networkId) // [Integer] The Ethereum network ID your Dapp uses.
})
this.setState({ notify })
}

let result = {
Expand Down
12 changes: 9 additions & 3 deletions src/api/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { events } from '@wearekickback/contracts'
import { parseLog } from 'ethereum-event-logs'
import { getProvider } from '../GlobalState'

export const extractNewPartyAddressFromTx = tx => {
// coerce events into logs if available
Expand All @@ -15,9 +16,14 @@ export const extractNewPartyAddressFromTx = tx => {
}

export function txHelper(web3TxObj) {
return new Promise(resolve => {
web3TxObj.on('transactionHash', hash => {
resolve(hash)
getProvider().then(provider => {
return new Promise(resolve => {
web3TxObj.on('transactionHash', hash => {
if (provider.state.notify) {
provider.state.notify.hash(hash)
}
resolve(hash)
})
})
})
}
Expand Down
6 changes: 5 additions & 1 deletion src/routes/Faq.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ class FAQ extends Component {
.
</p>
<h3>Can I cancel my registration?</h3>
<p>No. The purpose of Kickback is to create an incentive for attendees to commit to plans, whilst simultaneously taking the risk off of event organisers and venues.</p>
<p>
No. The purpose of Kickback is to create an incentive for attendees to
commit to plans, whilst simultaneously taking the risk off of event
organisers and venues.
</p>
<h3>What happens if the event is canceled?</h3>
<p>
In case the event is canceled, all registered people can withdraw
Expand Down
71 changes: 69 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7230,6 +7230,17 @@ bnb-javascript-sdk-nobroadcast@^2.16.14:
uuid "^3.3.2"
websocket-stream "^5.5.0"

bnc-notify@^1.9.1:
version "1.9.1"
resolved "https://registry.yarnpkg.com/bnc-notify/-/bnc-notify-1.9.1.tgz#cd8ec8e5f5482cf78b6caea7de35288ee73d6b32"
integrity sha512-OWXI6KIOU/0CWhlFBiIStfbio3X5uUTeBjG6h4R7Ng6MABqZHMFRCNOgVQ50HdwwZiaFMuA3l23cZLxJjyaY0Q==
dependencies:
bignumber.js "^9.0.0"
bnc-sdk "^3.5.0"
lodash.debounce "^4.0.8"
regenerator-runtime "^0.13.3"
uuid "^3.3.3"

bnc-onboard@^1.34.1:
version "1.34.1"
resolved "https://registry.yarnpkg.com/bnc-onboard/-/bnc-onboard-1.34.1.tgz#51a47dd86e11e60b5360f3c50098f6930196b72c"
Expand Down Expand Up @@ -7276,6 +7287,15 @@ bnc-sdk@^3.4.1:
rxjs "^6.6.3"
sturdy-websocket "^0.1.12"

bnc-sdk@^3.5.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/bnc-sdk/-/bnc-sdk-3.5.0.tgz#b863a2d947857d87c56d53261bd43529f1a5c03e"
integrity sha512-4CSon8xRTjtD7YOUDJcyqZ/bKCNNwDc4sOPq6O19AlolYTsbbVvh+p5EOmYqL4Re30hI3lKQxN4sh12A6VnAPQ==
dependencies:
crypto-es "^1.2.2"
rxjs "^6.6.3"
sturdy-websocket "^0.1.12"

[email protected], body-parser@^1.16.0, body-parser@^1.18.3:
version "1.19.0"
resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a"
Expand Down Expand Up @@ -12352,7 +12372,28 @@ fs.realpath@^1.0.0:
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=

[email protected], [email protected], fsevents@^1.2.3, fsevents@^1.2.7, fsevents@~2.1.2, fsevents@~2.3.1:
[email protected]:
version "1.2.4"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.4.tgz#f41dcb1af2582af3692da36fc55cbd8e1041c426"
integrity sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==
dependencies:
nan "^2.9.2"
node-pre-gyp "^0.10.0"

fsevents@^1.2.3, fsevents@^1.2.7:
version "1.2.13"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.2.13.tgz#f325cb0455592428bcf11b383370ef70e3bfcc38"
integrity sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==
dependencies:
bindings "^1.5.0"
nan "^2.12.1"

fsevents@~2.1.2:
version "2.1.3"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e"
integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==

fsevents@~2.3.1:
version "2.3.2"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
Expand Down Expand Up @@ -17314,6 +17355,11 @@ nan@^2.12.1, nan@^2.13.2, nan@^2.14.0, nan@^2.14.2, nan@^2.2.1:
resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.2.tgz#f5376400695168f4cc694ac9393d0c9585eeea19"
integrity sha512-M2ufzIiINKCuDfBSAUr1vWQ+vuVcA9kqx8JJUsbQi6yf1uGRyb7HfpdfUr5qLXf3B/t8dPvcjhKMmlfnP47EzQ==

nan@^2.9.2:
version "2.15.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.15.0.tgz#3f34a473ff18e15c1b5626b62903b5ad6e665fee"
integrity sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==

nano-base32@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/nano-base32/-/nano-base32-1.0.1.tgz#ba548c879efcfb90da1c4d9e097db4a46c9255ef"
Expand Down Expand Up @@ -17566,6 +17612,22 @@ node-notifier@^5.2.1:
shellwords "^0.1.1"
which "^1.3.0"

node-pre-gyp@^0.10.0:
version "0.10.3"
resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.10.3.tgz#3070040716afdc778747b61b6887bf78880b80fc"
integrity sha512-d1xFs+C/IPS8Id0qPTZ4bUT8wWryfR/OzzAFxweG+uLN85oPzyo2Iw6bVlLQ/JOdgNonXLCoRyqDzDWq4iw72A==
dependencies:
detect-libc "^1.0.2"
mkdirp "^0.5.1"
needle "^2.2.1"
nopt "^4.0.1"
npm-packlist "^1.1.6"
npmlog "^4.0.2"
rc "^1.2.7"
rimraf "^2.6.1"
semver "^5.3.0"
tar "^4"

node-pre-gyp@^0.11.0:
version "0.11.0"
resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.11.0.tgz#db1f33215272f692cd38f03238e3e9b47c5dd054"
Expand Down Expand Up @@ -21217,6 +21279,11 @@ regenerator-runtime@^0.12.0:
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz#fa1a71544764c036f8c49b13a08b2594c9f8a0de"
integrity sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg==

regenerator-runtime@^0.13.3:
version "0.13.9"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52"
integrity sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==

regenerator-runtime@^0.13.4, regenerator-runtime@^0.13.7:
version "0.13.7"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz#cac2dacc8a1ea675feaabaeb8ae833898ae46f55"
Expand Down Expand Up @@ -24469,7 +24536,7 @@ [email protected], uuid@^8.0.0, uuid@^8.3.2:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==

uuid@^3.0.1, uuid@^3.1.0, uuid@^3.2.1, uuid@^3.3.2, uuid@^3.4.0:
uuid@^3.0.1, uuid@^3.1.0, uuid@^3.2.1, uuid@^3.3.2, uuid@^3.3.3, uuid@^3.4.0:
version "3.4.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
Expand Down

0 comments on commit 0026cd0

Please sign in to comment.