Skip to content

Commit 8ec3c30

Browse files
authored
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
1 parent aac9654 commit 8ec3c30

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

README.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ yarn add bnc-assist
4343
#### Script Tag
4444

4545
The library uses [semantic versioning](https://semver.org/spec/v2.0.0.html).
46-
The current version is 0.9.1.
46+
The current version is 0.9.2.
4747
There are minified and non-minified versions.
4848
Put this script at the top of your `<head>`
4949

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

5353
<!-- OR... -->
5454

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

5858
### Initialize the Library
@@ -263,12 +263,14 @@ The function that is defined on the `handleNotificationEvent` property of the co
263263
inlineCustomMsgs: Object | Boolean, // the inline custom messages passed to the transaction
264264
reason: String, // reason for error type notifications
265265
transaction: {
266-
id: String, // internal unique id for the transaction
266+
id: String, // internal unique id for the transaction (remains constant even if transaction hash changes due to speedup or cancel)
267267
from: String, // the address the transaction was sent from
268268
gas: String, // the gas limit of the transaction
269269
gasPrice: String, // the gas price of the transaction
270270
to: String, // the address the transaction was sent to
271271
value: String // the value of the transaction
272+
hash: String // the transaction hash (updated to a new hash if transaction is sped up or cancelled)
273+
originalHash: String // if transaction was sped up or cancelled, the original transaction hash
272274
},
273275
wallet: {
274276
address: String, // the account address of the wallet in use

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bnc-assist",
3-
"version": "0.9.1",
3+
"version": "0.9.2",
44
"description": "Blocknative Assist js library for Dapp developers",
55
"main": "lib/assist.min.js",
66
"scripts": {

src/js/helpers/websockets.js

+11-4
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ export function handleSocketMessage(msg) {
130130
case 'pending':
131131
txObj = updateTransactionInQueue(transaction.id, {
132132
status: 'pending',
133-
nonce: transaction.nonce
133+
nonce: transaction.nonce,
134+
hash: transaction.hash,
135+
originalHash: transaction.originalHash
134136
})
135137

136138
handleEvent({
@@ -151,11 +153,13 @@ export function handleSocketMessage(msg) {
151153

152154
if (txObj.transaction.status === 'confirmed') {
153155
txObj = updateTransactionInQueue(transaction.id, {
154-
status: 'completed'
156+
status: 'completed',
157+
hash: transaction.hash
155158
})
156159
} else {
157160
txObj = updateTransactionInQueue(transaction.id, {
158-
status: 'confirmed'
161+
status: 'confirmed',
162+
hash: transaction.hash
159163
})
160164
}
161165

@@ -173,7 +177,10 @@ export function handleSocketMessage(msg) {
173177

174178
break
175179
case 'failed':
176-
txObj = updateTransactionInQueue(transaction.id, { status: 'failed' })
180+
txObj = updateTransactionInQueue(transaction.id, {
181+
status: 'failed',
182+
hash: transaction.hash
183+
})
177184

178185
handleEvent({
179186
eventCode: 'txFailed',

0 commit comments

Comments
 (0)