Skip to content

Commit 8701289

Browse files
committed
Improve MetaMask Disconnection
1 parent 9f21e1c commit 8701289

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Assets/Thirdweb/Runtime/Unity/Wallets/Core/MetaMaskWallet.cs

+11-3
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,18 @@ public Task<string> RecoverAddressFromTypedDataV4<T, TDomain>(T data, TypedData<
192192
throw new NotImplementedException();
193193
}
194194

195-
public Task Disconnect()
195+
public async Task Disconnect()
196196
{
197-
ThirdwebDebug.Log("Disconnecting has no effect on this wallet.");
198-
return Task.CompletedTask;
197+
try
198+
{
199+
_ = await WebGLMetaMask.Instance.RequestAsync<string>(
200+
new RpcRequest { Method = "wallet_revokePermissions", Params = new object[] { new Dictionary<string, object> { { "eth_accounts", new object() } } } }
201+
);
202+
}
203+
catch
204+
{
205+
// no-op
206+
}
199207
}
200208

201209
public Task<List<LinkedAccount>> LinkAccount(

0 commit comments

Comments
 (0)