Skip to content

Commit

Permalink
fix issue with walletSelector calling wallet() when it isnt ready still
Browse files Browse the repository at this point in the history
  • Loading branch information
wpdas committed Feb 9, 2024
1 parent bd5987b commit 0179f22
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wpdas/naxios",
"version": "2.0.0",
"version": "2.0.1",
"description": "Promise based NEAR Contract and NEAR Wallet client for browser",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down
22 changes: 12 additions & 10 deletions src/managers/wallet-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,21 @@ export class WalletManager {

private async setupData() {
// Initialize Wallet
const wallet = await this.walletSelector.wallet()
this.wallet = wallet
if (this.walletSelector) {
const wallet = await this.walletSelector.wallet()
this.wallet = wallet

const walletState = this.walletSelector.store.getState()
const accounts = walletState.accounts
this.accounts = accounts
const walletState = this.walletSelector.store.getState()
const accounts = walletState.accounts
this.accounts = accounts

// Set main account Id
this.accountId = accounts[0].accountId
// Set main account Id
this.accountId = accounts[0].accountId

// Others
this.recentlySignedInWallets = walletState.recentlySignedInWallets
this.selectedWalletId = walletState.selectedWalletId
// Others
this.recentlySignedInWallets = walletState.recentlySignedInWallets
this.selectedWalletId = walletState.selectedWalletId
}
}

/**
Expand Down

0 comments on commit 0179f22

Please sign in to comment.