File tree 3 files changed +7
-10
lines changed
3 files changed +7
-10
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " bnc-notify" ,
3
- "version" : " 1.2.2 " ,
3
+ "version" : " 1.2.3 " ,
4
4
"description" : " Show web3 users realtime transaction notifications" ,
5
5
"keywords" : [
6
6
" ethereum" ,
Original file line number Diff line number Diff line change @@ -136,7 +136,7 @@ function init(options: InitOptions): API {
136
136
137
137
const emitter = createEmitter ( )
138
138
139
- const result = preflightTransaction ( options , emitter )
139
+ const result = preflightTransaction ( options , emitter ) . catch ( err => err )
140
140
141
141
return {
142
142
emitter,
Original file line number Diff line number Diff line change @@ -242,21 +242,16 @@ export function preflightTransaction(
242
242
emitter
243
243
} )
244
244
245
- resolve ( id )
246
-
247
245
// if not provided with sendTransaction function, resolve with id so dev can initiate transaction
248
246
// dev will need to call notify.hash(txHash, id) with this id to link up the preflight with the postflight notifications
249
247
if ( ! sendTransaction ) {
250
- return
248
+ return resolve ( id )
251
249
}
252
250
253
- // initiate transaction
254
- const sendTransactionResult = sendTransaction ( )
255
-
256
251
// get result and handle errors
257
252
let hash
258
253
try {
259
- hash = await sendTransactionResult
254
+ hash = await sendTransaction ( )
260
255
} catch ( error ) {
261
256
const { eventCode, errorMsg } = extractMessageFromError ( error )
262
257
@@ -324,8 +319,10 @@ export function preflightTransaction(
324
319
} )
325
320
}
326
321
} , txStallConfirmedTimeout )
322
+
323
+ resolve ( id )
327
324
} else {
328
- throw new Error (
325
+ reject (
329
326
'sendTransaction function must resolve to a transaction hash that is of type String.'
330
327
)
331
328
}
You can’t perform that action at this time.
0 commit comments