Skip to content

fix: delete expirer entry after proposal response #6738

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 11, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/plain-paws-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@walletconnect/sign-client": patch
"@walletconnect/core": patch
"@walletconnect/react-native-compat": patch
"@walletconnect/types": patch
"@walletconnect/utils": patch
"@walletconnect/ethereum-provider": patch
"@walletconnect/signer-connection": patch
"@walletconnect/universal-provider": patch
---

deletes expirer entry after the wallet responds to a session proposal
5 changes: 4 additions & 1 deletion packages/sign-client/src/controllers/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@
metadata: proposer.metadata,
});
await this.client.proposal.delete(id, getSdkError("USER_DISCONNECTED"));
this.client.core.expirer.del(id);
await this.client.core.pairing.activate({ topic: pairingTopic });
await this.setExpiry(sessionTopic, calcExpiry(SESSION_EXPIRY));
return {
Expand Down Expand Up @@ -515,8 +516,10 @@
error: reason,
rpcOpts: ENGINE_RPC_OPTS.wc_sessionPropose.reject,
});
await this.client.proposal.delete(id, getSdkError("USER_DISCONNECTED"));
}

await this.client.proposal.delete(id, getSdkError("USER_DISCONNECTED"));
this.client.core.expirer.del(id);
};

public update: IEngine["update"] = async (params) => {
Expand Down Expand Up @@ -930,7 +933,7 @@
const authenticateEventTarget = engineEvent("session_request", authenticateId);

// handle fallback session proposal response
const onSessionConnect = async ({ error, session }: any) => {

Check warning on line 936 in packages/sign-client/src/controllers/engine.ts

View workflow job for this annotation

GitHub Actions / code_style (lint)

Async arrow function has no 'await' expression
// cleanup listener for authenticate response
this.events.off(authenticateEventTarget, onAuthenticate);
if (error) reject(error);
Expand Down Expand Up @@ -2200,7 +2203,7 @@
}, 500);
};

private onSessionDeleteRequest: EnginePrivate["onSessionDeleteRequest"] = async (

Check warning on line 2206 in packages/sign-client/src/controllers/engine.ts

View workflow job for this annotation

GitHub Actions / code_style (lint)

Async method 'onSessionDeleteRequest' has no 'await' expression
topic,
payload,
) => {
Expand Down
4 changes: 4 additions & 0 deletions packages/sign-client/test/sdk/client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ describe("Sign Client Integration", () => {
expect(clients.B.metadata.redirect).to.exist;
expect(clients.B.metadata.redirect?.native).to.exist;
expect(clients.B.metadata.redirect?.universal).to.exist;
expect(clients.A.core.expirer.keys).to.deep.equal(clients.B.core.expirer.keys);
expect(clients.A.core.expirer.keys.length).to.eq(2);
expect(clients.B.core.expirer.keys.length).to.eq(2);

await deleteClients(clients);
});
it("should set scopedProperties in session", async () => {
Expand Down