Skip to content
This repository has been archived by the owner on Dec 26, 2024. It is now read-only.

Commit

Permalink
Handle user rejection in AbstractionProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
imduchuyyy committed Jul 10, 2024
1 parent a0e4729 commit d82d409
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ export class AbstractionProvider extends EventEmitter implements IProvider {
const handshakeResponse: Message =
await handshakePopup.sendRequestMessage(payload);

if (handshakeResponse.payload == "rejected") {
reject("User rejected the connection");
return
}

this.accounts = handshakeResponse.payload as Address[];

this.emit("connect", { chainId: "1" });
Expand All @@ -90,10 +95,13 @@ export class AbstractionProvider extends EventEmitter implements IProvider {
...args,
dappInfo,
};
console.log(payload);
const signResponse: Message = await signPopup.sendRequestMessage(
payload
);
if (signResponse.payload == "rejected") {
reject("User rejected the connection");
return
}
resolve(signResponse.payload);
});
},
Expand Down

0 comments on commit d82d409

Please sign in to comment.