Skip to content

feat: added WalletConnect integration for improve tests speed#361

Open
Vorobeyko wants to merge 62 commits intomainfrom
feat/add-wc-wallet-without-wait
Open

feat: added WalletConnect integration for improve tests speed#361
Vorobeyko wants to merge 62 commits intomainfrom
feat/add-wc-wallet-without-wait

Conversation

@Vorobeyko
Copy link
Contributor

No description provided.

@Vorobeyko Vorobeyko changed the title Feat/add wc wallet without wait feat: added wallet connect integration for improve tests speed Mar 4, 2026
@@ -7,16 +17,20 @@ export interface CommonWalletConfig {
WALLET_TYPE: WalletConnectType;
LATEST_STABLE_DOWNLOAD_LINK?: string; // Link to stable wallet extension version for test (optional)
EXTENSION_START_PATH: string; // Start path for wallet setup
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is I'm correct that at this point of implementation WC direct connection EXTENSION_START_PATH also should be optional?

import type { WCSessionRequest } from '../components';
import type { WCWallet } from '../wc.service';

const isAddr = (v: unknown) => /^0x[a-fA-F0-9]{40}$/.test(String(v));
Copy link
Contributor

@itaven itaven Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better use

import { isAddress } from 'viem';

const isAddr = (v: unknown) => isAddress(String(v));

Also is it expected that address has unknown type?

Comment on lines +148 to +155
let proposal;
await test.step(`Pairing`, async () => {
[proposal] = await Promise.all([
this.waitForProposalOnce(this.defaultTimeoutMs),
this.signClient.core.pairing.pair({ uri }),
]);
});
const { id, params } = proposal;
Copy link
Contributor

@itaven itaven Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to use if no cons

      const proposal = await test.step('Pairing', async () => {
        const [proposal] = await Promise.all([
          this.waitForProposalOnce(this.defaultTimeoutMs),
          this.signClient.core.pairing.pair({ uri }),
        ]);

        return proposal;
      });

      const { id, params } = proposal;

async validateRequest(
req: WCSessionRequest,
): Promise<WCSessionRequest | undefined> {
// @todo: think about it, i think its bullshit
Copy link
Contributor

@itaven itaven Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain root of the comment pls?
As i see it's used by

const currentPendingRequest = this.pendings[0];
->
if (currentPendingRequest) {
      return this.validateRequest(currentPendingRequest);
    }
->
    // @todo: think about it, i think its bullshit
    if (req.processed) {

If request is pending he can be in processed state?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed it

async changeNetwork(networkName: string): Promise<void> {
await test.step(`Change network to ${networkName}`, async () => {
const chain = await this.networkSettings.changeNetwork(networkName);
this.rebuildViemClients(chain);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing await

}

private async rebuildViemClients(chain: Chain) {
test.step(`Rebuild Viem clients for chain ${chain.id}`, async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing await

const net =
this.networkSettings.networksByChainId.get(chain.id) ||
this.options.standConfig;
if (net?.rpcUrl) {
Copy link
Contributor

@itaven itaven Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: net might be a bit ambiguous. Maybe networkConfig (or similar) would make the intent clearer.

Comment on lines +522 to +523
this.walletClient = null;
this.publicClient = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain why do you need to set this.walletClient && this.publicClient to null? Where it should be inited? I see updateAllSessionsNamespaces after rebuildViemClients but for me it's confuised

@jake4take jake4take changed the title feat: added wallet connect integration for improve tests speed feat: added WalletConnect integration for improve tests speed Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants