Skip to content

Commit

Permalink
fix: replace cacao header type with literal string
Browse files Browse the repository at this point in the history
  • Loading branch information
gigajuwels committed Jul 20, 2023
1 parent 7e9c765 commit 752735c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions WalletConnectSharp.Auth/Controllers/AuthEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public async Task<RequestUri> Request(RequestParams @params, string topic = null
{
IsInitialized();

@params.Type ??= new Cacao.CacaoHeader();
@params.Type ??= "eip4361";

if (!IsValidRequest(@params))
{
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -140,7 +140,7 @@ private async Task<RequestUri> 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,
Expand Down
2 changes: 1 addition & 1 deletion WalletConnectSharp.Auth/Internals/AuthEngineValidations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down
2 changes: 1 addition & 1 deletion WalletConnectSharp.Auth/Models/AuthPayload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
4 changes: 2 additions & 2 deletions WalletConnectSharp.Sign/Engine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -553,9 +553,9 @@ public async Task<TR> Request<T, TR>(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;
};
Expand Down

0 comments on commit 752735c

Please sign in to comment.