diff --git a/WalletConnectSharp.Auth/Controllers/AuthEngine.cs b/WalletConnectSharp.Auth/Controllers/AuthEngine.cs index c4b206a..2fcdb53 100644 --- a/WalletConnectSharp.Auth/Controllers/AuthEngine.cs +++ b/WalletConnectSharp.Auth/Controllers/AuthEngine.cs @@ -73,7 +73,7 @@ public async Task Request(RequestParams @params, string topic = null { IsInitialized(); - @params.Type ??= new Cacao.CacaoHeader(); + @params.Type ??= "eip4361"; if (!IsValidRequest(@params)) { @@ -112,7 +112,7 @@ await this.Client.PairingTopics.Set(responseTopic, { Payload = new PayloadParams() { - Type = @params.Type ?? new Cacao.CacaoHeader(), + Type = @params.Type ?? "eip4361", ChainId = @params.ChainId, Statement = @params.Statement, Aud = @params.Aud, @@ -140,7 +140,7 @@ private async Task RequestOnKnownPairing(string topic, RequestParams { Payload = new PayloadParams() { - Type = @params.Type ?? new Cacao.CacaoHeader(), + Type = @params.Type ?? "eip4361", ChainId = @params.ChainId, Statement = @params.Statement, Aud = @params.Aud, diff --git a/WalletConnectSharp.Auth/Internals/AuthEngineValidations.cs b/WalletConnectSharp.Auth/Internals/AuthEngineValidations.cs index 93f7a07..9210c71 100644 --- a/WalletConnectSharp.Auth/Internals/AuthEngineValidations.cs +++ b/WalletConnectSharp.Auth/Internals/AuthEngineValidations.cs @@ -20,7 +20,7 @@ internal bool IsValidRequest(RequestParams @params) // const validChainId = isValidChainId(params.chainId); var domainInAud = @params.Aud.Contains(@params.Domain); var hasNonce = !string.IsNullOrWhiteSpace(@params.Nonce); - var hasValidType = @params.Type is { t: "eip4361" }; + var hasValidType = @params.Type == "eip4361"; var expiry = @params.Expiry; if (expiry != null && !Utils.IsValidRequestExpiry(expiry.Value, MinExpiry, MaxExpiry)) { diff --git a/WalletConnectSharp.Auth/Models/AuthPayload.cs b/WalletConnectSharp.Auth/Models/AuthPayload.cs index 9ef7d26..96d1c07 100644 --- a/WalletConnectSharp.Auth/Models/AuthPayload.cs +++ b/WalletConnectSharp.Auth/Models/AuthPayload.cs @@ -5,7 +5,7 @@ namespace WalletConnectSharp.Auth.Models; public class AuthPayload { [JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)] - public Cacao.CacaoHeader? Type { get; set; } + public string? Type { get; set; } [JsonProperty("chainId")] public string ChainId { get; set; } diff --git a/WalletConnectSharp.Sign/Engine.cs b/WalletConnectSharp.Sign/Engine.cs index 25b6a98..91dfb66 100644 --- a/WalletConnectSharp.Sign/Engine.cs +++ b/WalletConnectSharp.Sign/Engine.cs @@ -553,9 +553,9 @@ public async Task Request(string topic, T data, string chainId = null .OnResponse += args => { if (args.Response.IsError) - taskSource.SetException(args.Response.Error.ToException()); + taskSource.TrySetException(args.Response.Error.ToException()); else - taskSource.SetResult(args.Response.Result); + taskSource.TrySetResult(args.Response.Result); return Task.CompletedTask; };