Skip to content

Commit 8c5c37b

Browse files
authored
Merge pull request #266 from blocknative/enhancement/upgrade-sdk
Upgrade to version 2.0.0 of sdk. Closes #265
2 parents 996d872 + e6f9163 commit 8c5c37b

File tree

4 files changed

+528
-205
lines changed

4 files changed

+528
-205
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"@walletconnect/web3-provider": "^1.0.0-beta.45",
4747
"authereum": "^0.0.4-beta.88",
4848
"bignumber.js": "^9.0.0",
49-
"bnc-sdk": "1.1.0",
49+
"bnc-sdk": "2.0.0",
5050
"bowser": "^2.5.2",
5151
"ethereumjs-tx": "^2.1.2",
5252
"ethereumjs-util": "^6.2.0",

src/services.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import blocknativeApi from 'bnc-sdk'
1+
import BlocknativeApi from 'bnc-sdk'
22

33
let blocknative: any
44

55
export function initializeBlocknative(dappId: string, networkId: number): any {
6-
blocknative = blocknativeApi({
6+
blocknative = new BlocknativeApi({
77
dappId,
8-
networkId
8+
networkId,
9+
name: 'Onboard'
910
})
1011

1112
return blocknative

src/stores.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,10 @@ function createBalanceStore(initialState: string | null): BalanceStore {
271271

272272
// unsubscribe from previous address
273273
if (emitterAddress) {
274-
blocknative.unsubscribe(blocknative.clientIndex, emitterAddress)
274+
blocknative.unsubscribe(emitterAddress)
275275
}
276276

277-
emitter = blocknative.account(blocknative.clientIndex, $address)
278-
.emitter
277+
emitter = blocknative.account($address).emitter
279278

280279
emitter.on('txConfirmed', () => {
281280
if (stateSyncer.get) {
@@ -297,7 +296,7 @@ function createBalanceStore(initialState: string | null): BalanceStore {
297296
const blocknative = getBlocknative()
298297

299298
// unsubscribe from previous address
300-
blocknative.unsubscribe(blocknative.clientIndex, emitterAddress)
299+
blocknative.unsubscribe(emitterAddress)
301300

302301
// no address, so set balance to undefined
303302
set && set(undefined)

0 commit comments

Comments
 (0)