From 8ec3c309bb615c319b981a09a405e04382e5f6c0 Mon Sep 17 00:00:00 2001 From: Chris Meisl Date: Mon, 8 Jul 2019 16:44:40 -0600 Subject: [PATCH] version 0.9.2 (#318) * Original hash (#317) * add originalHash to speedup/cancel * streamlined implementation * update hash on second confirmation * update to version 0.9.2 --- README.md | 10 ++++++---- package.json | 2 +- src/js/helpers/websockets.js | 15 +++++++++++---- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a04995fa..7c8c5225 100644 --- a/README.md +++ b/README.md @@ -43,16 +43,16 @@ yarn add bnc-assist #### Script Tag The library uses [semantic versioning](https://semver.org/spec/v2.0.0.html). -The current version is 0.9.1. +The current version is 0.9.2. There are minified and non-minified versions. Put this script at the top of your `` ```html - + - + ``` ### Initialize the Library @@ -263,12 +263,14 @@ The function that is defined on the `handleNotificationEvent` property of the co inlineCustomMsgs: Object | Boolean, // the inline custom messages passed to the transaction reason: String, // reason for error type notifications transaction: { - id: String, // internal unique id for the transaction + id: String, // internal unique id for the transaction (remains constant even if transaction hash changes due to speedup or cancel) from: String, // the address the transaction was sent from gas: String, // the gas limit of the transaction gasPrice: String, // the gas price of the transaction to: String, // the address the transaction was sent to value: String // the value of the transaction + hash: String // the transaction hash (updated to a new hash if transaction is sped up or cancelled) + originalHash: String // if transaction was sped up or cancelled, the original transaction hash }, wallet: { address: String, // the account address of the wallet in use diff --git a/package.json b/package.json index 4abd6efb..8beae481 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bnc-assist", - "version": "0.9.1", + "version": "0.9.2", "description": "Blocknative Assist js library for Dapp developers", "main": "lib/assist.min.js", "scripts": { diff --git a/src/js/helpers/websockets.js b/src/js/helpers/websockets.js index 84ff472b..e1f5a314 100644 --- a/src/js/helpers/websockets.js +++ b/src/js/helpers/websockets.js @@ -130,7 +130,9 @@ export function handleSocketMessage(msg) { case 'pending': txObj = updateTransactionInQueue(transaction.id, { status: 'pending', - nonce: transaction.nonce + nonce: transaction.nonce, + hash: transaction.hash, + originalHash: transaction.originalHash }) handleEvent({ @@ -151,11 +153,13 @@ export function handleSocketMessage(msg) { if (txObj.transaction.status === 'confirmed') { txObj = updateTransactionInQueue(transaction.id, { - status: 'completed' + status: 'completed', + hash: transaction.hash }) } else { txObj = updateTransactionInQueue(transaction.id, { - status: 'confirmed' + status: 'confirmed', + hash: transaction.hash }) } @@ -173,7 +177,10 @@ export function handleSocketMessage(msg) { break case 'failed': - txObj = updateTransactionInQueue(transaction.id, { status: 'failed' }) + txObj = updateTransactionInQueue(transaction.id, { + status: 'failed', + hash: transaction.hash + }) handleEvent({ eventCode: 'txFailed',