Skip to content

Commit 95673ad

Browse files
committed
drop the enum, match type from GetLinkedAccounts
1 parent d8d1432 commit 95673ad

File tree

6 files changed

+8
-39
lines changed

6 files changed

+8
-39
lines changed

Thirdweb.Console/Program.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -260,24 +260,16 @@
260260
// var oldLinkedAccounts = await inAppWalletMain.GetLinkedAccounts();
261261
// Console.WriteLine($"Old linked accounts: {JsonConvert.SerializeObject(oldLinkedAccounts, Formatting.Indented)}");
262262

263-
// External wallet variant
263+
// // External wallet variant
264264
// var externalWallet = await PrivateKeyWallet.Generate(client: client);
265265
// var externalWalletAddress = await externalWallet.GetAddress();
266266
// var inAppWalletToLink = await InAppWallet.Create(client: client, authProvider: AuthProvider.Siwe, siweSigner: externalWallet);
267267
// _ = await inAppWalletMain.LinkAccount(walletToLink: inAppWalletToLink, chainId: 421614);
268268

269-
// Email variant
270-
// var linkedEmail = "firekeeper+unlinkingtest@thirdweb.com";
271-
// var inAppWalletToLink = await InAppWallet.Create(client: client, email: linkedEmail);
272-
// await inAppWalletToLink.SendOTP();
273-
// Console.WriteLine("Enter OTP:");
274-
// var otp = Console.ReadLine();
275-
// _ = await inAppWalletMain.LinkAccount(walletToLink: inAppWalletToLink, otp: otp);
276-
277269
// var linkedAccounts = await inAppWalletMain.GetLinkedAccounts();
278270
// Console.WriteLine($"Linked accounts: {JsonConvert.SerializeObject(linkedAccounts, Formatting.Indented)}");
279271

280-
// var unlinkingResult = await inAppWalletMain.UnlinkAccount(authProviderToUnlink: UnlinkingType.email, email: linkedEmail);
272+
// var unlinkingResult = await inAppWalletMain.UnlinkAccount(linkedType: "siwe", address: externalWalletAddress);
281273
// Console.WriteLine($"Unlinking result: {JsonConvert.SerializeObject(unlinkingResult, Formatting.Indented)}");
282274

283275
#endregion

Thirdweb/Thirdweb.Wallets/IThirdwebWallet.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@ Task<List<LinkedAccount>> LinkAccount(
158158
/// <summary>
159159
/// Unlinks an account (auth method) from the current wallet. Must pass corresponding parameter to unlink.
160160
/// </summary>
161-
/// <param name="authProviderToUnlink">The auth provider to unlink.</param>
161+
/// <param name="linkedType">The auth provider to unlink, use the type you get from GetLinkedAccounts.</param>
162162
/// <param name="address">The related wallet address to unlink (if applicable).</param>
163163
/// <param name="email">The related email to unlink (if applicable).</param>
164164
/// <param name="phone">The related phone number to unlink (if applicable).</param>
165165
/// <param name="id">The related user ID to unlink (if applicable).</param>
166-
Task<List<LinkedAccount>> UnlinkAccount(UnlinkingType authProviderToUnlink, string address = null, string email = null, string phone = null, string id = null);
166+
Task<List<LinkedAccount>> UnlinkAccount(string linkedType, string address = null, string email = null, string phone = null, string id = null);
167167

168168
/// <summary>
169169
/// Returns a list of linked accounts to the current wallet.

Thirdweb/Thirdweb.Wallets/InAppWallet/EcosystemWallet/EcosystemWallet.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,15 +332,14 @@ public string GenerateExternalLoginLink(string redirectUrl)
332332

333333
#region Account Linking
334334

335-
public async Task<List<LinkedAccount>> UnlinkAccount(UnlinkingType authProviderToUnlink, string address = null, string email = null, string phone = null, string id = null)
335+
public async Task<List<LinkedAccount>> UnlinkAccount(string linkedType, string address = null, string email = null, string phone = null, string id = null)
336336
{
337337
if (!await this.IsConnected().ConfigureAwait(false))
338338
{
339339
throw new InvalidOperationException("Cannot unlink account with a wallet that is not connected. Please login to the wallet before unlinking other wallets.");
340340
}
341341

342342
var currentAccountToken = this.EmbeddedWallet.GetSessionData()?.AuthToken;
343-
var linkedType = authProviderToUnlink.ToString();
344343
var linkedDetails = new
345344
{
346345
address,

Thirdweb/Thirdweb.Wallets/InAppWallet/InAppWallet.Types.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,6 @@ public enum AuthProvider
2626
Steam
2727
}
2828

29-
public enum UnlinkingType
30-
{
31-
apple,
32-
coinbase,
33-
discord,
34-
email,
35-
facebook,
36-
farcaster,
37-
github,
38-
google,
39-
guest,
40-
line,
41-
passkey,
42-
phone,
43-
siwe,
44-
steam,
45-
telegram,
46-
twitch,
47-
x,
48-
wallet
49-
}
50-
5129
/// <summary>
5230
/// Represents a linked account.
5331
/// </summary>

Thirdweb/Thirdweb.Wallets/PrivateKeyWallet/PrivateKeyWallet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ public virtual Task<List<LinkedAccount>> GetLinkedAccounts()
380380
throw new InvalidOperationException("GetLinkedAccounts is not supported for private key wallets.");
381381
}
382382

383-
public Task<List<LinkedAccount>> UnlinkAccount(UnlinkingType authProviderToUnlink, string address = null, string email = null, string phone = null, string id = null)
383+
public Task<List<LinkedAccount>> UnlinkAccount(string linkedType, string address = null, string email = null, string phone = null, string id = null)
384384
{
385385
throw new InvalidOperationException("UnlinkAccount is not supported for private key wallets.");
386386
}

Thirdweb/Thirdweb.Wallets/SmartWallet/SmartWallet.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,14 +1167,14 @@ public Task Disconnect()
11671167
return Task.CompletedTask;
11681168
}
11691169

1170-
public async Task<List<LinkedAccount>> UnlinkAccount(UnlinkingType authProviderToUnlink, string address = null, string email = null, string phone = null, string id = null)
1170+
public async Task<List<LinkedAccount>> UnlinkAccount(string linkedType, string address = null, string email = null, string phone = null, string id = null)
11711171
{
11721172
var personalWallet = await this.GetPersonalWallet().ConfigureAwait(false);
11731173
if (personalWallet is not InAppWallet and not EcosystemWallet)
11741174
{
11751175
throw new Exception("SmartWallet.UnlinkAccount is only supported if the signer is an InAppWallet or EcosystemWallet");
11761176
}
1177-
return await personalWallet.UnlinkAccount(authProviderToUnlink, address, email, phone, id).ConfigureAwait(false);
1177+
return await personalWallet.UnlinkAccount(linkedType, address, email, phone, id).ConfigureAwait(false);
11781178
}
11791179

11801180
public async Task<List<LinkedAccount>> LinkAccount(

0 commit comments

Comments
 (0)