Skip to content

Commit 1d050e3

Browse files
authored
Throw if GetEcosystemDetails is called on an InAppWallet (#139)
1 parent ef7f38d commit 1d050e3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,15 +369,30 @@ public string GetPhoneNumber()
369369
return this.PhoneNumber;
370370
}
371371

372+
/// <summary>
373+
/// Returns Ecosystem metadata (set in thirdweb Dashboard)
374+
/// </summary>
375+
/// <returns>Instance of <see cref="EcosystemDetails"/> containing metadata</returns>
376+
/// <exception cref="InvalidOperationException">Thrown when called on an InAppWallet</exception>
372377
public async Task<EcosystemDetails> GetEcosystemDetails()
373378
{
379+
if (this.GetType().Name.Contains("InAppWallet"))
380+
{
381+
throw new InvalidOperationException("Cannot get ecosystem details from an InAppWallet.");
382+
}
374383
var url = $"{EMBEDDED_WALLET_PATH_2024}/ecosystem-wallet";
375384
var response = await this.HttpClient.GetAsync(url).ConfigureAwait(false);
376385
_ = response.EnsureSuccessStatusCode();
377386
var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
378387
return JsonConvert.DeserializeObject<EcosystemDetails>(content);
379388
}
380389

390+
/// <summary>
391+
/// Returns a link that can be used to transfer the .NET wallet session to a thirdweb powered React website for seamless integration.
392+
/// </summary>
393+
/// <param name="redirectUrl">The URL of your thirdweb-powered website.</param>
394+
/// <returns>The URL to redirect the user to.</returns>
395+
/// <exception cref="InvalidOperationException">Thrown when no connected session is found</exception>
381396
public string GenerateExternalLoginLink(string redirectUrl)
382397
{
383398
var authProvider = HttpUtility.UrlEncode(this.AuthProvider.ToLower());

0 commit comments

Comments
 (0)