@formo/analytics 2.0.0-alpha.1 → 2.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formo/analytics",
3
- "version": "2.0.0-alpha.1",
3
+ "version": "2.0.0-alpha.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/getformo/sdk.git"
@@ -40,6 +40,7 @@ export class FormoAnalytics implements IFormoAnalytics {
40
40
 
41
41
  const provider = window?.ethereum || window.web3?.currentProvider;
42
42
  if (provider) {
43
+ console.log('FormoAnalytics: Provider is set');
43
44
  this.trackProvider(provider);
44
45
  }
45
46
  }
@@ -366,7 +367,10 @@ export class FormoAnalytics implements IFormoAnalytics {
366
367
 
367
368
  private async onAccountsChanged(accounts: string[]) {
368
369
  if (accounts.length > 0) {
369
- this.handleAccountConnected(accounts[0]);
370
+ const newAccount = accounts[0];
371
+ if (newAccount !== this.currentConnectedAccount) {
372
+ this.handleAccountConnected(newAccount);
373
+ }
370
374
  } else {
371
375
  this.handleAccountDisconnected();
372
376
  }
@@ -455,7 +459,7 @@ export class FormoAnalytics implements IFormoAnalytics {
455
459
 
456
460
  this.currentChainId = await this.getCurrentChainId();
457
461
 
458
- return this.connect({ chainId: this.currentChainId, address: account });
462
+ this.connect({ chainId: this.currentChainId, address: account });
459
463
  }
460
464
 
461
465
  private async getCurrentWallet() {