Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
4ea8c2d
feat: added wallet connect integration via api
Vorobeyko Feb 2, 2026
d5b5106
feat: added wallet connect integration via api
Vorobeyko Feb 2, 2026
93fe671
feat: update BrowserContextService and BrowserService for WalletConne…
Vorobeyko Feb 3, 2026
2c12df5
fix: add missing param
Vorobeyko Feb 3, 2026
76921bf
fix: enhance WalletConnect integration and update dependencies
Vorobeyko Feb 3, 2026
cefadbe
fix: enhance WalletConnect integration and update dependencies
Vorobeyko Feb 3, 2026
74143e4
fix: enhance WalletConnect integration and update dependencies
Vorobeyko Feb 3, 2026
05fc396
feat: update approveTokenTx and nextRequest methods for improved Wall…
Vorobeyko Feb 3, 2026
374928f
feat: update approveTokenTx and nextRequest methods for improved Wall…
Vorobeyko Feb 3, 2026
74b3a05
feat: update assertTxAmount and assertReceiptAddress methods to retur…
Vorobeyko Feb 4, 2026
c042e31
feat: update assertTxAmount and assertReceiptAddress methods to retur…
Vorobeyko Feb 4, 2026
1145841
feat: enhance transaction request handling and validation methods in …
Vorobeyko Feb 4, 2026
561016a
feat: enhance WCSDKWallet to support wallet_watchAsset and getTokenBa…
Vorobeyko Feb 9, 2026
e3e835e
feat: enhance WCSDKWallet to support wallet_watchAsset and getTokenBa…
Vorobeyko Feb 9, 2026
c3cb994
feat: enhance WCSDKWallet to support wallet_watchAsset and getTokenBa…
Vorobeyko Feb 9, 2026
89fddcd
feat: enhance WCSDKWallet to support wallet_watchAsset and getTokenBa…
Vorobeyko Feb 9, 2026
c4e65a4
feat: update confirmAddTokenToWallet method to handle WCSessionReques…
Vorobeyko Feb 9, 2026
a910cac
feat: add processed flag to WCSessionRequest and prevent reprocessing…
Vorobeyko Feb 9, 2026
4cee8a1
feat: update WC_SDK_COMMON_CONFIG to correct CONNECTED_WALLET_NAME
Vorobeyko Feb 9, 2026
2bad439
feat: refactor confirmTx and cancelTx methods to remove WCSessionRequ…
Vorobeyko Feb 10, 2026
8bc2054
feat: add cancelAllTxRequests method to WCSDKWallet for batch transac…
Vorobeyko Feb 10, 2026
e22cc85
feat: add cancelAllTxRequests method to WCSDKWallet for batch transac…
Vorobeyko Feb 10, 2026
b86f9ed
feat: setup fork
Vorobeyko Feb 11, 2026
b652178
feat: setup add/change network for wc
Vorobeyko Feb 11, 2026
d100d42
feat: setup add/change network for wc
Vorobeyko Feb 11, 2026
aea5079
feat: setup network for fork
Vorobeyko Feb 11, 2026
7a56cfa
feat: refactoring all code
Vorobeyko Feb 12, 2026
7d03734
feat: refactoring all code
Vorobeyko Feb 12, 2026
1aaeb98
feat: rename nextRequest to waitForTransaction in WCSDKWallet
Vorobeyko Feb 16, 2026
2f6622c
feat: update WC_SDK_COMMON_CONFIG and modify CommonWalletConfig struc…
Vorobeyko Feb 16, 2026
2b74b33
feat: refactor WCSDKWallet to streamline timeout and namespace handling
Vorobeyko Feb 16, 2026
bfffabd
feat: update walletConnect exports for improved structure
Vorobeyko Feb 16, 2026
3e4d5d6
Merge remote-tracking branch 'origin/main' into feat/add-wc-wallet
Vorobeyko Feb 19, 2026
f3737ac
Merge remote-tracking branch 'origin/feat/wait-for-tx' into feat/add-…
Vorobeyko Feb 19, 2026
48ce26f
feat: update walletConnect configuration and enhance request handling…
Vorobeyko Feb 19, 2026
2ab335d
Merge remote-tracking branch 'origin/feat/wait-for-tx' into feat/add-…
Vorobeyko Feb 20, 2026
207d8b9
feat: remove waitForTransaction method and refactor request handling …
Vorobeyko Feb 20, 2026
5d85637
feat: add getWalletAddress method to retrieve wallet address
Vorobeyko Feb 20, 2026
60a1301
feat: integrate Playwright test steps for improved request handling i…
Vorobeyko Feb 25, 2026
eaa735d
feat: refactor wallet handling by renaming WCSDKWallet to WCWallet an…
Vorobeyko Feb 25, 2026
f34de8b
feat: update walletconnect reference and introduce Accounts class for…
Vorobeyko Feb 26, 2026
8e0b55a
feat: refactor account handling in wallet methods to use currentAccount
Vorobeyko Feb 26, 2026
2ab89c9
feat: improve flow with accounts
Vorobeyko Feb 26, 2026
fc11bd1
feat: add wallet_getCapabilities method handling and update imports
Vorobeyko Feb 26, 2026
d678468
feat: implement changeWalletAccountByAddress method and update active…
Vorobeyko Feb 26, 2026
cd5a06f
feat: refactor setupNetwork method to remove async and improve networ…
Vorobeyko Feb 26, 2026
868dee4
feat: simplify wallet account handling by removing WALLET_TYPE check …
Vorobeyko Feb 26, 2026
7037a94
feat: replace console logging with ConsoleLogger for improved logging…
Vorobeyko Feb 26, 2026
271208c
feat: update WCWallet to support wallet_switchEthereumChain event han…
Vorobeyko Feb 27, 2026
269ae83
feat: enhance logging in NetworkSettings and add personal_sign method
Vorobeyko Mar 2, 2026
7510afc
feat: enhance WCWallet and NetworkSettings to support chain managemen…
Vorobeyko Mar 3, 2026
c4f559e
feat: enhance WCWallet and NetworkSettings to support chain managemen…
Vorobeyko Mar 3, 2026
3502202
feat: ensure wallet addresses are stored in a case-insensitive manner
Vorobeyko Mar 3, 2026
0d68ee0
feat: refactor session request handling in WCWallet for improved clar…
Vorobeyko Mar 3, 2026
30f2a29
feat: add clear method to RequestManager for resetting internal state
Vorobeyko Mar 3, 2026
aaa0f4e
feat: bind session request handlers to maintain context in WCWallet
Vorobeyko Mar 4, 2026
b81228d
feat: remove unused cancelAllTxRequests method from WCWallet
Vorobeyko Mar 4, 2026
2e8f5ae
feat: enhance personal_sign method with improved error handling and r…
Vorobeyko Mar 4, 2026
fee7846
feat: simplify request handling and improve RPC URLs in constants
Vorobeyko Mar 13, 2026
36e82fa
Merge remote-tracking branch 'origin/main' into feat/add-wc-wallet-wi…
Vorobeyko Mar 13, 2026
8f68026
feat: add optional chaining for walletConfig and update Avalanche RPC…
Vorobeyko Mar 13, 2026
a9d6f71
feat: add optional chaining for walletConfig in wallet setup
Vorobeyko Mar 13, 2026
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
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
"branches": [
"main",
{
"name": "develop",
"channel": "alpha",
"prerelease": "alpha"
"name": "feat/add-wc-wallet-without-wait",
"channel": "alpha-add-wc-wallet-without-wait",
"prerelease": "alpha-add-wc-wallet-without-wait"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion packages/browser-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@
"peerDependencies": {
"@playwright/test": "^1.51.1"
}
}
}
2 changes: 2 additions & 0 deletions packages/browser-service/src/browser.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
SafeIframePage,
SafeWcPage,
TrustWalletPage,
WCWallet,
} from '@lidofinance/wallets-testing-wallets';

export const WALLET_PAGES = {
Expand All @@ -24,6 +25,7 @@ export const WALLET_PAGES = {
bitget: BitgetPage,
safeWc: SafeWcPage,
safeIframe: SafeIframePage,
walletconnect: WCWallet,
};

export const DEFAULT_BROWSER_CONTEXT_DIR_NAME = '.browser_context';
52 changes: 32 additions & 20 deletions packages/browser-service/src/browser.context.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export type BrowserOptions = {
type OptionsBrowserContext = {
// If contextDataDir is undefined - will be created temp dir for context data.
// Else contextDataDir is not undefined - will be created user dir for context data in current folder.
contextDataDir: string;
contextDataDir?: string;
browserOptions?: BrowserOptions;
};

Expand All @@ -41,7 +41,7 @@ export class BrowserContextService {
private readonly logger = new ConsoleLogger(BrowserContextService.name);

constructor(
public walletExtensionStartPath: string,
public walletExtensionStartPath: string | null,
public options: OptionsBrowserContext,
) {
this.defaultBrowserOptions = {
Expand All @@ -50,7 +50,9 @@ export class BrowserContextService {
args: [
'--lang=en-US',
'--disable-dev-shm-usage',
`--disable-extensions-except=${this.walletExtensionStartPath}`,
this.walletExtensionStartPath
? `--disable-extensions-except=${this.walletExtensionStartPath}`
: '',
'--js-flags="--max-old-space-size=2048"',
],
permissions: ['clipboard-read', 'clipboard-write'],
Expand All @@ -63,10 +65,6 @@ export class BrowserContextService {
}

async initBrowserContext() {
this.logger.debug(
`Starting a new browser context (temp context: ${!this.options
.contextDataDir})`,
);
let browserContextPath = '';

if (this.options.contextDataDir) {
Expand All @@ -80,21 +78,33 @@ export class BrowserContextService {
});
}

this.logger.debug(
`Starting a new browser context (temp context: ${browserContextPath})`,
);

let attemptsLeft = 3;
while (attemptsLeft > 0) {
try {
this.browserContext = await chromium.launchPersistentContext(
browserContextPath,
{
...this.options.browserOptions,
timeout: 5000,
},
);
break;
if (this.walletExtensionStartPath) {
this.browserContext = await chromium.launchPersistentContext(
browserContextPath,
{
...this.options.browserOptions,
timeout: 5000,
},
);
break;
} else {
const browser = await chromium.launch(this.options.browserOptions);
this.browserContext = await browser.newContext();
break;
}
} catch (er) {
attemptsLeft--;
if (attemptsLeft == 0)
throw new Error(`Failed to launch persistent context: ${er}`);
throw new Error(
`Failed to launch browser with persistent context or new context: ${er}`,
);
}
}

Expand All @@ -111,10 +121,12 @@ export class BrowserContextService {
await this.browserContext.addCookies(this.options.browserOptions.cookies);
}

let [background] = this.browserContext.serviceWorkers();
if (!background)
background = await this.browserContext.waitForEvent('serviceworker');
this.extensionId = background.url().split('/')[2];
if (this.walletExtensionStartPath) {
let [background] = this.browserContext.serviceWorkers();
if (!background)
background = await this.browserContext.waitForEvent('serviceworker');
this.extensionId = background.url().split('/')[2];
}
}

async closePages() {
Expand Down
64 changes: 44 additions & 20 deletions packages/browser-service/src/browser.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,30 @@ export class BrowserService {
}

async setup() {
const extensionService = new ExtensionService();
let extensionPath, extensionService, contextDataDir;

const extensionPath = await extensionService.getExtensionDirFromId(
this.options.walletConfig.STORE_EXTENSION_ID,
this.options.walletConfig.LATEST_STABLE_DOWNLOAD_LINK,
);
if (this.options.walletConfig?.STORE_EXTENSION_ID) {
extensionService = new ExtensionService();

extensionPath = await extensionService.getExtensionDirFromId(
this.options.walletConfig.STORE_EXTENSION_ID,
this.options.walletConfig.LATEST_STABLE_DOWNLOAD_LINK,
);

contextDataDir = `${DEFAULT_BROWSER_CONTEXT_DIR_NAME}_${
mnemonicToAccount(this.options.accountConfig.SECRET_PHRASE).address
}_isFork-${this.isFork}_${this.options.walletConfig.WALLET_NAME}`;
}

const contextDataDir = `${DEFAULT_BROWSER_CONTEXT_DIR_NAME}_${
mnemonicToAccount(this.options.accountConfig.SECRET_PHRASE).address
}_isFork-${this.isFork}_${this.options.walletConfig.WALLET_NAME}`;
this.browserContextService = new BrowserContextService(extensionPath, {
contextDataDir,
browserOptions: this.options.browserOptions,
});

await this.browserContextService.initBrowserContext();
await this.annotateExtensionWalletVersion(extensionService);
if (this.options.walletConfig?.STORE_EXTENSION_ID) {
await this.annotateExtensionWalletVersion(extensionService);
}
this.setWalletPage();
await this.walletPage.setup();
}
Expand All @@ -146,15 +153,16 @@ export class BrowserService {
}

private setWalletPage() {
const extension = new Extension(this.browserContextService.extensionId);
const extensionWalletPage = new WALLET_PAGES[
this.options.walletConfig.EXTENSION_WALLET_NAME
]({
browserContext: this.browserContextService.browserContext,
extensionUrl: extension.url,
accountConfig: this.options.accountConfig,
walletConfig: this.options.walletConfig,
});
const buildExtensionWalletPage = () => {
const extension = new Extension(this.browserContextService.extensionId);

return new WALLET_PAGES[this.options.walletConfig.EXTENSION_WALLET_NAME]({
browserContext: this.browserContextService.browserContext,
extensionUrl: extension.url,
accountConfig: this.options.accountConfig,
walletConfig: this.options.walletConfig,
});
};

switch (this.options.walletConfig.WALLET_TYPE) {
case WalletConnectTypes.WC:
Expand All @@ -163,8 +171,24 @@ export class BrowserService {
this.options.walletConfig.WALLET_NAME
]({
browserContext: this.browserContextService.browserContext,
extensionPage: extensionWalletPage,
extensionPage: buildExtensionWalletPage(),
walletConfig: this.options.walletConfig,
standConfig: {
chainId: this.options.networkConfig.chainId,
standUrl: this.options.standUrl,
rpcUrl:
this.ethereumNodeService?.state.nodeUrl ||
this.options.networkConfig.rpcUrl,
},
});
break;
case WalletConnectTypes.WC_SDK:
this.walletPage = new WALLET_PAGES[
this.options.walletConfig.WALLET_NAME
]({
browserContext: this.browserContextService.browserContext,
walletConfig: this.options.walletConfig,
accountConfig: this.options.accountConfig,
standConfig: {
chainId: this.options.networkConfig.chainId,
standUrl: this.options.standUrl,
Expand All @@ -175,7 +199,7 @@ export class BrowserService {
});
break;
default:
this.walletPage = extensionWalletPage;
this.walletPage = buildExtensionWalletPage();
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/pg-reporter/src/reportRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export class ReporterRuntime {
});
}

const suite = suiteStats.get(suiteKey)!;
const suite = suiteStats.get(suiteKey);
suite.total++;

if (testCase.status === 'passed') suite.passed++;
Expand Down
1 change: 1 addition & 0 deletions packages/wallets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"access": "public"
},
"dependencies": {
"@walletconnect/sign-client": "2.23.4",
"big.js": "^6.2.1",
"expect": "^28.1.3",
"reflect-metadata": "^0.1.13",
Expand Down
1 change: 1 addition & 0 deletions packages/wallets/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export * from './exodus';
export * from './okx';
export * from './bitget';
export * from './ctrl';
export * from './walletConnect';

// export WC and IFRAME WalletConnectTypes
export * from './safe';
47 changes: 47 additions & 0 deletions packages/wallets/src/walletConnect/components/accounts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { ConsoleLogger } from '@nestjs/common';
import { Account } from 'viem';

const logger = new ConsoleLogger('WCWallet.Accounts');

export class Accounts {
private activeAccount: Account;
private accountsStore: Map<string, Account> = new Map();

async isWalletAddressExist(address: string): Promise<boolean> {
return this.accountsStore.has(address.toLowerCase());
}

setActiveAccount(account: Account) {
if (!this.accountsStore.has(account.address.toLowerCase())) {
logger.warn(
`Account ${account.address} not found in accounts list while setting active account, adding it to accounts list`,
);
this.storeAccount(account);
}
this.activeAccount = account;
}

getActiveAccount() {
if (!this.activeAccount) {
throw new Error('Active account is not set');
}
return this.activeAccount;
}

getEip115Account(chainId: number, address: string): string {
return `eip155:${chainId}:${address}`;
}

storeAccount(account: Account) {
if (!this.accountsStore.has(account.address.toLowerCase())) {
this.accountsStore.set(account.address.toLowerCase(), account);
}
}

getAccountByAddress(address: string) {
const account = this.accountsStore.get(address.toLowerCase());

if (!account) throw new Error(`Account with address ${address} not found`);
return account;
}
}
3 changes: 3 additions & 0 deletions packages/wallets/src/walletConnect/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './network';
export * from './requestManager';
export * from './accounts';
Loading
Loading