Skip to content

Commit

Permalink
version 0.9.2 (#318)
Browse files Browse the repository at this point in the history
* Original hash (#317)

* add originalHash to speedup/cancel

* streamlined implementation

* update hash on second confirmation

* update to version 0.9.2
  • Loading branch information
cmeisl authored Jul 8, 2019
1 parent aac9654 commit 8ec3c30
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<head>`

```html
<script src="https://assist.blocknative.com/0-9-1/assist.js"></script>
<script src="https://assist.blocknative.com/0-9-2/assist.js"></script>

<!-- OR... -->

<script src="https://assist.blocknative.com/0-9-1/assist.min.js"></script>
<script src="https://assist.blocknative.com/0-9-2/assist.min.js"></script>
```

### Initialize the Library
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
15 changes: 11 additions & 4 deletions src/js/helpers/websockets.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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
})
}

Expand All @@ -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',
Expand Down

0 comments on commit 8ec3c30

Please sign in to comment.