Skip to content

Commit cdf22cc

Browse files
authored
Merge pull request #225 from blocknative/develop
Release 1.3.2
2 parents 75d74b9 + ec13054 commit cdf22cc

File tree

4 files changed

+574
-279
lines changed

4 files changed

+574
-279
lines changed

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bnc-onboard",
3-
"version": "1.3.1",
3+
"version": "1.3.2",
44
"description": "Onboard users to web3 by allowing them to select a wallet, get that wallet ready to transact and have access to synced wallet state.",
55
"keywords": [
66
"ethereum",
@@ -28,7 +28,6 @@
2828
"@rollup/plugin-image": "^2.0.4",
2929
"@rollup/plugin-json": "^4.0.0",
3030
"@rollup/plugin-node-resolve": "^7.1.1",
31-
"@types/lodash.debounce": "^4.0.6",
3231
"@types/node": "^13.5.1",
3332
"babel-plugin-external-helpers": "^6.18.0",
3433
"rimraf": "^3.0.0",
@@ -47,11 +46,10 @@
4746
"@walletconnect/web3-provider": "^1.0.0-beta.45",
4847
"authereum": "^0.0.4-beta.88",
4948
"bignumber.js": "^9.0.0",
50-
"bnc-sdk": "1.0.3",
49+
"bnc-sdk": "1.1.0",
5150
"bowser": "^2.5.2",
5251
"ethereumjs-tx": "^2.1.2",
5352
"fortmatic": "^0.8.2",
54-
"lodash.debounce": "^4.0.8",
5553
"regenerator-runtime": "^0.13.3",
5654
"squarelink": "^1.1.4",
5755
"trezor-connect": "7.0.1",

rollup.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ export default {
5656
'squarelink',
5757
'authereum',
5858
'@toruslabs/torus-embed',
59-
'lodash.debounce',
6059
'regenerator-runtime/runtime',
6160
'trezor-connect',
6261
'ethereumjs-tx',

src/stores.ts

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { getBlocknative } from './services'
22
import { writable, derived, get } from 'svelte/store'
3-
import debounce from 'lodash.debounce'
43
import { wait, makeCancelable } from './utilities'
54
import { validateWalletInterface, validateType } from './validation'
65
import {
@@ -255,31 +254,36 @@ function createBalanceStore(initialState: string | null): BalanceStore {
255254
if (emitterAddress !== $address) {
256255
const blocknative = getBlocknative()
257256

257+
// unsubscribe from previous address
258+
if (emitterAddress) {
259+
blocknative.unsubscribe(blocknative.clientIndex, emitterAddress)
260+
}
261+
258262
emitter = blocknative.account(blocknative.clientIndex, $address)
259263
.emitter
260264

261-
emitter.on(
262-
'txConfirmed',
263-
debounce(() => {
264-
if (stateSyncer.get) {
265-
cancel = syncStateWithTimeout({
266-
getState: stateSyncer.get,
267-
setState: set,
268-
timeout: 2000,
269-
currentBalance: get(balance),
270-
pollStart: Date.now()
271-
})
272-
}
273-
274-
return false
275-
}, 500)
276-
)
277-
278-
emitter.on('all', () => false)
265+
emitter.on('txConfirmed', () => {
266+
if (stateSyncer.get) {
267+
cancel = syncStateWithTimeout({
268+
getState: stateSyncer.get,
269+
setState: set,
270+
timeout: 2000,
271+
currentBalance: get(balance),
272+
pollStart: Date.now()
273+
})
274+
}
275+
276+
return false
277+
})
279278

280279
emitterAddress = $address
281280
}
282281
} else if (emitterAddress && !$address) {
282+
const blocknative = getBlocknative()
283+
284+
// unsubscribe from previous address
285+
blocknative.unsubscribe(blocknative.clientIndex, emitterAddress)
286+
283287
// no address, so set balance to undefined
284288
set && set(undefined)
285289
emitterAddress = undefined

0 commit comments

Comments
 (0)