-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix an issue where solana is disconnected when trust evm wallet …
…is disconnected
- Loading branch information
Showing
2 changed files
with
24 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@node-real/walletkit': patch | ||
--- | ||
|
||
Fix an issue where solana is disconnected when trust evm wallet is disconnected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,8 @@ export type InjectedParameters = { | |
// Regex of wallets/providers that can accurately simulate contract calls & display contract revert reasons. | ||
const supportsSimulationIdRegex = /(rabby|trustwallet)/; | ||
|
||
const notRevokePermissionWallets = ['trust']; | ||
|
||
const targetMap = { | ||
coinbaseWallet: { | ||
id: 'coinbaseWallet', | ||
|
@@ -264,20 +266,23 @@ export function injected(parameters: InjectedParameters = {}) { | |
try { | ||
// Adding timeout as not all wallets support this method and can hang | ||
// https://github.com/wevm/wagmi/issues/4064 | ||
await withTimeout( | ||
() => | ||
// TODO: Remove explicit type for viem@3 | ||
provider.request<{ | ||
Method: 'wallet_revokePermissions'; | ||
Parameters: [permissions: { eth_accounts: Record<string, any> }]; | ||
ReturnType: null; | ||
}>({ | ||
// `'wallet_revokePermissions'` added in `[email protected]` | ||
method: 'wallet_revokePermissions', | ||
params: [{ eth_accounts: {} }], | ||
}), | ||
{ timeout: 100 }, | ||
); | ||
|
||
if (!notRevokePermissionWallets.includes(this.id)) { | ||
await withTimeout( | ||
() => | ||
// TODO: Remove explicit type for viem@3 | ||
provider.request<{ | ||
Method: 'wallet_revokePermissions'; | ||
Parameters: [permissions: { eth_accounts: Record<string, any> }]; | ||
ReturnType: null; | ||
}>({ | ||
// `'wallet_revokePermissions'` added in `[email protected]` | ||
method: 'wallet_revokePermissions', | ||
params: [{ eth_accounts: {} }], | ||
}), | ||
{ timeout: 100 }, | ||
); | ||
} | ||
} catch {} | ||
|
||
// Add shim signalling connector is disconnected | ||
|