From 7221c7bb49668d51cc9c2627188ceae02af33d76 Mon Sep 17 00:00:00 2001 From: Aaron Barnard Date: Sat, 4 Dec 2021 07:45:14 +1100 Subject: [PATCH 1/3] 1.9.1-0.0.1: [fix] - Duplicate Notifications (#216) * Fixes types * Maintains id * Increment version --- package.json | 2 +- src/interfaces.ts | 7 ++----- src/notify.ts | 3 +-- src/transactions.ts | 15 +++++++-------- src/utilities.ts | 5 +++-- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index ac9a453..b887b95 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bnc-notify", - "version": "1.9.1", + "version": "1.9.1-0.0.1", "description": "Show web3 users realtime transaction notifications", "keywords": [ "ethereum", diff --git a/src/interfaces.ts b/src/interfaces.ts index 7f84c76..59dcf1e 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -1,7 +1,8 @@ import type { BitcoinTransactionLog, EthereumTransactionLog, - SDKError + SDKError, + TransactionHandler } from 'bnc-sdk/dist/types/src/interfaces' export interface InitOptions extends ConfigOptions { @@ -14,10 +15,6 @@ export interface InitOptions extends ConfigOptions { export type ErrorHandler = (error: SDKError) => void -export interface TransactionHandler { - (transaction: TransactionEvent): void -} - export interface TransactionEvent { emitterResult: void | boolean | CustomNotificationObject transaction: TransactionData diff --git a/src/notify.ts b/src/notify.ts index 919db33..4ca8447 100644 --- a/src/notify.ts +++ b/src/notify.ts @@ -1,5 +1,6 @@ import 'regenerator-runtime/runtime' import BlocknativeSdk from 'bnc-sdk' +import type { TransactionHandler } from 'bnc-sdk/dist/types/src/interfaces' import { get } from 'svelte/store' import uuid from 'uuid/v4' @@ -13,7 +14,6 @@ import { createNotification } from './notifications' import type { InitOptions, - TransactionHandler, AppStore, API, Emitter, @@ -26,7 +26,6 @@ import type { export { InitOptions, - TransactionHandler, TransactionEvent, System, TransactionEventCode, diff --git a/src/transactions.ts b/src/transactions.ts index 8aad6a7..4bc67d7 100644 --- a/src/transactions.ts +++ b/src/transactions.ts @@ -68,19 +68,18 @@ export function handlePreFlightEvent( }) } -export function handleTransactionEvent(event: { - transaction: TransactionData - emitterResult: boolean | void | CustomNotificationObject -}) { +export function handleTransactionEvent(event) { const { transaction, emitterResult } = event + if (!transaction.id) { transaction.id = transaction.hash || transaction.txid } - const predicate = (tx: TransactionData) => - transaction.replaceHash - ? tx.id === transaction.replaceHash - : tx.id === transaction.id + const predicate = (tx: TransactionData) => { + return transaction.replaceHash + ? tx.id === transaction.replaceHash || tx.hash === transaction.replaceHash + : tx.id === transaction.id || tx.hash === transaction.hash + } transactions.updateQueue(transaction, predicate) diff --git a/src/utilities.ts b/src/utilities.ts index 752c381..e09072b 100644 --- a/src/utilities.ts +++ b/src/utilities.ts @@ -19,7 +19,7 @@ export function replaceOrAdd( const index = clone.findIndex(predicate) if (index !== -1) { - const { startTime, contractCall, status } = clone[index] + const { startTime, contractCall, status, id } = clone[index] // if current transaction is a speedup or cancel and new status is pending, ignore update if ( @@ -35,7 +35,8 @@ export function replaceOrAdd( clone[index] = { ...data, ...contractCallMerge, - startTime: startTime || serverStartTime + startTime: startTime || serverStartTime, + id } return clone } From 51237c5ef0470900a1e91eaea51de456ad282813 Mon Sep 17 00:00:00 2001 From: Taylor Dawson Date: Fri, 3 Dec 2021 13:01:05 -0800 Subject: [PATCH 2/3] Fixes circlci config for npm publishing (#217) --- .circleci/config.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e152098..c10df31 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,8 +25,7 @@ jobs: - run: sudo apt update && sudo apt install awscli - run: yarn - run: yarn build - - run: sudo npm i -g npm-cli-login - - run: NPM_USER=$NPM_USERNAME NPM_EMAIL=$NPM_EMAIL NPM_PASS=$NPM_PASSWORD npm-cli-login + - run: echo "//registry.npmjs.org/:_authToken=$npm_TOKEN" > .npmrc - run: npm publish --dry-run - run: gzip -9 ./dist/notify.umd.js - run: mv ./dist/notify.umd.js.gz ./dist/notify.umd.js @@ -45,9 +44,8 @@ jobs: - run: sudo apt update && sudo apt install awscli - run: yarn - run: yarn build - - run: sudo npm i -g add npm-cli-login - - run: NPM_USER=$NPM_USERNAME NPM_EMAIL=$NPM_EMAIL NPM_PASS=$NPM_PASSWORD npm-cli-login - - run: npm publish + - run: echo "//registry.npmjs.org/:_authToken=$npm_TOKEN" > .npmrc + - run: npm publish --access public - run: gzip -9 ./dist/notify.umd.js - run: mv ./dist/notify.umd.js.gz ./dist/notify.umd.js - run: ls -al From 0d5751c042186f81fedcf7e9ed31fa9007271682 Mon Sep 17 00:00:00 2001 From: Taylor Dawson Date: Fri, 3 Dec 2021 13:18:32 -0800 Subject: [PATCH 3/3] Release: 1.9.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b887b95..1914651 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bnc-notify", - "version": "1.9.1-0.0.1", + "version": "1.9.2", "description": "Show web3 users realtime transaction notifications", "keywords": [ "ethereum",