Skip to content

Commit

Permalink
fix: prevent to reset previously validated accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
helciofranco committed Jan 7, 2025
1 parent 82b94ba commit 85c6bc2
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions packages/walletconnect-connector/src/WalletConnectConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,20 +261,30 @@ export class WalletConnectConnector extends PredicateConnector {
break;
case 'CONNECT_SUCCESS': {
const { addresses = [] } = getAccount(wagmiConfig);

let hasAccountToSign = false;
for (const address of addresses) {
if (await this.accountHasValidation(address)) {
continue;
}

hasAccountToSign = true;
this.storage.setItem(`SIGNATURE_VALIDATION_${address}`, 'pending');
}

const currentConnectorEvent: CustomCurrentConnectorEvent = {
type: this.events.currentConnector,
data: this,
metadata: {
pendingSignature: true,
},
};
if (hasAccountToSign) {
const currentConnectorEvent: CustomCurrentConnectorEvent = {
type: this.events.currentConnector,
data: this,
metadata: {
pendingSignature: true,
},
};

// Workaround to tell Connecting dialog that now we'll request signature
this.emit(this.events.currentConnector, currentConnectorEvent);
}

// Workaround to tell Connecting dialog that now we'll request signature
this.emit(this.events.currentConnector, currentConnectorEvent);
unsub();
break;
}
Expand Down

0 comments on commit 85c6bc2

Please sign in to comment.