Skip to content

Commit 51f2a26

Browse files
committed
fix tests, add docs
1 parent a0bb8ea commit 51f2a26

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

Thirdweb.Tests/Thirdweb.Extensions/Thirdweb.Extensions.Tests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ public async Task ERC20_Approve()
442442
[Fact(Timeout = 120000)]
443443
public async Task ERC721A_TokensOfOwner()
444444
{
445-
var contract = await this.GetDrop721Contract();
445+
var contract = await this.GetERC721AContract();
446446
var ownerAddress = Constants.ADDRESS_ZERO;
447447
var tokens = await contract.ERC721A_TokensOfOwner(ownerAddress);
448448
Assert.NotNull(tokens);
@@ -452,7 +452,7 @@ public async Task ERC721A_TokensOfOwner()
452452
[Fact(Timeout = 120000)]
453453
public async Task ERC721A_TokensOfOwnerIn()
454454
{
455-
var contract = await this.GetDrop721Contract();
455+
var contract = await this.GetERC721AContract();
456456
var ownerAddress = Constants.ADDRESS_ZERO;
457457
var tokens = await contract.ERC721A_TokensOfOwnerIn(ownerAddress, 0, 1);
458458
Assert.NotNull(tokens);

Thirdweb/Thirdweb.Utils/Utils.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public static partial class Utils
2626
private static readonly Dictionary<BigInteger, bool> _eip155EnforcedCache = new();
2727
private static readonly Dictionary<BigInteger, ThirdwebChainData> _chainDataCache = new();
2828
private static readonly Dictionary<string, string> _ensCache = new();
29+
private static readonly List<string[]> _errorSubstringsComposite = new() { new string[] { "account", "not found!" }, new[] { "wrong", "chainid" } };
2930

3031
/// <summary>
3132
/// Computes the client ID from the given secret key.
@@ -305,7 +306,7 @@ public static string GenerateSIWE(LoginPayloadData loginPayloadData)
305306
/// <returns>True if it is a zkSync chain ID, otherwise false.</returns>
306307
public static async Task<bool> IsZkSync(ThirdwebClient client, BigInteger chainId)
307308
{
308-
if (chainId.Equals(324) || chainId.Equals(300) || chainId.Equals(302) || chainId.Equals(11124) || chainId.Equals(4654) || chainId.Equals(333271))
309+
if (chainId.Equals(324) || chainId.Equals(300) || chainId.Equals(302) || chainId.Equals(11124) || chainId.Equals(4654) || chainId.Equals(333271) || chainId.Equals(37111))
309310
{
310311
return true;
311312
}
@@ -659,9 +660,7 @@ public static async Task<bool> IsEip155Enforced(ThirdwebClient client, BigIntege
659660
else
660661
{
661662
// Check if all substrings in any of the composite substrings are present
662-
var errorSubstringsComposite = new List<string[]> { new string[] { "account", "not found!" }, new[] { "wrong", "chainid" } };
663-
664-
result = errorSubstringsComposite.Any(arr => arr.All(substring => errorMsg.Contains(substring)));
663+
result = _errorSubstringsComposite.Any(arr => arr.All(substring => errorMsg.Contains(substring)));
665664
}
666665
}
667666

Thirdweb/Thirdweb.Wallets/IThirdwebWallet.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,19 @@ Task<string> RecoverAddressFromTypedDataV4<T, TDomain>(T data, TypedData<TDomain
130130
/// </summary>
131131
Task Disconnect();
132132

133+
/// <summary>
134+
/// Links a new account (auth method) to the current wallet. The current wallet must be connected and the wallet being linked must not be fully connected ie created.
135+
/// </summary>
136+
/// <param name="walletToLink">The wallet to link.</param>
137+
/// <param name="otp">The OTP code if the wallet to link is an email or phone wallet.</param>
138+
/// <param name="isMobile">Set to true if linking OAuth on mobile.</param>
139+
/// <param name="browserOpenAction">The action to open the browser if linking OAuth.</param>
140+
/// <param name="mobileRedirectScheme">The redirect scheme if linking OAuth on mobile.</param>
141+
/// <param name="browser">The browser to use if linking OAuth.</param>
142+
/// <param name="chainId">The chain ID if linking an external wallet (SIWE).</param>
143+
/// <param name="jwt">The JWT token if linking custom JWT auth.</param>
144+
/// <param name="payload">The login payload if linking custom AuthEndpoint auth.</param>
145+
/// <returns>A list of <see cref="LinkedAccount"/> objects.</returns>
133146
Task<List<LinkedAccount>> LinkAccount(
134147
IThirdwebWallet walletToLink,
135148
string otp = null,
@@ -142,6 +155,10 @@ Task<List<LinkedAccount>> LinkAccount(
142155
string payload = null
143156
);
144157

158+
/// <summary>
159+
/// Returns a list of linked accounts to the current wallet.
160+
/// </summary>
161+
/// <returns>A list of <see cref="LinkedAccount"/> objects.</returns>
145162
Task<List<LinkedAccount>> GetLinkedAccounts();
146163
}
147164

0 commit comments

Comments
 (0)