Skip to content

Commit

Permalink
feat: the WalletAccount handle changed channel
Browse files Browse the repository at this point in the history
  • Loading branch information
tabaktoni committed Mar 18, 2024
1 parent 0dfb5db commit 73603e1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/wallet/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ export class WalletAccount extends Account implements AccountInterface {
this.address = res[0].toLowerCase();
});

// Throw Error on Network change
// Update Channel chainId on Network change
this.walletProvider.on('networkChanged', (res) => {
if (!res) return;
throw Error('WalletAccount doest support switching chains');
// Determine is it better to set chainId or replace channel with new one
// At the moment channel is stateless but it could change
this.channel.setChainId(res as StarknetChainId);
});

// Get and Set Address !!! Post constructor initial empty string
Expand Down

0 comments on commit 73603e1

Please sign in to comment.