diff --git a/packages/core/test/shared/ws.ts b/packages/core/test/shared/ws.ts index f852d029d..bb82bd8f5 100644 --- a/packages/core/test/shared/ws.ts +++ b/packages/core/test/shared/ws.ts @@ -1,18 +1,7 @@ -import { IJsonRpcConnection } from "@walletconnect/jsonrpc-utils"; import { IRelayer } from "@walletconnect/types"; -import EventEmitter from "events"; export async function disconnectSocket(relayer: IRelayer) { if (relayer.connected) { - relayer.provider.events = new EventEmitter(); - relayer.core.heartbeat.events = new EventEmitter(); - relayer.provider.connection.on("open", async () => { - await disconnect(relayer.provider.connection); - }); - await disconnect(relayer.provider.connection); + await relayer.transportClose(); } } - -function disconnect(socket: IJsonRpcConnection) { - return socket.close(); -} diff --git a/packages/sign-client/package.json b/packages/sign-client/package.json index 3d8b51033..707a33b6b 100644 --- a/packages/sign-client/package.json +++ b/packages/sign-client/package.json @@ -27,7 +27,7 @@ "test:concurrency": "vitest run --dir test/concurrency", "test:xregion": "vitest run --dir test/xregion", "test": "npm run test:pre; npm run test:run", - "test:ignoreUnhandled": "npm run test:pre; npm run test:run -- --dangerouslyIgnoreUnhandledErrors", + "test:ignoreUnhandled": "npm run test:pre; npm run test:run -- --dangerouslyIgnoreUnhandledErrors --no-threads", "test:canary": "vitest run --dir test/canary", "test:lifecycle": "vitest run --dir test/lifecycle", "canary": "npm run test:pre; npm run test:canary", diff --git a/packages/sign-client/src/controllers/engine.ts b/packages/sign-client/src/controllers/engine.ts index 32e39dc16..8cc53e0c0 100644 --- a/packages/sign-client/src/controllers/engine.ts +++ b/packages/sign-client/src/controllers/engine.ts @@ -94,6 +94,7 @@ export class Engine extends IEngine { } const publicKey = await this.client.core.crypto.generateKeyPair(); + const proposal = { requiredNamespaces, relays: relays ?? [{ protocol: RELAYER_DEFAULT_PROTOCOL }], @@ -131,6 +132,7 @@ export class Engine extends IEngine { } const id = await this.sendRequest(topic, "wc_sessionPropose", proposal); + const expiry = calcExpiry(FIVE_MINUTES); await this.setProposal(id, { id, expiry, ...proposal }); diff --git a/packages/sign-client/test/sdk/validation.spec.ts b/packages/sign-client/test/sdk/validation.spec.ts index 0d6834bc8..086bb8337 100644 --- a/packages/sign-client/test/sdk/validation.spec.ts +++ b/packages/sign-client/test/sdk/validation.spec.ts @@ -29,7 +29,6 @@ describe("Sign Client Validation", () => { let clients: Clients; beforeAll(async () => { clients = await initTwoClients(); - await testConnectMethod(clients); client = clients.A; pairingTopic = client.pairing.keys[0]; proposalId = client.proposal.keys[0]; @@ -459,7 +458,6 @@ describe("Sign Client Validation", () => { let clients: Clients; beforeAll(async () => { clients = await initTwoClients(); - await testConnectMethod(clients); client = clients.A; pairingTopic = client.pairing.keys[0]; proposalId = client.proposal.keys[0]; @@ -715,7 +713,6 @@ describe("Sign Client Validation", () => { let clients: Clients; beforeAll(async () => { clients = await initTwoClients(); - await testConnectMethod(clients); client = clients.A; pairingTopic = client.pairing.keys[0]; proposalId = client.proposal.keys[0]; @@ -860,7 +857,6 @@ describe("Sign Client Validation", () => { let clients: Clients; beforeAll(async () => { clients = await initTwoClients(); - await testConnectMethod(clients); client = clients.A; pairingTopic = client.pairing.keys[0]; proposalId = client.proposal.keys[0]; diff --git a/packages/sign-client/test/shared/values.ts b/packages/sign-client/test/shared/values.ts index c64a89bf5..7bd800e7a 100644 --- a/packages/sign-client/test/shared/values.ts +++ b/packages/sign-client/test/shared/values.ts @@ -6,9 +6,9 @@ export const TEST_RELAY_URL = process.env.TEST_RELAY_URL ? process.env.TEST_RELAY_URL : "ws://0.0.0.0:5555"; -export const TEST_RELAY_URL_US = "wss://us-east-1.relay.walletconnect.com/"; -export const TEST_RELAY_URL_EU = "wss://eu-central-1.relay.walletconnect.com/"; -export const TEST_RELAY_URL_AP = "wss://ap-southeast-1.relay.walletconnect.com/"; +export const TEST_RELAY_URL_US = "wss://us-east-1.relay.walletconnect.com"; +export const TEST_RELAY_URL_EU = "wss://eu-central-1.relay.walletconnect.com"; +export const TEST_RELAY_URL_AP = "wss://ap-southeast-1.relay.walletconnect.com"; // See https://github.com/WalletConnect/push-webhook-test-server export const TEST_WEBHOOK_ENDPOINT = "https://webhook-push-test.walletconnect.com/"; diff --git a/packages/sign-client/test/shared/ws.ts b/packages/sign-client/test/shared/ws.ts index 55c726231..6d2b9edf7 100644 --- a/packages/sign-client/test/shared/ws.ts +++ b/packages/sign-client/test/shared/ws.ts @@ -1,18 +1,7 @@ -import { IJsonRpcConnection } from "@walletconnect/jsonrpc-utils"; import { ICore } from "@walletconnect/types"; -import EventEmitter from "events"; export async function disconnectSocket(core: ICore) { if (core.relayer.connected) { - core.relayer.provider.events = new EventEmitter(); - core.relayer.core.heartbeat.events = new EventEmitter(); - core.relayer.provider.connection.on("open", async () => { - await disconnect(core.relayer.provider.connection); - }); - await disconnect(core.relayer.provider.connection); + await core.relayer.transportClose(); } } - -function disconnect(socket: IJsonRpcConnection) { - return socket.close(); -}