Skip to content

Commit

Permalink
fix: updateAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
isordo committed Nov 1, 2023
1 parent e631ee0 commit b31ae94
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 22 deletions.
3 changes: 1 addition & 2 deletions packages/beacon-core/src/transports/clients/ClientEvents.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export const enum ClientEvents {
CLOSE_ALERT = 'CLOSE_ALERT',
RESET_STATE = 'RESET_STATE',
WC_ACK_NOTIFICATION = 'WC_ACK_NOTIFICATION',
UPDATE_ACCOUNT = 'UPDATE_ACCOUNT',
WC_ACK_NOTIFICATION = 'WC_ACK_NOTIFICATION'
}
17 changes: 0 additions & 17 deletions packages/beacon-dapp/src/dapp-client/DAppClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,23 +431,6 @@ export class DAppClient extends Client {
ClientEvents.WC_ACK_NOTIFICATION,
this.wcToastHandler.bind(this)
)
this.walletConnectTransport.setEventHandler(
ClientEvents.UPDATE_ACCOUNT,
this.updateActiveAccountHandler.bind(this)
)
}

private async updateActiveAccountHandler(address?: string) {
if (address && this._activeAccount.isResolved()) {
const activeAccount = await this._activeAccount.promise

const account = {
...activeAccount,
address
} as AccountInfo

await this.setActiveAccount(account)
}
}

private async wcToastHandler() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,6 @@ export class WalletConnectCommunicationClient extends CommunicationClient {
throw new Error('Public key for the new account not provided')
}

const fun = this.eventHandlers.get(ClientEvents.UPDATE_ACCOUNT)
fun && fun(this.activeAccount)

this.notifyListeners(session.pairingTopic, {
id: await generateGUID(),
type: BeaconMessageType.ChangeAccountRequest,
Expand Down

0 comments on commit b31ae94

Please sign in to comment.