Skip to content

Commit

Permalink
Merge pull request #33 from blocknative/develop
Browse files Browse the repository at this point in the history
Release 1.0.3
  • Loading branch information
lnbc1QWFyb24 authored Dec 5, 2019
2 parents 68061b1 + 73475d2 commit 6b4cd7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bnc-sdk",
"version": "1.0.2",
"version": "1.0.3",
"description": "SDK to connect to the blocknative backend via a websocket connection",
"keywords": [
"ethereum",
Expand All @@ -14,7 +14,7 @@
"files": [
"dist"
],
"author": "Aaron Barnard <abarnard@protonmail.com>",
"author": "Aaron Barnard <aaron@blocknative.com>",
"repository": {
"type": "git",
"url": "https://github.com/blocknative/sdk"
Expand Down
17 changes: 4 additions & 13 deletions src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,10 @@ export function handleMessage(msg: { data: string }): void {
if (watchedAddress) {
session.clients.forEach((client: Client) => {
const { transactionHandlers, accounts } = client

const accountObj = accounts.find((ac: Ac) => ac.address === watchedAddress)

// no accountObj then this client isn't concerned with this notification
if (!accountObj) return

let emitterResult =
accountObj && last(accountObj.emitters.map((emitter: Emitter) => emitter.emit(newState)))
const emitterResult = accountObj
? last(accountObj.emitters.map((emitter: Emitter) => emitter.emit(newState)))
: false

transactionHandlers.forEach((handler: TransactionHandler) =>
handler({ transaction: newState, emitterResult })
Expand All @@ -105,13 +101,8 @@ export function handleMessage(msg: { data: string }): void {
} else {
session.clients.forEach((client: Client) => {
const { transactionHandlers, transactions } = client

const transactionObj = transactions.find((tx: Tx) => tx.hash === transaction.hash)

// no transactionObj then this client isn't concerned with this notification
if (!transactionObj) return

let emitterResult = transactionObj && transactionObj.emitter.emit(newState)
const emitterResult = transactionObj && transactionObj.emitter.emit(newState)

transactionHandlers.forEach((handler: TransactionHandler) =>
handler({ transaction: newState, emitterResult })
Expand Down

0 comments on commit 6b4cd7a

Please sign in to comment.