Skip to content

Commit

Permalink
add 'accountsChanged' listener
Browse files Browse the repository at this point in the history
  • Loading branch information
ecioppettini committed Apr 30, 2024
1 parent c28b343 commit a90bb0c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/paima-sdk/paima-providers/src/mina.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ export class MinaConnector implements IConnector<MinaApi>, IInjectedConnector<Mi
}

this.provider = await MinaProvider.init(gameInfo, conn);

conn.api.on('accountsChanged', accounts => {
if (!accounts || !accounts[0] || accounts[0] !== this.provider?.address) {
this.provider = undefined;
}
});

return this.provider;
};
getProvider = (): undefined | MinaProvider => {
Expand Down

0 comments on commit a90bb0c

Please sign in to comment.